diff --git a/DKTools.js b/DKTools.js index 34c5107..76e470e 100644 --- a/DKTools.js +++ b/DKTools.js @@ -3,7 +3,7 @@ Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Version: 8.2.0 +Version: 8.3.0 Release: 31.10.2019 First release: 13.01.2016 Supported languages: Russian, English @@ -14,14 +14,14 @@ Supported languages: Russian, English Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Версия: 8.2.0 +Версия: 8.3.0 Релиз: 31.10.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский */ /*: -* @plugindesc v.8.2.0 Library for RPG Maker. Made with ♥ by DKPlugins +* @plugindesc v.8.3.0 Library for RPG Maker. Made with ♥ by DKPlugins * @author DK (Denis Kuznetsov) * @help @@ -29,7 +29,7 @@ E-mail: kuznetsovdenis96@gmail.com Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru - Version: 8.2.0 + Version: 8.3.0 Release: 31.10.2019 First release: 13.01.2016 Supported languages: Russian, English @@ -288,7 +288,7 @@ E-mail: kuznetsovdenis96@gmail.com * @parent Functions * @desc Preloading resources * @type struct - * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]"} + * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]","Progress":"{\"Enabled\":\"false\",\"Background\":\"\",\"Progress Bar Width\":\"Graphics.boxWidth * 2 / 4\",\"Progress Bar Height\":\"48\",\"Progress Bar X\":\"(Graphics.boxWidth - width) * 2 / 4\",\"Progress Bar Y\":\"(Graphics.boxHeight - height) * 2 / 4\",\"Progress Bar Background Color\":\"grey\",\"Progress Bar Progress Color\":\"#33ccff\",\"Progress Bar Text\":\"Loading: %1\"}"} * @param Screenshots * @parent Functions @@ -299,7 +299,7 @@ E-mail: kuznetsovdenis96@gmail.com */ /*:ru -* @plugindesc v.8.2.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins +* @plugindesc v.8.3.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins * @author DK (Денис Кузнецов) * @help @@ -307,7 +307,7 @@ E-mail: kuznetsovdenis96@gmail.com Название: DKTools Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru - Версия: 8.2.0 + Версия: 8.3.0 Релиз: 31.10.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский @@ -588,7 +588,7 @@ E-mail: kuznetsovdenis96@gmail.com * @parent Functions * @desc Предварительная загрузка ресурсов * @type struct - * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]"} + * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]","Progress":"{\"Enabled\":\"false\",\"Background\":\"\",\"Progress Bar Width\":\"Graphics.boxWidth * 2 / 4\",\"Progress Bar Height\":\"48\",\"Progress Bar X\":\"(Graphics.boxWidth - width) * 2 / 4\",\"Progress Bar Y\":\"(Graphics.boxHeight - height) * 2 / 4\",\"Progress Bar Background Color\":\"grey\",\"Progress Bar Progress Color\":\"#33ccff\",\"Progress Bar Text\":\"Загрузка: %1\"}"} * @param Screenshots * @text Скриншоты @@ -818,7 +818,10 @@ E-mail: kuznetsovdenis96@gmail.com * @default false * @param Scene Name - * @desc Name of scene which will be launched instead the title screen. Standard: Scene_Map + * @desc Name of scene which will be launched instead the title screen. Standard: Scene_Title + * @type combo + * @option Scene_Map + * @option Scene_Title * @default Scene_Map * @param Skip Saves @@ -838,7 +841,10 @@ E-mail: kuznetsovdenis96@gmail.com * @param Scene Name * @text Название сцены - * @desc Название сцены, которая запускается вместо титульного экрана. Стандартно: Scene_Map + * @desc Название сцены, которая запускается вместо титульного экрана. Стандартно: Scene_Title + * @type combo + * @option Scene_Map + * @option Scene_Title * @default Scene_Map * @param Skip Saves @@ -911,6 +917,11 @@ E-mail: kuznetsovdenis96@gmail.com * @type struct[] * @default [] + * @param Progress Bar + * @desc Preloading process display + * @type struct + * @default {"Enabled":"false","Background":"","Progress Bar Width":"Graphics.boxWidth * 2 / 4","Progress Bar Height":"48","Progress Bar X":"(Graphics.boxWidth - width) * 2 / 4","Progress Bar Y":"(Graphics.boxHeight - height) * 2 / 4","Progress Bar Background Color":"grey","Progress Bar Progress Color":"#33ccff","Progress Bar Text":"Loading: %1"} + */ /*~struct~PreloadManager:ru @@ -939,6 +950,12 @@ E-mail: kuznetsovdenis96@gmail.com * @type struct[] * @default [] + * @param Progress Bar + * @text Прогресс + * @desc Отображение процесса предзагрузки + * @type struct + * @default {"Enabled":"false","Background":"","Progress Bar Width":"Graphics.boxWidth * 2 / 4","Progress Bar Height":"48","Progress Bar X":"(Graphics.boxWidth - width) * 2 / 4","Progress Bar Y":"(Graphics.boxHeight - height) * 2 / 4","Progress Bar Background Color":"grey","Progress Bar Progress Color":"#33ccff","Progress Bar Text":"Загрузка: %1"} + */ /*~struct~PreloadManagerImage: @@ -1012,6 +1029,155 @@ E-mail: kuznetsovdenis96@gmail.com */ +/*~struct~PreloadManagerProgressBar: + + * @param Enabled + * @desc Enable visual display of preloading ? + * @type boolean + * @default false + + * @param Background + * @desc Background picture + * @type file + * @dir img/system + + * @param Progress Bar Width + * @desc Width of the progress bar + * @type combo + * @option Graphics.boxWidth * 1 / 4 + * @option Graphics.boxWidth * 2 / 4 + * @option Graphics.boxWidth * 3 / 4 + * @default Graphics.boxWidth * 2 / 4 + + * @param Progress Bar Height + * @desc Height of the progress bar + * @type combo + * @option 36 + * @option 42 + * @option 48 + * @default 48 + + * @param Progress Bar X + * @desc The X coordinate of the progress bar + * @type combo + * @option (Graphics.boxWidth - width) * 1 / 4 + * @option (Graphics.boxWidth - width) * 2 / 4 + * @option (Graphics.boxWidth - width) * 3 / 4 + * @option (Graphics.boxWidth - width) * 1 / 5 + * @option (Graphics.boxWidth - width) * 1 / 6 + * @option (Graphics.boxWidth - width) * 4 / 5 + * @option (Graphics.boxWidth - width) * 5 / 6 + * @default (Graphics.boxWidth - width) * 2 / 4 + + * @param Progress Bar Y + * @desc The Y coordinate of the progress bar + * @type combo + * @option (Graphics.boxHeight - height) * 1 / 4 + * @option (Graphics.boxHeight - height) * 2 / 4 + * @option (Graphics.boxHeight - height) * 3 / 4 + * @option (Graphics.boxHeight - height) * 1 / 5 + * @option (Graphics.boxHeight - height) * 1 / 6 + * @option (Graphics.boxHeight - height) * 4 / 5 + * @option (Graphics.boxHeight - height) * 5 / 6 + * @default (Graphics.boxHeight - height) * 2 / 4 + + * @param Progress Bar Background Color + * @desc Progress bar background color + * @type combo + * @option grey + * @default grey + + * @param Progress Bar Progress Color + * @desc Progress bar progress color + * @type combo + * @option #33ccff + * @default #33ccff + + * @param Progress Bar Text + * @desc Progress bar text. Use to substitute: %1 - url, %2 - loaded, %3 - total + * @default Loading: %1 + +*/ + +/*~struct~PreloadManagerProgressBar:ru + + * @param Enabled + * @text Включено + * @desc Включить визуальное отображение загрузки ? + * @type boolean + * @default false + + * @param Background + * @text Фоновое изображение + * @desc Фоновое изображение + * @type file + * @dir img/system + + * @param Progress Bar Width + * @text Ширина прогресс бара + * @desc Ширина прогресс бара + * @type combo + * @option Graphics.boxWidth * 1 / 4 + * @option Graphics.boxWidth * 2 / 4 + * @option Graphics.boxWidth * 3 / 4 + * @default Graphics.boxWidth * 2 / 4 + + * @param Progress Bar Height + * @text Высота прогресс бара + * @desc Высота прогресс бара + * @type combo + * @option 36 + * @option 42 + * @option 48 + * @default 48 + + * @param Progress Bar X + * @text X прогресс бара + * @desc X прогресс бара + * @type combo + * @option (Graphics.boxWidth - width) * 1 / 4 + * @option (Graphics.boxWidth - width) * 2 / 4 + * @option (Graphics.boxWidth - width) * 3 / 4 + * @option (Graphics.boxWidth - width) * 1 / 5 + * @option (Graphics.boxWidth - width) * 1 / 6 + * @option (Graphics.boxWidth - width) * 4 / 5 + * @option (Graphics.boxWidth - width) * 5 / 6 + * @default (Graphics.boxWidth - width) * 2 / 4 + + * @param Progress Bar Y + * @text Y прогресс бара + * @desc Y прогресс бара + * @type combo + * @option (Graphics.boxHeight - height) * 1 / 4 + * @option (Graphics.boxHeight - height) * 2 / 4 + * @option (Graphics.boxHeight - height) * 3 / 4 + * @option (Graphics.boxHeight - height) * 1 / 5 + * @option (Graphics.boxHeight - height) * 1 / 6 + * @option (Graphics.boxHeight - height) * 4 / 5 + * @option (Graphics.boxHeight - height) * 5 / 6 + * @default (Graphics.boxHeight - height) * 2 / 4 + + * @param Progress Bar Background Color + * @text Фон прогресс бара + * @desc Фон прогресс бара в веб формате + * @type combo + * @option grey + * @default grey + + * @param Progress Bar Progress Color + * @text Цвет прогресс бара + * @desc Цвет прогресс бара в веб формате + * @type combo + * @option #33ccff + * @default #33ccff + + * @param Progress Bar Text + * @text Текст прогресс бара + * @desc Текст прогресс бара. Используйте, чтобы подставить: %1 - файл, %2 - загружено, %3 - всего + * @default Загрузка: %1 + +*/ + /*~struct~Screenshots: * @param Enabled @@ -1505,7 +1671,7 @@ E-mail: kuznetsovdenis96@gmail.com * @type {Object} */ window.Imported = window.Imported || {}; -window.Imported.DKTools = '8.2.0'; +window.Imported.DKTools = '8.3.0'; @@ -6174,7 +6340,7 @@ DKTools.IO.File = class extends DKTools.IO.Entity { * DKTools.IO.ERROR_DECOMPRESSING_DATA * DKTools.IO.ERROR_PARSING_DATA * - * @version 8.0.0 + * @version 8.3.0 * * @param {Object} object - Options of an operation * @@ -6184,6 +6350,7 @@ DKTools.IO.File = class extends DKTools.IO.Entity { * @param {Function} [object.onError] - Callback function upon completion of an operation with error (only for object.sync == false) * @param {Boolean} [object.decompress] - Use LZString.decompressFromBase64 for a data * @param {Boolean | Object} [object.parse] - Use JSON.parse for a data + * @param {String} [object.mimeType] - Mime type (only for XMLHttpRequest) * * @param {String} [object.options.encoding] - Encoding * @param {String} [object.options.flag] - File system flag @@ -6221,10 +6388,6 @@ DKTools.IO.File = class extends DKTools.IO.Entity { return { data: null, status: DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE }; } - if (!object.sync && !DKTools.Utils.isFunction(object.onSuccess)) { - return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; - } - const absolutePath = this.getAbsolutePath(); const processData = (data) => { if (data) { @@ -6265,6 +6428,10 @@ DKTools.IO.File = class extends DKTools.IO.Entity { this.__processError(error, object.onError); } } else { + if (!DKTools.Utils.isFunction(object.onSuccess)) { + return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; + } + fs.readFile(absolutePath, options, (error, data) => { if (error) { this.__processError(error, object.onError); @@ -6274,6 +6441,10 @@ DKTools.IO.File = class extends DKTools.IO.Entity { }); } } else { + if (!DKTools.Utils.isFunction(object.onSuccess)) { + return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; + } + if (DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP && this.getFullName() !== 'Stamp.json' && !this.exists()) { return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST }; } @@ -9447,32 +9618,33 @@ DKTools.PreloadManager = class { /** * Initializes the manager * + * @version 8.3.0 * @static */ static initialize() { this.clearCache(); - const param = DKToolsParam.get('Preload Manager'); + const params = DKToolsParam.get('Preload Manager'); /** * @private * @readonly * @type {Boolean} */ - this._enabled = param['Enabled']; + this._enabled = params['Enabled']; if (!this.isEnabled()) { return; } - _.forEach(param['Audio Files'], data => { + params['Audio Files'].forEach((data) => { this.preloadAudio({ path: data.Path, caching: data.Caching }); }); - _.forEach(param['Image Files'], data => { + params['Image Files'].forEach((data) => { this.preloadImage({ path: data.Path, hue: data.Hue, @@ -9480,7 +9652,24 @@ DKTools.PreloadManager = class { }); }); - this.start(); + const progressParams = params['Progress Bar']; + let start = false; + + if (!progressParams.Enabled) { + start = true; + + this.onFileLoad(() => { + Graphics.updateLoading(); + }); + + this.onFinish(() => { + Graphics.endLoading(); + }); + } + + if (start) { + this.start(); + } } // C methods @@ -9520,6 +9709,7 @@ DKTools.PreloadManager = class { /** * Finishes the preloading * + * @version 8.3.0 * @private * @static * @@ -9530,11 +9720,33 @@ DKTools.PreloadManager = class { this.clearQueue(); + const preloadingTime = (this._finishTime - this._startTime) / 1000; + const total = this.getTotal(); + this._log('Preloading complete! \n' + - 'Loaded/Skipped/Total: ' + this._loaded + '/' + this._skipped + '/' + this._total + '\n' + - 'Preloading time: ' + (this._finishTime - this._startTime) / 1000 + ' sec'); + 'Loaded/Skipped/Total: ' + this._loaded + '/' + this._skipped + '/' + total + '\n' + + 'Preloading time: ' + preloadingTime + ' sec'); + + if (this._finishListeners) { + const data = { + loaded: this._loaded, + skipped: this._skipped, + preloadingTime, + total + }; + + while (this._finishListeners.length > 0) { + const handler = this._finishListeners.shift(); + + handler(data); + } - Graphics.endLoading(); + delete this._finishListeners; + } + + if (this._fileLoadListeners) { + delete this._fileLoadListeners; + } } // G methods @@ -9634,6 +9846,19 @@ DKTools.PreloadManager = class { return this.getCachedImageByKey(this._generateImageKey(path)); } + /** + * Returns the total amount of resources to preload + * + * @static + * + * @since 8.3.0 + * + * @returns {Number} Total amount of resources to preload + */ + static getTotal() { + return _.size(this._queue.audio) + _.size(this._queue.image); + } + // I methods /** @@ -9754,6 +9979,7 @@ DKTools.PreloadManager = class { /** * Processes the loading of the data * + * @version 8.3.0 * @since 5.0.0 * @private * @static @@ -9765,7 +9991,57 @@ DKTools.PreloadManager = class { this._log(`Loaded ${data instanceof WebAudio ? 'audio': 'image'}: ${data.url}`); - Graphics.updateLoading(); + if (this._fileLoadListeners) { + const obj = { + file: data, + loadded: this._loaded, + total: this.getTotal() + }; + + this._fileLoadListeners.forEach((callback) => { + callback(obj); + }); + } + } + + /** + * Adds a callback function to handle file load + * All callback functions will be cleared after the preload is finished + * Callback function takes 1 argument - object with following properties: + * file (WebAudio or Bitmap), loaded, total + * + * @static + * + * @since 8.3.0 + * + * @param {Function} callback + */ + static onFileLoad(callback) { + if (!this._fileLoadListeners) { + this._fileLoadListeners = []; + } + + this._fileLoadListeners.push(callback); + } + + /** + * Adds a callback function to handle finish of preloading + * All callback functions will be cleared after the preload is finished + * Callback function takes 1 argument - object with following properties: + * loaded, skipped, preloadingTime (seconds), total + * + * @static + * + * @since 8.3.0 + * + * @param {Function} callback + */ + static onFinish(callback) { + if (!this._finishListeners) { + this._finishListeners = []; + } + + this._finishListeners.push(callback); } // P methods @@ -9804,7 +10080,7 @@ DKTools.PreloadManager = class { files = entity.getImageFiles(options).data; } - _.forEach(files, file => { + files.forEach((file) => { const fullPath = file.getFullPath(); if (this._queue[type][fullPath]) { @@ -9853,7 +10129,7 @@ DKTools.PreloadManager = class { static _processLoadAudioFiles() { const buffers = []; - _.forEach(this._queue.audio, data => { + _.forEach(this._queue.audio, (data) => { const file = new DKTools.IO.File(data.path); const fullPath = file.getFullPath(); @@ -9888,7 +10164,7 @@ DKTools.PreloadManager = class { } }); - return _.map(buffers, buffer => DKTools.Utils.WebAudio.loadAsync(buffer).then(() => this._onFileLoad(buffer))); + return buffers.map(buffer => DKTools.Utils.WebAudio.loadAsync(buffer).then(() => this._onFileLoad(buffer))); } /** @@ -9903,7 +10179,7 @@ DKTools.PreloadManager = class { static _processLoadImageFiles() { const bitmaps = []; - _.forEach(this._queue.image, data => { + _.forEach(this._queue.image, (data) => { const file = new DKTools.IO.File(data.path); const fullPath = file.getFullPath(); @@ -9942,7 +10218,7 @@ DKTools.PreloadManager = class { } }); - return _.map(bitmaps, bitmap => DKTools.Utils.Bitmap.loadAsync(bitmap).then(() => this._onFileLoad(bitmap))); + return bitmaps.map(bitmap => DKTools.Utils.Bitmap.loadAsync(bitmap).then(() => this._onFileLoad(bitmap))); } /** @@ -10039,7 +10315,7 @@ DKTools.PreloadManager = class { /** * Starts the preloading * - * @version 5.0.0 + * @version 8.3.0 * @static */ static start() { @@ -10047,25 +10323,27 @@ DKTools.PreloadManager = class { return; } + const total = this.getTotal(); + this._loaded = 0; this._skipped = 0; - this._total = _.size(this._queue.audio) + _.size(this._queue.image); this._startTime = new Date(); this._finishTime = null; - this._log('DKTools Preload Manager is running... \n' + - 'Total files to load: ' + this._total); - - if (this._total === 0) { + if (total === 0) { this._finish(); return; } + this._log('DKTools Preload Manager is running... \n' + + 'Total files to load: ' + total); + const audioPromise = Promise.all(this._processLoadAudioFiles()); const imagePromise = Promise.all(this._processLoadImageFiles()); - Promise.all([audioPromise, imagePromise]).then(() => this._finish()); + Promise.all([audioPromise, imagePromise]) + .then(() => this._finish()); } }; @@ -10143,12 +10421,12 @@ DKTools.StartupManager = class { /** * Initializes modules * - * @version 7.0.0 + * @version 8.3.0 * @static * @async */ static async initializeModules() { - // to be overridden by plugins + DKTools.PreloadManager.initialize(); } // C methods @@ -15622,6 +15900,7 @@ DKTools.Base = class { /** * Turns off the option * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String} option - Name of the option @@ -15635,6 +15914,7 @@ DKTools.Base = class { /** * Turns off the options * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -16591,6 +16871,7 @@ DKTools.Base = class { /** * Turns on the option * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String} option - Name of the option @@ -16604,6 +16885,7 @@ DKTools.Base = class { /** * Turns on the options * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -19051,6 +19333,7 @@ DKTools.Base = class { /** * Switches the option * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String} option - Name of the option @@ -19064,6 +19347,7 @@ DKTools.Base = class { /** * Switches the options * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -30161,12 +30445,10 @@ DKTools.Sprite.ProgressBar.Rectangle = class extends DKTools.Sprite.ProgressBar */ standardDrawGraphicHandler() { return () => { - let handler; + let handler = this.standardVerticalDrawGraphicHandler(); if (this.isHorizontal()) { handler = this.standardHorizontalDrawGraphicHandler(); - } else { - handler = this.standardVerticalDrawGraphicHandler(); } if (DKTools.Utils.isFunction(handler)) { @@ -36037,6 +36319,7 @@ DKTools.Scene.prototype._addAllChildren = function() { /** * Adds a listener of change of the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -36175,6 +36458,7 @@ DKTools.Scene.prototype._createEventManager = function() { /** * Clears the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @see DKTools.OptionManager.prototype.clear @@ -36186,6 +36470,7 @@ DKTools.Scene.prototype.clearOptions = function() { /** * Clears the events * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String[] | String} object Array with event types or event type @@ -36261,7 +36546,8 @@ DKTools.Scene.prototype.createForeground = function() { DKTools.Scene.prototype.destroy = function(options) { this._clearAll(); - this.clearEvents(); + this._eventManager.clearEvents(); + this.deactivate(); Stage.prototype.destroy.call(this, options); @@ -36270,6 +36556,7 @@ DKTools.Scene.prototype.destroy = function(options) { /** * Turns off the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -36283,6 +36570,7 @@ DKTools.Scene.prototype.disableOption = function(option) { /** * Turns off the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -36298,6 +36586,7 @@ DKTools.Scene.prototype.disableOptions = function(object) { /** * Turns on the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -36311,6 +36600,7 @@ DKTools.Scene.prototype.enableOption = function(option) { /** * Turns on the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -36326,6 +36616,7 @@ DKTools.Scene.prototype.enableOptions = function(object) { /** * Finishes the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -36342,6 +36633,7 @@ DKTools.Scene.prototype.finishEvents = function(type, forcedSuccess = false) { /** * Returns a container for the events by event type * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -36357,6 +36649,7 @@ DKTools.Scene.prototype.getEventsContainerByType = function(type) { /** * Returns a container for the events by event * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -36372,6 +36665,7 @@ DKTools.Scene.prototype.getEventsContainer = function(event) { /** * Returns an index of the event in its container * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -36387,6 +36681,7 @@ DKTools.Scene.prototype.getEventIndex = function(event) { /** * Returns an array with the all events or events of a certain type * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} [type] - Type of the events @@ -36402,6 +36697,7 @@ DKTools.Scene.prototype.getEvents = function(type) { /** * Returns an array with the all animations or animations of a certain type * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} [type] - Type of animation @@ -36429,6 +36725,7 @@ DKTools.Scene.prototype.hasWindowLayer = function() { * Checks for existence of the event in the object * Returns true if the event exists * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -36445,6 +36742,7 @@ DKTools.Scene.prototype.hasEvent = function(event) { * Checks for existence of the events of a certain type * Returns true if the events exists * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} [type] - Type of the Events @@ -36461,6 +36759,7 @@ DKTools.Scene.prototype.hasEvents = function(type) { * Checks for existence of the animation in the object * Returns true if the animation exists * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Animation} animation - Animation @@ -36477,6 +36776,7 @@ DKTools.Scene.prototype.hasAnimation = function(animation) { * Checks for existence of the animations of a certain type * Returns true if the animations exists * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} [type] - Type of the animations @@ -36497,7 +36797,7 @@ DKTools.Scene.prototype.hasAnimations = function(type) { * @param {Function} callback - Function for the child objects */ DKTools.Scene.prototype.iterateChildren = function(callback) { - _.forEach(this.children, callback); + this.children.forEach(callback); }; /** @@ -36509,10 +36809,10 @@ DKTools.Scene.prototype.iterateChildren = function(callback) { */ DKTools.Scene.prototype.isChild = function(object) { if (object instanceof Window && this.hasWindowLayer()) { - return DKTools.Utils.Array.contains(this._windowLayer.children, object); + return this._windowLayer.children.includes(object); } - return DKTools.Utils.Array.contains(this.children, object); + return this.children.includes(object); }; /** @@ -36529,6 +36829,7 @@ DKTools.Scene.prototype.isDestroyed = function() { /** * Returns true if the option is enabled * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -36544,6 +36845,7 @@ DKTools.Scene.prototype.isOptionEnabled = function(option) { /** * Returns conjunction of the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -36559,6 +36861,7 @@ DKTools.Scene.prototype.isOptionsEnabled = function(object) { /** * Returns disjunction of the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -36574,6 +36877,7 @@ DKTools.Scene.prototype.isSomeOptionsEnabled = function(object) { /** * Returns true if the option is disabled * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -36589,6 +36893,7 @@ DKTools.Scene.prototype.isOptionDisabled = function(option) { /** * Returns conjunction of the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -36604,6 +36909,7 @@ DKTools.Scene.prototype.isOptionsDisabled = function(object) { /** * Returns disjunction of the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -36619,6 +36925,7 @@ DKTools.Scene.prototype.isSomeOptionsDisabled = function(object) { /** * Returns true if some option is enabled * + * @deprecated 8.3.0 * @since 2.0.0 * * @see DKTools.OptionManager.prototype.isSomeOptionEnabled @@ -36632,6 +36939,7 @@ DKTools.Scene.prototype.isSomeOptionEnabled = function() { /** * Performs a callback function for the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -36647,6 +36955,7 @@ DKTools.Scene.prototype.iterateEventsContainer = function(type, callback) { * Checks the events for pause * Returns the conjunction of pauses of the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -36664,6 +36973,7 @@ DKTools.Scene.prototype.isEventsPaused = function(type) { /** * Pauses the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -36680,6 +36990,7 @@ DKTools.Scene.prototype.pauseEvents = function(type, duration) { /** * Removes the listener of change of the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -36695,6 +37006,7 @@ DKTools.Scene.prototype.removeOptionChangeListener = function(option, listener) * Removes the event from a container * Returns true if the event was removed * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -36710,6 +37022,7 @@ DKTools.Scene.prototype.removeEvent = function(event) { /** * Resumes the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -36722,13 +37035,22 @@ DKTools.Scene.prototype.resumeEvents = function(type) { /** * Removes the window from the scene + * Returns true if the window is removed + * + * @version 8.3.0 * * @param {DKTools.Window | *} window - Window to remove + * + * @returns {Boolean} Window is removed */ DKTools.Scene.prototype.removeWindow = function(window) { if (this.hasWindowLayer() && this.isChild(window)) { this._windowLayer.removeChild(window); + + return true; } + + return false; }; // S methods @@ -36827,6 +37149,7 @@ DKTools.Scene.prototype.stopAll = function() { /** * Stops the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -36841,6 +37164,7 @@ DKTools.Scene.prototype.stopEvents = function(type, forcedSuccess = false) { /** * Switches the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -36854,6 +37178,7 @@ DKTools.Scene.prototype.switchOption = function(option) { /** * Switches the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -36947,6 +37272,7 @@ DKTools.Scene.prototype.updateEvents = function() { /** * Updates the event * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -36960,6 +37286,7 @@ DKTools.Scene.prototype.updateEvent = function(event) { /** * Updates the events from container * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -36973,39 +37300,42 @@ DKTools.Scene.prototype.updateEventsContainer = function(type) { /** * Updates the events with type: ready * + * @version 8.3.0 * @since 2.0.0 * * @see DKTools.EventManager.prototype.updateEventsContainer */ DKTools.Scene.prototype.updateReadyEvents = function() { if (this.isReady()) { - this.updateEventsContainer('ready'); + this._eventManager.updateEventsContainer('ready'); } }; /** * Updates the events with type: update * + * @version 8.3.0 * @since 2.0.0 * * @see DKTools.EventManager.prototype.updateEventsContainer */ DKTools.Scene.prototype.updateUpdateEvents = function() { - this.updateEventsContainer('update'); + this._eventManager.updateEventsContainer('update'); }; /** * Updates the events with type: queue * + * @version 8.3.0 * @since 2.0.0 * * @see DKTools.EventManager.prototype.updateEventsContainer */ DKTools.Scene.prototype.updateQueueEvents = function() { - const container = this.getEventsContainerByType('queue'); + const container = this._eventManager.getEventsContainerByType('queue'); const event = container[0]; - this.updateEvent(event); + this._eventManager.updateEvent(event); }; @@ -37809,7 +38139,7 @@ DataManager.isDatabaseLoaded = function() { }; DataManager.onDatabaseLoad = function() { - DKTools.PreloadManager.initialize(); + // to be overriden by plugins }; @@ -38193,15 +38523,95 @@ Scene_Base.prototype.terminate = function() { // Scene_Boot //=========================================================================== +const DKTools_Scene_Boot_create = Scene_Boot.prototype.create; +Scene_Boot.prototype.create = function() { + DKTools_Scene_Boot_create.call(this); + + const params = DKToolsParam.get('Preload Manager', 'Progress Bar'); + + this._showProgressBar = params.Enabled && DKTools.PreloadManager.isEnabled(); + + if (this._showProgressBar) { + if (params.Background) { + this._background = new DKTools.Sprite(); + + this._background.loadSystem(params.Background); + + this.addChild(this._background); + } + + this.createProgressBar(params); + } +}; + +Scene_Boot.prototype.createProgressBar = function(params) { + const width = eval(params['Progress Bar Width']); + const height = eval(params['Progress Bar Height']); + const x = eval(params['Progress Bar X']); + const y = eval(params['Progress Bar Y']); + + this._progressBar = new DKTools.Sprite.ProgressBar.Rectangle(x, y, width, height); + + this._progressBar.setupBackgroundColor(params['Progress Bar Background Color']) + this._progressBar.setupProgressColor(params['Progress Bar Progress Color']); + this._progressBar.setupMaxValue(DKTools.PreloadManager.getTotal()); + this._progressBar.setupValue(0); + + this._progressBar.start(); + + this._progressBar.setupDrawTextHandler(function() { + const text = params['Progress Bar Text'].format(...this._data); + + this.drawText(text, { height: this.height }); + }.bind(this._progressBar)); + + this.addChild(this._progressBar); +}; + const DKTools_Scene_Boot_isReady = Scene_Boot.prototype.isReady; Scene_Boot.prototype.isReady = function() { - return DKTools_Scene_Boot_isReady.call(this) - && DKTools.StartupManager.isReady() - && DKTools.PreloadManager.isReady(); + if (!DKTools_Scene_Boot_isReady.call(this) || !DKTools.StartupManager.isReady()) { + return false; + } + + if (!this._showProgressBar) { + return DKTools.PreloadManager.isReady(); + } + + return true; }; const DKTools_Scene_Boot_start = Scene_Boot.prototype.start; Scene_Boot.prototype.start = function() { + if (this._showProgressBar && !DKTools.PreloadManager.isFinished()) { + const total = DKTools.PreloadManager.getTotal(); + const maxFrames = 180; + const repeatTime = (total > maxFrames ? 1 : Math.ceil(maxFrames / total)); + + DKTools.PreloadManager.onFileLoad((data) => { + this._progressBar.addEvent({ + type: 'queue', + repeats: 0, + repeatTime, + onStart: () => { + this._progressBar._data = [data.file.url, data.loaded, data.total]; + this._progressBar.nextValue(); + } + }); + }); + + this._progressBar.addOneTimeEvent({ + type: 'full', + onSuccess: () => { + this.start(); + } + }); + + DKTools.PreloadManager.start(); + + return; + } + const quickStart = DKToolsParam.get('Quick Start'); if (quickStart['Enabled']) { diff --git a/README.md b/README.md index 0841d8b..40c8c2a 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ **Author**: DK -**Version**: Public 8.2.0 +**Version**: Public 8.3.0 **Description**: Library for RPG Maker MV. Contains many tools for developing. diff --git a/dev/DKTools.js b/dev/DKTools.js index c2d5c5c..dad9822 100644 --- a/dev/DKTools.js +++ b/dev/DKTools.js @@ -3,7 +3,7 @@ Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Version: 8.2.0 +Version: 8.3.0 Release: 31.10.2019 First release: 13.01.2016 Supported languages: Russian, English @@ -14,14 +14,14 @@ Supported languages: Russian, English Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Версия: 8.2.0 +Версия: 8.3.0 Релиз: 31.10.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский */ /*: -* @plugindesc v.8.2.0 Library for RPG Maker. Made with ♥ by DKPlugins +* @plugindesc v.8.3.0 Library for RPG Maker. Made with ♥ by DKPlugins * @author DK (Denis Kuznetsov) * @help @@ -29,7 +29,7 @@ E-mail: kuznetsovdenis96@gmail.com Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru - Version: 8.2.0 + Version: 8.3.0 Release: 31.10.2019 First release: 13.01.2016 Supported languages: Russian, English @@ -288,7 +288,7 @@ E-mail: kuznetsovdenis96@gmail.com * @parent Functions * @desc Preloading resources * @type struct - * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]"} + * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]","Progress":"{\"Enabled\":\"false\",\"Background\":\"\",\"Progress Bar Width\":\"Graphics.boxWidth * 2 / 4\",\"Progress Bar Height\":\"48\",\"Progress Bar X\":\"(Graphics.boxWidth - width) * 2 / 4\",\"Progress Bar Y\":\"(Graphics.boxHeight - height) * 2 / 4\",\"Progress Bar Background Color\":\"grey\",\"Progress Bar Progress Color\":\"#33ccff\",\"Progress Bar Text\":\"Loading: %1\"}"} * @param Screenshots * @parent Functions @@ -299,7 +299,7 @@ E-mail: kuznetsovdenis96@gmail.com */ /*:ru -* @plugindesc v.8.2.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins +* @plugindesc v.8.3.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins * @author DK (Денис Кузнецов) * @help @@ -307,7 +307,7 @@ E-mail: kuznetsovdenis96@gmail.com Название: DKTools Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru - Версия: 8.2.0 + Версия: 8.3.0 Релиз: 31.10.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский @@ -588,7 +588,7 @@ E-mail: kuznetsovdenis96@gmail.com * @parent Functions * @desc Предварительная загрузка ресурсов * @type struct - * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]"} + * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]","Progress":"{\"Enabled\":\"false\",\"Background\":\"\",\"Progress Bar Width\":\"Graphics.boxWidth * 2 / 4\",\"Progress Bar Height\":\"48\",\"Progress Bar X\":\"(Graphics.boxWidth - width) * 2 / 4\",\"Progress Bar Y\":\"(Graphics.boxHeight - height) * 2 / 4\",\"Progress Bar Background Color\":\"grey\",\"Progress Bar Progress Color\":\"#33ccff\",\"Progress Bar Text\":\"Загрузка: %1\"}"} * @param Screenshots * @text Скриншоты @@ -818,7 +818,10 @@ E-mail: kuznetsovdenis96@gmail.com * @default false * @param Scene Name - * @desc Name of scene which will be launched instead the title screen. Standard: Scene_Map + * @desc Name of scene which will be launched instead the title screen. Standard: Scene_Title + * @type combo + * @option Scene_Map + * @option Scene_Title * @default Scene_Map * @param Skip Saves @@ -838,7 +841,10 @@ E-mail: kuznetsovdenis96@gmail.com * @param Scene Name * @text Название сцены - * @desc Название сцены, которая запускается вместо титульного экрана. Стандартно: Scene_Map + * @desc Название сцены, которая запускается вместо титульного экрана. Стандартно: Scene_Title + * @type combo + * @option Scene_Map + * @option Scene_Title * @default Scene_Map * @param Skip Saves @@ -911,6 +917,11 @@ E-mail: kuznetsovdenis96@gmail.com * @type struct[] * @default [] + * @param Progress Bar + * @desc Preloading process display + * @type struct + * @default {"Enabled":"false","Background":"","Progress Bar Width":"Graphics.boxWidth * 2 / 4","Progress Bar Height":"48","Progress Bar X":"(Graphics.boxWidth - width) * 2 / 4","Progress Bar Y":"(Graphics.boxHeight - height) * 2 / 4","Progress Bar Background Color":"grey","Progress Bar Progress Color":"#33ccff","Progress Bar Text":"Loading: %1"} + */ /*~struct~PreloadManager:ru @@ -939,6 +950,12 @@ E-mail: kuznetsovdenis96@gmail.com * @type struct[] * @default [] + * @param Progress Bar + * @text Прогресс + * @desc Отображение процесса предзагрузки + * @type struct + * @default {"Enabled":"false","Background":"","Progress Bar Width":"Graphics.boxWidth * 2 / 4","Progress Bar Height":"48","Progress Bar X":"(Graphics.boxWidth - width) * 2 / 4","Progress Bar Y":"(Graphics.boxHeight - height) * 2 / 4","Progress Bar Background Color":"grey","Progress Bar Progress Color":"#33ccff","Progress Bar Text":"Загрузка: %1"} + */ /*~struct~PreloadManagerImage: @@ -1012,6 +1029,155 @@ E-mail: kuznetsovdenis96@gmail.com */ +/*~struct~PreloadManagerProgressBar: + + * @param Enabled + * @desc Enable visual display of preloading ? + * @type boolean + * @default false + + * @param Background + * @desc Background picture + * @type file + * @dir img/system + + * @param Progress Bar Width + * @desc Width of the progress bar + * @type combo + * @option Graphics.boxWidth * 1 / 4 + * @option Graphics.boxWidth * 2 / 4 + * @option Graphics.boxWidth * 3 / 4 + * @default Graphics.boxWidth * 2 / 4 + + * @param Progress Bar Height + * @desc Height of the progress bar + * @type combo + * @option 36 + * @option 42 + * @option 48 + * @default 48 + + * @param Progress Bar X + * @desc The X coordinate of the progress bar + * @type combo + * @option (Graphics.boxWidth - width) * 1 / 4 + * @option (Graphics.boxWidth - width) * 2 / 4 + * @option (Graphics.boxWidth - width) * 3 / 4 + * @option (Graphics.boxWidth - width) * 1 / 5 + * @option (Graphics.boxWidth - width) * 1 / 6 + * @option (Graphics.boxWidth - width) * 4 / 5 + * @option (Graphics.boxWidth - width) * 5 / 6 + * @default (Graphics.boxWidth - width) * 2 / 4 + + * @param Progress Bar Y + * @desc The Y coordinate of the progress bar + * @type combo + * @option (Graphics.boxHeight - height) * 1 / 4 + * @option (Graphics.boxHeight - height) * 2 / 4 + * @option (Graphics.boxHeight - height) * 3 / 4 + * @option (Graphics.boxHeight - height) * 1 / 5 + * @option (Graphics.boxHeight - height) * 1 / 6 + * @option (Graphics.boxHeight - height) * 4 / 5 + * @option (Graphics.boxHeight - height) * 5 / 6 + * @default (Graphics.boxHeight - height) * 2 / 4 + + * @param Progress Bar Background Color + * @desc Progress bar background color + * @type combo + * @option grey + * @default grey + + * @param Progress Bar Progress Color + * @desc Progress bar progress color + * @type combo + * @option #33ccff + * @default #33ccff + + * @param Progress Bar Text + * @desc Progress bar text. Use to substitute: %1 - url, %2 - loaded, %3 - total + * @default Loading: %1 + +*/ + +/*~struct~PreloadManagerProgressBar:ru + + * @param Enabled + * @text Включено + * @desc Включить визуальное отображение загрузки ? + * @type boolean + * @default false + + * @param Background + * @text Фоновое изображение + * @desc Фоновое изображение + * @type file + * @dir img/system + + * @param Progress Bar Width + * @text Ширина прогресс бара + * @desc Ширина прогресс бара + * @type combo + * @option Graphics.boxWidth * 1 / 4 + * @option Graphics.boxWidth * 2 / 4 + * @option Graphics.boxWidth * 3 / 4 + * @default Graphics.boxWidth * 2 / 4 + + * @param Progress Bar Height + * @text Высота прогресс бара + * @desc Высота прогресс бара + * @type combo + * @option 36 + * @option 42 + * @option 48 + * @default 48 + + * @param Progress Bar X + * @text X прогресс бара + * @desc X прогресс бара + * @type combo + * @option (Graphics.boxWidth - width) * 1 / 4 + * @option (Graphics.boxWidth - width) * 2 / 4 + * @option (Graphics.boxWidth - width) * 3 / 4 + * @option (Graphics.boxWidth - width) * 1 / 5 + * @option (Graphics.boxWidth - width) * 1 / 6 + * @option (Graphics.boxWidth - width) * 4 / 5 + * @option (Graphics.boxWidth - width) * 5 / 6 + * @default (Graphics.boxWidth - width) * 2 / 4 + + * @param Progress Bar Y + * @text Y прогресс бара + * @desc Y прогресс бара + * @type combo + * @option (Graphics.boxHeight - height) * 1 / 4 + * @option (Graphics.boxHeight - height) * 2 / 4 + * @option (Graphics.boxHeight - height) * 3 / 4 + * @option (Graphics.boxHeight - height) * 1 / 5 + * @option (Graphics.boxHeight - height) * 1 / 6 + * @option (Graphics.boxHeight - height) * 4 / 5 + * @option (Graphics.boxHeight - height) * 5 / 6 + * @default (Graphics.boxHeight - height) * 2 / 4 + + * @param Progress Bar Background Color + * @text Фон прогресс бара + * @desc Фон прогресс бара в веб формате + * @type combo + * @option grey + * @default grey + + * @param Progress Bar Progress Color + * @text Цвет прогресс бара + * @desc Цвет прогресс бара в веб формате + * @type combo + * @option #33ccff + * @default #33ccff + + * @param Progress Bar Text + * @text Текст прогресс бара + * @desc Текст прогресс бара. Используйте, чтобы подставить: %1 - файл, %2 - загружено, %3 - всего + * @default Загрузка: %1 + +*/ + /*~struct~Screenshots: * @param Enabled @@ -1494,4 +1660,4 @@ E-mail: kuznetsovdenis96@gmail.com */ -!function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";(function(t){var n;window.Imported=window.Imported||{},window.Imported.DKTools="8.2.0",function(){function s(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function r(t,e,i,n){for(var s=-1,r=null==t?0:t.length;++s"']/g,q=RegExp(G.source),$=RegExp(X.source),Y=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,nt=RegExp(it.source),st=/^\s+|\s+$/g,rt=/^\s+/,ot=/\s+$/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,lt=/\{\n\/\* \[wrapped with (.+)\] \*/,ht=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,Tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Dt=/($^)/,vt=/['\n\r\u2028\u2029\\]/g,wt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",St="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+wt,bt=RegExp("['’]","g"),Kt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),At=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+wt,"g"),Ot=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",St].join("|"),"g"),It=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Ct=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Et="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),xt={};xt["[object Float32Array]"]=xt["[object Float64Array]"]=xt["[object Int8Array]"]=xt["[object Int16Array]"]=xt["[object Int32Array]"]=xt["[object Uint8Array]"]=xt["[object Uint8ClampedArray]"]=xt["[object Uint16Array]"]=xt["[object Uint32Array]"]=!0,xt["[object Arguments]"]=xt["[object Array]"]=xt["[object ArrayBuffer]"]=xt["[object Boolean]"]=xt["[object DataView]"]=xt["[object Date]"]=xt["[object Error]"]=xt["[object Function]"]=xt["[object Map]"]=xt["[object Number]"]=xt["[object Object]"]=xt["[object RegExp]"]=xt["[object Set]"]=xt["[object String]"]=xt["[object WeakMap]"]=!1;var Pt={};Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object DataView]"]=Pt["[object Boolean]"]=Pt["[object Date]"]=Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object Symbol]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object WeakMap]"]=!1;var Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mt=parseFloat,Bt=parseInt,Ft="object"==typeof global&&global&&global.Object===Object&&global,Lt="object"==typeof self&&self&&self.Object===Object&&self,Ht=Ft||Lt||Function("return this")(),kt=e&&!e.nodeType&&e,Ut=kt&&"object"==typeof t&&t&&!t.nodeType&&t,Wt=Ut&&Ut.exports===kt,jt=Wt&&Ft.process,Nt=function(){try{var t=Ut&&Ut.require&&Ut.require("util").types;return t||jt&&jt.binding&&jt.binding("util")}catch(t){}}(),zt=Nt&&Nt.isArrayBuffer,Vt=Nt&&Nt.isDate,Gt=Nt&&Nt.isMap,Xt=Nt&&Nt.isRegExp,qt=Nt&&Nt.isSet,$t=Nt&&Nt.isTypedArray,Yt=w("length"),Jt=S({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Zt=S({"&":"&","<":"<",">":">",'"':""","'":"'"}),Qt=S({"&":"&","<":"<",">":">",""":'"',"'":"'"}),te=function t(e){function i(t){if(Nn(t)&&!xo(t)&&!(t instanceof wt)){if(t instanceof S)return t;if(xs.call(t,"__wrapped__"))return gn(t)}return new S(t)}function n(){}function S(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=k}function wt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function St(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function oe(t,e,i,n,s,r){var a,l=1&e,h=2&e,u=4&e;if(i&&(a=s?i(t,n,s,r):i(t)),a!==k)return a;if(!jn(t))return t;if(n=xo(t)){if(a=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&xs.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return fi(t,a)}else{var c=Ur(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(Ro(t))return li(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!s){if(a=h||p?{}:Zi(t),!l)return h?function(t,e){return gi(t,kr(t),e)}(t,function(t,e){return t&&gi(e,ss(e),t)}(a,t)):function(t,e){return gi(t,Hr(t),e)}(t,ie(a,t))}else{if(!Pt[c])return s?t:{};a=function(t,e,i){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return hi(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return e=i?hi(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ui(t,i);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return(e=new t.constructor(t.source,dt.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new n;case"[object Symbol]":return Ar?Ss(Ar.call(t)):{}}}(t,c,l)}}if(r||(r=new Lt),s=r.get(t))return s;if(r.set(t,a),Lo(t))return t.forEach(function(n){a.add(oe(n,e,i,n,t,r))}),a;if(Bo(t))return t.forEach(function(n,s){a.set(s,oe(n,e,i,s,t,r))}),a;h=u?h?zi:Ni:h?ss:ns;var d=n?k:h(t);return o(d||t,function(n,s){d&&(n=t[s=n]),Nt(a,s,oe(n,e,i,s,t,r))}),a}function ae(t,e,i){var n=i.length;if(null==t)return!n;for(t=Ss(t);n--;){var s=i[n],r=e[s],o=t[s];if(o===k&&!(s in t)||!r(o))return!1}return!0}function le(t,e,i){if("function"!=typeof t)throw new As("Expected a function");return Nr(function(){t.apply(k,i)},e)}function he(t,e,i,n){var s=-1,r=h,o=!0,a=t.length,l=[],p=e.length;if(!a)return l;i&&(e=c(e,O(i))),n?(r=u,o=!1):200<=e.length&&(r=C,o=!1,e=new Ft(e));t:for(;++se}function ve(t,e){return null!=t&&xs.call(t,e)}function we(t,e){return null!=t&&e in Ss(t)}function Se(t,e,i){for(var n=i?u:h,s=t[0].length,r=t.length,o=r,a=ys(r),l=1/0,p=[];o--;){var d=t[o];o&&e&&(d=c(d,O(e))),l=ar(d.length,l),a[o]=!i&&(e||120<=s&&120<=d.length)?new Ft(o&&d):k}d=t[0];var f=-1,g=a[0];t:for(;++f(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))?t:t[pn(Dn(e))])?k:s(e,t,i)}function Ke(t){return Nn(t)&&"[object Arguments]"==Te(t)}function Ae(t,e,i,n,s){if(t===e)return!0;if(null==t||null==e||!Nn(t)&&!Nn(e))return t!=t&&e!=e;t:{var r=xo(t),o=xo(e),a=r?"[object Array]":Ur(t),l=o?"[object Array]":Ur(e),h="[object Object]"==(a="[object Arguments]"==a?"[object Object]":a);o="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l);if((l=a==l)&&Ro(t)){if(!Ro(e)){e=!1;break t}r=!0,h=!1}if(l&&!h)s||(s=new Lt),e=r||Ho(t)?Wi(t,e,i,n,Ae,s):function(t,e,i,n,s,r,o){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new Us(t),new Us(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Bn(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=R;case"[object Set]":if(a||(a=F),t.size!=e.size&&!(1&n))break;return(i=o.get(t))?i==e:(n|=2,o.set(t,e),e=Wi(a(t),a(e),n,s,r,o),o.delete(t),e);case"[object Symbol]":if(Ar)return Ar.call(t)==Ar.call(e)}return!1}(t,e,a,i,n,Ae,s);else{if(!(1&i)&&(r=h&&xs.call(t,"__wrapped__"),a=o&&xs.call(e,"__wrapped__"),r||a)){t=r?t.value():t,e=a?e.value():e,s||(s=new Lt),e=Ae(t,e,i,n,s);break t}if(l)e:if(s||(s=new Lt),r=1&i,a=Ni(t),o=a.length,l=Ni(e).length,o==l||r){for(h=o;h--;){var u=a[h];if(!(r?u in e:xs.call(e,u))){e=!1;break e}}if((l=s.get(t))&&s.get(e))e=l==e;else{l=!0,s.set(t,e),s.set(e,t);for(var c=r;++he?i:0,i)?t[e]:k}function Le(t,e,i){var n=-1;return e=c(e.length?e:[cs],O(Xi())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].c;return t}(t=Pe(t,function(t,i,s){return{a:c(e,function(e){return e(t)}),b:++n,c:t}}),function(t,e){var n;t:{n=-1;for(var s=t.a,r=e.a,o=s.length,a=i.length;++n=a){n=l;break t}n=l*("desc"==i[n]?-1:1);break t}}n=t.b-e.b}return n})}function He(t,e,i){for(var n=-1,s=e.length,r={};++ne||9007199254740991e&&(e=-e>s?0:s+e),0>(i=i>s?s:i)&&(i+=s),s=e>i?0:i-e>>>0,e>>>=0,i=ys(s);++n=s){for(;n>>1,o=t[r];null!==o&&!Xn(o)&&(i?o<=e:o(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))||delete t[pn(Dn(e))]}function ti(t,e,i,n){for(var s=t.length,r=n?s:-1;(n?r--:++rn)return n?Ze(t[0]):[];for(var s=-1,r=ys(n);++s=n?t:Ve(t,e,i)}function li(t,e){if(e)return t.slice();var i=t.length;i=Ws?Ws(i):new t.constructor(i);return t.copy(i),i}function hi(t){var e=new t.constructor(t.byteLength);return new Us(e).set(new Us(t)),e}function ui(t,e){return new t.constructor(e?hi(t.buffer):t.buffer,t.byteOffset,t.length)}function ci(t,e){if(t!==e){var i=t!==k,n=null===t,s=t==t,r=Xn(t),o=e!==k,a=null===e,l=e==e,h=Xn(e);if(!a&&!h&&!r&&t>e||r&&o&&l&&!a&&!h||n&&o&&l||!i&&l||!s)return 1;if(!n&&!r&&!h&&ts?k:r,s=1),e=Ss(e);++no&&a[0]!==h&&a[o-1]!==h?[]:B(a,h)).length)i?i?je(e,t):e:(i=je(e,Qs(t/L(e))),It.test(e)?ai(H(i),0,t).join(""):i.slice(0,t))}function xi(t,e,i,n){var r=1&e,o=wi(t);return function e(){for(var a=-1,l=arguments.length,h=-1,u=n.length,c=ys(u+l),p=this&&this!==Ht&&this instanceof e?o:t;++he||n)&&(1&t&&(r[2]=p[2],e|=1&i?0:4),(i=p[3])&&(n=r[3],r[3]=n?pi(n,i,p[4]):i,r[4]=n?B(r[3],"__lodash_placeholder__"):p[4]),(i=p[5])&&(n=r[5],r[5]=n?di(n,i,p[6]):i,r[6]=n?B(r[5],"__lodash_placeholder__"):p[6]),(i=p[7])&&(r[7]=i),128&t&&(r[8]=null==r[8]?p[8]:ar(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=e),t=r[0],e=r[1],i=r[2],n=r[3],s=r[4],!(a=r[9]=r[9]===k?l?0:t.length:or(r[9]-h,0))&&24&e&&(e&=-25),l=e&&1!=e?8==e||16==e?Si(t,e,a):32!=e&&33!=e||s.length?Ai.apply(k,r):xi(t,e,i,n):function(t,e,i){var n=1&e,s=wi(t);return function e(){return(this&&this!==Ht&&this instanceof e?s:t).apply(n?i:this,arguments)}}(t,e,i),hn((p?Rr:jr)(l,r),t,e)}function Hi(t,e,i,n){return t===k||Bn(t,Is[i])&&!xs.call(n,i)?e:t}function ki(t,e,i,n,s,r){return jn(t)&&jn(e)&&(r.set(e,t),Be(t,e,k,ki,r),r.delete(e)),t}function Ui(t){return Vn(t)?k:t}function Wi(t,e,i,n,s,r){var o=1&i,a=t.length;if(a!=(l=e.length)&&!(o&&l>a))return!1;if((l=r.get(t))&&r.get(e))return l==e;var l=-1,h=!0,u=2&i?new Ft:k;for(r.set(t,e),r.set(e,t);++l(i=null==i?0:Yn(i))&&(i=or(n+i,0)),m(t,Xi(e,3),i)):-1}function mn(t,e,i){var n=null==t?0:t.length;if(!n)return-1;var s=n-1;return i!==k&&(s=Yn(i),s=0>i?or(n+s,0):ar(s,n-1)),m(t,Xi(e,3),s,!0)}function yn(t){return null!=t&&t.length?de(t,1):[]}function Tn(t){return t&&t.length?t[0]:k}function Dn(t){var e=null==t?0:t.length;return e?t[e-1]:k}function vn(t,e){return t&&t.length&&e&&e.length?ke(t,e):t}function wn(t){return null==t?t:cr.call(t)}function Sn(t){if(!t||!t.length)return[];var e=0;return t=l(t,function(t){if(Ln(t))return e=or(t.length,e),!0}),A(e,function(e){return c(t,w(e))})}function bn(t,e){if(!t||!t.length)return[];var i=Sn(t);return null==e?i:c(i,function(t){return s(e,k,t)})}function Kn(t){return(t=i(t)).__chain__=!0,t}function An(t,e){return e(t)}function On(t,e){return(xo(t)?o:Cr)(t,Xi(e,3))}function In(t,e){return(xo(t)?function(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}:Er)(t,Xi(e,3))}function Cn(t,e){return(xo(t)?c:Pe)(t,Xi(e,3))}function En(t,e,i){return e=i?k:e,e=t&&null==e?t.length:e,Li(t,128,k,k,k,k,e)}function xn(t,e){var i;if("function"!=typeof e)throw new As("Expected a function");return t=Yn(t),function(){return 0<--t&&(i=e.apply(this,arguments)),1>=t&&(e=k),i}}function Pn(t,e,i){function n(e){var i=l,n=h;return l=h=k,f=e,c=t.apply(n,i)}function s(t){var i=t-d;return t-=f,d===k||i>=e||0>i||_&&t>=u}function r(){var t=To();if(s(t))return o(t);var i,n=Nr;i=t-f,t=e-(t-d),i=_?ar(t,u-i):t,p=n(r,i)}function o(t){return p=k,m&&l?n(t):(l=h=k,c)}function a(){var t=To(),i=s(t);if(l=arguments,h=this,d=t,i){if(p===k)return f=t=d,p=Nr(r,e),g?n(t):c;if(_)return p=Nr(r,e),n(d)}return p===k&&(p=Nr(r,e)),c}var l,h,u,c,p,d,f=0,g=!1,_=!1,m=!0;if("function"!=typeof t)throw new As("Expected a function");return e=Zn(e)||0,jn(i)&&(g=!!i.leading,u=(_="maxWait"in i)?or(Zn(i.maxWait)||0,e):u,m="trailing"in i?!!i.trailing:m),a.cancel=function(){p!==k&&Br(p),f=0,l=d=h=p=k},a.flush=function(){return p===k?c:o(To())},a}function Rn(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new As("Expected a function");var i=function(){var n=arguments,s=e?e.apply(this,n):n[0],r=i.cache;return r.has(s)?r.get(s):(n=t.apply(this,n),i.cache=r.set(s,n)||r,n)};return i.cache=new(Rn.Cache||Rt),i}function Mn(t){if("function"!=typeof t)throw new As("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Bn(t,e){return t===e||t!=t&&e!=e}function Fn(t){return null!=t&&Wn(t.length)&&!kn(t)}function Ln(t){return Nn(t)&&Fn(t)}function Hn(t){if(!Nn(t))return!1;var e=Te(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Vn(t)}function kn(t){return!!jn(t)&&("[object Function]"==(t=Te(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function Un(t){return"number"==typeof t&&t==Yn(t)}function Wn(t){return"number"==typeof t&&-1=t}function jn(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Nn(t){return null!=t&&"object"==typeof t}function zn(t){return"number"==typeof t||Nn(t)&&"[object Number]"==Te(t)}function Vn(t){return!(!Nn(t)||"[object Object]"!=Te(t))&&(null===(t=js(t))||"function"==typeof(t=xs.call(t,"constructor")&&t.constructor)&&t instanceof t&&Es.call(t)==Bs)}function Gn(t){return"string"==typeof t||!xo(t)&&Nn(t)&&"[object String]"==Te(t)}function Xn(t){return"symbol"==typeof t||Nn(t)&&"[object Symbol]"==Te(t)}function qn(t){if(!t)return[];if(Fn(t))return Gn(t)?H(t):fi(t);if(Xs&&t[Xs]){t=t[Xs]();for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}return("[object Map]"==(e=Ur(t))?R:"[object Set]"==e?F:os)(t)}function $n(t){return t?(t=Zn(t))===U||t===-U?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}function Yn(t){var e=(t=$n(t))%1;return t==t?e?t-e:t:0}function Jn(t){return t?re(Yn(t),0,4294967295):0}function Zn(t){if("number"==typeof t)return t;if(Xn(t))return W;if(jn(t)&&(t=jn(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace(st,"");var e=gt.test(t);return e||mt.test(t)?Bt(t.slice(2),e?2:8):ft.test(t)?W:+t}function Qn(t){return gi(t,ss(t))}function ts(t){return null==t?"":Je(t)}function es(t,e,i){return(t=null==t?k:me(t,e))===k?i:t}function is(t,e){return null!=t&&Ji(t,e,we)}function ns(t){return Fn(t)?kt(t):Ee(t)}function ss(t){if(Fn(t))t=kt(t,!0);else if(jn(t)){var e,i=rn(t),n=[];for(e in t)("constructor"!=e||!i&&xs.call(t,e))&&n.push(e);t=n}else{if(e=[],null!=t)for(i in Ss(t))e.push(i);t=e}return t}function rs(t,e){if(null==t)return{};var i=c(zi(t),function(t){return[t]});return e=Xi(e),He(t,i,function(t,i){return e(t,i[0])})}function os(t){return null==t?[]:I(t,ns(t))}function as(t){return ua(ts(t).toLowerCase())}function ls(t){return(t=ts(t))&&t.replace(Tt,Jt).replace(Kt,"")}function hs(t,e,i){return t=ts(t),(e=i?k:e)===k?Ct.test(t)?t.match(Ot)||[]:t.match(ut)||[]:t.match(e)||[]}function us(t){return function(){return t}}function cs(t){return t}function ps(t){return Ce("function"==typeof t?t:oe(t,1))}function ds(t,e,i){var n=ns(e),s=_e(e,n);null!=i||jn(e)&&(s.length||!n.length)||(i=e,e=t,t=this,s=_e(e,ns(e)));var r=!(jn(i)&&"chain"in i&&!i.chain),a=kn(t);return o(s,function(i){var n=e[i];t[i]=n,a&&(t.prototype[i]=function(){var e=this.__chain__;if(r||e){var i=t(this.__wrapped__);return(i.__actions__=fi(this.__actions__)).push({func:n,args:arguments,thisArg:t}),i.__chain__=e,i}return n.apply(t,p([this.value()],arguments))})}),t}function fs(){}function gs(t){return nn(t)?w(pn(t)):function(t){return function(e){return me(e,t)}}(t)}function _s(){return[]}function ms(){return!1}var ys=(e=null==e?Ht:te.defaults(Ht.Object(),e,te.pick(Ht,Et))).Array,Ts=e.Date,Ds=e.Error,vs=e.Function,ws=e.Math,Ss=e.Object,bs=e.RegExp,Ks=e.String,As=e.TypeError,Os=ys.prototype,Is=Ss.prototype,Cs=e["__core-js_shared__"],Es=vs.prototype.toString,xs=Is.hasOwnProperty,Ps=0,Rs=function(){var t=/[^.]+$/.exec(Cs&&Cs.keys&&Cs.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Ms=Is.toString,Bs=Es.call(Ss),Fs=Ht._,Ls=bs("^"+Es.call(xs).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hs=Wt?e.Buffer:k,ks=e.Symbol,Us=e.Uint8Array,Ws=Hs?Hs.allocUnsafe:k,js=M(Ss.getPrototypeOf,Ss),Ns=Ss.create,zs=Is.propertyIsEnumerable,Vs=Os.splice,Gs=ks?ks.isConcatSpreadable:k,Xs=ks?ks.iterator:k,qs=ks?ks.toStringTag:k,$s=function(){try{var t=Yi(Ss,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ys=e.clearTimeout!==Ht.clearTimeout&&e.clearTimeout,Js=Ts&&Ts.now!==Ht.Date.now&&Ts.now,Zs=e.setTimeout!==Ht.setTimeout&&e.setTimeout,Qs=ws.ceil,tr=ws.floor,er=Ss.getOwnPropertySymbols,ir=Hs?Hs.isBuffer:k,nr=e.isFinite,sr=Os.join,rr=M(Ss.keys,Ss),or=ws.max,ar=ws.min,lr=Ts.now,hr=e.parseInt,ur=ws.random,cr=Os.reverse,pr=Yi(e,"DataView"),dr=Yi(e,"Map"),fr=Yi(e,"Promise"),gr=Yi(e,"Set"),_r=Yi(e,"WeakMap"),mr=Yi(Ss,"create"),yr=_r&&new _r,Tr={},Dr=dn(pr),vr=dn(dr),wr=dn(fr),Sr=dn(gr),br=dn(_r),Kr=ks?ks.prototype:k,Ar=Kr?Kr.valueOf:k,Or=Kr?Kr.toString:k,Ir=function(){function t(){}return function(e){return jn(e)?Ns?Ns(e):(t.prototype=e,e=new t,t.prototype=k,e):{}}}();i.templateSettings={escape:Y,evaluate:J,interpolate:Z,variable:"",imports:{_:i}},i.prototype=n.prototype,i.prototype.constructor=i,S.prototype=Ir(n.prototype),S.prototype.constructor=S,wt.prototype=Ir(n.prototype),wt.prototype.constructor=wt,St.prototype.clear=function(){this.__data__=mr?mr(null):{},this.size=0},St.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},St.prototype.get=function(t){var e=this.__data__;return mr?"__lodash_hash_undefined__"===(t=e[t])?k:t:xs.call(e,t)?e[t]:k},St.prototype.has=function(t){var e=this.__data__;return mr?e[t]!==k:xs.call(e,t)},St.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=mr&&e===k?"__lodash_hash_undefined__":e,this},At.prototype.clear=function(){this.__data__=[],this.size=0},At.prototype.delete=function(t){var e=this.__data__;return!(0>(t=Yt(e,t))||(t==e.length-1?e.pop():Vs.call(e,t,1),--this.size,0))},At.prototype.get=function(t){var e=this.__data__;return 0>(t=Yt(e,t))?k:e[t][1]},At.prototype.has=function(t){return-1n?(++this.size,i.push([t,e])):i[n][1]=e,this},Rt.prototype.clear=function(){this.size=0,this.__data__={hash:new St,map:new(dr||At),string:new St}},Rt.prototype.delete=function(t){return t=qi(this,t).delete(t),this.size-=t?1:0,t},Rt.prototype.get=function(t){return qi(this,t).get(t)},Rt.prototype.has=function(t){return qi(this,t).has(t)},Rt.prototype.set=function(t,e){var i=qi(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this},Ft.prototype.add=Ft.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ft.prototype.has=function(t){return this.__data__.has(t)},Lt.prototype.clear=function(){this.__data__=new At,this.size=0},Lt.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},Lt.prototype.get=function(t){return this.__data__.get(t)},Lt.prototype.has=function(t){return this.__data__.has(t)},Lt.prototype.set=function(t,e){var i=this.__data__;if(i instanceof At){var n=i.__data__;if(!dr||199>n.length)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new Rt(n)}return i.set(t,e),this.size=i.size,this};var Cr=yi(fe),Er=yi(ge,!0),xr=Ti(),Pr=Ti(!0),Rr=yr?function(t,e){return yr.set(t,e),t}:cs,Mr=$s?function(t,e){return $s(t,"toString",{configurable:!0,enumerable:!1,value:us(e),writable:!0})}:cs,Br=Ys||function(t){return Ht.clearTimeout(t)},Fr=gr&&1/F(new gr([,-0]))[1]==U?function(t){return new gr(t)}:fs,Lr=yr?function(t){return yr.get(t)}:fs,Hr=er?function(t){return null==t?[]:(t=Ss(t),l(er(t),function(e){return zs.call(t,e)}))}:_s,kr=er?function(t){for(var e=[];t;)p(e,Hr(t)),t=js(t);return e}:_s,Ur=Te;(pr&&"[object DataView]"!=Ur(new pr(new ArrayBuffer(1)))||dr&&"[object Map]"!=Ur(new dr)||fr&&"[object Promise]"!=Ur(fr.resolve())||gr&&"[object Set]"!=Ur(new gr)||_r&&"[object WeakMap]"!=Ur(new _r))&&(Ur=function(t){var e=Te(t);if(t=(t="[object Object]"==e?t.constructor:k)?dn(t):"")switch(t){case Dr:return"[object DataView]";case vr:return"[object Map]";case wr:return"[object Promise]";case Sr:return"[object Set]";case br:return"[object WeakMap]"}return e});var Wr=Cs?kn:ms,jr=un(Rr),Nr=Zs||function(t,e){return Ht.setTimeout(t,e)},zr=un(Mr),Vr=function(t){var e=(t=Rn(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(et,function(t,i,n,s){e.push(n?s.replace(ct,"$1"):i||t)}),e}),Gr=Ne(function(t,e){return Ln(t)?he(t,de(e,1,Ln,!0)):[]}),Xr=Ne(function(t,e){var i=Dn(e);return Ln(i)&&(i=k),Ln(t)?he(t,de(e,1,Ln,!0),Xi(i,2)):[]}),qr=Ne(function(t,e){var i=Dn(e);return Ln(i)&&(i=k),Ln(t)?he(t,de(e,1,Ln,!0),k,i):[]}),$r=Ne(function(t){var e=c(t,si);return e.length&&e[0]===t[0]?Se(e):[]}),Yr=Ne(function(t){var e=Dn(t),i=c(t,si);return e===Dn(i)?e=k:i.pop(),i.length&&i[0]===t[0]?Se(i,Xi(e,2)):[]}),Jr=Ne(function(t){var e=Dn(t),i=c(t,si);return(e="function"==typeof e?e:k)&&i.pop(),i.length&&i[0]===t[0]?Se(i,k,e):[]}),Zr=Ne(vn),Qr=ji(function(t,e){var i=null==t?0:t.length,n=se(t,e);return Ue(t,c(e,function(t){return tn(t,i)?+t:t}).sort(ci)),n}),to=Ne(function(t){return Ze(de(t,1,Ln,!0))}),eo=Ne(function(t){var e=Dn(t);return Ln(e)&&(e=k),Ze(de(t,1,Ln,!0),Xi(e,2))}),io=Ne(function(t){var e="function"==typeof(e=Dn(t))?e:k;return Ze(de(t,1,Ln,!0),k,e)}),no=Ne(function(t,e){return Ln(t)?he(t,e):[]}),so=Ne(function(t){return ii(l(t,Ln))}),ro=Ne(function(t){var e=Dn(t);return Ln(e)&&(e=k),ii(l(t,Ln),Xi(e,2))}),oo=Ne(function(t){var e="function"==typeof(e=Dn(t))?e:k;return ii(l(t,Ln),k,e)}),ao=Ne(Sn),lo=Ne(function(t){var e;return bn(t,e="function"==typeof(e=1<(e=t.length)?t[e-1]:k)?(t.pop(),e):k)}),ho=ji(function(t){var e=t.length,i=e?t[0]:0,n=this.__wrapped__,s=function(e){return se(e,t)};return!(1=e}),Eo=Ke(function(){return arguments}())?Ke:function(t){return Nn(t)&&xs.call(t,"callee")&&!zs.call(t,"callee")},xo=ys.isArray,Po=zt?O(zt):function(t){return Nn(t)&&"[object ArrayBuffer]"==Te(t)},Ro=ir||ms,Mo=Vt?O(Vt):function(t){return Nn(t)&&"[object Date]"==Te(t)},Bo=Gt?O(Gt):function(t){return Nn(t)&&"[object Map]"==Ur(t)},Fo=Xt?O(Xt):function(t){return Nn(t)&&"[object RegExp]"==Te(t)},Lo=qt?O(qt):function(t){return Nn(t)&&"[object Set]"==Ur(t)},Ho=$t?O($t):function(t){return Nn(t)&&Wn(t.length)&&!!xt[Te(t)]},ko=Ri(xe),Uo=Ri(function(t,e){return t<=e}),Wo=mi(function(t,e){if(rn(e)||Fn(e))gi(e,ns(e),t);else for(var i in e)xs.call(e,i)&&Nt(t,i,e[i])}),jo=mi(function(t,e){gi(e,ss(e),t)}),No=mi(function(t,e,i,n){gi(e,ss(e),t,n)}),zo=mi(function(t,e,i,n){gi(e,ns(e),t,n)}),Vo=ji(se),Go=Ne(function(t,e){t=Ss(t);var i=-1,n=e.length;for((s=2--t)return e.apply(this,arguments)}},i.ary=En,i.assign=Wo,i.assignIn=jo,i.assignInWith=No,i.assignWith=zo,i.at=Vo,i.before=xn,i.bind=Do,i.bindAll=pa,i.bindKey=vo,i.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return xo(t)?t:[t]},i.chain=Kn,i.chunk=function(t,e,i){if(e=(i?en(t,e,i):e===k)?1:or(Yn(e),0),!(i=null==t?0:t.length)||1>e)return[];for(var n=0,s=0,r=ys(Qs(i/e));n(e=i||e===k?1:Yn(e))?0:e,n):[]},i.dropRight=function(t,e,i){var n=null==t?0:t.length;return n?Ve(t,0,0>(e=n-(e=i||e===k?1:Yn(e)))?0:e):[]},i.dropRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0,!0):[]},i.dropWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0):[]},i.fill=function(t,e,i,n){var s=null==t?0:t.length;if(!s)return[];for(i&&"number"!=typeof i&&en(t,e,i)&&(i=0,n=s),s=t.length,0>(i=Yn(i))&&(i=-i>s?0:s+i),0>(n=n===k||n>s?s:Yn(n))&&(n+=s),n=i>n?0:Jn(n);i>>0)?(t=ts(t))&&("string"==typeof e||null!=e&&!Fo(e))&&(!(e=Je(e))&&It.test(t))?ai(H(t),0,i):t.split(e,i):[]},i.spread=function(t,e){if("function"!=typeof t)throw new As("Expected a function");return e=null==e?0:or(Yn(e),0),Ne(function(i){var n=i[e];return i=ai(i,0,e),n&&p(i,n),s(t,this,i)})},i.tail=function(t){var e=null==t?0:t.length;return e?Ve(t,1,e):[]},i.take=function(t,e,i){return t&&t.length?Ve(t,0,0>(e=i||e===k?1:Yn(e))?0:e):[]},i.takeRight=function(t,e,i){var n=null==t?0:t.length;return n?Ve(t,0>(e=n-(e=i||e===k?1:Yn(e)))?0:e,n):[]},i.takeRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!1,!0):[]},i.takeWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3)):[]},i.tap=function(t,e){return e(t),t},i.throttle=function(t,e,i){var n=!0,s=!0;if("function"!=typeof t)throw new As("Expected a function");return jn(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),Pn(t,e,{leading:n,maxWait:e,trailing:s})},i.thru=An,i.toArray=qn,i.toPairs=ea,i.toPairsIn=ia,i.toPath=function(t){return xo(t)?c(t,pn):Xn(t)?[t]:fi(Vr(ts(t)))},i.toPlainObject=Qn,i.transform=function(t,e,i){var n=xo(t),s=n||Ro(t)||Ho(t);if(e=Xi(e,4),null==i){var r=t&&t.constructor;i=s?n?new r:[]:jn(t)&&kn(r)?Ir(js(t)):{}}return(s?o:fe)(t,function(t,n,s){return e(i,t,n,s)}),i},i.unary=function(t){return En(t,1)},i.union=to,i.unionBy=eo,i.unionWith=io,i.uniq=function(t){return t&&t.length?Ze(t):[]},i.uniqBy=function(t,e){return t&&t.length?Ze(t,Xi(e,2)):[]},i.uniqWith=function(t,e){return e="function"==typeof e?e:k,t&&t.length?Ze(t,k,e):[]},i.unset=function(t,e){return null==t||Qe(t,e)},i.unzip=Sn,i.unzipWith=bn,i.update=function(t,e,i){return null!=t&&(t=ze(t,e,(i=ri(i))(me(t,e)),void 0)),t},i.updateWith=function(t,e,i,n){return n="function"==typeof n?n:k,null!=t&&(t=ze(t,e,(i=ri(i))(me(t,e)),n)),t},i.values=os,i.valuesIn=function(t){return null==t?[]:I(t,ss(t))},i.without=no,i.words=hs,i.wrap=function(t,e){return Ko(ri(e),t)},i.xor=so,i.xorBy=ro,i.xorWith=oo,i.zip=ao,i.zipObject=function(t,e){return ni(t||[],e||[],Nt)},i.zipObjectDeep=function(t,e){return ni(t||[],e||[],ze)},i.zipWith=lo,i.entries=ea,i.entriesIn=ia,i.extend=jo,i.extendWith=No,ds(i,i),i.add=wa,i.attempt=ca,i.camelCase=na,i.capitalize=as,i.ceil=Sa,i.clamp=function(t,e,i){return i===k&&(i=e,e=k),i!==k&&(i=(i=Zn(i))==i?i:0),e!==k&&(e=(e=Zn(e))==e?e:0),re(Zn(t),e,i)},i.clone=function(t){return oe(t,4)},i.cloneDeep=function(t){return oe(t,5)},i.cloneDeepWith=function(t,e){return oe(t,5,e="function"==typeof e?e:k)},i.cloneWith=function(t,e){return oe(t,4,e="function"==typeof e?e:k)},i.conformsTo=function(t,e){return null==e||ae(t,e,ns(e))},i.deburr=ls,i.defaultTo=function(t,e){return null==t||t!=t?e:t},i.divide=ba,i.endsWith=function(t,e,i){t=ts(t),e=Je(e);var n=t.length;n=i=i===k?n:re(Yn(i),0,n);return 0<=(i-=e.length)&&t.slice(i,n)==e},i.eq=Bn,i.escape=function(t){return(t=ts(t))&&$.test(t)?t.replace(X,Zt):t},i.escapeRegExp=function(t){return(t=ts(t))&&nt.test(t)?t.replace(it,"\\$&"):t},i.every=function(t,e,i){var n=xo(t)?a:ue;return i&&en(t,e,i)&&(e=k),n(t,Xi(e,3))},i.find=co,i.findIndex=_n,i.findKey=function(t,e){return _(t,Xi(e,3),fe)},i.findLast=po,i.findLastIndex=mn,i.findLastKey=function(t,e){return _(t,Xi(e,3),ge)},i.floor=Ka,i.forEach=On,i.forEachRight=In,i.forIn=function(t,e){return null==t?t:xr(t,Xi(e,3),ss)},i.forInRight=function(t,e){return null==t?t:Pr(t,Xi(e,3),ss)},i.forOwn=function(t,e){return t&&fe(t,Xi(e,3))},i.forOwnRight=function(t,e){return t&&ge(t,Xi(e,3))},i.get=es,i.gt=Io,i.gte=Co,i.has=function(t,e){return null!=t&&Ji(t,e,ve)},i.hasIn=is,i.head=Tn,i.identity=cs,i.includes=function(t,e,i,n){return t=Fn(t)?t:os(t),i=i&&!n?Yn(i):0,n=t.length,0>i&&(i=or(n+i,0)),Gn(t)?i<=n&&-1(i=null==i?0:Yn(i))&&(i=or(n+i,0)),y(t,e,i)):-1},i.inRange=function(t,e,i){return e=$n(e),i===k?(i=e,e=0):i=$n(i),(t=Zn(t))>=ar(e,i)&&t=t},i.isSet=Lo,i.isString=Gn,i.isSymbol=Xn,i.isTypedArray=Ho,i.isUndefined=function(t){return t===k},i.isWeakMap=function(t){return Nn(t)&&"[object WeakMap]"==Ur(t)},i.isWeakSet=function(t){return Nn(t)&&"[object WeakSet]"==Te(t)},i.join=function(t,e){return null==t?"":sr.call(t,e)},i.kebabCase=sa,i.last=Dn,i.lastIndexOf=function(t,e,i){var n=null==t?0:t.length;if(!n)return-1;var s=n;if(i!==k&&(s=0>(s=Yn(i))?or(n+s,0):ar(s,n-1)),e==e)t:{for(i=s+1;i--;)if(t[i]===e){t=i;break t}t=i}else t=m(t,D,s,!0);return t},i.lowerCase=ra,i.lowerFirst=oa,i.lt=ko,i.lte=Uo,i.max=function(t){return t&&t.length?ce(t,cs,De):k},i.maxBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),De):k},i.mean=function(t){return v(t,cs)},i.meanBy=function(t,e){return v(t,Xi(e,2))},i.min=function(t){return t&&t.length?ce(t,cs,xe):k},i.minBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),xe):k},i.stubArray=_s,i.stubFalse=ms,i.stubObject=function(){return{}},i.stubString=function(){return""},i.stubTrue=function(){return!0},i.multiply=Aa,i.nth=function(t,e){return t&&t.length?Fe(t,Yn(e)):k},i.noConflict=function(){return Ht._===this&&(Ht._=Fs),this},i.noop=fs,i.now=To,i.pad=function(t,e,i){t=ts(t);var n=(e=Yn(e))?L(t):0;return!e||n>=e?t:Ei(tr(e=(e-n)/2),i)+t+Ei(Qs(e),i)},i.padEnd=function(t,e,i){t=ts(t);var n=(e=Yn(e))?L(t):0;return e&&ne){var n=t;t=e,e=n}return i||t%1||e%1?(i=ur(),ar(t+i*(e-t+Mt("1e-"+((i+"").length-1))),e)):We(t,e)},i.reduce=function(t,e,i){var n=xo(t)?d:b,s=3>arguments.length;return n(t,Xi(e,4),i,s,Cr)},i.reduceRight=function(t,e,i){var n=xo(t)?f:b,s=3>arguments.length;return n(t,Xi(e,4),i,s,Er)},i.repeat=function(t,e,i){return e=(i?en(t,e,i):e===k)?1:Yn(e),je(ts(t),e)},i.replace=function(){var t=arguments,e=ts(t[0]);return 3>t.length?e:e.replace(t[1],t[2])},i.result=function(t,e,i){var n=-1,s=(e=oi(e,t)).length;for(s||(s=1,t=k);++n(t=Yn(t))||9007199254740991=r)return t;if(1>(r=i-L(n)))return n;if(i=o?ai(o,0,r).join(""):t.slice(0,r),s===k)return i+n;if(o&&(r+=i.length-r),Fo(s)){if(t.slice(r).search(s)){var a=i;for(s.global||(s=bs(s.source,ts(dt.exec(s))+"g")),s.lastIndex=0;o=s.exec(a);)var l=o.index;i=i.slice(0,l===k?r:l)}}else t.indexOf(Je(s),r)!=r&&(-1<(s=i.lastIndexOf(s))&&(i=i.slice(0,s)));return i+n},i.unescape=function(t){return(t=ts(t))&&q.test(t)?t.replace(G,Qt):t},i.uniqueId=function(t){var e=++Ps;return ts(t)+e},i.upperCase=ha,i.upperFirst=ua,i.each=On,i.eachRight=In,i.first=Tn,ds(i,function(){var t={};return fe(i,function(e,n){xs.call(i.prototype,n)||(t[n]=e)}),t}(),{chain:!1}),i.VERSION="4.17.11",o("bind bindKey curry curryRight partial partialRight".split(" "),function(t){i[t].placeholder=i}),o(["drop","take"],function(t,e){wt.prototype[t]=function(i){i=i===k?1:or(Yn(i),0);var n=this.__filtered__&&!e?new wt(this):this.clone();return n.__filtered__?n.__takeCount__=ar(i,n.__takeCount__):n.__views__.push({size:ar(i,4294967295),type:t+(0>n.__dir__?"Right":"")}),n},wt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),o(["filter","map","takeWhile"],function(t,e){var i=e+1,n=1==i||3==i;wt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xi(t,3),type:i}),e.__filtered__=e.__filtered__||n,e}}),o(["head","last"],function(t,e){var i="take"+(e?"Right":"");wt.prototype[t]=function(){return this[i](1).value()[0]}}),o(["initial","tail"],function(t,e){var i="drop"+(e?"":"Right");wt.prototype[t]=function(){return this.__filtered__?new wt(this):this[i](1)}}),wt.prototype.compact=function(){return this.filter(cs)},wt.prototype.find=function(t){return this.filter(t).head()},wt.prototype.findLast=function(t){return this.reverse().find(t)},wt.prototype.invokeMap=Ne(function(t,e){return"function"==typeof t?new wt(this):this.map(function(i){return be(i,t,e)})}),wt.prototype.reject=function(t){return this.filter(Mn(Xi(t)))},wt.prototype.slice=function(t,e){t=Yn(t);var i=this;return i.__filtered__&&(0e)?new wt(i):(0>t?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==k&&(i=0>(e=Yn(e))?i.dropRight(-e):i.take(e-t)),i)},wt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},wt.prototype.toArray=function(){return this.take(4294967295)},fe(wt.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),s=/^(?:head|last)$/.test(e),r=i[s?"take"+("last"==e?"Right":""):e],o=s||/^find/.test(e);r&&(i.prototype[e]=function(){var e=this.__wrapped__,a=s?[1]:arguments,l=e instanceof wt,h=a[0],u=l||xo(e),c=function(t){return t=r.apply(i,p([t],a)),s&&d?t[0]:t};u&&n&&"function"==typeof h&&1!=h.length&&(l=u=!1);var d=this.__chain__,f=!!this.__actions__.length;h=o&&!d,l=l&&!f;return!o&&u?(e=l?e:new wt(this),(e=t.apply(e,a)).__actions__.push({func:An,args:[c],thisArg:k}),new S(e,d)):h&&l?t.apply(this,a):(e=this.thru(c),h?s?e.value()[0]:e.value():e)})}),o("pop push shift sort splice unshift".split(" "),function(t){var e=Os[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",s=/^(?:pop|shift)$/.test(t);i.prototype[t]=function(){var t=arguments;if(s&&!this.__chain__){var i=this.value();return e.apply(xo(i)?i:[],t)}return this[n](function(i){return e.apply(xo(i)?i:[],t)})}}),fe(wt.prototype,function(t,e){var n=i[e];if(n){var s=n.name+"";(Tr[s]||(Tr[s]=[])).push({name:e,func:n})}}),Tr[Ai(k,2).name]=[{name:"wrapper",func:k}],wt.prototype.clone=function(){var t=new wt(this.__wrapped__);return t.__actions__=fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=fi(this.__views__),t},wt.prototype.reverse=function(){if(this.__filtered__){var t=new wt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},wt.prototype.value=function(){var t,e=this.__wrapped__.value(),i=this.__dir__,n=xo(e),s=0>i,r=n?e.length:0;t=0;for(var o=r,a=this.__views__,l=-1,h=a.length;++l=this.__values__.length;return{done:t,value:t?k:this.__values__[this.__index__++]}},i.prototype.plant=function(t){for(var e,i=this;i instanceof n;){var s=gn(i);s.__index__=0,s.__values__=k,e?r.__wrapped__=s:e=s;var r=s;i=i.__wrapped__}return r.__wrapped__=t,e},i.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof wt?(this.__actions__.length&&(t=new wt(this)),(t=t.reverse()).__actions__.push({func:An,args:[wn],thisArg:k}),new S(t,this.__chain__)):this.thru(wn)},i.prototype.toJSON=i.prototype.valueOf=i.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},i.prototype.first=i.prototype.head,Xs&&(i.prototype[Xs]=function(){return this}),i}();Ht._=te,void 0===(n=function(){return te}.call(e,i,e,t))||(t.exports=n)}.call(this),window.DKTools={},Object.defineProperties(DKTools,{SITE:{value:"https://dk-plugins.ru"},VERSION:{value:Imported.DKTools}}),DKTools.Sprite=function(t,e,i,n){this.initialize.apply(this,arguments)},DKTools.Window=function(t,e,i,n){this.initialize.apply(this,arguments)},DKTools.Scene=function(){this.initialize.apply(this,arguments)},DKTools.Utils=class{constructor(){return DKTools.Utils}static initialize(){this._saidHello=!1,this._isNwjs=Utils.isNwjs(),this._isTest=!!Utils.isOptionValid("test"),this._isMobileDevice=Utils.isMobileDevice(),this._isMobileSafari=Utils.isMobileSafari(),this._isAndroidChrome=Utils.isAndroidChrome(),this._gridSize=64,this._sayHello(),this.__tileSize(),this.__imageCacheLimit(),s.get("Debugging Console","Enabled")&&this.openConsole(),s.get("Check Updates","Enabled")&&this._checkUpdates()}static async _checkUpdates(){if(!this.isNwjs()||!this.isTest())return;let t=[];try{const e=new FormData;e.append("version",DKTools.VERSION),t=await DKTools.Network.fetchJson(`${DKTools.SITE}/plugins.php`,{method:"POST",body:e})}catch(t){return void console.error("DKTools can not check updates")}if(!t||0===t.length)return;const e=s.get("Check Updates","Show New Plugins");_.forEach(t,t=>{const i=t.version;if(DKTools.PluginManager.isRegistered(t.name)){if(i>DKTools.PluginManager.getVersion(t.name)){const e=[`Available a new version of ${t.name}: ${i} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}}else if(e){const e=[`Try the new plugin: ${t.name} \n`,`Description: ${t.description} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}})}static _getErrorLogData(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e}static __hideGrid(){this._gridSprite&&(SceneManager._scene.removeChild(this._gridSprite),this._gridSprite=null)}static __imageCacheLimit(){const t=s.get("Image Cache Limit");t.Enabled&&(ImageCache.limit=t.Limit)}static isAndroidChrome(){return this._isAndroidChrome}static isArrayLike(t){return!!Array.isArray(t)||"[object Arguments]"===String(t)}static isBoolean(t){return"boolean"==typeof t}static isFunction(t){return"function"==typeof t}static isMobileDevice(){return this._isMobileDevice}static isMobileSafari(){return this._isMobileSafari}static isNumber(t){return Number.isFinite(t)}static isNwjs(){return this._isNwjs}static isString(t){return!!t&&"string"==typeof t}static isTest(){return this._isTest}static async logError(t){if(!t||!this.isNwjs())return;const e=s.get("Errors Log"),i=DKTools.Utils.isTest(),n=e.Enabled;if("None"===n||"Only Game"===n&&i||"Only Test"===n&&!i)return;const r=DKTools.IO.fs,o=DKTools.IO.os;if(!r||!o)return;const a=1024*e["File Size"]*1024,l=e.Filename,h=new DKTools.IO.File(l),u=await h.getStatsAsync().then(t=>t.data);if(u&&u.size>a){const t=DKTools.IO.parsePath(l).name,e=new Date,i=String(e.getDate()).padZero(2),n=String(e.getMonth()+1).padZero(2),s=e.getFullYear(),r=String(e.getHours()).padZero(2),o=String(e.getMinutes()).padZero(2),a=String(e.getSeconds()).padZero(2);await h.renameAsync(`${i}.${n}.${s}_${r}.${o}.${a}_${t}`)}const c=await r.openSync(l,"a"),p=this._getErrorLogData();let d=`Date: ${(new Date).toString()}`+o.EOL;_.forEach(p,(t,e)=>{d+=e+": "+t+o.EOL}),t instanceof Object?(d+=`Name: ${t.name}`+o.EOL,d+=`Message: ${t.message}`+o.EOL,void 0!==t.filename&&(d+=`Filename: ${t.filename}`+o.EOL),void 0!==t.lineNumber&&(d+=`Line: ${t.lineNumber}`+o.EOL),void 0!==t.columnNumber&&(d+=`Column: ${t.columnNumber}`+o.EOL),d+=`Stack: ${t.stack}`+o.EOL+o.EOL):d+=`Error: ${t}`+o.EOL+o.EOL,await r.writeSync(c,d),await r.closeSync(c)}static makeScreenshot(){if(!this.isNwjs())return;const t=s.get("Screenshots"),e=t.Path,i=t.Type,n=t.Quality,r=SceneManager.snap().canvas.toDataURL("image/"+i,n),o=new RegExp(`^data:image/${i};base64,`),a=r.replace(o,""),l=new Date;let h=t.Filename;const u=(h=(h=(h=(h=(h=(h=h.replace(/%year/gi,l.getFullYear())).replace(/%month/gi,l.getMonth()+1)).replace(/%day/gi,l.getDate())).replace(/%hours/gi,l.getHours())).replace(/%minutes/gi,l.getMinutes())).replace(/%seconds/gi,l.getSeconds()))+"."+i,c=DKTools.IO.normalizePath(e+"/"+u);new DKTools.IO.File(c).save(a,{createDirectory:!0,options:"base64"}),console.log("The screenshot is saved with the name: "+u)}static mixin(t,e){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}static openConsole(){if(this.isTest()&&this.isNwjs())try{const t=i(2).Window.get();t.showDevTools(null,()=>t.focus())}catch(t){this.logError(t),console.error("DKTools can not open the console")}}static __tileSize(){const t=s.get("Tile Size");t.Enabled&&(Tilemap.TILE_WIDTH=t.Size,Tilemap.TILE_HEIGHT=t.Size)}static throwError(t){setTimeout(()=>{throw t},0)}static __quickLoad(){if(!DKTools.Utils.isTest()||!s.get("Quick Load","Enabled"))return;const t=s.get("Quick Load","Savefile ID"),e=SceneManager._scene;t>0?DataManager.loadGame(t)&&(SoundManager.playLoad(),e instanceof Scene_Base&&e.fadeOutAll(),$gameSystem.versionId()!==$dataSystem.versionId&&($gamePlayer.reserveTransfer($gameMap.mapId(),$gamePlayer.x,$gamePlayer.y),$gamePlayer.requestMapReload()),SceneManager.goto(Scene_Map)):e instanceof Scene_Load||SceneManager.push(Scene_Load)}static _sayHello(){if(!this._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>=0){const t=[`%c %c %c DKTools.js ${DKTools.VERSION} %c %c ${DKTools.SITE} %c \n`,"background: #279EE8; padding:5px 0;","background: #279EE8; padding:5px 0;","color: #4CCBF5; background: #030307; padding:5px 0;","background: #279EE8; padding:5px 0;","background: #BDE5F2; padding:5px 0;","background: #279EE8; padding:5px 0;"];console.log.apply(console,t)}else window.console&&console.log(`DKTools.js ${DKTools.VERSION} - ${DKTools.SITE}`);this._saidHello=!0}}static __showGrid(){if(!DKTools.Utils.isTest()||!s.get("Grid","Enabled"))return;if(this._gridSprite)return void(this._gridSize>=32?(this._gridSize-=16,this._gridSprite.refreshAll()):(this._gridSize=64,this.__hideGrid()));const t=s.get("Grid");let e=null;this._gridSprite=new DKTools.Sprite.Button(Graphics),this._gridSprite.addEvent({type:"draw-all",onUpdate:()=>{const i=Graphics.boxWidth,n=Graphics.boxHeight,s=this._gridSize,r=t["Grid Color"],o=t["Grid Width"];_.times(Math.ceil(i/s),t=>{this._gridSprite.drawLine({x1:s*t,y1:0,x2:s*t,y2:n,color:r,lineWidth:o})}),_.times(Math.ceil(n/s),t=>{this._gridSprite.drawLine({x1:0,y1:s*t,x2:i,y2:s*t,color:r,lineWidth:o})}),e&&this._gridSprite.drawLine({x1:e.x,y1:e.y,x2:TouchInput.mouseX,y2:TouchInput.mouseY,color:e.color,lineWidth:t["Ruler Width"]})}}),this._gridSprite.addEvent({type:"mouse-inside",onUpdate:()=>{const t=TouchInput.mouseX,e=TouchInput.mouseY,n=Graphics.boxWidth,s=Graphics.boxHeight;let r=t+8,o=e+8;r+i.width>n&&(r=t-i.width-8),o+i.height>s&&(o=e-i.height-8),i.move(r,o),i.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-down-middle",onUpdate:()=>{e||(e={x:TouchInput.mouseX,y:TouchInput.mouseY,color:t["Ruler Color"]||DKTools.Utils.Random.getHexColor()}),this._gridSprite.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-up-middle",onUpdate:()=>{e=null,this._gridSprite.refreshAll()}}),this._gridSprite.start(!0);const i=new DKTools.Sprite(0,0,220,"2");i.addEvent({type:"draw-all",onUpdate:()=>{if(e){const t={x:TouchInput.mouseX,y:TouchInput.mouseY},n=Math.floor(DKTools.Utils.Point.getDistance(e,t));i.drawText(`line: ${n} (${e.x}, ${e.y})`,{y:"0",align:"left"})}i.drawText(`x: ${TouchInput.mouseX}, y: ${TouchInput.mouseY}`,{y:"1",align:"left"})}}),i.start(),this._gridSprite.addChild(i),this._gridSprite.updateMouseInsideEvents(),SceneManager._scene.addChild(this._gridSprite)}},DKTools.Utils.Object=class{static toCamelCase(t){return _.reduce(t,(t,e,i)=>({...t,[_.camelCase(i)]:e}),{})}},DKTools.Utils.Number=class{static clamp(t,e,i){return _.clamp(t,e,i)}static inRange(t,e,i){return _.inRange(t,e,i)}},DKTools.Utils.String=class{static toBooleanArray(t){return _.map(this.toStringArray(t),Boolean)}static toNumberArray(t){return _.map(this.toStringArray(t),Number)}static toStringArray(t){return t.trim().replace(/\s*\,\s*/g,",").split(",")}},DKTools.Utils.Array=class{static avg(t){return this.sum(t)/t.length}static compact(t){return _.pull(t,"",null,void 0,Number.NaN)}static conjunction(t){return _.every(t,_.isEqual.bind(this,!0))}static contains(t,e){return _.includes(t,e)}static count(t,e){return _.size(t)-_.size(_.without(t,e))}static counts(t,e){return _.size(t)-_.size(_.difference(t,e))}static disjunction(t){return _.some(t,_.isEqual.bind(this,!0))}static insert(t,e,i=0){t.splice(i,0,e)}static isBitmapArray(t){return _.every(t,t=>t instanceof Bitmap)}static isBooleanArray(t){return _.every(t,t=>DKTools.Utils.isBoolean(t))}static isEmpty(t){return _.isEmpty(t)}static isNumberArray(t){return _.every(t,t=>DKTools.Utils.isNumber(t))}static isSpriteArray(t){return _.every(t,t=>t instanceof Sprite)}static isStringArray(t){return _.every(t,t=>DKTools.Utils.isString(t))}static isWindowArray(t){return _.every(t,t=>t instanceof Window)}static max(t){return Math.max.apply(Math,t)}static min(t){return Math.min.apply(Math,t)}static remove(t,e){return _.pull(t,e)}static sum(t){return _.reduce(t,(t,e)=>t+=e,0)}},DKTools.Utils.Point=class{static clone(t=0,e=0){return this.toPoint(t,e)}static equals(t,e=0,i=0){if(0===arguments.length)return!1;const n=this.toPoint(e,i);return(t=this.toPoint(t)).x===n.x&&t.y===n.y}static getDistance(t,e=0,i=0){const n=this.toPoint(e,i);return t=this.toPoint(t),Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}static toArray(t){return[t.x,t.y]}static toPoint(t=0,e=0){const i=this.tryToPoint(t,e);if(null!==i)return i;const n=t=>Number.isFinite(t)?t:0;let s;return t instanceof Object&&(s=t.x,e=t.y),s=n(s),e=n(e),new Point(s,e)}static tryToPoint(t,e){let i,n;return t instanceof Object?(i=t.x,n=t.y):(i=t,n=e),DKTools.Utils.Array.isNumberArray([i,n])?new Point(i,n):null}},DKTools.Utils.Rectangle=class{static clone(t=0,e=0,i=0,n=0){return this.toRectangle(t,e,i,n)}static equals(t,e=0,i=0,n=0,s=0){if(0===arguments.length)return!1;const r=this.toRectangle(e,i,n,s);return(t=this.toRectangle(t)).x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}static isEmpty(t){return this.equals(t,Rectangle.emptyRectangle)}static toArray(t){return[t.x,t.y,t.width,t.height]}static toRectangle(t=0,e=0,i=0,n=0){const s=this.tryToRectangle(t,e,i,n);if(s)return s;const r=t=>Number.isFinite(t)?t:0;let o;return t instanceof Object&&(o=t.x,e=t.y,i=t.width,n=t.height),o=r(o),e=r(e),i=r(i),n=r(n),new Rectangle(o,e,i,n)}static tryToRectangle(t,e,i,n){let s,r,o,a;return t instanceof Object?(s=t.x,r=t.y,o=t.width,a=t.height):(s=t,r=e,o=i,a=n),DKTools.Utils.Array.isNumberArray([s,r,o,a])?new Rectangle(s,r,o,a):null}},DKTools.Utils.WebAudio=class{static load(t,e,i){if(!t)return null;if(t instanceof WebAudio)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const n=AudioManager.createBuffer(t,e);return DKTools.Utils.isFunction(i)&&n.addLoadListener(i),n}static async loadAsync(t,e,i){return new Promise(n=>{const s=this.load(t,e,i);s?s.addLoadListener(()=>n(s)):n(s)})}static loadBuffers(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const n=[];let s=0;const r=(r,o)=>{e&&(n[r]=o,s++,DKTools.Utils.isFunction(i)&&i(o,n,t),t.length===s&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof WebAudio?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBuffersAsync(t){const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}},DKTools.Utils.Bitmap=class{static clone(t){if(!t||t.url)return t;const e=t.canvas,i=new Bitmap(e.width,e.height);return i.context.drawImage(e,0,0),i}static drawLine(t,e,i,n,s,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.beginPath(),a.moveTo(e,i),a.lineTo(n,s),a.stroke(),a.restore(),t._setDirty()}static fillArc(t,e,i,n,s,r,o="white",a=!1){const l=t.context;l.save(),l.fillStyle=o,l.beginPath(),l.arc(e,i,n,s,r,a),l.fill(),l.restore(),t._setDirty()}static getBase64(t){return t&&t.canvas?t.canvas.toDataURL("image/png"):null}static load(t,e,i,n,s){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const r=DKTools.IO.normalizePath(t+"/",!0),o=ImageManager.loadBitmap(r,e,n,s);return DKTools.Utils.isFunction(i)&&o.addLoadListener(i),o}static async loadAsync(t,e,i,n,s){return new Promise(r=>{const o=this.load(t,e,i,n,s);o?o.addLoadListener(()=>r(o)):r(o)})}static loadBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const n=[];let s=0;const r=(r,o)=>{e&&(n[r]=o,s++,DKTools.Utils.isFunction(i)&&i(o,n,t),t.length===s&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}static reserve(t,e,i,n,s,r){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.reserve.apply(this,t);if(t instanceof Object)return this.reserve(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);if(!DKTools.Utils.isString(t))return null;const o=DKTools.IO.normalizePath(t+"/",!0),a=ImageManager.reserveBitmap(o,e,n,s,r);return DKTools.Utils.isFunction(i)&&a.addLoadListener(i),a}static async reserveAsync(t,e,i,n,s,r){return new Promise(o=>{const a=this.reserve(t,e,i,n,s,r);a?a.addLoadListener(()=>o(a)):o(a)})}static reserveBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.reserve(t));const n=[];let s=0;const r=(r,o)=>{e&&(n[r]=o,s++,DKTools.Utils.isFunction(i)&&i(o,n,t),t.length===s&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async reserveBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.reserveAsync(t));return Promise.all(e)}static strokeArc(t,e,i,n,s,r,o="white",a=1,l=!1){const h=t.context;h.save(),h.strokeStyle=o,h.lineWidth=a,h.beginPath(),h.arc(e,i,n,s,r,l),h.stroke(),h.restore(),t._setDirty()}static strokeRect(t,e,i,n,s,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.strokeRect(e,i,n,s),a.restore(),t._setDirty()}},DKTools.Utils.Event=class{static getAllComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t?(t instanceof Game_Event&&(t=t.event()),_.reduce(t.pages,(t,e,i)=>(t[i+1]=_.reduce(e.list,(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]),t),{})):[]}static getComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t&&t.page()?_.reduce(t.list(),(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]):[]}},DKTools.Utils.Random=class{constructor(){return DKTools.Utils.Random}static getBoolean(){return this.getInt(1)%2==0}static getFloat(t=1){return _.random(0,t,!0)}static getHexColor(){return"#"+(16777215*Math.random()<<0).toString(16)}static getInt(t=1){return _.random(0,t)}static getRgbaColor(t=1){const e=this.getInt(255),i=this.getInt(255),n=this.getInt(255);return"rgba(%1, %2, %3, %4)".format(e,i,n,t)}},DKTools.IO=class{constructor(){return DKTools.IO}static initialize(){let t="";this.isLocalMode()&&(this._fs=i(3),this._os=i(4),this._path=i(5),t=this.joinPath(this._path.dirname(process.mainModule.filename),"/")),this._projectPath=t,this._mode=s.get("File System","Mode"),this._stamp={},this._loadStamp(),this._createStamp()}static absolutePathExists(t){if(this.isLocalMode())return this._fs.existsSync(t);if(this.mode===DKTools.IO.MODE_NWJS_STAMP&&t.startsWith(this._projectPath)){if(this.isFile(t))return!0;if(this.isDirectory(t))return!0}return!1}static _createStamp(){if(!DKTools.Utils.isTest()||!this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;const t=s.get("File System","Ignored Directories").map(t=>new DKTools.IO.Directory(t)),e=DKTools.IO.getRootDirectory(),i=this._stamp;let n=null;const r=e=>{t.some(t=>t.getFullPath()===e.getFullPath())||e.getAllAsync().then(t=>t.data).then(t=>{t.forEach(t=>{t.getStatsAsync().then(t=>t.data).then(e=>{const s=t.getFullPath().substring(1).split("\\");t.isFile()?_.set(i,s,{__stats__:{...e,type:"file"}}):_.set(i,s,{__stats__:{...e,type:"directory"}}),n&&clearTimeout(n),n=setTimeout(()=>{new DKTools.IO.File("data/Stamp.json").saveJsonAsync(i,{compress:!0})})}),t.isDirectory()&&r(t)})})};r(e)}static getRootDirectory(){return new DKTools.IO.Directory}static getAbsolutePath(t){const e=this.joinPath(this._projectPath,t||"");return this.normalizePath(e)}static isLocalMode(){return DKTools.Utils.isNwjs()}static isFile(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isFile()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\");if(_.last(e).includes("."))return"file"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static isDirectory(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isDirectory()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\").filter(t=>!!t);if(!_.last(e).includes("."))return"directory"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static joinPath(){if(this.isLocalMode())return this._path.join(...arguments);const t=_.filter(arguments,t=>DKTools.Utils.isString(t));let e=t.join("\\");return/^[\\\/]{2}[^\\\/]/.test(t[0])||(e=e.replace(/^[\\\/]{2,}/,"\\")),this.normalizePath(e)}static _loadStamp(){if(this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;new DKTools.IO.File("data/Stamp.json").loadJson({sync:!0,decompress:!0,onSuccess:t=>{this._stamp=t.data||this._stamp}})}static normalizePath(t,e=!1){if(this.isLocalMode()){const i=this._path.normalize(t);return e?i.replace(/\\/g,"/"):i}const i=this._statPath(t),n=i.isUnc,s=i.isAbsolute;let r=i.device,o=i.tail;const a=/[\\\/]$/.test(o),l=_.filter(o.split(/[\\\/]+/),t=>t&&"."!==t),h=[];for(const t of l)".."===t?h.length>0&&".."!==h[h.length-1]?h.pop():s||h.push(".."):h.push(t);(o=h.join("\\"))||s||(o="."),o&&a&&(o+="\\"),n&&(r="\\\\"+r.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\"));const u=r+(s?"\\":"")+o;return e?u.replace(/\\/g,"/"):u}static parsePath(t){if(this.isLocalMode())return this._path.parse(t);const e=this._splitPath(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}}static pathExists(t){return this.absolutePathExists(this.getAbsolutePath(t))}static _statPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=e[1]||"",n=!!i&&":"!==i[1];return{device:i,isUnc:n,isAbsolute:n||!!e[2],tail:e[3]}}static _splitPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=(e[1]||"")+(e[2]||""),n=e[3]||"",s=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/.exec(n);return[i,s[1],s[2],s[3]]}},Object.defineProperties(DKTools.IO,{fs:{get:function(){return this._fs},configurable:!0},os:{get:function(){return this._os},configurable:!0},path:{get:function(){return this._path},configurable:!0},sep:{get:function(){return this.isLocalMode()?this._path.sep:"/"},configurable:!0},projectPath:{get:function(){return this._projectPath},configurable:!0},mode:{get:function(){return this._mode},configurable:!0},stamp:{get:function(){return this._stamp},configurable:!0},OK:{value:0},EXPECT_CALLBACK:{value:1},ERROR_NOT_LOCAL_MODE:{value:2},ERROR_PATH_DOES_NOT_EXIST:{value:3},ERROR_CALLBACK_IS_NOT_AVAILABLE:{value:4},ERROR_DIRECTORY_ALREADY_EXISTS:{value:5},ERROR_DIRECTORY_IS_NOT_EMPTY:{value:6},ERROR_OVERWRITING_IS_NOT_AVAILABLE:{value:7},ERROR_OPTIONS_ARE_NOT_AVAILABLE:{value:8},ERROR_DECOMPRESSING_DATA:{value:9},ERROR_PARSING_DATA:{value:10},MODE_NWJS_STAMP:{value:0},MODE_NWJS:{value:1}}),DKTools.IO.Entity=class{constructor(){this.initialize.apply(this,arguments)}initialize(t=""){const e=DKTools.IO.parsePath(t);this._path=DKTools.IO.normalizePath(e.dir+"/"),this._name=e.name,this._initialExtension=e.ext,this._extension=e.ext}exists(){return DKTools.IO.absolutePathExists(this.getAbsolutePath())}getPath(){return this._path}getName(){return this._name}getExtension(){return this._extension}getFullPath(){return DKTools.IO.joinPath(this.getPath(),"/",this.getFullName())}getFullName(){return this._name+this._extension}getAbsolutePath(){return DKTools.IO.getAbsolutePath(this.getFullPath())}getStats(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const t=this.getFullPath().split("\\").filter(t=>!!t);return{data:_.get(DKTools.IO.stamp,t.concat("__stats__"),{}),status:DKTools.IO.OK}}const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.stat(i,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess({data:i,status:DKTools.IO.OK},this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{return{data:e.statSync(i),status:DKTools.IO.OK}}catch(e){this.__processError(e,t.onError)}}async getStatsAsync(){return new Promise((t,e)=>{const i=this.getStats({sync:!1,onSuccess:t,onError:e});i.status!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}hasExtension(){return!!this._extension}isFile(){if(this instanceof DKTools.IO.File){if(DKTools.IO.isLocalMode()){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.isFile(t)}return DKTools.IO.isFile(this.getFullPath())}return!!this.hasExtension()}return!1}isDirectory(){return this instanceof DKTools.IO.Directory&&(DKTools.IO.isLocalMode()?DKTools.IO.isDirectory(this.getFullPath()):!this.hasExtension())}__processError(t,e){DKTools.Utils.isFunction(e)?e(t,this):DKTools.Utils.throwError(t)}rename(t,e={}){if(e=e||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,n=this.getAbsolutePath(),s=DKTools.IO.normalizePath(this._path+"/"+t+this._extension),r=DKTools.IO.getAbsolutePath(s);if(!e.overwrite&&DKTools.IO.absolutePathExists(r))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;if(!e.sync)return i.rename(n,r,i=>{i?this.__processError(i,e.onError):(this._name=t,DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this))}),DKTools.IO.EXPECT_CALLBACK;try{return i.renameSync(n,r),this._name=t,DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async renameAsync(t,e={}){return new Promise((i,n)=>{const s=this.rename(t,{...e,sync:!1,onSuccess:i,onError:n});s!==DKTools.IO.EXPECT_CALLBACK&&i(s)})}},Object.defineProperties(DKTools.IO.Entity.prototype,{path:{get:function(){return this._path},configurable:!0},name:{get:function(){return this._name},configurable:!0},initialExtension:{get:function(){return this._initialExtension},configurable:!0},extension:{get:function(){return this._extension},configurable:!0}}),DKTools.IO.File=class extends DKTools.IO.Entity{initialize(t=""){super.initialize(t),this._detectExtension()}copy(t,e={}){if(!e)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,n=this.getAbsolutePath(),s=new DKTools.IO.File(t).getDirectory();if(e.createDirectory&&!s.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;s.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${s.getFullPath()}`),e.onError)}if(!s.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!e.sync)return i.copyFile(n,t,e.flags,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.copyFileSync(n,t,e.flags),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async copyAsync(t,e={}){return new Promise((i,n)=>{const s=this.copy(t,{...e,sync:!1,onSuccess:i,onError:n});s!==DKTools.IO.EXPECT_CALLBACK&&i(s)})}_detectExtension(){let t=this._extension;this.isAudio()?t=AudioManager.audioFileExt():this.isImage()?t=".png":this.isVideo()&&(t=Graphics.canPlayVideoType("video/webm")&&!DKTools.Utils.isMobileDevice()?".webm":".mp4"),this._extension=t}exists(){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.pathExists(t)}return super.exists()}getDirectory(){return new DKTools.IO.Directory(this._path)}getDirectoryName(){return this.getDirectory().getName()}isAudio(){return".ogg"===this._extension||".m4a"===this._extension||".rpgmvo"===this._extension}isJson(){return".json"===this._extension}isTxt(){return".txt"===this._extension}isImage(){return".png"===this._extension||".rpgmvp"===this._extension||".webp"===this._extension}isScript(){return".js"===this._extension}isVideo(){return".webm"===this._extension||".mp4"===this._extension}isSave(){return".rpgsave"===this._extension}load(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=this.getAbsolutePath(),i=e=>{if(e){if(t.decompress)try{e=LZString.decompressFromBase64(e)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(t.parse)try{e=JSON.parse(e,t.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:e,status:DKTools.IO.OK}};if(DKTools.IO.isLocalMode()){if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const n=DKTools.IO.fs,s=t.options||{encoding:"utf8"};if(t.sync)try{const r=n.readFileSync(e,s);return i(r)}catch(e){this.__processError(e,t.onError)}else n.readFile(e,s,(e,n)=>{e?this.__processError(e,t.onError):t.onSuccess(i(n),this)})}else{if(DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP&&"Stamp.json"!==this.getFullName()&&!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const n=new XMLHttpRequest;n.open("GET",e,!t.sync),n.overrideMimeType(t.mimeType||"application/json"),n.onload=(()=>{4===n.readyState&&(200===n.status?t.onSuccess(i(n.responseText),this):this.__processError(n,t.onError))}),n.onerror=(()=>{this.__processError(n,t.onError)});try{n.send()}catch(t){}}return{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async loadAsync(t={}){return new Promise((e,i)=>{const n=this.load({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}loadAudio(){return this.isAudio()&&(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP||this.exists())?DKTools.Utils.WebAudio.load(this.getDirectoryName(),this.getName()):null}async loadAudioAsync(){return DKTools.Utils.WebAudio.loadAsync(this.loadAudio())}loadJson(t){return t?(t.parse||(t.parse=!0),this.load(t)):{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE}}async loadJsonAsync(t={}){return new Promise((e,i)=>{const n=this.loadJson({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}loadBitmap(t,e,i){return t instanceof Object?this.loadBitmap(t.listener,t.hue,t.smooth):this.isImage()&&(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP||this.exists())?DKTools.Utils.Bitmap.load({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i}):null}async loadBitmapAsync(t,e,i){return DKTools.Utils.Bitmap.loadAsync(this.loadBitmap(t,e,i))}remove(t={}){if(t=t||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.unlink(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.unlinkSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAsync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmap(t,e,i,n){return t instanceof Object?this.reserveBitmap(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserve({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:n}):null}async reserveBitmapAsync(t,e,i,n){return t instanceof Object?this.reserveBitmapAsync(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserveAsync({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:n}):null}save(t,e={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;const i=DKTools.IO.fs,n=this.getAbsolutePath(),s=this.getDirectory();if((e=e||{}).createDirectory&&!s.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;s.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${s.getFullPath()}`),e.onError)}if(!s.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(e.stringify&&(t=JSON.stringify(t,e.stringify.replacer,e.stringify.space)),e.compress&&(t=LZString.compressToBase64(t)),!e.sync)return i.writeFile(n,t,e.options,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.writeFileSync(n,t,e.options),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async saveAsync(t,e={}){return new Promise((i,n)=>{const s=this.save(t,{...e,sync:!1,onSuccess:i,onError:n});s!==DKTools.IO.EXPECT_CALLBACK&&i(s)})}saveJson(t,e={}){return(e=e||{}).stringify||(e.stringify={space:"\t"}),this.save(t,e)}async saveJsonAsync(t,e={}){return new Promise((i,n)=>{const s=this.saveJson(t,{...e,sync:!1,onSuccess:i,onError:n});s!==DKTools.IO.EXPECT_CALLBACK&&i(s)})}},DKTools.IO.Directory=class extends DKTools.IO.Entity{create(t){if(!t)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(this.exists())return DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.mkdir(i,t.options,e=>{e?this.__processError(e,t.onError):t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.mkdirSync(i,t.options),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async createAsync(t={}){return new Promise((e,i)=>{const n=this.create({...t,sync:!1,onSuccess:e,onError:i});n!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}createDirectory(t,e){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).create(e)}async createDirectoryAsync(t,e={}){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).createAsync(e)}findFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let n=1,s=0;const r=s=>{_.forEach(s,s=>{if(s.isFile()){const e=s.getFullName();t.template instanceof RegExp&&t.template.test(e)?i.push(s):t.template&&e!==t.template||i.push(s)}else n{if(t.sync){const i=e.getAll({sync:!0,options:t.options}).data;r(i)}else e.getAll({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{s++,r(e.data),n===s&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findFilesAsync(t={}){return new Promise((e,i)=>{const n=this.findFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}findDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let n=1,s=0;const r=s=>{_.forEach(s,s=>{const r=s.getFullName();t.template instanceof RegExp&&t.template.test(r)?i.push(s):t.template&&r!==t.template||i.push(s),n{if(t.sync){const i=e.getDirectories({sync:!0,options:t.options}).data;r(i)}else e.getDirectories({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{s++,r(e.data),n===s&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findDirectoriesAsync(t={}){return new Promise((e,i)=>{const n=this.findDirectories({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getAll(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=this.getFullPath(),i=i=>{return t.template instanceof RegExp?i=_.filter(i,e=>t.template.test(e)):DKTools.Utils.isString(t.template)&&(i=_.filter(i,e=>e===t.template)),{data:_.reduce(i,(t,i)=>{const n=DKTools.IO.normalizePath(e+"/"+i);return DKTools.IO.isFile(n)?t.push(new DKTools.IO.File(n)):DKTools.IO.isDirectory(n)&&t.push(new DKTools.IO.Directory(n)),t},[]),status:DKTools.IO.OK}};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.getFullPath().split("\\"),n=_.get(DKTools.IO.stamp,e,{}),s=Object.keys(n);return t.sync?i(s):(t.onSuccess(i(s),this),{data:null,status:DKTools.IO.EXPECT_CALLBACK})}const n=DKTools.IO.fs,s=this.getAbsolutePath();if(!t.sync)return n.readdir(s,t.options,(e,n)=>{e?this.__processError(e,t.onError):t.onSuccess(i(n),this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{const e=n.readdirSync(s,t.options);return i(e)}catch(e){this.__processError(e,t.onError)}}async getAllAsync(t={}){return new Promise((e,i)=>{const n=this.getAll({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isFile());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,n)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},n):i(t,n)}),this.getAll(t)}}async getFilesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isFile());return{...t,data:e}}return t})}getDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isDirectory());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,n)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},n):i(t,n)}),this.getAll(t)}}async getDirectoriesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isDirectory());return{...t,data:e}}return t})}getAudioFiles(t){return this.getFiles({...t,template:/(.ogg|.rpgmvo)/})}async getAudioFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getAudioFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getJsonFiles(t){return this.getFiles({...t,template:/(.json)/})}async getJsonFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getJsonFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getTxtFiles(t){return this.getFiles({...t,template:/(.txt)/})}async getTxtFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getTxtFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getImageFiles(t){return this.getFiles({...t,template:/(.png|.webp|.rpgmvp)/})}async getImageFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getImageFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getVideoFiles(t){return this.getFiles({...t,template:/(.webm|.mp4)/})}async getVideoFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getVideoFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getRootDirectory(){return new DKTools.IO.Directory(this.getPath())}isEmpty(){const t=this.getAll({sync:!0}).data;return!t||0===t.length}loadAudioFiles(){const t=this.getAudioFiles({sync:!0});return t.status!==DKTools.IO.OK?[]:_.map(t.data,t=>t.loadAudio())}async loadAudioFilesAsync(){const t=await this.getAudioFilesAsync();if(t.status!==DKTools.IO.OK)return[];const e=_.map(t.data,t=>t.loadAudioAsync());return Promise.all(e)}loadBitmaps(t,e,i){const n=this.getImageFiles({sync:!0});return n.status!==DKTools.IO.OK?[]:_.map(n.data,n=>n.loadBitmap(t,e,i))}async loadBitmapsAsync(t,e,i){const n=await this.getImageFilesAsync();if(n.status!==DKTools.IO.OK)return[];const s=_.map(n.data,n=>n.loadBitmapAsync(t,e,i));return Promise.all(s)}remove(t={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!this.isEmpty())return DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.rmdir(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.rmdirSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmaps(t,e,i,n){const s=this.getImageFiles({sync:!0});return s.status!==DKTools.IO.OK?[]:_.map(s.data,s=>s.reserveBitmap(t,e,i,n))}async reserveBitmapsAsync(t,e,i,n){const s=await this.getImageFilesAsync();if(s.status!==DKTools.IO.OK)return[];const r=_.map(s.data,s=>s.reserveBitmapAsync(t,e,i,n));return Promise.all(r)}},DKTools.IO.WebStorage=class{static exists(t){return localStorage.hasOwnProperty(t)}static load(t,e={}){if(!this.exists(t))return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};let i=localStorage.getItem(t);if(i){if(e.decompress)try{i=LZString.decompressFromBase64(i)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(e.parse)try{i=JSON.parse(i,e.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:i,status:DKTools.IO.OK}}static remove(t){return this.exists(t)?(localStorage.removeItem(t),DKTools.IO.OK):DKTools.IO.ERROR_PATH_DOES_NOT_EXIST}static rename(t,e,i=!1){if(!this.exists(t))return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!i&&this.exists(e))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;const n=localStorage.getItem(t);return localStorage.setItem(e,n),localStorage.removeItem(t),DKTools.IO.OK}static save(t,e,i={}){return i=i||{},!_.defaultTo(i.overwrite,!0)&&this.exists(t)?DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE:(i.stringify&&(e=JSON.stringify(e,i.stringify.replacer,i.stringify.space)),i.compress&&(e=LZString.compressToBase64(e)),localStorage.setItem(t,e),DKTools.IO.OK)}},DKTools.Network=class{constructor(){return DKTools.Network}static async fetchFile(t,e={}){return fetch(t,e).then(t=>{if(t.ok)return this._toFile(t);throw t})}static async fetchJson(t,e={}){return e.headers||(e.headers={}),e.headers.Accept="application/json",fetch(t,e).then(t=>{if(t.ok)return this._toJson(t);throw t})}static async _toFile(t){return t.arrayBuffer().catch(()=>null)}static async _toJson(t){return t.json().catch(()=>null)}},DKTools.ParameterManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._pluginName=t,this._params={},this.initializeParams()}initializeParams(){_.forEach(PluginManager.parameters(this._pluginName),(t,e)=>{this._params[e]=DKTools.ParameterManager.parse(t)})}get(t,e,i){if(!DKTools.Utils.isString(t))return void console.error("Parameter name is not a string!",this._pluginName,t,e,i);let n=this._params[t];return void 0!==n?(e instanceof Object?n=_.find(n,e):void 0!==e&&(n=n[e]),n instanceof Object&&(i instanceof Object?(void 0!==i.key&&(n=n[i.key]),void 0!==i.index&&(n=n[i.index])):void 0!==i&&(n=n[i])),n):void 0}static parse(t){try{return DKTools.Utils.isNumber(t)||DKTools.Utils.isBoolean(t)?t:JSON.parse(t,(t,e)=>{if(Array.isArray(e))return _.map(e,t=>this.parse(t));try{return this.parse(e)}catch(t){return e}})}catch(e){return t}}},Object.defineProperties(DKTools.ParameterManager.prototype,{pluginName:{get:function(){return this._pluginName},configurable:!0},params:{get:function(){return this._params},configurable:!0}}),DKTools.PluginManager=class{constructor(){return DKTools.PluginManager}static initialize(){this.registerPlugins(Imported),this._checkRequirements()}static _checkRequirements(){_.forEach(this._requirements,(t,e)=>{const i=_.max(t),n=this.getVersion(e);if(void 0===n){const t='Required to install the plugin "%1". Minimal version: %2'.format(e,i);throw new Error(t)}if(n{this.registerPlugin(e,t)})}static requirePlugin(t,e){this._requirements[t]||(this._requirements[t]=[]),this._requirements[t].push(e)}static requirePlugins(t){_.forEach(t,(t,e)=>{this.requirePlugin(e,t)})}},Object.defineProperties(DKTools.PluginManager,{_plugins:{value:{}},_requirements:{value:{}},plugins:{get:function(){return this._plugins},configurable:!0},requirements:{get:function(){return this._requirements},configurable:!0}}),DKTools.PluginCommandManager=class{constructor(){return DKTools.PluginCommandManager}static has(t){return!!this._pluginCommands[t.toLowerCase()]}static process(t,e,i){const n=this._pluginCommands[e.toLowerCase()];DKTools.Utils.isFunction(n)&&n.call(t,i)}static set(t,e){this._pluginCommands[t.toLowerCase()]=e}},Object.defineProperties(DKTools.PluginCommandManager,{_pluginCommands:{value:{}}}),DKTools.PreloadManager=class{constructor(){return DKTools.PreloadManager}static initialize(){this.clearCache();const t=s.get("Preload Manager");this._enabled=t.Enabled,this.isEnabled()&&(_.forEach(t["Audio Files"],t=>{this.preloadAudio({path:t.Path,caching:t.Caching})}),_.forEach(t["Image Files"],t=>{this.preloadImage({path:t.Path,hue:t.Hue,caching:t.Caching})}),this.start())}static clearCache(){this._cache={audio:{},image:{}}}static clearQueue(){this._queue={audio:[],image:[]}}static _finish(){this._finishTime=new Date,this.clearQueue(),this._log("Preloading complete! \nLoaded/Skipped/Total: "+this._loaded+"/"+this._skipped+"/"+this._total+"\nPreloading time: "+(this._finishTime-this._startTime)/1e3+" sec"),Graphics.endLoading()}static _generateAudioKey(t){return DKTools.IO.normalizePath(t,!0)}static _generateImageKey(t,e=0){return DKTools.IO.normalizePath(ImageManager._generateCacheKey(t,e||0),!0)}static getCachedAudioByKey(t){return this._cache.audio[t]}static getCachedAudioByPath(t){return this.getCachedAudioByKey(this._generateAudioKey(t))}static getCachedImageByKey(t){return this._cache.image[t]}static getCachedImageByPath(t){return this.getCachedImageByKey(this._generateImageKey(t))}static isAudioCachedByKey(t){return!!this._cache.audio[t]}static isAudioCachedByPath(t){return this.isAudioCachedByKey(this._generateAudioKey(t))}static isEnabled(){return this._enabled}static isFinished(){return!!this._finishTime}static isReady(){return!this.isEnabled()||this.isFinished()}static isImageCachedByKey(t){return!!this._cache.image[t]}static isImageCachedByPath(t,e){return this.isImageCachedByKey(this._generateImageKey(t,e))}static _log(t){this.isEnabled()&&DKTools.Utils.isTest()&&s.get("Preload Manager","Debugging")&&t&&console.log(t)}static _onFileLoad(t){this._loaded++,this._log(`Loaded ${t instanceof WebAudio?"audio":"image"}: ${t.url}`),Graphics.updateLoading()}static _preload(t,e){if(this.isEnabled()&&e instanceof Object&&DKTools.Utils.isString(e.path)){const i=new DKTools.IO.Directory(e.path);if(i.isDirectory()){if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP)throw new Error("Web browsers and mobile phones cannot load directories!");{const n={sync:!0};let s=[];"audio"===t?s=i.getAudioFiles(n).data:"image"===t&&(s=i.getImageFiles(n).data),_.forEach(s,i=>{const n=i.getFullPath();this._queue[t][n]||(this._queue[t][n]={...e,path:n})})}}else{let i=e.path;i.includes(".")||("image"===t?i+=".png":"audio"===t&&(i+=".ogg"));const n=new DKTools.IO.File(i),s=n.getFullPath();n.isFile()?this._queue[t][s]||(this._queue[t][s]={...e,path:i}):console.error("This is not a file: "+s)}}}static _processLoadAudioFiles(){const t=[];return _.forEach(this._queue.audio,e=>{const i=new DKTools.IO.File(e.path),n=i.getFullPath();if(i.isFile())if(i.isAudio()){if(this.isAudioCachedByPath(n))return this._skipped++,void this._log("Audio already preloaded: "+n+". Skipped...");const s=i.loadAudio();s?(e.caching&&(this._cache.audio[this._generateAudioKey(s.url)]=s),t.push(s)):(this._skipped++,this._log("Cannot load an audio: "+n+". Skipped..."))}else this._skipped++,this._log("This is not an audio: "+n+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.WebAudio.loadAsync(t).then(()=>this._onFileLoad(t)))}static _processLoadImageFiles(){const t=[];return _.forEach(this._queue.image,e=>{const i=new DKTools.IO.File(e.path),n=i.getFullPath();if(i.isFile())if(i.isImage()){if(this.isImageCachedByPath(n,e.hue))return this._skipped++,void this._log("Image already preloaded: "+n+". Skipped...");const s=DKTools.Utils.Bitmap.reserve({folder:i.getPath(),filename:i.getName(),hue:e.hue});s?(e.caching&&(this._cache.image[this._generateImageKey(s.url,e.hue)]=s),t.push(s)):(this._skipped++,this._log("Cannot load an image: "+n+". Skipped..."))}else this._skipped++,this._log("This is not an image: "+n+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.Bitmap.loadAsync(t).then(()=>this._onFileLoad(t)))}static preloadAudio(t){this._preload("audio",t)}static preloadImage(t){this._preload("image",t)}static releaseAudioByKey(t){this._cache.audio[t]=void 0}static releaseAudioByPath(t){this.releaseAudioByKey(this._generateAudioKey(t))}static releaseImageByKey(t){this._cache.image[t]=void 0}static releaseImageByPath(t,e){this.releaseImageByKey(this._generateImageKey(t,e))}static start(){if(!this.isEnabled())return;if(this._loaded=0,this._skipped=0,this._total=_.size(this._queue.audio)+_.size(this._queue.image),this._startTime=new Date,this._finishTime=null,this._log("DKTools Preload Manager is running... \nTotal files to load: "+this._total),0===this._total)return void this._finish();const t=Promise.all(this._processLoadAudioFiles()),e=Promise.all(this._processLoadImageFiles());Promise.all([t,e]).then(()=>this._finish())}},Object.defineProperties(DKTools.PreloadManager,{_queue:{value:{audio:{},image:{}},writable:!0},_cache:{value:{audio:[],image:[]},writable:!0}}),DKTools.StartupManager=class{static async initialize(){this._isReady=!1,await this.checkErrors(),await this.initializeModules(),this._isReady=!0}static async initializeModules(){}static _checkRPGMakerVersion(){if(Utils.RPGMAKER_VERSION<"1.6.0")throw new Error("Required to update RPG Maker MV to minimal version 1.6.0 (Installed: %1)".format(Utils.RPGMAKER_VERSION))}static _checkWebStorage(){if(!DKTools.IO.isLocalMode()&&!window.hasOwnProperty("localStorage"))throw new Error("Your browser does not support localStorage API")}static async checkErrors(){await this._checkRPGMakerVersion(),await this._checkWebStorage()}static isReady(){return this._isReady}},DKTools.Audio=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._type=t.type.toLowerCase(),this._name=t.name,this._volume=_.defaultTo(t.volume,this.standardVolume()),this._pitch=_.defaultTo(t.pitch,this.standardPitch()),this._pan=_.defaultTo(t.pan,this.standardPan()),this._loop=_.defaultTo(t.loop,this.standardLoop()),this._buffer=this._createBuffer(),this._pausePos=null}_createBuffer(){return AudioManager.createBuffer(this._type,this._name)}clone(){return new DKTools.Audio(this)}equals(t){return!!t&&(this._type===t.type&&this._name===t.name&&this._volume===t.volume&&this._pitch===t.pitch&&this._pan===t.pan&&this._loop===t.loop)}fadeIn(t=0){this._buffer.fadeIn(t)}fadeOut(t=0){this._buffer.fadeOut(t)}isPaused(){return!this.isPlaying()&&null!=this._pausePos}isPlaying(){return this._buffer.isPlaying()}pause(){this.isPlaying()&&(this._pausePos=this.seek(),this.stop())}play(t=0){this._buffer.play(this._loop,t),this._updateBufferParameters(),this._pausePos=null}resume(){this.isPaused()&&this.play(this._pausePos)}seek(){return this._buffer.seek()}standardLoop(){return"bgm"===this._type||"bgs"===this._type}standardPan(){return 0}standardPitch(){return 100}standardVolume(){return 90}stop(){this.isPlaying()&&this._buffer.stop()}_updateBufferParameters(){const t=this._buffer;let e=AudioManager[this._type+"Volume"];Number.isFinite(e)||(e=100),t.volume=e*this._volume/1e4,t.pitch=this._pitch/100,t.pan=this._pan/100}},Object.defineProperties(DKTools.Audio.prototype,{id:{get:function(){return this._id},configurable:!0},type:{get:function(){return this._type},configurable:!0},name:{get:function(){return this._name},configurable:!0},volume:{get:function(){return this._volume},set:function(t){this._volume!==t&&(this._volume=t,this._updateBufferParameters())},configurable:!0},pitch:{get:function(){return this._pitch},set:function(t){this._pitch!==t&&(this._pitch=t,this._updateBufferParameters())},configurable:!0},pan:{get:function(){return this._pan},set:function(t){this._pan!==t&&(this._pan=t,this._updateBufferParameters())},configurable:!0},loop:{get:function(){return this._loop},configurable:!0},buffer:{get:function(){return this._buffer},configurable:!0},pos:{get:function(){return this.seek()},set:function(t){this.play(t)},configurable:!0}}),DKTools.Event=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._target=t.target,this._type=t.type,this._repeatTime=t.repeatTime||-1,this._repeats=_.defaultTo(t.repeats,-1),this._remainingPauseTime=t.remainingPauseTime||0,this._onStart=t.onStart,this._onUpdate=t.onUpdate,this._onPause=t.onPause,this._onReset=t.onReset,this._onRepeat=t.onRepeat,this._onSuccess=t.onSuccess,this._onFail=t.onFail,this._started=!1,this._resetRemainingTime(),this._resetRemainingRepeats()}addRemainingPauseTime(t=1){this._remainingPauseTime+=t}addRemainingRepeats(t=1){this._remainingRepeats+=t}addRemainingTime(t=1){this._remainingTime+=t}_callOnPauseHandler(){this._canCallOnPauseHandler()&&this._onPause(this)}_callOnRepeatHandler(){this._canCallOnRepeatHandler()&&this._onRepeat(this)}_callOnResetHandler(){this._canCallOnResetHandler()&&this._onReset(this)}_callOnStartHandler(){this._canCallOnStartHandler()&&this._onStart(this),this._started=!0}_callOnSuccessHandler(t=!1){(this._canCallOnSuccessHandler()||t)&&this._onSuccess(this)}_callOnUpdateHandler(){this._canCallOnUpdateHandler()&&this._onUpdate(this)}_callonFailHandler(){this._canCallonFailHandler()&&this._onFail(this)}_canCallOnPauseHandler(){return this.hasOnPauseHandler()&&this.isPaused()}_canCallOnRepeatHandler(){return this.hasOnRepeatHandler()}_canCallOnResetHandler(){return this.hasOnResetHandler()}_canCallOnStartHandler(){return this.hasOnStartHandler()&&!this.isStarted()}_canCallOnSuccessHandler(){return this.hasOnSuccessHandler()&&this.isFinished()}_canCallOnUpdateHandler(){return this.hasOnUpdateHandler()&&this.isUpdated()}_canCallonFailHandler(){return this.hasonFailHandler()}_clearRemainingRepeats(){this._remainingRepeats=0}_clearRemainingTime(){this._remainingTime=0}clone(){return new this.constructor(this)}finish(t=!1){this.isFinished()||t?this._callOnSuccessHandler(t):this._callonFailHandler(),this._clearRemainingTime(),this._clearRemainingRepeats()}getElapsedRepeats(){return this._repeats-this._remainingRepeats}getElapsedTime(){return this._repeatTime-this._remainingTime}hasManager(){return!!this._manager}hasOnPauseHandler(){return!!this._onPause}hasOnRepeatHandler(){return!!this._onRepeat}hasOnResetHandler(){return!!this._onReset}hasOnStartHandler(){return!!this._onStart}hasOnSuccessHandler(){return!!this._onSuccess}hasOnUpdateHandler(){return!!this._onUpdate}hasTarget(){return!!this._target}hasType(){return!!this._type}hasonFailHandler(){return!!this._onFail}isAnimation(){return this instanceof DKTools.Animation}isAnimationAction(){return this instanceof DKTools.Animation.Action}isFinished(){return 0===this._remainingTime&&0===this._remainingRepeats}isPaused(){return 0!==this._remainingPauseTime}isStarted(){return this._started}isUpdated(){return this.isStarted()&&!this.isPaused()&&!this.isFinished()}pause(t=-1){this._remainingPauseTime=t}_resetRemainingRepeats(){this._remainingRepeats=this._repeats}_resetRemainingTime(){this._remainingTime=this._repeatTime}remove(){return!this.hasTarget()||this._target.removeEvent(this)}repeat(){this._remainingRepeats>0&&this._remainingRepeats--,this._resetRemainingTime(),this._callOnRepeatHandler()}reset(){this._resetRemainingTime(),this._resetRemainingRepeats(),this._callOnResetHandler()}resume(){this._remainingPauseTime=0}setManager(t){this._manager=t}setOnPauseHandler(t){this._onPause=t}setOnRepeatHandler(t){this._onRepeat=t}setOnResetHandler(t){this._onReset=t}setOnStartHandler(t){this._onStart=t}setOnSuccessHandler(t){this._onSuccess=t}setOnUpdateHandler(t){this._onUpdate=t}setTarget(t){this._target=t}setonFailHandler(t){this._onFail=t}stop(t=!1){this.finish(t),this.reset()}_update(){this._callOnUpdateHandler(),this._updateRemainingRepeats()}_updatePause(){this._callOnPauseHandler(),this._updateRemainingPauseTime()}_updateRemainingPauseTime(){this._remainingPauseTime>0&&this._remainingPauseTime--}_updateRemainingRepeats(){this.isFinished()||(0===this._remainingTime?this.repeat():this._updateRemainingTime())}_updateRemainingTime(){this._remainingTime>0&&this._remainingTime--}update(){this.isPaused()?this._updatePause():(this._callOnStartHandler(),this._update(),this.isFinished()&&this.finish())}},Object.defineProperties(DKTools.Event.prototype,{id:{get:function(){return this._id},configurable:!0},target:{get:function(){return this._target},configurable:!0},manager:{get:function(){return this._manager},configurable:!0},type:{get:function(){return this._type},configurable:!0},repeatTime:{get:function(){return this._duration},configurable:!0},repeats:{get:function(){return this._repeats},configurable:!0},remainingTime:{get:function(){return this._remainingTime},set:function(t){this._remainingTime=t},configurable:!0},remainingRepeats:{get:function(){return this._remainingRepeats},set:function(t){this._remainingRepeats=t},configurable:!0},remainingPauseTime:{get:function(){return this._remainingPauseTime},set:function(t){this._remainingPauseTime=t},configurable:!0},onStart:{get:function(){return this._onStart},configurable:!0},onUpdate:{get:function(){return this._onUpdate},configurable:!0},onPause:{get:function(){return this._onPause},configurable:!0},onReset:{get:function(){return this._onReset},configurable:!0},onRepeat:{get:function(){return this._onRepeat},configurable:!0},onSuccess:{get:function(){return this._onSuccess},configurable:!0},onFail:{get:function(){return this._onFail},configurable:!0}}),DKTools.Animation=class extends DKTools.Event{initialize(t){this._actions=[],DKTools.Event.prototype.initialize.call(this,t)}addAction(t){t&&(Number.isFinite(t.startTime)||(t.startTime=0),Number.isFinite(t.endTime)||(t.endTime=this._repeatTime),t.setAnimation(this),this._actions.push(t))}addActions(t){_.forEach(t,this.addAction.bind(this))}_canUpdateAction(t){return _.inRange(this.getElapsedTime(),t.startTime,t.endTime)}hasAction(t){return DKTools.Utils.Array.contains(this._actions,t)}hasActions(){return!DKTools.Utils.Array.isEmpty(this._actions)}isActionFinished(t){return t.isStarted()&&!t.isPaused()&&this.getElapsedTime()>=t.endTime}isActionUpdated(t){return t.isStarted()&&!t.isPaused()&&this._canUpdateAction(t)}isFinished(){return DKTools.Event.prototype.isFinished.call(this)||!this.hasActions()}removeAction(t){this.hasAction(t)&&DKTools.Utils.Array.remove(this._actions,t)}repeat(){this.repeatActions(),DKTools.Event.prototype.repeat.call(this)}repeatActions(){_.forEach(this._actions,function(t){t.repeat()})}reset(){this.resetActions(),DKTools.Event.prototype.reset.call(this)}resetActions(){_.forEach(this._actions,function(t){t.reset()})}_update(){this._updateActions(),DKTools.Event.prototype._update.call(this)}_updateAction(t){this._canUpdateAction(t)?t.update():this.getElapsedTime()===t.endTime&&this.isActionFinished(t)&&t.finish()}_updateActions(){_.forEach(this._actions,this._updateAction.bind(this))}},Object.defineProperties(DKTools.Animation.prototype,{actions:{get:function(){return this._actions},configurable:!0}}),DKTools.Animation.Action=class extends DKTools.Event{static Anchor(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.anchor,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=n.x+s,a=n.y+r;e.setAnchor(o,a)}.bind(e)),e}static Close(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=-e.openness/t,n=e.openness+i;e.openness=n}.bind(e)),e}static Frame(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.frame,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=(i.width-n.width)/t,a=(i.height-n.height)/t,l=new Rectangle(n.x+s,n.y+r,n.width+o,n.height+a);e.setFrame(l)}.bind(e)),e}static Move(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.x-e.x)/t,n=(this._data.y-e.y)/t,s=e.x+i,r=e.y+n;e.move(s,r)}.bind(e)),e}static OpacitySprite(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.opacity)/t,n=e.opacity+i;e.setOpacity(n)}.bind(e)),e}static OpacityWindow(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.windowOpacity-e.windowOpacity)/t,n=(this._data.contentsOpacity-e.contentsOpacity)/t,s=(this._data.frameOpacity-e.frameOpacity)/t,r=(this._data.backOpacity-e.backOpacity)/t,o={windowOpacity:e.windowOpacity+i,contentsOpacity:e.contentsOpacity+n,frameOpacity:e.frameOpacity+s,backOpacity:e.backOpacity+r};e.setOpacity(o)}.bind(e)),e}static Open(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(255-e.openness)/t;e.openness=e.openness+i}.bind(e)),e}static Pivot(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.pivot,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=n.x+s,a=n.y+r;e.setPivot(o,a)}.bind(e)),e}static Rotation(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.rotation)/t,n=e.rotation+i;e.setRotation(n)}.bind(e)),e}static Scale(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.scale,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=n.x+s,a=n.y+r;e.setScale(o,a)}.bind(e)),e}static Skew(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.skew,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=n.x+s,a=n.y+r;e.setSkew(o,a)}.bind(e)),e}static Sound(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this._data;t.isPlaying()||t.play()}.bind(e)),e}static Tint(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.tint)/t,n=e.tint+i;e.setTint(n)}.bind(e)),e}static Tone(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=e.tone,n=(this._data[0]-i[0])/t,s=(this._data[1]-i[1])/t,r=(this._data[2]-i[2])/t,o=i[0]+n,a=i[1]+s,l=i[2]+r;e.setTone([o,a,l])}.bind(e)),e}initialize(t){t=t||{},this._animation=null,this._startTime=t.startTime,this._endTime=t.endTime,this._data=t.data,DKTools.Event.prototype.initialize.call(this,t)}getElapsedTime(){return this._animation.getElapsedTime()-this._startTime}getRemainingTime(){return this._endTime-this._animation.getElapsedTime()}isFinished(){return this._animation.isActionFinished(this)}isUpdated(){return this._animation.isActionUpdated(this)}remove(){this._animation.removeAction(this)}repeat(){this._callOnRepeatHandler()}reset(){this._callOnResetHandler()}setAnimation(t){this._animation=t}},Object.defineProperties(DKTools.Animation.Action.prototype,{animation:{get:function(){return this._animation},configurable:!0},startTime:{get:function(){return this._startTime},set:function(t){this._startTime=t},configurable:!0},endTime:{get:function(){return this._endTime},set:function(t){this._endTime=t},configurable:!0},data:{get:function(){return this._data},configurable:!0}}),DKTools.OptionManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(){this.clear()}addOptionChangeListener(t,e){this._optionChangeListeners[t]||(this._optionChangeListeners[t]=[]),this._optionChangeListeners[t].push(e)}clear(){this._options=[],this._optionChangeListeners={}}clone(t=!1){const e=new DKTools.OptionManager;return e.enableOptions(this._options),t&&_.forEach(this._optionChangeListeners,(t,i)=>{_.forEach(t,t=>{e.addOptionChangeListener(i,t)})}),e}disableOption(t){this.isOptionEnabled(t)&&(DKTools.Utils.Array.remove(this._options,t),this._onOptionChange(t,!1))}disableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.disableOption.bind(this))}enableOption(t){this.isOptionDisabled(t)&&(this._options.push(t),this._onOptionChange(t,!0))}enableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.enableOption.bind(this))}equals(t){return t instanceof DKTools.OptionManager&&_.isEqual(this._options,t.options)}isOptionDisabled(t){return!this.isOptionEnabled(t)}isOptionEnabled(t){return DKTools.Utils.Array.contains(this._options,t)}isOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionDisabled.bind(this))}isOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionEnabled.bind(this))}isSomeOptionEnabled(){return this._options.length>0}isSomeOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionDisabled.bind(this))}isSomeOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionEnabled.bind(this))}_onOptionChange(t,e){_.forEach(this._optionChangeListeners[t],i=>{i(t,e)})}removeOptionChangeListener(t,e){DKTools.Utils.Array.remove(this._optionChangeListeners[t],e)}switchOption(t){this.isOptionEnabled(t)?this.disableOption(t):this.enableOption(t)}switchOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.switchOption.bind(this))}},Object.defineProperties(DKTools.OptionManager,{options:{get:function(){return this._options},configurable:!0}}),DKTools.EventManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._target=t,this._events={}}addAnimation(t){return this.addEventToContainer(t)}addEvent(t){let e;return t instanceof DKTools.Event||t instanceof DKTools.Animation?e=t:t instanceof Object&&(e=new DKTools.Event(t)),this.addEventToContainer(e)}addEventToContainer(t){if(!t)return null;return t.hasTarget()||t.setTarget(this._target),t.setManager(this),this.getEventsContainer(t).push(t),t}addOneTimeEvent(t){return t.repeatTime=1,t.repeats=0,this.addEvent(t)}_checkEvent(t){return t&&!t.isFinished()}_checkEvents(){_.forEach(this._events,(t,e)=>{this._events[e]=this._checkEventsContainer(t)})}_checkEventsContainer(t){return _.filter(t,this._checkEvent.bind(this))}clearEvents(t){t?Array.isArray(t)?_.forEach(t,t=>{this._events[t]=[]}):this._events[t]=[]:this._events={}}createEventsContainer(t){return this._events[t]=[],this._events[t]}findAnimation(t,e){return _.find(this.getAnimations(e),{id:t})}findEvent(t,e){return _.find(this.getEvents(e),{id:t})}finishEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.finish(e)})}getAnimations(t){return _.filter(this.getEvents(t),t=>t instanceof DKTools.Animation)}getEventIndex(t){return this.getEventsContainer(t).indexOf(t)}getEvents(t){if(t)return this.getEventsContainerByType(t);let e=[];return _.forEach(this._events,t=>{e=e.concat(t)}),e}getEventsContainer(t){return this.getEventsContainerByType(t.type)}getEventsContainerByType(t){return this._events[t]||this.createEventsContainer(t)}hasAnimation(t){return t instanceof DKTools.Animation&&this.getEventIndex(t)>=0}hasAnimations(t){return!DKTools.Utils.Array.isEmpty(this.getAnimations(t))}hasEvent(t){return this.getEventIndex(t)>=0}hasEvents(t){return!DKTools.Utils.Array.isEmpty(this.getEvents(t))}isEventsPaused(t){const e=this.getEventsContainerByType(t);return _.every(e,t=>t.isPaused())}iterateEventsContainer(t,e){const i=this.getEventsContainerByType(t);_.forEach(i,e)}pauseEvents(t,e=-1){this.iterateEventsContainer(t,t=>{t.pause(e)})}removeEvent(t){const e=this.getEventIndex(t);if(e>=0){return this.getEventsContainer(t)[e]=null,!0}return!1}resumeEvents(t){this.iterateEventsContainer(t,t=>{t.resume()})}stopEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.stop(e)})}update(){this._checkEvents()}updateEvent(t){t&&t.update()}updateEventsContainer(t){this.iterateEventsContainer(t,this.updateEvent.bind(this))}},Object.defineProperties(DKTools.EventManager,{events:{get:function(){return this._events},configurable:!0}}),DKTools.Unit=class{constructor(t){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this.setSource(t.source),this.setPercents(t.percents),this.setGetValueHandler(t.getValueHandler)}add(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.add(e):this._source+=e,this):this}clone(){return new this.constructor(this)}div(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.div(e):this._source/=e,this):this}equals(t){return!!t&&(this===t||this._source===t.source&&this._percents===t.percents)}_getValueFromUnit(t){return t instanceof DKTools.Unit?t.getValue():t}getPercents(){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const t=this._percents(this);return Number.isFinite(t)?t:100}return 100}getValue(){let t;return(t=this.hasGetValueHandler()?this._getValueHandler(this):this.getValueBase())||0}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source instanceof DKTools.Unit?this._source.getValue()*t:this._source*t}hasGetValueHandler(){return DKTools.Utils.isFunction(this._getValueHandler)}hasPercents(){return DKTools.Utils.isFunction(this._percents)||Number.isFinite(this._percents)}hasSource(){return this._source instanceof DKTools.Unit||Number.isFinite(this._source)}mul(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.mul(e):this._source*=e,this):this}setGetValueHandler(t){this._getValueHandler=t}setPercents(t=100){this._percents=t}setSource(t){this._source=t}sub(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.rem(e):this._source-=e,this):this}},Object.defineProperties(DKTools.Unit.prototype,{source:{get:function(){return this._source},configurable:!0},percents:{get:function(){return this._percents},configurable:!0},getValueHandler:{get:function(){return this._getValueHandler},configurable:!0}}),DKTools.Unit.Property=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperty(t.property)}add(t){if(!t)return this;const e=this._property,i=this._source[e];let n=this._getValueFromUnit(t);return n instanceof Object&&(n=n[e]),n?(i instanceof DKTools.Unit?i.add(n):this._source[e]+=n,this):this}div(t){if(!t)return this;const e=this._property,i=this._source[e];let n=this._getValueFromUnit(t);return n instanceof Object&&(n=n[e]),n?(i instanceof DKTools.Unit?i.div(n):this._source[e]/=n,this):this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&this._percents===t.percents&&this._property===t.property)}getValueBase(){if(!this.hasSource()||!this.hasProperty())return Number.NaN;return new DKTools.Unit({source:this._source[this._property],percents:this.getPercents()}).getValue()}hasProperty(){return!!this._property}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._property,i=this._source[e];let n=this._getValueFromUnit(t);return n instanceof Object&&(n=n[e]),n?(i instanceof DKTools.Unit?i.mul(n):this._source[e]*=n,this):this}setProperty(t){this._property=t}sub(t){if(!t)return this;const e=this._property,i=this._source[e];let n=this._getValueFromUnit(t);return n instanceof Object&&(n=n[e]),n?(i instanceof DKTools.Unit?i.rem(n):this._source[e]-=n,this):this}},Object.defineProperties(DKTools.Unit.Property.prototype,{property:{get:function(){return this._property},configurable:!0}}),DKTools.Unit.Properties=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperties(t.properties)}add(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].add(i):this._source[e]+=i)}),this}addProperty(t){Array.isArray(this._properties)&&this._properties.push(t)}div(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].div(i):this._source[e]/=i)}),this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&_.isEqual(this._percents,t.percents)&&_.isEqual(this._properties,t.properties))}_getProperties(){let t=this._properties;return DKTools.Utils.isFunction(t)&&(t=t(this)),Array.isArray(t)?t:[]}getPercents(t){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const e=this._percents(t,this);return Number.isFinite(e)?e:100}if(this._percents instanceof Object){if(DKTools.Utils.isFunction(this._percents[t])){const e=this._percents[t](this);return Number.isFinite(e)?e:100}return Number.isFinite(this._percents[t])?this._percents[t]:100}return 100}getValue(t){return this.hasGetValueHandler()?this._getValueHandler(t,this):this.getValueBase(t)}getValueBase(t){const e=t=>{if(!this.hasSource())return Number.NaN;const e=this._source,i=this.getPercents(t);return 0===i?0:e[t]instanceof DKTools.Unit?e[t].getValue(t)*i/100:new DKTools.Unit.Property({source:e,percents:i,property:t}).getValue()};if(t)return e(t);const i=this._getProperties();return _.reduce(i,(t,i)=>(t[i]=e(i),t),{})}hasProperty(t){return this._getProperties().includes(t)}hasProperties(){return this._getProperties().length>0}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].mul(i):this._source[e]*=i)}),this}removeProperty(t){Array.isArray(this._properties)&&DKTools.Utils.Array.remove(this._properties,t)}setProperties(t){this._properties=DKTools.Utils.isFunction(t)?t:_.clone(t)}sub(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].rem(i):this._source[e]-=i)}),this}},Object.defineProperties(DKTools.Unit.Properties.prototype,{properties:{get:function(){return this._properties},configurable:!0}}),DKTools.Unit.Function=class extends DKTools.Unit{add(){return this}div(){return this}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source(this)*t}hasSource(){return DKTools.Utils.isFunction(this._source)}mul(){return this}sub(){return this}},DKTools.Base=class{constructor(){throw new Error("This is an abstract class!")}initialize(t,e,i,n){let s;t instanceof Graphics?(i=Graphics.boxWidth,n=Graphics.boxHeight):t instanceof Object?(s=t.x,e=t.y,i=t.width,n=t.height):Number.isFinite(t)&&(s=t),this.move(s,e),this.setupSize(i,n),this._clearAll(),this._createAll(),this._setupAll(),this._addAllChildren(),this.setupAll(t)}_addAllChildren(){}activate(){this.setActive(!0)&&this.updateActivateEvents()}actorName(t){const e=t>=1?$gameActors.actor(t):null;return e?e.name():""}addAllChildren(){this.updateAddAllChildrenEvents()}addAnimation(t){this._eventManager.addAnimation(t)}addEvent(t){return this._eventManager.addEvent(t)}addOneTimeEvent(t){return this._eventManager.addOneTimeEvent(t)}addOptionChangeListener(t,e){this._optionManager.addOptionChangeListener(t,e)}addFilter(t){t&&(this.filters&&this.filters.length>0?this.filters.push(t):this.filters=[t])}_clearAll(){this._clearMouseEnterTime(),this._clearWheel()}_clearMouseEnterTime(){this._mouseEnterTime=0}_clearWheel(){this._clearWheelX(),this._clearWheelY()}_clearWheelX(){this._wheelX=0}_clearWheelY(){this._wheelY=0}_createAll(){this._createOptionManager(),this._createEventManager()}_createEventManager(){this._eventManager=new DKTools.EventManager(this)}_createOptionManager(){this._optionManager=new DKTools.OptionManager}_checkHeight(t){const e=this.getMinHeight();return t?Math.max(e,t):e}_checkWidth(t){const e=this.getMinWidth();return t?Math.max(e,t):e}calcTextHeight(t,e=!1){if(!this.hasBitmap()||!t)return 0;const i=this.bitmap.fontSize,n=t.text.slice(t.index).split("\n"),s=e?n.length:1;let r=0;for(let t=0;t{e.addText(t.text,{...t.options})}),t.cloneOptions&&e.enableOptions(this._optionManager.options),t.blockStart||e.start(),t.activate&&e.activate(),e}convertEscapeCharacters(t){try{return Window_Base.prototype.convertEscapeCharacters.call(this,t)}catch(e){return t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\x1b\x1b/g,"\\")).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bN\[(\d+)\]/gi,function(){return this.actorName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bP\[(\d+)\]/gi,function(){return this.partyMemberName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bG/gi,TextManager.currencyUnit)}}createAll(){this.updateCreateAllEvents()}deactivate(){this.setActive(!1)&&this.updateDeactivateEvents()}destroy(t={}){this._clearAll(),this.clearEvents(),this.hide()}disableOption(t){this._optionManager.disableOption(t)}disableOptions(t){this._optionManager.disableOptions.apply(this._optionManager,arguments)}drawAll(){}drawArrow(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=ImageManager.loadSystem(this.standardWindowskin()),n=DKTools.Sprite.Arrow.getRect(t);return this.drawBitmap(i,{...e,source:n})}drawBitmap(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=DKTools.Utils.Bitmap.load(t);if(!i||e.sync&&!i.isReady())return!1;let n=!0;return i.addLoadListener(()=>{const t=DKTools.Utils.isFunction,s=DKTools.Utils.isString,r=this.getLineHeight(),{paintOpacity:o,resetPaintOpacity:a}=e;let{source:l,destination:h}=e,u={};t(e.callback)&&(u=e.callback(i,this)),l=l||u.source||{},h=h||u.destination||{},t(l)&&(l=l(i,this)),t(h)&&(h=h(i,this));const c=_.defaultTo(l.x,0),p=_.defaultTo(l.width,i.width);let d=_.defaultTo(l.y,0),f=_.defaultTo(l.height,i.height);const g=_.defaultTo(h.x,0),m=_.defaultTo(h.width,p);let y=_.defaultTo(h.y,0),T=_.defaultTo(h.height,f);0!==p&&0!==f&&0!==m&&0!==T?(s(d)&&(d=r*parseFloat(d)),s(f)&&(f=r*parseFloat(f)),s(y)&&(y=r*parseFloat(y)),s(T)&&(T=r*parseFloat(T)),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.blt(i,c,d,p,f,g,y,m,T),a&&this.resetPaintOpacity()):n=!1}),n}async drawBitmapAsync(t,e={}){if(!t)return!1;const i=await DKTools.Utils.Bitmap.loadAsync(t);return this.drawBitmap(i,e)}drawCharacter(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const n=ImageManager.loadCharacter(t),s=ImageManager.isBigCharacter(t),r=n.width/(s?3:12),o=n.height/(s?4:8),a=(e%4*3+1)*r,l=4*Math.floor(e/4)*o,h=new Rectangle(a,l,r,o),u=i.pos;let{x:c,y:p}=i;return u instanceof Object&&(c=u.x,p=u.y),c=c||0,p=p||0,this.drawBitmap(n,{...i,source:h,destination:{x:c,y:p}})}drawCircle(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:n,paintOpacity:s,resetPaintOpacity:r}=t;let{x:o,y:a}=t;return 0!==i&&(e instanceof Object&&(o=e.x,a=e.y),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),Number.isFinite(s)&&this.changePaintOpacity(s),this.bitmap.drawCircle(o||0,a||0,i||1,n||"white"),r&&this.resetPaintOpacity(),!0)}drawFace(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const{pos:n,rect:s}=i;let{x:r,y:o,width:a,height:l}=i;n instanceof Object&&(r=n.x,o=n.y),s instanceof Object&&(r=s.x,o=s.y,a=s.width,l=s.height),a=a||Window_Base._faceWidth,l=l||Window_Base._faceHeight;const h=ImageManager.loadFace(t),u=Window_Base._faceWidth,c=Window_Base._faceHeight,p=Math.min(a,u),d=Math.min(l,c),f=e%4*u+(u-p)/2,g=Math.floor(e/4)*c+(c-d)/2,_=new Rectangle(f,g,p,d);return r=Math.floor((r||0)+Math.max(a-u,0)/2),o=Math.floor((o||0)+Math.max(l-c,0)/2),this.drawBitmap(h,{...i,source:_,destination:{x:r,y:o}})}drawGauge(t={}){if(!this.hasBitmap())return!1;const{pos:e,rect:i,reversed:n,gradient:s,paintOpacity:r,resetPaintOpacity:o}=t;let{x:a,y:l,width:h,height:u,type:c,rate:p,backgroundColor:d,color:f,color1:g,color2:m}=t;if(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(a=i.x,l=i.y,h=i.width,u=i.height),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),0===h||0===u)return!1;a=a||0,l=l||0,h=h||this.standardDrawingWidth(),u=u||this.standardDrawingHeight(),d=_.defaultTo(d,"black"),f=_.defaultTo(f,"white"),g=_.defaultTo(g,f),m=_.defaultTo(m,f),c=_.defaultTo(c,"horizontal"),p=_.defaultTo(p,1);const y={x:a,y:l,width:h,height:u};if("horizontal"===c)y.width*=p,n&&(y.x+=h-y.width);else{if("vertical"!==c)return!1;y.height*=p,n&&(y.y+=u-y.height)}return Number.isFinite(r)&&this.changePaintOpacity(r),this.fillRect({x:a,y:l,width:h,height:u,color:d}),this.gradientFillRect({rect:y,color1:g,color2:m,vertical:"vertical"===s}),o&&this.resetPaintOpacity(),!0}drawIcon(t,e={}){if(!this.hasBitmap()||null==t)return!1;const i=ImageManager.loadSystem("IconSet"),n=Window_Base._iconWidth,s=Window_Base._iconHeight,r=t%16*n,o=Math.floor(t/16)*s,a=new Rectangle(r,o,n,s),l=e.pos;let{x:h,y:u}=e;return l instanceof Object&&(h=l.x,u=l.y),this.drawBitmap(i,{...e,source:a,destination:{x:h,y:u}})}drawItemName(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=Window_Base._iconWidth+4,{pos:n,iconPos:s,paintOpacity:r,resetPaintOpacity:o}=e;let{x:a,y:l,iconX:h,iconY:u}=e;return n instanceof Object&&(a=n.x,l=n.y),s instanceof Object&&(h=s.x,u=s.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),a=a||0,l=l||0,h=_.defaultTo(h,a+2),u=_.defaultTo(u,l+2),Number.isFinite(r)&&this.changePaintOpacity(r),this.drawIcon(t.iconIndex,{x:h,y:u}),this.drawText(t.name,{x:a+i,y:l,width:(e.width||312)-i,height:e.height,align:"left",font:e.font,textColor:e.textColor,resetFont:e.resetFont,resetTextColor:e.resetTextColor}),o&&this.resetPaintOpacity(),!0}drawLine(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos1:e,pos2:i,color:n,lineWidth:s,paintOpacity:r,resetPaintOpacity:o}=t;let{x1:a,y1:l,x2:h,y2:u}=t;return 0!==s&&(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(h=i.x,u=i.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),Number.isFinite(r)&&this.changePaintOpacity(r),DKTools.Utils.Bitmap.drawLine(this.bitmap,a||0,l||0,h||0,u||0,n,s),o&&this.resetPaintOpacity(),!0)}drawPolygon(t){if(!this.hasBitmap())return!1;t=t||{};const{points:e,paintOpacity:i,resetPaintOpacity:n}=t;if(!Array.isArray(e)||0===e.length)return!1;Number.isFinite(i)&&this.changePaintOpacity(i);for(let i=0;i=24&&(this.bitmap.fontSize-=12)}move(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e);this.position.copy(i)}obtainEscapeCode(t){return Window_Base.prototype.obtainEscapeCode.call(this,t)}obtainEscapeParam(t){return Window_Base.prototype.obtainEscapeParam.call(this,t)}partyMemberName(t){const e=t>=1?$gameParty.members()[t-1]:null;return e?e.name():""}pauseEvents(t,e){this._eventManager.pauseEvents(t,e)}processAll(){this.processMouse(),this.processWheel()}processCharacter(t){Window_Base.prototype.processCharacter.call(this,t)}processDrawIcon(t,e){this.drawIcon(t,{x:e.x+2,y:e.y+2}),e.x+=Window_Base._iconWidth+4}processEscapeCharacter(t,e){try{const i={...e};Window_Base.prototype.processEscapeCharacter.call(this,t,i),Object.assign(e,i)}catch(i){switch(t){case"C":this.changeTextColor(this.getWindowskinTextColor(this.obtainEscapeParam(e)));break;case"I":this.processDrawIcon(this.obtainEscapeParam(e),e);break;case"{":this.makeFontBigger();break;case"}":this.makeFontSmaller()}}}processMouse(){this.isOptionEnabled("process-mouse")&&this.isVisible()&&(this.isActive()||this.isOptionEnabled("process-mouse-ignore-active"))?this.isMouseInside()?(0===this._mouseEnterTime&&this.updateMouseEnterEvents(),this.updateMouseInsideEvents(),TouchInput.isMouseMoved()&&this.updateMouseMoveEvents(),this._mouseEnterTime++):(this._mouseEnterTime>0&&this.updateMouseLeaveEvents(),this.updateMouseOutsideEvents(),this._clearMouseEnterTime()):this._clearMouseEnterTime()}processNewLine(t){t.width?t.width0&&(e||this.start(),i&&this.activate()),n}setActive(t){if(this.active===t)return!1;const e=this.active;return this.setupActive(t),this.active!==e}setId(t){if(this._id===t)return!1;const e=this._id;return this.setupId(t),this._id!==e}setPivot(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.pivot,i))return!1;const n=DKTools.Utils.Point.clone(this.pivot);return this.setupPivot(i),!DKTools.Utils.Point.equals(this.pivot,n)}setRotation(t){if(this.rotation===t)return!1;const e=this.rotation;return this.setupRotation(t),this.rotation!==e}setScale(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.scale,i))return!1;const n=DKTools.Utils.Point.clone(this.scale);return this.setupScale(i),!DKTools.Utils.Point.equals(this.scale,n)}setSkew(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.skew,i))return!1;const n=DKTools.Utils.Point.clone(this.skew);return this.setupSkew(i),!DKTools.Utils.Point.equals(this.skew,n)}setTint(t){if(this.tint===t)return!1;const e=this.tint;return this.setupTint(t),this.tint!==e}setVisible(t){if(this.visible===t)return!1;const e=this.visible;return this.setupVisible(t),this.visible!==e}show(t=!1){this.setVisible(!0)&&this.updateShowEvents(),t&&this.activate()}start(t=!1){this._started=!0,this.removeAllChildren(),this.terminateAll(),this.removeAll(),this.checkAll(),this.createAll(),this.startAll(),this.addAllChildren(),this.refreshAll(),this.updateStartEvents(),t&&this.activate()}startAll(){this.updateStartAllEvents()}stopEvents(t,e=!1){this._eventManager.stopEvents(t,e)}strokeArc(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:n,lineWidth:s,anticlockwise:r,paintOpacity:o,resetPaintOpacity:a}=t;let{x:l,y:h,startAngle:u,endAngle:c}=t;return e instanceof Object&&(l=e.x,h=e.y),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(o)&&this.changePaintOpacity(o),l=l||0,h=h||0,u=u||0,c=_.defaultTo(c,2*Math.PI),DKTools.Utils.Bitmap.strokeArc(this.bitmap,l,h,i,u,c,n,s,r),a&&this.resetPaintOpacity(),!0}strokeRect(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,rect:i,lineWidth:n,paintOpacity:s,resetPaintOpacity:r}=t;let{x:o,y:a,width:l,height:h,color:u}=t;return e instanceof Object&&(o=e.x,a=pox.y),i instanceof Object&&(o=i.x,a=i.y,l=i.width,h=i.height),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(s)&&this.changePaintOpacity(s),o=o||0,a=a||0,l=l||this.standardDrawingWidth(),h=h||this.standardDrawingHeight(),u=u||"white",DKTools.Utils.Bitmap.strokeRect(this.bitmap,o,a,l,h,u,n),r&&this.resetPaintOpacity(),!0}switchOption(t){this._optionManager.switchOption(t)}switchOptions(t){this._optionManager.switchOptions.apply(this._optionManager,arguments)}terminate(){}terminateAll(){this.updateTerminateAllEvents()}textWrap(t,e={}){if(!this.hasBitmap()||""===t||null==t)return"";t=String(t),e=e||{};const i=t.split("\n"),n=e.maxWidth||this.bitmap.width,s=this.getTextWidth(" ");let r="",o=1;for(let t=0;tn){const t=i.split("");for(let e=0;el?(r+="\n"+t[e],l=n-i):(0===e&&(r+=" "),r+=t[e],l-=i)}}else{const a=h+s;if(0===t||a>l){if(t>0){if(e.maxLines===o)return r;r+="\n",o++}r+=i,l=n-h}else l-=a,r+=" "+i}}t{this[t.type](t.text,t.options)})},DKTools.Sprite.prototype.drawText=function(t,e={}){if(!this.hasBitmap()||null==t||""===t)return!1;t=String(t),e=e||{};const{pos:i,rect:n,font:s,textColor:r,paintOpacity:o,resetFont:a,resetTextColor:l,resetPaintOpacity:h}=e;let{x:u,y:c,width:p,height:d,align:f}=e;return i instanceof Object&&(u=i.x,c=i.y),n instanceof Object&&(u=n.x,c=n.y,p=n.width,d=n.height),DKTools.Utils.isString(c)&&(c=this.getLineHeight()*parseFloat(c)),DKTools.Utils.isString(d)&&(d=this.getLineHeight()*parseFloat(d)),0!==p&&0!==d&&(u=u||0,c=c||0,p=p||this.standardDrawingWidth(),d=d||this.getLineHeight(),f=f||this.align,s&&this.changeFont(s),r&&this.changeTextColor(r),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.drawText(t,u,c,p,d,f),a&&this.resetFont(),l&&this.resetTextColor(),h&&this.resetPaintOpacity(),!0)},DKTools.Sprite.prototype.findText=function(t){return _.find(this._texts,{id:t})},DKTools.Sprite.prototype._getBitmapHeight=function(){return this._bitmapHeight},DKTools.Sprite.prototype._getBitmapWidth=function(){return this._bitmapWidth},DKTools.Sprite.prototype.getCurrentOpacity=function(){return 255*this.alpha},DKTools.Sprite.prototype.getLocalPoint=function(t,e){const i=DKTools.Base.prototype.getLocalPoint.call(this,t,e),n=this.anchor;return i.x+=this.width*n.x,i.y+=this.height*n.y,i},DKTools.Sprite.prototype.hasFillColor=function(){return!!this._fillColor},DKTools.Sprite.prototype.hasFixedBitmap=function(){return!!this._fixedBitmap},DKTools.Sprite.prototype.hasGraphicFolder=function(){return!!this._graphicFolder},DKTools.Sprite.prototype.hasGraphicName=function(){return!!this._graphicName},DKTools.Sprite.prototype.hasTexts=function(){return this._texts.length>0},DKTools.Sprite.prototype.isResizable=function(){return!this.hasGraphicName()&&!this.hasFixedBitmap()},DKTools.Sprite.prototype._loadGraphic=function(){if(this.hasGraphicFolder()&&this.hasGraphicName()){const t=this._graphicFolder,e=this._graphicName,i=this._graphicLoadListener;this.loadBitmap(t,e,i),this.updateReadyEvents()}},DKTools.Sprite.prototype.loadAnimation=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/animations/",t,e,i,n)},DKTools.Sprite.prototype.loadBattleback1=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks1/",t,e,i,n)},DKTools.Sprite.prototype.loadBattleback2=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks2/",t,e,i,n)},DKTools.Sprite.prototype.loadBitmap=function(t,e,i,n,s){if(t instanceof Object)return this.loadBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth);const r=DKTools.Utils.Bitmap.load(t,e,null,n,s);return!!this.setBitmap(r)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.loadCharacter=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/characters/",t,e,i,n)},DKTools.Sprite.prototype.loadEnemy=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/enemies/",t,e,i,n)},DKTools.Sprite.prototype.loadFace=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/faces/",t,e,i,n)},DKTools.Sprite.prototype.loadParallax=function(t,e,i,n){return t instanceof Object?this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t.filename,t.listener,t.hue,t.smooth):this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t,e,i,n)},DKTools.Sprite.prototype.loadPicture=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/pictures/",t,e,i,n)},DKTools.Sprite.prototype.loadSvActor=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_actors/",t,e,i,n)},DKTools.Sprite.prototype.loadSvEnemy=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_enemies/",t,e,i,n)},DKTools.Sprite.prototype.loadSystem=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/system/",t,e,i,n)},DKTools.Sprite.prototype.loadTileset=function(t,e,i,n){return t instanceof Object?this.loadBitmap(ImageManager.TILESETS_FOLDER,t.filename,t.listener,t.hue,t.smooth):this.loadBitmap(ImageManager.TILESETS_FOLDER,t,e,i,n)},DKTools.Sprite.prototype.loadTitle1=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles1/",t,e,i,n)},DKTools.Sprite.prototype.loadTitle2=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles2/",t,e,i,n)},DKTools.Sprite.prototype.loadWindowskin=function(t,e,i,n){return t instanceof Object?this.loadSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth):this.loadSystem(t||this.standardWindowskin(),e,i,n)},DKTools.Sprite.prototype.moveWithAnchor=function(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e),n=this.anchor;this.move(i.x+this.width*n.x,i.y+this.height*n.y)},DKTools.Sprite.prototype.standardAlign=function(){return"center"},DKTools.Sprite.prototype.standardAnchor=function(){return new Point(0,0)},DKTools.Sprite.prototype.standardFillColor=function(){return null},DKTools.Sprite.prototype.standardFont=function(){return{fontFace:this.standardFontFace(),fontItalic:this.standardFontItalic(),fontSize:this.standardFontSize()}},DKTools.Sprite.prototype.standardFontFace=function(){try{return Window_Base.prototype.standardFontFace.call(this)}catch(t){return"GameFont"}},DKTools.Sprite.prototype.standardFontItalic=function(){return!1},DKTools.Sprite.prototype.standardFontSize=function(){try{return Window_Base.prototype.standardFontSize.call(this)}catch(t){return 28}},DKTools.Sprite.prototype.standardFrame=function(){return new Rectangle(0,0,this.width,this.height)},DKTools.Sprite.prototype.standardGraphicFolder=function(){return"img/system/"},DKTools.Sprite.prototype.standardGraphicName=function(){return""},DKTools.Sprite.prototype.standardOpacity=function(){return 255},DKTools.Sprite.prototype.standardPaintOpacity=function(){return 255},DKTools.Sprite.prototype.standardTextColor=function(){return"#ffffff"},DKTools.Sprite.prototype.standardMask=function(){return null},DKTools.Sprite.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t),this.setupBitmap(t),this.setupFrame(t.frame),this.setupAnchor(t.anchor),this.setupAlign(t.align),this.setupFont(t.font),this.setupTextColor(t.textColor),this.setupPaintOpacity(t.paintOpacity),this.setupFillColor(t.fillColor),this.setupOpacity(t.opacity),this.setupGraphicFolder(t.graphicFolder),this.setupGraphicName(t.graphicName)},DKTools.Sprite.prototype.setupAlign=function(t){this._align=t||this.standardAlign()},DKTools.Sprite.prototype.setupAnchor=function(t,e){const i=DKTools.Utils.Point.tryToPoint(t,e),n=Object.assign(this.standardAnchor(),i);this.anchor.copy(n)},DKTools.Sprite.prototype.setupBitmap=function(t){let e=null;t instanceof DKTools.Sprite&&t.hasFixedBitmap()&&t.canCloneFixedBitmap()?e=DKTools.Utils.Bitmap.clone(t.bitmap):t instanceof Object&&(e=DKTools.Utils.Bitmap.load(t.bitmap||t)),e?(this.bitmap=e,this.bitmap.addLoadListener(this.setupSize.bind(this))):this.bitmap=null,this._fixedBitmap=!!this.bitmap},DKTools.Sprite.prototype.setupFillColor=function(t){this._fillColor=null!==t?_.defaultTo(t,this.standardFillColor()):null},DKTools.Sprite.prototype.setupFont=function(t){this._font=Object.assign(this.standardFont(),t)},DKTools.Sprite.prototype.setupFrame=function(t,e,i,n){const s=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,n),r=Object.assign(this.standardFrame(),s);Sprite.prototype.setFrame.call(this,r.x,r.y,r.width,r.height)},DKTools.Sprite.prototype.setupGraphicFolder=function(t){this._graphicFolder=_.defaultTo(t,this.standardGraphicFolder())},DKTools.Sprite.prototype.setupGraphicLoadListener=function(t){this._graphicLoadListener=t||null},DKTools.Sprite.prototype.setupGraphicName=function(t){this._graphicName=null!==t?_.defaultTo(t,this.standardGraphicName()):null},DKTools.Sprite.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this._bitmapHeight=this._checkHeight(t)},DKTools.Sprite.prototype.setupMask=function(t){this.mask=null!==t?_.defaultTo(t,this.standardMask()):null},DKTools.Sprite.prototype.setupOpacity=function(t){this._opacity=DKTools.Utils.Number.clamp(_.defaultTo(t,this.standardOpacity(),0,255))},DKTools.Sprite.prototype.setupPaintOpacity=function(t){this._paintOpacity=_.defaultTo(t,this.standardPaintOpacity())},DKTools.Sprite.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);this.setupWidth(t),this.setupHeight(e)},DKTools.Sprite.prototype.setupTextColor=function(t){this._textColor=t||this.standardTextColor()},DKTools.Sprite.prototype.setupWidth=function(t){this._bitmapWidth=this._checkWidth(t)},DKTools.Sprite.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let n=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setAlign(t.align,!0)&&n++,this.setAnchor(t.anchor)&&n++,this.setFont(t.font,!0)&&n++,this.setTextColor(t.textColor,!0)&&n++,this.setPaintOpacity(t.paintOpacity,!0)&&n++,this.setFillColor(t.fillColor,!0)&&n++,this.setOpacity(t.opacity,!0)&&n++,this.setGraphicFolder(t.graphicFolder,!0)&&n++,this.setGraphicName(t.graphicName,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n},DKTools.Sprite.prototype.setAlign=function(t,e=!1){if(this._align===t)return!1;const i=this._align;return this.setupAlign(t),this._align!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setAnchor=function(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.anchor,i))return!1;const n=DKTools.Utils.Point.clone(this.anchor);return this.setupAnchor(i),!DKTools.Utils.Point.equals(this.anchor,n)},DKTools.Sprite.prototype.setBitmap=function(t){return this.bitmap!==t&&(this.setupBitmap(t),!0)},DKTools.Sprite.prototype.setFillColor=function(t,e=!1){if(this._fillColor===t)return!1;const i=this._fillColor;return this.setupFillColor(t),this._fillColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setFont=function(t,e=!1){if(_.isEqual(this._font,Object.assign(this.standardFont(),t)))return!1;const i={...this._font};return this.setupFont(t),!_.isEqual(this._font,i)&&(e||this.start(),!0)},DKTools.Sprite.prototype.setFrame=function(t,e,i,n){const s=DKTools.Utils.Rectangle.toRectangle(t,e,i,n);if(DKTools.Utils.Rectangle.equals(this._frame,s))return!1;const r=DKTools.Utils.Rectangle.clone(this._frame);return this.setupFrame(s),!DKTools.Utils.Rectangle.equals(this._frame,r)},DKTools.Sprite.prototype.setGraphicFolder=function(t,e=!1){if(this._graphicFolder===t)return!1;const i=this._graphicFolder;return this.setupGraphicFolder(t),this._graphicFolder!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setGraphicName=function(t,e=!1){if(this._graphicName===t)return!1;const i=this._graphicName;return this.setupGraphicName(t),this._graphicName!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setHeight=function(t,e=!1){return this.resize(this._getBitmapWidth(),t,e)},DKTools.Sprite.prototype.setMask=function(t){return this.mask!==t&&(this.setupMask(t),!0)},DKTools.Sprite.prototype.setOpacity=function(t,e=!1){if(this._opacity===t)return!1;const i=this._opacity;return this.setupOpacity(t),this._opacity!==i&&(e||this.updateOpacity(),!0)},DKTools.Sprite.prototype.setPaintOpacity=function(t,e=!1){if(this._paintOpacity===t)return!1;const i=this._paintOpacity;return this.setupPaintOpacity(t),this._paintOpacity!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setTextColor=function(t,e=!1){if(this._textColor===t)return!1;const i=this._textColor;return this.setupTextColor(t),this._textColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setWidth=function(t,e=!1){return this.resize(t,this._getBitmapHeight(),e)},DKTools.Sprite.prototype.redrawAll=function(){this.clear(),this.drawAll(),this.updateRedrawAllEvents()},DKTools.Sprite.prototype.removeBitmap=function(){this.hasBitmap()&&this.setBitmap(null)},DKTools.Sprite.prototype.removeFillColor=function(){this.hasFillColor()&&this.setFillColor(null)},DKTools.Sprite.prototype.removeGraphicName=function(){this.hasGraphicName()&&this.setGraphicName(null)},DKTools.Sprite.prototype.removeText=function(t,e=!1){const i=this.findText(t);return i?(DKTools.Utils.Array.remove(this._texts,i),e||this.refreshAll(),i):null},DKTools.Sprite.prototype.reserveAnimation=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/animations/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveBattleback1=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks1/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveBattleback2=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks2/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveBitmap=function(t,e,i,n,s,r){if(t instanceof Object)return this.reserveBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);const o=DKTools.Utils.Bitmap.reserve(t,e,null,n,s,r);return!!this.setBitmap(o)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.reserveCharacter=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/characters/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveEnemy=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/enemies/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveFace=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/faces/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveParallax=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t,e,i,n,s)},DKTools.Sprite.prototype.reservePicture=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/pictures/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveSvActor=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_actors/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveSvEnemy=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_enemies/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveSystem=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/system/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveTileset=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap(ImageManager.TILESETS_FOLDER,t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap(ImageManager.TILESETS_FOLDER,t,e,i,n,s)},DKTools.Sprite.prototype.reserveTitle1=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles1/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveTitle2=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles2/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveWindowskin=function(t,e,i,n,s){return t instanceof Object?this.reserveSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth,t.reservationId):this.reserveSystem(t||this.standardWindowskin(),e,i,n,s)},DKTools.Sprite.prototype.resetAll=function(){this.resetFont(),this.resetPaintOpacity(),this.resetTextColor()},DKTools.Sprite.prototype.resetFont=function(){this.changeFont(this.font)},DKTools.Sprite.prototype.resetPaintOpacity=function(){this.changePaintOpacity(this.paintOpacity)},DKTools.Sprite.prototype.resetTextColor=function(){this.changeTextColor(this.textColor)},DKTools.Sprite.prototype.resize=function(t,e,i=!1,n=!1){if(!this.isResizable())return!1;if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._bitmapWidth===t&&this._bitmapHeight===e)return!1;const s=this._bitmapWidth,r=this._bitmapHeight;return this.setupSize(t,e),(this._bitmapWidth!==s||this._bitmapHeight!==r)&&(i||this.start(),n&&this.activate(),!0)},DKTools.Sprite.prototype.rotateHue=function(t){return!(!this.hasBitmap()||!t)&&(this.bitmap.rotateHue(t),!0)},DKTools.Sprite.prototype.updateAll=function(){DKTools.Base.prototype.updateAll.call(this),this.updateBitmap()},DKTools.Sprite.prototype.updateBitmap=function(){this.hasBitmap()&&(this.updateFont(),this.updatePaintOpacity(),this.updateTextColor())},DKTools.Sprite.prototype.updateDrawAllEvents=function(){this.updateEventsContainer("draw-all")},DKTools.Sprite.prototype.updateFill=function(){this.hasFillColor()&&this.fillAll(this.fillColor)},DKTools.Sprite.prototype.updateFont=function(t={}){t=t||{},this.bitmap.fontFace=t.fontFace||this.font.fontFace,this.bitmap.fontItalic=!!t.fontItalic,this.bitmap.fontSize=t.fontSize||this.font.fontSize},DKTools.Sprite.prototype.updatePaintOpacity=function(t){Number.isFinite(t)||(t=this.paintOpacity),this.bitmap.paintOpacity=t},DKTools.Sprite.prototype.updateTextColor=function(t){this.bitmap.textColor=t||this.textColor},DKTools.Sprite.prototype.updateOpacity=function(t){Number.isFinite(t)||(t=this.opacity),this.alpha=DKTools.Utils.Number.clamp(t,0,255)/255},DKTools.Sprite.Button=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearMousePressTime()}_clearMousePressTime(){this._mousePressTime=0}isPressed(){return this._mousePressTime>0&&!this.isLongPressed()}isLongPressed(){return this._mousePressTime>=this._longPressInterval}_setupEvents(){DKTools.Sprite.prototype._setupEvents.call(this),this._setupUpdateButtonStateEvent()}_setupOptions(){DKTools.Sprite.prototype._setupOptions.call(this),this._setupProcessMouseOption()}_setupUpdateButtonStateEvent(){this.addEvent({type:"update",onUpdate:this.updateButtonState.bind(this)})}_setupProcessMouseOption(){this.enableOption("process-mouse")}standardActive(){return!1}standardLongPressInterval(){return 18}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupLongPressInterval(t.longPressInterval)}setupLongPressInterval(t){this._longPressInterval=t||this.standardLongPressInterval()}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setLongPressInterval(t.longPressInterval)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setLongPressInterval(t){if(this._longPressInterval===t)return!1;const e=this._longPressInterval;return this.setupLongPressInterval(t),this._longPressInterval!==e}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processMousePress()}processMousePress(){if(this.isVisible()&&this.isMouseInside()&&(this.isActive()||this.isOptionEnabled("process-mouse-press-ignore-active")))if(TouchInput.isMousePressed()){let t;this._mousePressTime++,TouchInput.isLeftButtonPressed()?t="left":TouchInput.isMiddleButtonPressed()?t="middle":TouchInput.isRightButtonPressed()&&(t="right"),t&&(this.updateMouseDownEvents(t),this.isLongPressed()&&(this._mousePressTime===this._longPressInterval&&this.updateMouseLongPressStartedEvents(t),this.updateMouseLongPressEvents(t)))}else{let t;TouchInput.isLeftButtonReleased()?t="left":TouchInput.isMiddleButtonReleased()?t="middle":TouchInput.isRightButtonReleased()&&(t="right"),t&&(this.isLongPressed()?this.updateMouseLongPressFinishedEvents(t):this.isPressed()&&this.updateMouseClickEvents(t),this._mousePressTime>0&&this.updateMouseUpEvents(t)),this._clearMousePressTime()}else this._clearMousePressTime()}updateMouseDownEvents(t){this.updateEventsContainer("mouse-down-"+t)}updateMouseUpEvents(t){this.updateEventsContainer("mouse-up-"+t)}updateMouseClickEvents(t){this.updateEventsContainer("mouse-click-"+t)}updateMouseLongPressEvents(t){this.updateEventsContainer("mouse-long-press-"+t)}updateMouseLongPressStartedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-started`)}updateMouseLongPressFinishedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-finished`)}updateStateNormalEvents(){this.updateEventsContainer("state-normal")}updateStatePressedEvents(){this.updateEventsContainer("state-pressed")}updateButtonState(){this._mousePressTime>0?this.updateStatePressedEvents():this.updateStateNormalEvents()}},Object.defineProperties(DKTools.Sprite.Button.prototype,{longPressInterval:{get:function(){return this._longPressInterval},configurable:!0},mousePressTime:{get:function(){return this._mousePressTime},configurable:!0}}),DKTools.Sprite.Cursor=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearAnimationCount()}_clearAnimationCount(){this._animationCount=0}_createAll(){DKTools.Sprite.prototype._createAll.call(this),this._createWindowskin()}_createWindowskin(){this._windowskin=ImageManager.loadSystem(this.standardWindowskin())}refreshAll(){DKTools.Sprite.prototype.refreshAll.call(this),this.refreshCursor()}refreshCursor(){const t=this._cursorRect.x,e=this._cursorRect.y,i=this._cursorRect.width,n=this._cursorRect.height,s=this.parent,r=Math.min(i,s.width-t),o=Math.min(n,s.height-e);if(this.move(t,e),i>0&&n>0){const t=this._windowskin,e=new Bitmap(r,o),s=96,a=48;e.blt(t,s+4,s+4,a-8,a-8,4,4,i-8,n-8),e.blt(t,s+4,s,a-8,4,4,0,i-8,4),e.blt(t,s+4,s+a-4,a-8,4,4,0+n-4,i-8,4),e.blt(t,s,s+4,4,a-8,0,4,4,n-8),e.blt(t,s+a-4,s+4,4,a-8,0+i-4,4,4,n-8),e.blt(t,s,s,4,4,0,0,4,4),e.blt(t,s+a-4,s,4,4,0+i-4,0,4,4),e.blt(t,s,s+a-4,4,4,0,0+n-4,4,4),e.blt(t,s+a-4,s+a-4,4,4,0+i-4,0+n-4,4,4),this.setupBitmap(e)}}standardBlinkSpeed(){return 8}standardCursorRect(){return new Rectangle(0,0,0,0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupBlinkSpeed(t.blinkSpeed),this.setupCursorRect(t.cursorRect)}setupBlinkSpeed(t){this._blinkSpeed=_.defaultTo(t,this.standardBlinkSpeed())}setupCursorRect(t,e,i,n){const s=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,n);this._cursorRect=Object.assign(this.standardCursorRect(),s)}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setBlinkSpeed(t.blinkSpeed)&&n++,this.setCursorRect(t.cursorRect)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setBlinkSpeed(t){if(this._blinkSpeed===t)return!1;const e=this._blinkSpeed;return this.setupBlinkSpeed(t),this._blinkSpeed!==e}setCursorRect(t,e,i,n){const s=DKTools.Utils.Rectangle.toRectangle(t,e,i,n);if(DKTools.Utils.Rectangle.equals(this._cursorRect,s))return!1;const r=DKTools.Utils.Rectangle.clone(this._cursorRect);return this.setupCursorRect(s),!DKTools.Utils.Rectangle.equals(this._cursorRect,r)&&(this.refreshCursor(),!0)}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processCursorAnimation()}processCursorAnimation(){const t=this._animationCount%40;let e=this.parent.getCurrentOpacity();this.parent.isVisibleAndActive()&&(this._animationCount++,e-=t<20?t*this._blinkSpeed:(40-t)*this._blinkSpeed),this.setOpacity(e)}},Object.defineProperties(DKTools.Sprite.Cursor.prototype,{cursorRect:{get:function(){return this._cursorRect},configurable:!0},blinkSpeed:{get:function(){return this._blinkSpeed},configurable:!0}}),DKTools.Sprite.Arrow=class extends DKTools.Sprite.Button{static getRect(t){const e=24,i=12;let n,s,r,o;switch(t){case"up":n=132,s=24,r=e,o=i;break;case"down":n=132,s=60,r=e,o=i;break;case"left":n=120,s=36,r=i,o=e;break;case"right":n=156,s=36,r=i,o=e}return DKTools.Utils.Rectangle.tryToRectangle(n,s,r,o)}refreshAll(){DKTools.Sprite.Button.prototype.refreshAll.call(this),this.refreshArrow()}refreshArrow(){this.setFrame(DKTools.Sprite.Arrow.getRect(this._arrowType))}standardVisible(){return!1}standardGraphicName(){return this.standardWindowskin()}standardAnchor(){return new Point(.5,.5)}standardArrowType(){return null}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupArrowType(t.arrowType)}setupArrowType(t){this._arrowType=t||this.standardArrowType()}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setArrowType(t.arrowType,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setArrowType(t,e=!1){if(this._arrowType===t)return!1;const i=this._arrowType;return this.setupArrowType(t),this._arrowType!==i&&(e||this.refreshAll(),!0)}},Object.defineProperties(DKTools.Sprite.Arrow.prototype,{arrowType:{get:function(){return this._arrowType},configurable:!0}}),DKTools.Sprite.Selectable=class extends DKTools.Sprite.Button{_addAllChildren(){DKTools.Sprite.Button.prototype._addAllChildren.call(this),this._addCursorSprite()}_addCursorSprite(){this.addChild(this._cursorSprite)}activate(){DKTools.Sprite.Button.prototype.activate.call(this),this.reselect()}addItem(t,e=!1){const i=this.insertItem(t,this.getMaxItems()-1,!0);return e||this.refreshAll(),i}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return e||this.refreshAll(),i}_clearAll(){DKTools.Sprite.Button.prototype._clearAll.call(this),this._clearItems(),this._clearHandlers(),this._clearTopRow(),this._clearTopCol()}_clearItems(){this._items=[]}_clearHandlers(){this._handlers={}}_clearTopRow(){this._topRow=0}_clearTopCol(){this._topCol=0}_createAll(){DKTools.Sprite.Button.prototype._createAll.call(this),this._createCursorSprite()}_createCursorSprite(){this._cursorSprite=new DKTools.Sprite.Cursor}_checkItem(t){return void 0===t.enabled&&(t.enabled=!0),void 0===t.ext&&(t.ext=null),t.symbol&&DKTools.Utils.isFunction(t.handler)&&this.setHandler(t.symbol,t.handler),t}callHandler(t){this.isHandled(t)&&this._handlers[t](this._index,this)}callOkHandler(){const t=this.getCurrentItemSymbol();this.isHandled(t)?this.callHandler(t):this.isHandled("ok")?this.callHandler("ok"):this.activate()}callCancelHandler(){this.callHandler("cancel")}clearItem(t){this.clearRect(this.getItemRect(t))}cursorDown(t=!1){this.hasCursorDownHandler()&&this._cursorDownHandler(t,this)}cursorUp(t=!1){this.hasCursorUpHandler()&&this._cursorUpHandler(t,this)}cursorRight(t=!1){this.hasCursorRightHandler()&&this._cursorRightHandler(t,this)}cursorLeft(t=!1){this.hasCursorLeftHandler()&&this._cursorLeftHandler(t,this)}cursorPageDown(){this.hasCursorPageDownHandler()&&this._cursorPageDownHandler(this)}cursorPageUp(){this.hasCursorPageUpHandler()&&this._cursorPageUpHandler(this)}deactivate(t=!1){DKTools.Sprite.Button.prototype.deactivate.call(this),t&&this.deselect()}deselect(){this.selectItem(-1)}disableItem(t,e=!1){(this.getItem(t)||{}).enabled=!1,e||this.refreshAll()}drawAll(){DKTools.Sprite.Button.prototype.drawAll.call(this),this.drawAllItems()}drawAllItems(){const t=this.getMaxPageItems(),e=this.getMaxItems();let i=this.getTopIndex();for(let n=0;n0?this._index-1:t?this.getMaxItems()-1:-1}getNextIndex(t=!1){return this._index0}hasSymbol(t){return _.includes(this._items,{symbol:t})}hasExt(t){return _.includes(this._items,{ext:t})}hasCursorDownHandler(){return!!this._cursorDownHandler}hasCursorUpHandler(){return!!this._cursorUpHandler}hasCursorRightHandler(){return!!this._cursorRightHandler}hasCursorLeftHandler(){return!!this._cursorLeftHandler}hasCursorPageDownHandler(){return!!this._cursorPageDownHandler}hasCursorPageUpHandler(){return!!this._cursorPageUpHandler}hasDrawItemHandler(){return!!this._itemDrawHandler}hideCursor(){this._cursorSprite.hide()}hitTest(t,e){if(this.isOutside(t,e))return-1;const i=this.scale,n=this.getLocalPoint(t,e),s=this.getMaxPageItems(),r=this.getMaxItems();let o=this.getTopIndex();for(let t=0;tthis.insertItem(t,e+i,!0));return i||this.refreshAll(),n}isCursorFixed(){return this._cursorFixed}isCursorAll(){return this._cursorAll}isFixedHorizontal(){return this._fixedHorizontal}isHorizontal(){return this.isFixedHorizontal()||1===this.getMaxPageRows()}isVertical(){return!this.isHorizontal()}isCursorMovable(){return this.isVisibleAndActive()&&!this.isCursorFixed()&&!this.isCursorAll()&&this.hasItems()}isOkEnabled(){return!0}isCancelEnabled(){return this.isHandled("cancel")}isOkTriggered(){return Input.isRepeated("ok")}isCancelTriggered(){return Input.isRepeated("cancel")||TouchInput.isCancelled()}isCursorVisible(){if(!this._cursorSprite.isVisible())return!1;if(this.isHorizontal()){const t=this.getCurrentCol();return t>=this.getTopCol()&&t<=this.getBottomCol()}const t=this.getCurrentRow();return t>=this.getTopRow()&&t<=this.getBottomRow()}isItemEnabled(t){const e=(this.getItem(t)||{}).enabled;return DKTools.Utils.isFunction(e)?e(t,this):e}isCurrentItemEnabled(){return this.isItemEnabled(this._index)}isItemVisible(t){return DKTools.Utils.Number.inRange(t,this.getTopIndex(),this.getBottomIndex()+1)}isItemSelected(t){return this._index===t}isHandled(t){return!!this._handlers[t]}isItemHandled(t){const e=this.getItem(t)||{};return this.isHandled(e.symbol)||DKTools.Utils.isFunction(e.okHandler)}isCurrentItemHandled(){return this.isItemHandled(this._index)}_onTouch(t=!1){const e=this._index,i=TouchInput.x,n=TouchInput.y,s=this.hitTest(i,n);s>=0&&(this._index===s?t&&this.isOkEnabled()&&this.processOk():this.isCursorMovable()&&this.selectItem(s)),this._index!==e&&this.playCursorSound()}playOkSound(){SoundManager.playOk()}playCancelSound(){SoundManager.playCancel()}playCursorSound(){SoundManager.playCursor()}playBuzzerSound(){SoundManager.playBuzzer()}processAll(){DKTools.Sprite.Button.prototype.processAll.call(this),this.processCursorMove(),this.processHandling()}processCursorMove(){if(!this.isCursorMovable())return;const t=this._index;Input.isRepeated("down")&&this.cursorDown(Input.isTriggered("down")),Input.isRepeated("up")&&this.cursorUp(Input.isTriggered("up")),Input.isRepeated("right")&&this.cursorRight(Input.isTriggered("right")),Input.isRepeated("left")&&this.cursorLeft(Input.isTriggered("left")),Input.isTriggered("pagedown")&&this.cursorPageDown(),Input.isTriggered("pageup")&&this.cursorPageUp(),this._index!==t&&this.playCursorSound()}processHandling(){this.isVisibleAndActive()&&(this.isOkEnabled()&&this.isOkTriggered()?this.processOk():this.isCancelEnabled()&&this.isCancelTriggered()&&this.processCancel())}processMouseHover(){if(this.isOptionEnabled("process-mouse-hover")&&this.isCursorMovable()&&TouchInput.date>Input.date){const t=this._index,e=TouchInput.mouseX,i=TouchInput.mouseY,n=this.hitTest(e,i);n>=0&&n!==t&&this.selectItem(n,!0)}}processWheelScroll(){if(this.isOptionEnabled("process-wheel-scroll")&&this.isVisibleAndActive()){this._wheelY>0?this.isHorizontal()?this.scrollRight():this.scrollDown():this.isHorizontal()?this.scrollLeft():this.scrollUp()}}processOk(){if(this.isCurrentItemEnabled()){this.playOkSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem()||{};DKTools.Utils.isFunction(t.okHandler)?t.okHandler(this._index,this):this.callOkHandler()}else this.playBuzzerSound()}processCancel(){this.playCancelSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem();t&&DKTools.Utils.isFunction(t.cancelHandler)?t.cancelHandler(this._index,this):this.callCancelHandler()}redrawItem(t){this.isItemVisible(t)&&(this.clearItem(t),this.drawItem(t))}redrawCurrentItem(){this.redrawItem(this._index)}removeHandler(t){delete this._handlers[t]}removeItem(t,e=!1){const i=this.getItem(t);return i?(DKTools.Utils.Array.remove(this._items,i),e||this.refreshAll(),i):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return e||this.refreshAll(),i}replaceItem(t,e,i=!1){const n=this._checkItem(t);e=e||0;const s=this._items[e];return this._items[e]=n,i||this.refreshAll(),s}reselect(){this.selectItem(this._index)}resetScroll(){0!==this._index&&this.selectItem(0)}_setupEvents(){DKTools.Sprite.Button.prototype._setupEvents.call(this),this._setupMouseClickEvent(),this._setupMouseLongPressEvent(),this._setupMouseHoverEvents(),this._setupWheelScrollEvents()}_setupMouseClickEvent(){this.addEvent({type:"mouse-click-left",onUpdate:this._onTouch.bind(this,!0)})}_setupMouseLongPressEvent(){this.addEvent({type:"mouse-long-press-left",onUpdate:this._onTouch.bind(this,!1)})}_setupMouseHoverEvents(){this.addEvent({type:"mouse-enter",onUpdate:this.processMouseHover.bind(this)}),this.addEvent({type:"mouse-move",onUpdate:this.processMouseHover.bind(this)})}_setupWheelScrollEvents(){this.addEvent({type:"wheel-Y-inside",onUpdate:this.processWheelScroll.bind(this)}),this.addEvent({type:"wheel-Y-outside",onUpdate:this.processWheelScroll.bind(this)})}standardIndex(){return 0}standardMaxCols(){return 1}standardCursorFixed(){return!1}standardCursorAll(){return!1}standardFixedHorizontal(){return!1}standardHorizontalSpacing(){return 0}standardVerticalSpacing(){return 0}standardTextPadding(){return 6}standardCursorDownHandler(){return t=>{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),n=this.getMaxCols();(e{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),n=this.getMaxCols();(e>=n||t&&i===this.getMaxRows()*n)&&this.selectItem((e-n+i)%i)}}standardCursorRightHandler(){return t=>{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i>0||t)&&this.selectItem((i-1+e)%e)}else this.selectPrevItem(t)}}standardCursorPageDownHandler(){return()=>{if(this.isHorizontal()){const t=this.getTopCol(),e=this.getMaxPageCols(),i=this.getMaxItems();t+e{if(this.isHorizontal()){const t=this.getTopCol();t>0&&(this.setTopCol(t-this.getMaxPageCols()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}else{const t=this.getTopRow();t>0&&(this.setTopRow(t-this.getMaxPageRows()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}}}standardItems(){return[]}standardItemDrawHandler(){return t=>{const e=this.getItemName(t),i=this.getItemFont(t),n=this.getItemTextColor(t),s=this.getItemPaintOpacity(t),r=this.getItemAlign(t),o=this.getItemRectForText(t);this.drawText(e,{font:i,textColor:n,paintOpacity:s,align:r,rect:o,resetFont:!0,resetTextColor:!0,resetPaintOpacity:!0})}}standardItemWidth(){return()=>Math.floor((this.width+this._horizontalSpacing)/this.getMaxCols()-this._horizontalSpacing)}standardItemHeight(){return this.getLineHeight()}standardItemRect(){return t=>{const e=new Rectangle(0,0,this.getItemWidth(),this.getItemHeight()),i=this.getMaxCols();return this.isHorizontal()?(e.x=(t-this.getTopCol())*(e.width+this._horizontalSpacing),e.y=0):(e.x=t%i*(e.width+this._horizontalSpacing),e.y=(Math.floor(t/i)-this.getTopRow())*(e.height+this._verticalSpacing)),e}}standardItemFont(){return()=>this.font}standardItemTextColor(){return()=>this.textColor}standardItemPaintOpacity(){return t=>this.isItemEnabled(t)?this.standardEnabledItemPaintOpacity():this.standardDisabledItemPaintOpacity()}standardEnabledItemPaintOpacity(){return 255}standardDisabledItemPaintOpacity(){try{return Window_Base.prototype.translucentOpacity.call(this)}catch(t){return 160}}standardItemAlign(){return this.align}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupIndex(t.index),this.setupMaxCols(t.maxCols),this.setupFixedHorizontal(t.fixedHorizontal),this.setupCursorFixed(t.cursorFixed),this.setupCursorAll(t.cursorAll),this.setupCursorDownHandler(t.cursorDownHandler),this.setupCursorUpHandler(t.cursorUpHandler),this.setupCursorRightHandler(t.cursorRightHandler),this.setupCursorLeftHandler(t.cursorLeftHandler),this.setupCursorPageDownHandler(t.cursorPageDownHandler),this.setupCursorPageUpHandler(t.cursorPageUpHandler),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupTextPadding(t.textPadding),this.setupItems(t.items),this.setupItemDrawHandler(t.drawItemHandler),this.setupItemWidth(t.itemWidth),this.setupItemHeight(t.itemHeight),this.setupItemRect(t.itemRect),this.setupItemFont(t.itemFont),this.setupItemTextColor(t.itemTextColor),this.setupItemPaintOpacity(t.itemPaintOpacity),this.setupItemAlign(t.itemAlign)}setupIndex(t){this._lastIndex=this._index,this._index=_.defaultTo(t,this.standardIndex())}setupMaxCols(t){this._maxCols=t||this.standardMaxCols()}setupFixedHorizontal(t){this._fixedHorizontal=_.defaultTo(t,this.standardFixedHorizontal())}setupCursorFixed(t){this._cursorFixed=_.defaultTo(t,this.standardCursorFixed())}setupCursorAll(t){this._cursorAll=_.defaultTo(t,this.standardCursorAll())}setupCursorDownHandler(t){this._cursorDownHandler=t||this.standardCursorDownHandler()}setupCursorUpHandler(t){this._cursorUpHandler=t||this.standardCursorUpHandler()}setupCursorRightHandler(t){this._cursorRightHandler=t||this.standardCursorRightHandler()}setupCursorLeftHandler(t){this._cursorLeftHandler=t||this.standardCursorLeftHandler()}setupCursorPageDownHandler(t){this._cursorPageDownHandler=t||this.standardCursorPageDownHandler()}setupCursorPageUpHandler(t){this._cursorPageUpHandler=t||this.standardCursorPageUpHandler()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupTextPadding(t){this._textPadding=_.defaultTo(t,this.standardTextPadding())}setupItems(t){this._items=_.map(t||this.standardItems(),t=>this._checkItem(t))}setupItemDrawHandler(t){this._itemDrawHandler=t||this.standardItemDrawHandler()}setupItemWidth(t){this._itemWidth=t||this.standardItemWidth()}setupItemHeight(t){this._itemHeight=t||this.standardItemHeight()}setupItemRect(t){this._itemRect=t||this.standardItemRect()}setupItemFont(t){this._itemFont=t||this.standardItemFont()}setupItemTextColor(t){this._itemTextColor=t||this.standardItemTextColor()}setupItemPaintOpacity(t){this._itemPaintOpacity=t||this.standardItemPaintOpacity()}setupItemAlign(t){this._itemAlign=t||this.standardItemAlign()}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setIndex(t.index,!0)&&n++,this.setMaxCols(t.maxCols,!0)&&n++,this.setFixedHorizontal(t.fixedHorizontal,!0)&&n++,this.setCursorFixed(t.cursorFixed,!0)&&n++,this.setCursorAll(t.cursorAll,!0)&&n++,this.setCursorDownHandler(t.cursorDownHandler,!0)&&n++,this.setCursorUpHandler(t.cursorUpHandler,!0)&&n++,this.setCursorRightHandler(t.cursorRightHandler,!0)&&n++,this.setCursorLeftHandler(t.cursorLeftHandler,!0)&&n++,this.setCursorPageDownHandler(t.cursorPageDownHandler,!0)&&n++,this.setCursorPageUpHandler(t.cursorPageUpHandler,!0)&&n++,n+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setTextPadding(t.textPadding,!0)&&n++,this.setItems(t.items,!0)&&n++,this.setItemDrawHandler(t.drawItemHandler,!0)&&n++,this.setItemWidth(t.itemWidth,!0)&&n++,this.setItemHeight(t.itemHeight,!0)&&n++,this.setItemRect(t.itemRect,!0)&&n++,this.setItemFont(t.itemFont,!0)&&n++,this.setItemTextColor(t.itemTextColor,!0)&&n++,this.setItemPaintOpacity(t.itemPaintOpacity,!0)&&n++,this.setItemAlign(t.itemAlign,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setIndex(t,e=!1){return this._index!==t&&(this.setupIndex(t),this._index!==this._lastIndex&&(e||this.refreshAll(),!0))}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.refreshAll(),!0)}setFixedHorizontal(t,e=!1){if(this._fixedHorizontal===t)return!1;const i=this._fixedHorizontal;return this.setupFixedHorizontal(t),this._fixedHorizontal!==i&&(e||this.refreshAll(),!0)}setCursorFixed(t,e=!1){if(this._cursorFixed===t)return!1;const i=this._cursorFixed;return this.setupCursorFixed(t),this._cursorFixed!==i&&(e||this.refreshAll(),!0)}setCursorAll(t,e=!1){if(this._cursorAll===t)return!1;const i=this._cursorAll;return this.setupCursorAll(t),this._cursorAll!==i&&(e||this.refreshAll(),!0)}setCursorDownHandler(t,e=!1){if(this._cursorDownHandler===t)return!1;const i=this._cursorDownHandler;return this.setupCursorDownHandler(t),this._cursorDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorUpHandler(t,e=!1){if(this._cursorUpHandler===t)return!1;const i=this._cursorUpHandler;return this.setupCursorUpHandler(t),this._cursorUpHandler!==i&&(e||this.refreshAll(),!0)}setCursorRightHandler(t,e=!1){if(this._cursorRightHandler===t)return!1;const i=this._cursorRightHandler;return this.setupCursorRightHandler(t),this._cursorRightHandler!==i&&(e||this.refreshAll(),!0)}setCursorLeftHandler(t,e=!1){if(this._cursorLeftHandler===t)return!1;const i=this._cursorLeftHandler;return this.setupCursorLeftHandler(t),this._cursorLeftHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageDownHandler(t,e=!1){if(this._cursorPageDownHandler===t)return!1;const i=this._cursorPageDownHandler;return this.setupCursorPageDownHandler(t),this._cursorPageDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageUpHandler(t,e=!1){if(this._cursorPageUpHandler===t)return!1;const i=this._cursorPageUpHandler;return this.setupCursorPageUpHandler(t),this._cursorPageUpHandler!==i&&(e||this.refreshAll(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.refreshAll(),!0)}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.refreshAll(),!0)}setSpacing(t,e,i=!1){let n=0;return this.setHorizontalSpacing(t,!0)&&n++,this.setVerticalSpacing(e,!0)&&n++,n>0&&!i&&this.refreshAll(),n}setTextPadding(t,e=!1){if(this._textPadding===t)return!1;const i=this._textPadding;return this.setupTextPadding(t),this._textPadding!==i&&(e||this.refreshAll(),!0)}setItems(t,e=!1){return this._items!=t&&(this.setupItems(t),e||this.refreshAll(),!0)}setItemDrawHandler(t,e=!1){if(this._itemDrawHandler===t)return!1;const i=this._itemDrawHandler;return this.setupItemDrawHandler(t),this._itemDrawHandler!==i&&(e||this.refreshAll(),!0)}setItemWidth(t,e=!1){if(this._itemWidth===t)return!1;const i=this._itemWidth;return this.setupItemWidth(t),this._itemWidth!==i&&(e||this.refreshAll(),!0)}setItemHeight(t,e=!1){if(this._itemHeight===t)return!1;const i=this._itemHeight;return this.setupItemHeight(t),this._itemHeight!==i&&(e||this.refreshAll(),!0)}setItemFont(t,e=!1){if(this._itemFont===t)return!1;const i=this._itemFont;return this.setupItemFont(t),this._itemFont!==i&&(e||this.refreshAll(),!0)}setItemTextColor(t,e=!1){if(this._itemTextColor===t)return!1;const i=this._itemTextColor;return this.setupItemTextColor(t),this._itemTextColor!==i&&(e||this.refreshAll(),!0)}setItemPaintOpacity(t,e=!1){if(this._itemPaintOpacity===t)return!1;const i=this._itemPaintOpacity;return this.setupItemPaintOpacity(t),this._itemPaintOpacity!==i&&(e||this.refreshAll(),!0)}setItemAlign(t,e=!1){if(this._itemAlign===t)return!1;const i=this._itemAlign;return this.setupItemAlign(t),this._itemAlign!==i&&(e||this.refreshAll(),!0)}setTopRow(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopRow());this._topRow!==i&&(this._topRow=i,e||this.refreshAll())}setTopCol(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopCol());this._topCol!==i&&(this._topCol=i,e||this.refreshAll())}setBottomRow(t,e=!1){this.setTopRow(t-(this.getMaxPageRows()-1),e)}setBottomCol(t,e=!1){this.setTopCol(t-(this.getMaxPageCols()-1),e)}setHandler(t,e){this._handlers[t]=e}setCursorRect(t,e,i,n){return this._cursorSprite.setCursorRect(t,e,i,n)}showCursor(){this._cursorSprite.show(!0)}selectItem(t,e=!1){const i=this.getItem(t);this.setupIndex(t),this.refreshAll(),e&&this.playCursorSound(),i&&DKTools.Utils.isFunction(i.selectHandler)&&i.selectHandler(t,this),this.updateSelectEvents()}selectSymbol(t){const e=Math.max(0,this.findSymbol(t));this.selectItem(e)}selectExt(t){const e=Math.max(0,this.findExt(t));this.selectItem(e)}selectPrevItem(t=!1,e=!1){const i=this.getPrevIndex(t);i>=0&&this.selectItem(i,e)}selectNextItem(t=!1,e=!1){const i=this.getNextIndex(t);i>=0&&this.selectItem(i,e)}selectLastItem(t=!1){this.selectItem(this.getMaxItems()-1,t)}scrollDown(){this.getTopRow()+10&&this.cursorUp()}scrollRight(){this.getTopCol()+10&&this.cursorLeft()}updateAll(){DKTools.Sprite.Button.prototype.updateAll.call(this),this.updateCursor()}updateCursor(){if(this.isHorizontal()){const t=this.getCurrentCol();tthis.getBottomCol()&&this.setBottomCol(t)}else{const t=this.getCurrentRow();tthis.getBottomRow()&&this.setBottomRow(t)}if(this.isCursorAll()){const t=this.getMaxRows()*this.getItemHeight();this.setCursorRect(0,0,this.width,t),this.resetScroll()}else if(this.isCursorVisible()||!this._cursorSprite.hasBitmap()){const t=this.getItemRect(this._index);this.setCursorRect(t)}else this.setCursorRect(Rectangle.emptyRectangle)}updateSelectEvents(){this.updateEventsContainer("select")}},Object.defineProperties(DKTools.Sprite.Selectable.prototype,{cursorSprite:{get:function(){return this._cursorSprite},configurable:!0},lastIndex:{get:function(){return this._lastIndex},configurable:!0},index:{get:function(){return this._index},configurable:!0},maxCols:{get:function(){return this._maxCols},configurable:!0},cursorFixed:{get:function(){return this._cursorFixed},configurable:!0},cursorAll:{get:function(){return this._cursorAll},configurable:!0},cursorDownHandler:{get:function(){return this._cursorDownHandler},configurable:!0},cursorUpHandler:{get:function(){return this._cursorUpHandler},configurable:!0},cursorRightHandler:{get:function(){return this._cursorRightHandler},configurable:!0},cursorLeftHandler:{get:function(){return this._cursorLeftHandler},configurable:!0},cursorPageDownHandler:{get:function(){return this._cursorPageDownHandler},configurable:!0},cursorPageUpHandler:{get:function(){return this._cursorPageUpHandler},configurable:!0},horizontalSpacing:{get:function(){return this._horizontalSpacing},configurable:!0},verticalSpacing:{get:function(){return this._verticalSpacing},configurable:!0},textPadding:{get:function(){return this._textPadding},configurable:!0},items:{get:function(){return this._items},configurable:!0},itemDrawHandler:{get:function(){return this._itemDrawHandler},configurable:!0},itemWidth:{get:function(){return this._itemWidth},configurable:!0},itemHeight:{get:function(){return this._itemHeight},configurable:!0},itemFont:{get:function(){return this._itemFont},configurable:!0},itemTextColor:{get:function(){return this._itemTextColor},configurable:!0},itemPaintOpacity:{get:function(){return this._itemPaintOpacity},configurable:!0},itemAlign:{get:function(){return this._itemAlign},configurable:!0}}),DKTools.Sprite.ProgressBar=class extends DKTools.Sprite{addValue(t){t&&this.setValue(this._value+t)}aimateFull(t){return this.animateValue(this._maxValue,t)}animateEmpty(t){return this.animateValue(0,t)}animateValue(t,e){return this.addEvent({type:"update",repeatTime:e,repeats:0,onUpdate:this._updateAnimateValue.bind(this,t)})}canCloneFixedBitmap(){return!1}_drawProgressGraphic(){this.hasDrawGraphicHandler()&&this._drawGraphicHandler(this)}_drawProgressText(){this.hasDrawTextHandler()&&this._drawTextHandler(this)}drawAll(){DKTools.Sprite.prototype.drawAll.call(this),this.drawProgress()}drawProgress(){this._drawProgressGraphic(),this._drawProgressText()}getNextValue(){return Math.min(this._value+this._valueStep,this._maxValue)}getPercents(){return Math.ceil(this._value/this._maxValue*100)}getPrevValue(){return Math.max(0,this._value-this._valueStep)}hasDrawGraphicHandler(){return!!this._drawGraphicHandler}hasDrawTextHandler(){return!!this._drawTextHandler}isEmpty(){return 0===this._value}isFull(){return this._value===this._maxValue}isHorizontal(){return this.width>this.height}isVertical(){return!this.isHorizontal()}makeEmpty(){this.setValue(0)}makeFull(){this.setValue(this._maxValue)}nextValue(){return this.setValue(this.getNextValue())}prevValue(){return this.setValue(this.getPrevValue())}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setValueStep(t.valueStep,!0)&&n++,this.setMaxValue(t.maxValue,!0)&&n++,this.setValue(t.value,!0)&&n++,this.setBackgroundColor(t.backgroundColor,!0)&&n++,this.setProgressColor(t.progressColor,!0)&&n++,this.setDrawGraphicHandler(t.drawGraphicHandler,!0)&&n++,this.setDrawTextHandler(t.drawTextHandler,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setBackgroundColor(t,e=!1){if(this._backgroundColor===t)return!1;const i=this._backgroundColor;return this.setupBackgroundColor(t),this._backgroundColor!==i&&(e||this.refreshAll(),!0)}setDrawGraphicHandler(t,e=!1){return this._drawGraphicHandler!==t&&(this.setupDrawGraphicHandler(t),e||this.refreshAll(),!0)}setDrawTextHandler(t,e=!1){return this._drawTextHandler!==t&&(this.setupDrawTextHandler(t),e||this.refreshAll(),!0)}setMaxValue(t,e=!1){if(this._maxValue===t)return!1;const i=this._maxValue;return this.setupMaxValue(t),this._maxValue!==i&&(e||this.refreshAll(),!0)}setProgressColor(t,e=!1){if(this._progressColor===t)return!1;const i=this._progressColor;return this.setupProgressColor(t),this._progressColor!==i&&(e||this.refreshAll(),!0)}setValue(t,e=!1){if(this._value===t)return!1;const i=this._value;return this.setupValue(t),this._value!==i&&(e||this.refreshAll(),this.updateValueEvents(),!0)}setValueStep(t,e=!1){if(this._valueStep===t)return!1;const i=this._valueStep;return this.setupValueStep(t),this._valueStep!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupValueStep(t.valueStep),this.setupMaxValue(t.maxValue),this.setupValue(t.value),this.setupBackgroundColor(t.progressColor),this.setupProgressColor(t.progressColor),this.setupDrawGraphicHandler(t.drawGraphicHandler),this.setupDrawTextHandler(t.drawTextHandler)}setupBackgroundColor(t){this._backgroundColor=t||this.standardBackgroundColor()}setupDrawGraphicHandler(t){this._drawGraphicHandler=t||this.standardDrawGraphicHandler()}setupDrawTextHandler(t){this._drawTextHandler=t||this.standardDrawTextHandler()}setupMaxValue(t){this._maxValue=t||this.standardMaxValue()}setupProgressColor(t){this._progressColor=t||this.standardProgressColor()}setupValue(t){const e=this._maxValue,i=Math.max(0,Math.min(t,e));this._value=_.defaultTo(i,this.standardValue())}setupValueStep(t){this._valueStep=t||this.standardValueStep()}standardActive(){return!1}standardBackgroundColor(){return"grey"}standardDrawGraphicHandler(){return null}standardDrawTextHandler(){return null}standardMaxValue(){return 100}standardProgressColor(){return"#33ccff"}standardValue(){return 0}standardValueStep(){return 1}subValue(t){this.addValue(-t)}_updateAnimateValue(t,e){const i=e.remainingTime,n=(this._value*(i-1)+t)/i;this.setValue(n)}updateEmptyEvents(){this.isEmpty()&&this.updateEventsContainer("empty")}updateEvents(){DKTools.Sprite.prototype.updateEvents.call(this),this.updateEmptyEvents(),this.updateFullEvents()}updateFullEvents(){this.isFull()&&this.updateEventsContainer("full")}updateValueEvents(){this.updateEventsContainer("value")}},Object.defineProperties(DKTools.Sprite.ProgressBar.prototype,{valueStep:{get:function(){return this._valueStep},configurable:!0},maxValue:{get:function(){return this._maxValue},configurable:!0},value:{get:function(){return this._value},configurable:!0},backgroundColor:{get:function(){return this._backgroundColor},configurable:!0},progressColor:{get:function(){return this._progressColor},configurable:!0},drawGraphicHandler:{get:function(){return this._drawGraphicHandler},configurable:!0},drawTextHandler:{get:function(){return this._drawTextHandler},configurable:!0}}),DKTools.Sprite.ProgressBar.Rectangle=class extends DKTools.Sprite.ProgressBar{standardDrawGraphicHandler(){return()=>{let t;t=this.isHorizontal()?this.standardHorizontalDrawGraphicHandler():this.standardVerticalDrawGraphicHandler(),DKTools.Utils.isFunction(t)&&t(this)}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardHorizontalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue})}}standardVerticalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue,type:"vertical",reversed:!0})}}},DKTools.Sprite.ProgressBar.Circle=class extends DKTools.Sprite.ProgressBar{setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.ProgressBar.prototype.setAll.call(this,t,!0);return this.setLineWidth(t.lineWidth,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setLineWidth(t,e=!1){if(this._lineWidth===t)return!1;const i=this._lineWidth;return this.setupLineWidth(t),this._lineWidth!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.ProgressBar.prototype.setupAll.call(this,t),this.setupLineWidth(t.lineWidth)}setupLineWidth(t){this._lineWidth=t||this.standardLineWidth()}standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,n=i;this.strokeArc({x:i,y:n,radius:e,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:n,radius:e,startAngle:-Math.PI/2,endAngle:-Math.PI/2+2*Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardLineWidth(){return 10}},Object.defineProperties(DKTools.Sprite.ProgressBar.Circle.prototype,{lineWidth:{get:function(){return this._lineWidth},configurable:!0}}),DKTools.Sprite.ProgressBar.SemiCircle=class extends DKTools.Sprite.ProgressBar.Circle{standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,n=this.height;this.strokeArc({x:i,y:n,radius:e,startAngle:Math.PI,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:n,radius:e,startAngle:Math.PI,endAngle:-Math.PI+Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}},DKTools.Sprite.CheckBox=class extends DKTools.Sprite.Button{check(){this.isChecked()||(this.switch(),this.updateCheckedEvents())}isChecked(){return this._checked}_refreshCheckedGraphic(){let t=null;DKTools.Utils.isString(this._checkedGraphic)?t={folder:this._graphicFolder,filename:this._checkedGraphic}:this._checkedGraphic instanceof Object&&(t=this._checkedGraphic),t&&this.loadBitmap(t)}_refreshGraphic(){this.isChecked()?this._refreshCheckedGraphic():this._refreshUncheckedGraphic()}_refreshUncheckedGraphic(){let t=null;DKTools.Utils.isString(this._uncheckedGraphic)?t={folder:this._graphicFolder,filename:this._uncheckedGraphic}:this._uncheckedGraphic instanceof Object&&(t=this._uncheckedGraphic),t&&this.loadBitmap(t)}refreshAll(){this._refreshGraphic(),DKTools.Sprite.Button.prototype.refreshAll.call(this)}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setChecked(t.checked,!0)&&n++,this.setCheckedGraphic(t.checkedGraphic,!0)&&n++,this.setUncheckedGraphic(t.uncheckedGraphic,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setChecked(t,e=!1){if(this._checked===t)return!1;const i=this._checked;return this.setupChecked(t),this._checked!==i&&(e||this.refreshAll(),!0)}setCheckedGraphic(t,e=!1){const i=this._checkedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupCheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupCheckedGraphic(t),_.isEqual(this._checkedGraphic,e))return!1}}return e||this.refreshAll(),!0}setUncheckedGraphic(t,e=!1){const i=this._uncheckedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupUncheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupUncheckedGraphic(t),_.isEqual(this._uncheckedGraphic,e))return!1}}return e||this.refreshAll(),!0}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupChecked(t.checked),this.setupCheckedGraphic(t.checkedGraphic),this.setupUncheckedGraphic(t.uncheckedGraphic)}setupChecked(t){this._checked=_.defaultTo(t,this.standardChecked())}setupCheckedGraphic(t){this._checkedGraphic=t||this.standardCheckedGraphic()}setupUncheckedGraphic(t){this._uncheckedGraphic=t||this.standardUncheckedGraphic()}standardChecked(){return!1}standardCheckedGraphic(){return null}standardUncheckedGraphic(){return null}switch(){this.setChecked(!this.isChecked())}uncheck(){this.isChecked()&&(this.switch(),this.updateUncheckedEvents())}updateCheckedEvents(){this.updateEventsContainer("checked")}updateMouseClickEvents(t){this.switch(),DKTools.Sprite.Button.prototype.updateMouseClickEvents.call(this,t)}updateUncheckedEvents(){this.updateEventsContainer("unchecked")}},Object.defineProperties(DKTools.Sprite.CheckBox.prototype,{checked:{get:function(){return this._checked},configurable:!0},checkedGraphic:{get:function(){return this._checkedGraphic},configurable:!0},uncheckedGraphic:{get:function(){return this._uncheckedGraphic},configurable:!0}}),DKTools.Viewport=class extends DKTools.Sprite{canCloneFixedBitmap(){return!1}createAll(){DKTools.Sprite.prototype.createAll.call(this),this.createMask()}createMask(){DKTools.Sprite.prototype.createMask.call(this,this._maskShape)}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaskShape(t.maskShape,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setMaskShape(t,e=!1){if(this._maskShape===t)return!1;const i=this._maskShape;return this.setupShape(t),this._maskShape!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaskShape(t.maskShape)}setupMaskShape(t){this._maskShape=t||this.standardMaskShape()}standardMaskShape(){return"rect"}},Object.defineProperties(DKTools.Viewport.prototype,{maskShape:{get:function(){return this._maskShape},configurable:!0}}),DKTools.Layout=class extends DKTools.Sprite{activateItems(t=!1){this.iterateItems(t=>{t.activate()},t)}addAllChildren(){DKTools.Sprite.prototype.addAllChildren.call(this),this.addAllItems()}addAllItems(){this.hasItems()&&this.addChild.apply(this,this._items)}addCol(){this.addCols(1)}addCols(t){this.setMaxCols(this.getMaxCols()+t)}addItem(t,e=!1){return t instanceof DKTools.Sprite?(this._items.push(t),e||this.start(),t):null}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return i.length>0&&!e&&this.start(),i}alignCol(t){_.forEach(this.getItemsInCol(t),this.alignItem.bind(this))}alignItem(t){if(this.isReady()){const e=this.getItemRow(t),i=this.getItemCol(t),n=this.getRowHeight(e),s=this.getColWidth(i),r=this.getColX(i)+(s-t.width)/2,o=this.getRowY(e)+(n-t.height)/2;t.move(r,o)}else this.addOneTimeEvent({type:"ready",onSuccess:this.alignItem.bind(this,t)})}alignItems(){this.addOneTimeEvent({type:"ready",onSuccess:()=>{this.iterateItems(this.alignItem.bind(this))}})}alignRow(t){_.forEach(this.getItemsInRow(t),this.alignItem.bind(this))}_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearItems()}_clearItems(){this._items=[]}canCloneFixedBitmap(){return!1}clearItems(t=!1){this.removeAllItems(),this._clearItems(),t||this.start()}deactivateItems(t=!1){this.iterateItems(t=>{t.deactivate()},t)}_getBitmapHeight(){let t=0;const e=this.getMaxRows();for(let i=1;i<=e;i++)t+=this.getRowHeight(i)+this._verticalSpacing;return t-this._verticalSpacing}_getBitmapWidth(){let t=0;const e=this.getMaxCols();for(let i=1;i<=e;i++)t+=this.getColWidth(i)+this._horizontalSpacing;return t-this._horizontalSpacing}getCell(t,e){const i=this.getMaxCols()*(t-1)+(e-1);return{item:this.getItem(i),x:this.getColX(e),y:this.getRowY(t),width:this.getColWidth(e),height:this.getRowHeight(t)}}getColWidth(t){return DKTools.Utils.isFunction(this._colWidth)?this._colWidth(t,this):this._colWidth}getColX(t){let e=0;for(let i=1;i=0?e%this.getMaxCols()+1:-1}getItemIndex(t){return _.indexOf(this.getItems(),t)}getItemRow(t){const e=this.getItemIndex(t);return e>=0?Math.floor(e/this.getMaxCols())+1:-1}getItems(){return this.isInverted()?_.reverse(_.clone(this._items)):this._items}getItemsInCol(t){const e=[],i=this.getMaxRows(),n=this.getMaxCols();if(t<1||t>n)return e;const s=t-1;for(let t=0;tthis.getMaxRows())return e;const n=i*(t-1);for(let t=0;t=0}hasItems(){return!this.isEmpty()}hideItems(t=!1,e=!1){this.iterateItems(e=>{e.hide(t)},e)}insertItem(t,e,i=!1){return t instanceof DKTools.Sprite?(DKTools.Utils.Array.insert(this._items,t,e),i||this.start(),t):null}insertItems(t,e,i=!1){e=e||0;const n=_.map(t,(t,i)=>this.insertItem(t,e+i,!0));return n.length>0&&!i&&this.start(),n}invert(){this.setInverted(!this.isInverted())}isEmpty(){return 0===this.getMaxItems()}isHorizontal(){return 1===this.getMaxRows()}isInverted(){return this._inverted}isReady(){return this.isEmpty()||_.every(this._items,t=>t.isReady())}isVertical(){return 1===this.getMaxCols()}iterateItems(t,e=!1){_.forEach(this.getItems(),t),e&&this.start()}moveItem(t,e,i){const n=this.getItem(t);n&&n.move(e,i)}removeAllChildren(){DKTools.Sprite.prototype.removeAllChildren.call(this),this.removeAllItems()}removeAllItems(){this.hasItems()&&this.removeChild.apply(this,this._items)}removeCol(){this.removeCols(1)}removeCols(t){this.getMaxCols()-t>=1&&this.addCols(-t)}removeItem(t,e=!1){return Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)?(this.removeChild(t),DKTools.Utils.Array.remove(this._items,t),e||this.start(),t):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return i.length>0&&!e&&this.start(),i}resizeItem(t,e,i,n=!1){Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)&&t.resize(e,i)&&(n||this.start())}resizeItems(t,e,i=!1){this.iterateItems(i=>{this.resizeItem(i,t,e,!0)},!i)}setAll(t,e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaxCols(t.maxCols,!0)&&n++,n+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setItems(t.items,!0)&&n++,this.setRowHeight(t.rowHeight,!0)&&n++,this.setColWidth(t.colWidth,!0)&&n++,this.setInverted(t.reversed,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setColWidth(t,e=!1){if(this._colWidth===t)return!1;const i=this._colWidth;return this.setupColWidth(t),this._colWidth!==i&&(e||this.start(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.start(),!0)}setInverted(t,e=!1){if(this._inverted===t)return!1;const i=this._inverted;return this.setupInverted(t),this._inverted!==i&&(e||this.start(),!0)}setItems(t,e=!1){return this._items!=t&&(this.removeAllItems(),this.setupItems(t),e||this.start(),!0)}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.start(),!0)}setRowHeight(t,e=!1){if(this._rowHeight===t)return!1;const i=this._rowHeight;return this.setupRowHeight(t),this._rowHeight!==i&&(e||this.start(),!0)}setSpacing(t,e,i=!1){let n=0;return this.setHorizontalSpacing(t,!0)&&n++,this.setVerticalSpacing(e,!0)&&n++,n>0&&!i&&this.start(),n}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaxCols(t.maxCols),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupItems(t.items),this.setupRowHeight(t.rowHeight),this.setupColWidth(t.colWidth),this.setupInverted(t.inverted)}setupColWidth(t){this._colWidth=t||this.standardColWidth()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupInverted(t){this._inverted=_.defaultTo(t,this.standardInverted())}setupItems(t){this._items=_.clone(t||this.standardItems())}setupMaxCols(t){this._maxCols=_.defaultTo(t,this.standardMaxCols())}setupRowHeight(t){this._rowHeight=t||this.standardRowHeight()}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}showItems(t=!1,e=!1){this.iterateItems(e=>{e.show(t)},e)}standardActive(){return!1}standardColWidth(){return t=>{const e=this.getItemsInCol(t);return _.max(_.map(e,"width"))}}standardHorizontalSpacing(){return 12}standardInverted(){return!1}standardItems(){return[]}standardMaxCols(){return 1}standardRowHeight(){return t=>{const e=this.getItemsInRow(t);return _.max(_.map(e,"height"))}}standardVerticalSpacing(){return this.getLineHeight()/2}start(){this._started=!0,this.isReady()?DKTools.Sprite.prototype.start.call(this):this.addOneTimeEvent({type:"ready",onSuccess:this.start.bind(this)})}startItems(t=!1,e=!1){this.iterateItems(e=>{e.start(t)},!e)}updateAll(){DKTools.Sprite.prototype.updateAll.call(this),this.updateLayout()}updateLayout(){const t=this.getMaxItems(),e=this.getMaxRows(),i=this.getMaxCols();let n=0;for(let s=1;s<=e&&n{const e=this.findArrow(t);e&&this.addChild(e)})},DKTools.Window.prototype.activate=function(){DKTools.Base.prototype.activate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.activate()},DKTools.Window.prototype.addAllChildren=function(){DKTools.Base.prototype.addAllChildren.call(this),this.addContentsSprite()},DKTools.Window.prototype.addContentsSprite=function(){this._addContentsSprite(),this._refreshContents()},DKTools.Window.prototype._clearAll=function(){DKTools.Base.prototype._clearAll.call(this),this._clearIsWindow(),this._clearOpenness(),this._clearPadding(),this._clearMargin(),this._clearColorTone(),this._clearOrigin(),this._clearArrows()},DKTools.Window.prototype._clearIsWindow=function(){this._isWindow=!0},DKTools.Window.prototype._clearOpenness=function(){this._openness=this.standardOpenness()},DKTools.Window.prototype._clearPadding=function(){this._padding=this.standardPadding()},DKTools.Window.prototype._clearMargin=function(){this._margin=this.standardMargin()},DKTools.Window.prototype._clearColorTone=function(){this._colorTone=this.standardTone()},DKTools.Window.prototype._clearOrigin=function(){this._origin=this.standardOrigin()},DKTools.Window.prototype._clearArrows=function(){this._arrows=[]},DKTools.Window.prototype._createAll=function(){DKTools.Base.prototype._createAll.call(this),this._createAllParts(),this._createWindowskin()},DKTools.Window.prototype._createAllParts=function(){this._createSpriteContainer(),this._createBackSprite(),this._createFrameSprite(),this._createPauseSignSprite(),this._createArrows()},DKTools.Window.prototype._createSpriteContainer=function(){this._windowSpriteContainer=new PIXI.Container},DKTools.Window.prototype._createBackSprite=function(){this.needsCreateBackSprite()&&(this._windowBackSprite=new Sprite,this._windowBackSprite.opacity=this.standardBackOpacity(),this._windowBackSprite.visible=this.standardBackVisible())},DKTools.Window.prototype._createFrameSprite=function(){this.needsCreateFrameSprite()&&(this._windowFrameSprite=new Sprite,this._windowFrameSprite.visible=this.standardFrameVisible())},DKTools.Window.prototype._createPauseSignSprite=function(){this.needsCreatePauseSignSprite()&&(this._windowPauseSignSprite=new Sprite)},DKTools.Window.prototype._createArrows=function(){this.needsCreateArrowsSprites()&&(this.needsCreateUpArrowSprite()&&this.createArrow("up","up",{onUpdate:this.onUpArrowUpdate.bind(this),onMouseClick:this.onUpArrowMouseClick.bind(this),onMouseLongPress:this.onUpArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateDownArrowSprite()&&this.createArrow("down","down",{onUpdate:this.onDownArrowUpdate.bind(this),onMouseClick:this.onDownArrowMouseClick.bind(this),onMouseLongPress:this.onDownArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateLeftArrowSprite()&&this.createArrow("left","left",{onUpdate:this.onLeftArrowUpdate.bind(this),onMouseClick:this.onLeftArrowMouseClick.bind(this),onMouseLongPress:this.onLeftArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateRightArrowSprite()&&this.createArrow("right","right",{onUpdate:this.onRightArrowUpdate.bind(this),onMouseClick:this.onRightArrowMouseClick.bind(this),onMouseLongPress:this.onRightArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}))},DKTools.Window.prototype._createWindowskin=function(){this.windowskin=DKTools.Utils.Bitmap.load({folder:"img/system",filename:this.standardWindowskin()})},DKTools.Window.prototype.canRedrawAll=function(){return this.hasContentsSprite()&&DKTools.Base.prototype.canRedrawAll.call(this)},DKTools.Window.prototype.changeFont=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeFont(t)},DKTools.Window.prototype.changeTextColor=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeTextColor(t)},DKTools.Window.prototype.changePaintOpacity=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changePaintOpacity(t)},DKTools.Window.prototype.checkSize=function(){const t=this.getMinWidth(),e=this.getMinHeight();let i=0;return this._width{this.isOpenAndVisible()?n.show():n.hide(),DKTools.Utils.isFunction(i.onUpdate)&&i.onUpdate(t)}}),DKTools.Utils.isFunction(i.onMouseDown)&&n.addEvent({type:"mouse-down-left",onUpdate:i.onMouseDown}),DKTools.Utils.isFunction(i.onMouseUp)&&n.addEvent({type:"mouse-up-left",onUpdate:i.onMouseUp}),DKTools.Utils.isFunction(i.onMouseClick)&&n.addEvent({type:"mouse-click-left",onUpdate:i.onMouseClick}),DKTools.Utils.isFunction(i.onMouseLongPress)&&n.addEvent({type:"mouse-long-press-left",onUpdate:i.onMouseLongPress}),DKTools.Utils.isFunction(i.onMouseLongPressStarted)&&n.addEvent({type:"mouse-long-press-left-started",onUpdate:i.onMouseLongPressStarted}),DKTools.Utils.isFunction(i.onMouseLongPressFinished)&&n.addEvent({type:"mouse-long-press-left-finished",onUpdate:i.onMouseLongPressFinished}),DKTools.Utils.isFunction(i.onStateNormal)&&n.addEvent({type:"state-normal",onUpdate:i.onStateNormal}),DKTools.Utils.isFunction(i.onStatePressed)&&n.addEvent({type:"state-pressed",onUpdate:i.onStatePressed}),this._arrows.push(n),this.addChild(n),n},DKTools.Window.prototype.deactivate=function(){DKTools.Base.prototype.deactivate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.deactivate()},DKTools.Window.prototype.destroy=function(t){DKTools.Base.prototype.destroy.call(this,t),Window_Base.prototype.destroy.call(this,t)},DKTools.Window.prototype.drawText=function(t,e){return!!this.hasContentsSprite()&&this._windowContentsSprite.drawText(t,e)},DKTools.Window.prototype.findArrow=function(t){return _.find(this._arrows,{id:t})},DKTools.Window.prototype.getMinWidth=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinWidth.call(this)},DKTools.Window.prototype.getMinHeight=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinHeight.call(this)},DKTools.Window.prototype.getContentsWidth=function(){return DKTools.Utils.isFunction(this._contentsWidth)?this._contentsWidth(this):this._contentsWidth},DKTools.Window.prototype.getContentsHeight=function(){return DKTools.Utils.isFunction(this._contentsHeight)?this._contentsHeight(this):this._contentsHeight},DKTools.Window.prototype.getContentsSize=function(){return{width:this.getContentsWidth(),height:this.getContentsHeight()}},DKTools.Window.prototype.getCurrentOpacity=function(){return this.windowOpacity},DKTools.Window.prototype.hasBitmap=function(){return!!this.hasContentsSprite()&&this._windowContentsSprite.hasBitmap()},DKTools.Window.prototype.hasSpriteContainer=function(){return!!this._windowSpriteContainer},DKTools.Window.prototype.hasBackSprite=function(){return!!this._windowBackSprite},DKTools.Window.prototype.hasFrameSprite=function(){return!!this._windowFrameSprite},DKTools.Window.prototype.hasContentsSprite=function(){return!!this._windowContentsSprite},DKTools.Window.prototype.hasArrow=function(t){return!!this.findArrow(t)},DKTools.Window.prototype.hasArrowSprites=function(){return this.hasUpArrowSprite()&&this.hasDownArrowSprite()&&this.hasLeftArrowSprite()&&this.hasRightArrowSprite()},DKTools.Window.prototype.hasUpArrowSprite=function(){return this.hasArrow("up")},DKTools.Window.prototype.hasDownArrowSprite=function(){return this.hasArrow("down")},DKTools.Window.prototype.hasLeftArrowSprite=function(){return this.hasArrow("left")},DKTools.Window.prototype.hasRightArrowSprite=function(){return this.hasArrow("right")},DKTools.Window.prototype.hasPauseSignSprite=function(){return!!this._windowPauseSignSprite},DKTools.Window.prototype.hasBackgroundDimmer=function(){return!!this._dimmerSprite},DKTools.Window.prototype.hideBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!1)},DKTools.Window.prototype.hideContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.hide()},DKTools.Window.prototype.hideFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!1)},DKTools.Window.prototype.isOpenAndVisible=function(){return this.isOpen()&&this.isVisible()},DKTools.Window.prototype.isOpenAndActive=function(){return this.isOpen()&&this.isActive()},DKTools.Window.prototype.needsCreateBackSprite=function(){return!0},DKTools.Window.prototype.needsCreateFrameSprite=function(){return!0},DKTools.Window.prototype.needsCreateArrowsSprites=function(){return!1},DKTools.Window.prototype.needsCreateDownArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateUpArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateLeftArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateRightArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreatePauseSignSprite=function(){return!0},DKTools.Window.prototype.onUpArrowUpdate=function(t){},DKTools.Window.prototype.onDownArrowUpdate=function(t){},DKTools.Window.prototype.onLeftArrowUpdate=function(t){},DKTools.Window.prototype.onRightArrowUpdate=function(t){},DKTools.Window.prototype.onUpArrowMouseClick=function(t){},DKTools.Window.prototype.onDownArrowMouseClick=function(t){},DKTools.Window.prototype.onLeftArrowMouseClick=function(t){},DKTools.Window.prototype.onRightArrowMouseClick=function(t){},DKTools.Window.prototype.onUpArrowMouseLongPress=function(t){},DKTools.Window.prototype.onDownArrowMouseLongPress=function(t){},DKTools.Window.prototype.onLeftArrowMouseLongPress=function(t){},DKTools.Window.prototype.onRightArrowMouseLongPress=function(t){},DKTools.Window.prototype._refreshAllParts=function(){this._refreshBack(),this._refreshFrame(),this._refreshContents(),this._refreshPauseSign(),this._refreshArrows()},DKTools.Window.prototype._refreshBack=function(){this.hasBackSprite()&&Window.prototype._refreshBack.call(this)},DKTools.Window.prototype._refreshFrame=function(){this.hasFrameSprite()&&Window.prototype._refreshFrame.call(this)},DKTools.Window.prototype._refreshContents=function(){if(this.hasContentsSprite()){let t=this._contentsPosition;DKTools.Utils.isFunction(t)&&(t=t(this)),this._windowContentsSprite.move(t)}},DKTools.Window.prototype._refreshPauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._refreshPauseSign.call(this)},DKTools.Window.prototype._refreshArrows=function(){const t={up:this.standardUpArrowPosition(),down:this.standardDownArrowPosition(),left:this.standardLeftArrowPosition(),right:this.standardRightArrowPosition()};_.forEach(t,(t,e)=>{const i=this.findArrow(e);i&&i.move(t)})},DKTools.Window.prototype.redrawAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.redrawAll()},DKTools.Window.prototype.refreshAll=function(){this._refreshAllParts(),DKTools.Base.prototype.refreshAll.call(this)},DKTools.Window.prototype.refreshArrows=function(){_.forEach(this._arrows,t=>{t.refreshAll()})},DKTools.Window.prototype.removeAllChildren=function(){DKTools.Base.prototype.removeAllChildren.call(this),this.removeContentsSprite()},DKTools.Window.prototype.removeContentsSprite=function(){this.hasContentsSprite()&&this.removeChild(this._windowContentsSprite)},DKTools.Window.prototype.removeArrow=function(t){const e=this.findArrow(t);e&&(DKTools.Utils.Array.remove(this._arrows,e),this.removeChild(e))},DKTools.Window.prototype.resetAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetAll()},DKTools.Window.prototype.resetFont=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetFont()},DKTools.Window.prototype.resetTextColor=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetTextColor()},DKTools.Window.prototype.resetPaintOpacity=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetPaintOpacity()},DKTools.Window.prototype.resize=function(t,e,i=!1,n=!1){if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._width===t&&this._height===e)return!1;const s=this._width,r=this._height;return this.setupSize(t,e),(this._width!==s||this._height!==r)&&(i||this.start(),n&&this.activate(),!0)},DKTools.Window.prototype.standardOpenness=function(){return 255},DKTools.Window.prototype.standardOpennessSpeed=function(){return 16},DKTools.Window.prototype.standardMargin=function(){return 4},DKTools.Window.prototype.standardOrigin=function(){return new Point(0,0)},DKTools.Window.prototype.standardUpArrowPosition=function(){return new Point(this._width/2,12)},DKTools.Window.prototype.standardDownArrowPosition=function(){return new Point(this._width/2,this._height-12)},DKTools.Window.prototype.standardLeftArrowPosition=function(){return new Point(12,this._height/2)},DKTools.Window.prototype.standardRightArrowPosition=function(){return new Point(this._width-12,this._height/2)},DKTools.Window.prototype.standardArrowStateNormal=function(){return t=>{const e=t.target;e.setScale(1,1),e.setOpacity(255)}},DKTools.Window.prototype.standardArrowStatePressed=function(){return t=>{const e=t.target;e.setScale(.9,.9),e.setOpacity(160)}},DKTools.Window.prototype.standardContentsSprite=function(){return new DKTools.Sprite},DKTools.Window.prototype.standardChildX=function(){return this._padding},DKTools.Window.prototype.standardChildY=function(){return this._padding},DKTools.Window.prototype.standardChildPosition=function(){return()=>new Point(this.standardChildX(),this.standardChildY())},DKTools.Window.prototype.standardContentsPosition=function(){return this.standardChildPosition()},DKTools.Window.prototype.standardBackVisible=function(){return!0},DKTools.Window.prototype.standardFrameVisible=function(){return!0},DKTools.Window.prototype.standardContentsWidth=function(){return()=>this._width-2*this._padding},DKTools.Window.prototype.standardContentsHeight=function(){return()=>this._height-2*this._padding},DKTools.Window.prototype.standardWindowOpacity=function(){return 255},DKTools.Window.prototype.standardContentsOpacity=function(){return 255},DKTools.Window.prototype.standardFrameOpacity=function(){return 255},DKTools.Window.prototype.standardOpacity=function(){return{windowOpacity:this.standardWindowOpacity(),contentsOpacity:this.standardContentsOpacity(),frameOpacity:this.standardFrameOpacity(),backOpacity:this.standardBackOpacity()}},DKTools.Window.prototype.standardTone=function(){try{return _.clone($gameSystem.windowTone())}catch(t){return[0,0,0]}},DKTools.Window.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t);let e=t.contentsSprite;t instanceof DKTools.Window&&e instanceof DKTools.Sprite&&(e=e.clone({blockStart:!0})),this.setupPadding(t.padding),this.setupMargin(t.margin),this.setupContentsWidth(t.contentsWidth),this.setupContentsHeight(t.contentsHeight),this.setupContentsSprite(e),this.setupContentsPosition(t.contentsPosition),this.setupOpacity(t.opacity),this.setupTone(t.tone)},DKTools.Window.prototype.setupWidth=function(t){this.width=this._checkWidth(t)},DKTools.Window.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this.height=this._checkHeight(t)},DKTools.Window.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),t=this._checkWidth(t),e=this._checkHeight(e),Window.prototype.move.call(this,this.x,this.y,t,e)},DKTools.Window.prototype.setupPadding=function(t){this._padding=_.defaultTo(t,this.standardPadding())},DKTools.Window.prototype.setupMargin=function(t){this._margin=_.defaultTo(t,this.standardMargin())},DKTools.Window.prototype.setupContentsWidth=function(t){this._contentsWidth=t||this.standardContentsWidth()},DKTools.Window.prototype.setupContentsHeight=function(t){this._contentsHeight=t||this.standardContentsHeight()},DKTools.Window.prototype.setupContentsSprite=function(t){this._windowContentsSprite=t||this.standardContentsSprite()},DKTools.Window.prototype.setupContentsPosition=function(t,e){let i=t;DKTools.Utils.isFunction(t)||(i=DKTools.Utils.Point.tryToPoint(t,e)||this.standardContentsPosition()),this._contentsPosition=i},DKTools.Window.prototype.setupOpacity=function(t){this._opacity=Object.assign(this.standardOpacity(),t)},DKTools.Window.prototype.setupTone=function(t){this._tone=Object.assign(this.standardTone(),t)},DKTools.Window.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let n=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setPadding(t.padding,!0)&&n++,this.setMargin(t.margin,!0)&&n++,this.setOpacity(t.opacity,!0)&&n++,this.setTone(t.tone,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n},DKTools.Window.prototype.setWidth=function(t,e=!1,i=!1){return this.resize(t,this._height,e,i)},DKTools.Window.prototype.setHeight=function(t,e=!1,i=!1){return this.resize(this._width,t,e,i)},DKTools.Window.prototype.setPadding=function(t,e=!1){if(this._padding===t)return!1;const i=this._padding;return this.setupPadding(t),this._padding!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setMargin=function(t,e=!1){if(this._margin===t)return!1;const i=this._margin;return this.setupMargin(padding),this._margin!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setContentsSprite=function(t,e=!1,i=!1){return this._windowContentsSprite!=t&&(this.removeContentsSprite(),this.setupContentsSprite(t),this.addContentsSprite(),e||this.start(),i&&this.activate(),!0)},DKTools.Window.prototype.setContentsPosition=function(t,e){const i=DKTools.Utils.isFunction,n=i(this._contentsPosition),s=i(t);if(n||s){if(this._contentsPosition===t)return!1;this.setupContentsPosition(t,e)}else{const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this._contentsPosition,i))return!1;const n=DKTools.Utils.Point.clone(this._contentsPosition);if(this.setupContentsPosition(i),DKTools.Utils.Point.equals(this._contentsPosition,n))return!1}return this._refreshContents(),!0},DKTools.Window.prototype.setOpacity=function(t,e=!1){if(_.isEqual(this._opacity,Object.assign(this.standardOpacity(),t)))return!1;const i=_.clone(this._opacity);return this.setupOpacity(t),!_.isEqual(this._opacity,i)&&(e||this.updateOpacity(),!0)},DKTools.Window.prototype.setTone=function(t,e=!1){if(_.isEqual(this._tone,Object.assign(this.standardTone(),t)))return!1;const i=_.clone(this._tone);return this.setupTone(t),!_.isEqual(this._tone,i)&&(e||this.updateTone(),!0)},DKTools.Window.prototype.start=function(t=!1){if(this.hasContentsSprite()){const e=this._windowContentsSprite;e.resize(this.getContentsWidth(),this.getContentsHeight(),!0),e.start(t)}DKTools.Base.prototype.start.call(this,t)},DKTools.Window.prototype.showBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!0)},DKTools.Window.prototype.showContents=function(t=!1){this.hasContentsSprite()&&this._windowContentsSprite.show(t)},DKTools.Window.prototype.showFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!0)},DKTools.Window.prototype._updateContents=function(){this.hasContentsSprite()&&Window.prototype._updateContents.call(this)},DKTools.Window.prototype._updatePauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._updatePauseSign.call(this)},DKTools.Window.prototype.updateOpenEvents=function(){this.updateEventsContainer("open")},DKTools.Window.prototype.updateCloseEvents=function(){this.updateEventsContainer("close")},DKTools.Window.prototype.updateAll=function(){this.updateContents(),DKTools.Base.prototype.updateAll.call(this),this.updateTone()},DKTools.Window.prototype.updateContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.updateAll()},DKTools.Window.prototype.updateTransform=function(){this._updateContents(),this._updatePauseSign(),PIXI.Container.prototype.updateTransform.call(this)},DKTools.Window.prototype.updateOpacity=function(t={}){t=t||{},this.hasSpriteContainer()&&(this.windowOpacity=_.defaultTo(t.windowOpacity,this.opacity.windowOpacity)),this.hasContentsSprite()&&(this.contentsOpacity=_.defaultTo(t.contentsOpacity,this.opacity.contentsOpacity)),this.hasFrameSprite()&&(this.frameOpacity=_.defaultTo(t.frameOpacity,this.opacity.frameOpacity)),this.hasBackSprite()&&(this.backOpacity=_.defaultTo(t.backOpacity,this.opacity.backOpacity))},DKTools.Window.prototype.updateTone=function(t){t=t||this.tone,this.hasBackSprite()&&Window.prototype.setTone.apply(this,t)},DKTools.Window.prototype.updateOpen=function(){this._opening&&(this.openness+=this.standardOpennessSpeed(),this.isOpen()&&(this._opening=!1,this.updateOpenEvents()))},DKTools.Window.prototype.updateClose=function(){this._closing&&(this.openness-=this.standardOpennessSpeed(),this.isClosed()&&(this._closing=!1,this.updateCloseEvents()))},DKTools.Window.prototype.update=function(){DKTools.Base.prototype.update.call(this),this.updateOpen(),this.updateClose(),this.updateBackgroundDimmer()},DKTools.Window.Selectable=class extends DKTools.Window{needsCreateArrowsSprites(){return!0}onUpArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()&&t.getTopRow()>0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onDownArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()){const i=t.getTopRow(),n=t.getMaxTopRow();n>0&&i0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onRightArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isHorizontal()){const i=t.getTopCol(),n=t.getMaxTopCol();n>0&&ithis.add(t))}finish(){this._queue=[],this._finished=!0}hasErrors(){return this._errors>0}isReady(){return this._finished}_onError(){this._errors++}start(){const t=_.map(this._queue,t=>t.catch(t=>{throw this._onError(),t}));Promise.all(t).then(()=>this.finish())}};const s=new DKTools.ParameterManager("DKTools");DKTools.PluginCommandManager.set("DKPluginsCheckUpdates",()=>{DKTools.Utils.openConsole(),DKTools.Utils._checkUpdates()}),DKTools.PluginCommandManager.set("UpdateFileSystemStamp",()=>{DKTools.IO._createStamp()});const r=window.onload;window.onload=function(){DKTools.Utils.initialize(),DKTools.IO.initialize(),r.call(this),DKTools.PluginManager.initialize()};const o=ImageCache.prototype.get;ImageCache.prototype.get=function(t){return o.call(this,t)||DKTools.PreloadManager.getCachedImageByKey(t)},ImageCache.prototype._truncateCache=function(){const t=this._items;let e=ImageCache.limit;Object.keys(t).map(e=>t[e]).filter(t=>!this._mustBeHeld(t)).sort((t,e)=>e.touch-t.touch).forEach(i=>{if(e>0&&!DKTools.PreloadManager.isImageCachedByKey(i.key)){const t=i.bitmap;e-=t.width*t.height}else delete t[i.key]})};const a=ImageCache.prototype._mustBeHeld;ImageCache.prototype._mustBeHeld=function(t){return!DKTools.PreloadManager.isImageCachedByKey(t.key)&&a.call(this,t)};const l=Graphics.initialize;Graphics.initialize=function(t,e,i){l.call(this,t,e,i);const n=s.get("FPS Meter");if(DKTools.Utils.isTest()&&n.Enabled){const t=this._fpsMeter;t&&(this.showFps(),"FPS"===n.Mode?(t.showFps(),this._fpsMeterToggled=!1):(t.showDuration(),this._fpsMeterToggled=!0))}};const h=Graphics.printError;Graphics.printError=function(t,e){h.call(this,t,e),this._errorPrinter&&this._updateErrorPrinter()};const u=Graphics._createFPSMeter;Graphics._createFPSMeter=function(){const t=s.get("FPS Meter");t.Enabled?(this._fpsMeter=new FPSMeter({theme:t.Theme,history:t.History,toggleOn:null,graph:1,decimals:0}),this._fpsMeter.hide()):u.call(this)},Graphics.printDetailedError=function(t){if(!this._errorPrinter)return;const e=t.stack.split(/(?:\r\n|\r|\n)/).map(t=>t.replace(/[\(](.*[\/])/,"("));this._errorPrinter.innerHTML=this._makeDetailedErrorHtml(t.name,t.message,e),this._applyCanvasFilter(),this._clearUpperCanvas()},Graphics._getErrorReferenceInfo=function(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e},Graphics._getErrorMessageForErrorPrint=function(){return s.get("Print Detailed Error","Error Message")},Graphics._getRestartMessageForErrorPrint=function(){return s.get("Print Detailed Error","Restart Message")},Graphics._makeDetailedErrorHtml=function(t,e,i){const n=this._getErrorMessageForErrorPrint(),s=this._getRestartMessageForErrorPrint(),r=this._getErrorReferenceInfo();let o="";return n&&(o=''+n+"

"),Object.keys(r).length>0&&(o+='Reference Information
',_.forEach(r,(t,e)=>{o+=''+e+": "+t+"
"}),o+="
"),o+=''+e+"
",_.forEach(i,t=>{o+=''+t+"
"}),s&&(o+='
'+s+"

"),o};const c=Graphics._updateErrorPrinter;Graphics._updateErrorPrinter=function(){c.call(this),this._errorPrinter&&this._errorShowed&&s.get("Print Detailed Error","Enabled")&&(this._errorPrinter.style.textAlign="left",this._errorPrinter.height=.8*this._height,this._centerElement(this._errorPrinter))};const p=TouchInput.initialize;TouchInput.initialize=function(){p.call(this);const t=s.get("Cursor Graphic");if(t.Enabled){const e=t.Graphic;e&&(document.body.style.cursor=`url('img/system/${e}.png'), default`)}};const d=TouchInput.clear;TouchInput.clear=function(){d.call(this),this._mouseMoved=!1,this._leftButtonPressed=!1,this._middleButtonPressed=!1,this._rightButtonPressed=!1,this._leftButtonReleased=!1,this._middleButtonReleased=!1,this._rightButtonReleased=!1,this._mouseX=0,this._mouseY=0,this._events.mouseMoved=!1,this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1};const f=TouchInput.update;TouchInput.update=function(){this._mouseMoved=this._events.mouseMoved,this._leftButtonPressed=this._events.leftButtonPressed,this._middleButtonPressed=this._events.middleButtonPressed,this._rightButtonPressed=this._events.rightButtonPressed,this._leftButtonReleased=this._events.leftButtonReleased,this._middleButtonReleased=this._events.middleButtonReleased,this._rightButtonReleased=this._events.rightButtonReleased,this._events.mouseMoved=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1,f.call(this)},TouchInput.isMouseMoved=function(){return this._mouseMoved},TouchInput.isMousePressed=function(){return this.isLeftButtonPressed()||this.isMiddleButtonPressed()||this.isRightButtonPressed()},TouchInput.isMouseReleased=function(){return this.isLeftButtonReleased()||this.isMiddleButtonReleased()||this.isRightButtonReleased()},TouchInput.isLeftButtonPressed=function(){return this._leftButtonPressed},TouchInput.isLeftButtonReleased=function(){return this._leftButtonReleased},TouchInput.isMiddleButtonPressed=function(){return this._middleButtonPressed},TouchInput.isMiddleButtonReleased=function(){return this._middleButtonReleased},TouchInput.isRightButtonPressed=function(){return this._rightButtonPressed},TouchInput.isRightButtonReleased=function(){return this._rightButtonReleased};const g=TouchInput._onLeftButtonDown;TouchInput._onLeftButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);g.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.leftButtonPressed=!0)};const m=TouchInput._onMiddleButtonDown;TouchInput._onMiddleButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);m.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.middleButtonPressed=!0)};const y=TouchInput._onRightButtonDown;TouchInput._onRightButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);y.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.rightButtonPressed=!0)};const T=TouchInput._onMouseMove;TouchInput._onMouseMove=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);T.call(this,t),this._mouseX===e&&this._mouseY===i||(this._events.mouseMoved=!0,this._date=Date.now(),this._mouseX=e,this._mouseY=i)};const D=TouchInput._onMouseUp;TouchInput._onMouseUp=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);D.call(this,t),this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,Graphics.isInsideCanvas(e,i)&&(0===t.button?this._events.leftButtonReleased=!0:1===t.button?this._events.middleButtonReleased=!0:2===t.button&&(this._events.rightButtonReleased=!0))},Object.defineProperties(TouchInput,{mouseX:{get:function(){return this._mouseX},configurable:!0},mouseY:{get:function(){return this._mouseY},configurable:!0}});const v=Tilemap.prototype.initialize;Tilemap.prototype.initialize=function(){v.call(this),this._tileWidth=Tilemap.TILE_WIDTH||this._tileWidth,this._tileHeight=Tilemap.TILE_HEIGHT||this._tileHeight};const w=WebAudio.prototype.addLoadListener;WebAudio.prototype.addLoadListener=function(t){this.isReady()?t(this):w.call(this,t)},WebAudio.prototype._onLoad=function(){for(;this._loadListeners.length>0;){this._loadListeners.shift()(this)}};const S=DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded=function(){return!!S.call(this)&&(this.__isDatabaseLoaded||(this.__isDatabaseLoaded=!0,this.onDatabaseLoad()),!0)},DataManager.onDatabaseLoad=function(){DKTools.PreloadManager.initialize()},Object.defineProperties(ImageManager,{PARALLAXES_FOLDER:{get:function(){const t=s.get("Tile Size");return t.Enabled?DKTools.IO.normalizePath(t["Parallaxes Folder"]+"/"):"img/parallaxes/"},configurable:!0},TILESETS_FOLDER:{get:function(){const t=s.get("Tile Size");return t.Enabled?DKTools.IO.normalizePath(t["Tilesets Folder"]+"/"):"img/tilesets/"},configurable:!0}}),ImageManager.loadParallax=function(t,e){return this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!0)},ImageManager.loadTileset=function(t,e){return this.loadBitmap(ImageManager.TILESETS_FOLDER,t,e,!1)},ImageManager.reserveParallax=function(t,e,i){return this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!1,i)},ImageManager.reserveTileset=function(t,e,i){return this.reserveBitmap(ImageManager.TILESETS_FOLDER,t,e,!1,i)},ImageManager.requestParallax=function(t,e){return this.requestBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!0)},ImageManager.requestTileset=function(t,e){return this.requestBitmap(ImageManager.TILESETS_FOLDER,t,e,!1)};const b=AudioManager.createBuffer;AudioManager.createBuffer=function(t,e){const i=this.audioFileExt(),n=this._path+t+"/"+encodeURIComponent(e)+i;return DKTools.PreloadManager.isAudioCachedByPath(n)?DKTools.PreloadManager.getCachedAudioByPath(n):b.call(this,t,e)};const K=SceneManager.initialize;SceneManager.initialize=async function(){await K.call(this),await DKTools.StartupManager.initialize()};const A=SceneManager.initGraphics;SceneManager.initGraphics=function(){const t=s.get("Screen Resolution");if(t.Enabled){const e=t.Width,i=t.Height;this._boxWidth=e,this._screenWidth=e,this._boxHeight=i,this._screenHeight=i,this.updateResolution()}A.call(this)},SceneManager.updateResolution=function(){const t=this._screenWidth-window.innerWidth,e=this._screenHeight-window.innerHeight;0!==t&&0!==e&&(window.moveBy(-1*t/2,-1*e/2),window.resizeBy(t,e))};const O=SceneManager.onKeyDown;SceneManager.onKeyDown=function(t){if(O.call(this,t),t.ctrlKey||t.altKey)return;const e=s.get("Quick Load","Key Code"),i=s.get("Screenshots","Key Code"),n=s.get("Grid","Key Code");switch(t.keyCode){case e:DKTools.Utils.__quickLoad();break;case i:s.get("Screenshots","Enabled")&&DKTools.Utils.makeScreenshot();break;case n:DKTools.Utils.__showGrid()}};const I=SceneManager.catchException;SceneManager.catchException=function(t){I.call(this,t),t instanceof Error&&s.get("Print Detailed Error","Enabled")&&Graphics.printDetailedError(t),DKTools.Utils.logError(t),s.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()};const C=SceneManager.onError;SceneManager.onError=function(t){C.call(this,t),DKTools.Utils.logError(t),s.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()},SceneManager.changeScene=function(){this.isSceneChanging()&&!this.isCurrentSceneBusy()&&(this._scene&&(this._scene.terminate(),this._scene.detachReservation(),this._previousClass=this._scene.constructor),this._scene=this._nextScene,this._scene&&(this._scene.attachReservation(),this._scene.startPreloading(),this._sceneCreated=!1,this._sceneStarted=!1,this._nextScene=null,this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate())),this._exiting&&this.terminate())},SceneManager.updateScene=function(){if(this._scene){if(!this._sceneCreated&&this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate()),this._sceneCreated&&!this._sceneStarted)try{this._scene.isReady()&&(this._scene.start(),this._sceneStarted=!0,this.onSceneStart())}catch(t){console.error(t),DKTools.Utils.logError(t),this._scene.start(),this._sceneStarted=!0,this.onSceneStart()}this.isCurrentSceneStarted()&&this._scene.update()}},SceneManager.isCurrentScene=function(t){return!!this._scene&&this._scene.constructor===t};const E=SceneManager.goto;SceneManager.goto=function(t){E.call(this,t),DKTools.Utils.__hideGrid()};const x=Scene_Base.prototype.initialize;Scene_Base.prototype.initialize=function(){x.call(this),this._preloader=new DKTools.Scene.Preloader},Scene_Base.prototype.activate=function(){this._active=!0},Scene_Base.prototype.deactivate=function(){this._active=!1},Scene_Base.prototype.isPreloaded=function(){return this._preloader.isReady()};const P=Scene_Base.prototype.isReady;Scene_Base.prototype.isReady=function(){return P.call(this)&&this.isPreloaded()},Scene_Base.prototype.setupPreloading=function(){},Scene_Base.prototype.startPreloading=function(){this.setupPreloading(),this._preloader.start()};const R=Scene_Base.prototype.terminate;Scene_Base.prototype.terminate=function(){R.call(this),this._preloader.finish()};const M=Scene_Boot.prototype.isReady;Scene_Boot.prototype.isReady=function(){return M.call(this)&&DKTools.StartupManager.isReady()&&DKTools.PreloadManager.isReady()};const B=Scene_Boot.prototype.start;Scene_Boot.prototype.start=function(){const t=s.get("Quick Start");t.Enabled?(B.call(this),DataManager.isBattleTest()||DataManager.isEventTest()||!t["Skip Saves"]&&DataManager.isAnySavefileExists()||(Scene_Base.prototype.start.call(this),SoundManager.preloadImportantSounds(),this.checkPlayerLocation(),DataManager.setupNewGame(),this.updateDocumentTitle(),SceneManager.goto(window[t["Scene Name"]]))):B.call(this)};const F=Scene_Map.prototype.isReady;Scene_Map.prototype.isReady=function(){return!!this.isPreloaded()&&F.call(this)};const L=Game_Map.prototype.tileWidth;Game_Map.prototype.tileWidth=function(){return Tilemap.TILE_WIDTH||L.call(this)};const H=Game_Map.prototype.tileHeight;Game_Map.prototype.tileHeight=function(){return Tilemap.TILE_HEIGHT||H.call(this)};const k=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(t,e){k.call(this,t,e),DKTools.PluginCommandManager.process(this,t,e)},s.get("Font Size","Enabled")&&(Window_Base.prototype.standardFontSize=function(){return s.get("Font Size","Size")},DKTools.Sprite.prototype.standardFontSize=function(){try{return Window_Base.prototype.standardFontSize.call(this)}catch(t){return s.get("Font Size","Size")}}),s.get("Line Height","Enabled")&&(Window_Base.prototype.lineHeight=function(){return s.get("Line Height","Height")},DKTools.Base.prototype.getLineHeight=function(){try{return Window_Base.prototype.lineHeight.call(this)}catch(t){return s.get("Line Height","Height")}},DKTools.Sprite.prototype.getLineHeight=function(){return DKTools.Base.prototype.getLineHeight.call(this)},DKTools.Window.prototype.getLineHeight=function(){return DKTools.Base.prototype.getLineHeight.call(this)}),s.get("Window Padding","Enabled")&&(Window_Base.prototype.standardPadding=function(){return s.get("Window Padding","Padding")})}).call(this,i(1)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("nw.gui")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("os")},function(t,e){t.exports=require("path")}]); \ No newline at end of file +!function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(module,exports,__webpack_require__){"use strict";(function(module){var __WEBPACK_AMD_DEFINE_RESULT__;window.Imported=window.Imported||{},window.Imported.DKTools="8.3.0",function(){function t(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function e(t,e,i,s){for(var n=-1,r=null==t?0:t.length;++n"']/g,N=RegExp(j.source),V=RegExp(z.source),G=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,q=/<%=([\s\S]+?)%>/g,$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,J=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,Q=RegExp(Z.source),tt=/^\s+|\s+$/g,et=/^\s+/,it=/\s+$/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,nt=/\{\n\/\* \[wrapped with (.+)\] \*/,rt=/,? & /,ot=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,at=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ht=/\w*$/,ut=/^[-+]0x[0-9a-f]+$/i,ct=/^0b[01]+$/i,pt=/^\[object .+?Constructor\]$/,dt=/^0o[0-7]+$/i,ft=/^(?:0|[1-9]\d*)$/,gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_t=/($^)/,mt=/['\n\r\u2028\u2029\\]/g,Tt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",yt="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+Tt,Dt=RegExp("['’]","g"),wt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),vt=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+Tt,"g"),St=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",yt].join("|"),"g"),Kt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),bt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,At="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),It={};It["[object Float32Array]"]=It["[object Float64Array]"]=It["[object Int8Array]"]=It["[object Int16Array]"]=It["[object Int32Array]"]=It["[object Uint8Array]"]=It["[object Uint8ClampedArray]"]=It["[object Uint16Array]"]=It["[object Uint32Array]"]=!0,It["[object Arguments]"]=It["[object Array]"]=It["[object ArrayBuffer]"]=It["[object Boolean]"]=It["[object DataView]"]=It["[object Date]"]=It["[object Error]"]=It["[object Function]"]=It["[object Map]"]=It["[object Number]"]=It["[object Object]"]=It["[object RegExp]"]=It["[object Set]"]=It["[object String]"]=It["[object WeakMap]"]=!1;var Ot={};Ot["[object Arguments]"]=Ot["[object Array]"]=Ot["[object ArrayBuffer]"]=Ot["[object DataView]"]=Ot["[object Boolean]"]=Ot["[object Date]"]=Ot["[object Float32Array]"]=Ot["[object Float64Array]"]=Ot["[object Int8Array]"]=Ot["[object Int16Array]"]=Ot["[object Int32Array]"]=Ot["[object Map]"]=Ot["[object Number]"]=Ot["[object Object]"]=Ot["[object RegExp]"]=Ot["[object Set]"]=Ot["[object String]"]=Ot["[object Symbol]"]=Ot["[object Uint8Array]"]=Ot["[object Uint8ClampedArray]"]=Ot["[object Uint16Array]"]=Ot["[object Uint32Array]"]=!0,Ot["[object Error]"]=Ot["[object Function]"]=Ot["[object WeakMap]"]=!1;var Ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Et=parseFloat,xt=parseInt,Pt="object"==typeof global&&global&&global.Object===Object&&global,Mt="object"==typeof self&&self&&self.Object===Object&&self,Rt=Pt||Mt||Function("return this")(),Bt=exports&&!exports.nodeType&&exports,Lt=Bt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Lt&&Lt.exports===Bt,Ht=Ft&&Pt.process,kt=function(){try{var t=Lt&&Lt.require&&Lt.require("util").types;return t||Ht&&Ht.binding&&Ht.binding("util")}catch(t){}}(),Ut=kt&&kt.isArrayBuffer,Wt=kt&&kt.isDate,jt=kt&&kt.isMap,zt=kt&&kt.isRegExp,Nt=kt&&kt.isSet,Vt=kt&&kt.isTypedArray,Gt=T("length"),Xt=y({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),qt=y({"&":"&","<":"<",">":">",'"':""","'":"'"}),$t=y({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Yt=function y(Tt){function yt(t){if(js(t)&&!xo(t)&&!(t instanceof Pt)){if(t instanceof Ct)return t;if(xn.call(t,"__wrapped__"))return fs(t)}return new Ct(t)}function vt(){}function Ct(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=B}function Pt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mt(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function oe(t,e,s,n,r,o){var a,l=1&e,h=2&e,u=4&e;if(s&&(a=r?s(t,n,r,o):s(t)),a!==B)return a;if(!Ws(t))return t;if(n=xo(t)){if(a=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&xn.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return fi(t,a)}else{var c=Ur(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(Mo(t))return li(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!r){if(a=h||p?{}:Zi(t),!l)return h?function(t,e){return gi(t,kr(t),e)}(t,function(t,e){return t&&gi(e,nn(e),t)}(a,t)):function(t,e){return gi(t,Hr(t),e)}(t,ie(a,t))}else{if(!Ot[c])return r?t:{};a=function(t,e,i){var s=t.constructor;switch(e){case"[object ArrayBuffer]":return hi(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return e=i?hi(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ui(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(e=new t.constructor(t.source,ht.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new s;case"[object Symbol]":return Ar?Sn(Ar.call(t)):{}}}(t,c,l)}}if(o||(o=new kt),r=o.get(t))return r;if(o.set(t,a),Fo(t))return t.forEach(function(i){a.add(oe(i,e,s,i,t,o))}),a;if(Bo(t))return t.forEach(function(i,n){a.set(n,oe(i,e,s,n,t,o))}),a;h=u?h?Ni:zi:h?nn:sn;var d=n?B:h(t);return i(d||t,function(i,n){d&&(i=t[n=i]),Qt(a,n,oe(i,e,s,n,t,o))}),a}function ae(t,e,i){var s=i.length;if(null==t)return!s;for(t=Sn(t);s--;){var n=i[s],r=e[n],o=t[n];if(o===B&&!(n in t)||!r(o))return!1}return!0}function le(t,e,i){if("function"!=typeof t)throw new An("Expected a function");return zr(function(){t.apply(B,i)},e)}function he(t,e,i,s){var n=-1,l=r,h=!0,u=t.length,c=[],p=e.length;if(!u)return c;i&&(e=a(e,S(i))),s?(l=o,h=!1):200<=e.length&&(l=b,h=!1,e=new Ht(e));t:for(;++ne}function we(t,e){return null!=t&&xn.call(t,e)}function ve(t,e){return null!=t&&e in Sn(t)}function Se(t,e,i){for(var s=i?o:r,n=t[0].length,l=t.length,h=l,u=Tn(l),c=1/0,p=[];h--;){var d=t[h];h&&e&&(d=a(d,S(e))),c=ar(d.length,c),u[h]=!i&&(e||120<=n&&120<=d.length)?new Ht(h&&d):B}d=t[0];var f=-1,g=u[0];t:for(;++f(i=oi(i,e)).length?e:me(e,Ve(i,0,-1)))?e:e[cs(ys(i))])?B:t(i,e,s)}function be(t){return js(t)&&"[object Arguments]"==ye(t)}function Ae(t,e,i,s,n){if(t===e)return!0;if(null==t||null==e||!js(t)&&!js(e))return t!=t&&e!=e;t:{var r=xo(t),o=xo(e),a=r?"[object Array]":Ur(t),l=o?"[object Array]":Ur(e),h="[object Object]"==(a="[object Arguments]"==a?"[object Object]":a);o="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l);if((l=a==l)&&Mo(t)){if(!Mo(e)){e=!1;break t}r=!0,h=!1}if(l&&!h)n||(n=new kt),e=r||Ho(t)?Wi(t,e,i,s,Ae,n):function(t,e,i,s,n,r,o){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new Un(t),new Un(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Rs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=C;case"[object Set]":if(a||(a=P),t.size!=e.size&&!(1&s))break;return(i=o.get(t))?i==e:(s|=2,o.set(t,e),e=Wi(a(t),a(e),s,n,r,o),o.delete(t),e);case"[object Symbol]":if(Ar)return Ar.call(t)==Ar.call(e)}return!1}(t,e,a,i,s,Ae,n);else{if(!(1&i)&&(r=h&&xn.call(t,"__wrapped__"),a=o&&xn.call(e,"__wrapped__"),r||a)){t=r?t.value():t,e=a?e.value():e,n||(n=new kt),e=Ae(t,e,i,s,n);break t}if(l)e:if(n||(n=new kt),r=1&i,a=zi(t),o=a.length,l=zi(e).length,o==l||r){for(h=o;h--;){var u=a[h];if(!(r?u in e:xn.call(e,u))){e=!1;break e}}if((l=n.get(t))&&n.get(e))e=l==e;else{l=!0,n.set(t,e),n.set(e,t);for(var c=r;++he?i:0,i)?t[e]:B}function Fe(t,e,i){var s=-1;return e=a(e.length?e:[cn],S(Xi())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].c;return t}(t=Pe(t,function(t,i,n){return{a:a(e,function(e){return e(t)}),b:++s,c:t}}),function(t,e){var s;t:{s=-1;for(var n=t.a,r=e.a,o=n.length,a=i.length;++s=a){s=l;break t}s=l*("desc"==i[s]?-1:1);break t}}s=t.b-e.b}return s})}function He(t,e,i){for(var s=-1,n=e.length,r={};++se||9007199254740991e&&(e=-e>n?0:n+e),0>(i=i>n?n:i)&&(i+=n),n=e>i?0:i-e>>>0,e>>>=0,i=Tn(n);++s=n){for(;s>>1,o=t[r];null!==o&&!Gs(o)&&(i?o<=e:o(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))||delete t[cs(ys(e))]}function ti(t,e,i,s){for(var n=t.length,r=s?n:-1;(s?r--:++rs)return s?Ze(t[0]):[];for(var n=-1,r=Tn(s);++n=s?t:Ve(t,e,i)}function li(t,e){if(e)return t.slice();var i=t.length;i=Wn?Wn(i):new t.constructor(i);return t.copy(i),i}function hi(t){var e=new t.constructor(t.byteLength);return new Un(e).set(new Un(t)),e}function ui(t,e){return new t.constructor(e?hi(t.buffer):t.buffer,t.byteOffset,t.length)}function ci(t,e){if(t!==e){var i=t!==B,s=null===t,n=t==t,r=Gs(t),o=e!==B,a=null===e,l=e==e,h=Gs(e);if(!a&&!h&&!r&&t>e||r&&o&&l&&!a&&!h||s&&o&&l||!i&&l||!n)return 1;if(!s&&!r&&!h&&tn?B:r,n=1),e=Sn(e);++so&&a[0]!==h&&a[o-1]!==h?[]:x(a,h)).length)i?i?je(e,t):e:(i=je(e,Qn(t/M(e))),Kt.test(e)?ai(R(i),0,t).join(""):i.slice(0,t))}function xi(e,i,s,n){var r=1&i,o=vi(e);return function i(){for(var a=-1,l=arguments.length,h=-1,u=n.length,c=Tn(u+l),p=this&&this!==Rt&&this instanceof i?o:e;++he||s)&&(1&t&&(r[2]=p[2],e|=1&i?0:4),(i=p[3])&&(s=r[3],r[3]=s?pi(s,i,p[4]):i,r[4]=s?x(r[3],"__lodash_placeholder__"):p[4]),(i=p[5])&&(s=r[5],r[5]=s?di(s,i,p[6]):i,r[6]=s?x(r[5],"__lodash_placeholder__"):p[6]),(i=p[7])&&(r[7]=i),128&t&&(r[8]=null==r[8]?p[8]:ar(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=e),t=r[0],e=r[1],i=r[2],s=r[3],n=r[4],!(a=r[9]=r[9]===B?l?0:t.length:or(r[9]-h,0))&&24&e&&(e&=-25),l=e&&1!=e?8==e||16==e?Si(t,e,a):32!=e&&33!=e||n.length?Ai.apply(B,r):xi(t,e,i,s):function(t,e,i){var s=1&e,n=vi(t);return function e(){return(this&&this!==Rt&&this instanceof e?n:t).apply(s?i:this,arguments)}}(t,e,i),ls((p?Mr:jr)(l,r),t,e)}function Hi(t,e,i,s){return t===B||Rs(t,On[i])&&!xn.call(s,i)?e:t}function ki(t,e,i,s,n,r){return Ws(t)&&Ws(e)&&(r.set(e,t),Be(t,e,B,ki,r),r.delete(e)),t}function Ui(t){return Ns(t)?B:t}function Wi(t,e,i,s,n,r){var o=1&i,a=t.length;if(a!=(l=e.length)&&!(o&&l>a))return!1;if((l=r.get(t))&&r.get(e))return l==e;var l=-1,h=!0,u=2&i?new Ht:B;for(r.set(t,e),r.set(e,t);++l(i=null==i?0:$s(i))&&(i=or(s+i,0)),d(t,Xi(e,3),i)):-1}function _s(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s-1;return i!==B&&(n=$s(i),n=0>i?or(s+n,0):ar(n,s-1)),d(t,Xi(e,3),n,!0)}function ms(t){return null!=t&&t.length?de(t,1):[]}function Ts(t){return t&&t.length?t[0]:B}function ys(t){var e=null==t?0:t.length;return e?t[e-1]:B}function Ds(t,e){return t&&t.length&&e&&e.length?ke(t,e):t}function ws(t){return null==t?t:cr.call(t)}function vs(t){if(!t||!t.length)return[];var e=0;return t=n(t,function(t){if(Ls(t))return e=or(t.length,e),!0}),v(e,function(e){return a(t,T(e))})}function Ss(e,i){if(!e||!e.length)return[];var s=vs(e);return null==i?s:a(s,function(e){return t(i,B,e)})}function Ks(t){return(t=yt(t)).__chain__=!0,t}function bs(t,e){return e(t)}function As(t,e){return(xo(t)?i:Cr)(t,Xi(e,3))}function Is(t,e){return(xo(t)?function(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}:Er)(t,Xi(e,3))}function Os(t,e){return(xo(t)?a:Pe)(t,Xi(e,3))}function Cs(t,e,i){return e=i?B:e,e=t&&null==e?t.length:e,Fi(t,128,B,B,B,B,e)}function Es(t,e){var i;if("function"!=typeof e)throw new An("Expected a function");return t=$s(t),function(){return 0<--t&&(i=e.apply(this,arguments)),1>=t&&(e=B),i}}function xs(t,e,i){function s(e){var i=l,s=h;return l=h=B,f=e,c=t.apply(s,i)}function n(t){var i=t-d;return t-=f,d===B||i>=e||0>i||_&&t>=u}function r(){var t=yo();if(n(t))return o(t);var i,s=zr;i=t-f,t=e-(t-d),i=_?ar(t,u-i):t,p=s(r,i)}function o(t){return p=B,m&&l?s(t):(l=h=B,c)}function a(){var t=yo(),i=n(t);if(l=arguments,h=this,d=t,i){if(p===B)return f=t=d,p=zr(r,e),g?s(t):c;if(_)return p=zr(r,e),s(d)}return p===B&&(p=zr(r,e)),c}var l,h,u,c,p,d,f=0,g=!1,_=!1,m=!0;if("function"!=typeof t)throw new An("Expected a function");return e=Js(e)||0,Ws(i)&&(g=!!i.leading,u=(_="maxWait"in i)?or(Js(i.maxWait)||0,e):u,m="trailing"in i?!!i.trailing:m),a.cancel=function(){p!==B&&Br(p),f=0,l=d=h=p=B},a.flush=function(){return p===B?c:o(yo())},a}function Ps(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new An("Expected a function");var i=function(){var s=arguments,n=e?e.apply(this,s):s[0],r=i.cache;return r.has(n)?r.get(n):(s=t.apply(this,s),i.cache=r.set(n,s)||r,s)};return i.cache=new(Ps.Cache||Lt),i}function Ms(t){if("function"!=typeof t)throw new An("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Rs(t,e){return t===e||t!=t&&e!=e}function Bs(t){return null!=t&&Us(t.length)&&!Hs(t)}function Ls(t){return js(t)&&Bs(t)}function Fs(t){if(!js(t))return!1;var e=ye(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ns(t)}function Hs(t){return!!Ws(t)&&("[object Function]"==(t=ye(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function ks(t){return"number"==typeof t&&t==$s(t)}function Us(t){return"number"==typeof t&&-1=t}function Ws(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function js(t){return null!=t&&"object"==typeof t}function zs(t){return"number"==typeof t||js(t)&&"[object Number]"==ye(t)}function Ns(t){return!(!js(t)||"[object Object]"!=ye(t))&&(null===(t=jn(t))||"function"==typeof(t=xn.call(t,"constructor")&&t.constructor)&&t instanceof t&&En.call(t)==Bn)}function Vs(t){return"string"==typeof t||!xo(t)&&js(t)&&"[object String]"==ye(t)}function Gs(t){return"symbol"==typeof t||js(t)&&"[object Symbol]"==ye(t)}function Xs(t){if(!t)return[];if(Bs(t))return Vs(t)?R(t):fi(t);if(Xn&&t[Xn]){t=t[Xn]();for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}return("[object Map]"==(e=Ur(t))?C:"[object Set]"==e?P:on)(t)}function qs(t){return t?(t=Js(t))===L||t===-L?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}function $s(t){var e=(t=qs(t))%1;return t==t?e?t-e:t:0}function Ys(t){return t?re($s(t),0,4294967295):0}function Js(t){if("number"==typeof t)return t;if(Gs(t))return F;if(Ws(t)&&(t=Ws(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace(tt,"");var e=ct.test(t);return e||dt.test(t)?xt(t.slice(2),e?2:8):ut.test(t)?F:+t}function Zs(t){return gi(t,nn(t))}function Qs(t){return null==t?"":Je(t)}function tn(t,e,i){return(t=null==t?B:me(t,e))===B?i:t}function en(t,e){return null!=t&&Ji(t,e,ve)}function sn(t){return Bs(t)?Gt(t):Ee(t)}function nn(t){if(Bs(t))t=Gt(t,!0);else if(Ws(t)){var e,i=ns(t),s=[];for(e in t)("constructor"!=e||!i&&xn.call(t,e))&&s.push(e);t=s}else{if(e=[],null!=t)for(i in Sn(t))e.push(i);t=e}return t}function rn(t,e){if(null==t)return{};var i=a(Ni(t),function(t){return[t]});return e=Xi(e),He(t,i,function(t,i){return e(t,i[0])})}function on(t){return null==t?[]:K(t,sn(t))}function an(t){return ua(Qs(t).toLowerCase())}function ln(t){return(t=Qs(t))&&t.replace(gt,Xt).replace(wt,"")}function hn(t,e,i){return t=Qs(t),(e=i?B:e)===B?bt.test(t)?t.match(St)||[]:t.match(ot)||[]:t.match(e)||[]}function un(t){return function(){return t}}function cn(t){return t}function pn(t){return Ce("function"==typeof t?t:oe(t,1))}function dn(t,e,s){var n=sn(e),r=_e(e,n);null!=s||Ws(e)&&(r.length||!n.length)||(s=e,e=t,t=this,r=_e(e,sn(e)));var o=!(Ws(s)&&"chain"in s&&!s.chain),a=Hs(t);return i(r,function(i){var s=e[i];t[i]=s,a&&(t.prototype[i]=function(){var e=this.__chain__;if(o||e){var i=t(this.__wrapped__);return(i.__actions__=fi(this.__actions__)).push({func:s,args:arguments,thisArg:t}),i.__chain__=e,i}return s.apply(t,l([this.value()],arguments))})}),t}function fn(){}function gn(t){return is(t)?T(cs(t)):function(t){return function(e){return me(e,t)}}(t)}function _n(){return[]}function mn(){return!1}var Tn=(Tt=null==Tt?Rt:Yt.defaults(Rt.Object(),Tt,Yt.pick(Rt,At))).Array,yn=Tt.Date,Dn=Tt.Error,wn=Tt.Function,vn=Tt.Math,Sn=Tt.Object,Kn=Tt.RegExp,bn=Tt.String,An=Tt.TypeError,In=Tn.prototype,On=Sn.prototype,Cn=Tt["__core-js_shared__"],En=wn.prototype.toString,xn=On.hasOwnProperty,Pn=0,Mn=function(){var t=/[^.]+$/.exec(Cn&&Cn.keys&&Cn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Rn=On.toString,Bn=En.call(Sn),Ln=Rt._,Fn=Kn("^"+En.call(xn).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hn=Ft?Tt.Buffer:B,kn=Tt.Symbol,Un=Tt.Uint8Array,Wn=Hn?Hn.allocUnsafe:B,jn=E(Sn.getPrototypeOf,Sn),zn=Sn.create,Nn=On.propertyIsEnumerable,Vn=In.splice,Gn=kn?kn.isConcatSpreadable:B,Xn=kn?kn.iterator:B,qn=kn?kn.toStringTag:B,$n=function(){try{var t=Yi(Sn,"defineProperty");return t({},"",{}),t}catch(t){}}(),Yn=Tt.clearTimeout!==Rt.clearTimeout&&Tt.clearTimeout,Jn=yn&&yn.now!==Rt.Date.now&&yn.now,Zn=Tt.setTimeout!==Rt.setTimeout&&Tt.setTimeout,Qn=vn.ceil,tr=vn.floor,er=Sn.getOwnPropertySymbols,ir=Hn?Hn.isBuffer:B,sr=Tt.isFinite,nr=In.join,rr=E(Sn.keys,Sn),or=vn.max,ar=vn.min,lr=yn.now,hr=Tt.parseInt,ur=vn.random,cr=In.reverse,pr=Yi(Tt,"DataView"),dr=Yi(Tt,"Map"),fr=Yi(Tt,"Promise"),gr=Yi(Tt,"Set"),_r=Yi(Tt,"WeakMap"),mr=Yi(Sn,"create"),Tr=_r&&new _r,yr={},Dr=ps(pr),wr=ps(dr),vr=ps(fr),Sr=ps(gr),Kr=ps(_r),br=kn?kn.prototype:B,Ar=br?br.valueOf:B,Ir=br?br.toString:B,Or=function(){function t(){}return function(e){return Ws(e)?zn?zn(e):(t.prototype=e,e=new t,t.prototype=B,e):{}}}();yt.templateSettings={escape:G,evaluate:X,interpolate:q,variable:"",imports:{_:yt}},yt.prototype=vt.prototype,yt.prototype.constructor=yt,Ct.prototype=Or(vt.prototype),Ct.prototype.constructor=Ct,Pt.prototype=Or(vt.prototype),Pt.prototype.constructor=Pt,Mt.prototype.clear=function(){this.__data__=mr?mr(null):{},this.size=0},Mt.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},Mt.prototype.get=function(t){var e=this.__data__;return mr?"__lodash_hash_undefined__"===(t=e[t])?B:t:xn.call(e,t)?e[t]:B},Mt.prototype.has=function(t){var e=this.__data__;return mr?e[t]!==B:xn.call(e,t)},Mt.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=mr&&e===B?"__lodash_hash_undefined__":e,this},Bt.prototype.clear=function(){this.__data__=[],this.size=0},Bt.prototype.delete=function(t){var e=this.__data__;return!(0>(t=te(e,t))||(t==e.length-1?e.pop():Vn.call(e,t,1),--this.size,0))},Bt.prototype.get=function(t){var e=this.__data__;return 0>(t=te(e,t))?B:e[t][1]},Bt.prototype.has=function(t){return-1s?(++this.size,i.push([t,e])):i[s][1]=e,this},Lt.prototype.clear=function(){this.size=0,this.__data__={hash:new Mt,map:new(dr||Bt),string:new Mt}},Lt.prototype.delete=function(t){return t=qi(this,t).delete(t),this.size-=t?1:0,t},Lt.prototype.get=function(t){return qi(this,t).get(t)},Lt.prototype.has=function(t){return qi(this,t).has(t)},Lt.prototype.set=function(t,e){var i=qi(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this},Ht.prototype.add=Ht.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ht.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.clear=function(){this.__data__=new Bt,this.size=0},kt.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,e){var i=this.__data__;if(i instanceof Bt){var s=i.__data__;if(!dr||199>s.length)return s.push([t,e]),this.size=++i.size,this;i=this.__data__=new Lt(s)}return i.set(t,e),this.size=i.size,this};var Cr=Ti(fe),Er=Ti(ge,!0),xr=yi(),Pr=yi(!0),Mr=Tr?function(t,e){return Tr.set(t,e),t}:cn,Rr=$n?function(t,e){return $n(t,"toString",{configurable:!0,enumerable:!1,value:un(e),writable:!0})}:cn,Br=Yn||function(t){return Rt.clearTimeout(t)},Lr=gr&&1/P(new gr([,-0]))[1]==L?function(t){return new gr(t)}:fn,Fr=Tr?function(t){return Tr.get(t)}:fn,Hr=er?function(t){return null==t?[]:(t=Sn(t),n(er(t),function(e){return Nn.call(t,e)}))}:_n,kr=er?function(t){for(var e=[];t;)l(e,Hr(t)),t=jn(t);return e}:_n,Ur=ye;(pr&&"[object DataView]"!=Ur(new pr(new ArrayBuffer(1)))||dr&&"[object Map]"!=Ur(new dr)||fr&&"[object Promise]"!=Ur(fr.resolve())||gr&&"[object Set]"!=Ur(new gr)||_r&&"[object WeakMap]"!=Ur(new _r))&&(Ur=function(t){var e=ye(t);if(t=(t="[object Object]"==e?t.constructor:B)?ps(t):"")switch(t){case Dr:return"[object DataView]";case wr:return"[object Map]";case vr:return"[object Promise]";case Sr:return"[object Set]";case Kr:return"[object WeakMap]"}return e});var Wr=Cn?Hs:mn,jr=hs(Mr),zr=Zn||function(t,e){return Rt.setTimeout(t,e)},Nr=hs(Rr),Vr=function(t){var e=(t=Ps(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(J,function(t,i,s,n){e.push(s?n.replace(at,"$1"):i||t)}),e}),Gr=ze(function(t,e){return Ls(t)?he(t,de(e,1,Ls,!0)):[]}),Xr=ze(function(t,e){var i=ys(e);return Ls(i)&&(i=B),Ls(t)?he(t,de(e,1,Ls,!0),Xi(i,2)):[]}),qr=ze(function(t,e){var i=ys(e);return Ls(i)&&(i=B),Ls(t)?he(t,de(e,1,Ls,!0),B,i):[]}),$r=ze(function(t){var e=a(t,ni);return e.length&&e[0]===t[0]?Se(e):[]}),Yr=ze(function(t){var e=ys(t),i=a(t,ni);return e===ys(i)?e=B:i.pop(),i.length&&i[0]===t[0]?Se(i,Xi(e,2)):[]}),Jr=ze(function(t){var e=ys(t),i=a(t,ni);return(e="function"==typeof e?e:B)&&i.pop(),i.length&&i[0]===t[0]?Se(i,B,e):[]}),Zr=ze(Ds),Qr=ji(function(t,e){var i=null==t?0:t.length,s=ne(t,e);return Ue(t,a(e,function(t){return ts(t,i)?+t:t}).sort(ci)),s}),to=ze(function(t){return Ze(de(t,1,Ls,!0))}),eo=ze(function(t){var e=ys(t);return Ls(e)&&(e=B),Ze(de(t,1,Ls,!0),Xi(e,2))}),io=ze(function(t){var e="function"==typeof(e=ys(t))?e:B;return Ze(de(t,1,Ls,!0),B,e)}),so=ze(function(t,e){return Ls(t)?he(t,e):[]}),no=ze(function(t){return ii(n(t,Ls))}),ro=ze(function(t){var e=ys(t);return Ls(e)&&(e=B),ii(n(t,Ls),Xi(e,2))}),oo=ze(function(t){var e="function"==typeof(e=ys(t))?e:B;return ii(n(t,Ls),B,e)}),ao=ze(vs),lo=ze(function(t){var e;return Ss(t,e="function"==typeof(e=1<(e=t.length)?t[e-1]:B)?(t.pop(),e):B)}),ho=ji(function(t){var e=t.length,i=e?t[0]:0,s=this.__wrapped__,n=function(e){return ne(e,t)};return!(1=e}),Eo=be(function(){return arguments}())?be:function(t){return js(t)&&xn.call(t,"callee")&&!Nn.call(t,"callee")},xo=Tn.isArray,Po=Ut?S(Ut):function(t){return js(t)&&"[object ArrayBuffer]"==ye(t)},Mo=ir||mn,Ro=Wt?S(Wt):function(t){return js(t)&&"[object Date]"==ye(t)},Bo=jt?S(jt):function(t){return js(t)&&"[object Map]"==Ur(t)},Lo=zt?S(zt):function(t){return js(t)&&"[object RegExp]"==ye(t)},Fo=Nt?S(Nt):function(t){return js(t)&&"[object Set]"==Ur(t)},Ho=Vt?S(Vt):function(t){return js(t)&&Us(t.length)&&!!It[ye(t)]},ko=Mi(xe),Uo=Mi(function(t,e){return t<=e}),Wo=mi(function(t,e){if(ns(e)||Bs(e))gi(e,sn(e),t);else for(var i in e)xn.call(e,i)&&Qt(t,i,e[i])}),jo=mi(function(t,e){gi(e,nn(e),t)}),zo=mi(function(t,e,i,s){gi(e,nn(e),t,s)}),No=mi(function(t,e,i,s){gi(e,sn(e),t,s)}),Vo=ji(ne),Go=ze(function(t,e){t=Sn(t);var i=-1,s=e.length;for((n=2--t)return e.apply(this,arguments)}},yt.ary=Cs,yt.assign=Wo,yt.assignIn=jo,yt.assignInWith=zo,yt.assignWith=No,yt.at=Vo,yt.before=Es,yt.bind=Do,yt.bindAll=pa,yt.bindKey=wo,yt.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return xo(t)?t:[t]},yt.chain=Ks,yt.chunk=function(t,e,i){if(e=(i?es(t,e,i):e===B)?1:or($s(e),0),!(i=null==t?0:t.length)||1>e)return[];for(var s=0,n=0,r=Tn(Qn(i/e));s(e=i||e===B?1:$s(e))?0:e,s):[]},yt.dropRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0,0>(e=s-(e=i||e===B?1:$s(e)))?0:e):[]},yt.dropRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0,!0):[]},yt.dropWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0):[]},yt.fill=function(t,e,i,s){var n=null==t?0:t.length;if(!n)return[];for(i&&"number"!=typeof i&&es(t,e,i)&&(i=0,s=n),n=t.length,0>(i=$s(i))&&(i=-i>n?0:n+i),0>(s=s===B||s>n?n:$s(s))&&(s+=n),s=i>s?0:Ys(s);i>>0)?(t=Qs(t))&&("string"==typeof e||null!=e&&!Lo(e))&&(!(e=Je(e))&&Kt.test(t))?ai(R(t),0,i):t.split(e,i):[]},yt.spread=function(e,i){if("function"!=typeof e)throw new An("Expected a function");return i=null==i?0:or($s(i),0),ze(function(s){var n=s[i];return s=ai(s,0,i),n&&l(s,n),t(e,this,s)})},yt.tail=function(t){var e=null==t?0:t.length;return e?Ve(t,1,e):[]},yt.take=function(t,e,i){return t&&t.length?Ve(t,0,0>(e=i||e===B?1:$s(e))?0:e):[]},yt.takeRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0>(e=s-(e=i||e===B?1:$s(e)))?0:e,s):[]},yt.takeRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!1,!0):[]},yt.takeWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3)):[]},yt.tap=function(t,e){return e(t),t},yt.throttle=function(t,e,i){var s=!0,n=!0;if("function"!=typeof t)throw new An("Expected a function");return Ws(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xs(t,e,{leading:s,maxWait:e,trailing:n})},yt.thru=bs,yt.toArray=Xs,yt.toPairs=ea,yt.toPairsIn=ia,yt.toPath=function(t){return xo(t)?a(t,cs):Gs(t)?[t]:fi(Vr(Qs(t)))},yt.toPlainObject=Zs,yt.transform=function(t,e,s){var n=xo(t),r=n||Mo(t)||Ho(t);if(e=Xi(e,4),null==s){var o=t&&t.constructor;s=r?n?new o:[]:Ws(t)&&Hs(o)?Or(jn(t)):{}}return(r?i:fe)(t,function(t,i,n){return e(s,t,i,n)}),s},yt.unary=function(t){return Cs(t,1)},yt.union=to,yt.unionBy=eo,yt.unionWith=io,yt.uniq=function(t){return t&&t.length?Ze(t):[]},yt.uniqBy=function(t,e){return t&&t.length?Ze(t,Xi(e,2)):[]},yt.uniqWith=function(t,e){return e="function"==typeof e?e:B,t&&t.length?Ze(t,B,e):[]},yt.unset=function(t,e){return null==t||Qe(t,e)},yt.unzip=vs,yt.unzipWith=Ss,yt.update=function(t,e,i){return null!=t&&(t=Ne(t,e,(i=ri(i))(me(t,e)),void 0)),t},yt.updateWith=function(t,e,i,s){return s="function"==typeof s?s:B,null!=t&&(t=Ne(t,e,(i=ri(i))(me(t,e)),s)),t},yt.values=on,yt.valuesIn=function(t){return null==t?[]:K(t,nn(t))},yt.without=so,yt.words=hn,yt.wrap=function(t,e){return bo(ri(e),t)},yt.xor=no,yt.xorBy=ro,yt.xorWith=oo,yt.zip=ao,yt.zipObject=function(t,e){return si(t||[],e||[],Qt)},yt.zipObjectDeep=function(t,e){return si(t||[],e||[],Ne)},yt.zipWith=lo,yt.entries=ea,yt.entriesIn=ia,yt.extend=jo,yt.extendWith=zo,dn(yt,yt),yt.add=va,yt.attempt=ca,yt.camelCase=sa,yt.capitalize=an,yt.ceil=Sa,yt.clamp=function(t,e,i){return i===B&&(i=e,e=B),i!==B&&(i=(i=Js(i))==i?i:0),e!==B&&(e=(e=Js(e))==e?e:0),re(Js(t),e,i)},yt.clone=function(t){return oe(t,4)},yt.cloneDeep=function(t){return oe(t,5)},yt.cloneDeepWith=function(t,e){return oe(t,5,e="function"==typeof e?e:B)},yt.cloneWith=function(t,e){return oe(t,4,e="function"==typeof e?e:B)},yt.conformsTo=function(t,e){return null==e||ae(t,e,sn(e))},yt.deburr=ln,yt.defaultTo=function(t,e){return null==t||t!=t?e:t},yt.divide=Ka,yt.endsWith=function(t,e,i){t=Qs(t),e=Je(e);var s=t.length;s=i=i===B?s:re($s(i),0,s);return 0<=(i-=e.length)&&t.slice(i,s)==e},yt.eq=Rs,yt.escape=function(t){return(t=Qs(t))&&V.test(t)?t.replace(z,qt):t},yt.escapeRegExp=function(t){return(t=Qs(t))&&Q.test(t)?t.replace(Z,"\\$&"):t},yt.every=function(t,e,i){var n=xo(t)?s:ue;return i&&es(t,e,i)&&(e=B),n(t,Xi(e,3))},yt.find=co,yt.findIndex=gs,yt.findKey=function(t,e){return p(t,Xi(e,3),fe)},yt.findLast=po,yt.findLastIndex=_s,yt.findLastKey=function(t,e){return p(t,Xi(e,3),ge)},yt.floor=ba,yt.forEach=As,yt.forEachRight=Is,yt.forIn=function(t,e){return null==t?t:xr(t,Xi(e,3),nn)},yt.forInRight=function(t,e){return null==t?t:Pr(t,Xi(e,3),nn)},yt.forOwn=function(t,e){return t&&fe(t,Xi(e,3))},yt.forOwnRight=function(t,e){return t&&ge(t,Xi(e,3))},yt.get=tn,yt.gt=Oo,yt.gte=Co,yt.has=function(t,e){return null!=t&&Ji(t,e,we)},yt.hasIn=en,yt.head=Ts,yt.identity=cn,yt.includes=function(t,e,i,s){return t=Bs(t)?t:on(t),i=i&&!s?$s(i):0,s=t.length,0>i&&(i=or(s+i,0)),Vs(t)?i<=s&&-1(i=null==i?0:$s(i))&&(i=or(s+i,0)),f(t,e,i)):-1},yt.inRange=function(t,e,i){return e=qs(e),i===B?(i=e,e=0):i=qs(i),(t=Js(t))>=ar(e,i)&&t=t},yt.isSet=Fo,yt.isString=Vs,yt.isSymbol=Gs,yt.isTypedArray=Ho,yt.isUndefined=function(t){return t===B},yt.isWeakMap=function(t){return js(t)&&"[object WeakMap]"==Ur(t)},yt.isWeakSet=function(t){return js(t)&&"[object WeakSet]"==ye(t)},yt.join=function(t,e){return null==t?"":nr.call(t,e)},yt.kebabCase=na,yt.last=ys,yt.lastIndexOf=function(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s;if(i!==B&&(n=0>(n=$s(i))?or(s+n,0):ar(n,s-1)),e==e)t:{for(i=n+1;i--;)if(t[i]===e){t=i;break t}t=i}else t=d(t,_,n,!0);return t},yt.lowerCase=ra,yt.lowerFirst=oa,yt.lt=ko,yt.lte=Uo,yt.max=function(t){return t&&t.length?ce(t,cn,De):B},yt.maxBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),De):B},yt.mean=function(t){return m(t,cn)},yt.meanBy=function(t,e){return m(t,Xi(e,2))},yt.min=function(t){return t&&t.length?ce(t,cn,xe):B},yt.minBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),xe):B},yt.stubArray=_n,yt.stubFalse=mn,yt.stubObject=function(){return{}},yt.stubString=function(){return""},yt.stubTrue=function(){return!0},yt.multiply=Aa,yt.nth=function(t,e){return t&&t.length?Le(t,$s(e)):B},yt.noConflict=function(){return Rt._===this&&(Rt._=Ln),this},yt.noop=fn,yt.now=yo,yt.pad=function(t,e,i){t=Qs(t);var s=(e=$s(e))?M(t):0;return!e||s>=e?t:Ei(tr(e=(e-s)/2),i)+t+Ei(Qn(e),i)},yt.padEnd=function(t,e,i){t=Qs(t);var s=(e=$s(e))?M(t):0;return e&&se){var s=t;t=e,e=s}return i||t%1||e%1?(i=ur(),ar(t+i*(e-t+Et("1e-"+((i+"").length-1))),e)):We(t,e)},yt.reduce=function(t,e,i){var s=xo(t)?h:D,n=3>arguments.length;return s(t,Xi(e,4),i,n,Cr)},yt.reduceRight=function(t,e,i){var s=xo(t)?u:D,n=3>arguments.length;return s(t,Xi(e,4),i,n,Er)},yt.repeat=function(t,e,i){return e=(i?es(t,e,i):e===B)?1:$s(e),je(Qs(t),e)},yt.replace=function(){var t=arguments,e=Qs(t[0]);return 3>t.length?e:e.replace(t[1],t[2])},yt.result=function(t,e,i){var s=-1,n=(e=oi(e,t)).length;for(n||(n=1,t=B);++s(t=$s(t))||9007199254740991=r)return t;if(1>(r=i-M(s)))return s;if(i=o?ai(o,0,r).join(""):t.slice(0,r),n===B)return i+s;if(o&&(r+=i.length-r),Lo(n)){if(t.slice(r).search(n)){var a=i;for(n.global||(n=Kn(n.source,Qs(ht.exec(n))+"g")),n.lastIndex=0;o=n.exec(a);)var l=o.index;i=i.slice(0,l===B?r:l)}}else t.indexOf(Je(n),r)!=r&&(-1<(n=i.lastIndexOf(n))&&(i=i.slice(0,n)));return i+s},yt.unescape=function(t){return(t=Qs(t))&&N.test(t)?t.replace(j,$t):t},yt.uniqueId=function(t){var e=++Pn;return Qs(t)+e},yt.upperCase=ha,yt.upperFirst=ua,yt.each=As,yt.eachRight=Is,yt.first=Ts,dn(yt,function(){var t={};return fe(yt,function(e,i){xn.call(yt.prototype,i)||(t[i]=e)}),t}(),{chain:!1}),yt.VERSION="4.17.11",i("bind bindKey curry curryRight partial partialRight".split(" "),function(t){yt[t].placeholder=yt}),i(["drop","take"],function(t,e){Pt.prototype[t]=function(i){i=i===B?1:or($s(i),0);var s=this.__filtered__&&!e?new Pt(this):this.clone();return s.__filtered__?s.__takeCount__=ar(i,s.__takeCount__):s.__views__.push({size:ar(i,4294967295),type:t+(0>s.__dir__?"Right":"")}),s},Pt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),i(["filter","map","takeWhile"],function(t,e){var i=e+1,s=1==i||3==i;Pt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xi(t,3),type:i}),e.__filtered__=e.__filtered__||s,e}}),i(["head","last"],function(t,e){var i="take"+(e?"Right":"");Pt.prototype[t]=function(){return this[i](1).value()[0]}}),i(["initial","tail"],function(t,e){var i="drop"+(e?"":"Right");Pt.prototype[t]=function(){return this.__filtered__?new Pt(this):this[i](1)}}),Pt.prototype.compact=function(){return this.filter(cn)},Pt.prototype.find=function(t){return this.filter(t).head()},Pt.prototype.findLast=function(t){return this.reverse().find(t)},Pt.prototype.invokeMap=ze(function(t,e){return"function"==typeof t?new Pt(this):this.map(function(i){return Ke(i,t,e)})}),Pt.prototype.reject=function(t){return this.filter(Ms(Xi(t)))},Pt.prototype.slice=function(t,e){t=$s(t);var i=this;return i.__filtered__&&(0e)?new Pt(i):(0>t?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==B&&(i=0>(e=$s(e))?i.dropRight(-e):i.take(e-t)),i)},Pt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Pt.prototype.toArray=function(){return this.take(4294967295)},fe(Pt.prototype,function(t,e){var i=/^(?:filter|find|map|reject)|While$/.test(e),s=/^(?:head|last)$/.test(e),n=yt[s?"take"+("last"==e?"Right":""):e],r=s||/^find/.test(e);n&&(yt.prototype[e]=function(){var e=this.__wrapped__,o=s?[1]:arguments,a=e instanceof Pt,h=o[0],u=a||xo(e),c=function(t){return t=n.apply(yt,l([t],o)),s&&p?t[0]:t};u&&i&&"function"==typeof h&&1!=h.length&&(a=u=!1);var p=this.__chain__,d=!!this.__actions__.length;h=r&&!p,a=a&&!d;return!r&&u?(e=a?e:new Pt(this),(e=t.apply(e,o)).__actions__.push({func:bs,args:[c],thisArg:B}),new Ct(e,p)):h&&a?t.apply(this,o):(e=this.thru(c),h?s?e.value()[0]:e.value():e)})}),i("pop push shift sort splice unshift".split(" "),function(t){var e=In[t],i=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",s=/^(?:pop|shift)$/.test(t);yt.prototype[t]=function(){var t=arguments;if(s&&!this.__chain__){var n=this.value();return e.apply(xo(n)?n:[],t)}return this[i](function(i){return e.apply(xo(i)?i:[],t)})}}),fe(Pt.prototype,function(t,e){var i=yt[e];if(i){var s=i.name+"";(yr[s]||(yr[s]=[])).push({name:e,func:i})}}),yr[Ai(B,2).name]=[{name:"wrapper",func:B}],Pt.prototype.clone=function(){var t=new Pt(this.__wrapped__);return t.__actions__=fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=fi(this.__views__),t},Pt.prototype.reverse=function(){if(this.__filtered__){var t=new Pt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Pt.prototype.value=function(){var t,e=this.__wrapped__.value(),i=this.__dir__,s=xo(e),n=0>i,r=s?e.length:0;t=0;for(var o=r,a=this.__views__,l=-1,h=a.length;++l=this.__values__.length;return{done:t,value:t?B:this.__values__[this.__index__++]}},yt.prototype.plant=function(t){for(var e,i=this;i instanceof vt;){var s=fs(i);s.__index__=0,s.__values__=B,e?n.__wrapped__=s:e=s;var n=s;i=i.__wrapped__}return n.__wrapped__=t,e},yt.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Pt?(this.__actions__.length&&(t=new Pt(this)),(t=t.reverse()).__actions__.push({func:bs,args:[ws],thisArg:B}),new Ct(t,this.__chain__)):this.thru(ws)},yt.prototype.toJSON=yt.prototype.valueOf=yt.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},yt.prototype.first=yt.prototype.head,Xn&&(yt.prototype[Xn]=function(){return this}),yt}();Rt._=Yt,void 0===(__WEBPACK_AMD_DEFINE_RESULT__=function(){return Yt}.call(exports,__webpack_require__,exports,module))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)}.call(this),window.DKTools={},Object.defineProperties(DKTools,{SITE:{value:"https://dk-plugins.ru"},VERSION:{value:Imported.DKTools}}),DKTools.Sprite=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Window=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Scene=function(){this.initialize.apply(this,arguments)},DKTools.Utils=class{constructor(){return DKTools.Utils}static initialize(){this._saidHello=!1,this._isNwjs=Utils.isNwjs(),this._isTest=!!Utils.isOptionValid("test"),this._isMobileDevice=Utils.isMobileDevice(),this._isMobileSafari=Utils.isMobileSafari(),this._isAndroidChrome=Utils.isAndroidChrome(),this._gridSize=64,this._sayHello(),this.__tileSize(),this.__imageCacheLimit(),DKToolsParam.get("Debugging Console","Enabled")&&this.openConsole(),DKToolsParam.get("Check Updates","Enabled")&&this._checkUpdates()}static async _checkUpdates(){if(!this.isNwjs()||!this.isTest())return;let t=[];try{const e=new FormData;e.append("version",DKTools.VERSION),t=await DKTools.Network.fetchJson(`${DKTools.SITE}/plugins.php`,{method:"POST",body:e})}catch(t){return void console.error("DKTools can not check updates")}if(!t||0===t.length)return;const e=DKToolsParam.get("Check Updates","Show New Plugins");_.forEach(t,t=>{const i=t.version;if(DKTools.PluginManager.isRegistered(t.name)){if(i>DKTools.PluginManager.getVersion(t.name)){const e=[`Available a new version of ${t.name}: ${i} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}}else if(e){const e=[`Try the new plugin: ${t.name} \n`,`Description: ${t.description} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}})}static _getErrorLogData(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e}static __hideGrid(){this._gridSprite&&(SceneManager._scene.removeChild(this._gridSprite),this._gridSprite=null)}static __imageCacheLimit(){const t=DKToolsParam.get("Image Cache Limit");t.Enabled&&(ImageCache.limit=t.Limit)}static isAndroidChrome(){return this._isAndroidChrome}static isArrayLike(t){return!!Array.isArray(t)||"[object Arguments]"===String(t)}static isBoolean(t){return"boolean"==typeof t}static isFunction(t){return"function"==typeof t}static isMobileDevice(){return this._isMobileDevice}static isMobileSafari(){return this._isMobileSafari}static isNumber(t){return Number.isFinite(t)}static isNwjs(){return this._isNwjs}static isString(t){return!!t&&"string"==typeof t}static isTest(){return this._isTest}static async logError(t){if(!t||!this.isNwjs())return;const e=DKToolsParam.get("Errors Log"),i=DKTools.Utils.isTest(),s=e.Enabled;if("None"===s||"Only Game"===s&&i||"Only Test"===s&&!i)return;const n=DKTools.IO.fs,r=DKTools.IO.os;if(!n||!r)return;const o=1024*e["File Size"]*1024,a=e.Filename,l=new DKTools.IO.File(a),h=await l.getStatsAsync().then(t=>t.data);if(h&&h.size>o){const t=DKTools.IO.parsePath(a).name,e=new Date,i=String(e.getDate()).padZero(2),s=String(e.getMonth()+1).padZero(2),n=e.getFullYear(),r=String(e.getHours()).padZero(2),o=String(e.getMinutes()).padZero(2),h=String(e.getSeconds()).padZero(2);await l.renameAsync(`${i}.${s}.${n}_${r}.${o}.${h}_${t}`)}const u=await n.openSync(a,"a"),c=this._getErrorLogData();let p=`Date: ${(new Date).toString()}`+r.EOL;_.forEach(c,(t,e)=>{p+=e+": "+t+r.EOL}),t instanceof Object?(p+=`Name: ${t.name}`+r.EOL,p+=`Message: ${t.message}`+r.EOL,void 0!==t.filename&&(p+=`Filename: ${t.filename}`+r.EOL),void 0!==t.lineNumber&&(p+=`Line: ${t.lineNumber}`+r.EOL),void 0!==t.columnNumber&&(p+=`Column: ${t.columnNumber}`+r.EOL),p+=`Stack: ${t.stack}`+r.EOL+r.EOL):p+=`Error: ${t}`+r.EOL+r.EOL,await n.writeSync(u,p),await n.closeSync(u)}static makeScreenshot(){if(!this.isNwjs())return;const t=DKToolsParam.get("Screenshots"),e=t.Path,i=t.Type,s=t.Quality,n=SceneManager.snap().canvas.toDataURL("image/"+i,s),r=new RegExp(`^data:image/${i};base64,`),o=n.replace(r,""),a=new Date;let l=t.Filename;const h=(l=(l=(l=(l=(l=(l=l.replace(/%year/gi,a.getFullYear())).replace(/%month/gi,a.getMonth()+1)).replace(/%day/gi,a.getDate())).replace(/%hours/gi,a.getHours())).replace(/%minutes/gi,a.getMinutes())).replace(/%seconds/gi,a.getSeconds()))+"."+i,u=DKTools.IO.normalizePath(e+"/"+h);new DKTools.IO.File(u).save(o,{createDirectory:!0,options:"base64"}),console.log("The screenshot is saved with the name: "+h)}static mixin(t,e){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}static openConsole(){if(this.isTest()&&this.isNwjs())try{const t=__webpack_require__(2).Window.get();t.showDevTools(null,()=>t.focus())}catch(t){this.logError(t),console.error("DKTools can not open the console")}}static __tileSize(){const t=DKToolsParam.get("Tile Size");t.Enabled&&(Tilemap.TILE_WIDTH=t.Size,Tilemap.TILE_HEIGHT=t.Size)}static throwError(t){setTimeout(()=>{throw t},0)}static __quickLoad(){if(!DKTools.Utils.isTest()||!DKToolsParam.get("Quick Load","Enabled"))return;const t=DKToolsParam.get("Quick Load","Savefile ID"),e=SceneManager._scene;t>0?DataManager.loadGame(t)&&(SoundManager.playLoad(),e instanceof Scene_Base&&e.fadeOutAll(),$gameSystem.versionId()!==$dataSystem.versionId&&($gamePlayer.reserveTransfer($gameMap.mapId(),$gamePlayer.x,$gamePlayer.y),$gamePlayer.requestMapReload()),SceneManager.goto(Scene_Map)):e instanceof Scene_Load||SceneManager.push(Scene_Load)}static _sayHello(){if(!this._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>=0){const t=[`%c %c %c DKTools.js ${DKTools.VERSION} %c %c ${DKTools.SITE} %c \n`,"background: #279EE8; padding:5px 0;","background: #279EE8; padding:5px 0;","color: #4CCBF5; background: #030307; padding:5px 0;","background: #279EE8; padding:5px 0;","background: #BDE5F2; padding:5px 0;","background: #279EE8; padding:5px 0;"];console.log.apply(console,t)}else window.console&&console.log(`DKTools.js ${DKTools.VERSION} - ${DKTools.SITE}`);this._saidHello=!0}}static __showGrid(){if(!DKTools.Utils.isTest()||!DKToolsParam.get("Grid","Enabled"))return;if(this._gridSprite)return void(this._gridSize>=32?(this._gridSize-=16,this._gridSprite.refreshAll()):(this._gridSize=64,this.__hideGrid()));const t=DKToolsParam.get("Grid");let e=null;this._gridSprite=new DKTools.Sprite.Button(Graphics),this._gridSprite.addEvent({type:"draw-all",onUpdate:()=>{const i=Graphics.boxWidth,s=Graphics.boxHeight,n=this._gridSize,r=t["Grid Color"],o=t["Grid Width"];_.times(Math.ceil(i/n),t=>{this._gridSprite.drawLine({x1:n*t,y1:0,x2:n*t,y2:s,color:r,lineWidth:o})}),_.times(Math.ceil(s/n),t=>{this._gridSprite.drawLine({x1:0,y1:n*t,x2:i,y2:n*t,color:r,lineWidth:o})}),e&&this._gridSprite.drawLine({x1:e.x,y1:e.y,x2:TouchInput.mouseX,y2:TouchInput.mouseY,color:e.color,lineWidth:t["Ruler Width"]})}}),this._gridSprite.addEvent({type:"mouse-inside",onUpdate:()=>{const t=TouchInput.mouseX,e=TouchInput.mouseY,s=Graphics.boxWidth,n=Graphics.boxHeight;let r=t+8,o=e+8;r+i.width>s&&(r=t-i.width-8),o+i.height>n&&(o=e-i.height-8),i.move(r,o),i.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-down-middle",onUpdate:()=>{e||(e={x:TouchInput.mouseX,y:TouchInput.mouseY,color:t["Ruler Color"]||DKTools.Utils.Random.getHexColor()}),this._gridSprite.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-up-middle",onUpdate:()=>{e=null,this._gridSprite.refreshAll()}}),this._gridSprite.start(!0);const i=new DKTools.Sprite(0,0,220,"2");i.addEvent({type:"draw-all",onUpdate:()=>{if(e){const t={x:TouchInput.mouseX,y:TouchInput.mouseY},s=Math.floor(DKTools.Utils.Point.getDistance(e,t));i.drawText(`line: ${s} (${e.x}, ${e.y})`,{y:"0",align:"left"})}i.drawText(`x: ${TouchInput.mouseX}, y: ${TouchInput.mouseY}`,{y:"1",align:"left"})}}),i.start(),this._gridSprite.addChild(i),this._gridSprite.updateMouseInsideEvents(),SceneManager._scene.addChild(this._gridSprite)}},DKTools.Utils.Object=class{static toCamelCase(t){return _.reduce(t,(t,e,i)=>({...t,[_.camelCase(i)]:e}),{})}},DKTools.Utils.Number=class{static clamp(t,e,i){return _.clamp(t,e,i)}static inRange(t,e,i){return _.inRange(t,e,i)}},DKTools.Utils.String=class{static toBooleanArray(t){return _.map(this.toStringArray(t),Boolean)}static toNumberArray(t){return _.map(this.toStringArray(t),Number)}static toStringArray(t){return t.trim().replace(/\s*\,\s*/g,",").split(",")}},DKTools.Utils.Array=class{static avg(t){return this.sum(t)/t.length}static compact(t){return _.pull(t,"",null,void 0,Number.NaN)}static conjunction(t){return _.every(t,_.isEqual.bind(this,!0))}static contains(t,e){return _.includes(t,e)}static count(t,e){return _.size(t)-_.size(_.without(t,e))}static counts(t,e){return _.size(t)-_.size(_.difference(t,e))}static disjunction(t){return _.some(t,_.isEqual.bind(this,!0))}static insert(t,e,i=0){t.splice(i,0,e)}static isBitmapArray(t){return _.every(t,t=>t instanceof Bitmap)}static isBooleanArray(t){return _.every(t,t=>DKTools.Utils.isBoolean(t))}static isEmpty(t){return _.isEmpty(t)}static isNumberArray(t){return _.every(t,t=>DKTools.Utils.isNumber(t))}static isSpriteArray(t){return _.every(t,t=>t instanceof Sprite)}static isStringArray(t){return _.every(t,t=>DKTools.Utils.isString(t))}static isWindowArray(t){return _.every(t,t=>t instanceof Window)}static max(t){return Math.max.apply(Math,t)}static min(t){return Math.min.apply(Math,t)}static remove(t,e){return _.pull(t,e)}static sum(t){return _.reduce(t,(t,e)=>t+=e,0)}},DKTools.Utils.Point=class{static clone(t=0,e=0){return this.toPoint(t,e)}static equals(t,e=0,i=0){if(0===arguments.length)return!1;const s=this.toPoint(e,i);return(t=this.toPoint(t)).x===s.x&&t.y===s.y}static getDistance(t,e=0,i=0){const s=this.toPoint(e,i);return t=this.toPoint(t),Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}static toArray(t){return[t.x,t.y]}static toPoint(t=0,e=0){const i=this.tryToPoint(t,e);if(null!==i)return i;const s=t=>Number.isFinite(t)?t:0;let n;return t instanceof Object&&(n=t.x,e=t.y),n=s(n),e=s(e),new Point(n,e)}static tryToPoint(t,e){let i,s;return t instanceof Object?(i=t.x,s=t.y):(i=t,s=e),DKTools.Utils.Array.isNumberArray([i,s])?new Point(i,s):null}},DKTools.Utils.Rectangle=class{static clone(t=0,e=0,i=0,s=0){return this.toRectangle(t,e,i,s)}static equals(t,e=0,i=0,s=0,n=0){if(0===arguments.length)return!1;const r=this.toRectangle(e,i,s,n);return(t=this.toRectangle(t)).x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}static isEmpty(t){return this.equals(t,Rectangle.emptyRectangle)}static toArray(t){return[t.x,t.y,t.width,t.height]}static toRectangle(t=0,e=0,i=0,s=0){const n=this.tryToRectangle(t,e,i,s);if(n)return n;const r=t=>Number.isFinite(t)?t:0;let o;return t instanceof Object&&(o=t.x,e=t.y,i=t.width,s=t.height),o=r(o),e=r(e),i=r(i),s=r(s),new Rectangle(o,e,i,s)}static tryToRectangle(t,e,i,s){let n,r,o,a;return t instanceof Object?(n=t.x,r=t.y,o=t.width,a=t.height):(n=t,r=e,o=i,a=s),DKTools.Utils.Array.isNumberArray([n,r,o,a])?new Rectangle(n,r,o,a):null}},DKTools.Utils.WebAudio=class{static load(t,e,i){if(!t)return null;if(t instanceof WebAudio)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const s=AudioManager.createBuffer(t,e);return DKTools.Utils.isFunction(i)&&s.addLoadListener(i),s}static async loadAsync(t,e,i){return new Promise(s=>{const n=this.load(t,e,i);n?n.addLoadListener(()=>s(n)):s(n)})}static loadBuffers(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof WebAudio?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBuffersAsync(t){const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}},DKTools.Utils.Bitmap=class{static clone(t){if(!t||t.url)return t;const e=t.canvas,i=new Bitmap(e.width,e.height);return i.context.drawImage(e,0,0),i}static drawLine(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.beginPath(),a.moveTo(e,i),a.lineTo(s,n),a.stroke(),a.restore(),t._setDirty()}static fillArc(t,e,i,s,n,r,o="white",a=!1){const l=t.context;l.save(),l.fillStyle=o,l.beginPath(),l.arc(e,i,s,n,r,a),l.fill(),l.restore(),t._setDirty()}static getBase64(t){return t&&t.canvas?t.canvas.toDataURL("image/png"):null}static load(t,e,i,s,n){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const r=DKTools.IO.normalizePath(t+"/",!0),o=ImageManager.loadBitmap(r,e,s,n);return DKTools.Utils.isFunction(i)&&o.addLoadListener(i),o}static async loadAsync(t,e,i,s,n){return new Promise(r=>{const o=this.load(t,e,i,s,n);o?o.addLoadListener(()=>r(o)):r(o)})}static loadBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}static reserve(t,e,i,s,n,r){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.reserve.apply(this,t);if(t instanceof Object)return this.reserve(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);if(!DKTools.Utils.isString(t))return null;const o=DKTools.IO.normalizePath(t+"/",!0),a=ImageManager.reserveBitmap(o,e,s,n,r);return DKTools.Utils.isFunction(i)&&a.addLoadListener(i),a}static async reserveAsync(t,e,i,s,n,r){return new Promise(o=>{const a=this.reserve(t,e,i,s,n,r);a?a.addLoadListener(()=>o(a)):o(a)})}static reserveBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.reserve(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async reserveBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.reserveAsync(t));return Promise.all(e)}static strokeArc(t,e,i,s,n,r,o="white",a=1,l=!1){const h=t.context;h.save(),h.strokeStyle=o,h.lineWidth=a,h.beginPath(),h.arc(e,i,s,n,r,l),h.stroke(),h.restore(),t._setDirty()}static strokeRect(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.strokeRect(e,i,s,n),a.restore(),t._setDirty()}},DKTools.Utils.Event=class{static getAllComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t?(t instanceof Game_Event&&(t=t.event()),_.reduce(t.pages,(t,e,i)=>(t[i+1]=_.reduce(e.list,(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]),t),{})):[]}static getComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t&&t.page()?_.reduce(t.list(),(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]):[]}},DKTools.Utils.Random=class{constructor(){return DKTools.Utils.Random}static getBoolean(){return this.getInt(1)%2==0}static getFloat(t=1){return _.random(0,t,!0)}static getHexColor(){return"#"+(16777215*Math.random()<<0).toString(16)}static getInt(t=1){return _.random(0,t)}static getRgbaColor(t=1){const e=this.getInt(255),i=this.getInt(255),s=this.getInt(255);return"rgba(%1, %2, %3, %4)".format(e,i,s,t)}},DKTools.IO=class{constructor(){return DKTools.IO}static initialize(){let t="";this.isLocalMode()&&(this._fs=__webpack_require__(3),this._os=__webpack_require__(4),this._path=__webpack_require__(5),t=this.joinPath(this._path.dirname(process.mainModule.filename),"/")),this._projectPath=t,this._mode=DKToolsParam.get("File System","Mode"),this._stamp={},this._loadStamp(),this._createStamp()}static absolutePathExists(t){if(this.isLocalMode())return this._fs.existsSync(t);if(this.mode===DKTools.IO.MODE_NWJS_STAMP&&t.startsWith(this._projectPath)){if(this.isFile(t))return!0;if(this.isDirectory(t))return!0}return!1}static _createStamp(){if(!DKTools.Utils.isTest()||!this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;const t=DKToolsParam.get("File System","Ignored Directories").map(t=>new DKTools.IO.Directory(t)),e=DKTools.IO.getRootDirectory(),i=this._stamp;let s=null;const n=e=>{t.some(t=>t.getFullPath()===e.getFullPath())||e.getAllAsync().then(t=>t.data).then(t=>{t.forEach(t=>{t.getStatsAsync().then(t=>t.data).then(e=>{const n=t.getFullPath().substring(1).split("\\");t.isFile()?_.set(i,n,{__stats__:{...e,type:"file"}}):_.set(i,n,{__stats__:{...e,type:"directory"}}),s&&clearTimeout(s),s=setTimeout(()=>{new DKTools.IO.File("data/Stamp.json").saveJsonAsync(i,{compress:!0})})}),t.isDirectory()&&n(t)})})};n(e)}static getRootDirectory(){return new DKTools.IO.Directory}static getAbsolutePath(t){const e=this.joinPath(this._projectPath,t||"");return this.normalizePath(e)}static isLocalMode(){return DKTools.Utils.isNwjs()}static isFile(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isFile()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\");if(_.last(e).includes("."))return"file"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static isDirectory(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isDirectory()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\").filter(t=>!!t);if(!_.last(e).includes("."))return"directory"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static joinPath(){if(this.isLocalMode())return this._path.join(...arguments);const t=_.filter(arguments,t=>DKTools.Utils.isString(t));let e=t.join("\\");return/^[\\\/]{2}[^\\\/]/.test(t[0])||(e=e.replace(/^[\\\/]{2,}/,"\\")),this.normalizePath(e)}static _loadStamp(){if(this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;new DKTools.IO.File("data/Stamp.json").loadJson({sync:!0,decompress:!0,onSuccess:t=>{this._stamp=t.data||this._stamp}})}static normalizePath(t,e=!1){if(this.isLocalMode()){const i=this._path.normalize(t);return e?i.replace(/\\/g,"/"):i}const i=this._statPath(t),s=i.isUnc,n=i.isAbsolute;let r=i.device,o=i.tail;const a=/[\\\/]$/.test(o),l=_.filter(o.split(/[\\\/]+/),t=>t&&"."!==t),h=[];for(const t of l)".."===t?h.length>0&&".."!==h[h.length-1]?h.pop():n||h.push(".."):h.push(t);(o=h.join("\\"))||n||(o="."),o&&a&&(o+="\\"),s&&(r="\\\\"+r.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\"));const u=r+(n?"\\":"")+o;return e?u.replace(/\\/g,"/"):u}static parsePath(t){if(this.isLocalMode())return this._path.parse(t);const e=this._splitPath(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}}static pathExists(t){return this.absolutePathExists(this.getAbsolutePath(t))}static _statPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=e[1]||"",s=!!i&&":"!==i[1];return{device:i,isUnc:s,isAbsolute:s||!!e[2],tail:e[3]}}static _splitPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=(e[1]||"")+(e[2]||""),s=e[3]||"",n=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/.exec(s);return[i,n[1],n[2],n[3]]}},Object.defineProperties(DKTools.IO,{fs:{get:function(){return this._fs},configurable:!0},os:{get:function(){return this._os},configurable:!0},path:{get:function(){return this._path},configurable:!0},sep:{get:function(){return this.isLocalMode()?this._path.sep:"/"},configurable:!0},projectPath:{get:function(){return this._projectPath},configurable:!0},mode:{get:function(){return this._mode},configurable:!0},stamp:{get:function(){return this._stamp},configurable:!0},OK:{value:0},EXPECT_CALLBACK:{value:1},ERROR_NOT_LOCAL_MODE:{value:2},ERROR_PATH_DOES_NOT_EXIST:{value:3},ERROR_CALLBACK_IS_NOT_AVAILABLE:{value:4},ERROR_DIRECTORY_ALREADY_EXISTS:{value:5},ERROR_DIRECTORY_IS_NOT_EMPTY:{value:6},ERROR_OVERWRITING_IS_NOT_AVAILABLE:{value:7},ERROR_OPTIONS_ARE_NOT_AVAILABLE:{value:8},ERROR_DECOMPRESSING_DATA:{value:9},ERROR_PARSING_DATA:{value:10},MODE_NWJS_STAMP:{value:0},MODE_NWJS:{value:1}}),DKTools.IO.Entity=class{constructor(){this.initialize.apply(this,arguments)}initialize(t=""){const e=DKTools.IO.parsePath(t);this._path=DKTools.IO.normalizePath(e.dir+"/"),this._name=e.name,this._initialExtension=e.ext,this._extension=e.ext}exists(){return DKTools.IO.absolutePathExists(this.getAbsolutePath())}getPath(){return this._path}getName(){return this._name}getExtension(){return this._extension}getFullPath(){return DKTools.IO.joinPath(this.getPath(),"/",this.getFullName())}getFullName(){return this._name+this._extension}getAbsolutePath(){return DKTools.IO.getAbsolutePath(this.getFullPath())}getStats(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const t=this.getFullPath().split("\\").filter(t=>!!t);return{data:_.get(DKTools.IO.stamp,t.concat("__stats__"),{}),status:DKTools.IO.OK}}const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.stat(i,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess({data:i,status:DKTools.IO.OK},this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{return{data:e.statSync(i),status:DKTools.IO.OK}}catch(e){this.__processError(e,t.onError)}}async getStatsAsync(){return new Promise((t,e)=>{const i=this.getStats({sync:!1,onSuccess:t,onError:e});i.status!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}hasExtension(){return!!this._extension}isFile(){if(this instanceof DKTools.IO.File){if(DKTools.IO.isLocalMode()){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.isFile(t)}return DKTools.IO.isFile(this.getFullPath())}return!!this.hasExtension()}return!1}isDirectory(){return this instanceof DKTools.IO.Directory&&(DKTools.IO.isLocalMode()?DKTools.IO.isDirectory(this.getFullPath()):!this.hasExtension())}__processError(t,e){DKTools.Utils.isFunction(e)?e(t,this):DKTools.Utils.throwError(t)}rename(t,e={}){if(e=e||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=DKTools.IO.normalizePath(this._path+"/"+t+this._extension),r=DKTools.IO.getAbsolutePath(n);if(!e.overwrite&&DKTools.IO.absolutePathExists(r))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;if(!e.sync)return i.rename(s,r,i=>{i?this.__processError(i,e.onError):(this._name=t,DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this))}),DKTools.IO.EXPECT_CALLBACK;try{return i.renameSync(s,r),this._name=t,DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async renameAsync(t,e={}){return new Promise((i,s)=>{const n=this.rename(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},Object.defineProperties(DKTools.IO.Entity.prototype,{path:{get:function(){return this._path},configurable:!0},name:{get:function(){return this._name},configurable:!0},initialExtension:{get:function(){return this._initialExtension},configurable:!0},extension:{get:function(){return this._extension},configurable:!0}}),DKTools.IO.File=class extends DKTools.IO.Entity{initialize(t=""){super.initialize(t),this._detectExtension()}copy(t,e={}){if(!e)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=new DKTools.IO.File(t).getDirectory();if(e.createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!e.sync)return i.copyFile(s,t,e.flags,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.copyFileSync(s,t,e.flags),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async copyAsync(t,e={}){return new Promise((i,s)=>{const n=this.copy(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}_detectExtension(){let t=this._extension;this.isAudio()?t=AudioManager.audioFileExt():this.isImage()?t=".png":this.isVideo()&&(t=Graphics.canPlayVideoType("video/webm")&&!DKTools.Utils.isMobileDevice()?".webm":".mp4"),this._extension=t}exists(){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.pathExists(t)}return super.exists()}getDirectory(){return new DKTools.IO.Directory(this._path)}getDirectoryName(){return this.getDirectory().getName()}isAudio(){return".ogg"===this._extension||".m4a"===this._extension||".rpgmvo"===this._extension}isJson(){return".json"===this._extension}isTxt(){return".txt"===this._extension}isImage(){return".png"===this._extension||".rpgmvp"===this._extension||".webp"===this._extension}isScript(){return".js"===this._extension}isVideo(){return".webm"===this._extension||".mp4"===this._extension}isSave(){return".rpgsave"===this._extension}load(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};const e=this.getAbsolutePath(),i=e=>{if(e){if(t.decompress)try{e=LZString.decompressFromBase64(e)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(t.parse)try{e=JSON.parse(e,t.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:e,status:DKTools.IO.OK}};if(DKTools.IO.isLocalMode()){if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=DKTools.IO.fs,n=t.options||{encoding:"utf8"};if(t.sync)try{const r=s.readFileSync(e,n);return i(r)}catch(e){this.__processError(e,t.onError)}else{if(!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};s.readFile(e,n,(e,s)=>{e?this.__processError(e,t.onError):t.onSuccess(i(s),this)})}}else{if(!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP&&"Stamp.json"!==this.getFullName()&&!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=new XMLHttpRequest;s.open("GET",e,!t.sync),s.overrideMimeType(t.mimeType||"application/json"),s.onload=(()=>{4===s.readyState&&(200===s.status?t.onSuccess(i(s.responseText),this):this.__processError(s,t.onError))}),s.onerror=(()=>{this.__processError(s,t.onError)});try{s.send()}catch(t){}}return{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async loadAsync(t={}){return new Promise((e,i)=>{const s=this.load({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadAudio(){return this.isAudio()&&(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP||this.exists())?DKTools.Utils.WebAudio.load(this.getDirectoryName(),this.getName()):null}async loadAudioAsync(){return DKTools.Utils.WebAudio.loadAsync(this.loadAudio())}loadJson(t){return t?(t.parse||(t.parse=!0),this.load(t)):{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE}}async loadJsonAsync(t={}){return new Promise((e,i)=>{const s=this.loadJson({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadBitmap(t,e,i){return t instanceof Object?this.loadBitmap(t.listener,t.hue,t.smooth):this.isImage()&&(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP||this.exists())?DKTools.Utils.Bitmap.load({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i}):null}async loadBitmapAsync(t,e,i){return DKTools.Utils.Bitmap.loadAsync(this.loadBitmap(t,e,i))}remove(t={}){if(t=t||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.unlink(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.unlinkSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAsync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmap(t,e,i,s){return t instanceof Object?this.reserveBitmap(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserve({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}async reserveBitmapAsync(t,e,i,s){return t instanceof Object?this.reserveBitmapAsync(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserveAsync({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}save(t,e={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=this.getDirectory();if((e=e||{}).createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(e.stringify&&(t=JSON.stringify(t,e.stringify.replacer,e.stringify.space)),e.compress&&(t=LZString.compressToBase64(t)),!e.sync)return i.writeFile(s,t,e.options,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.writeFileSync(s,t,e.options),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async saveAsync(t,e={}){return new Promise((i,s)=>{const n=this.save(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}saveJson(t,e={}){return(e=e||{}).stringify||(e.stringify={space:"\t"}),this.save(t,e)}async saveJsonAsync(t,e={}){return new Promise((i,s)=>{const n=this.saveJson(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},DKTools.IO.Directory=class extends DKTools.IO.Entity{create(t){if(!t)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(this.exists())return DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.mkdir(i,t.options,e=>{e?this.__processError(e,t.onError):t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.mkdirSync(i,t.options),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async createAsync(t={}){return new Promise((e,i)=>{const s=this.create({...t,sync:!1,onSuccess:e,onError:i});s!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}createDirectory(t,e){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).create(e)}async createDirectoryAsync(t,e={}){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).createAsync(e)}findFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{if(n.isFile()){const e=n.getFullName();t.template instanceof RegExp&&t.template.test(e)?i.push(n):t.template&&e!==t.template||i.push(n)}else s{if(t.sync){const i=e.getAll({sync:!0,options:t.options}).data;r(i)}else e.getAll({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findFilesAsync(t={}){return new Promise((e,i)=>{const s=this.findFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}findDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{const r=n.getFullName();t.template instanceof RegExp&&t.template.test(r)?i.push(n):t.template&&r!==t.template||i.push(n),s{if(t.sync){const i=e.getDirectories({sync:!0,options:t.options}).data;r(i)}else e.getDirectories({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findDirectoriesAsync(t={}){return new Promise((e,i)=>{const s=this.findDirectories({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getAll(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=this.getFullPath(),i=i=>{return t.template instanceof RegExp?i=_.filter(i,e=>t.template.test(e)):DKTools.Utils.isString(t.template)&&(i=_.filter(i,e=>e===t.template)),{data:_.reduce(i,(t,i)=>{const s=DKTools.IO.normalizePath(e+"/"+i);return DKTools.IO.isFile(s)?t.push(new DKTools.IO.File(s)):DKTools.IO.isDirectory(s)&&t.push(new DKTools.IO.Directory(s)),t},[]),status:DKTools.IO.OK}};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.getFullPath().split("\\"),s=_.get(DKTools.IO.stamp,e,{}),n=Object.keys(s);return t.sync?i(n):(t.onSuccess(i(n),this),{data:null,status:DKTools.IO.EXPECT_CALLBACK})}const s=DKTools.IO.fs,n=this.getAbsolutePath();if(!t.sync)return s.readdir(n,t.options,(e,s)=>{e?this.__processError(e,t.onError):t.onSuccess(i(s),this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{const e=s.readdirSync(n,t.options);return i(e)}catch(e){this.__processError(e,t.onError)}}async getAllAsync(t={}){return new Promise((e,i)=>{const s=this.getAll({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isFile());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getFilesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isFile());return{...t,data:e}}return t})}getDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isDirectory());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getDirectoriesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isDirectory());return{...t,data:e}}return t})}getAudioFiles(t){return this.getFiles({...t,template:/(.ogg|.rpgmvo)/})}async getAudioFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getAudioFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getJsonFiles(t){return this.getFiles({...t,template:/(.json)/})}async getJsonFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getJsonFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getTxtFiles(t){return this.getFiles({...t,template:/(.txt)/})}async getTxtFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getTxtFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getImageFiles(t){return this.getFiles({...t,template:/(.png|.webp|.rpgmvp)/})}async getImageFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getImageFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getVideoFiles(t){return this.getFiles({...t,template:/(.webm|.mp4)/})}async getVideoFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getVideoFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getRootDirectory(){return new DKTools.IO.Directory(this.getPath())}isEmpty(){const t=this.getAll({sync:!0}).data;return!t||0===t.length}loadAudioFiles(){const t=this.getAudioFiles({sync:!0});return t.status!==DKTools.IO.OK?[]:_.map(t.data,t=>t.loadAudio())}async loadAudioFilesAsync(){const t=await this.getAudioFilesAsync();if(t.status!==DKTools.IO.OK)return[];const e=_.map(t.data,t=>t.loadAudioAsync());return Promise.all(e)}loadBitmaps(t,e,i){const s=this.getImageFiles({sync:!0});return s.status!==DKTools.IO.OK?[]:_.map(s.data,s=>s.loadBitmap(t,e,i))}async loadBitmapsAsync(t,e,i){const s=await this.getImageFilesAsync();if(s.status!==DKTools.IO.OK)return[];const n=_.map(s.data,s=>s.loadBitmapAsync(t,e,i));return Promise.all(n)}remove(t={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!this.isEmpty())return DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.rmdir(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.rmdirSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmaps(t,e,i,s){const n=this.getImageFiles({sync:!0});return n.status!==DKTools.IO.OK?[]:_.map(n.data,n=>n.reserveBitmap(t,e,i,s))}async reserveBitmapsAsync(t,e,i,s){const n=await this.getImageFilesAsync();if(n.status!==DKTools.IO.OK)return[];const r=_.map(n.data,n=>n.reserveBitmapAsync(t,e,i,s));return Promise.all(r)}},DKTools.IO.WebStorage=class{static exists(t){return localStorage.hasOwnProperty(t)}static load(t,e={}){if(!this.exists(t))return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};let i=localStorage.getItem(t);if(i){if(e.decompress)try{i=LZString.decompressFromBase64(i)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(e.parse)try{i=JSON.parse(i,e.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:i,status:DKTools.IO.OK}}static remove(t){return this.exists(t)?(localStorage.removeItem(t),DKTools.IO.OK):DKTools.IO.ERROR_PATH_DOES_NOT_EXIST}static rename(t,e,i=!1){if(!this.exists(t))return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!i&&this.exists(e))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;const s=localStorage.getItem(t);return localStorage.setItem(e,s),localStorage.removeItem(t),DKTools.IO.OK}static save(t,e,i={}){return i=i||{},!_.defaultTo(i.overwrite,!0)&&this.exists(t)?DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE:(i.stringify&&(e=JSON.stringify(e,i.stringify.replacer,i.stringify.space)),i.compress&&(e=LZString.compressToBase64(e)),localStorage.setItem(t,e),DKTools.IO.OK)}},DKTools.Network=class{constructor(){return DKTools.Network}static async fetchFile(t,e={}){return fetch(t,e).then(t=>{if(t.ok)return this._toFile(t);throw t})}static async fetchJson(t,e={}){return e.headers||(e.headers={}),e.headers.Accept="application/json",fetch(t,e).then(t=>{if(t.ok)return this._toJson(t);throw t})}static async _toFile(t){return t.arrayBuffer().catch(()=>null)}static async _toJson(t){return t.json().catch(()=>null)}},DKTools.ParameterManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._pluginName=t,this._params={},this.initializeParams()}initializeParams(){_.forEach(PluginManager.parameters(this._pluginName),(t,e)=>{this._params[e]=DKTools.ParameterManager.parse(t)})}get(t,e,i){if(!DKTools.Utils.isString(t))return void console.error("Parameter name is not a string!",this._pluginName,t,e,i);let s=this._params[t];return void 0!==s?(e instanceof Object?s=_.find(s,e):void 0!==e&&(s=s[e]),s instanceof Object&&(i instanceof Object?(void 0!==i.key&&(s=s[i.key]),void 0!==i.index&&(s=s[i.index])):void 0!==i&&(s=s[i])),s):void 0}static parse(t){try{return DKTools.Utils.isNumber(t)||DKTools.Utils.isBoolean(t)?t:JSON.parse(t,(t,e)=>{if(Array.isArray(e))return _.map(e,t=>this.parse(t));try{return this.parse(e)}catch(t){return e}})}catch(e){return t}}},Object.defineProperties(DKTools.ParameterManager.prototype,{pluginName:{get:function(){return this._pluginName},configurable:!0},params:{get:function(){return this._params},configurable:!0}}),DKTools.PluginManager=class{constructor(){return DKTools.PluginManager}static initialize(){this.registerPlugins(Imported),this._checkRequirements()}static _checkRequirements(){_.forEach(this._requirements,(t,e)=>{const i=_.max(t),s=this.getVersion(e);if(void 0===s){const t='Required to install the plugin "%1". Minimal version: %2'.format(e,i);throw new Error(t)}if(s{this.registerPlugin(e,t)})}static requirePlugin(t,e){this._requirements[t]||(this._requirements[t]=[]),this._requirements[t].push(e)}static requirePlugins(t){_.forEach(t,(t,e)=>{this.requirePlugin(e,t)})}},Object.defineProperties(DKTools.PluginManager,{_plugins:{value:{}},_requirements:{value:{}},plugins:{get:function(){return this._plugins},configurable:!0},requirements:{get:function(){return this._requirements},configurable:!0}}),DKTools.PluginCommandManager=class{constructor(){return DKTools.PluginCommandManager}static has(t){return!!this._pluginCommands[t.toLowerCase()]}static process(t,e,i){const s=this._pluginCommands[e.toLowerCase()];DKTools.Utils.isFunction(s)&&s.call(t,i)}static set(t,e){this._pluginCommands[t.toLowerCase()]=e}},Object.defineProperties(DKTools.PluginCommandManager,{_pluginCommands:{value:{}}}),DKTools.PreloadManager=class{constructor(){return DKTools.PreloadManager}static initialize(){this.clearCache();const t=DKToolsParam.get("Preload Manager");if(this._enabled=t.Enabled,!this.isEnabled())return;t["Audio Files"].forEach(t=>{this.preloadAudio({path:t.Path,caching:t.Caching})}),t["Image Files"].forEach(t=>{this.preloadImage({path:t.Path,hue:t.Hue,caching:t.Caching})});let e=!1;t["Progress Bar"].Enabled||(e=!0,this.onFileLoad(()=>{Graphics.updateLoading()}),this.onFinish(()=>{Graphics.endLoading()})),e&&this.start()}static clearCache(){this._cache={audio:{},image:{}}}static clearQueue(){this._queue={audio:[],image:[]}}static _finish(){this._finishTime=new Date,this.clearQueue();const t=(this._finishTime-this._startTime)/1e3,e=this.getTotal();if(this._log("Preloading complete! \nLoaded/Skipped/Total: "+this._loaded+"/"+this._skipped+"/"+e+"\nPreloading time: "+t+" sec"),this._finishListeners){const i={loaded:this._loaded,skipped:this._skipped,preloadingTime:t,total:e};for(;this._finishListeners.length>0;){this._finishListeners.shift()(i)}delete this._finishListeners}this._fileLoadListeners&&delete this._fileLoadListeners}static _generateAudioKey(t){return DKTools.IO.normalizePath(t,!0)}static _generateImageKey(t,e=0){return DKTools.IO.normalizePath(ImageManager._generateCacheKey(t,e||0),!0)}static getCachedAudioByKey(t){return this._cache.audio[t]}static getCachedAudioByPath(t){return this.getCachedAudioByKey(this._generateAudioKey(t))}static getCachedImageByKey(t){return this._cache.image[t]}static getCachedImageByPath(t){return this.getCachedImageByKey(this._generateImageKey(t))}static getTotal(){return _.size(this._queue.audio)+_.size(this._queue.image)}static isAudioCachedByKey(t){return!!this._cache.audio[t]}static isAudioCachedByPath(t){return this.isAudioCachedByKey(this._generateAudioKey(t))}static isEnabled(){return this._enabled}static isFinished(){return!!this._finishTime}static isReady(){return!this.isEnabled()||this.isFinished()}static isImageCachedByKey(t){return!!this._cache.image[t]}static isImageCachedByPath(t,e){return this.isImageCachedByKey(this._generateImageKey(t,e))}static _log(t){this.isEnabled()&&DKTools.Utils.isTest()&&DKToolsParam.get("Preload Manager","Debugging")&&t&&console.log(t)}static _onFileLoad(t){if(this._loaded++,this._log(`Loaded ${t instanceof WebAudio?"audio":"image"}: ${t.url}`),this._fileLoadListeners){const e={file:t,loadded:this._loaded,total:this.getTotal()};this._fileLoadListeners.forEach(t=>{t(e)})}}static onFileLoad(t){this._fileLoadListeners||(this._fileLoadListeners=[]),this._fileLoadListeners.push(t)}static onFinish(t){this._finishListeners||(this._finishListeners=[]),this._finishListeners.push(t)}static _preload(t,e){if(this.isEnabled()&&e instanceof Object&&DKTools.Utils.isString(e.path)){const i=new DKTools.IO.Directory(e.path);if(i.isDirectory()){if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP)throw new Error("Web browsers and mobile phones cannot load directories!");{const s={sync:!0};let n=[];"audio"===t?n=i.getAudioFiles(s).data:"image"===t&&(n=i.getImageFiles(s).data),n.forEach(i=>{const s=i.getFullPath();this._queue[t][s]||(this._queue[t][s]={...e,path:s})})}}else{let i=e.path;i.includes(".")||("image"===t?i+=".png":"audio"===t&&(i+=".ogg"));const s=new DKTools.IO.File(i),n=s.getFullPath();s.isFile()?this._queue[t][n]||(this._queue[t][n]={...e,path:i}):console.error("This is not a file: "+n)}}}static _processLoadAudioFiles(){const t=[];return _.forEach(this._queue.audio,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isAudio()){if(this.isAudioCachedByPath(s))return this._skipped++,void this._log("Audio already preloaded: "+s+". Skipped...");const n=i.loadAudio();n?(e.caching&&(this._cache.audio[this._generateAudioKey(n.url)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an audio: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an audio: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),t.map(t=>DKTools.Utils.WebAudio.loadAsync(t).then(()=>this._onFileLoad(t)))}static _processLoadImageFiles(){const t=[];return _.forEach(this._queue.image,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isImage()){if(this.isImageCachedByPath(s,e.hue))return this._skipped++,void this._log("Image already preloaded: "+s+". Skipped...");const n=DKTools.Utils.Bitmap.reserve({folder:i.getPath(),filename:i.getName(),hue:e.hue});n?(e.caching&&(this._cache.image[this._generateImageKey(n.url,e.hue)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an image: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an image: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),t.map(t=>DKTools.Utils.Bitmap.loadAsync(t).then(()=>this._onFileLoad(t)))}static preloadAudio(t){this._preload("audio",t)}static preloadImage(t){this._preload("image",t)}static releaseAudioByKey(t){this._cache.audio[t]=void 0}static releaseAudioByPath(t){this.releaseAudioByKey(this._generateAudioKey(t))}static releaseImageByKey(t){this._cache.image[t]=void 0}static releaseImageByPath(t,e){this.releaseImageByKey(this._generateImageKey(t,e))}static start(){if(!this.isEnabled())return;const t=this.getTotal();if(this._loaded=0,this._skipped=0,this._startTime=new Date,this._finishTime=null,0===t)return void this._finish();this._log("DKTools Preload Manager is running... \nTotal files to load: "+t);const e=Promise.all(this._processLoadAudioFiles()),i=Promise.all(this._processLoadImageFiles());Promise.all([e,i]).then(()=>this._finish())}},Object.defineProperties(DKTools.PreloadManager,{_queue:{value:{audio:{},image:{}},writable:!0},_cache:{value:{audio:[],image:[]},writable:!0}}),DKTools.StartupManager=class{static async initialize(){this._isReady=!1,await this.checkErrors(),await this.initializeModules(),this._isReady=!0}static async initializeModules(){DKTools.PreloadManager.initialize()}static _checkRPGMakerVersion(){if(Utils.RPGMAKER_VERSION<"1.6.0")throw new Error("Required to update RPG Maker MV to minimal version 1.6.0 (Installed: %1)".format(Utils.RPGMAKER_VERSION))}static _checkWebStorage(){if(!DKTools.IO.isLocalMode()&&!window.hasOwnProperty("localStorage"))throw new Error("Your browser does not support localStorage API")}static async checkErrors(){await this._checkRPGMakerVersion(),await this._checkWebStorage()}static isReady(){return this._isReady}},DKTools.Audio=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._type=t.type.toLowerCase(),this._name=t.name,this._volume=_.defaultTo(t.volume,this.standardVolume()),this._pitch=_.defaultTo(t.pitch,this.standardPitch()),this._pan=_.defaultTo(t.pan,this.standardPan()),this._loop=_.defaultTo(t.loop,this.standardLoop()),this._buffer=this._createBuffer(),this._pausePos=null}_createBuffer(){return AudioManager.createBuffer(this._type,this._name)}clone(){return new DKTools.Audio(this)}equals(t){return!!t&&(this._type===t.type&&this._name===t.name&&this._volume===t.volume&&this._pitch===t.pitch&&this._pan===t.pan&&this._loop===t.loop)}fadeIn(t=0){this._buffer.fadeIn(t)}fadeOut(t=0){this._buffer.fadeOut(t)}isPaused(){return!this.isPlaying()&&null!=this._pausePos}isPlaying(){return this._buffer.isPlaying()}pause(){this.isPlaying()&&(this._pausePos=this.seek(),this.stop())}play(t=0){this._buffer.play(this._loop,t),this._updateBufferParameters(),this._pausePos=null}resume(){this.isPaused()&&this.play(this._pausePos)}seek(){return this._buffer.seek()}standardLoop(){return"bgm"===this._type||"bgs"===this._type}standardPan(){return 0}standardPitch(){return 100}standardVolume(){return 90}stop(){this.isPlaying()&&this._buffer.stop()}_updateBufferParameters(){const t=this._buffer;let e=AudioManager[this._type+"Volume"];Number.isFinite(e)||(e=100),t.volume=e*this._volume/1e4,t.pitch=this._pitch/100,t.pan=this._pan/100}},Object.defineProperties(DKTools.Audio.prototype,{id:{get:function(){return this._id},configurable:!0},type:{get:function(){return this._type},configurable:!0},name:{get:function(){return this._name},configurable:!0},volume:{get:function(){return this._volume},set:function(t){this._volume!==t&&(this._volume=t,this._updateBufferParameters())},configurable:!0},pitch:{get:function(){return this._pitch},set:function(t){this._pitch!==t&&(this._pitch=t,this._updateBufferParameters())},configurable:!0},pan:{get:function(){return this._pan},set:function(t){this._pan!==t&&(this._pan=t,this._updateBufferParameters())},configurable:!0},loop:{get:function(){return this._loop},configurable:!0},buffer:{get:function(){return this._buffer},configurable:!0},pos:{get:function(){return this.seek()},set:function(t){this.play(t)},configurable:!0}}),DKTools.Event=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._target=t.target,this._type=t.type,this._repeatTime=t.repeatTime||-1,this._repeats=_.defaultTo(t.repeats,-1),this._remainingPauseTime=t.remainingPauseTime||0,this._onStart=t.onStart,this._onUpdate=t.onUpdate,this._onPause=t.onPause,this._onReset=t.onReset,this._onRepeat=t.onRepeat,this._onSuccess=t.onSuccess,this._onFail=t.onFail,this._started=!1,this._resetRemainingTime(),this._resetRemainingRepeats()}addRemainingPauseTime(t=1){this._remainingPauseTime+=t}addRemainingRepeats(t=1){this._remainingRepeats+=t}addRemainingTime(t=1){this._remainingTime+=t}_callOnPauseHandler(){this._canCallOnPauseHandler()&&this._onPause(this)}_callOnRepeatHandler(){this._canCallOnRepeatHandler()&&this._onRepeat(this)}_callOnResetHandler(){this._canCallOnResetHandler()&&this._onReset(this)}_callOnStartHandler(){this._canCallOnStartHandler()&&this._onStart(this),this._started=!0}_callOnSuccessHandler(t=!1){(this._canCallOnSuccessHandler()||t)&&this._onSuccess(this)}_callOnUpdateHandler(){this._canCallOnUpdateHandler()&&this._onUpdate(this)}_callonFailHandler(){this._canCallonFailHandler()&&this._onFail(this)}_canCallOnPauseHandler(){return this.hasOnPauseHandler()&&this.isPaused()}_canCallOnRepeatHandler(){return this.hasOnRepeatHandler()}_canCallOnResetHandler(){return this.hasOnResetHandler()}_canCallOnStartHandler(){return this.hasOnStartHandler()&&!this.isStarted()}_canCallOnSuccessHandler(){return this.hasOnSuccessHandler()&&this.isFinished()}_canCallOnUpdateHandler(){return this.hasOnUpdateHandler()&&this.isUpdated()}_canCallonFailHandler(){return this.hasonFailHandler()}_clearRemainingRepeats(){this._remainingRepeats=0}_clearRemainingTime(){this._remainingTime=0}clone(){return new this.constructor(this)}finish(t=!1){this.isFinished()||t?this._callOnSuccessHandler(t):this._callonFailHandler(),this._clearRemainingTime(),this._clearRemainingRepeats()}getElapsedRepeats(){return this._repeats-this._remainingRepeats}getElapsedTime(){return this._repeatTime-this._remainingTime}hasManager(){return!!this._manager}hasOnPauseHandler(){return!!this._onPause}hasOnRepeatHandler(){return!!this._onRepeat}hasOnResetHandler(){return!!this._onReset}hasOnStartHandler(){return!!this._onStart}hasOnSuccessHandler(){return!!this._onSuccess}hasOnUpdateHandler(){return!!this._onUpdate}hasTarget(){return!!this._target}hasType(){return!!this._type}hasonFailHandler(){return!!this._onFail}isAnimation(){return this instanceof DKTools.Animation}isAnimationAction(){return this instanceof DKTools.Animation.Action}isFinished(){return 0===this._remainingTime&&0===this._remainingRepeats}isPaused(){return 0!==this._remainingPauseTime}isStarted(){return this._started}isUpdated(){return this.isStarted()&&!this.isPaused()&&!this.isFinished()}pause(t=-1){this._remainingPauseTime=t}_resetRemainingRepeats(){this._remainingRepeats=this._repeats}_resetRemainingTime(){this._remainingTime=this._repeatTime}remove(){return!this.hasTarget()||this._target.removeEvent(this)}repeat(){this._remainingRepeats>0&&this._remainingRepeats--,this._resetRemainingTime(),this._callOnRepeatHandler()}reset(){this._resetRemainingTime(),this._resetRemainingRepeats(),this._callOnResetHandler()}resume(){this._remainingPauseTime=0}setManager(t){this._manager=t}setOnPauseHandler(t){this._onPause=t}setOnRepeatHandler(t){this._onRepeat=t}setOnResetHandler(t){this._onReset=t}setOnStartHandler(t){this._onStart=t}setOnSuccessHandler(t){this._onSuccess=t}setOnUpdateHandler(t){this._onUpdate=t}setTarget(t){this._target=t}setonFailHandler(t){this._onFail=t}stop(t=!1){this.finish(t),this.reset()}_update(){this._callOnUpdateHandler(),this._updateRemainingRepeats()}_updatePause(){this._callOnPauseHandler(),this._updateRemainingPauseTime()}_updateRemainingPauseTime(){this._remainingPauseTime>0&&this._remainingPauseTime--}_updateRemainingRepeats(){this.isFinished()||(0===this._remainingTime?this.repeat():this._updateRemainingTime())}_updateRemainingTime(){this._remainingTime>0&&this._remainingTime--}update(){this.isPaused()?this._updatePause():(this._callOnStartHandler(),this._update(),this.isFinished()&&this.finish())}},Object.defineProperties(DKTools.Event.prototype,{id:{get:function(){return this._id},configurable:!0},target:{get:function(){return this._target},configurable:!0},manager:{get:function(){return this._manager},configurable:!0},type:{get:function(){return this._type},configurable:!0},repeatTime:{get:function(){return this._duration},configurable:!0},repeats:{get:function(){return this._repeats},configurable:!0},remainingTime:{get:function(){return this._remainingTime},set:function(t){this._remainingTime=t},configurable:!0},remainingRepeats:{get:function(){return this._remainingRepeats},set:function(t){this._remainingRepeats=t},configurable:!0},remainingPauseTime:{get:function(){return this._remainingPauseTime},set:function(t){this._remainingPauseTime=t},configurable:!0},onStart:{get:function(){return this._onStart},configurable:!0},onUpdate:{get:function(){return this._onUpdate},configurable:!0},onPause:{get:function(){return this._onPause},configurable:!0},onReset:{get:function(){return this._onReset},configurable:!0},onRepeat:{get:function(){return this._onRepeat},configurable:!0},onSuccess:{get:function(){return this._onSuccess},configurable:!0},onFail:{get:function(){return this._onFail},configurable:!0}}),DKTools.Animation=class extends DKTools.Event{initialize(t){this._actions=[],DKTools.Event.prototype.initialize.call(this,t)}addAction(t){t&&(Number.isFinite(t.startTime)||(t.startTime=0),Number.isFinite(t.endTime)||(t.endTime=this._repeatTime),t.setAnimation(this),this._actions.push(t))}addActions(t){_.forEach(t,this.addAction.bind(this))}_canUpdateAction(t){return _.inRange(this.getElapsedTime(),t.startTime,t.endTime)}hasAction(t){return DKTools.Utils.Array.contains(this._actions,t)}hasActions(){return!DKTools.Utils.Array.isEmpty(this._actions)}isActionFinished(t){return t.isStarted()&&!t.isPaused()&&this.getElapsedTime()>=t.endTime}isActionUpdated(t){return t.isStarted()&&!t.isPaused()&&this._canUpdateAction(t)}isFinished(){return DKTools.Event.prototype.isFinished.call(this)||!this.hasActions()}removeAction(t){this.hasAction(t)&&DKTools.Utils.Array.remove(this._actions,t)}repeat(){this.repeatActions(),DKTools.Event.prototype.repeat.call(this)}repeatActions(){_.forEach(this._actions,function(t){t.repeat()})}reset(){this.resetActions(),DKTools.Event.prototype.reset.call(this)}resetActions(){_.forEach(this._actions,function(t){t.reset()})}_update(){this._updateActions(),DKTools.Event.prototype._update.call(this)}_updateAction(t){this._canUpdateAction(t)?t.update():this.getElapsedTime()===t.endTime&&this.isActionFinished(t)&&t.finish()}_updateActions(){_.forEach(this._actions,this._updateAction.bind(this))}},Object.defineProperties(DKTools.Animation.prototype,{actions:{get:function(){return this._actions},configurable:!0}}),DKTools.Animation.Action=class extends DKTools.Event{static Anchor(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.anchor,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setAnchor(o,a)}.bind(e)),e}static Close(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=-e.openness/t,s=e.openness+i;e.openness=s}.bind(e)),e}static Frame(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.frame,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=(i.width-s.width)/t,a=(i.height-s.height)/t,l=new Rectangle(s.x+n,s.y+r,s.width+o,s.height+a);e.setFrame(l)}.bind(e)),e}static Move(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.x-e.x)/t,s=(this._data.y-e.y)/t,n=e.x+i,r=e.y+s;e.move(n,r)}.bind(e)),e}static OpacitySprite(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.opacity)/t,s=e.opacity+i;e.setOpacity(s)}.bind(e)),e}static OpacityWindow(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.windowOpacity-e.windowOpacity)/t,s=(this._data.contentsOpacity-e.contentsOpacity)/t,n=(this._data.frameOpacity-e.frameOpacity)/t,r=(this._data.backOpacity-e.backOpacity)/t,o={windowOpacity:e.windowOpacity+i,contentsOpacity:e.contentsOpacity+s,frameOpacity:e.frameOpacity+n,backOpacity:e.backOpacity+r};e.setOpacity(o)}.bind(e)),e}static Open(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(255-e.openness)/t;e.openness=e.openness+i}.bind(e)),e}static Pivot(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.pivot,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setPivot(o,a)}.bind(e)),e}static Rotation(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.rotation)/t,s=e.rotation+i;e.setRotation(s)}.bind(e)),e}static Scale(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.scale,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setScale(o,a)}.bind(e)),e}static Skew(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.skew,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setSkew(o,a)}.bind(e)),e}static Sound(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this._data;t.isPlaying()||t.play()}.bind(e)),e}static Tint(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.tint)/t,s=e.tint+i;e.setTint(s)}.bind(e)),e}static Tone(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=e.tone,s=(this._data[0]-i[0])/t,n=(this._data[1]-i[1])/t,r=(this._data[2]-i[2])/t,o=i[0]+s,a=i[1]+n,l=i[2]+r;e.setTone([o,a,l])}.bind(e)),e}initialize(t){t=t||{},this._animation=null,this._startTime=t.startTime,this._endTime=t.endTime,this._data=t.data,DKTools.Event.prototype.initialize.call(this,t)}getElapsedTime(){return this._animation.getElapsedTime()-this._startTime}getRemainingTime(){return this._endTime-this._animation.getElapsedTime()}isFinished(){return this._animation.isActionFinished(this)}isUpdated(){return this._animation.isActionUpdated(this)}remove(){this._animation.removeAction(this)}repeat(){this._callOnRepeatHandler()}reset(){this._callOnResetHandler()}setAnimation(t){this._animation=t}},Object.defineProperties(DKTools.Animation.Action.prototype,{animation:{get:function(){return this._animation},configurable:!0},startTime:{get:function(){return this._startTime},set:function(t){this._startTime=t},configurable:!0},endTime:{get:function(){return this._endTime},set:function(t){this._endTime=t},configurable:!0},data:{get:function(){return this._data},configurable:!0}}),DKTools.OptionManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(){this.clear()}addOptionChangeListener(t,e){this._optionChangeListeners[t]||(this._optionChangeListeners[t]=[]),this._optionChangeListeners[t].push(e)}clear(){this._options=[],this._optionChangeListeners={}}clone(t=!1){const e=new DKTools.OptionManager;return e.enableOptions(this._options),t&&_.forEach(this._optionChangeListeners,(t,i)=>{_.forEach(t,t=>{e.addOptionChangeListener(i,t)})}),e}disableOption(t){this.isOptionEnabled(t)&&(DKTools.Utils.Array.remove(this._options,t),this._onOptionChange(t,!1))}disableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.disableOption.bind(this))}enableOption(t){this.isOptionDisabled(t)&&(this._options.push(t),this._onOptionChange(t,!0))}enableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.enableOption.bind(this))}equals(t){return t instanceof DKTools.OptionManager&&_.isEqual(this._options,t.options)}isOptionDisabled(t){return!this.isOptionEnabled(t)}isOptionEnabled(t){return DKTools.Utils.Array.contains(this._options,t)}isOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionDisabled.bind(this))}isOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionEnabled.bind(this))}isSomeOptionEnabled(){return this._options.length>0}isSomeOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionDisabled.bind(this))}isSomeOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionEnabled.bind(this))}_onOptionChange(t,e){_.forEach(this._optionChangeListeners[t],i=>{i(t,e)})}removeOptionChangeListener(t,e){DKTools.Utils.Array.remove(this._optionChangeListeners[t],e)}switchOption(t){this.isOptionEnabled(t)?this.disableOption(t):this.enableOption(t)}switchOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.switchOption.bind(this))}},Object.defineProperties(DKTools.OptionManager,{options:{get:function(){return this._options},configurable:!0}}),DKTools.EventManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._target=t,this._events={}}addAnimation(t){return this.addEventToContainer(t)}addEvent(t){let e;return t instanceof DKTools.Event||t instanceof DKTools.Animation?e=t:t instanceof Object&&(e=new DKTools.Event(t)),this.addEventToContainer(e)}addEventToContainer(t){if(!t)return null;return t.hasTarget()||t.setTarget(this._target),t.setManager(this),this.getEventsContainer(t).push(t),t}addOneTimeEvent(t){return t.repeatTime=1,t.repeats=0,this.addEvent(t)}_checkEvent(t){return t&&!t.isFinished()}_checkEvents(){_.forEach(this._events,(t,e)=>{this._events[e]=this._checkEventsContainer(t)})}_checkEventsContainer(t){return _.filter(t,this._checkEvent.bind(this))}clearEvents(t){t?Array.isArray(t)?_.forEach(t,t=>{this._events[t]=[]}):this._events[t]=[]:this._events={}}createEventsContainer(t){return this._events[t]=[],this._events[t]}findAnimation(t,e){return _.find(this.getAnimations(e),{id:t})}findEvent(t,e){return _.find(this.getEvents(e),{id:t})}finishEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.finish(e)})}getAnimations(t){return _.filter(this.getEvents(t),t=>t instanceof DKTools.Animation)}getEventIndex(t){return this.getEventsContainer(t).indexOf(t)}getEvents(t){if(t)return this.getEventsContainerByType(t);let e=[];return _.forEach(this._events,t=>{e=e.concat(t)}),e}getEventsContainer(t){return this.getEventsContainerByType(t.type)}getEventsContainerByType(t){return this._events[t]||this.createEventsContainer(t)}hasAnimation(t){return t instanceof DKTools.Animation&&this.getEventIndex(t)>=0}hasAnimations(t){return!DKTools.Utils.Array.isEmpty(this.getAnimations(t))}hasEvent(t){return this.getEventIndex(t)>=0}hasEvents(t){return!DKTools.Utils.Array.isEmpty(this.getEvents(t))}isEventsPaused(t){const e=this.getEventsContainerByType(t);return _.every(e,t=>t.isPaused())}iterateEventsContainer(t,e){const i=this.getEventsContainerByType(t);_.forEach(i,e)}pauseEvents(t,e=-1){this.iterateEventsContainer(t,t=>{t.pause(e)})}removeEvent(t){const e=this.getEventIndex(t);if(e>=0){return this.getEventsContainer(t)[e]=null,!0}return!1}resumeEvents(t){this.iterateEventsContainer(t,t=>{t.resume()})}stopEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.stop(e)})}update(){this._checkEvents()}updateEvent(t){t&&t.update()}updateEventsContainer(t){this.iterateEventsContainer(t,this.updateEvent.bind(this))}},Object.defineProperties(DKTools.EventManager,{events:{get:function(){return this._events},configurable:!0}}),DKTools.Unit=class{constructor(t){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this.setSource(t.source),this.setPercents(t.percents),this.setGetValueHandler(t.getValueHandler)}add(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.add(e):this._source+=e,this):this}clone(){return new this.constructor(this)}div(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.div(e):this._source/=e,this):this}equals(t){return!!t&&(this===t||this._source===t.source&&this._percents===t.percents)}_getValueFromUnit(t){return t instanceof DKTools.Unit?t.getValue():t}getPercents(){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const t=this._percents(this);return Number.isFinite(t)?t:100}return 100}getValue(){let t;return(t=this.hasGetValueHandler()?this._getValueHandler(this):this.getValueBase())||0}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source instanceof DKTools.Unit?this._source.getValue()*t:this._source*t}hasGetValueHandler(){return DKTools.Utils.isFunction(this._getValueHandler)}hasPercents(){return DKTools.Utils.isFunction(this._percents)||Number.isFinite(this._percents)}hasSource(){return this._source instanceof DKTools.Unit||Number.isFinite(this._source)}mul(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.mul(e):this._source*=e,this):this}setGetValueHandler(t){this._getValueHandler=t}setPercents(t=100){this._percents=t}setSource(t){this._source=t}sub(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.rem(e):this._source-=e,this):this}},Object.defineProperties(DKTools.Unit.prototype,{source:{get:function(){return this._source},configurable:!0},percents:{get:function(){return this._percents},configurable:!0},getValueHandler:{get:function(){return this._getValueHandler},configurable:!0}}),DKTools.Unit.Property=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperty(t.property)}add(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.add(s):this._source[e]+=s,this):this}div(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.div(s):this._source[e]/=s,this):this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&this._percents===t.percents&&this._property===t.property)}getValueBase(){if(!this.hasSource()||!this.hasProperty())return Number.NaN;return new DKTools.Unit({source:this._source[this._property],percents:this.getPercents()}).getValue()}hasProperty(){return!!this._property}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.mul(s):this._source[e]*=s,this):this}setProperty(t){this._property=t}sub(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.rem(s):this._source[e]-=s,this):this}},Object.defineProperties(DKTools.Unit.Property.prototype,{property:{get:function(){return this._property},configurable:!0}}),DKTools.Unit.Properties=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperties(t.properties)}add(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].add(i):this._source[e]+=i)}),this}addProperty(t){Array.isArray(this._properties)&&this._properties.push(t)}div(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].div(i):this._source[e]/=i)}),this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&_.isEqual(this._percents,t.percents)&&_.isEqual(this._properties,t.properties))}_getProperties(){let t=this._properties;return DKTools.Utils.isFunction(t)&&(t=t(this)),Array.isArray(t)?t:[]}getPercents(t){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const e=this._percents(t,this);return Number.isFinite(e)?e:100}if(this._percents instanceof Object){if(DKTools.Utils.isFunction(this._percents[t])){const e=this._percents[t](this);return Number.isFinite(e)?e:100}return Number.isFinite(this._percents[t])?this._percents[t]:100}return 100}getValue(t){return this.hasGetValueHandler()?this._getValueHandler(t,this):this.getValueBase(t)}getValueBase(t){const e=t=>{if(!this.hasSource())return Number.NaN;const e=this._source,i=this.getPercents(t);return 0===i?0:e[t]instanceof DKTools.Unit?e[t].getValue(t)*i/100:new DKTools.Unit.Property({source:e,percents:i,property:t}).getValue()};if(t)return e(t);const i=this._getProperties();return _.reduce(i,(t,i)=>(t[i]=e(i),t),{})}hasProperty(t){return this._getProperties().includes(t)}hasProperties(){return this._getProperties().length>0}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].mul(i):this._source[e]*=i)}),this}removeProperty(t){Array.isArray(this._properties)&&DKTools.Utils.Array.remove(this._properties,t)}setProperties(t){this._properties=DKTools.Utils.isFunction(t)?t:_.clone(t)}sub(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].rem(i):this._source[e]-=i)}),this}},Object.defineProperties(DKTools.Unit.Properties.prototype,{properties:{get:function(){return this._properties},configurable:!0}}),DKTools.Unit.Function=class extends DKTools.Unit{add(){return this}div(){return this}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source(this)*t}hasSource(){return DKTools.Utils.isFunction(this._source)}mul(){return this}sub(){return this}},DKTools.Base=class{constructor(){throw new Error("This is an abstract class!")}initialize(t,e,i,s){let n;t instanceof Graphics?(i=Graphics.boxWidth,s=Graphics.boxHeight):t instanceof Object?(n=t.x,e=t.y,i=t.width,s=t.height):Number.isFinite(t)&&(n=t),this.move(n,e),this.setupSize(i,s),this._clearAll(),this._createAll(),this._setupAll(),this._addAllChildren(),this.setupAll(t)}_addAllChildren(){}activate(){this.setActive(!0)&&this.updateActivateEvents()}actorName(t){const e=t>=1?$gameActors.actor(t):null;return e?e.name():""}addAllChildren(){this.updateAddAllChildrenEvents()}addAnimation(t){this._eventManager.addAnimation(t)}addEvent(t){return this._eventManager.addEvent(t)}addOneTimeEvent(t){return this._eventManager.addOneTimeEvent(t)}addOptionChangeListener(t,e){this._optionManager.addOptionChangeListener(t,e)}addFilter(t){t&&(this.filters&&this.filters.length>0?this.filters.push(t):this.filters=[t])}_clearAll(){this._clearMouseEnterTime(),this._clearWheel()}_clearMouseEnterTime(){this._mouseEnterTime=0}_clearWheel(){this._clearWheelX(),this._clearWheelY()}_clearWheelX(){this._wheelX=0}_clearWheelY(){this._wheelY=0}_createAll(){this._createOptionManager(),this._createEventManager()}_createEventManager(){this._eventManager=new DKTools.EventManager(this)}_createOptionManager(){this._optionManager=new DKTools.OptionManager}_checkHeight(t){const e=this.getMinHeight();return t?Math.max(e,t):e}_checkWidth(t){const e=this.getMinWidth();return t?Math.max(e,t):e}calcTextHeight(t,e=!1){if(!this.hasBitmap()||!t)return 0;const i=this.bitmap.fontSize,s=t.text.slice(t.index).split("\n"),n=e?s.length:1;let r=0;for(let t=0;t{e.addText(t.text,{...t.options})}),t.cloneOptions&&e.enableOptions(this._optionManager.options),t.blockStart||e.start(),t.activate&&e.activate(),e}convertEscapeCharacters(t){try{return Window_Base.prototype.convertEscapeCharacters.call(this,t)}catch(e){return t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\x1b\x1b/g,"\\")).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bN\[(\d+)\]/gi,function(){return this.actorName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bP\[(\d+)\]/gi,function(){return this.partyMemberName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bG/gi,TextManager.currencyUnit)}}createAll(){this.updateCreateAllEvents()}deactivate(){this.setActive(!1)&&this.updateDeactivateEvents()}destroy(t={}){this._clearAll(),this.clearEvents(),this.hide()}disableOption(t){this._optionManager.disableOption(t)}disableOptions(t){this._optionManager.disableOptions.apply(this._optionManager,arguments)}drawAll(){}drawArrow(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=ImageManager.loadSystem(this.standardWindowskin()),s=DKTools.Sprite.Arrow.getRect(t);return this.drawBitmap(i,{...e,source:s})}drawBitmap(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=DKTools.Utils.Bitmap.load(t);if(!i||e.sync&&!i.isReady())return!1;let s=!0;return i.addLoadListener(()=>{const t=DKTools.Utils.isFunction,n=DKTools.Utils.isString,r=this.getLineHeight(),{paintOpacity:o,resetPaintOpacity:a}=e;let{source:l,destination:h}=e,u={};t(e.callback)&&(u=e.callback(i,this)),l=l||u.source||{},h=h||u.destination||{},t(l)&&(l=l(i,this)),t(h)&&(h=h(i,this));const c=_.defaultTo(l.x,0),p=_.defaultTo(l.width,i.width);let d=_.defaultTo(l.y,0),f=_.defaultTo(l.height,i.height);const g=_.defaultTo(h.x,0),m=_.defaultTo(h.width,p);let T=_.defaultTo(h.y,0),y=_.defaultTo(h.height,f);0!==p&&0!==f&&0!==m&&0!==y?(n(d)&&(d=r*parseFloat(d)),n(f)&&(f=r*parseFloat(f)),n(T)&&(T=r*parseFloat(T)),n(y)&&(y=r*parseFloat(y)),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.blt(i,c,d,p,f,g,T,m,y),a&&this.resetPaintOpacity()):s=!1}),s}async drawBitmapAsync(t,e={}){if(!t)return!1;const i=await DKTools.Utils.Bitmap.loadAsync(t);return this.drawBitmap(i,e)}drawCharacter(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const s=ImageManager.loadCharacter(t),n=ImageManager.isBigCharacter(t),r=s.width/(n?3:12),o=s.height/(n?4:8),a=(e%4*3+1)*r,l=4*Math.floor(e/4)*o,h=new Rectangle(a,l,r,o),u=i.pos;let{x:c,y:p}=i;return u instanceof Object&&(c=u.x,p=u.y),c=c||0,p=p||0,this.drawBitmap(s,{...i,source:h,destination:{x:c,y:p}})}drawCircle(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a}=t;return 0!==i&&(e instanceof Object&&(o=e.x,a=e.y),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),Number.isFinite(n)&&this.changePaintOpacity(n),this.bitmap.drawCircle(o||0,a||0,i||1,s||"white"),r&&this.resetPaintOpacity(),!0)}drawFace(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const{pos:s,rect:n}=i;let{x:r,y:o,width:a,height:l}=i;s instanceof Object&&(r=s.x,o=s.y),n instanceof Object&&(r=n.x,o=n.y,a=n.width,l=n.height),a=a||Window_Base._faceWidth,l=l||Window_Base._faceHeight;const h=ImageManager.loadFace(t),u=Window_Base._faceWidth,c=Window_Base._faceHeight,p=Math.min(a,u),d=Math.min(l,c),f=e%4*u+(u-p)/2,g=Math.floor(e/4)*c+(c-d)/2,_=new Rectangle(f,g,p,d);return r=Math.floor((r||0)+Math.max(a-u,0)/2),o=Math.floor((o||0)+Math.max(l-c,0)/2),this.drawBitmap(h,{...i,source:_,destination:{x:r,y:o}})}drawGauge(t={}){if(!this.hasBitmap())return!1;const{pos:e,rect:i,reversed:s,gradient:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x:a,y:l,width:h,height:u,type:c,rate:p,backgroundColor:d,color:f,color1:g,color2:m}=t;if(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(a=i.x,l=i.y,h=i.width,u=i.height),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),0===h||0===u)return!1;a=a||0,l=l||0,h=h||this.standardDrawingWidth(),u=u||this.standardDrawingHeight(),d=_.defaultTo(d,"black"),f=_.defaultTo(f,"white"),g=_.defaultTo(g,f),m=_.defaultTo(m,f),c=_.defaultTo(c,"horizontal"),p=_.defaultTo(p,1);const T={x:a,y:l,width:h,height:u};if("horizontal"===c)T.width*=p,s&&(T.x+=h-T.width);else{if("vertical"!==c)return!1;T.height*=p,s&&(T.y+=u-T.height)}return Number.isFinite(r)&&this.changePaintOpacity(r),this.fillRect({x:a,y:l,width:h,height:u,color:d}),this.gradientFillRect({rect:T,color1:g,color2:m,vertical:"vertical"===n}),o&&this.resetPaintOpacity(),!0}drawIcon(t,e={}){if(!this.hasBitmap()||null==t)return!1;const i=ImageManager.loadSystem("IconSet"),s=Window_Base._iconWidth,n=Window_Base._iconHeight,r=t%16*s,o=Math.floor(t/16)*n,a=new Rectangle(r,o,s,n),l=e.pos;let{x:h,y:u}=e;return l instanceof Object&&(h=l.x,u=l.y),this.drawBitmap(i,{...e,source:a,destination:{x:h,y:u}})}drawItemName(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=Window_Base._iconWidth+4,{pos:s,iconPos:n,paintOpacity:r,resetPaintOpacity:o}=e;let{x:a,y:l,iconX:h,iconY:u}=e;return s instanceof Object&&(a=s.x,l=s.y),n instanceof Object&&(h=n.x,u=n.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),a=a||0,l=l||0,h=_.defaultTo(h,a+2),u=_.defaultTo(u,l+2),Number.isFinite(r)&&this.changePaintOpacity(r),this.drawIcon(t.iconIndex,{x:h,y:u}),this.drawText(t.name,{x:a+i,y:l,width:(e.width||312)-i,height:e.height,align:"left",font:e.font,textColor:e.textColor,resetFont:e.resetFont,resetTextColor:e.resetTextColor}),o&&this.resetPaintOpacity(),!0}drawLine(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos1:e,pos2:i,color:s,lineWidth:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x1:a,y1:l,x2:h,y2:u}=t;return 0!==n&&(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(h=i.x,u=i.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),Number.isFinite(r)&&this.changePaintOpacity(r),DKTools.Utils.Bitmap.drawLine(this.bitmap,a||0,l||0,h||0,u||0,s,n),o&&this.resetPaintOpacity(),!0)}drawPolygon(t){if(!this.hasBitmap())return!1;t=t||{};const{points:e,paintOpacity:i,resetPaintOpacity:s}=t;if(!Array.isArray(e)||0===e.length)return!1;Number.isFinite(i)&&this.changePaintOpacity(i);for(let i=0;i=24&&(this.bitmap.fontSize-=12)}move(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e);this.position.copy(i)}obtainEscapeCode(t){return Window_Base.prototype.obtainEscapeCode.call(this,t)}obtainEscapeParam(t){return Window_Base.prototype.obtainEscapeParam.call(this,t)}partyMemberName(t){const e=t>=1?$gameParty.members()[t-1]:null;return e?e.name():""}pauseEvents(t,e){this._eventManager.pauseEvents(t,e)}processAll(){this.processMouse(),this.processWheel()}processCharacter(t){Window_Base.prototype.processCharacter.call(this,t)}processDrawIcon(t,e){this.drawIcon(t,{x:e.x+2,y:e.y+2}),e.x+=Window_Base._iconWidth+4}processEscapeCharacter(t,e){try{const i={...e};Window_Base.prototype.processEscapeCharacter.call(this,t,i),Object.assign(e,i)}catch(i){switch(t){case"C":this.changeTextColor(this.getWindowskinTextColor(this.obtainEscapeParam(e)));break;case"I":this.processDrawIcon(this.obtainEscapeParam(e),e);break;case"{":this.makeFontBigger();break;case"}":this.makeFontSmaller()}}}processMouse(){this.isOptionEnabled("process-mouse")&&this.isVisible()&&(this.isActive()||this.isOptionEnabled("process-mouse-ignore-active"))?this.isMouseInside()?(0===this._mouseEnterTime&&this.updateMouseEnterEvents(),this.updateMouseInsideEvents(),TouchInput.isMouseMoved()&&this.updateMouseMoveEvents(),this._mouseEnterTime++):(this._mouseEnterTime>0&&this.updateMouseLeaveEvents(),this.updateMouseOutsideEvents(),this._clearMouseEnterTime()):this._clearMouseEnterTime()}processNewLine(t){t.width?t.width0&&(e||this.start(),i&&this.activate()),s}setActive(t){if(this.active===t)return!1;const e=this.active;return this.setupActive(t),this.active!==e}setId(t){if(this._id===t)return!1;const e=this._id;return this.setupId(t),this._id!==e}setPivot(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.pivot,i))return!1;const s=DKTools.Utils.Point.clone(this.pivot);return this.setupPivot(i),!DKTools.Utils.Point.equals(this.pivot,s)}setRotation(t){if(this.rotation===t)return!1;const e=this.rotation;return this.setupRotation(t),this.rotation!==e}setScale(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.scale,i))return!1;const s=DKTools.Utils.Point.clone(this.scale);return this.setupScale(i),!DKTools.Utils.Point.equals(this.scale,s)}setSkew(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.skew,i))return!1;const s=DKTools.Utils.Point.clone(this.skew);return this.setupSkew(i),!DKTools.Utils.Point.equals(this.skew,s)}setTint(t){if(this.tint===t)return!1;const e=this.tint;return this.setupTint(t),this.tint!==e}setVisible(t){if(this.visible===t)return!1;const e=this.visible;return this.setupVisible(t),this.visible!==e}show(t=!1){this.setVisible(!0)&&this.updateShowEvents(),t&&this.activate()}start(t=!1){this._started=!0,this.removeAllChildren(),this.terminateAll(),this.removeAll(),this.checkAll(),this.createAll(),this.startAll(),this.addAllChildren(),this.refreshAll(),this.updateStartEvents(),t&&this.activate()}startAll(){this.updateStartAllEvents()}stopEvents(t,e=!1){this._eventManager.stopEvents(t,e)}strokeArc(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,lineWidth:n,anticlockwise:r,paintOpacity:o,resetPaintOpacity:a}=t;let{x:l,y:h,startAngle:u,endAngle:c}=t;return e instanceof Object&&(l=e.x,h=e.y),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(o)&&this.changePaintOpacity(o),l=l||0,h=h||0,u=u||0,c=_.defaultTo(c,2*Math.PI),DKTools.Utils.Bitmap.strokeArc(this.bitmap,l,h,i,u,c,s,n,r),a&&this.resetPaintOpacity(),!0}strokeRect(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,rect:i,lineWidth:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a,width:l,height:h,color:u}=t;return e instanceof Object&&(o=e.x,a=pox.y),i instanceof Object&&(o=i.x,a=i.y,l=i.width,h=i.height),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(n)&&this.changePaintOpacity(n),o=o||0,a=a||0,l=l||this.standardDrawingWidth(),h=h||this.standardDrawingHeight(),u=u||"white",DKTools.Utils.Bitmap.strokeRect(this.bitmap,o,a,l,h,u,s),r&&this.resetPaintOpacity(),!0}switchOption(t){this._optionManager.switchOption(t)}switchOptions(t){this._optionManager.switchOptions.apply(this._optionManager,arguments)}terminate(){}terminateAll(){this.updateTerminateAllEvents()}textWrap(t,e={}){if(!this.hasBitmap()||""===t||null==t)return"";t=String(t),e=e||{};const i=t.split("\n"),s=e.maxWidth||this.bitmap.width,n=this.getTextWidth(" ");let r="",o=1;for(let t=0;ts){const t=i.split("");for(let e=0;el?(r+="\n"+t[e],l=s-i):(0===e&&(r+=" "),r+=t[e],l-=i)}}else{const a=h+n;if(0===t||a>l){if(t>0){if(e.maxLines===o)return r;r+="\n",o++}r+=i,l=s-h}else l-=a,r+=" "+i}}t{this[t.type](t.text,t.options)})},DKTools.Sprite.prototype.drawText=function(t,e={}){if(!this.hasBitmap()||null==t||""===t)return!1;t=String(t),e=e||{};const{pos:i,rect:s,font:n,textColor:r,paintOpacity:o,resetFont:a,resetTextColor:l,resetPaintOpacity:h}=e;let{x:u,y:c,width:p,height:d,align:f}=e;return i instanceof Object&&(u=i.x,c=i.y),s instanceof Object&&(u=s.x,c=s.y,p=s.width,d=s.height),DKTools.Utils.isString(c)&&(c=this.getLineHeight()*parseFloat(c)),DKTools.Utils.isString(d)&&(d=this.getLineHeight()*parseFloat(d)),0!==p&&0!==d&&(u=u||0,c=c||0,p=p||this.standardDrawingWidth(),d=d||this.getLineHeight(),f=f||this.align,n&&this.changeFont(n),r&&this.changeTextColor(r),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.drawText(t,u,c,p,d,f),a&&this.resetFont(),l&&this.resetTextColor(),h&&this.resetPaintOpacity(),!0)},DKTools.Sprite.prototype.findText=function(t){return _.find(this._texts,{id:t})},DKTools.Sprite.prototype._getBitmapHeight=function(){return this._bitmapHeight},DKTools.Sprite.prototype._getBitmapWidth=function(){return this._bitmapWidth},DKTools.Sprite.prototype.getCurrentOpacity=function(){return 255*this.alpha},DKTools.Sprite.prototype.getLocalPoint=function(t,e){const i=DKTools.Base.prototype.getLocalPoint.call(this,t,e),s=this.anchor;return i.x+=this.width*s.x,i.y+=this.height*s.y,i},DKTools.Sprite.prototype.hasFillColor=function(){return!!this._fillColor},DKTools.Sprite.prototype.hasFixedBitmap=function(){return!!this._fixedBitmap},DKTools.Sprite.prototype.hasGraphicFolder=function(){return!!this._graphicFolder},DKTools.Sprite.prototype.hasGraphicName=function(){return!!this._graphicName},DKTools.Sprite.prototype.hasTexts=function(){return this._texts.length>0},DKTools.Sprite.prototype.isResizable=function(){return!this.hasGraphicName()&&!this.hasFixedBitmap()},DKTools.Sprite.prototype._loadGraphic=function(){if(this.hasGraphicFolder()&&this.hasGraphicName()){const t=this._graphicFolder,e=this._graphicName,i=this._graphicLoadListener;this.loadBitmap(t,e,i),this.updateReadyEvents()}},DKTools.Sprite.prototype.loadAnimation=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/animations/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks1/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks2/",t,e,i,s)},DKTools.Sprite.prototype.loadBitmap=function(t,e,i,s,n){if(t instanceof Object)return this.loadBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth);const r=DKTools.Utils.Bitmap.load(t,e,null,s,n);return!!this.setBitmap(r)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.loadCharacter=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/characters/",t,e,i,s)},DKTools.Sprite.prototype.loadEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadFace=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/faces/",t,e,i,s)},DKTools.Sprite.prototype.loadParallax=function(t,e,i,s){return t instanceof Object?this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t.filename,t.listener,t.hue,t.smooth):this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t,e,i,s)},DKTools.Sprite.prototype.loadPicture=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/pictures/",t,e,i,s)},DKTools.Sprite.prototype.loadSvActor=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_actors/",t,e,i,s)},DKTools.Sprite.prototype.loadSvEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadSystem=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/system/",t,e,i,s)},DKTools.Sprite.prototype.loadTileset=function(t,e,i,s){return t instanceof Object?this.loadBitmap(ImageManager.TILESETS_FOLDER,t.filename,t.listener,t.hue,t.smooth):this.loadBitmap(ImageManager.TILESETS_FOLDER,t,e,i,s)},DKTools.Sprite.prototype.loadTitle1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles1/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles2/",t,e,i,s)},DKTools.Sprite.prototype.loadWindowskin=function(t,e,i,s){return t instanceof Object?this.loadSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth):this.loadSystem(t||this.standardWindowskin(),e,i,s)},DKTools.Sprite.prototype.moveWithAnchor=function(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e),s=this.anchor;this.move(i.x+this.width*s.x,i.y+this.height*s.y)},DKTools.Sprite.prototype.standardAlign=function(){return"center"},DKTools.Sprite.prototype.standardAnchor=function(){return new Point(0,0)},DKTools.Sprite.prototype.standardFillColor=function(){return null},DKTools.Sprite.prototype.standardFont=function(){return{fontFace:this.standardFontFace(),fontItalic:this.standardFontItalic(),fontSize:this.standardFontSize()}},DKTools.Sprite.prototype.standardFontFace=function(){try{return Window_Base.prototype.standardFontFace.call(this)}catch(t){return"GameFont"}},DKTools.Sprite.prototype.standardFontItalic=function(){return!1},DKTools.Sprite.prototype.standardFontSize=function(){try{return Window_Base.prototype.standardFontSize.call(this)}catch(t){return 28}},DKTools.Sprite.prototype.standardFrame=function(){return new Rectangle(0,0,this.width,this.height)},DKTools.Sprite.prototype.standardGraphicFolder=function(){return"img/system/"},DKTools.Sprite.prototype.standardGraphicName=function(){return""},DKTools.Sprite.prototype.standardOpacity=function(){return 255},DKTools.Sprite.prototype.standardPaintOpacity=function(){return 255},DKTools.Sprite.prototype.standardTextColor=function(){return"#ffffff"},DKTools.Sprite.prototype.standardMask=function(){return null},DKTools.Sprite.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t),this.setupBitmap(t),this.setupFrame(t.frame),this.setupAnchor(t.anchor),this.setupAlign(t.align),this.setupFont(t.font),this.setupTextColor(t.textColor),this.setupPaintOpacity(t.paintOpacity),this.setupFillColor(t.fillColor),this.setupOpacity(t.opacity),this.setupGraphicFolder(t.graphicFolder),this.setupGraphicName(t.graphicName)},DKTools.Sprite.prototype.setupAlign=function(t){this._align=t||this.standardAlign()},DKTools.Sprite.prototype.setupAnchor=function(t,e){const i=DKTools.Utils.Point.tryToPoint(t,e),s=Object.assign(this.standardAnchor(),i);this.anchor.copy(s)},DKTools.Sprite.prototype.setupBitmap=function(t){let e=null;t instanceof DKTools.Sprite&&t.hasFixedBitmap()&&t.canCloneFixedBitmap()?e=DKTools.Utils.Bitmap.clone(t.bitmap):t instanceof Object&&(e=DKTools.Utils.Bitmap.load(t.bitmap||t)),e?(this.bitmap=e,this.bitmap.addLoadListener(this.setupSize.bind(this))):this.bitmap=null,this._fixedBitmap=!!this.bitmap},DKTools.Sprite.prototype.setupFillColor=function(t){this._fillColor=null!==t?_.defaultTo(t,this.standardFillColor()):null},DKTools.Sprite.prototype.setupFont=function(t){this._font=Object.assign(this.standardFont(),t)},DKTools.Sprite.prototype.setupFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s),r=Object.assign(this.standardFrame(),n);Sprite.prototype.setFrame.call(this,r.x,r.y,r.width,r.height)},DKTools.Sprite.prototype.setupGraphicFolder=function(t){this._graphicFolder=_.defaultTo(t,this.standardGraphicFolder())},DKTools.Sprite.prototype.setupGraphicLoadListener=function(t){this._graphicLoadListener=t||null},DKTools.Sprite.prototype.setupGraphicName=function(t){this._graphicName=null!==t?_.defaultTo(t,this.standardGraphicName()):null},DKTools.Sprite.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this._bitmapHeight=this._checkHeight(t)},DKTools.Sprite.prototype.setupMask=function(t){this.mask=null!==t?_.defaultTo(t,this.standardMask()):null},DKTools.Sprite.prototype.setupOpacity=function(t){this._opacity=DKTools.Utils.Number.clamp(_.defaultTo(t,this.standardOpacity(),0,255))},DKTools.Sprite.prototype.setupPaintOpacity=function(t){this._paintOpacity=_.defaultTo(t,this.standardPaintOpacity())},DKTools.Sprite.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);this.setupWidth(t),this.setupHeight(e)},DKTools.Sprite.prototype.setupTextColor=function(t){this._textColor=t||this.standardTextColor()},DKTools.Sprite.prototype.setupWidth=function(t){this._bitmapWidth=this._checkWidth(t)},DKTools.Sprite.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setAlign(t.align,!0)&&s++,this.setAnchor(t.anchor)&&s++,this.setFont(t.font,!0)&&s++,this.setTextColor(t.textColor,!0)&&s++,this.setPaintOpacity(t.paintOpacity,!0)&&s++,this.setFillColor(t.fillColor,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setGraphicFolder(t.graphicFolder,!0)&&s++,this.setGraphicName(t.graphicName,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Sprite.prototype.setAlign=function(t,e=!1){if(this._align===t)return!1;const i=this._align;return this.setupAlign(t),this._align!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setAnchor=function(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.anchor,i))return!1;const s=DKTools.Utils.Point.clone(this.anchor);return this.setupAnchor(i),!DKTools.Utils.Point.equals(this.anchor,s)},DKTools.Sprite.prototype.setBitmap=function(t){return this.bitmap!==t&&(this.setupBitmap(t),!0)},DKTools.Sprite.prototype.setFillColor=function(t,e=!1){if(this._fillColor===t)return!1;const i=this._fillColor;return this.setupFillColor(t),this._fillColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setFont=function(t,e=!1){if(_.isEqual(this._font,Object.assign(this.standardFont(),t)))return!1;const i={...this._font};return this.setupFont(t),!_.isEqual(this._font,i)&&(e||this.start(),!0)},DKTools.Sprite.prototype.setFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._frame,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._frame);return this.setupFrame(n),!DKTools.Utils.Rectangle.equals(this._frame,r)},DKTools.Sprite.prototype.setGraphicFolder=function(t,e=!1){if(this._graphicFolder===t)return!1;const i=this._graphicFolder;return this.setupGraphicFolder(t),this._graphicFolder!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setGraphicName=function(t,e=!1){if(this._graphicName===t)return!1;const i=this._graphicName;return this.setupGraphicName(t),this._graphicName!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setHeight=function(t,e=!1){return this.resize(this._getBitmapWidth(),t,e)},DKTools.Sprite.prototype.setMask=function(t){return this.mask!==t&&(this.setupMask(t),!0)},DKTools.Sprite.prototype.setOpacity=function(t,e=!1){if(this._opacity===t)return!1;const i=this._opacity;return this.setupOpacity(t),this._opacity!==i&&(e||this.updateOpacity(),!0)},DKTools.Sprite.prototype.setPaintOpacity=function(t,e=!1){if(this._paintOpacity===t)return!1;const i=this._paintOpacity;return this.setupPaintOpacity(t),this._paintOpacity!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setTextColor=function(t,e=!1){if(this._textColor===t)return!1;const i=this._textColor;return this.setupTextColor(t),this._textColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setWidth=function(t,e=!1){return this.resize(t,this._getBitmapHeight(),e)},DKTools.Sprite.prototype.redrawAll=function(){this.clear(),this.drawAll(),this.updateRedrawAllEvents()},DKTools.Sprite.prototype.removeBitmap=function(){this.hasBitmap()&&this.setBitmap(null)},DKTools.Sprite.prototype.removeFillColor=function(){this.hasFillColor()&&this.setFillColor(null)},DKTools.Sprite.prototype.removeGraphicName=function(){this.hasGraphicName()&&this.setGraphicName(null)},DKTools.Sprite.prototype.removeText=function(t,e=!1){const i=this.findText(t);return i?(DKTools.Utils.Array.remove(this._texts,i),e||this.refreshAll(),i):null},DKTools.Sprite.prototype.reserveAnimation=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/animations/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBitmap=function(t,e,i,s,n,r){if(t instanceof Object)return this.reserveBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);const o=DKTools.Utils.Bitmap.reserve(t,e,null,s,n,r);return!!this.setBitmap(o)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.reserveCharacter=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/characters/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveFace=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/faces/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveParallax=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t,e,i,s,n)},DKTools.Sprite.prototype.reservePicture=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/pictures/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvActor=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_actors/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSystem=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/system/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTileset=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap(ImageManager.TILESETS_FOLDER,t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap(ImageManager.TILESETS_FOLDER,t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveWindowskin=function(t,e,i,s,n){return t instanceof Object?this.reserveSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth,t.reservationId):this.reserveSystem(t||this.standardWindowskin(),e,i,s,n)},DKTools.Sprite.prototype.resetAll=function(){this.resetFont(),this.resetPaintOpacity(),this.resetTextColor()},DKTools.Sprite.prototype.resetFont=function(){this.changeFont(this.font)},DKTools.Sprite.prototype.resetPaintOpacity=function(){this.changePaintOpacity(this.paintOpacity)},DKTools.Sprite.prototype.resetTextColor=function(){this.changeTextColor(this.textColor)},DKTools.Sprite.prototype.resize=function(t,e,i=!1,s=!1){if(!this.isResizable())return!1;if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._bitmapWidth===t&&this._bitmapHeight===e)return!1;const n=this._bitmapWidth,r=this._bitmapHeight;return this.setupSize(t,e),(this._bitmapWidth!==n||this._bitmapHeight!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Sprite.prototype.rotateHue=function(t){return!(!this.hasBitmap()||!t)&&(this.bitmap.rotateHue(t),!0)},DKTools.Sprite.prototype.updateAll=function(){DKTools.Base.prototype.updateAll.call(this),this.updateBitmap()},DKTools.Sprite.prototype.updateBitmap=function(){this.hasBitmap()&&(this.updateFont(),this.updatePaintOpacity(),this.updateTextColor())},DKTools.Sprite.prototype.updateDrawAllEvents=function(){this.updateEventsContainer("draw-all")},DKTools.Sprite.prototype.updateFill=function(){this.hasFillColor()&&this.fillAll(this.fillColor)},DKTools.Sprite.prototype.updateFont=function(t={}){t=t||{},this.bitmap.fontFace=t.fontFace||this.font.fontFace,this.bitmap.fontItalic=!!t.fontItalic,this.bitmap.fontSize=t.fontSize||this.font.fontSize},DKTools.Sprite.prototype.updatePaintOpacity=function(t){Number.isFinite(t)||(t=this.paintOpacity),this.bitmap.paintOpacity=t},DKTools.Sprite.prototype.updateTextColor=function(t){this.bitmap.textColor=t||this.textColor},DKTools.Sprite.prototype.updateOpacity=function(t){Number.isFinite(t)||(t=this.opacity),this.alpha=DKTools.Utils.Number.clamp(t,0,255)/255},DKTools.Sprite.Button=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearMousePressTime()}_clearMousePressTime(){this._mousePressTime=0}isPressed(){return this._mousePressTime>0&&!this.isLongPressed()}isLongPressed(){return this._mousePressTime>=this._longPressInterval}_setupEvents(){DKTools.Sprite.prototype._setupEvents.call(this),this._setupUpdateButtonStateEvent()}_setupOptions(){DKTools.Sprite.prototype._setupOptions.call(this),this._setupProcessMouseOption()}_setupUpdateButtonStateEvent(){this.addEvent({type:"update",onUpdate:this.updateButtonState.bind(this)})}_setupProcessMouseOption(){this.enableOption("process-mouse")}standardActive(){return!1}standardLongPressInterval(){return 18}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupLongPressInterval(t.longPressInterval)}setupLongPressInterval(t){this._longPressInterval=t||this.standardLongPressInterval()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setLongPressInterval(t.longPressInterval)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLongPressInterval(t){if(this._longPressInterval===t)return!1;const e=this._longPressInterval;return this.setupLongPressInterval(t),this._longPressInterval!==e}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processMousePress()}processMousePress(){if(this.isVisible()&&this.isMouseInside()&&(this.isActive()||this.isOptionEnabled("process-mouse-press-ignore-active")))if(TouchInput.isMousePressed()){let t;this._mousePressTime++,TouchInput.isLeftButtonPressed()?t="left":TouchInput.isMiddleButtonPressed()?t="middle":TouchInput.isRightButtonPressed()&&(t="right"),t&&(this.updateMouseDownEvents(t),this.isLongPressed()&&(this._mousePressTime===this._longPressInterval&&this.updateMouseLongPressStartedEvents(t),this.updateMouseLongPressEvents(t)))}else{let t;TouchInput.isLeftButtonReleased()?t="left":TouchInput.isMiddleButtonReleased()?t="middle":TouchInput.isRightButtonReleased()&&(t="right"),t&&(this.isLongPressed()?this.updateMouseLongPressFinishedEvents(t):this.isPressed()&&this.updateMouseClickEvents(t),this._mousePressTime>0&&this.updateMouseUpEvents(t)),this._clearMousePressTime()}else this._clearMousePressTime()}updateMouseDownEvents(t){this.updateEventsContainer("mouse-down-"+t)}updateMouseUpEvents(t){this.updateEventsContainer("mouse-up-"+t)}updateMouseClickEvents(t){this.updateEventsContainer("mouse-click-"+t)}updateMouseLongPressEvents(t){this.updateEventsContainer("mouse-long-press-"+t)}updateMouseLongPressStartedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-started`)}updateMouseLongPressFinishedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-finished`)}updateStateNormalEvents(){this.updateEventsContainer("state-normal")}updateStatePressedEvents(){this.updateEventsContainer("state-pressed")}updateButtonState(){this._mousePressTime>0?this.updateStatePressedEvents():this.updateStateNormalEvents()}},Object.defineProperties(DKTools.Sprite.Button.prototype,{longPressInterval:{get:function(){return this._longPressInterval},configurable:!0},mousePressTime:{get:function(){return this._mousePressTime},configurable:!0}}),DKTools.Sprite.Cursor=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearAnimationCount()}_clearAnimationCount(){this._animationCount=0}_createAll(){DKTools.Sprite.prototype._createAll.call(this),this._createWindowskin()}_createWindowskin(){this._windowskin=ImageManager.loadSystem(this.standardWindowskin())}refreshAll(){DKTools.Sprite.prototype.refreshAll.call(this),this.refreshCursor()}refreshCursor(){const t=this._cursorRect.x,e=this._cursorRect.y,i=this._cursorRect.width,s=this._cursorRect.height,n=this.parent,r=Math.min(i,n.width-t),o=Math.min(s,n.height-e);if(this.move(t,e),i>0&&s>0){const t=this._windowskin,e=new Bitmap(r,o),n=96,a=48;e.blt(t,n+4,n+4,a-8,a-8,4,4,i-8,s-8),e.blt(t,n+4,n,a-8,4,4,0,i-8,4),e.blt(t,n+4,n+a-4,a-8,4,4,0+s-4,i-8,4),e.blt(t,n,n+4,4,a-8,0,4,4,s-8),e.blt(t,n+a-4,n+4,4,a-8,0+i-4,4,4,s-8),e.blt(t,n,n,4,4,0,0,4,4),e.blt(t,n+a-4,n,4,4,0+i-4,0,4,4),e.blt(t,n,n+a-4,4,4,0,0+s-4,4,4),e.blt(t,n+a-4,n+a-4,4,4,0+i-4,0+s-4,4,4),this.setupBitmap(e)}}standardBlinkSpeed(){return 8}standardCursorRect(){return new Rectangle(0,0,0,0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupBlinkSpeed(t.blinkSpeed),this.setupCursorRect(t.cursorRect)}setupBlinkSpeed(t){this._blinkSpeed=_.defaultTo(t,this.standardBlinkSpeed())}setupCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s);this._cursorRect=Object.assign(this.standardCursorRect(),n)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setBlinkSpeed(t.blinkSpeed)&&s++,this.setCursorRect(t.cursorRect)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBlinkSpeed(t){if(this._blinkSpeed===t)return!1;const e=this._blinkSpeed;return this.setupBlinkSpeed(t),this._blinkSpeed!==e}setCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._cursorRect,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._cursorRect);return this.setupCursorRect(n),!DKTools.Utils.Rectangle.equals(this._cursorRect,r)&&(this.refreshCursor(),!0)}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processCursorAnimation()}processCursorAnimation(){const t=this._animationCount%40;let e=this.parent.getCurrentOpacity();this.parent.isVisibleAndActive()&&(this._animationCount++,e-=t<20?t*this._blinkSpeed:(40-t)*this._blinkSpeed),this.setOpacity(e)}},Object.defineProperties(DKTools.Sprite.Cursor.prototype,{cursorRect:{get:function(){return this._cursorRect},configurable:!0},blinkSpeed:{get:function(){return this._blinkSpeed},configurable:!0}}),DKTools.Sprite.Arrow=class extends DKTools.Sprite.Button{static getRect(t){const e=24,i=12;let s,n,r,o;switch(t){case"up":s=132,n=24,r=e,o=i;break;case"down":s=132,n=60,r=e,o=i;break;case"left":s=120,n=36,r=i,o=e;break;case"right":s=156,n=36,r=i,o=e}return DKTools.Utils.Rectangle.tryToRectangle(s,n,r,o)}refreshAll(){DKTools.Sprite.Button.prototype.refreshAll.call(this),this.refreshArrow()}refreshArrow(){this.setFrame(DKTools.Sprite.Arrow.getRect(this._arrowType))}standardVisible(){return!1}standardGraphicName(){return this.standardWindowskin()}standardAnchor(){return new Point(.5,.5)}standardArrowType(){return null}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupArrowType(t.arrowType)}setupArrowType(t){this._arrowType=t||this.standardArrowType()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setArrowType(t.arrowType,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setArrowType(t,e=!1){if(this._arrowType===t)return!1;const i=this._arrowType;return this.setupArrowType(t),this._arrowType!==i&&(e||this.refreshAll(),!0)}},Object.defineProperties(DKTools.Sprite.Arrow.prototype,{arrowType:{get:function(){return this._arrowType},configurable:!0}}),DKTools.Sprite.Selectable=class extends DKTools.Sprite.Button{_addAllChildren(){DKTools.Sprite.Button.prototype._addAllChildren.call(this),this._addCursorSprite()}_addCursorSprite(){this.addChild(this._cursorSprite)}activate(){DKTools.Sprite.Button.prototype.activate.call(this),this.reselect()}addItem(t,e=!1){const i=this.insertItem(t,this.getMaxItems()-1,!0);return e||this.refreshAll(),i}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return e||this.refreshAll(),i}_clearAll(){DKTools.Sprite.Button.prototype._clearAll.call(this),this._clearItems(),this._clearHandlers(),this._clearTopRow(),this._clearTopCol()}_clearItems(){this._items=[]}_clearHandlers(){this._handlers={}}_clearTopRow(){this._topRow=0}_clearTopCol(){this._topCol=0}_createAll(){DKTools.Sprite.Button.prototype._createAll.call(this),this._createCursorSprite()}_createCursorSprite(){this._cursorSprite=new DKTools.Sprite.Cursor}_checkItem(t){return void 0===t.enabled&&(t.enabled=!0),void 0===t.ext&&(t.ext=null),t.symbol&&DKTools.Utils.isFunction(t.handler)&&this.setHandler(t.symbol,t.handler),t}callHandler(t){this.isHandled(t)&&this._handlers[t](this._index,this)}callOkHandler(){const t=this.getCurrentItemSymbol();this.isHandled(t)?this.callHandler(t):this.isHandled("ok")?this.callHandler("ok"):this.activate()}callCancelHandler(){this.callHandler("cancel")}clearItem(t){this.clearRect(this.getItemRect(t))}cursorDown(t=!1){this.hasCursorDownHandler()&&this._cursorDownHandler(t,this)}cursorUp(t=!1){this.hasCursorUpHandler()&&this._cursorUpHandler(t,this)}cursorRight(t=!1){this.hasCursorRightHandler()&&this._cursorRightHandler(t,this)}cursorLeft(t=!1){this.hasCursorLeftHandler()&&this._cursorLeftHandler(t,this)}cursorPageDown(){this.hasCursorPageDownHandler()&&this._cursorPageDownHandler(this)}cursorPageUp(){this.hasCursorPageUpHandler()&&this._cursorPageUpHandler(this)}deactivate(t=!1){DKTools.Sprite.Button.prototype.deactivate.call(this),t&&this.deselect()}deselect(){this.selectItem(-1)}disableItem(t,e=!1){(this.getItem(t)||{}).enabled=!1,e||this.refreshAll()}drawAll(){DKTools.Sprite.Button.prototype.drawAll.call(this),this.drawAllItems()}drawAllItems(){const t=this.getMaxPageItems(),e=this.getMaxItems();let i=this.getTopIndex();for(let s=0;s0?this._index-1:t?this.getMaxItems()-1:-1}getNextIndex(t=!1){return this._index0}hasSymbol(t){return _.includes(this._items,{symbol:t})}hasExt(t){return _.includes(this._items,{ext:t})}hasCursorDownHandler(){return!!this._cursorDownHandler}hasCursorUpHandler(){return!!this._cursorUpHandler}hasCursorRightHandler(){return!!this._cursorRightHandler}hasCursorLeftHandler(){return!!this._cursorLeftHandler}hasCursorPageDownHandler(){return!!this._cursorPageDownHandler}hasCursorPageUpHandler(){return!!this._cursorPageUpHandler}hasDrawItemHandler(){return!!this._itemDrawHandler}hideCursor(){this._cursorSprite.hide()}hitTest(t,e){if(this.isOutside(t,e))return-1;const i=this.scale,s=this.getLocalPoint(t,e),n=this.getMaxPageItems(),r=this.getMaxItems();let o=this.getTopIndex();for(let t=0;tthis.insertItem(t,e+i,!0));return i||this.refreshAll(),s}isCursorFixed(){return this._cursorFixed}isCursorAll(){return this._cursorAll}isFixedHorizontal(){return this._fixedHorizontal}isHorizontal(){return this.isFixedHorizontal()||1===this.getMaxPageRows()}isVertical(){return!this.isHorizontal()}isCursorMovable(){return this.isVisibleAndActive()&&!this.isCursorFixed()&&!this.isCursorAll()&&this.hasItems()}isOkEnabled(){return!0}isCancelEnabled(){return this.isHandled("cancel")}isOkTriggered(){return Input.isRepeated("ok")}isCancelTriggered(){return Input.isRepeated("cancel")||TouchInput.isCancelled()}isCursorVisible(){if(!this._cursorSprite.isVisible())return!1;if(this.isHorizontal()){const t=this.getCurrentCol();return t>=this.getTopCol()&&t<=this.getBottomCol()}const t=this.getCurrentRow();return t>=this.getTopRow()&&t<=this.getBottomRow()}isItemEnabled(t){const e=(this.getItem(t)||{}).enabled;return DKTools.Utils.isFunction(e)?e(t,this):e}isCurrentItemEnabled(){return this.isItemEnabled(this._index)}isItemVisible(t){return DKTools.Utils.Number.inRange(t,this.getTopIndex(),this.getBottomIndex()+1)}isItemSelected(t){return this._index===t}isHandled(t){return!!this._handlers[t]}isItemHandled(t){const e=this.getItem(t)||{};return this.isHandled(e.symbol)||DKTools.Utils.isFunction(e.okHandler)}isCurrentItemHandled(){return this.isItemHandled(this._index)}_onTouch(t=!1){const e=this._index,i=TouchInput.x,s=TouchInput.y,n=this.hitTest(i,s);n>=0&&(this._index===n?t&&this.isOkEnabled()&&this.processOk():this.isCursorMovable()&&this.selectItem(n)),this._index!==e&&this.playCursorSound()}playOkSound(){SoundManager.playOk()}playCancelSound(){SoundManager.playCancel()}playCursorSound(){SoundManager.playCursor()}playBuzzerSound(){SoundManager.playBuzzer()}processAll(){DKTools.Sprite.Button.prototype.processAll.call(this),this.processCursorMove(),this.processHandling()}processCursorMove(){if(!this.isCursorMovable())return;const t=this._index;Input.isRepeated("down")&&this.cursorDown(Input.isTriggered("down")),Input.isRepeated("up")&&this.cursorUp(Input.isTriggered("up")),Input.isRepeated("right")&&this.cursorRight(Input.isTriggered("right")),Input.isRepeated("left")&&this.cursorLeft(Input.isTriggered("left")),Input.isTriggered("pagedown")&&this.cursorPageDown(),Input.isTriggered("pageup")&&this.cursorPageUp(),this._index!==t&&this.playCursorSound()}processHandling(){this.isVisibleAndActive()&&(this.isOkEnabled()&&this.isOkTriggered()?this.processOk():this.isCancelEnabled()&&this.isCancelTriggered()&&this.processCancel())}processMouseHover(){if(this.isOptionEnabled("process-mouse-hover")&&this.isCursorMovable()&&TouchInput.date>Input.date){const t=this._index,e=TouchInput.mouseX,i=TouchInput.mouseY,s=this.hitTest(e,i);s>=0&&s!==t&&this.selectItem(s,!0)}}processWheelScroll(){if(this.isOptionEnabled("process-wheel-scroll")&&this.isVisibleAndActive()){this._wheelY>0?this.isHorizontal()?this.scrollRight():this.scrollDown():this.isHorizontal()?this.scrollLeft():this.scrollUp()}}processOk(){if(this.isCurrentItemEnabled()){this.playOkSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem()||{};DKTools.Utils.isFunction(t.okHandler)?t.okHandler(this._index,this):this.callOkHandler()}else this.playBuzzerSound()}processCancel(){this.playCancelSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem();t&&DKTools.Utils.isFunction(t.cancelHandler)?t.cancelHandler(this._index,this):this.callCancelHandler()}redrawItem(t){this.isItemVisible(t)&&(this.clearItem(t),this.drawItem(t))}redrawCurrentItem(){this.redrawItem(this._index)}removeHandler(t){delete this._handlers[t]}removeItem(t,e=!1){const i=this.getItem(t);return i?(DKTools.Utils.Array.remove(this._items,i),e||this.refreshAll(),i):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return e||this.refreshAll(),i}replaceItem(t,e,i=!1){const s=this._checkItem(t);e=e||0;const n=this._items[e];return this._items[e]=s,i||this.refreshAll(),n}reselect(){this.selectItem(this._index)}resetScroll(){0!==this._index&&this.selectItem(0)}_setupEvents(){DKTools.Sprite.Button.prototype._setupEvents.call(this),this._setupMouseClickEvent(),this._setupMouseLongPressEvent(),this._setupMouseHoverEvents(),this._setupWheelScrollEvents()}_setupMouseClickEvent(){this.addEvent({type:"mouse-click-left",onUpdate:this._onTouch.bind(this,!0)})}_setupMouseLongPressEvent(){this.addEvent({type:"mouse-long-press-left",onUpdate:this._onTouch.bind(this,!1)})}_setupMouseHoverEvents(){this.addEvent({type:"mouse-enter",onUpdate:this.processMouseHover.bind(this)}),this.addEvent({type:"mouse-move",onUpdate:this.processMouseHover.bind(this)})}_setupWheelScrollEvents(){this.addEvent({type:"wheel-Y-inside",onUpdate:this.processWheelScroll.bind(this)}),this.addEvent({type:"wheel-Y-outside",onUpdate:this.processWheelScroll.bind(this)})}standardIndex(){return 0}standardMaxCols(){return 1}standardCursorFixed(){return!1}standardCursorAll(){return!1}standardFixedHorizontal(){return!1}standardHorizontalSpacing(){return 0}standardVerticalSpacing(){return 0}standardTextPadding(){return 6}standardCursorDownHandler(){return t=>{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e>=s||t&&i===this.getMaxRows()*s)&&this.selectItem((e-s+i)%i)}}standardCursorRightHandler(){return t=>{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i>0||t)&&this.selectItem((i-1+e)%e)}else this.selectPrevItem(t)}}standardCursorPageDownHandler(){return()=>{if(this.isHorizontal()){const t=this.getTopCol(),e=this.getMaxPageCols(),i=this.getMaxItems();t+e{if(this.isHorizontal()){const t=this.getTopCol();t>0&&(this.setTopCol(t-this.getMaxPageCols()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}else{const t=this.getTopRow();t>0&&(this.setTopRow(t-this.getMaxPageRows()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}}}standardItems(){return[]}standardItemDrawHandler(){return t=>{const e=this.getItemName(t),i=this.getItemFont(t),s=this.getItemTextColor(t),n=this.getItemPaintOpacity(t),r=this.getItemAlign(t),o=this.getItemRectForText(t);this.drawText(e,{font:i,textColor:s,paintOpacity:n,align:r,rect:o,resetFont:!0,resetTextColor:!0,resetPaintOpacity:!0})}}standardItemWidth(){return()=>Math.floor((this.width+this._horizontalSpacing)/this.getMaxCols()-this._horizontalSpacing)}standardItemHeight(){return this.getLineHeight()}standardItemRect(){return t=>{const e=new Rectangle(0,0,this.getItemWidth(),this.getItemHeight()),i=this.getMaxCols();return this.isHorizontal()?(e.x=(t-this.getTopCol())*(e.width+this._horizontalSpacing),e.y=0):(e.x=t%i*(e.width+this._horizontalSpacing),e.y=(Math.floor(t/i)-this.getTopRow())*(e.height+this._verticalSpacing)),e}}standardItemFont(){return()=>this.font}standardItemTextColor(){return()=>this.textColor}standardItemPaintOpacity(){return t=>this.isItemEnabled(t)?this.standardEnabledItemPaintOpacity():this.standardDisabledItemPaintOpacity()}standardEnabledItemPaintOpacity(){return 255}standardDisabledItemPaintOpacity(){try{return Window_Base.prototype.translucentOpacity.call(this)}catch(t){return 160}}standardItemAlign(){return this.align}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupIndex(t.index),this.setupMaxCols(t.maxCols),this.setupFixedHorizontal(t.fixedHorizontal),this.setupCursorFixed(t.cursorFixed),this.setupCursorAll(t.cursorAll),this.setupCursorDownHandler(t.cursorDownHandler),this.setupCursorUpHandler(t.cursorUpHandler),this.setupCursorRightHandler(t.cursorRightHandler),this.setupCursorLeftHandler(t.cursorLeftHandler),this.setupCursorPageDownHandler(t.cursorPageDownHandler),this.setupCursorPageUpHandler(t.cursorPageUpHandler),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupTextPadding(t.textPadding),this.setupItems(t.items),this.setupItemDrawHandler(t.drawItemHandler),this.setupItemWidth(t.itemWidth),this.setupItemHeight(t.itemHeight),this.setupItemRect(t.itemRect),this.setupItemFont(t.itemFont),this.setupItemTextColor(t.itemTextColor),this.setupItemPaintOpacity(t.itemPaintOpacity),this.setupItemAlign(t.itemAlign)}setupIndex(t){this._lastIndex=this._index,this._index=_.defaultTo(t,this.standardIndex())}setupMaxCols(t){this._maxCols=t||this.standardMaxCols()}setupFixedHorizontal(t){this._fixedHorizontal=_.defaultTo(t,this.standardFixedHorizontal())}setupCursorFixed(t){this._cursorFixed=_.defaultTo(t,this.standardCursorFixed())}setupCursorAll(t){this._cursorAll=_.defaultTo(t,this.standardCursorAll())}setupCursorDownHandler(t){this._cursorDownHandler=t||this.standardCursorDownHandler()}setupCursorUpHandler(t){this._cursorUpHandler=t||this.standardCursorUpHandler()}setupCursorRightHandler(t){this._cursorRightHandler=t||this.standardCursorRightHandler()}setupCursorLeftHandler(t){this._cursorLeftHandler=t||this.standardCursorLeftHandler()}setupCursorPageDownHandler(t){this._cursorPageDownHandler=t||this.standardCursorPageDownHandler()}setupCursorPageUpHandler(t){this._cursorPageUpHandler=t||this.standardCursorPageUpHandler()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupTextPadding(t){this._textPadding=_.defaultTo(t,this.standardTextPadding())}setupItems(t){this._items=_.map(t||this.standardItems(),t=>this._checkItem(t))}setupItemDrawHandler(t){this._itemDrawHandler=t||this.standardItemDrawHandler()}setupItemWidth(t){this._itemWidth=t||this.standardItemWidth()}setupItemHeight(t){this._itemHeight=t||this.standardItemHeight()}setupItemRect(t){this._itemRect=t||this.standardItemRect()}setupItemFont(t){this._itemFont=t||this.standardItemFont()}setupItemTextColor(t){this._itemTextColor=t||this.standardItemTextColor()}setupItemPaintOpacity(t){this._itemPaintOpacity=t||this.standardItemPaintOpacity()}setupItemAlign(t){this._itemAlign=t||this.standardItemAlign()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setIndex(t.index,!0)&&s++,this.setMaxCols(t.maxCols,!0)&&s++,this.setFixedHorizontal(t.fixedHorizontal,!0)&&s++,this.setCursorFixed(t.cursorFixed,!0)&&s++,this.setCursorAll(t.cursorAll,!0)&&s++,this.setCursorDownHandler(t.cursorDownHandler,!0)&&s++,this.setCursorUpHandler(t.cursorUpHandler,!0)&&s++,this.setCursorRightHandler(t.cursorRightHandler,!0)&&s++,this.setCursorLeftHandler(t.cursorLeftHandler,!0)&&s++,this.setCursorPageDownHandler(t.cursorPageDownHandler,!0)&&s++,this.setCursorPageUpHandler(t.cursorPageUpHandler,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setTextPadding(t.textPadding,!0)&&s++,this.setItems(t.items,!0)&&s++,this.setItemDrawHandler(t.drawItemHandler,!0)&&s++,this.setItemWidth(t.itemWidth,!0)&&s++,this.setItemHeight(t.itemHeight,!0)&&s++,this.setItemRect(t.itemRect,!0)&&s++,this.setItemFont(t.itemFont,!0)&&s++,this.setItemTextColor(t.itemTextColor,!0)&&s++,this.setItemPaintOpacity(t.itemPaintOpacity,!0)&&s++,this.setItemAlign(t.itemAlign,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setIndex(t,e=!1){return this._index!==t&&(this.setupIndex(t),this._index!==this._lastIndex&&(e||this.refreshAll(),!0))}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.refreshAll(),!0)}setFixedHorizontal(t,e=!1){if(this._fixedHorizontal===t)return!1;const i=this._fixedHorizontal;return this.setupFixedHorizontal(t),this._fixedHorizontal!==i&&(e||this.refreshAll(),!0)}setCursorFixed(t,e=!1){if(this._cursorFixed===t)return!1;const i=this._cursorFixed;return this.setupCursorFixed(t),this._cursorFixed!==i&&(e||this.refreshAll(),!0)}setCursorAll(t,e=!1){if(this._cursorAll===t)return!1;const i=this._cursorAll;return this.setupCursorAll(t),this._cursorAll!==i&&(e||this.refreshAll(),!0)}setCursorDownHandler(t,e=!1){if(this._cursorDownHandler===t)return!1;const i=this._cursorDownHandler;return this.setupCursorDownHandler(t),this._cursorDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorUpHandler(t,e=!1){if(this._cursorUpHandler===t)return!1;const i=this._cursorUpHandler;return this.setupCursorUpHandler(t),this._cursorUpHandler!==i&&(e||this.refreshAll(),!0)}setCursorRightHandler(t,e=!1){if(this._cursorRightHandler===t)return!1;const i=this._cursorRightHandler;return this.setupCursorRightHandler(t),this._cursorRightHandler!==i&&(e||this.refreshAll(),!0)}setCursorLeftHandler(t,e=!1){if(this._cursorLeftHandler===t)return!1;const i=this._cursorLeftHandler;return this.setupCursorLeftHandler(t),this._cursorLeftHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageDownHandler(t,e=!1){if(this._cursorPageDownHandler===t)return!1;const i=this._cursorPageDownHandler;return this.setupCursorPageDownHandler(t),this._cursorPageDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageUpHandler(t,e=!1){if(this._cursorPageUpHandler===t)return!1;const i=this._cursorPageUpHandler;return this.setupCursorPageUpHandler(t),this._cursorPageUpHandler!==i&&(e||this.refreshAll(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.refreshAll(),!0)}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.refreshAll(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.refreshAll(),s}setTextPadding(t,e=!1){if(this._textPadding===t)return!1;const i=this._textPadding;return this.setupTextPadding(t),this._textPadding!==i&&(e||this.refreshAll(),!0)}setItems(t,e=!1){return this._items!=t&&(this.setupItems(t),e||this.refreshAll(),!0)}setItemDrawHandler(t,e=!1){if(this._itemDrawHandler===t)return!1;const i=this._itemDrawHandler;return this.setupItemDrawHandler(t),this._itemDrawHandler!==i&&(e||this.refreshAll(),!0)}setItemWidth(t,e=!1){if(this._itemWidth===t)return!1;const i=this._itemWidth;return this.setupItemWidth(t),this._itemWidth!==i&&(e||this.refreshAll(),!0)}setItemHeight(t,e=!1){if(this._itemHeight===t)return!1;const i=this._itemHeight;return this.setupItemHeight(t),this._itemHeight!==i&&(e||this.refreshAll(),!0)}setItemFont(t,e=!1){if(this._itemFont===t)return!1;const i=this._itemFont;return this.setupItemFont(t),this._itemFont!==i&&(e||this.refreshAll(),!0)}setItemTextColor(t,e=!1){if(this._itemTextColor===t)return!1;const i=this._itemTextColor;return this.setupItemTextColor(t),this._itemTextColor!==i&&(e||this.refreshAll(),!0)}setItemPaintOpacity(t,e=!1){if(this._itemPaintOpacity===t)return!1;const i=this._itemPaintOpacity;return this.setupItemPaintOpacity(t),this._itemPaintOpacity!==i&&(e||this.refreshAll(),!0)}setItemAlign(t,e=!1){if(this._itemAlign===t)return!1;const i=this._itemAlign;return this.setupItemAlign(t),this._itemAlign!==i&&(e||this.refreshAll(),!0)}setTopRow(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopRow());this._topRow!==i&&(this._topRow=i,e||this.refreshAll())}setTopCol(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopCol());this._topCol!==i&&(this._topCol=i,e||this.refreshAll())}setBottomRow(t,e=!1){this.setTopRow(t-(this.getMaxPageRows()-1),e)}setBottomCol(t,e=!1){this.setTopCol(t-(this.getMaxPageCols()-1),e)}setHandler(t,e){this._handlers[t]=e}setCursorRect(t,e,i,s){return this._cursorSprite.setCursorRect(t,e,i,s)}showCursor(){this._cursorSprite.show(!0)}selectItem(t,e=!1){const i=this.getItem(t);this.setupIndex(t),this.refreshAll(),e&&this.playCursorSound(),i&&DKTools.Utils.isFunction(i.selectHandler)&&i.selectHandler(t,this),this.updateSelectEvents()}selectSymbol(t){const e=Math.max(0,this.findSymbol(t));this.selectItem(e)}selectExt(t){const e=Math.max(0,this.findExt(t));this.selectItem(e)}selectPrevItem(t=!1,e=!1){const i=this.getPrevIndex(t);i>=0&&this.selectItem(i,e)}selectNextItem(t=!1,e=!1){const i=this.getNextIndex(t);i>=0&&this.selectItem(i,e)}selectLastItem(t=!1){this.selectItem(this.getMaxItems()-1,t)}scrollDown(){this.getTopRow()+10&&this.cursorUp()}scrollRight(){this.getTopCol()+10&&this.cursorLeft()}updateAll(){DKTools.Sprite.Button.prototype.updateAll.call(this),this.updateCursor()}updateCursor(){if(this.isHorizontal()){const t=this.getCurrentCol();tthis.getBottomCol()&&this.setBottomCol(t)}else{const t=this.getCurrentRow();tthis.getBottomRow()&&this.setBottomRow(t)}if(this.isCursorAll()){const t=this.getMaxRows()*this.getItemHeight();this.setCursorRect(0,0,this.width,t),this.resetScroll()}else if(this.isCursorVisible()||!this._cursorSprite.hasBitmap()){const t=this.getItemRect(this._index);this.setCursorRect(t)}else this.setCursorRect(Rectangle.emptyRectangle)}updateSelectEvents(){this.updateEventsContainer("select")}},Object.defineProperties(DKTools.Sprite.Selectable.prototype,{cursorSprite:{get:function(){return this._cursorSprite},configurable:!0},lastIndex:{get:function(){return this._lastIndex},configurable:!0},index:{get:function(){return this._index},configurable:!0},maxCols:{get:function(){return this._maxCols},configurable:!0},cursorFixed:{get:function(){return this._cursorFixed},configurable:!0},cursorAll:{get:function(){return this._cursorAll},configurable:!0},cursorDownHandler:{get:function(){return this._cursorDownHandler},configurable:!0},cursorUpHandler:{get:function(){return this._cursorUpHandler},configurable:!0},cursorRightHandler:{get:function(){return this._cursorRightHandler},configurable:!0},cursorLeftHandler:{get:function(){return this._cursorLeftHandler},configurable:!0},cursorPageDownHandler:{get:function(){return this._cursorPageDownHandler},configurable:!0},cursorPageUpHandler:{get:function(){return this._cursorPageUpHandler},configurable:!0},horizontalSpacing:{get:function(){return this._horizontalSpacing},configurable:!0},verticalSpacing:{get:function(){return this._verticalSpacing},configurable:!0},textPadding:{get:function(){return this._textPadding},configurable:!0},items:{get:function(){return this._items},configurable:!0},itemDrawHandler:{get:function(){return this._itemDrawHandler},configurable:!0},itemWidth:{get:function(){return this._itemWidth},configurable:!0},itemHeight:{get:function(){return this._itemHeight},configurable:!0},itemFont:{get:function(){return this._itemFont},configurable:!0},itemTextColor:{get:function(){return this._itemTextColor},configurable:!0},itemPaintOpacity:{get:function(){return this._itemPaintOpacity},configurable:!0},itemAlign:{get:function(){return this._itemAlign},configurable:!0}}),DKTools.Sprite.ProgressBar=class extends DKTools.Sprite{addValue(t){t&&this.setValue(this._value+t)}aimateFull(t){return this.animateValue(this._maxValue,t)}animateEmpty(t){return this.animateValue(0,t)}animateValue(t,e){return this.addEvent({type:"update",repeatTime:e,repeats:0,onUpdate:this._updateAnimateValue.bind(this,t)})}canCloneFixedBitmap(){return!1}_drawProgressGraphic(){this.hasDrawGraphicHandler()&&this._drawGraphicHandler(this)}_drawProgressText(){this.hasDrawTextHandler()&&this._drawTextHandler(this)}drawAll(){DKTools.Sprite.prototype.drawAll.call(this),this.drawProgress()}drawProgress(){this._drawProgressGraphic(),this._drawProgressText()}getNextValue(){return Math.min(this._value+this._valueStep,this._maxValue)}getPercents(){return Math.ceil(this._value/this._maxValue*100)}getPrevValue(){return Math.max(0,this._value-this._valueStep)}hasDrawGraphicHandler(){return!!this._drawGraphicHandler}hasDrawTextHandler(){return!!this._drawTextHandler}isEmpty(){return 0===this._value}isFull(){return this._value===this._maxValue}isHorizontal(){return this.width>this.height}isVertical(){return!this.isHorizontal()}makeEmpty(){this.setValue(0)}makeFull(){this.setValue(this._maxValue)}nextValue(){return this.setValue(this.getNextValue())}prevValue(){return this.setValue(this.getPrevValue())}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setValueStep(t.valueStep,!0)&&s++,this.setMaxValue(t.maxValue,!0)&&s++,this.setValue(t.value,!0)&&s++,this.setBackgroundColor(t.backgroundColor,!0)&&s++,this.setProgressColor(t.progressColor,!0)&&s++,this.setDrawGraphicHandler(t.drawGraphicHandler,!0)&&s++,this.setDrawTextHandler(t.drawTextHandler,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBackgroundColor(t,e=!1){if(this._backgroundColor===t)return!1;const i=this._backgroundColor;return this.setupBackgroundColor(t),this._backgroundColor!==i&&(e||this.refreshAll(),!0)}setDrawGraphicHandler(t,e=!1){return this._drawGraphicHandler!==t&&(this.setupDrawGraphicHandler(t),e||this.refreshAll(),!0)}setDrawTextHandler(t,e=!1){return this._drawTextHandler!==t&&(this.setupDrawTextHandler(t),e||this.refreshAll(),!0)}setMaxValue(t,e=!1){if(this._maxValue===t)return!1;const i=this._maxValue;return this.setupMaxValue(t),this._maxValue!==i&&(e||this.refreshAll(),!0)}setProgressColor(t,e=!1){if(this._progressColor===t)return!1;const i=this._progressColor;return this.setupProgressColor(t),this._progressColor!==i&&(e||this.refreshAll(),!0)}setValue(t,e=!1){if(this._value===t)return!1;const i=this._value;return this.setupValue(t),this._value!==i&&(e||this.refreshAll(),this.updateValueEvents(),!0)}setValueStep(t,e=!1){if(this._valueStep===t)return!1;const i=this._valueStep;return this.setupValueStep(t),this._valueStep!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupValueStep(t.valueStep),this.setupMaxValue(t.maxValue),this.setupValue(t.value),this.setupBackgroundColor(t.progressColor),this.setupProgressColor(t.progressColor),this.setupDrawGraphicHandler(t.drawGraphicHandler),this.setupDrawTextHandler(t.drawTextHandler)}setupBackgroundColor(t){this._backgroundColor=t||this.standardBackgroundColor()}setupDrawGraphicHandler(t){this._drawGraphicHandler=t||this.standardDrawGraphicHandler()}setupDrawTextHandler(t){this._drawTextHandler=t||this.standardDrawTextHandler()}setupMaxValue(t){this._maxValue=t||this.standardMaxValue()}setupProgressColor(t){this._progressColor=t||this.standardProgressColor()}setupValue(t){const e=this._maxValue,i=Math.max(0,Math.min(t,e));this._value=_.defaultTo(i,this.standardValue())}setupValueStep(t){this._valueStep=t||this.standardValueStep()}standardActive(){return!1}standardBackgroundColor(){return"grey"}standardDrawGraphicHandler(){return null}standardDrawTextHandler(){return null}standardMaxValue(){return 100}standardProgressColor(){return"#33ccff"}standardValue(){return 0}standardValueStep(){return 1}subValue(t){this.addValue(-t)}_updateAnimateValue(t,e){const i=e.remainingTime,s=(this._value*(i-1)+t)/i;this.setValue(s)}updateEmptyEvents(){this.isEmpty()&&this.updateEventsContainer("empty")}updateEvents(){DKTools.Sprite.prototype.updateEvents.call(this),this.updateEmptyEvents(),this.updateFullEvents()}updateFullEvents(){this.isFull()&&this.updateEventsContainer("full")}updateValueEvents(){this.updateEventsContainer("value")}},Object.defineProperties(DKTools.Sprite.ProgressBar.prototype,{valueStep:{get:function(){return this._valueStep},configurable:!0},maxValue:{get:function(){return this._maxValue},configurable:!0},value:{get:function(){return this._value},configurable:!0},backgroundColor:{get:function(){return this._backgroundColor},configurable:!0},progressColor:{get:function(){return this._progressColor},configurable:!0},drawGraphicHandler:{get:function(){return this._drawGraphicHandler},configurable:!0},drawTextHandler:{get:function(){return this._drawTextHandler},configurable:!0}}),DKTools.Sprite.ProgressBar.Rectangle=class extends DKTools.Sprite.ProgressBar{standardDrawGraphicHandler(){return()=>{let t=this.standardVerticalDrawGraphicHandler();this.isHorizontal()&&(t=this.standardHorizontalDrawGraphicHandler()),DKTools.Utils.isFunction(t)&&t(this)}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardHorizontalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue})}}standardVerticalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue,type:"vertical",reversed:!0})}}},DKTools.Sprite.ProgressBar.Circle=class extends DKTools.Sprite.ProgressBar{setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.ProgressBar.prototype.setAll.call(this,t,!0);return this.setLineWidth(t.lineWidth,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLineWidth(t,e=!1){if(this._lineWidth===t)return!1;const i=this._lineWidth;return this.setupLineWidth(t),this._lineWidth!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.ProgressBar.prototype.setupAll.call(this,t),this.setupLineWidth(t.lineWidth)}setupLineWidth(t){this._lineWidth=t||this.standardLineWidth()}standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,s=i;this.strokeArc({x:i,y:s,radius:e,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:-Math.PI/2,endAngle:-Math.PI/2+2*Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardLineWidth(){return 10}},Object.defineProperties(DKTools.Sprite.ProgressBar.Circle.prototype,{lineWidth:{get:function(){return this._lineWidth},configurable:!0}}),DKTools.Sprite.ProgressBar.SemiCircle=class extends DKTools.Sprite.ProgressBar.Circle{standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,s=this.height;this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,endAngle:-Math.PI+Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}},DKTools.Sprite.CheckBox=class extends DKTools.Sprite.Button{check(){this.isChecked()||(this.switch(),this.updateCheckedEvents())}isChecked(){return this._checked}_refreshCheckedGraphic(){let t=null;DKTools.Utils.isString(this._checkedGraphic)?t={folder:this._graphicFolder,filename:this._checkedGraphic}:this._checkedGraphic instanceof Object&&(t=this._checkedGraphic),t&&this.loadBitmap(t)}_refreshGraphic(){this.isChecked()?this._refreshCheckedGraphic():this._refreshUncheckedGraphic()}_refreshUncheckedGraphic(){let t=null;DKTools.Utils.isString(this._uncheckedGraphic)?t={folder:this._graphicFolder,filename:this._uncheckedGraphic}:this._uncheckedGraphic instanceof Object&&(t=this._uncheckedGraphic),t&&this.loadBitmap(t)}refreshAll(){this._refreshGraphic(),DKTools.Sprite.Button.prototype.refreshAll.call(this)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setChecked(t.checked,!0)&&s++,this.setCheckedGraphic(t.checkedGraphic,!0)&&s++,this.setUncheckedGraphic(t.uncheckedGraphic,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setChecked(t,e=!1){if(this._checked===t)return!1;const i=this._checked;return this.setupChecked(t),this._checked!==i&&(e||this.refreshAll(),!0)}setCheckedGraphic(t,e=!1){const i=this._checkedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupCheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupCheckedGraphic(t),_.isEqual(this._checkedGraphic,e))return!1}}return e||this.refreshAll(),!0}setUncheckedGraphic(t,e=!1){const i=this._uncheckedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupUncheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupUncheckedGraphic(t),_.isEqual(this._uncheckedGraphic,e))return!1}}return e||this.refreshAll(),!0}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupChecked(t.checked),this.setupCheckedGraphic(t.checkedGraphic),this.setupUncheckedGraphic(t.uncheckedGraphic)}setupChecked(t){this._checked=_.defaultTo(t,this.standardChecked())}setupCheckedGraphic(t){this._checkedGraphic=t||this.standardCheckedGraphic()}setupUncheckedGraphic(t){this._uncheckedGraphic=t||this.standardUncheckedGraphic()}standardChecked(){return!1}standardCheckedGraphic(){return null}standardUncheckedGraphic(){return null}switch(){this.setChecked(!this.isChecked())}uncheck(){this.isChecked()&&(this.switch(),this.updateUncheckedEvents())}updateCheckedEvents(){this.updateEventsContainer("checked")}updateMouseClickEvents(t){this.switch(),DKTools.Sprite.Button.prototype.updateMouseClickEvents.call(this,t)}updateUncheckedEvents(){this.updateEventsContainer("unchecked")}},Object.defineProperties(DKTools.Sprite.CheckBox.prototype,{checked:{get:function(){return this._checked},configurable:!0},checkedGraphic:{get:function(){return this._checkedGraphic},configurable:!0},uncheckedGraphic:{get:function(){return this._uncheckedGraphic},configurable:!0}}),DKTools.Viewport=class extends DKTools.Sprite{canCloneFixedBitmap(){return!1}createAll(){DKTools.Sprite.prototype.createAll.call(this),this.createMask()}createMask(){DKTools.Sprite.prototype.createMask.call(this,this._maskShape)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaskShape(t.maskShape,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setMaskShape(t,e=!1){if(this._maskShape===t)return!1;const i=this._maskShape;return this.setupShape(t),this._maskShape!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaskShape(t.maskShape)}setupMaskShape(t){this._maskShape=t||this.standardMaskShape()}standardMaskShape(){return"rect"}},Object.defineProperties(DKTools.Viewport.prototype,{maskShape:{get:function(){return this._maskShape},configurable:!0}}),DKTools.Layout=class extends DKTools.Sprite{activateItems(t=!1){this.iterateItems(t=>{t.activate()},t)}addAllChildren(){DKTools.Sprite.prototype.addAllChildren.call(this),this.addAllItems()}addAllItems(){this.hasItems()&&this.addChild.apply(this,this._items)}addCol(){this.addCols(1)}addCols(t){this.setMaxCols(this.getMaxCols()+t)}addItem(t,e=!1){return t instanceof DKTools.Sprite?(this._items.push(t),e||this.start(),t):null}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return i.length>0&&!e&&this.start(),i}alignCol(t){_.forEach(this.getItemsInCol(t),this.alignItem.bind(this))}alignItem(t){if(this.isReady()){const e=this.getItemRow(t),i=this.getItemCol(t),s=this.getRowHeight(e),n=this.getColWidth(i),r=this.getColX(i)+(n-t.width)/2,o=this.getRowY(e)+(s-t.height)/2;t.move(r,o)}else this.addOneTimeEvent({type:"ready",onSuccess:this.alignItem.bind(this,t)})}alignItems(){this.addOneTimeEvent({type:"ready",onSuccess:()=>{this.iterateItems(this.alignItem.bind(this))}})}alignRow(t){_.forEach(this.getItemsInRow(t),this.alignItem.bind(this))}_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearItems()}_clearItems(){this._items=[]}canCloneFixedBitmap(){return!1}clearItems(t=!1){this.removeAllItems(),this._clearItems(),t||this.start()}deactivateItems(t=!1){this.iterateItems(t=>{t.deactivate()},t)}_getBitmapHeight(){let t=0;const e=this.getMaxRows();for(let i=1;i<=e;i++)t+=this.getRowHeight(i)+this._verticalSpacing;return t-this._verticalSpacing}_getBitmapWidth(){let t=0;const e=this.getMaxCols();for(let i=1;i<=e;i++)t+=this.getColWidth(i)+this._horizontalSpacing;return t-this._horizontalSpacing}getCell(t,e){const i=this.getMaxCols()*(t-1)+(e-1);return{item:this.getItem(i),x:this.getColX(e),y:this.getRowY(t),width:this.getColWidth(e),height:this.getRowHeight(t)}}getColWidth(t){return DKTools.Utils.isFunction(this._colWidth)?this._colWidth(t,this):this._colWidth}getColX(t){let e=0;for(let i=1;i=0?e%this.getMaxCols()+1:-1}getItemIndex(t){return _.indexOf(this.getItems(),t)}getItemRow(t){const e=this.getItemIndex(t);return e>=0?Math.floor(e/this.getMaxCols())+1:-1}getItems(){return this.isInverted()?_.reverse(_.clone(this._items)):this._items}getItemsInCol(t){const e=[],i=this.getMaxRows(),s=this.getMaxCols();if(t<1||t>s)return e;const n=t-1;for(let t=0;tthis.getMaxRows())return e;const s=i*(t-1);for(let t=0;t=0}hasItems(){return!this.isEmpty()}hideItems(t=!1,e=!1){this.iterateItems(e=>{e.hide(t)},e)}insertItem(t,e,i=!1){return t instanceof DKTools.Sprite?(DKTools.Utils.Array.insert(this._items,t,e),i||this.start(),t):null}insertItems(t,e,i=!1){e=e||0;const s=_.map(t,(t,i)=>this.insertItem(t,e+i,!0));return s.length>0&&!i&&this.start(),s}invert(){this.setInverted(!this.isInverted())}isEmpty(){return 0===this.getMaxItems()}isHorizontal(){return 1===this.getMaxRows()}isInverted(){return this._inverted}isReady(){return this.isEmpty()||_.every(this._items,t=>t.isReady())}isVertical(){return 1===this.getMaxCols()}iterateItems(t,e=!1){_.forEach(this.getItems(),t),e&&this.start()}moveItem(t,e,i){const s=this.getItem(t);s&&s.move(e,i)}removeAllChildren(){DKTools.Sprite.prototype.removeAllChildren.call(this),this.removeAllItems()}removeAllItems(){this.hasItems()&&this.removeChild.apply(this,this._items)}removeCol(){this.removeCols(1)}removeCols(t){this.getMaxCols()-t>=1&&this.addCols(-t)}removeItem(t,e=!1){return Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)?(this.removeChild(t),DKTools.Utils.Array.remove(this._items,t),e||this.start(),t):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return i.length>0&&!e&&this.start(),i}resizeItem(t,e,i,s=!1){Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)&&t.resize(e,i)&&(s||this.start())}resizeItems(t,e,i=!1){this.iterateItems(i=>{this.resizeItem(i,t,e,!0)},!i)}setAll(t,e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaxCols(t.maxCols,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setItems(t.items,!0)&&s++,this.setRowHeight(t.rowHeight,!0)&&s++,this.setColWidth(t.colWidth,!0)&&s++,this.setInverted(t.reversed,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setColWidth(t,e=!1){if(this._colWidth===t)return!1;const i=this._colWidth;return this.setupColWidth(t),this._colWidth!==i&&(e||this.start(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.start(),!0)}setInverted(t,e=!1){if(this._inverted===t)return!1;const i=this._inverted;return this.setupInverted(t),this._inverted!==i&&(e||this.start(),!0)}setItems(t,e=!1){return this._items!=t&&(this.removeAllItems(),this.setupItems(t),e||this.start(),!0)}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.start(),!0)}setRowHeight(t,e=!1){if(this._rowHeight===t)return!1;const i=this._rowHeight;return this.setupRowHeight(t),this._rowHeight!==i&&(e||this.start(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.start(),s}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaxCols(t.maxCols),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupItems(t.items),this.setupRowHeight(t.rowHeight),this.setupColWidth(t.colWidth),this.setupInverted(t.inverted)}setupColWidth(t){this._colWidth=t||this.standardColWidth()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupInverted(t){this._inverted=_.defaultTo(t,this.standardInverted())}setupItems(t){this._items=_.clone(t||this.standardItems())}setupMaxCols(t){this._maxCols=_.defaultTo(t,this.standardMaxCols())}setupRowHeight(t){this._rowHeight=t||this.standardRowHeight()}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}showItems(t=!1,e=!1){this.iterateItems(e=>{e.show(t)},e)}standardActive(){return!1}standardColWidth(){return t=>{const e=this.getItemsInCol(t);return _.max(_.map(e,"width"))}}standardHorizontalSpacing(){return 12}standardInverted(){return!1}standardItems(){return[]}standardMaxCols(){return 1}standardRowHeight(){return t=>{const e=this.getItemsInRow(t);return _.max(_.map(e,"height"))}}standardVerticalSpacing(){return this.getLineHeight()/2}start(){this._started=!0,this.isReady()?DKTools.Sprite.prototype.start.call(this):this.addOneTimeEvent({type:"ready",onSuccess:this.start.bind(this)})}startItems(t=!1,e=!1){this.iterateItems(e=>{e.start(t)},!e)}updateAll(){DKTools.Sprite.prototype.updateAll.call(this),this.updateLayout()}updateLayout(){const t=this.getMaxItems(),e=this.getMaxRows(),i=this.getMaxCols();let s=0;for(let n=1;n<=e&&s{const e=this.findArrow(t);e&&this.addChild(e)})},DKTools.Window.prototype.activate=function(){DKTools.Base.prototype.activate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.activate()},DKTools.Window.prototype.addAllChildren=function(){DKTools.Base.prototype.addAllChildren.call(this),this.addContentsSprite()},DKTools.Window.prototype.addContentsSprite=function(){this._addContentsSprite(),this._refreshContents()},DKTools.Window.prototype._clearAll=function(){DKTools.Base.prototype._clearAll.call(this),this._clearIsWindow(),this._clearOpenness(),this._clearPadding(),this._clearMargin(),this._clearColorTone(),this._clearOrigin(),this._clearArrows()},DKTools.Window.prototype._clearIsWindow=function(){this._isWindow=!0},DKTools.Window.prototype._clearOpenness=function(){this._openness=this.standardOpenness()},DKTools.Window.prototype._clearPadding=function(){this._padding=this.standardPadding()},DKTools.Window.prototype._clearMargin=function(){this._margin=this.standardMargin()},DKTools.Window.prototype._clearColorTone=function(){this._colorTone=this.standardTone()},DKTools.Window.prototype._clearOrigin=function(){this._origin=this.standardOrigin()},DKTools.Window.prototype._clearArrows=function(){this._arrows=[]},DKTools.Window.prototype._createAll=function(){DKTools.Base.prototype._createAll.call(this),this._createAllParts(),this._createWindowskin()},DKTools.Window.prototype._createAllParts=function(){this._createSpriteContainer(),this._createBackSprite(),this._createFrameSprite(),this._createPauseSignSprite(),this._createArrows()},DKTools.Window.prototype._createSpriteContainer=function(){this._windowSpriteContainer=new PIXI.Container},DKTools.Window.prototype._createBackSprite=function(){this.needsCreateBackSprite()&&(this._windowBackSprite=new Sprite,this._windowBackSprite.opacity=this.standardBackOpacity(),this._windowBackSprite.visible=this.standardBackVisible())},DKTools.Window.prototype._createFrameSprite=function(){this.needsCreateFrameSprite()&&(this._windowFrameSprite=new Sprite,this._windowFrameSprite.visible=this.standardFrameVisible())},DKTools.Window.prototype._createPauseSignSprite=function(){this.needsCreatePauseSignSprite()&&(this._windowPauseSignSprite=new Sprite)},DKTools.Window.prototype._createArrows=function(){this.needsCreateArrowsSprites()&&(this.needsCreateUpArrowSprite()&&this.createArrow("up","up",{onUpdate:this.onUpArrowUpdate.bind(this),onMouseClick:this.onUpArrowMouseClick.bind(this),onMouseLongPress:this.onUpArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateDownArrowSprite()&&this.createArrow("down","down",{onUpdate:this.onDownArrowUpdate.bind(this),onMouseClick:this.onDownArrowMouseClick.bind(this),onMouseLongPress:this.onDownArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateLeftArrowSprite()&&this.createArrow("left","left",{onUpdate:this.onLeftArrowUpdate.bind(this),onMouseClick:this.onLeftArrowMouseClick.bind(this),onMouseLongPress:this.onLeftArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateRightArrowSprite()&&this.createArrow("right","right",{onUpdate:this.onRightArrowUpdate.bind(this),onMouseClick:this.onRightArrowMouseClick.bind(this),onMouseLongPress:this.onRightArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}))},DKTools.Window.prototype._createWindowskin=function(){this.windowskin=DKTools.Utils.Bitmap.load({folder:"img/system",filename:this.standardWindowskin()})},DKTools.Window.prototype.canRedrawAll=function(){return this.hasContentsSprite()&&DKTools.Base.prototype.canRedrawAll.call(this)},DKTools.Window.prototype.changeFont=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeFont(t)},DKTools.Window.prototype.changeTextColor=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeTextColor(t)},DKTools.Window.prototype.changePaintOpacity=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changePaintOpacity(t)},DKTools.Window.prototype.checkSize=function(){const t=this.getMinWidth(),e=this.getMinHeight();let i=0;return this._width{this.isOpenAndVisible()?s.show():s.hide(),DKTools.Utils.isFunction(i.onUpdate)&&i.onUpdate(t)}}),DKTools.Utils.isFunction(i.onMouseDown)&&s.addEvent({type:"mouse-down-left",onUpdate:i.onMouseDown}),DKTools.Utils.isFunction(i.onMouseUp)&&s.addEvent({type:"mouse-up-left",onUpdate:i.onMouseUp}),DKTools.Utils.isFunction(i.onMouseClick)&&s.addEvent({type:"mouse-click-left",onUpdate:i.onMouseClick}),DKTools.Utils.isFunction(i.onMouseLongPress)&&s.addEvent({type:"mouse-long-press-left",onUpdate:i.onMouseLongPress}),DKTools.Utils.isFunction(i.onMouseLongPressStarted)&&s.addEvent({type:"mouse-long-press-left-started",onUpdate:i.onMouseLongPressStarted}),DKTools.Utils.isFunction(i.onMouseLongPressFinished)&&s.addEvent({type:"mouse-long-press-left-finished",onUpdate:i.onMouseLongPressFinished}),DKTools.Utils.isFunction(i.onStateNormal)&&s.addEvent({type:"state-normal",onUpdate:i.onStateNormal}),DKTools.Utils.isFunction(i.onStatePressed)&&s.addEvent({type:"state-pressed",onUpdate:i.onStatePressed}),this._arrows.push(s),this.addChild(s),s},DKTools.Window.prototype.deactivate=function(){DKTools.Base.prototype.deactivate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.deactivate()},DKTools.Window.prototype.destroy=function(t){DKTools.Base.prototype.destroy.call(this,t),Window_Base.prototype.destroy.call(this,t)},DKTools.Window.prototype.drawText=function(t,e){return!!this.hasContentsSprite()&&this._windowContentsSprite.drawText(t,e)},DKTools.Window.prototype.findArrow=function(t){return _.find(this._arrows,{id:t})},DKTools.Window.prototype.getMinWidth=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinWidth.call(this)},DKTools.Window.prototype.getMinHeight=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinHeight.call(this)},DKTools.Window.prototype.getContentsWidth=function(){return DKTools.Utils.isFunction(this._contentsWidth)?this._contentsWidth(this):this._contentsWidth},DKTools.Window.prototype.getContentsHeight=function(){return DKTools.Utils.isFunction(this._contentsHeight)?this._contentsHeight(this):this._contentsHeight},DKTools.Window.prototype.getContentsSize=function(){return{width:this.getContentsWidth(),height:this.getContentsHeight()}},DKTools.Window.prototype.getCurrentOpacity=function(){return this.windowOpacity},DKTools.Window.prototype.hasBitmap=function(){return!!this.hasContentsSprite()&&this._windowContentsSprite.hasBitmap()},DKTools.Window.prototype.hasSpriteContainer=function(){return!!this._windowSpriteContainer},DKTools.Window.prototype.hasBackSprite=function(){return!!this._windowBackSprite},DKTools.Window.prototype.hasFrameSprite=function(){return!!this._windowFrameSprite},DKTools.Window.prototype.hasContentsSprite=function(){return!!this._windowContentsSprite},DKTools.Window.prototype.hasArrow=function(t){return!!this.findArrow(t)},DKTools.Window.prototype.hasArrowSprites=function(){return this.hasUpArrowSprite()&&this.hasDownArrowSprite()&&this.hasLeftArrowSprite()&&this.hasRightArrowSprite()},DKTools.Window.prototype.hasUpArrowSprite=function(){return this.hasArrow("up")},DKTools.Window.prototype.hasDownArrowSprite=function(){return this.hasArrow("down")},DKTools.Window.prototype.hasLeftArrowSprite=function(){return this.hasArrow("left")},DKTools.Window.prototype.hasRightArrowSprite=function(){return this.hasArrow("right")},DKTools.Window.prototype.hasPauseSignSprite=function(){return!!this._windowPauseSignSprite},DKTools.Window.prototype.hasBackgroundDimmer=function(){return!!this._dimmerSprite},DKTools.Window.prototype.hideBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!1)},DKTools.Window.prototype.hideContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.hide()},DKTools.Window.prototype.hideFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!1)},DKTools.Window.prototype.isOpenAndVisible=function(){return this.isOpen()&&this.isVisible()},DKTools.Window.prototype.isOpenAndActive=function(){return this.isOpen()&&this.isActive()},DKTools.Window.prototype.needsCreateBackSprite=function(){return!0},DKTools.Window.prototype.needsCreateFrameSprite=function(){return!0},DKTools.Window.prototype.needsCreateArrowsSprites=function(){return!1},DKTools.Window.prototype.needsCreateDownArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateUpArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateLeftArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateRightArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreatePauseSignSprite=function(){return!0},DKTools.Window.prototype.onUpArrowUpdate=function(t){},DKTools.Window.prototype.onDownArrowUpdate=function(t){},DKTools.Window.prototype.onLeftArrowUpdate=function(t){},DKTools.Window.prototype.onRightArrowUpdate=function(t){},DKTools.Window.prototype.onUpArrowMouseClick=function(t){},DKTools.Window.prototype.onDownArrowMouseClick=function(t){},DKTools.Window.prototype.onLeftArrowMouseClick=function(t){},DKTools.Window.prototype.onRightArrowMouseClick=function(t){},DKTools.Window.prototype.onUpArrowMouseLongPress=function(t){},DKTools.Window.prototype.onDownArrowMouseLongPress=function(t){},DKTools.Window.prototype.onLeftArrowMouseLongPress=function(t){},DKTools.Window.prototype.onRightArrowMouseLongPress=function(t){},DKTools.Window.prototype._refreshAllParts=function(){this._refreshBack(),this._refreshFrame(),this._refreshContents(),this._refreshPauseSign(),this._refreshArrows()},DKTools.Window.prototype._refreshBack=function(){this.hasBackSprite()&&Window.prototype._refreshBack.call(this)},DKTools.Window.prototype._refreshFrame=function(){this.hasFrameSprite()&&Window.prototype._refreshFrame.call(this)},DKTools.Window.prototype._refreshContents=function(){if(this.hasContentsSprite()){let t=this._contentsPosition;DKTools.Utils.isFunction(t)&&(t=t(this)),this._windowContentsSprite.move(t)}},DKTools.Window.prototype._refreshPauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._refreshPauseSign.call(this)},DKTools.Window.prototype._refreshArrows=function(){const t={up:this.standardUpArrowPosition(),down:this.standardDownArrowPosition(),left:this.standardLeftArrowPosition(),right:this.standardRightArrowPosition()};_.forEach(t,(t,e)=>{const i=this.findArrow(e);i&&i.move(t)})},DKTools.Window.prototype.redrawAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.redrawAll()},DKTools.Window.prototype.refreshAll=function(){this._refreshAllParts(),DKTools.Base.prototype.refreshAll.call(this)},DKTools.Window.prototype.refreshArrows=function(){_.forEach(this._arrows,t=>{t.refreshAll()})},DKTools.Window.prototype.removeAllChildren=function(){DKTools.Base.prototype.removeAllChildren.call(this),this.removeContentsSprite()},DKTools.Window.prototype.removeContentsSprite=function(){this.hasContentsSprite()&&this.removeChild(this._windowContentsSprite)},DKTools.Window.prototype.removeArrow=function(t){const e=this.findArrow(t);e&&(DKTools.Utils.Array.remove(this._arrows,e),this.removeChild(e))},DKTools.Window.prototype.resetAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetAll()},DKTools.Window.prototype.resetFont=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetFont()},DKTools.Window.prototype.resetTextColor=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetTextColor()},DKTools.Window.prototype.resetPaintOpacity=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetPaintOpacity()},DKTools.Window.prototype.resize=function(t,e,i=!1,s=!1){if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._width===t&&this._height===e)return!1;const n=this._width,r=this._height;return this.setupSize(t,e),(this._width!==n||this._height!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Window.prototype.standardOpenness=function(){return 255},DKTools.Window.prototype.standardOpennessSpeed=function(){return 16},DKTools.Window.prototype.standardMargin=function(){return 4},DKTools.Window.prototype.standardOrigin=function(){return new Point(0,0)},DKTools.Window.prototype.standardUpArrowPosition=function(){return new Point(this._width/2,12)},DKTools.Window.prototype.standardDownArrowPosition=function(){return new Point(this._width/2,this._height-12)},DKTools.Window.prototype.standardLeftArrowPosition=function(){return new Point(12,this._height/2)},DKTools.Window.prototype.standardRightArrowPosition=function(){return new Point(this._width-12,this._height/2)},DKTools.Window.prototype.standardArrowStateNormal=function(){return t=>{const e=t.target;e.setScale(1,1),e.setOpacity(255)}},DKTools.Window.prototype.standardArrowStatePressed=function(){return t=>{const e=t.target;e.setScale(.9,.9),e.setOpacity(160)}},DKTools.Window.prototype.standardContentsSprite=function(){return new DKTools.Sprite},DKTools.Window.prototype.standardChildX=function(){return this._padding},DKTools.Window.prototype.standardChildY=function(){return this._padding},DKTools.Window.prototype.standardChildPosition=function(){return()=>new Point(this.standardChildX(),this.standardChildY())},DKTools.Window.prototype.standardContentsPosition=function(){return this.standardChildPosition()},DKTools.Window.prototype.standardBackVisible=function(){return!0},DKTools.Window.prototype.standardFrameVisible=function(){return!0},DKTools.Window.prototype.standardContentsWidth=function(){return()=>this._width-2*this._padding},DKTools.Window.prototype.standardContentsHeight=function(){return()=>this._height-2*this._padding},DKTools.Window.prototype.standardWindowOpacity=function(){return 255},DKTools.Window.prototype.standardContentsOpacity=function(){return 255},DKTools.Window.prototype.standardFrameOpacity=function(){return 255},DKTools.Window.prototype.standardOpacity=function(){return{windowOpacity:this.standardWindowOpacity(),contentsOpacity:this.standardContentsOpacity(),frameOpacity:this.standardFrameOpacity(),backOpacity:this.standardBackOpacity()}},DKTools.Window.prototype.standardTone=function(){try{return _.clone($gameSystem.windowTone())}catch(t){return[0,0,0]}},DKTools.Window.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t);let e=t.contentsSprite;t instanceof DKTools.Window&&e instanceof DKTools.Sprite&&(e=e.clone({blockStart:!0})),this.setupPadding(t.padding),this.setupMargin(t.margin),this.setupContentsWidth(t.contentsWidth),this.setupContentsHeight(t.contentsHeight),this.setupContentsSprite(e),this.setupContentsPosition(t.contentsPosition),this.setupOpacity(t.opacity),this.setupTone(t.tone)},DKTools.Window.prototype.setupWidth=function(t){this.width=this._checkWidth(t)},DKTools.Window.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this.height=this._checkHeight(t)},DKTools.Window.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),t=this._checkWidth(t),e=this._checkHeight(e),Window.prototype.move.call(this,this.x,this.y,t,e)},DKTools.Window.prototype.setupPadding=function(t){this._padding=_.defaultTo(t,this.standardPadding())},DKTools.Window.prototype.setupMargin=function(t){this._margin=_.defaultTo(t,this.standardMargin())},DKTools.Window.prototype.setupContentsWidth=function(t){this._contentsWidth=t||this.standardContentsWidth()},DKTools.Window.prototype.setupContentsHeight=function(t){this._contentsHeight=t||this.standardContentsHeight()},DKTools.Window.prototype.setupContentsSprite=function(t){this._windowContentsSprite=t||this.standardContentsSprite()},DKTools.Window.prototype.setupContentsPosition=function(t,e){let i=t;DKTools.Utils.isFunction(t)||(i=DKTools.Utils.Point.tryToPoint(t,e)||this.standardContentsPosition()),this._contentsPosition=i},DKTools.Window.prototype.setupOpacity=function(t){this._opacity=Object.assign(this.standardOpacity(),t)},DKTools.Window.prototype.setupTone=function(t){this._tone=Object.assign(this.standardTone(),t)},DKTools.Window.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setPadding(t.padding,!0)&&s++,this.setMargin(t.margin,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setTone(t.tone,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Window.prototype.setWidth=function(t,e=!1,i=!1){return this.resize(t,this._height,e,i)},DKTools.Window.prototype.setHeight=function(t,e=!1,i=!1){return this.resize(this._width,t,e,i)},DKTools.Window.prototype.setPadding=function(t,e=!1){if(this._padding===t)return!1;const i=this._padding;return this.setupPadding(t),this._padding!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setMargin=function(t,e=!1){if(this._margin===t)return!1;const i=this._margin;return this.setupMargin(padding),this._margin!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setContentsSprite=function(t,e=!1,i=!1){return this._windowContentsSprite!=t&&(this.removeContentsSprite(),this.setupContentsSprite(t),this.addContentsSprite(),e||this.start(),i&&this.activate(),!0)},DKTools.Window.prototype.setContentsPosition=function(t,e){const i=DKTools.Utils.isFunction,s=i(this._contentsPosition),n=i(t);if(s||n){if(this._contentsPosition===t)return!1;this.setupContentsPosition(t,e)}else{const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this._contentsPosition,i))return!1;const s=DKTools.Utils.Point.clone(this._contentsPosition);if(this.setupContentsPosition(i),DKTools.Utils.Point.equals(this._contentsPosition,s))return!1}return this._refreshContents(),!0},DKTools.Window.prototype.setOpacity=function(t,e=!1){if(_.isEqual(this._opacity,Object.assign(this.standardOpacity(),t)))return!1;const i=_.clone(this._opacity);return this.setupOpacity(t),!_.isEqual(this._opacity,i)&&(e||this.updateOpacity(),!0)},DKTools.Window.prototype.setTone=function(t,e=!1){if(_.isEqual(this._tone,Object.assign(this.standardTone(),t)))return!1;const i=_.clone(this._tone);return this.setupTone(t),!_.isEqual(this._tone,i)&&(e||this.updateTone(),!0)},DKTools.Window.prototype.start=function(t=!1){if(this.hasContentsSprite()){const e=this._windowContentsSprite;e.resize(this.getContentsWidth(),this.getContentsHeight(),!0),e.start(t)}DKTools.Base.prototype.start.call(this,t)},DKTools.Window.prototype.showBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!0)},DKTools.Window.prototype.showContents=function(t=!1){this.hasContentsSprite()&&this._windowContentsSprite.show(t)},DKTools.Window.prototype.showFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!0)},DKTools.Window.prototype._updateContents=function(){this.hasContentsSprite()&&Window.prototype._updateContents.call(this)},DKTools.Window.prototype._updatePauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._updatePauseSign.call(this)},DKTools.Window.prototype.updateOpenEvents=function(){this.updateEventsContainer("open")},DKTools.Window.prototype.updateCloseEvents=function(){this.updateEventsContainer("close")},DKTools.Window.prototype.updateAll=function(){this.updateContents(),DKTools.Base.prototype.updateAll.call(this),this.updateTone()},DKTools.Window.prototype.updateContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.updateAll()},DKTools.Window.prototype.updateTransform=function(){this._updateContents(),this._updatePauseSign(),PIXI.Container.prototype.updateTransform.call(this)},DKTools.Window.prototype.updateOpacity=function(t={}){t=t||{},this.hasSpriteContainer()&&(this.windowOpacity=_.defaultTo(t.windowOpacity,this.opacity.windowOpacity)),this.hasContentsSprite()&&(this.contentsOpacity=_.defaultTo(t.contentsOpacity,this.opacity.contentsOpacity)),this.hasFrameSprite()&&(this.frameOpacity=_.defaultTo(t.frameOpacity,this.opacity.frameOpacity)),this.hasBackSprite()&&(this.backOpacity=_.defaultTo(t.backOpacity,this.opacity.backOpacity))},DKTools.Window.prototype.updateTone=function(t){t=t||this.tone,this.hasBackSprite()&&Window.prototype.setTone.apply(this,t)},DKTools.Window.prototype.updateOpen=function(){this._opening&&(this.openness+=this.standardOpennessSpeed(),this.isOpen()&&(this._opening=!1,this.updateOpenEvents()))},DKTools.Window.prototype.updateClose=function(){this._closing&&(this.openness-=this.standardOpennessSpeed(),this.isClosed()&&(this._closing=!1,this.updateCloseEvents()))},DKTools.Window.prototype.update=function(){DKTools.Base.prototype.update.call(this),this.updateOpen(),this.updateClose(),this.updateBackgroundDimmer()},DKTools.Window.Selectable=class extends DKTools.Window{needsCreateArrowsSprites(){return!0}onUpArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()&&t.getTopRow()>0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onDownArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()){const i=t.getTopRow(),s=t.getMaxTopRow();s>0&&i0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onRightArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isHorizontal()){const i=t.getTopCol(),s=t.getMaxTopCol();s>0&&ithis.add(t))}finish(){this._queue=[],this._finished=!0}hasErrors(){return this._errors>0}isReady(){return this._finished}_onError(){this._errors++}start(){const t=_.map(this._queue,t=>t.catch(t=>{throw this._onError(),t}));Promise.all(t).then(()=>this.finish())}};const DKToolsParam=new DKTools.ParameterManager("DKTools");DKTools.PluginCommandManager.set("DKPluginsCheckUpdates",()=>{DKTools.Utils.openConsole(),DKTools.Utils._checkUpdates()}),DKTools.PluginCommandManager.set("UpdateFileSystemStamp",()=>{DKTools.IO._createStamp()});const DKTools_window_onload=window.onload;window.onload=function(){DKTools.Utils.initialize(),DKTools.IO.initialize(),DKTools_window_onload.call(this),DKTools.PluginManager.initialize()};const DKTools_ImageCache_get=ImageCache.prototype.get;ImageCache.prototype.get=function(t){return DKTools_ImageCache_get.call(this,t)||DKTools.PreloadManager.getCachedImageByKey(t)},ImageCache.prototype._truncateCache=function(){const t=this._items;let e=ImageCache.limit;Object.keys(t).map(e=>t[e]).filter(t=>!this._mustBeHeld(t)).sort((t,e)=>e.touch-t.touch).forEach(i=>{if(e>0&&!DKTools.PreloadManager.isImageCachedByKey(i.key)){const t=i.bitmap;e-=t.width*t.height}else delete t[i.key]})};const DKTools_ImageCache_mustBeHeld=ImageCache.prototype._mustBeHeld;ImageCache.prototype._mustBeHeld=function(t){return!DKTools.PreloadManager.isImageCachedByKey(t.key)&&DKTools_ImageCache_mustBeHeld.call(this,t)};const DKTools_Graphics_initialize=Graphics.initialize;Graphics.initialize=function(t,e,i){DKTools_Graphics_initialize.call(this,t,e,i);const s=DKToolsParam.get("FPS Meter");if(DKTools.Utils.isTest()&&s.Enabled){const t=this._fpsMeter;t&&(this.showFps(),"FPS"===s.Mode?(t.showFps(),this._fpsMeterToggled=!1):(t.showDuration(),this._fpsMeterToggled=!0))}};const DKTools_Graphics_printError=Graphics.printError;Graphics.printError=function(t,e){DKTools_Graphics_printError.call(this,t,e),this._errorPrinter&&this._updateErrorPrinter()};const DKTools_Graphics_createFPSMeter=Graphics._createFPSMeter;Graphics._createFPSMeter=function(){const t=DKToolsParam.get("FPS Meter");t.Enabled?(this._fpsMeter=new FPSMeter({theme:t.Theme,history:t.History,toggleOn:null,graph:1,decimals:0}),this._fpsMeter.hide()):DKTools_Graphics_createFPSMeter.call(this)},Graphics.printDetailedError=function(t){if(!this._errorPrinter)return;const e=t.stack.split(/(?:\r\n|\r|\n)/).map(t=>t.replace(/[\(](.*[\/])/,"("));this._errorPrinter.innerHTML=this._makeDetailedErrorHtml(t.name,t.message,e),this._applyCanvasFilter(),this._clearUpperCanvas()},Graphics._getErrorReferenceInfo=function(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e},Graphics._getErrorMessageForErrorPrint=function(){return DKToolsParam.get("Print Detailed Error","Error Message")},Graphics._getRestartMessageForErrorPrint=function(){return DKToolsParam.get("Print Detailed Error","Restart Message")},Graphics._makeDetailedErrorHtml=function(t,e,i){const s=this._getErrorMessageForErrorPrint(),n=this._getRestartMessageForErrorPrint(),r=this._getErrorReferenceInfo();let o="";return s&&(o=''+s+"

"),Object.keys(r).length>0&&(o+='Reference Information
',_.forEach(r,(t,e)=>{o+=''+e+": "+t+"
"}),o+="
"),o+=''+e+"
",_.forEach(i,t=>{o+=''+t+"
"}),n&&(o+='
'+n+"

"),o};const DKTools_Graphics_updateErrorPrinter=Graphics._updateErrorPrinter;Graphics._updateErrorPrinter=function(){DKTools_Graphics_updateErrorPrinter.call(this),this._errorPrinter&&this._errorShowed&&DKToolsParam.get("Print Detailed Error","Enabled")&&(this._errorPrinter.style.textAlign="left",this._errorPrinter.height=.8*this._height,this._centerElement(this._errorPrinter))};const DKTools_TouchInput_initialize=TouchInput.initialize;TouchInput.initialize=function(){DKTools_TouchInput_initialize.call(this);const t=DKToolsParam.get("Cursor Graphic");if(t.Enabled){const e=t.Graphic;e&&(document.body.style.cursor=`url('img/system/${e}.png'), default`)}};const DKTools_TouchInput_clear=TouchInput.clear;TouchInput.clear=function(){DKTools_TouchInput_clear.call(this),this._mouseMoved=!1,this._leftButtonPressed=!1,this._middleButtonPressed=!1,this._rightButtonPressed=!1,this._leftButtonReleased=!1,this._middleButtonReleased=!1,this._rightButtonReleased=!1,this._mouseX=0,this._mouseY=0,this._events.mouseMoved=!1,this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1};const DKTools_TouchInput_update=TouchInput.update;TouchInput.update=function(){this._mouseMoved=this._events.mouseMoved,this._leftButtonPressed=this._events.leftButtonPressed,this._middleButtonPressed=this._events.middleButtonPressed,this._rightButtonPressed=this._events.rightButtonPressed,this._leftButtonReleased=this._events.leftButtonReleased,this._middleButtonReleased=this._events.middleButtonReleased,this._rightButtonReleased=this._events.rightButtonReleased,this._events.mouseMoved=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1,DKTools_TouchInput_update.call(this)},TouchInput.isMouseMoved=function(){return this._mouseMoved},TouchInput.isMousePressed=function(){return this.isLeftButtonPressed()||this.isMiddleButtonPressed()||this.isRightButtonPressed()},TouchInput.isMouseReleased=function(){return this.isLeftButtonReleased()||this.isMiddleButtonReleased()||this.isRightButtonReleased()},TouchInput.isLeftButtonPressed=function(){return this._leftButtonPressed},TouchInput.isLeftButtonReleased=function(){return this._leftButtonReleased},TouchInput.isMiddleButtonPressed=function(){return this._middleButtonPressed},TouchInput.isMiddleButtonReleased=function(){return this._middleButtonReleased},TouchInput.isRightButtonPressed=function(){return this._rightButtonPressed},TouchInput.isRightButtonReleased=function(){return this._rightButtonReleased};const DKTools_TouchInput_onLeftButtonDown=TouchInput._onLeftButtonDown;TouchInput._onLeftButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onLeftButtonDown.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.leftButtonPressed=!0)};const DKTools_TouchInput_onMiddleButtonDown=TouchInput._onMiddleButtonDown;TouchInput._onMiddleButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onMiddleButtonDown.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.middleButtonPressed=!0)};const DKTools_TouchInput_onRightButtonDown=TouchInput._onRightButtonDown;TouchInput._onRightButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onRightButtonDown.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.rightButtonPressed=!0)};const DKTools_TouchInput_onMouseMove=TouchInput._onMouseMove;TouchInput._onMouseMove=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onMouseMove.call(this,t),this._mouseX===e&&this._mouseY===i||(this._events.mouseMoved=!0,this._date=Date.now(),this._mouseX=e,this._mouseY=i)};const DKTools_TouchInput_onMouseUp=TouchInput._onMouseUp;TouchInput._onMouseUp=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onMouseUp.call(this,t),this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,Graphics.isInsideCanvas(e,i)&&(0===t.button?this._events.leftButtonReleased=!0:1===t.button?this._events.middleButtonReleased=!0:2===t.button&&(this._events.rightButtonReleased=!0))},Object.defineProperties(TouchInput,{mouseX:{get:function(){return this._mouseX},configurable:!0},mouseY:{get:function(){return this._mouseY},configurable:!0}});const DKTools_Tilemap_initialize=Tilemap.prototype.initialize;Tilemap.prototype.initialize=function(){DKTools_Tilemap_initialize.call(this),this._tileWidth=Tilemap.TILE_WIDTH||this._tileWidth,this._tileHeight=Tilemap.TILE_HEIGHT||this._tileHeight};const DKTools_WebAudio_addLoadListener=WebAudio.prototype.addLoadListener;WebAudio.prototype.addLoadListener=function(t){this.isReady()?t(this):DKTools_WebAudio_addLoadListener.call(this,t)},WebAudio.prototype._onLoad=function(){for(;this._loadListeners.length>0;){this._loadListeners.shift()(this)}};const DKTools_DataManager_isDatabaseLoaded=DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded=function(){return!!DKTools_DataManager_isDatabaseLoaded.call(this)&&(this.__isDatabaseLoaded||(this.__isDatabaseLoaded=!0,this.onDatabaseLoad()),!0)},DataManager.onDatabaseLoad=function(){},Object.defineProperties(ImageManager,{PARALLAXES_FOLDER:{get:function(){const t=DKToolsParam.get("Tile Size");return t.Enabled?DKTools.IO.normalizePath(t["Parallaxes Folder"]+"/"):"img/parallaxes/"},configurable:!0},TILESETS_FOLDER:{get:function(){const t=DKToolsParam.get("Tile Size");return t.Enabled?DKTools.IO.normalizePath(t["Tilesets Folder"]+"/"):"img/tilesets/"},configurable:!0}}),ImageManager.loadParallax=function(t,e){return this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!0)},ImageManager.loadTileset=function(t,e){return this.loadBitmap(ImageManager.TILESETS_FOLDER,t,e,!1)},ImageManager.reserveParallax=function(t,e,i){return this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!1,i)},ImageManager.reserveTileset=function(t,e,i){return this.reserveBitmap(ImageManager.TILESETS_FOLDER,t,e,!1,i)},ImageManager.requestParallax=function(t,e){return this.requestBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!0)},ImageManager.requestTileset=function(t,e){return this.requestBitmap(ImageManager.TILESETS_FOLDER,t,e,!1)};const DKTools_AudioManager_createBuffer=AudioManager.createBuffer;AudioManager.createBuffer=function(t,e){const i=this.audioFileExt(),s=this._path+t+"/"+encodeURIComponent(e)+i;return DKTools.PreloadManager.isAudioCachedByPath(s)?DKTools.PreloadManager.getCachedAudioByPath(s):DKTools_AudioManager_createBuffer.call(this,t,e)};const DKTools_SceneManager_initialize=SceneManager.initialize;SceneManager.initialize=async function(){await DKTools_SceneManager_initialize.call(this),await DKTools.StartupManager.initialize()};const DKTools_SceneManager_initGraphics=SceneManager.initGraphics;SceneManager.initGraphics=function(){const t=DKToolsParam.get("Screen Resolution");if(t.Enabled){const e=t.Width,i=t.Height;this._boxWidth=e,this._screenWidth=e,this._boxHeight=i,this._screenHeight=i,this.updateResolution()}DKTools_SceneManager_initGraphics.call(this)},SceneManager.updateResolution=function(){const t=this._screenWidth-window.innerWidth,e=this._screenHeight-window.innerHeight;0!==t&&0!==e&&(window.moveBy(-1*t/2,-1*e/2),window.resizeBy(t,e))};const DKTools_SceneManager_onKeyDown=SceneManager.onKeyDown;SceneManager.onKeyDown=function(t){if(DKTools_SceneManager_onKeyDown.call(this,t),t.ctrlKey||t.altKey)return;const e=DKToolsParam.get("Quick Load","Key Code"),i=DKToolsParam.get("Screenshots","Key Code"),s=DKToolsParam.get("Grid","Key Code");switch(t.keyCode){case e:DKTools.Utils.__quickLoad();break;case i:DKToolsParam.get("Screenshots","Enabled")&&DKTools.Utils.makeScreenshot();break;case s:DKTools.Utils.__showGrid()}};const DKTools_SceneManager_catchException=SceneManager.catchException;SceneManager.catchException=function(t){DKTools_SceneManager_catchException.call(this,t),t instanceof Error&&DKToolsParam.get("Print Detailed Error","Enabled")&&Graphics.printDetailedError(t),DKTools.Utils.logError(t),DKToolsParam.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()};const DKTools_SceneManager_onError=SceneManager.onError;SceneManager.onError=function(t){DKTools_SceneManager_onError.call(this,t),DKTools.Utils.logError(t),DKToolsParam.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()},SceneManager.changeScene=function(){this.isSceneChanging()&&!this.isCurrentSceneBusy()&&(this._scene&&(this._scene.terminate(),this._scene.detachReservation(),this._previousClass=this._scene.constructor),this._scene=this._nextScene,this._scene&&(this._scene.attachReservation(),this._scene.startPreloading(),this._sceneCreated=!1,this._sceneStarted=!1,this._nextScene=null,this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate())),this._exiting&&this.terminate())},SceneManager.updateScene=function(){if(this._scene){if(!this._sceneCreated&&this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate()),this._sceneCreated&&!this._sceneStarted)try{this._scene.isReady()&&(this._scene.start(),this._sceneStarted=!0,this.onSceneStart())}catch(t){console.error(t),DKTools.Utils.logError(t),this._scene.start(),this._sceneStarted=!0,this.onSceneStart()}this.isCurrentSceneStarted()&&this._scene.update()}},SceneManager.isCurrentScene=function(t){return!!this._scene&&this._scene.constructor===t};const DKTools_SceneManager_goto=SceneManager.goto;SceneManager.goto=function(t){DKTools_SceneManager_goto.call(this,t),DKTools.Utils.__hideGrid()};const DKTools_Scene_Base_initialize=Scene_Base.prototype.initialize;Scene_Base.prototype.initialize=function(){DKTools_Scene_Base_initialize.call(this),this._preloader=new DKTools.Scene.Preloader},Scene_Base.prototype.activate=function(){this._active=!0},Scene_Base.prototype.deactivate=function(){this._active=!1},Scene_Base.prototype.isPreloaded=function(){return this._preloader.isReady()};const DKTools_Scene_Base_isReady=Scene_Base.prototype.isReady;Scene_Base.prototype.isReady=function(){return DKTools_Scene_Base_isReady.call(this)&&this.isPreloaded()},Scene_Base.prototype.setupPreloading=function(){},Scene_Base.prototype.startPreloading=function(){this.setupPreloading(),this._preloader.start()};const DKTools_Scene_Base_terminate=Scene_Base.prototype.terminate;Scene_Base.prototype.terminate=function(){DKTools_Scene_Base_terminate.call(this),this._preloader.finish()};const DKTools_Scene_Boot_create=Scene_Boot.prototype.create;Scene_Boot.prototype.create=function(){DKTools_Scene_Boot_create.call(this);const t=DKToolsParam.get("Preload Manager","Progress Bar");this._showProgressBar=t.Enabled&&DKTools.PreloadManager.isEnabled(),this._showProgressBar&&(t.Background&&(this._background=new DKTools.Sprite,this._background.loadSystem(t.Background),this.addChild(this._background)),this.createProgressBar(t))},Scene_Boot.prototype.createProgressBar=function(params){const width=eval(params["Progress Bar Width"]),height=eval(params["Progress Bar Height"]),x=eval(params["Progress Bar X"]),y=eval(params["Progress Bar Y"]);this._progressBar=new DKTools.Sprite.ProgressBar.Rectangle(x,y,width,height),this._progressBar.setupBackgroundColor(params["Progress Bar Background Color"]),this._progressBar.setupProgressColor(params["Progress Bar Progress Color"]),this._progressBar.setupMaxValue(DKTools.PreloadManager.getTotal()),this._progressBar.setupValue(0),this._progressBar.start(),this._progressBar.setupDrawTextHandler(function(){const t=params["Progress Bar Text"].format(...this._data);this.drawText(t,{height:this.height})}.bind(this._progressBar)),this.addChild(this._progressBar)};const DKTools_Scene_Boot_isReady=Scene_Boot.prototype.isReady;Scene_Boot.prototype.isReady=function(){return!(!DKTools_Scene_Boot_isReady.call(this)||!DKTools.StartupManager.isReady())&&(!!this._showProgressBar||DKTools.PreloadManager.isReady())};const DKTools_Scene_Boot_start=Scene_Boot.prototype.start;Scene_Boot.prototype.start=function(){if(this._showProgressBar&&!DKTools.PreloadManager.isFinished()){const t=DKTools.PreloadManager.getTotal(),e=180,i=t>e?1:Math.ceil(e/t);return DKTools.PreloadManager.onFileLoad(t=>{this._progressBar.addEvent({type:"queue",repeats:0,repeatTime:i,onStart:()=>{this._progressBar._data=[t.file.url,t.loaded,t.total],this._progressBar.nextValue()}})}),this._progressBar.addOneTimeEvent({type:"full",onSuccess:()=>{this.start()}}),void DKTools.PreloadManager.start()}const t=DKToolsParam.get("Quick Start");t.Enabled?(DKTools_Scene_Boot_start.call(this),DataManager.isBattleTest()||DataManager.isEventTest()||!t["Skip Saves"]&&DataManager.isAnySavefileExists()||(Scene_Base.prototype.start.call(this),SoundManager.preloadImportantSounds(),this.checkPlayerLocation(),DataManager.setupNewGame(),this.updateDocumentTitle(),SceneManager.goto(window[t["Scene Name"]]))):DKTools_Scene_Boot_start.call(this)};const DKTools_Scene_Map_isReady=Scene_Map.prototype.isReady;Scene_Map.prototype.isReady=function(){return!!this.isPreloaded()&&DKTools_Scene_Map_isReady.call(this)};const DKTools_Game_Map_tileWidth=Game_Map.prototype.tileWidth;Game_Map.prototype.tileWidth=function(){return Tilemap.TILE_WIDTH||DKTools_Game_Map_tileWidth.call(this)};const DKTools_Game_Map_tileHeight=Game_Map.prototype.tileHeight;Game_Map.prototype.tileHeight=function(){return Tilemap.TILE_HEIGHT||DKTools_Game_Map_tileHeight.call(this)};const DKTools_Game_Interpreter_pluginCommand=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(t,e){DKTools_Game_Interpreter_pluginCommand.call(this,t,e),DKTools.PluginCommandManager.process(this,t,e)},DKToolsParam.get("Font Size","Enabled")&&(Window_Base.prototype.standardFontSize=function(){return DKToolsParam.get("Font Size","Size")},DKTools.Sprite.prototype.standardFontSize=function(){try{return Window_Base.prototype.standardFontSize.call(this)}catch(t){return DKToolsParam.get("Font Size","Size")}}),DKToolsParam.get("Line Height","Enabled")&&(Window_Base.prototype.lineHeight=function(){return DKToolsParam.get("Line Height","Height")},DKTools.Base.prototype.getLineHeight=function(){try{return Window_Base.prototype.lineHeight.call(this)}catch(t){return DKToolsParam.get("Line Height","Height")}},DKTools.Sprite.prototype.getLineHeight=function(){return DKTools.Base.prototype.getLineHeight.call(this)},DKTools.Window.prototype.getLineHeight=function(){return DKTools.Base.prototype.getLineHeight.call(this)}),DKToolsParam.get("Window Padding","Enabled")&&(Window_Base.prototype.standardPadding=function(){return DKToolsParam.get("Window Padding","Padding")})}).call(this,__webpack_require__(1)(module))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("nw.gui")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("os")},function(t,e){t.exports=require("path")}]); \ No newline at end of file diff --git a/release/DKTools.js b/release/DKTools.js index c4b2800..22c8b4a 100644 --- a/release/DKTools.js +++ b/release/DKTools.js @@ -1 +1 @@ -!function(t){var e={};function i(n){if(e[n])return e[n].exports;var s=e[n]={i:n,l:!1,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.l=!0,s.exports}i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)i.d(n,s,function(e){return t[e]}.bind(null,s));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";(function(t){var n;window.Imported=window.Imported||{},window.Imported.DKTools="8.2.0",function(){function s(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function r(t,e,i,n){for(var s=-1,r=null==t?0:t.length;++s"']/g,q=RegExp(G.source),$=RegExp(X.source),Y=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,Z=/<%=([\s\S]+?)%>/g,Q=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,tt=/^\w*$/,et=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,it=/[\\^$.*+?()[\]{}|]/g,nt=RegExp(it.source),st=/^\s+|\s+$/g,rt=/^\s+/,ot=/\s+$/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,lt=/\{\n\/\* \[wrapped with (.+)\] \*/,ht=/,? & /,ut=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/\\(\\)?/g,pt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,dt=/\w*$/,ft=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,_t=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,yt=/^(?:0|[1-9]\d*)$/,Tt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,Dt=/($^)/,vt=/['\n\r\u2028\u2029\\]/g,wt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",St="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+wt,bt=RegExp("['’]","g"),Kt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),At=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+wt,"g"),Ot=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",St].join("|"),"g"),It=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),Ct=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,Et="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),xt={};xt["[object Float32Array]"]=xt["[object Float64Array]"]=xt["[object Int8Array]"]=xt["[object Int16Array]"]=xt["[object Int32Array]"]=xt["[object Uint8Array]"]=xt["[object Uint8ClampedArray]"]=xt["[object Uint16Array]"]=xt["[object Uint32Array]"]=!0,xt["[object Arguments]"]=xt["[object Array]"]=xt["[object ArrayBuffer]"]=xt["[object Boolean]"]=xt["[object DataView]"]=xt["[object Date]"]=xt["[object Error]"]=xt["[object Function]"]=xt["[object Map]"]=xt["[object Number]"]=xt["[object Object]"]=xt["[object RegExp]"]=xt["[object Set]"]=xt["[object String]"]=xt["[object WeakMap]"]=!1;var Pt={};Pt["[object Arguments]"]=Pt["[object Array]"]=Pt["[object ArrayBuffer]"]=Pt["[object DataView]"]=Pt["[object Boolean]"]=Pt["[object Date]"]=Pt["[object Float32Array]"]=Pt["[object Float64Array]"]=Pt["[object Int8Array]"]=Pt["[object Int16Array]"]=Pt["[object Int32Array]"]=Pt["[object Map]"]=Pt["[object Number]"]=Pt["[object Object]"]=Pt["[object RegExp]"]=Pt["[object Set]"]=Pt["[object String]"]=Pt["[object Symbol]"]=Pt["[object Uint8Array]"]=Pt["[object Uint8ClampedArray]"]=Pt["[object Uint16Array]"]=Pt["[object Uint32Array]"]=!0,Pt["[object Error]"]=Pt["[object Function]"]=Pt["[object WeakMap]"]=!1;var Rt={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Mt=parseFloat,Bt=parseInt,Ft="object"==typeof global&&global&&global.Object===Object&&global,Lt="object"==typeof self&&self&&self.Object===Object&&self,Ht=Ft||Lt||Function("return this")(),kt=e&&!e.nodeType&&e,Ut=kt&&"object"==typeof t&&t&&!t.nodeType&&t,Wt=Ut&&Ut.exports===kt,jt=Wt&&Ft.process,Nt=function(){try{var t=Ut&&Ut.require&&Ut.require("util").types;return t||jt&&jt.binding&&jt.binding("util")}catch(t){}}(),zt=Nt&&Nt.isArrayBuffer,Vt=Nt&&Nt.isDate,Gt=Nt&&Nt.isMap,Xt=Nt&&Nt.isRegExp,qt=Nt&&Nt.isSet,$t=Nt&&Nt.isTypedArray,Yt=w("length"),Jt=S({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),Zt=S({"&":"&","<":"<",">":">",'"':""","'":"'"}),Qt=S({"&":"&","<":"<",">":">",""":'"',"'":"'"}),te=function t(e){function i(t){if(Nn(t)&&!xo(t)&&!(t instanceof wt)){if(t instanceof S)return t;if(xs.call(t,"__wrapped__"))return gn(t)}return new S(t)}function n(){}function S(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=k}function wt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function St(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function oe(t,e,i,n,s,r){var a,l=1&e,h=2&e,u=4&e;if(i&&(a=s?i(t,n,s,r):i(t)),a!==k)return a;if(!jn(t))return t;if(n=xo(t)){if(a=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&xs.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return fi(t,a)}else{var c=Ur(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(Ro(t))return li(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!s){if(a=h||p?{}:Zi(t),!l)return h?function(t,e){return gi(t,kr(t),e)}(t,function(t,e){return t&&gi(e,ss(e),t)}(a,t)):function(t,e){return gi(t,Hr(t),e)}(t,ie(a,t))}else{if(!Pt[c])return s?t:{};a=function(t,e,i){var n=t.constructor;switch(e){case"[object ArrayBuffer]":return hi(t);case"[object Boolean]":case"[object Date]":return new n(+t);case"[object DataView]":return e=i?hi(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ui(t,i);case"[object Map]":return new n;case"[object Number]":case"[object String]":return new n(t);case"[object RegExp]":return(e=new t.constructor(t.source,dt.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new n;case"[object Symbol]":return Ar?Ss(Ar.call(t)):{}}}(t,c,l)}}if(r||(r=new Lt),s=r.get(t))return s;if(r.set(t,a),Lo(t))return t.forEach(function(n){a.add(oe(n,e,i,n,t,r))}),a;if(Bo(t))return t.forEach(function(n,s){a.set(s,oe(n,e,i,s,t,r))}),a;h=u?h?zi:Ni:h?ss:ns;var d=n?k:h(t);return o(d||t,function(n,s){d&&(n=t[s=n]),Nt(a,s,oe(n,e,i,s,t,r))}),a}function ae(t,e,i){var n=i.length;if(null==t)return!n;for(t=Ss(t);n--;){var s=i[n],r=e[s],o=t[s];if(o===k&&!(s in t)||!r(o))return!1}return!0}function le(t,e,i){if("function"!=typeof t)throw new As("Expected a function");return Nr(function(){t.apply(k,i)},e)}function he(t,e,i,n){var s=-1,r=h,o=!0,a=t.length,l=[],p=e.length;if(!a)return l;i&&(e=c(e,O(i))),n?(r=u,o=!1):200<=e.length&&(r=C,o=!1,e=new Ft(e));t:for(;++se}function ve(t,e){return null!=t&&xs.call(t,e)}function we(t,e){return null!=t&&e in Ss(t)}function Se(t,e,i){for(var n=i?u:h,s=t[0].length,r=t.length,o=r,a=ys(r),l=1/0,p=[];o--;){var d=t[o];o&&e&&(d=c(d,O(e))),l=ar(d.length,l),a[o]=!i&&(e||120<=s&&120<=d.length)?new Ft(o&&d):k}d=t[0];var f=-1,g=a[0];t:for(;++f(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))?t:t[pn(Dn(e))])?k:s(e,t,i)}function Ke(t){return Nn(t)&&"[object Arguments]"==Te(t)}function Ae(t,e,i,n,s){if(t===e)return!0;if(null==t||null==e||!Nn(t)&&!Nn(e))return t!=t&&e!=e;t:{var r=xo(t),o=xo(e),a=r?"[object Array]":Ur(t),l=o?"[object Array]":Ur(e),h="[object Object]"==(a="[object Arguments]"==a?"[object Object]":a);o="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l);if((l=a==l)&&Ro(t)){if(!Ro(e)){e=!1;break t}r=!0,h=!1}if(l&&!h)s||(s=new Lt),e=r||Ho(t)?Wi(t,e,i,n,Ae,s):function(t,e,i,n,s,r,o){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new Us(t),new Us(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Bn(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=R;case"[object Set]":if(a||(a=F),t.size!=e.size&&!(1&n))break;return(i=o.get(t))?i==e:(n|=2,o.set(t,e),e=Wi(a(t),a(e),n,s,r,o),o.delete(t),e);case"[object Symbol]":if(Ar)return Ar.call(t)==Ar.call(e)}return!1}(t,e,a,i,n,Ae,s);else{if(!(1&i)&&(r=h&&xs.call(t,"__wrapped__"),a=o&&xs.call(e,"__wrapped__"),r||a)){t=r?t.value():t,e=a?e.value():e,s||(s=new Lt),e=Ae(t,e,i,n,s);break t}if(l)e:if(s||(s=new Lt),r=1&i,a=Ni(t),o=a.length,l=Ni(e).length,o==l||r){for(h=o;h--;){var u=a[h];if(!(r?u in e:xs.call(e,u))){e=!1;break e}}if((l=s.get(t))&&s.get(e))e=l==e;else{l=!0,s.set(t,e),s.set(e,t);for(var c=r;++he?i:0,i)?t[e]:k}function Le(t,e,i){var n=-1;return e=c(e.length?e:[cs],O(Xi())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].c;return t}(t=Pe(t,function(t,i,s){return{a:c(e,function(e){return e(t)}),b:++n,c:t}}),function(t,e){var n;t:{n=-1;for(var s=t.a,r=e.a,o=s.length,a=i.length;++n=a){n=l;break t}n=l*("desc"==i[n]?-1:1);break t}}n=t.b-e.b}return n})}function He(t,e,i){for(var n=-1,s=e.length,r={};++ne||9007199254740991e&&(e=-e>s?0:s+e),0>(i=i>s?s:i)&&(i+=s),s=e>i?0:i-e>>>0,e>>>=0,i=ys(s);++n=s){for(;n>>1,o=t[r];null!==o&&!Xn(o)&&(i?o<=e:o(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))||delete t[pn(Dn(e))]}function ti(t,e,i,n){for(var s=t.length,r=n?s:-1;(n?r--:++rn)return n?Ze(t[0]):[];for(var s=-1,r=ys(n);++s=n?t:Ve(t,e,i)}function li(t,e){if(e)return t.slice();var i=t.length;i=Ws?Ws(i):new t.constructor(i);return t.copy(i),i}function hi(t){var e=new t.constructor(t.byteLength);return new Us(e).set(new Us(t)),e}function ui(t,e){return new t.constructor(e?hi(t.buffer):t.buffer,t.byteOffset,t.length)}function ci(t,e){if(t!==e){var i=t!==k,n=null===t,s=t==t,r=Xn(t),o=e!==k,a=null===e,l=e==e,h=Xn(e);if(!a&&!h&&!r&&t>e||r&&o&&l&&!a&&!h||n&&o&&l||!i&&l||!s)return 1;if(!n&&!r&&!h&&ts?k:r,s=1),e=Ss(e);++no&&a[0]!==h&&a[o-1]!==h?[]:B(a,h)).length)i?i?je(e,t):e:(i=je(e,Qs(t/L(e))),It.test(e)?ai(H(i),0,t).join(""):i.slice(0,t))}function xi(t,e,i,n){var r=1&e,o=wi(t);return function e(){for(var a=-1,l=arguments.length,h=-1,u=n.length,c=ys(u+l),p=this&&this!==Ht&&this instanceof e?o:t;++he||n)&&(1&t&&(r[2]=p[2],e|=1&i?0:4),(i=p[3])&&(n=r[3],r[3]=n?pi(n,i,p[4]):i,r[4]=n?B(r[3],"__lodash_placeholder__"):p[4]),(i=p[5])&&(n=r[5],r[5]=n?di(n,i,p[6]):i,r[6]=n?B(r[5],"__lodash_placeholder__"):p[6]),(i=p[7])&&(r[7]=i),128&t&&(r[8]=null==r[8]?p[8]:ar(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=e),t=r[0],e=r[1],i=r[2],n=r[3],s=r[4],!(a=r[9]=r[9]===k?l?0:t.length:or(r[9]-h,0))&&24&e&&(e&=-25),l=e&&1!=e?8==e||16==e?Si(t,e,a):32!=e&&33!=e||s.length?Ai.apply(k,r):xi(t,e,i,n):function(t,e,i){var n=1&e,s=wi(t);return function e(){return(this&&this!==Ht&&this instanceof e?s:t).apply(n?i:this,arguments)}}(t,e,i),hn((p?Rr:jr)(l,r),t,e)}function Hi(t,e,i,n){return t===k||Bn(t,Is[i])&&!xs.call(n,i)?e:t}function ki(t,e,i,n,s,r){return jn(t)&&jn(e)&&(r.set(e,t),Be(t,e,k,ki,r),r.delete(e)),t}function Ui(t){return Vn(t)?k:t}function Wi(t,e,i,n,s,r){var o=1&i,a=t.length;if(a!=(l=e.length)&&!(o&&l>a))return!1;if((l=r.get(t))&&r.get(e))return l==e;var l=-1,h=!0,u=2&i?new Ft:k;for(r.set(t,e),r.set(e,t);++l(i=null==i?0:Yn(i))&&(i=or(n+i,0)),m(t,Xi(e,3),i)):-1}function mn(t,e,i){var n=null==t?0:t.length;if(!n)return-1;var s=n-1;return i!==k&&(s=Yn(i),s=0>i?or(n+s,0):ar(s,n-1)),m(t,Xi(e,3),s,!0)}function yn(t){return null!=t&&t.length?de(t,1):[]}function Tn(t){return t&&t.length?t[0]:k}function Dn(t){var e=null==t?0:t.length;return e?t[e-1]:k}function vn(t,e){return t&&t.length&&e&&e.length?ke(t,e):t}function wn(t){return null==t?t:cr.call(t)}function Sn(t){if(!t||!t.length)return[];var e=0;return t=l(t,function(t){if(Ln(t))return e=or(t.length,e),!0}),A(e,function(e){return c(t,w(e))})}function bn(t,e){if(!t||!t.length)return[];var i=Sn(t);return null==e?i:c(i,function(t){return s(e,k,t)})}function Kn(t){return(t=i(t)).__chain__=!0,t}function An(t,e){return e(t)}function On(t,e){return(xo(t)?o:Cr)(t,Xi(e,3))}function In(t,e){return(xo(t)?function(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}:Er)(t,Xi(e,3))}function Cn(t,e){return(xo(t)?c:Pe)(t,Xi(e,3))}function En(t,e,i){return e=i?k:e,e=t&&null==e?t.length:e,Li(t,128,k,k,k,k,e)}function xn(t,e){var i;if("function"!=typeof e)throw new As("Expected a function");return t=Yn(t),function(){return 0<--t&&(i=e.apply(this,arguments)),1>=t&&(e=k),i}}function Pn(t,e,i){function n(e){var i=l,n=h;return l=h=k,f=e,c=t.apply(n,i)}function s(t){var i=t-d;return t-=f,d===k||i>=e||0>i||_&&t>=u}function r(){var t=To();if(s(t))return o(t);var i,n=Nr;i=t-f,t=e-(t-d),i=_?ar(t,u-i):t,p=n(r,i)}function o(t){return p=k,m&&l?n(t):(l=h=k,c)}function a(){var t=To(),i=s(t);if(l=arguments,h=this,d=t,i){if(p===k)return f=t=d,p=Nr(r,e),g?n(t):c;if(_)return p=Nr(r,e),n(d)}return p===k&&(p=Nr(r,e)),c}var l,h,u,c,p,d,f=0,g=!1,_=!1,m=!0;if("function"!=typeof t)throw new As("Expected a function");return e=Zn(e)||0,jn(i)&&(g=!!i.leading,u=(_="maxWait"in i)?or(Zn(i.maxWait)||0,e):u,m="trailing"in i?!!i.trailing:m),a.cancel=function(){p!==k&&Br(p),f=0,l=d=h=p=k},a.flush=function(){return p===k?c:o(To())},a}function Rn(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new As("Expected a function");var i=function(){var n=arguments,s=e?e.apply(this,n):n[0],r=i.cache;return r.has(s)?r.get(s):(n=t.apply(this,n),i.cache=r.set(s,n)||r,n)};return i.cache=new(Rn.Cache||Rt),i}function Mn(t){if("function"!=typeof t)throw new As("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Bn(t,e){return t===e||t!=t&&e!=e}function Fn(t){return null!=t&&Wn(t.length)&&!kn(t)}function Ln(t){return Nn(t)&&Fn(t)}function Hn(t){if(!Nn(t))return!1;var e=Te(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Vn(t)}function kn(t){return!!jn(t)&&("[object Function]"==(t=Te(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function Un(t){return"number"==typeof t&&t==Yn(t)}function Wn(t){return"number"==typeof t&&-1=t}function jn(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Nn(t){return null!=t&&"object"==typeof t}function zn(t){return"number"==typeof t||Nn(t)&&"[object Number]"==Te(t)}function Vn(t){return!(!Nn(t)||"[object Object]"!=Te(t))&&(null===(t=js(t))||"function"==typeof(t=xs.call(t,"constructor")&&t.constructor)&&t instanceof t&&Es.call(t)==Bs)}function Gn(t){return"string"==typeof t||!xo(t)&&Nn(t)&&"[object String]"==Te(t)}function Xn(t){return"symbol"==typeof t||Nn(t)&&"[object Symbol]"==Te(t)}function qn(t){if(!t)return[];if(Fn(t))return Gn(t)?H(t):fi(t);if(Xs&&t[Xs]){t=t[Xs]();for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}return("[object Map]"==(e=Ur(t))?R:"[object Set]"==e?F:os)(t)}function $n(t){return t?(t=Zn(t))===U||t===-U?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}function Yn(t){var e=(t=$n(t))%1;return t==t?e?t-e:t:0}function Jn(t){return t?re(Yn(t),0,4294967295):0}function Zn(t){if("number"==typeof t)return t;if(Xn(t))return W;if(jn(t)&&(t=jn(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace(st,"");var e=gt.test(t);return e||mt.test(t)?Bt(t.slice(2),e?2:8):ft.test(t)?W:+t}function Qn(t){return gi(t,ss(t))}function ts(t){return null==t?"":Je(t)}function es(t,e,i){return(t=null==t?k:me(t,e))===k?i:t}function is(t,e){return null!=t&&Ji(t,e,we)}function ns(t){return Fn(t)?kt(t):Ee(t)}function ss(t){if(Fn(t))t=kt(t,!0);else if(jn(t)){var e,i=rn(t),n=[];for(e in t)("constructor"!=e||!i&&xs.call(t,e))&&n.push(e);t=n}else{if(e=[],null!=t)for(i in Ss(t))e.push(i);t=e}return t}function rs(t,e){if(null==t)return{};var i=c(zi(t),function(t){return[t]});return e=Xi(e),He(t,i,function(t,i){return e(t,i[0])})}function os(t){return null==t?[]:I(t,ns(t))}function as(t){return ua(ts(t).toLowerCase())}function ls(t){return(t=ts(t))&&t.replace(Tt,Jt).replace(Kt,"")}function hs(t,e,i){return t=ts(t),(e=i?k:e)===k?Ct.test(t)?t.match(Ot)||[]:t.match(ut)||[]:t.match(e)||[]}function us(t){return function(){return t}}function cs(t){return t}function ps(t){return Ce("function"==typeof t?t:oe(t,1))}function ds(t,e,i){var n=ns(e),s=_e(e,n);null!=i||jn(e)&&(s.length||!n.length)||(i=e,e=t,t=this,s=_e(e,ns(e)));var r=!(jn(i)&&"chain"in i&&!i.chain),a=kn(t);return o(s,function(i){var n=e[i];t[i]=n,a&&(t.prototype[i]=function(){var e=this.__chain__;if(r||e){var i=t(this.__wrapped__);return(i.__actions__=fi(this.__actions__)).push({func:n,args:arguments,thisArg:t}),i.__chain__=e,i}return n.apply(t,p([this.value()],arguments))})}),t}function fs(){}function gs(t){return nn(t)?w(pn(t)):function(t){return function(e){return me(e,t)}}(t)}function _s(){return[]}function ms(){return!1}var ys=(e=null==e?Ht:te.defaults(Ht.Object(),e,te.pick(Ht,Et))).Array,Ts=e.Date,Ds=e.Error,vs=e.Function,ws=e.Math,Ss=e.Object,bs=e.RegExp,Ks=e.String,As=e.TypeError,Os=ys.prototype,Is=Ss.prototype,Cs=e["__core-js_shared__"],Es=vs.prototype.toString,xs=Is.hasOwnProperty,Ps=0,Rs=function(){var t=/[^.]+$/.exec(Cs&&Cs.keys&&Cs.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Ms=Is.toString,Bs=Es.call(Ss),Fs=Ht._,Ls=bs("^"+Es.call(xs).replace(it,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hs=Wt?e.Buffer:k,ks=e.Symbol,Us=e.Uint8Array,Ws=Hs?Hs.allocUnsafe:k,js=M(Ss.getPrototypeOf,Ss),Ns=Ss.create,zs=Is.propertyIsEnumerable,Vs=Os.splice,Gs=ks?ks.isConcatSpreadable:k,Xs=ks?ks.iterator:k,qs=ks?ks.toStringTag:k,$s=function(){try{var t=Yi(Ss,"defineProperty");return t({},"",{}),t}catch(t){}}(),Ys=e.clearTimeout!==Ht.clearTimeout&&e.clearTimeout,Js=Ts&&Ts.now!==Ht.Date.now&&Ts.now,Zs=e.setTimeout!==Ht.setTimeout&&e.setTimeout,Qs=ws.ceil,tr=ws.floor,er=Ss.getOwnPropertySymbols,ir=Hs?Hs.isBuffer:k,nr=e.isFinite,sr=Os.join,rr=M(Ss.keys,Ss),or=ws.max,ar=ws.min,lr=Ts.now,hr=e.parseInt,ur=ws.random,cr=Os.reverse,pr=Yi(e,"DataView"),dr=Yi(e,"Map"),fr=Yi(e,"Promise"),gr=Yi(e,"Set"),_r=Yi(e,"WeakMap"),mr=Yi(Ss,"create"),yr=_r&&new _r,Tr={},Dr=dn(pr),vr=dn(dr),wr=dn(fr),Sr=dn(gr),br=dn(_r),Kr=ks?ks.prototype:k,Ar=Kr?Kr.valueOf:k,Or=Kr?Kr.toString:k,Ir=function(){function t(){}return function(e){return jn(e)?Ns?Ns(e):(t.prototype=e,e=new t,t.prototype=k,e):{}}}();i.templateSettings={escape:Y,evaluate:J,interpolate:Z,variable:"",imports:{_:i}},i.prototype=n.prototype,i.prototype.constructor=i,S.prototype=Ir(n.prototype),S.prototype.constructor=S,wt.prototype=Ir(n.prototype),wt.prototype.constructor=wt,St.prototype.clear=function(){this.__data__=mr?mr(null):{},this.size=0},St.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},St.prototype.get=function(t){var e=this.__data__;return mr?"__lodash_hash_undefined__"===(t=e[t])?k:t:xs.call(e,t)?e[t]:k},St.prototype.has=function(t){var e=this.__data__;return mr?e[t]!==k:xs.call(e,t)},St.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=mr&&e===k?"__lodash_hash_undefined__":e,this},At.prototype.clear=function(){this.__data__=[],this.size=0},At.prototype.delete=function(t){var e=this.__data__;return!(0>(t=Yt(e,t))||(t==e.length-1?e.pop():Vs.call(e,t,1),--this.size,0))},At.prototype.get=function(t){var e=this.__data__;return 0>(t=Yt(e,t))?k:e[t][1]},At.prototype.has=function(t){return-1n?(++this.size,i.push([t,e])):i[n][1]=e,this},Rt.prototype.clear=function(){this.size=0,this.__data__={hash:new St,map:new(dr||At),string:new St}},Rt.prototype.delete=function(t){return t=qi(this,t).delete(t),this.size-=t?1:0,t},Rt.prototype.get=function(t){return qi(this,t).get(t)},Rt.prototype.has=function(t){return qi(this,t).has(t)},Rt.prototype.set=function(t,e){var i=qi(this,t),n=i.size;return i.set(t,e),this.size+=i.size==n?0:1,this},Ft.prototype.add=Ft.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ft.prototype.has=function(t){return this.__data__.has(t)},Lt.prototype.clear=function(){this.__data__=new At,this.size=0},Lt.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},Lt.prototype.get=function(t){return this.__data__.get(t)},Lt.prototype.has=function(t){return this.__data__.has(t)},Lt.prototype.set=function(t,e){var i=this.__data__;if(i instanceof At){var n=i.__data__;if(!dr||199>n.length)return n.push([t,e]),this.size=++i.size,this;i=this.__data__=new Rt(n)}return i.set(t,e),this.size=i.size,this};var Cr=yi(fe),Er=yi(ge,!0),xr=Ti(),Pr=Ti(!0),Rr=yr?function(t,e){return yr.set(t,e),t}:cs,Mr=$s?function(t,e){return $s(t,"toString",{configurable:!0,enumerable:!1,value:us(e),writable:!0})}:cs,Br=Ys||function(t){return Ht.clearTimeout(t)},Fr=gr&&1/F(new gr([,-0]))[1]==U?function(t){return new gr(t)}:fs,Lr=yr?function(t){return yr.get(t)}:fs,Hr=er?function(t){return null==t?[]:(t=Ss(t),l(er(t),function(e){return zs.call(t,e)}))}:_s,kr=er?function(t){for(var e=[];t;)p(e,Hr(t)),t=js(t);return e}:_s,Ur=Te;(pr&&"[object DataView]"!=Ur(new pr(new ArrayBuffer(1)))||dr&&"[object Map]"!=Ur(new dr)||fr&&"[object Promise]"!=Ur(fr.resolve())||gr&&"[object Set]"!=Ur(new gr)||_r&&"[object WeakMap]"!=Ur(new _r))&&(Ur=function(t){var e=Te(t);if(t=(t="[object Object]"==e?t.constructor:k)?dn(t):"")switch(t){case Dr:return"[object DataView]";case vr:return"[object Map]";case wr:return"[object Promise]";case Sr:return"[object Set]";case br:return"[object WeakMap]"}return e});var Wr=Cs?kn:ms,jr=un(Rr),Nr=Zs||function(t,e){return Ht.setTimeout(t,e)},zr=un(Mr),Vr=function(t){var e=(t=Rn(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(et,function(t,i,n,s){e.push(n?s.replace(ct,"$1"):i||t)}),e}),Gr=Ne(function(t,e){return Ln(t)?he(t,de(e,1,Ln,!0)):[]}),Xr=Ne(function(t,e){var i=Dn(e);return Ln(i)&&(i=k),Ln(t)?he(t,de(e,1,Ln,!0),Xi(i,2)):[]}),qr=Ne(function(t,e){var i=Dn(e);return Ln(i)&&(i=k),Ln(t)?he(t,de(e,1,Ln,!0),k,i):[]}),$r=Ne(function(t){var e=c(t,si);return e.length&&e[0]===t[0]?Se(e):[]}),Yr=Ne(function(t){var e=Dn(t),i=c(t,si);return e===Dn(i)?e=k:i.pop(),i.length&&i[0]===t[0]?Se(i,Xi(e,2)):[]}),Jr=Ne(function(t){var e=Dn(t),i=c(t,si);return(e="function"==typeof e?e:k)&&i.pop(),i.length&&i[0]===t[0]?Se(i,k,e):[]}),Zr=Ne(vn),Qr=ji(function(t,e){var i=null==t?0:t.length,n=se(t,e);return Ue(t,c(e,function(t){return tn(t,i)?+t:t}).sort(ci)),n}),to=Ne(function(t){return Ze(de(t,1,Ln,!0))}),eo=Ne(function(t){var e=Dn(t);return Ln(e)&&(e=k),Ze(de(t,1,Ln,!0),Xi(e,2))}),io=Ne(function(t){var e="function"==typeof(e=Dn(t))?e:k;return Ze(de(t,1,Ln,!0),k,e)}),no=Ne(function(t,e){return Ln(t)?he(t,e):[]}),so=Ne(function(t){return ii(l(t,Ln))}),ro=Ne(function(t){var e=Dn(t);return Ln(e)&&(e=k),ii(l(t,Ln),Xi(e,2))}),oo=Ne(function(t){var e="function"==typeof(e=Dn(t))?e:k;return ii(l(t,Ln),k,e)}),ao=Ne(Sn),lo=Ne(function(t){var e;return bn(t,e="function"==typeof(e=1<(e=t.length)?t[e-1]:k)?(t.pop(),e):k)}),ho=ji(function(t){var e=t.length,i=e?t[0]:0,n=this.__wrapped__,s=function(e){return se(e,t)};return!(1=e}),Eo=Ke(function(){return arguments}())?Ke:function(t){return Nn(t)&&xs.call(t,"callee")&&!zs.call(t,"callee")},xo=ys.isArray,Po=zt?O(zt):function(t){return Nn(t)&&"[object ArrayBuffer]"==Te(t)},Ro=ir||ms,Mo=Vt?O(Vt):function(t){return Nn(t)&&"[object Date]"==Te(t)},Bo=Gt?O(Gt):function(t){return Nn(t)&&"[object Map]"==Ur(t)},Fo=Xt?O(Xt):function(t){return Nn(t)&&"[object RegExp]"==Te(t)},Lo=qt?O(qt):function(t){return Nn(t)&&"[object Set]"==Ur(t)},Ho=$t?O($t):function(t){return Nn(t)&&Wn(t.length)&&!!xt[Te(t)]},ko=Ri(xe),Uo=Ri(function(t,e){return t<=e}),Wo=mi(function(t,e){if(rn(e)||Fn(e))gi(e,ns(e),t);else for(var i in e)xs.call(e,i)&&Nt(t,i,e[i])}),jo=mi(function(t,e){gi(e,ss(e),t)}),No=mi(function(t,e,i,n){gi(e,ss(e),t,n)}),zo=mi(function(t,e,i,n){gi(e,ns(e),t,n)}),Vo=ji(se),Go=Ne(function(t,e){t=Ss(t);var i=-1,n=e.length;for((s=2--t)return e.apply(this,arguments)}},i.ary=En,i.assign=Wo,i.assignIn=jo,i.assignInWith=No,i.assignWith=zo,i.at=Vo,i.before=xn,i.bind=Do,i.bindAll=pa,i.bindKey=vo,i.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return xo(t)?t:[t]},i.chain=Kn,i.chunk=function(t,e,i){if(e=(i?en(t,e,i):e===k)?1:or(Yn(e),0),!(i=null==t?0:t.length)||1>e)return[];for(var n=0,s=0,r=ys(Qs(i/e));n(e=i||e===k?1:Yn(e))?0:e,n):[]},i.dropRight=function(t,e,i){var n=null==t?0:t.length;return n?Ve(t,0,0>(e=n-(e=i||e===k?1:Yn(e)))?0:e):[]},i.dropRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0,!0):[]},i.dropWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0):[]},i.fill=function(t,e,i,n){var s=null==t?0:t.length;if(!s)return[];for(i&&"number"!=typeof i&&en(t,e,i)&&(i=0,n=s),s=t.length,0>(i=Yn(i))&&(i=-i>s?0:s+i),0>(n=n===k||n>s?s:Yn(n))&&(n+=s),n=i>n?0:Jn(n);i>>0)?(t=ts(t))&&("string"==typeof e||null!=e&&!Fo(e))&&(!(e=Je(e))&&It.test(t))?ai(H(t),0,i):t.split(e,i):[]},i.spread=function(t,e){if("function"!=typeof t)throw new As("Expected a function");return e=null==e?0:or(Yn(e),0),Ne(function(i){var n=i[e];return i=ai(i,0,e),n&&p(i,n),s(t,this,i)})},i.tail=function(t){var e=null==t?0:t.length;return e?Ve(t,1,e):[]},i.take=function(t,e,i){return t&&t.length?Ve(t,0,0>(e=i||e===k?1:Yn(e))?0:e):[]},i.takeRight=function(t,e,i){var n=null==t?0:t.length;return n?Ve(t,0>(e=n-(e=i||e===k?1:Yn(e)))?0:e,n):[]},i.takeRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!1,!0):[]},i.takeWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3)):[]},i.tap=function(t,e){return e(t),t},i.throttle=function(t,e,i){var n=!0,s=!0;if("function"!=typeof t)throw new As("Expected a function");return jn(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),Pn(t,e,{leading:n,maxWait:e,trailing:s})},i.thru=An,i.toArray=qn,i.toPairs=ea,i.toPairsIn=ia,i.toPath=function(t){return xo(t)?c(t,pn):Xn(t)?[t]:fi(Vr(ts(t)))},i.toPlainObject=Qn,i.transform=function(t,e,i){var n=xo(t),s=n||Ro(t)||Ho(t);if(e=Xi(e,4),null==i){var r=t&&t.constructor;i=s?n?new r:[]:jn(t)&&kn(r)?Ir(js(t)):{}}return(s?o:fe)(t,function(t,n,s){return e(i,t,n,s)}),i},i.unary=function(t){return En(t,1)},i.union=to,i.unionBy=eo,i.unionWith=io,i.uniq=function(t){return t&&t.length?Ze(t):[]},i.uniqBy=function(t,e){return t&&t.length?Ze(t,Xi(e,2)):[]},i.uniqWith=function(t,e){return e="function"==typeof e?e:k,t&&t.length?Ze(t,k,e):[]},i.unset=function(t,e){return null==t||Qe(t,e)},i.unzip=Sn,i.unzipWith=bn,i.update=function(t,e,i){return null!=t&&(t=ze(t,e,(i=ri(i))(me(t,e)),void 0)),t},i.updateWith=function(t,e,i,n){return n="function"==typeof n?n:k,null!=t&&(t=ze(t,e,(i=ri(i))(me(t,e)),n)),t},i.values=os,i.valuesIn=function(t){return null==t?[]:I(t,ss(t))},i.without=no,i.words=hs,i.wrap=function(t,e){return Ko(ri(e),t)},i.xor=so,i.xorBy=ro,i.xorWith=oo,i.zip=ao,i.zipObject=function(t,e){return ni(t||[],e||[],Nt)},i.zipObjectDeep=function(t,e){return ni(t||[],e||[],ze)},i.zipWith=lo,i.entries=ea,i.entriesIn=ia,i.extend=jo,i.extendWith=No,ds(i,i),i.add=wa,i.attempt=ca,i.camelCase=na,i.capitalize=as,i.ceil=Sa,i.clamp=function(t,e,i){return i===k&&(i=e,e=k),i!==k&&(i=(i=Zn(i))==i?i:0),e!==k&&(e=(e=Zn(e))==e?e:0),re(Zn(t),e,i)},i.clone=function(t){return oe(t,4)},i.cloneDeep=function(t){return oe(t,5)},i.cloneDeepWith=function(t,e){return oe(t,5,e="function"==typeof e?e:k)},i.cloneWith=function(t,e){return oe(t,4,e="function"==typeof e?e:k)},i.conformsTo=function(t,e){return null==e||ae(t,e,ns(e))},i.deburr=ls,i.defaultTo=function(t,e){return null==t||t!=t?e:t},i.divide=ba,i.endsWith=function(t,e,i){t=ts(t),e=Je(e);var n=t.length;n=i=i===k?n:re(Yn(i),0,n);return 0<=(i-=e.length)&&t.slice(i,n)==e},i.eq=Bn,i.escape=function(t){return(t=ts(t))&&$.test(t)?t.replace(X,Zt):t},i.escapeRegExp=function(t){return(t=ts(t))&&nt.test(t)?t.replace(it,"\\$&"):t},i.every=function(t,e,i){var n=xo(t)?a:ue;return i&&en(t,e,i)&&(e=k),n(t,Xi(e,3))},i.find=co,i.findIndex=_n,i.findKey=function(t,e){return _(t,Xi(e,3),fe)},i.findLast=po,i.findLastIndex=mn,i.findLastKey=function(t,e){return _(t,Xi(e,3),ge)},i.floor=Ka,i.forEach=On,i.forEachRight=In,i.forIn=function(t,e){return null==t?t:xr(t,Xi(e,3),ss)},i.forInRight=function(t,e){return null==t?t:Pr(t,Xi(e,3),ss)},i.forOwn=function(t,e){return t&&fe(t,Xi(e,3))},i.forOwnRight=function(t,e){return t&&ge(t,Xi(e,3))},i.get=es,i.gt=Io,i.gte=Co,i.has=function(t,e){return null!=t&&Ji(t,e,ve)},i.hasIn=is,i.head=Tn,i.identity=cs,i.includes=function(t,e,i,n){return t=Fn(t)?t:os(t),i=i&&!n?Yn(i):0,n=t.length,0>i&&(i=or(n+i,0)),Gn(t)?i<=n&&-1(i=null==i?0:Yn(i))&&(i=or(n+i,0)),y(t,e,i)):-1},i.inRange=function(t,e,i){return e=$n(e),i===k?(i=e,e=0):i=$n(i),(t=Zn(t))>=ar(e,i)&&t=t},i.isSet=Lo,i.isString=Gn,i.isSymbol=Xn,i.isTypedArray=Ho,i.isUndefined=function(t){return t===k},i.isWeakMap=function(t){return Nn(t)&&"[object WeakMap]"==Ur(t)},i.isWeakSet=function(t){return Nn(t)&&"[object WeakSet]"==Te(t)},i.join=function(t,e){return null==t?"":sr.call(t,e)},i.kebabCase=sa,i.last=Dn,i.lastIndexOf=function(t,e,i){var n=null==t?0:t.length;if(!n)return-1;var s=n;if(i!==k&&(s=0>(s=Yn(i))?or(n+s,0):ar(s,n-1)),e==e)t:{for(i=s+1;i--;)if(t[i]===e){t=i;break t}t=i}else t=m(t,D,s,!0);return t},i.lowerCase=ra,i.lowerFirst=oa,i.lt=ko,i.lte=Uo,i.max=function(t){return t&&t.length?ce(t,cs,De):k},i.maxBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),De):k},i.mean=function(t){return v(t,cs)},i.meanBy=function(t,e){return v(t,Xi(e,2))},i.min=function(t){return t&&t.length?ce(t,cs,xe):k},i.minBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),xe):k},i.stubArray=_s,i.stubFalse=ms,i.stubObject=function(){return{}},i.stubString=function(){return""},i.stubTrue=function(){return!0},i.multiply=Aa,i.nth=function(t,e){return t&&t.length?Fe(t,Yn(e)):k},i.noConflict=function(){return Ht._===this&&(Ht._=Fs),this},i.noop=fs,i.now=To,i.pad=function(t,e,i){t=ts(t);var n=(e=Yn(e))?L(t):0;return!e||n>=e?t:Ei(tr(e=(e-n)/2),i)+t+Ei(Qs(e),i)},i.padEnd=function(t,e,i){t=ts(t);var n=(e=Yn(e))?L(t):0;return e&&ne){var n=t;t=e,e=n}return i||t%1||e%1?(i=ur(),ar(t+i*(e-t+Mt("1e-"+((i+"").length-1))),e)):We(t,e)},i.reduce=function(t,e,i){var n=xo(t)?d:b,s=3>arguments.length;return n(t,Xi(e,4),i,s,Cr)},i.reduceRight=function(t,e,i){var n=xo(t)?f:b,s=3>arguments.length;return n(t,Xi(e,4),i,s,Er)},i.repeat=function(t,e,i){return e=(i?en(t,e,i):e===k)?1:Yn(e),je(ts(t),e)},i.replace=function(){var t=arguments,e=ts(t[0]);return 3>t.length?e:e.replace(t[1],t[2])},i.result=function(t,e,i){var n=-1,s=(e=oi(e,t)).length;for(s||(s=1,t=k);++n(t=Yn(t))||9007199254740991=r)return t;if(1>(r=i-L(n)))return n;if(i=o?ai(o,0,r).join(""):t.slice(0,r),s===k)return i+n;if(o&&(r+=i.length-r),Fo(s)){if(t.slice(r).search(s)){var a=i;for(s.global||(s=bs(s.source,ts(dt.exec(s))+"g")),s.lastIndex=0;o=s.exec(a);)var l=o.index;i=i.slice(0,l===k?r:l)}}else t.indexOf(Je(s),r)!=r&&(-1<(s=i.lastIndexOf(s))&&(i=i.slice(0,s)));return i+n},i.unescape=function(t){return(t=ts(t))&&q.test(t)?t.replace(G,Qt):t},i.uniqueId=function(t){var e=++Ps;return ts(t)+e},i.upperCase=ha,i.upperFirst=ua,i.each=On,i.eachRight=In,i.first=Tn,ds(i,function(){var t={};return fe(i,function(e,n){xs.call(i.prototype,n)||(t[n]=e)}),t}(),{chain:!1}),i.VERSION="4.17.11",o("bind bindKey curry curryRight partial partialRight".split(" "),function(t){i[t].placeholder=i}),o(["drop","take"],function(t,e){wt.prototype[t]=function(i){i=i===k?1:or(Yn(i),0);var n=this.__filtered__&&!e?new wt(this):this.clone();return n.__filtered__?n.__takeCount__=ar(i,n.__takeCount__):n.__views__.push({size:ar(i,4294967295),type:t+(0>n.__dir__?"Right":"")}),n},wt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),o(["filter","map","takeWhile"],function(t,e){var i=e+1,n=1==i||3==i;wt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xi(t,3),type:i}),e.__filtered__=e.__filtered__||n,e}}),o(["head","last"],function(t,e){var i="take"+(e?"Right":"");wt.prototype[t]=function(){return this[i](1).value()[0]}}),o(["initial","tail"],function(t,e){var i="drop"+(e?"":"Right");wt.prototype[t]=function(){return this.__filtered__?new wt(this):this[i](1)}}),wt.prototype.compact=function(){return this.filter(cs)},wt.prototype.find=function(t){return this.filter(t).head()},wt.prototype.findLast=function(t){return this.reverse().find(t)},wt.prototype.invokeMap=Ne(function(t,e){return"function"==typeof t?new wt(this):this.map(function(i){return be(i,t,e)})}),wt.prototype.reject=function(t){return this.filter(Mn(Xi(t)))},wt.prototype.slice=function(t,e){t=Yn(t);var i=this;return i.__filtered__&&(0e)?new wt(i):(0>t?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==k&&(i=0>(e=Yn(e))?i.dropRight(-e):i.take(e-t)),i)},wt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},wt.prototype.toArray=function(){return this.take(4294967295)},fe(wt.prototype,function(t,e){var n=/^(?:filter|find|map|reject)|While$/.test(e),s=/^(?:head|last)$/.test(e),r=i[s?"take"+("last"==e?"Right":""):e],o=s||/^find/.test(e);r&&(i.prototype[e]=function(){var e=this.__wrapped__,a=s?[1]:arguments,l=e instanceof wt,h=a[0],u=l||xo(e),c=function(t){return t=r.apply(i,p([t],a)),s&&d?t[0]:t};u&&n&&"function"==typeof h&&1!=h.length&&(l=u=!1);var d=this.__chain__,f=!!this.__actions__.length;h=o&&!d,l=l&&!f;return!o&&u?(e=l?e:new wt(this),(e=t.apply(e,a)).__actions__.push({func:An,args:[c],thisArg:k}),new S(e,d)):h&&l?t.apply(this,a):(e=this.thru(c),h?s?e.value()[0]:e.value():e)})}),o("pop push shift sort splice unshift".split(" "),function(t){var e=Os[t],n=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",s=/^(?:pop|shift)$/.test(t);i.prototype[t]=function(){var t=arguments;if(s&&!this.__chain__){var i=this.value();return e.apply(xo(i)?i:[],t)}return this[n](function(i){return e.apply(xo(i)?i:[],t)})}}),fe(wt.prototype,function(t,e){var n=i[e];if(n){var s=n.name+"";(Tr[s]||(Tr[s]=[])).push({name:e,func:n})}}),Tr[Ai(k,2).name]=[{name:"wrapper",func:k}],wt.prototype.clone=function(){var t=new wt(this.__wrapped__);return t.__actions__=fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=fi(this.__views__),t},wt.prototype.reverse=function(){if(this.__filtered__){var t=new wt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},wt.prototype.value=function(){var t,e=this.__wrapped__.value(),i=this.__dir__,n=xo(e),s=0>i,r=n?e.length:0;t=0;for(var o=r,a=this.__views__,l=-1,h=a.length;++l=this.__values__.length;return{done:t,value:t?k:this.__values__[this.__index__++]}},i.prototype.plant=function(t){for(var e,i=this;i instanceof n;){var s=gn(i);s.__index__=0,s.__values__=k,e?r.__wrapped__=s:e=s;var r=s;i=i.__wrapped__}return r.__wrapped__=t,e},i.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof wt?(this.__actions__.length&&(t=new wt(this)),(t=t.reverse()).__actions__.push({func:An,args:[wn],thisArg:k}),new S(t,this.__chain__)):this.thru(wn)},i.prototype.toJSON=i.prototype.valueOf=i.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},i.prototype.first=i.prototype.head,Xs&&(i.prototype[Xs]=function(){return this}),i}();Ht._=te,void 0===(n=function(){return te}.call(e,i,e,t))||(t.exports=n)}.call(this),window.DKTools={},Object.defineProperties(DKTools,{SITE:{value:"https://dk-plugins.ru"},VERSION:{value:Imported.DKTools}}),DKTools.Sprite=function(t,e,i,n){this.initialize.apply(this,arguments)},DKTools.Window=function(t,e,i,n){this.initialize.apply(this,arguments)},DKTools.Scene=function(){this.initialize.apply(this,arguments)},DKTools.Utils=class{constructor(){return DKTools.Utils}static initialize(){this._saidHello=!1,this._isNwjs=Utils.isNwjs(),this._isTest=!!Utils.isOptionValid("test"),this._isMobileDevice=Utils.isMobileDevice(),this._isMobileSafari=Utils.isMobileSafari(),this._isAndroidChrome=Utils.isAndroidChrome(),this._gridSize=64,this._sayHello(),this.__tileSize(),this.__imageCacheLimit(),s.get("Debugging Console","Enabled")&&this.openConsole(),s.get("Check Updates","Enabled")&&this._checkUpdates()}static async _checkUpdates(){if(!this.isNwjs()||!this.isTest())return;let t=[];try{const e=new FormData;e.append("version",DKTools.VERSION),t=await DKTools.Network.fetchJson(`${DKTools.SITE}/plugins.php`,{method:"POST",body:e})}catch(t){return void console.error("DKTools can not check updates")}if(!t||0===t.length)return;const e=s.get("Check Updates","Show New Plugins");_.forEach(t,t=>{const i=t.version;if(DKTools.PluginManager.isRegistered(t.name)){if(i>DKTools.PluginManager.getVersion(t.name)){const e=[`Available a new version of ${t.name}: ${i} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}}else if(e){const e=[`Try the new plugin: ${t.name} \n`,`Description: ${t.description} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}})}static _getErrorLogData(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e}static __hideGrid(){this._gridSprite&&(SceneManager._scene.removeChild(this._gridSprite),this._gridSprite=null)}static __imageCacheLimit(){const t=s.get("Image Cache Limit");t.Enabled&&(ImageCache.limit=t.Limit)}static isAndroidChrome(){return this._isAndroidChrome}static isArrayLike(t){return!!Array.isArray(t)||"[object Arguments]"===String(t)}static isBoolean(t){return"boolean"==typeof t}static isFunction(t){return"function"==typeof t}static isMobileDevice(){return this._isMobileDevice}static isMobileSafari(){return this._isMobileSafari}static isNumber(t){return Number.isFinite(t)}static isNwjs(){return this._isNwjs}static isString(t){return!!t&&"string"==typeof t}static isTest(){return this._isTest}static async logError(t){if(!t||!this.isNwjs())return;const e=s.get("Errors Log"),i=DKTools.Utils.isTest(),n=e.Enabled;if("None"===n||"Only Game"===n&&i||"Only Test"===n&&!i)return;const r=DKTools.IO.fs,o=DKTools.IO.os;if(!r||!o)return;const a=1024*e["File Size"]*1024,l=e.Filename,h=new DKTools.IO.File(l),u=await h.getStatsAsync().then(t=>t.data);if(u&&u.size>a){const t=DKTools.IO.parsePath(l).name,e=new Date,i=String(e.getDate()).padZero(2),n=String(e.getMonth()+1).padZero(2),s=e.getFullYear(),r=String(e.getHours()).padZero(2),o=String(e.getMinutes()).padZero(2),a=String(e.getSeconds()).padZero(2);await h.renameAsync(`${i}.${n}.${s}_${r}.${o}.${a}_${t}`)}const c=await r.openSync(l,"a"),p=this._getErrorLogData();let d=`Date: ${(new Date).toString()}`+o.EOL;_.forEach(p,(t,e)=>{d+=e+": "+t+o.EOL}),t instanceof Object?(d+=`Name: ${t.name}`+o.EOL,d+=`Message: ${t.message}`+o.EOL,void 0!==t.filename&&(d+=`Filename: ${t.filename}`+o.EOL),void 0!==t.lineNumber&&(d+=`Line: ${t.lineNumber}`+o.EOL),void 0!==t.columnNumber&&(d+=`Column: ${t.columnNumber}`+o.EOL),d+=`Stack: ${t.stack}`+o.EOL+o.EOL):d+=`Error: ${t}`+o.EOL+o.EOL,await r.writeSync(c,d),await r.closeSync(c)}static makeScreenshot(){if(!this.isNwjs())return;const t=s.get("Screenshots"),e=t.Path,i=t.Type,n=t.Quality,r=SceneManager.snap().canvas.toDataURL("image/"+i,n),o=new RegExp(`^data:image/${i};base64,`),a=r.replace(o,""),l=new Date;let h=t.Filename;const u=(h=(h=(h=(h=(h=(h=h.replace(/%year/gi,l.getFullYear())).replace(/%month/gi,l.getMonth()+1)).replace(/%day/gi,l.getDate())).replace(/%hours/gi,l.getHours())).replace(/%minutes/gi,l.getMinutes())).replace(/%seconds/gi,l.getSeconds()))+"."+i,c=DKTools.IO.normalizePath(e+"/"+u);new DKTools.IO.File(c).save(a,{createDirectory:!0,options:"base64"}),console.log("The screenshot is saved with the name: "+u)}static mixin(t,e){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}static openConsole(){if(this.isTest()&&this.isNwjs())try{const t=i(2).Window.get();t.showDevTools(null,()=>t.focus())}catch(t){this.logError(t),console.error("DKTools can not open the console")}}static __tileSize(){const t=s.get("Tile Size");t.Enabled&&(Tilemap.TILE_WIDTH=t.Size,Tilemap.TILE_HEIGHT=t.Size)}static throwError(t){setTimeout(()=>{throw t},0)}static __quickLoad(){if(!DKTools.Utils.isTest()||!s.get("Quick Load","Enabled"))return;const t=s.get("Quick Load","Savefile ID"),e=SceneManager._scene;t>0?DataManager.loadGame(t)&&(SoundManager.playLoad(),e instanceof Scene_Base&&e.fadeOutAll(),$gameSystem.versionId()!==$dataSystem.versionId&&($gamePlayer.reserveTransfer($gameMap.mapId(),$gamePlayer.x,$gamePlayer.y),$gamePlayer.requestMapReload()),SceneManager.goto(Scene_Map)):e instanceof Scene_Load||SceneManager.push(Scene_Load)}static _sayHello(){if(!this._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>=0){const t=[`%c %c %c DKTools.js ${DKTools.VERSION} %c %c ${DKTools.SITE} %c \n`,"background: #279EE8; padding:5px 0;","background: #279EE8; padding:5px 0;","color: #4CCBF5; background: #030307; padding:5px 0;","background: #279EE8; padding:5px 0;","background: #BDE5F2; padding:5px 0;","background: #279EE8; padding:5px 0;"];console.log.apply(console,t)}else window.console&&console.log(`DKTools.js ${DKTools.VERSION} - ${DKTools.SITE}`);this._saidHello=!0}}static __showGrid(){if(!DKTools.Utils.isTest()||!s.get("Grid","Enabled"))return;if(this._gridSprite)return void(this._gridSize>=32?(this._gridSize-=16,this._gridSprite.refreshAll()):(this._gridSize=64,this.__hideGrid()));const t=s.get("Grid");let e=null;this._gridSprite=new DKTools.Sprite.Button(Graphics),this._gridSprite.addEvent({type:"draw-all",onUpdate:()=>{const i=Graphics.boxWidth,n=Graphics.boxHeight,s=this._gridSize,r=t["Grid Color"],o=t["Grid Width"];_.times(Math.ceil(i/s),t=>{this._gridSprite.drawLine({x1:s*t,y1:0,x2:s*t,y2:n,color:r,lineWidth:o})}),_.times(Math.ceil(n/s),t=>{this._gridSprite.drawLine({x1:0,y1:s*t,x2:i,y2:s*t,color:r,lineWidth:o})}),e&&this._gridSprite.drawLine({x1:e.x,y1:e.y,x2:TouchInput.mouseX,y2:TouchInput.mouseY,color:e.color,lineWidth:t["Ruler Width"]})}}),this._gridSprite.addEvent({type:"mouse-inside",onUpdate:()=>{const t=TouchInput.mouseX,e=TouchInput.mouseY,n=Graphics.boxWidth,s=Graphics.boxHeight;let r=t+8,o=e+8;r+i.width>n&&(r=t-i.width-8),o+i.height>s&&(o=e-i.height-8),i.move(r,o),i.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-down-middle",onUpdate:()=>{e||(e={x:TouchInput.mouseX,y:TouchInput.mouseY,color:t["Ruler Color"]||DKTools.Utils.Random.getHexColor()}),this._gridSprite.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-up-middle",onUpdate:()=>{e=null,this._gridSprite.refreshAll()}}),this._gridSprite.start(!0);const i=new DKTools.Sprite(0,0,220,"2");i.addEvent({type:"draw-all",onUpdate:()=>{if(e){const t={x:TouchInput.mouseX,y:TouchInput.mouseY},n=Math.floor(DKTools.Utils.Point.getDistance(e,t));i.drawText(`line: ${n} (${e.x}, ${e.y})`,{y:"0",align:"left"})}i.drawText(`x: ${TouchInput.mouseX}, y: ${TouchInput.mouseY}`,{y:"1",align:"left"})}}),i.start(),this._gridSprite.addChild(i),this._gridSprite.updateMouseInsideEvents(),SceneManager._scene.addChild(this._gridSprite)}},DKTools.Utils.Object=class{static toCamelCase(t){return _.reduce(t,(t,e,i)=>({...t,[_.camelCase(i)]:e}),{})}},DKTools.Utils.Number=class{static clamp(t,e,i){return _.clamp(t,e,i)}static inRange(t,e,i){return _.inRange(t,e,i)}},DKTools.Utils.String=class{static toBooleanArray(t){return _.map(this.toStringArray(t),Boolean)}static toNumberArray(t){return _.map(this.toStringArray(t),Number)}static toStringArray(t){return t.trim().replace(/\s*\,\s*/g,",").split(",")}},DKTools.Utils.Array=class{static avg(t){return this.sum(t)/t.length}static compact(t){return _.pull(t,"",null,void 0,Number.NaN)}static conjunction(t){return _.every(t,_.isEqual.bind(this,!0))}static contains(t,e){return _.includes(t,e)}static count(t,e){return _.size(t)-_.size(_.without(t,e))}static counts(t,e){return _.size(t)-_.size(_.difference(t,e))}static disjunction(t){return _.some(t,_.isEqual.bind(this,!0))}static insert(t,e,i=0){t.splice(i,0,e)}static isBitmapArray(t){return _.every(t,t=>t instanceof Bitmap)}static isBooleanArray(t){return _.every(t,t=>DKTools.Utils.isBoolean(t))}static isEmpty(t){return _.isEmpty(t)}static isNumberArray(t){return _.every(t,t=>DKTools.Utils.isNumber(t))}static isSpriteArray(t){return _.every(t,t=>t instanceof Sprite)}static isStringArray(t){return _.every(t,t=>DKTools.Utils.isString(t))}static isWindowArray(t){return _.every(t,t=>t instanceof Window)}static max(t){return Math.max.apply(Math,t)}static min(t){return Math.min.apply(Math,t)}static remove(t,e){return _.pull(t,e)}static sum(t){return _.reduce(t,(t,e)=>t+=e,0)}},DKTools.Utils.Point=class{static clone(t=0,e=0){return this.toPoint(t,e)}static equals(t,e=0,i=0){if(0===arguments.length)return!1;const n=this.toPoint(e,i);return(t=this.toPoint(t)).x===n.x&&t.y===n.y}static getDistance(t,e=0,i=0){const n=this.toPoint(e,i);return t=this.toPoint(t),Math.sqrt(Math.pow(t.x-n.x,2)+Math.pow(t.y-n.y,2))}static toArray(t){return[t.x,t.y]}static toPoint(t=0,e=0){const i=this.tryToPoint(t,e);if(null!==i)return i;const n=t=>Number.isFinite(t)?t:0;let s;return t instanceof Object&&(s=t.x,e=t.y),s=n(s),e=n(e),new Point(s,e)}static tryToPoint(t,e){let i,n;return t instanceof Object?(i=t.x,n=t.y):(i=t,n=e),DKTools.Utils.Array.isNumberArray([i,n])?new Point(i,n):null}},DKTools.Utils.Rectangle=class{static clone(t=0,e=0,i=0,n=0){return this.toRectangle(t,e,i,n)}static equals(t,e=0,i=0,n=0,s=0){if(0===arguments.length)return!1;const r=this.toRectangle(e,i,n,s);return(t=this.toRectangle(t)).x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}static isEmpty(t){return this.equals(t,Rectangle.emptyRectangle)}static toArray(t){return[t.x,t.y,t.width,t.height]}static toRectangle(t=0,e=0,i=0,n=0){const s=this.tryToRectangle(t,e,i,n);if(s)return s;const r=t=>Number.isFinite(t)?t:0;let o;return t instanceof Object&&(o=t.x,e=t.y,i=t.width,n=t.height),o=r(o),e=r(e),i=r(i),n=r(n),new Rectangle(o,e,i,n)}static tryToRectangle(t,e,i,n){let s,r,o,a;return t instanceof Object?(s=t.x,r=t.y,o=t.width,a=t.height):(s=t,r=e,o=i,a=n),DKTools.Utils.Array.isNumberArray([s,r,o,a])?new Rectangle(s,r,o,a):null}},DKTools.Utils.WebAudio=class{static load(t,e,i){if(!t)return null;if(t instanceof WebAudio)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const n=AudioManager.createBuffer(t,e);return DKTools.Utils.isFunction(i)&&n.addLoadListener(i),n}static async loadAsync(t,e,i){return new Promise(n=>{const s=this.load(t,e,i);s?s.addLoadListener(()=>n(s)):n(s)})}static loadBuffers(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const n=[];let s=0;const r=(r,o)=>{e&&(n[r]=o,s++,DKTools.Utils.isFunction(i)&&i(o,n,t),t.length===s&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof WebAudio?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBuffersAsync(t){const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}},DKTools.Utils.Bitmap=class{static clone(t){if(!t||t.url)return t;const e=t.canvas,i=new Bitmap(e.width,e.height);return i.context.drawImage(e,0,0),i}static drawLine(t,e,i,n,s,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.beginPath(),a.moveTo(e,i),a.lineTo(n,s),a.stroke(),a.restore(),t._setDirty()}static fillArc(t,e,i,n,s,r,o="white",a=!1){const l=t.context;l.save(),l.fillStyle=o,l.beginPath(),l.arc(e,i,n,s,r,a),l.fill(),l.restore(),t._setDirty()}static getBase64(t){return t&&t.canvas?t.canvas.toDataURL("image/png"):null}static load(t,e,i,n,s){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const r=DKTools.IO.normalizePath(t+"/",!0),o=ImageManager.loadBitmap(r,e,n,s);return DKTools.Utils.isFunction(i)&&o.addLoadListener(i),o}static async loadAsync(t,e,i,n,s){return new Promise(r=>{const o=this.load(t,e,i,n,s);o?o.addLoadListener(()=>r(o)):r(o)})}static loadBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const n=[];let s=0;const r=(r,o)=>{e&&(n[r]=o,s++,DKTools.Utils.isFunction(i)&&i(o,n,t),t.length===s&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}static reserve(t,e,i,n,s,r){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.reserve.apply(this,t);if(t instanceof Object)return this.reserve(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);if(!DKTools.Utils.isString(t))return null;const o=DKTools.IO.normalizePath(t+"/",!0),a=ImageManager.reserveBitmap(o,e,n,s,r);return DKTools.Utils.isFunction(i)&&a.addLoadListener(i),a}static async reserveAsync(t,e,i,n,s,r){return new Promise(o=>{const a=this.reserve(t,e,i,n,s,r);a?a.addLoadListener(()=>o(a)):o(a)})}static reserveBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.reserve(t));const n=[];let s=0;const r=(r,o)=>{e&&(n[r]=o,s++,DKTools.Utils.isFunction(i)&&i(o,n,t),t.length===s&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async reserveBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.reserveAsync(t));return Promise.all(e)}static strokeArc(t,e,i,n,s,r,o="white",a=1,l=!1){const h=t.context;h.save(),h.strokeStyle=o,h.lineWidth=a,h.beginPath(),h.arc(e,i,n,s,r,l),h.stroke(),h.restore(),t._setDirty()}static strokeRect(t,e,i,n,s,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.strokeRect(e,i,n,s),a.restore(),t._setDirty()}},DKTools.Utils.Event=class{static getAllComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t?(t instanceof Game_Event&&(t=t.event()),_.reduce(t.pages,(t,e,i)=>(t[i+1]=_.reduce(e.list,(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]),t),{})):[]}static getComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t&&t.page()?_.reduce(t.list(),(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]):[]}},DKTools.Utils.Random=class{constructor(){return DKTools.Utils.Random}static getBoolean(){return this.getInt(1)%2==0}static getFloat(t=1){return _.random(0,t,!0)}static getHexColor(){return"#"+(16777215*Math.random()<<0).toString(16)}static getInt(t=1){return _.random(0,t)}static getRgbaColor(t=1){const e=this.getInt(255),i=this.getInt(255),n=this.getInt(255);return"rgba(%1, %2, %3, %4)".format(e,i,n,t)}},DKTools.IO=class{constructor(){return DKTools.IO}static initialize(){let t="";this.isLocalMode()&&(this._fs=i(3),this._os=i(4),this._path=i(5),t=this.joinPath(this._path.dirname(process.mainModule.filename),"/")),this._projectPath=t,this._mode=s.get("File System","Mode"),this._stamp={},this._loadStamp(),this._createStamp()}static absolutePathExists(t){if(this.isLocalMode())return this._fs.existsSync(t);if(this.mode===DKTools.IO.MODE_NWJS_STAMP&&t.startsWith(this._projectPath)){if(this.isFile(t))return!0;if(this.isDirectory(t))return!0}return!1}static _createStamp(){if(!DKTools.Utils.isTest()||!this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;const t=s.get("File System","Ignored Directories").map(t=>new DKTools.IO.Directory(t)),e=DKTools.IO.getRootDirectory(),i=this._stamp;let n=null;const r=e=>{t.some(t=>t.getFullPath()===e.getFullPath())||e.getAllAsync().then(t=>t.data).then(t=>{t.forEach(t=>{t.getStatsAsync().then(t=>t.data).then(e=>{const s=t.getFullPath().substring(1).split("\\");t.isFile()?_.set(i,s,{__stats__:{...e,type:"file"}}):_.set(i,s,{__stats__:{...e,type:"directory"}}),n&&clearTimeout(n),n=setTimeout(()=>{new DKTools.IO.File("data/Stamp.json").saveJsonAsync(i,{compress:!0})})}),t.isDirectory()&&r(t)})})};r(e)}static getRootDirectory(){return new DKTools.IO.Directory}static getAbsolutePath(t){const e=this.joinPath(this._projectPath,t||"");return this.normalizePath(e)}static isLocalMode(){return DKTools.Utils.isNwjs()}static isFile(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isFile()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\");if(_.last(e).includes("."))return"file"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static isDirectory(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isDirectory()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\").filter(t=>!!t);if(!_.last(e).includes("."))return"directory"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static joinPath(){if(this.isLocalMode())return this._path.join(...arguments);const t=_.filter(arguments,t=>DKTools.Utils.isString(t));let e=t.join("\\");return/^[\\\/]{2}[^\\\/]/.test(t[0])||(e=e.replace(/^[\\\/]{2,}/,"\\")),this.normalizePath(e)}static _loadStamp(){if(this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;new DKTools.IO.File("data/Stamp.json").loadJson({sync:!0,decompress:!0,onSuccess:t=>{this._stamp=t.data||this._stamp}})}static normalizePath(t,e=!1){if(this.isLocalMode()){const i=this._path.normalize(t);return e?i.replace(/\\/g,"/"):i}const i=this._statPath(t),n=i.isUnc,s=i.isAbsolute;let r=i.device,o=i.tail;const a=/[\\\/]$/.test(o),l=_.filter(o.split(/[\\\/]+/),t=>t&&"."!==t),h=[];for(const t of l)".."===t?h.length>0&&".."!==h[h.length-1]?h.pop():s||h.push(".."):h.push(t);(o=h.join("\\"))||s||(o="."),o&&a&&(o+="\\"),n&&(r="\\\\"+r.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\"));const u=r+(s?"\\":"")+o;return e?u.replace(/\\/g,"/"):u}static parsePath(t){if(this.isLocalMode())return this._path.parse(t);const e=this._splitPath(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}}static pathExists(t){return this.absolutePathExists(this.getAbsolutePath(t))}static _statPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=e[1]||"",n=!!i&&":"!==i[1];return{device:i,isUnc:n,isAbsolute:n||!!e[2],tail:e[3]}}static _splitPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=(e[1]||"")+(e[2]||""),n=e[3]||"",s=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/.exec(n);return[i,s[1],s[2],s[3]]}},Object.defineProperties(DKTools.IO,{fs:{get:function(){return this._fs},configurable:!0},os:{get:function(){return this._os},configurable:!0},path:{get:function(){return this._path},configurable:!0},sep:{get:function(){return this.isLocalMode()?this._path.sep:"/"},configurable:!0},projectPath:{get:function(){return this._projectPath},configurable:!0},mode:{get:function(){return this._mode},configurable:!0},stamp:{get:function(){return this._stamp},configurable:!0},OK:{value:0},EXPECT_CALLBACK:{value:1},ERROR_NOT_LOCAL_MODE:{value:2},ERROR_PATH_DOES_NOT_EXIST:{value:3},ERROR_CALLBACK_IS_NOT_AVAILABLE:{value:4},ERROR_DIRECTORY_ALREADY_EXISTS:{value:5},ERROR_DIRECTORY_IS_NOT_EMPTY:{value:6},ERROR_OVERWRITING_IS_NOT_AVAILABLE:{value:7},ERROR_OPTIONS_ARE_NOT_AVAILABLE:{value:8},ERROR_DECOMPRESSING_DATA:{value:9},ERROR_PARSING_DATA:{value:10},MODE_NWJS_STAMP:{value:0},MODE_NWJS:{value:1}}),DKTools.IO.Entity=class{constructor(){this.initialize.apply(this,arguments)}initialize(t=""){const e=DKTools.IO.parsePath(t);this._path=DKTools.IO.normalizePath(e.dir+"/"),this._name=e.name,this._initialExtension=e.ext,this._extension=e.ext}exists(){return DKTools.IO.absolutePathExists(this.getAbsolutePath())}getPath(){return this._path}getName(){return this._name}getExtension(){return this._extension}getFullPath(){return DKTools.IO.joinPath(this.getPath(),"/",this.getFullName())}getFullName(){return this._name+this._extension}getAbsolutePath(){return DKTools.IO.getAbsolutePath(this.getFullPath())}getStats(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const t=this.getFullPath().split("\\").filter(t=>!!t);return{data:_.get(DKTools.IO.stamp,t.concat("__stats__"),{}),status:DKTools.IO.OK}}const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.stat(i,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess({data:i,status:DKTools.IO.OK},this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{return{data:e.statSync(i),status:DKTools.IO.OK}}catch(e){this.__processError(e,t.onError)}}async getStatsAsync(){return new Promise((t,e)=>{const i=this.getStats({sync:!1,onSuccess:t,onError:e});i.status!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}hasExtension(){return!!this._extension}isFile(){if(this instanceof DKTools.IO.File){if(DKTools.IO.isLocalMode()){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.isFile(t)}return DKTools.IO.isFile(this.getFullPath())}return!!this.hasExtension()}return!1}isDirectory(){return this instanceof DKTools.IO.Directory&&(DKTools.IO.isLocalMode()?DKTools.IO.isDirectory(this.getFullPath()):!this.hasExtension())}__processError(t,e){DKTools.Utils.isFunction(e)?e(t,this):DKTools.Utils.throwError(t)}rename(t,e={}){if(e=e||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,n=this.getAbsolutePath(),s=DKTools.IO.normalizePath(this._path+"/"+t+this._extension),r=DKTools.IO.getAbsolutePath(s);if(!e.overwrite&&DKTools.IO.absolutePathExists(r))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;if(!e.sync)return i.rename(n,r,i=>{i?this.__processError(i,e.onError):(this._name=t,DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this))}),DKTools.IO.EXPECT_CALLBACK;try{return i.renameSync(n,r),this._name=t,DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async renameAsync(t,e={}){return new Promise((i,n)=>{const s=this.rename(t,{...e,sync:!1,onSuccess:i,onError:n});s!==DKTools.IO.EXPECT_CALLBACK&&i(s)})}},Object.defineProperties(DKTools.IO.Entity.prototype,{path:{get:function(){return this._path},configurable:!0},name:{get:function(){return this._name},configurable:!0},initialExtension:{get:function(){return this._initialExtension},configurable:!0},extension:{get:function(){return this._extension},configurable:!0}}),DKTools.IO.File=class extends DKTools.IO.Entity{initialize(t=""){super.initialize(t),this._detectExtension()}copy(t,e={}){if(!e)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,n=this.getAbsolutePath(),s=new DKTools.IO.File(t).getDirectory();if(e.createDirectory&&!s.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;s.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${s.getFullPath()}`),e.onError)}if(!s.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!e.sync)return i.copyFile(n,t,e.flags,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.copyFileSync(n,t,e.flags),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async copyAsync(t,e={}){return new Promise((i,n)=>{const s=this.copy(t,{...e,sync:!1,onSuccess:i,onError:n});s!==DKTools.IO.EXPECT_CALLBACK&&i(s)})}_detectExtension(){let t=this._extension;this.isAudio()?t=AudioManager.audioFileExt():this.isImage()?t=".png":this.isVideo()&&(t=Graphics.canPlayVideoType("video/webm")&&!DKTools.Utils.isMobileDevice()?".webm":".mp4"),this._extension=t}exists(){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.pathExists(t)}return super.exists()}getDirectory(){return new DKTools.IO.Directory(this._path)}getDirectoryName(){return this.getDirectory().getName()}isAudio(){return".ogg"===this._extension||".m4a"===this._extension||".rpgmvo"===this._extension}isJson(){return".json"===this._extension}isTxt(){return".txt"===this._extension}isImage(){return".png"===this._extension||".rpgmvp"===this._extension||".webp"===this._extension}isScript(){return".js"===this._extension}isVideo(){return".webm"===this._extension||".mp4"===this._extension}isSave(){return".rpgsave"===this._extension}load(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=this.getAbsolutePath(),i=e=>{if(e){if(t.decompress)try{e=LZString.decompressFromBase64(e)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(t.parse)try{e=JSON.parse(e,t.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:e,status:DKTools.IO.OK}};if(DKTools.IO.isLocalMode()){if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const n=DKTools.IO.fs,s=t.options||{encoding:"utf8"};if(t.sync)try{const r=n.readFileSync(e,s);return i(r)}catch(e){this.__processError(e,t.onError)}else n.readFile(e,s,(e,n)=>{e?this.__processError(e,t.onError):t.onSuccess(i(n),this)})}else{if(DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP&&"Stamp.json"!==this.getFullName()&&!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const n=new XMLHttpRequest;n.open("GET",e,!t.sync),n.overrideMimeType(t.mimeType||"application/json"),n.onload=(()=>{4===n.readyState&&(200===n.status?t.onSuccess(i(n.responseText),this):this.__processError(n,t.onError))}),n.onerror=(()=>{this.__processError(n,t.onError)});try{n.send()}catch(t){}}return{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async loadAsync(t={}){return new Promise((e,i)=>{const n=this.load({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}loadAudio(){return this.isAudio()&&(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP||this.exists())?DKTools.Utils.WebAudio.load(this.getDirectoryName(),this.getName()):null}async loadAudioAsync(){return DKTools.Utils.WebAudio.loadAsync(this.loadAudio())}loadJson(t){return t?(t.parse||(t.parse=!0),this.load(t)):{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE}}async loadJsonAsync(t={}){return new Promise((e,i)=>{const n=this.loadJson({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}loadBitmap(t,e,i){return t instanceof Object?this.loadBitmap(t.listener,t.hue,t.smooth):this.isImage()&&(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP||this.exists())?DKTools.Utils.Bitmap.load({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i}):null}async loadBitmapAsync(t,e,i){return DKTools.Utils.Bitmap.loadAsync(this.loadBitmap(t,e,i))}remove(t={}){if(t=t||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.unlink(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.unlinkSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAsync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmap(t,e,i,n){return t instanceof Object?this.reserveBitmap(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserve({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:n}):null}async reserveBitmapAsync(t,e,i,n){return t instanceof Object?this.reserveBitmapAsync(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserveAsync({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:n}):null}save(t,e={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;const i=DKTools.IO.fs,n=this.getAbsolutePath(),s=this.getDirectory();if((e=e||{}).createDirectory&&!s.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;s.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${s.getFullPath()}`),e.onError)}if(!s.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(e.stringify&&(t=JSON.stringify(t,e.stringify.replacer,e.stringify.space)),e.compress&&(t=LZString.compressToBase64(t)),!e.sync)return i.writeFile(n,t,e.options,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.writeFileSync(n,t,e.options),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async saveAsync(t,e={}){return new Promise((i,n)=>{const s=this.save(t,{...e,sync:!1,onSuccess:i,onError:n});s!==DKTools.IO.EXPECT_CALLBACK&&i(s)})}saveJson(t,e={}){return(e=e||{}).stringify||(e.stringify={space:"\t"}),this.save(t,e)}async saveJsonAsync(t,e={}){return new Promise((i,n)=>{const s=this.saveJson(t,{...e,sync:!1,onSuccess:i,onError:n});s!==DKTools.IO.EXPECT_CALLBACK&&i(s)})}},DKTools.IO.Directory=class extends DKTools.IO.Entity{create(t){if(!t)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(this.exists())return DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.mkdir(i,t.options,e=>{e?this.__processError(e,t.onError):t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.mkdirSync(i,t.options),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async createAsync(t={}){return new Promise((e,i)=>{const n=this.create({...t,sync:!1,onSuccess:e,onError:i});n!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}createDirectory(t,e){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).create(e)}async createDirectoryAsync(t,e={}){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).createAsync(e)}findFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let n=1,s=0;const r=s=>{_.forEach(s,s=>{if(s.isFile()){const e=s.getFullName();t.template instanceof RegExp&&t.template.test(e)?i.push(s):t.template&&e!==t.template||i.push(s)}else n{if(t.sync){const i=e.getAll({sync:!0,options:t.options}).data;r(i)}else e.getAll({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{s++,r(e.data),n===s&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findFilesAsync(t={}){return new Promise((e,i)=>{const n=this.findFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}findDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let n=1,s=0;const r=s=>{_.forEach(s,s=>{const r=s.getFullName();t.template instanceof RegExp&&t.template.test(r)?i.push(s):t.template&&r!==t.template||i.push(s),n{if(t.sync){const i=e.getDirectories({sync:!0,options:t.options}).data;r(i)}else e.getDirectories({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{s++,r(e.data),n===s&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findDirectoriesAsync(t={}){return new Promise((e,i)=>{const n=this.findDirectories({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getAll(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=this.getFullPath(),i=i=>{return t.template instanceof RegExp?i=_.filter(i,e=>t.template.test(e)):DKTools.Utils.isString(t.template)&&(i=_.filter(i,e=>e===t.template)),{data:_.reduce(i,(t,i)=>{const n=DKTools.IO.normalizePath(e+"/"+i);return DKTools.IO.isFile(n)?t.push(new DKTools.IO.File(n)):DKTools.IO.isDirectory(n)&&t.push(new DKTools.IO.Directory(n)),t},[]),status:DKTools.IO.OK}};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.getFullPath().split("\\"),n=_.get(DKTools.IO.stamp,e,{}),s=Object.keys(n);return t.sync?i(s):(t.onSuccess(i(s),this),{data:null,status:DKTools.IO.EXPECT_CALLBACK})}const n=DKTools.IO.fs,s=this.getAbsolutePath();if(!t.sync)return n.readdir(s,t.options,(e,n)=>{e?this.__processError(e,t.onError):t.onSuccess(i(n),this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{const e=n.readdirSync(s,t.options);return i(e)}catch(e){this.__processError(e,t.onError)}}async getAllAsync(t={}){return new Promise((e,i)=>{const n=this.getAll({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isFile());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,n)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},n):i(t,n)}),this.getAll(t)}}async getFilesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isFile());return{...t,data:e}}return t})}getDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isDirectory());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,n)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},n):i(t,n)}),this.getAll(t)}}async getDirectoriesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isDirectory());return{...t,data:e}}return t})}getAudioFiles(t){return this.getFiles({...t,template:/(.ogg|.rpgmvo)/})}async getAudioFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getAudioFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getJsonFiles(t){return this.getFiles({...t,template:/(.json)/})}async getJsonFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getJsonFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getTxtFiles(t){return this.getFiles({...t,template:/(.txt)/})}async getTxtFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getTxtFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getImageFiles(t){return this.getFiles({...t,template:/(.png|.webp|.rpgmvp)/})}async getImageFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getImageFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getVideoFiles(t){return this.getFiles({...t,template:/(.webm|.mp4)/})}async getVideoFilesAsync(t={}){return new Promise((e,i)=>{const n=this.getVideoFiles({...t,sync:!1,onSuccess:e,onError:i});n.status!==DKTools.IO.EXPECT_CALLBACK&&e(n)})}getRootDirectory(){return new DKTools.IO.Directory(this.getPath())}isEmpty(){const t=this.getAll({sync:!0}).data;return!t||0===t.length}loadAudioFiles(){const t=this.getAudioFiles({sync:!0});return t.status!==DKTools.IO.OK?[]:_.map(t.data,t=>t.loadAudio())}async loadAudioFilesAsync(){const t=await this.getAudioFilesAsync();if(t.status!==DKTools.IO.OK)return[];const e=_.map(t.data,t=>t.loadAudioAsync());return Promise.all(e)}loadBitmaps(t,e,i){const n=this.getImageFiles({sync:!0});return n.status!==DKTools.IO.OK?[]:_.map(n.data,n=>n.loadBitmap(t,e,i))}async loadBitmapsAsync(t,e,i){const n=await this.getImageFilesAsync();if(n.status!==DKTools.IO.OK)return[];const s=_.map(n.data,n=>n.loadBitmapAsync(t,e,i));return Promise.all(s)}remove(t={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!this.isEmpty())return DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.rmdir(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.rmdirSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmaps(t,e,i,n){const s=this.getImageFiles({sync:!0});return s.status!==DKTools.IO.OK?[]:_.map(s.data,s=>s.reserveBitmap(t,e,i,n))}async reserveBitmapsAsync(t,e,i,n){const s=await this.getImageFilesAsync();if(s.status!==DKTools.IO.OK)return[];const r=_.map(s.data,s=>s.reserveBitmapAsync(t,e,i,n));return Promise.all(r)}},DKTools.IO.WebStorage=class{static exists(t){return localStorage.hasOwnProperty(t)}static load(t,e={}){if(!this.exists(t))return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};let i=localStorage.getItem(t);if(i){if(e.decompress)try{i=LZString.decompressFromBase64(i)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(e.parse)try{i=JSON.parse(i,e.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:i,status:DKTools.IO.OK}}static remove(t){return this.exists(t)?(localStorage.removeItem(t),DKTools.IO.OK):DKTools.IO.ERROR_PATH_DOES_NOT_EXIST}static rename(t,e,i=!1){if(!this.exists(t))return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!i&&this.exists(e))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;const n=localStorage.getItem(t);return localStorage.setItem(e,n),localStorage.removeItem(t),DKTools.IO.OK}static save(t,e,i={}){return i=i||{},!_.defaultTo(i.overwrite,!0)&&this.exists(t)?DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE:(i.stringify&&(e=JSON.stringify(e,i.stringify.replacer,i.stringify.space)),i.compress&&(e=LZString.compressToBase64(e)),localStorage.setItem(t,e),DKTools.IO.OK)}},DKTools.Network=class{constructor(){return DKTools.Network}static async fetchFile(t,e={}){return fetch(t,e).then(t=>{if(t.ok)return this._toFile(t);throw t})}static async fetchJson(t,e={}){return e.headers||(e.headers={}),e.headers.Accept="application/json",fetch(t,e).then(t=>{if(t.ok)return this._toJson(t);throw t})}static async _toFile(t){return t.arrayBuffer().catch(()=>null)}static async _toJson(t){return t.json().catch(()=>null)}},DKTools.ParameterManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._pluginName=t,this._params={},this.initializeParams()}initializeParams(){_.forEach(PluginManager.parameters(this._pluginName),(t,e)=>{this._params[e]=DKTools.ParameterManager.parse(t)})}get(t,e,i){if(!DKTools.Utils.isString(t))return void console.error("Parameter name is not a string!",this._pluginName,t,e,i);let n=this._params[t];return void 0!==n?(e instanceof Object?n=_.find(n,e):void 0!==e&&(n=n[e]),n instanceof Object&&(i instanceof Object?(void 0!==i.key&&(n=n[i.key]),void 0!==i.index&&(n=n[i.index])):void 0!==i&&(n=n[i])),n):void 0}static parse(t){try{return DKTools.Utils.isNumber(t)||DKTools.Utils.isBoolean(t)?t:JSON.parse(t,(t,e)=>{if(Array.isArray(e))return _.map(e,t=>this.parse(t));try{return this.parse(e)}catch(t){return e}})}catch(e){return t}}},Object.defineProperties(DKTools.ParameterManager.prototype,{pluginName:{get:function(){return this._pluginName},configurable:!0},params:{get:function(){return this._params},configurable:!0}}),DKTools.PluginManager=class{constructor(){return DKTools.PluginManager}static initialize(){this.registerPlugins(Imported),this._checkRequirements()}static _checkRequirements(){_.forEach(this._requirements,(t,e)=>{const i=_.max(t),n=this.getVersion(e);if(void 0===n){const t='Required to install the plugin "%1". Minimal version: %2'.format(e,i);throw new Error(t)}if(n{this.registerPlugin(e,t)})}static requirePlugin(t,e){this._requirements[t]||(this._requirements[t]=[]),this._requirements[t].push(e)}static requirePlugins(t){_.forEach(t,(t,e)=>{this.requirePlugin(e,t)})}},Object.defineProperties(DKTools.PluginManager,{_plugins:{value:{}},_requirements:{value:{}},plugins:{get:function(){return this._plugins},configurable:!0},requirements:{get:function(){return this._requirements},configurable:!0}}),DKTools.PluginCommandManager=class{constructor(){return DKTools.PluginCommandManager}static has(t){return!!this._pluginCommands[t.toLowerCase()]}static process(t,e,i){const n=this._pluginCommands[e.toLowerCase()];DKTools.Utils.isFunction(n)&&n.call(t,i)}static set(t,e){this._pluginCommands[t.toLowerCase()]=e}},Object.defineProperties(DKTools.PluginCommandManager,{_pluginCommands:{value:{}}}),DKTools.PreloadManager=class{constructor(){return DKTools.PreloadManager}static initialize(){this.clearCache();const t=s.get("Preload Manager");this._enabled=t.Enabled,this.isEnabled()&&(_.forEach(t["Audio Files"],t=>{this.preloadAudio({path:t.Path,caching:t.Caching})}),_.forEach(t["Image Files"],t=>{this.preloadImage({path:t.Path,hue:t.Hue,caching:t.Caching})}),this.start())}static clearCache(){this._cache={audio:{},image:{}}}static clearQueue(){this._queue={audio:[],image:[]}}static _finish(){this._finishTime=new Date,this.clearQueue(),this._log("Preloading complete! \nLoaded/Skipped/Total: "+this._loaded+"/"+this._skipped+"/"+this._total+"\nPreloading time: "+(this._finishTime-this._startTime)/1e3+" sec"),Graphics.endLoading()}static _generateAudioKey(t){return DKTools.IO.normalizePath(t,!0)}static _generateImageKey(t,e=0){return DKTools.IO.normalizePath(ImageManager._generateCacheKey(t,e||0),!0)}static getCachedAudioByKey(t){return this._cache.audio[t]}static getCachedAudioByPath(t){return this.getCachedAudioByKey(this._generateAudioKey(t))}static getCachedImageByKey(t){return this._cache.image[t]}static getCachedImageByPath(t){return this.getCachedImageByKey(this._generateImageKey(t))}static isAudioCachedByKey(t){return!!this._cache.audio[t]}static isAudioCachedByPath(t){return this.isAudioCachedByKey(this._generateAudioKey(t))}static isEnabled(){return this._enabled}static isFinished(){return!!this._finishTime}static isReady(){return!this.isEnabled()||this.isFinished()}static isImageCachedByKey(t){return!!this._cache.image[t]}static isImageCachedByPath(t,e){return this.isImageCachedByKey(this._generateImageKey(t,e))}static _log(t){this.isEnabled()&&DKTools.Utils.isTest()&&s.get("Preload Manager","Debugging")&&t&&console.log(t)}static _onFileLoad(t){this._loaded++,this._log(`Loaded ${t instanceof WebAudio?"audio":"image"}: ${t.url}`),Graphics.updateLoading()}static _preload(t,e){if(this.isEnabled()&&e instanceof Object&&DKTools.Utils.isString(e.path)){const i=new DKTools.IO.Directory(e.path);if(i.isDirectory()){if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP)throw new Error("Web browsers and mobile phones cannot load directories!");{const n={sync:!0};let s=[];"audio"===t?s=i.getAudioFiles(n).data:"image"===t&&(s=i.getImageFiles(n).data),_.forEach(s,i=>{const n=i.getFullPath();this._queue[t][n]||(this._queue[t][n]={...e,path:n})})}}else{let i=e.path;i.includes(".")||("image"===t?i+=".png":"audio"===t&&(i+=".ogg"));const n=new DKTools.IO.File(i),s=n.getFullPath();n.isFile()?this._queue[t][s]||(this._queue[t][s]={...e,path:i}):console.error("This is not a file: "+s)}}}static _processLoadAudioFiles(){const t=[];return _.forEach(this._queue.audio,e=>{const i=new DKTools.IO.File(e.path),n=i.getFullPath();if(i.isFile())if(i.isAudio()){if(this.isAudioCachedByPath(n))return this._skipped++,void this._log("Audio already preloaded: "+n+". Skipped...");const s=i.loadAudio();s?(e.caching&&(this._cache.audio[this._generateAudioKey(s.url)]=s),t.push(s)):(this._skipped++,this._log("Cannot load an audio: "+n+". Skipped..."))}else this._skipped++,this._log("This is not an audio: "+n+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.WebAudio.loadAsync(t).then(()=>this._onFileLoad(t)))}static _processLoadImageFiles(){const t=[];return _.forEach(this._queue.image,e=>{const i=new DKTools.IO.File(e.path),n=i.getFullPath();if(i.isFile())if(i.isImage()){if(this.isImageCachedByPath(n,e.hue))return this._skipped++,void this._log("Image already preloaded: "+n+". Skipped...");const s=DKTools.Utils.Bitmap.reserve({folder:i.getPath(),filename:i.getName(),hue:e.hue});s?(e.caching&&(this._cache.image[this._generateImageKey(s.url,e.hue)]=s),t.push(s)):(this._skipped++,this._log("Cannot load an image: "+n+". Skipped..."))}else this._skipped++,this._log("This is not an image: "+n+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),_.map(t,t=>DKTools.Utils.Bitmap.loadAsync(t).then(()=>this._onFileLoad(t)))}static preloadAudio(t){this._preload("audio",t)}static preloadImage(t){this._preload("image",t)}static releaseAudioByKey(t){this._cache.audio[t]=void 0}static releaseAudioByPath(t){this.releaseAudioByKey(this._generateAudioKey(t))}static releaseImageByKey(t){this._cache.image[t]=void 0}static releaseImageByPath(t,e){this.releaseImageByKey(this._generateImageKey(t,e))}static start(){if(!this.isEnabled())return;if(this._loaded=0,this._skipped=0,this._total=_.size(this._queue.audio)+_.size(this._queue.image),this._startTime=new Date,this._finishTime=null,this._log("DKTools Preload Manager is running... \nTotal files to load: "+this._total),0===this._total)return void this._finish();const t=Promise.all(this._processLoadAudioFiles()),e=Promise.all(this._processLoadImageFiles());Promise.all([t,e]).then(()=>this._finish())}},Object.defineProperties(DKTools.PreloadManager,{_queue:{value:{audio:{},image:{}},writable:!0},_cache:{value:{audio:[],image:[]},writable:!0}}),DKTools.StartupManager=class{static async initialize(){this._isReady=!1,await this.checkErrors(),await this.initializeModules(),this._isReady=!0}static async initializeModules(){}static _checkRPGMakerVersion(){if(Utils.RPGMAKER_VERSION<"1.6.0")throw new Error("Required to update RPG Maker MV to minimal version 1.6.0 (Installed: %1)".format(Utils.RPGMAKER_VERSION))}static _checkWebStorage(){if(!DKTools.IO.isLocalMode()&&!window.hasOwnProperty("localStorage"))throw new Error("Your browser does not support localStorage API")}static async checkErrors(){await this._checkRPGMakerVersion(),await this._checkWebStorage()}static isReady(){return this._isReady}},DKTools.Audio=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._type=t.type.toLowerCase(),this._name=t.name,this._volume=_.defaultTo(t.volume,this.standardVolume()),this._pitch=_.defaultTo(t.pitch,this.standardPitch()),this._pan=_.defaultTo(t.pan,this.standardPan()),this._loop=_.defaultTo(t.loop,this.standardLoop()),this._buffer=this._createBuffer(),this._pausePos=null}_createBuffer(){return AudioManager.createBuffer(this._type,this._name)}clone(){return new DKTools.Audio(this)}equals(t){return!!t&&(this._type===t.type&&this._name===t.name&&this._volume===t.volume&&this._pitch===t.pitch&&this._pan===t.pan&&this._loop===t.loop)}fadeIn(t=0){this._buffer.fadeIn(t)}fadeOut(t=0){this._buffer.fadeOut(t)}isPaused(){return!this.isPlaying()&&null!=this._pausePos}isPlaying(){return this._buffer.isPlaying()}pause(){this.isPlaying()&&(this._pausePos=this.seek(),this.stop())}play(t=0){this._buffer.play(this._loop,t),this._updateBufferParameters(),this._pausePos=null}resume(){this.isPaused()&&this.play(this._pausePos)}seek(){return this._buffer.seek()}standardLoop(){return"bgm"===this._type||"bgs"===this._type}standardPan(){return 0}standardPitch(){return 100}standardVolume(){return 90}stop(){this.isPlaying()&&this._buffer.stop()}_updateBufferParameters(){const t=this._buffer;let e=AudioManager[this._type+"Volume"];Number.isFinite(e)||(e=100),t.volume=e*this._volume/1e4,t.pitch=this._pitch/100,t.pan=this._pan/100}},Object.defineProperties(DKTools.Audio.prototype,{id:{get:function(){return this._id},configurable:!0},type:{get:function(){return this._type},configurable:!0},name:{get:function(){return this._name},configurable:!0},volume:{get:function(){return this._volume},set:function(t){this._volume!==t&&(this._volume=t,this._updateBufferParameters())},configurable:!0},pitch:{get:function(){return this._pitch},set:function(t){this._pitch!==t&&(this._pitch=t,this._updateBufferParameters())},configurable:!0},pan:{get:function(){return this._pan},set:function(t){this._pan!==t&&(this._pan=t,this._updateBufferParameters())},configurable:!0},loop:{get:function(){return this._loop},configurable:!0},buffer:{get:function(){return this._buffer},configurable:!0},pos:{get:function(){return this.seek()},set:function(t){this.play(t)},configurable:!0}}),DKTools.Event=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._target=t.target,this._type=t.type,this._repeatTime=t.repeatTime||-1,this._repeats=_.defaultTo(t.repeats,-1),this._remainingPauseTime=t.remainingPauseTime||0,this._onStart=t.onStart,this._onUpdate=t.onUpdate,this._onPause=t.onPause,this._onReset=t.onReset,this._onRepeat=t.onRepeat,this._onSuccess=t.onSuccess,this._onFail=t.onFail,this._started=!1,this._resetRemainingTime(),this._resetRemainingRepeats()}addRemainingPauseTime(t=1){this._remainingPauseTime+=t}addRemainingRepeats(t=1){this._remainingRepeats+=t}addRemainingTime(t=1){this._remainingTime+=t}_callOnPauseHandler(){this._canCallOnPauseHandler()&&this._onPause(this)}_callOnRepeatHandler(){this._canCallOnRepeatHandler()&&this._onRepeat(this)}_callOnResetHandler(){this._canCallOnResetHandler()&&this._onReset(this)}_callOnStartHandler(){this._canCallOnStartHandler()&&this._onStart(this),this._started=!0}_callOnSuccessHandler(t=!1){(this._canCallOnSuccessHandler()||t)&&this._onSuccess(this)}_callOnUpdateHandler(){this._canCallOnUpdateHandler()&&this._onUpdate(this)}_callonFailHandler(){this._canCallonFailHandler()&&this._onFail(this)}_canCallOnPauseHandler(){return this.hasOnPauseHandler()&&this.isPaused()}_canCallOnRepeatHandler(){return this.hasOnRepeatHandler()}_canCallOnResetHandler(){return this.hasOnResetHandler()}_canCallOnStartHandler(){return this.hasOnStartHandler()&&!this.isStarted()}_canCallOnSuccessHandler(){return this.hasOnSuccessHandler()&&this.isFinished()}_canCallOnUpdateHandler(){return this.hasOnUpdateHandler()&&this.isUpdated()}_canCallonFailHandler(){return this.hasonFailHandler()}_clearRemainingRepeats(){this._remainingRepeats=0}_clearRemainingTime(){this._remainingTime=0}clone(){return new this.constructor(this)}finish(t=!1){this.isFinished()||t?this._callOnSuccessHandler(t):this._callonFailHandler(),this._clearRemainingTime(),this._clearRemainingRepeats()}getElapsedRepeats(){return this._repeats-this._remainingRepeats}getElapsedTime(){return this._repeatTime-this._remainingTime}hasManager(){return!!this._manager}hasOnPauseHandler(){return!!this._onPause}hasOnRepeatHandler(){return!!this._onRepeat}hasOnResetHandler(){return!!this._onReset}hasOnStartHandler(){return!!this._onStart}hasOnSuccessHandler(){return!!this._onSuccess}hasOnUpdateHandler(){return!!this._onUpdate}hasTarget(){return!!this._target}hasType(){return!!this._type}hasonFailHandler(){return!!this._onFail}isAnimation(){return this instanceof DKTools.Animation}isAnimationAction(){return this instanceof DKTools.Animation.Action}isFinished(){return 0===this._remainingTime&&0===this._remainingRepeats}isPaused(){return 0!==this._remainingPauseTime}isStarted(){return this._started}isUpdated(){return this.isStarted()&&!this.isPaused()&&!this.isFinished()}pause(t=-1){this._remainingPauseTime=t}_resetRemainingRepeats(){this._remainingRepeats=this._repeats}_resetRemainingTime(){this._remainingTime=this._repeatTime}remove(){return!this.hasTarget()||this._target.removeEvent(this)}repeat(){this._remainingRepeats>0&&this._remainingRepeats--,this._resetRemainingTime(),this._callOnRepeatHandler()}reset(){this._resetRemainingTime(),this._resetRemainingRepeats(),this._callOnResetHandler()}resume(){this._remainingPauseTime=0}setManager(t){this._manager=t}setOnPauseHandler(t){this._onPause=t}setOnRepeatHandler(t){this._onRepeat=t}setOnResetHandler(t){this._onReset=t}setOnStartHandler(t){this._onStart=t}setOnSuccessHandler(t){this._onSuccess=t}setOnUpdateHandler(t){this._onUpdate=t}setTarget(t){this._target=t}setonFailHandler(t){this._onFail=t}stop(t=!1){this.finish(t),this.reset()}_update(){this._callOnUpdateHandler(),this._updateRemainingRepeats()}_updatePause(){this._callOnPauseHandler(),this._updateRemainingPauseTime()}_updateRemainingPauseTime(){this._remainingPauseTime>0&&this._remainingPauseTime--}_updateRemainingRepeats(){this.isFinished()||(0===this._remainingTime?this.repeat():this._updateRemainingTime())}_updateRemainingTime(){this._remainingTime>0&&this._remainingTime--}update(){this.isPaused()?this._updatePause():(this._callOnStartHandler(),this._update(),this.isFinished()&&this.finish())}},Object.defineProperties(DKTools.Event.prototype,{id:{get:function(){return this._id},configurable:!0},target:{get:function(){return this._target},configurable:!0},manager:{get:function(){return this._manager},configurable:!0},type:{get:function(){return this._type},configurable:!0},repeatTime:{get:function(){return this._duration},configurable:!0},repeats:{get:function(){return this._repeats},configurable:!0},remainingTime:{get:function(){return this._remainingTime},set:function(t){this._remainingTime=t},configurable:!0},remainingRepeats:{get:function(){return this._remainingRepeats},set:function(t){this._remainingRepeats=t},configurable:!0},remainingPauseTime:{get:function(){return this._remainingPauseTime},set:function(t){this._remainingPauseTime=t},configurable:!0},onStart:{get:function(){return this._onStart},configurable:!0},onUpdate:{get:function(){return this._onUpdate},configurable:!0},onPause:{get:function(){return this._onPause},configurable:!0},onReset:{get:function(){return this._onReset},configurable:!0},onRepeat:{get:function(){return this._onRepeat},configurable:!0},onSuccess:{get:function(){return this._onSuccess},configurable:!0},onFail:{get:function(){return this._onFail},configurable:!0}}),DKTools.Animation=class extends DKTools.Event{initialize(t){this._actions=[],DKTools.Event.prototype.initialize.call(this,t)}addAction(t){t&&(Number.isFinite(t.startTime)||(t.startTime=0),Number.isFinite(t.endTime)||(t.endTime=this._repeatTime),t.setAnimation(this),this._actions.push(t))}addActions(t){_.forEach(t,this.addAction.bind(this))}_canUpdateAction(t){return _.inRange(this.getElapsedTime(),t.startTime,t.endTime)}hasAction(t){return DKTools.Utils.Array.contains(this._actions,t)}hasActions(){return!DKTools.Utils.Array.isEmpty(this._actions)}isActionFinished(t){return t.isStarted()&&!t.isPaused()&&this.getElapsedTime()>=t.endTime}isActionUpdated(t){return t.isStarted()&&!t.isPaused()&&this._canUpdateAction(t)}isFinished(){return DKTools.Event.prototype.isFinished.call(this)||!this.hasActions()}removeAction(t){this.hasAction(t)&&DKTools.Utils.Array.remove(this._actions,t)}repeat(){this.repeatActions(),DKTools.Event.prototype.repeat.call(this)}repeatActions(){_.forEach(this._actions,function(t){t.repeat()})}reset(){this.resetActions(),DKTools.Event.prototype.reset.call(this)}resetActions(){_.forEach(this._actions,function(t){t.reset()})}_update(){this._updateActions(),DKTools.Event.prototype._update.call(this)}_updateAction(t){this._canUpdateAction(t)?t.update():this.getElapsedTime()===t.endTime&&this.isActionFinished(t)&&t.finish()}_updateActions(){_.forEach(this._actions,this._updateAction.bind(this))}},Object.defineProperties(DKTools.Animation.prototype,{actions:{get:function(){return this._actions},configurable:!0}}),DKTools.Animation.Action=class extends DKTools.Event{static Anchor(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.anchor,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=n.x+s,a=n.y+r;e.setAnchor(o,a)}.bind(e)),e}static Close(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=-e.openness/t,n=e.openness+i;e.openness=n}.bind(e)),e}static Frame(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.frame,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=(i.width-n.width)/t,a=(i.height-n.height)/t,l=new Rectangle(n.x+s,n.y+r,n.width+o,n.height+a);e.setFrame(l)}.bind(e)),e}static Move(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.x-e.x)/t,n=(this._data.y-e.y)/t,s=e.x+i,r=e.y+n;e.move(s,r)}.bind(e)),e}static OpacitySprite(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.opacity)/t,n=e.opacity+i;e.setOpacity(n)}.bind(e)),e}static OpacityWindow(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.windowOpacity-e.windowOpacity)/t,n=(this._data.contentsOpacity-e.contentsOpacity)/t,s=(this._data.frameOpacity-e.frameOpacity)/t,r=(this._data.backOpacity-e.backOpacity)/t,o={windowOpacity:e.windowOpacity+i,contentsOpacity:e.contentsOpacity+n,frameOpacity:e.frameOpacity+s,backOpacity:e.backOpacity+r};e.setOpacity(o)}.bind(e)),e}static Open(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(255-e.openness)/t;e.openness=e.openness+i}.bind(e)),e}static Pivot(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.pivot,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=n.x+s,a=n.y+r;e.setPivot(o,a)}.bind(e)),e}static Rotation(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.rotation)/t,n=e.rotation+i;e.setRotation(n)}.bind(e)),e}static Scale(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.scale,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=n.x+s,a=n.y+r;e.setScale(o,a)}.bind(e)),e}static Skew(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,n=e.skew,s=(i.x-n.x)/t,r=(i.y-n.y)/t,o=n.x+s,a=n.y+r;e.setSkew(o,a)}.bind(e)),e}static Sound(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this._data;t.isPlaying()||t.play()}.bind(e)),e}static Tint(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.tint)/t,n=e.tint+i;e.setTint(n)}.bind(e)),e}static Tone(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=e.tone,n=(this._data[0]-i[0])/t,s=(this._data[1]-i[1])/t,r=(this._data[2]-i[2])/t,o=i[0]+n,a=i[1]+s,l=i[2]+r;e.setTone([o,a,l])}.bind(e)),e}initialize(t){t=t||{},this._animation=null,this._startTime=t.startTime,this._endTime=t.endTime,this._data=t.data,DKTools.Event.prototype.initialize.call(this,t)}getElapsedTime(){return this._animation.getElapsedTime()-this._startTime}getRemainingTime(){return this._endTime-this._animation.getElapsedTime()}isFinished(){return this._animation.isActionFinished(this)}isUpdated(){return this._animation.isActionUpdated(this)}remove(){this._animation.removeAction(this)}repeat(){this._callOnRepeatHandler()}reset(){this._callOnResetHandler()}setAnimation(t){this._animation=t}},Object.defineProperties(DKTools.Animation.Action.prototype,{animation:{get:function(){return this._animation},configurable:!0},startTime:{get:function(){return this._startTime},set:function(t){this._startTime=t},configurable:!0},endTime:{get:function(){return this._endTime},set:function(t){this._endTime=t},configurable:!0},data:{get:function(){return this._data},configurable:!0}}),DKTools.OptionManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(){this.clear()}addOptionChangeListener(t,e){this._optionChangeListeners[t]||(this._optionChangeListeners[t]=[]),this._optionChangeListeners[t].push(e)}clear(){this._options=[],this._optionChangeListeners={}}clone(t=!1){const e=new DKTools.OptionManager;return e.enableOptions(this._options),t&&_.forEach(this._optionChangeListeners,(t,i)=>{_.forEach(t,t=>{e.addOptionChangeListener(i,t)})}),e}disableOption(t){this.isOptionEnabled(t)&&(DKTools.Utils.Array.remove(this._options,t),this._onOptionChange(t,!1))}disableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.disableOption.bind(this))}enableOption(t){this.isOptionDisabled(t)&&(this._options.push(t),this._onOptionChange(t,!0))}enableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.enableOption.bind(this))}equals(t){return t instanceof DKTools.OptionManager&&_.isEqual(this._options,t.options)}isOptionDisabled(t){return!this.isOptionEnabled(t)}isOptionEnabled(t){return DKTools.Utils.Array.contains(this._options,t)}isOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionDisabled.bind(this))}isOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionEnabled.bind(this))}isSomeOptionEnabled(){return this._options.length>0}isSomeOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionDisabled.bind(this))}isSomeOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionEnabled.bind(this))}_onOptionChange(t,e){_.forEach(this._optionChangeListeners[t],i=>{i(t,e)})}removeOptionChangeListener(t,e){DKTools.Utils.Array.remove(this._optionChangeListeners[t],e)}switchOption(t){this.isOptionEnabled(t)?this.disableOption(t):this.enableOption(t)}switchOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.switchOption.bind(this))}},Object.defineProperties(DKTools.OptionManager,{options:{get:function(){return this._options},configurable:!0}}),DKTools.EventManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._target=t,this._events={}}addAnimation(t){return this.addEventToContainer(t)}addEvent(t){let e;return t instanceof DKTools.Event||t instanceof DKTools.Animation?e=t:t instanceof Object&&(e=new DKTools.Event(t)),this.addEventToContainer(e)}addEventToContainer(t){if(!t)return null;return t.hasTarget()||t.setTarget(this._target),t.setManager(this),this.getEventsContainer(t).push(t),t}addOneTimeEvent(t){return t.repeatTime=1,t.repeats=0,this.addEvent(t)}_checkEvent(t){return t&&!t.isFinished()}_checkEvents(){_.forEach(this._events,(t,e)=>{this._events[e]=this._checkEventsContainer(t)})}_checkEventsContainer(t){return _.filter(t,this._checkEvent.bind(this))}clearEvents(t){t?Array.isArray(t)?_.forEach(t,t=>{this._events[t]=[]}):this._events[t]=[]:this._events={}}createEventsContainer(t){return this._events[t]=[],this._events[t]}findAnimation(t,e){return _.find(this.getAnimations(e),{id:t})}findEvent(t,e){return _.find(this.getEvents(e),{id:t})}finishEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.finish(e)})}getAnimations(t){return _.filter(this.getEvents(t),t=>t instanceof DKTools.Animation)}getEventIndex(t){return this.getEventsContainer(t).indexOf(t)}getEvents(t){if(t)return this.getEventsContainerByType(t);let e=[];return _.forEach(this._events,t=>{e=e.concat(t)}),e}getEventsContainer(t){return this.getEventsContainerByType(t.type)}getEventsContainerByType(t){return this._events[t]||this.createEventsContainer(t)}hasAnimation(t){return t instanceof DKTools.Animation&&this.getEventIndex(t)>=0}hasAnimations(t){return!DKTools.Utils.Array.isEmpty(this.getAnimations(t))}hasEvent(t){return this.getEventIndex(t)>=0}hasEvents(t){return!DKTools.Utils.Array.isEmpty(this.getEvents(t))}isEventsPaused(t){const e=this.getEventsContainerByType(t);return _.every(e,t=>t.isPaused())}iterateEventsContainer(t,e){const i=this.getEventsContainerByType(t);_.forEach(i,e)}pauseEvents(t,e=-1){this.iterateEventsContainer(t,t=>{t.pause(e)})}removeEvent(t){const e=this.getEventIndex(t);if(e>=0){return this.getEventsContainer(t)[e]=null,!0}return!1}resumeEvents(t){this.iterateEventsContainer(t,t=>{t.resume()})}stopEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.stop(e)})}update(){this._checkEvents()}updateEvent(t){t&&t.update()}updateEventsContainer(t){this.iterateEventsContainer(t,this.updateEvent.bind(this))}},Object.defineProperties(DKTools.EventManager,{events:{get:function(){return this._events},configurable:!0}}),DKTools.Unit=class{constructor(t){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this.setSource(t.source),this.setPercents(t.percents),this.setGetValueHandler(t.getValueHandler)}add(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.add(e):this._source+=e,this):this}clone(){return new this.constructor(this)}div(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.div(e):this._source/=e,this):this}equals(t){return!!t&&(this===t||this._source===t.source&&this._percents===t.percents)}_getValueFromUnit(t){return t instanceof DKTools.Unit?t.getValue():t}getPercents(){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const t=this._percents(this);return Number.isFinite(t)?t:100}return 100}getValue(){let t;return(t=this.hasGetValueHandler()?this._getValueHandler(this):this.getValueBase())||0}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source instanceof DKTools.Unit?this._source.getValue()*t:this._source*t}hasGetValueHandler(){return DKTools.Utils.isFunction(this._getValueHandler)}hasPercents(){return DKTools.Utils.isFunction(this._percents)||Number.isFinite(this._percents)}hasSource(){return this._source instanceof DKTools.Unit||Number.isFinite(this._source)}mul(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.mul(e):this._source*=e,this):this}setGetValueHandler(t){this._getValueHandler=t}setPercents(t=100){this._percents=t}setSource(t){this._source=t}sub(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.rem(e):this._source-=e,this):this}},Object.defineProperties(DKTools.Unit.prototype,{source:{get:function(){return this._source},configurable:!0},percents:{get:function(){return this._percents},configurable:!0},getValueHandler:{get:function(){return this._getValueHandler},configurable:!0}}),DKTools.Unit.Property=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperty(t.property)}add(t){if(!t)return this;const e=this._property,i=this._source[e];let n=this._getValueFromUnit(t);return n instanceof Object&&(n=n[e]),n?(i instanceof DKTools.Unit?i.add(n):this._source[e]+=n,this):this}div(t){if(!t)return this;const e=this._property,i=this._source[e];let n=this._getValueFromUnit(t);return n instanceof Object&&(n=n[e]),n?(i instanceof DKTools.Unit?i.div(n):this._source[e]/=n,this):this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&this._percents===t.percents&&this._property===t.property)}getValueBase(){if(!this.hasSource()||!this.hasProperty())return Number.NaN;return new DKTools.Unit({source:this._source[this._property],percents:this.getPercents()}).getValue()}hasProperty(){return!!this._property}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._property,i=this._source[e];let n=this._getValueFromUnit(t);return n instanceof Object&&(n=n[e]),n?(i instanceof DKTools.Unit?i.mul(n):this._source[e]*=n,this):this}setProperty(t){this._property=t}sub(t){if(!t)return this;const e=this._property,i=this._source[e];let n=this._getValueFromUnit(t);return n instanceof Object&&(n=n[e]),n?(i instanceof DKTools.Unit?i.rem(n):this._source[e]-=n,this):this}},Object.defineProperties(DKTools.Unit.Property.prototype,{property:{get:function(){return this._property},configurable:!0}}),DKTools.Unit.Properties=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperties(t.properties)}add(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].add(i):this._source[e]+=i)}),this}addProperty(t){Array.isArray(this._properties)&&this._properties.push(t)}div(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].div(i):this._source[e]/=i)}),this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&_.isEqual(this._percents,t.percents)&&_.isEqual(this._properties,t.properties))}_getProperties(){let t=this._properties;return DKTools.Utils.isFunction(t)&&(t=t(this)),Array.isArray(t)?t:[]}getPercents(t){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const e=this._percents(t,this);return Number.isFinite(e)?e:100}if(this._percents instanceof Object){if(DKTools.Utils.isFunction(this._percents[t])){const e=this._percents[t](this);return Number.isFinite(e)?e:100}return Number.isFinite(this._percents[t])?this._percents[t]:100}return 100}getValue(t){return this.hasGetValueHandler()?this._getValueHandler(t,this):this.getValueBase(t)}getValueBase(t){const e=t=>{if(!this.hasSource())return Number.NaN;const e=this._source,i=this.getPercents(t);return 0===i?0:e[t]instanceof DKTools.Unit?e[t].getValue(t)*i/100:new DKTools.Unit.Property({source:e,percents:i,property:t}).getValue()};if(t)return e(t);const i=this._getProperties();return _.reduce(i,(t,i)=>(t[i]=e(i),t),{})}hasProperty(t){return this._getProperties().includes(t)}hasProperties(){return this._getProperties().length>0}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].mul(i):this._source[e]*=i)}),this}removeProperty(t){Array.isArray(this._properties)&&DKTools.Utils.Array.remove(this._properties,t)}setProperties(t){this._properties=DKTools.Utils.isFunction(t)?t:_.clone(t)}sub(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].rem(i):this._source[e]-=i)}),this}},Object.defineProperties(DKTools.Unit.Properties.prototype,{properties:{get:function(){return this._properties},configurable:!0}}),DKTools.Unit.Function=class extends DKTools.Unit{add(){return this}div(){return this}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source(this)*t}hasSource(){return DKTools.Utils.isFunction(this._source)}mul(){return this}sub(){return this}},DKTools.Base=class{constructor(){throw new Error("This is an abstract class!")}initialize(t,e,i,n){let s;t instanceof Graphics?(i=Graphics.boxWidth,n=Graphics.boxHeight):t instanceof Object?(s=t.x,e=t.y,i=t.width,n=t.height):Number.isFinite(t)&&(s=t),this.move(s,e),this.setupSize(i,n),this._clearAll(),this._createAll(),this._setupAll(),this._addAllChildren(),this.setupAll(t)}_addAllChildren(){}activate(){this.setActive(!0)&&this.updateActivateEvents()}actorName(t){const e=t>=1?$gameActors.actor(t):null;return e?e.name():""}addAllChildren(){this.updateAddAllChildrenEvents()}addAnimation(t){this._eventManager.addAnimation(t)}addEvent(t){return this._eventManager.addEvent(t)}addOneTimeEvent(t){return this._eventManager.addOneTimeEvent(t)}addOptionChangeListener(t,e){this._optionManager.addOptionChangeListener(t,e)}addFilter(t){t&&(this.filters&&this.filters.length>0?this.filters.push(t):this.filters=[t])}_clearAll(){this._clearMouseEnterTime(),this._clearWheel()}_clearMouseEnterTime(){this._mouseEnterTime=0}_clearWheel(){this._clearWheelX(),this._clearWheelY()}_clearWheelX(){this._wheelX=0}_clearWheelY(){this._wheelY=0}_createAll(){this._createOptionManager(),this._createEventManager()}_createEventManager(){this._eventManager=new DKTools.EventManager(this)}_createOptionManager(){this._optionManager=new DKTools.OptionManager}_checkHeight(t){const e=this.getMinHeight();return t?Math.max(e,t):e}_checkWidth(t){const e=this.getMinWidth();return t?Math.max(e,t):e}calcTextHeight(t,e=!1){if(!this.hasBitmap()||!t)return 0;const i=this.bitmap.fontSize,n=t.text.slice(t.index).split("\n"),s=e?n.length:1;let r=0;for(let t=0;t{e.addText(t.text,{...t.options})}),t.cloneOptions&&e.enableOptions(this._optionManager.options),t.blockStart||e.start(),t.activate&&e.activate(),e}convertEscapeCharacters(t){try{return Window_Base.prototype.convertEscapeCharacters.call(this,t)}catch(e){return t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\x1b\x1b/g,"\\")).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bN\[(\d+)\]/gi,function(){return this.actorName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bP\[(\d+)\]/gi,function(){return this.partyMemberName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bG/gi,TextManager.currencyUnit)}}createAll(){this.updateCreateAllEvents()}deactivate(){this.setActive(!1)&&this.updateDeactivateEvents()}destroy(t={}){this._clearAll(),this.clearEvents(),this.hide()}disableOption(t){this._optionManager.disableOption(t)}disableOptions(t){this._optionManager.disableOptions.apply(this._optionManager,arguments)}drawAll(){}drawArrow(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=ImageManager.loadSystem(this.standardWindowskin()),n=DKTools.Sprite.Arrow.getRect(t);return this.drawBitmap(i,{...e,source:n})}drawBitmap(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=DKTools.Utils.Bitmap.load(t);if(!i||e.sync&&!i.isReady())return!1;let n=!0;return i.addLoadListener(()=>{const t=DKTools.Utils.isFunction,s=DKTools.Utils.isString,r=this.getLineHeight(),{paintOpacity:o,resetPaintOpacity:a}=e;let{source:l,destination:h}=e,u={};t(e.callback)&&(u=e.callback(i,this)),l=l||u.source||{},h=h||u.destination||{},t(l)&&(l=l(i,this)),t(h)&&(h=h(i,this));const c=_.defaultTo(l.x,0),p=_.defaultTo(l.width,i.width);let d=_.defaultTo(l.y,0),f=_.defaultTo(l.height,i.height);const g=_.defaultTo(h.x,0),m=_.defaultTo(h.width,p);let y=_.defaultTo(h.y,0),T=_.defaultTo(h.height,f);0!==p&&0!==f&&0!==m&&0!==T?(s(d)&&(d=r*parseFloat(d)),s(f)&&(f=r*parseFloat(f)),s(y)&&(y=r*parseFloat(y)),s(T)&&(T=r*parseFloat(T)),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.blt(i,c,d,p,f,g,y,m,T),a&&this.resetPaintOpacity()):n=!1}),n}async drawBitmapAsync(t,e={}){if(!t)return!1;const i=await DKTools.Utils.Bitmap.loadAsync(t);return this.drawBitmap(i,e)}drawCharacter(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const n=ImageManager.loadCharacter(t),s=ImageManager.isBigCharacter(t),r=n.width/(s?3:12),o=n.height/(s?4:8),a=(e%4*3+1)*r,l=4*Math.floor(e/4)*o,h=new Rectangle(a,l,r,o),u=i.pos;let{x:c,y:p}=i;return u instanceof Object&&(c=u.x,p=u.y),c=c||0,p=p||0,this.drawBitmap(n,{...i,source:h,destination:{x:c,y:p}})}drawCircle(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:n,paintOpacity:s,resetPaintOpacity:r}=t;let{x:o,y:a}=t;return 0!==i&&(e instanceof Object&&(o=e.x,a=e.y),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),Number.isFinite(s)&&this.changePaintOpacity(s),this.bitmap.drawCircle(o||0,a||0,i||1,n||"white"),r&&this.resetPaintOpacity(),!0)}drawFace(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const{pos:n,rect:s}=i;let{x:r,y:o,width:a,height:l}=i;n instanceof Object&&(r=n.x,o=n.y),s instanceof Object&&(r=s.x,o=s.y,a=s.width,l=s.height),a=a||Window_Base._faceWidth,l=l||Window_Base._faceHeight;const h=ImageManager.loadFace(t),u=Window_Base._faceWidth,c=Window_Base._faceHeight,p=Math.min(a,u),d=Math.min(l,c),f=e%4*u+(u-p)/2,g=Math.floor(e/4)*c+(c-d)/2,_=new Rectangle(f,g,p,d);return r=Math.floor((r||0)+Math.max(a-u,0)/2),o=Math.floor((o||0)+Math.max(l-c,0)/2),this.drawBitmap(h,{...i,source:_,destination:{x:r,y:o}})}drawGauge(t={}){if(!this.hasBitmap())return!1;const{pos:e,rect:i,reversed:n,gradient:s,paintOpacity:r,resetPaintOpacity:o}=t;let{x:a,y:l,width:h,height:u,type:c,rate:p,backgroundColor:d,color:f,color1:g,color2:m}=t;if(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(a=i.x,l=i.y,h=i.width,u=i.height),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),0===h||0===u)return!1;a=a||0,l=l||0,h=h||this.standardDrawingWidth(),u=u||this.standardDrawingHeight(),d=_.defaultTo(d,"black"),f=_.defaultTo(f,"white"),g=_.defaultTo(g,f),m=_.defaultTo(m,f),c=_.defaultTo(c,"horizontal"),p=_.defaultTo(p,1);const y={x:a,y:l,width:h,height:u};if("horizontal"===c)y.width*=p,n&&(y.x+=h-y.width);else{if("vertical"!==c)return!1;y.height*=p,n&&(y.y+=u-y.height)}return Number.isFinite(r)&&this.changePaintOpacity(r),this.fillRect({x:a,y:l,width:h,height:u,color:d}),this.gradientFillRect({rect:y,color1:g,color2:m,vertical:"vertical"===s}),o&&this.resetPaintOpacity(),!0}drawIcon(t,e={}){if(!this.hasBitmap()||null==t)return!1;const i=ImageManager.loadSystem("IconSet"),n=Window_Base._iconWidth,s=Window_Base._iconHeight,r=t%16*n,o=Math.floor(t/16)*s,a=new Rectangle(r,o,n,s),l=e.pos;let{x:h,y:u}=e;return l instanceof Object&&(h=l.x,u=l.y),this.drawBitmap(i,{...e,source:a,destination:{x:h,y:u}})}drawItemName(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=Window_Base._iconWidth+4,{pos:n,iconPos:s,paintOpacity:r,resetPaintOpacity:o}=e;let{x:a,y:l,iconX:h,iconY:u}=e;return n instanceof Object&&(a=n.x,l=n.y),s instanceof Object&&(h=s.x,u=s.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),a=a||0,l=l||0,h=_.defaultTo(h,a+2),u=_.defaultTo(u,l+2),Number.isFinite(r)&&this.changePaintOpacity(r),this.drawIcon(t.iconIndex,{x:h,y:u}),this.drawText(t.name,{x:a+i,y:l,width:(e.width||312)-i,height:e.height,align:"left",font:e.font,textColor:e.textColor,resetFont:e.resetFont,resetTextColor:e.resetTextColor}),o&&this.resetPaintOpacity(),!0}drawLine(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos1:e,pos2:i,color:n,lineWidth:s,paintOpacity:r,resetPaintOpacity:o}=t;let{x1:a,y1:l,x2:h,y2:u}=t;return 0!==s&&(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(h=i.x,u=i.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),Number.isFinite(r)&&this.changePaintOpacity(r),DKTools.Utils.Bitmap.drawLine(this.bitmap,a||0,l||0,h||0,u||0,n,s),o&&this.resetPaintOpacity(),!0)}drawPolygon(t){if(!this.hasBitmap())return!1;t=t||{};const{points:e,paintOpacity:i,resetPaintOpacity:n}=t;if(!Array.isArray(e)||0===e.length)return!1;Number.isFinite(i)&&this.changePaintOpacity(i);for(let i=0;i=24&&(this.bitmap.fontSize-=12)}move(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e);this.position.copy(i)}obtainEscapeCode(t){return Window_Base.prototype.obtainEscapeCode.call(this,t)}obtainEscapeParam(t){return Window_Base.prototype.obtainEscapeParam.call(this,t)}partyMemberName(t){const e=t>=1?$gameParty.members()[t-1]:null;return e?e.name():""}pauseEvents(t,e){this._eventManager.pauseEvents(t,e)}processAll(){this.processMouse(),this.processWheel()}processCharacter(t){Window_Base.prototype.processCharacter.call(this,t)}processDrawIcon(t,e){this.drawIcon(t,{x:e.x+2,y:e.y+2}),e.x+=Window_Base._iconWidth+4}processEscapeCharacter(t,e){try{const i={...e};Window_Base.prototype.processEscapeCharacter.call(this,t,i),Object.assign(e,i)}catch(i){switch(t){case"C":this.changeTextColor(this.getWindowskinTextColor(this.obtainEscapeParam(e)));break;case"I":this.processDrawIcon(this.obtainEscapeParam(e),e);break;case"{":this.makeFontBigger();break;case"}":this.makeFontSmaller()}}}processMouse(){this.isOptionEnabled("process-mouse")&&this.isVisible()&&(this.isActive()||this.isOptionEnabled("process-mouse-ignore-active"))?this.isMouseInside()?(0===this._mouseEnterTime&&this.updateMouseEnterEvents(),this.updateMouseInsideEvents(),TouchInput.isMouseMoved()&&this.updateMouseMoveEvents(),this._mouseEnterTime++):(this._mouseEnterTime>0&&this.updateMouseLeaveEvents(),this.updateMouseOutsideEvents(),this._clearMouseEnterTime()):this._clearMouseEnterTime()}processNewLine(t){t.width?t.width0&&(e||this.start(),i&&this.activate()),n}setActive(t){if(this.active===t)return!1;const e=this.active;return this.setupActive(t),this.active!==e}setId(t){if(this._id===t)return!1;const e=this._id;return this.setupId(t),this._id!==e}setPivot(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.pivot,i))return!1;const n=DKTools.Utils.Point.clone(this.pivot);return this.setupPivot(i),!DKTools.Utils.Point.equals(this.pivot,n)}setRotation(t){if(this.rotation===t)return!1;const e=this.rotation;return this.setupRotation(t),this.rotation!==e}setScale(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.scale,i))return!1;const n=DKTools.Utils.Point.clone(this.scale);return this.setupScale(i),!DKTools.Utils.Point.equals(this.scale,n)}setSkew(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.skew,i))return!1;const n=DKTools.Utils.Point.clone(this.skew);return this.setupSkew(i),!DKTools.Utils.Point.equals(this.skew,n)}setTint(t){if(this.tint===t)return!1;const e=this.tint;return this.setupTint(t),this.tint!==e}setVisible(t){if(this.visible===t)return!1;const e=this.visible;return this.setupVisible(t),this.visible!==e}show(t=!1){this.setVisible(!0)&&this.updateShowEvents(),t&&this.activate()}start(t=!1){this._started=!0,this.removeAllChildren(),this.terminateAll(),this.removeAll(),this.checkAll(),this.createAll(),this.startAll(),this.addAllChildren(),this.refreshAll(),this.updateStartEvents(),t&&this.activate()}startAll(){this.updateStartAllEvents()}stopEvents(t,e=!1){this._eventManager.stopEvents(t,e)}strokeArc(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:n,lineWidth:s,anticlockwise:r,paintOpacity:o,resetPaintOpacity:a}=t;let{x:l,y:h,startAngle:u,endAngle:c}=t;return e instanceof Object&&(l=e.x,h=e.y),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(o)&&this.changePaintOpacity(o),l=l||0,h=h||0,u=u||0,c=_.defaultTo(c,2*Math.PI),DKTools.Utils.Bitmap.strokeArc(this.bitmap,l,h,i,u,c,n,s,r),a&&this.resetPaintOpacity(),!0}strokeRect(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,rect:i,lineWidth:n,paintOpacity:s,resetPaintOpacity:r}=t;let{x:o,y:a,width:l,height:h,color:u}=t;return e instanceof Object&&(o=e.x,a=pox.y),i instanceof Object&&(o=i.x,a=i.y,l=i.width,h=i.height),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(s)&&this.changePaintOpacity(s),o=o||0,a=a||0,l=l||this.standardDrawingWidth(),h=h||this.standardDrawingHeight(),u=u||"white",DKTools.Utils.Bitmap.strokeRect(this.bitmap,o,a,l,h,u,n),r&&this.resetPaintOpacity(),!0}switchOption(t){this._optionManager.switchOption(t)}switchOptions(t){this._optionManager.switchOptions.apply(this._optionManager,arguments)}terminate(){}terminateAll(){this.updateTerminateAllEvents()}textWrap(t,e={}){if(!this.hasBitmap()||""===t||null==t)return"";t=String(t),e=e||{};const i=t.split("\n"),n=e.maxWidth||this.bitmap.width,s=this.getTextWidth(" ");let r="",o=1;for(let t=0;tn){const t=i.split("");for(let e=0;el?(r+="\n"+t[e],l=n-i):(0===e&&(r+=" "),r+=t[e],l-=i)}}else{const a=h+s;if(0===t||a>l){if(t>0){if(e.maxLines===o)return r;r+="\n",o++}r+=i,l=n-h}else l-=a,r+=" "+i}}t{this[t.type](t.text,t.options)})},DKTools.Sprite.prototype.drawText=function(t,e={}){if(!this.hasBitmap()||null==t||""===t)return!1;t=String(t),e=e||{};const{pos:i,rect:n,font:s,textColor:r,paintOpacity:o,resetFont:a,resetTextColor:l,resetPaintOpacity:h}=e;let{x:u,y:c,width:p,height:d,align:f}=e;return i instanceof Object&&(u=i.x,c=i.y),n instanceof Object&&(u=n.x,c=n.y,p=n.width,d=n.height),DKTools.Utils.isString(c)&&(c=this.getLineHeight()*parseFloat(c)),DKTools.Utils.isString(d)&&(d=this.getLineHeight()*parseFloat(d)),0!==p&&0!==d&&(u=u||0,c=c||0,p=p||this.standardDrawingWidth(),d=d||this.getLineHeight(),f=f||this.align,s&&this.changeFont(s),r&&this.changeTextColor(r),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.drawText(t,u,c,p,d,f),a&&this.resetFont(),l&&this.resetTextColor(),h&&this.resetPaintOpacity(),!0)},DKTools.Sprite.prototype.findText=function(t){return _.find(this._texts,{id:t})},DKTools.Sprite.prototype._getBitmapHeight=function(){return this._bitmapHeight},DKTools.Sprite.prototype._getBitmapWidth=function(){return this._bitmapWidth},DKTools.Sprite.prototype.getCurrentOpacity=function(){return 255*this.alpha},DKTools.Sprite.prototype.getLocalPoint=function(t,e){const i=DKTools.Base.prototype.getLocalPoint.call(this,t,e),n=this.anchor;return i.x+=this.width*n.x,i.y+=this.height*n.y,i},DKTools.Sprite.prototype.hasFillColor=function(){return!!this._fillColor},DKTools.Sprite.prototype.hasFixedBitmap=function(){return!!this._fixedBitmap},DKTools.Sprite.prototype.hasGraphicFolder=function(){return!!this._graphicFolder},DKTools.Sprite.prototype.hasGraphicName=function(){return!!this._graphicName},DKTools.Sprite.prototype.hasTexts=function(){return this._texts.length>0},DKTools.Sprite.prototype.isResizable=function(){return!this.hasGraphicName()&&!this.hasFixedBitmap()},DKTools.Sprite.prototype._loadGraphic=function(){if(this.hasGraphicFolder()&&this.hasGraphicName()){const t=this._graphicFolder,e=this._graphicName,i=this._graphicLoadListener;this.loadBitmap(t,e,i),this.updateReadyEvents()}},DKTools.Sprite.prototype.loadAnimation=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/animations/",t,e,i,n)},DKTools.Sprite.prototype.loadBattleback1=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks1/",t,e,i,n)},DKTools.Sprite.prototype.loadBattleback2=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks2/",t,e,i,n)},DKTools.Sprite.prototype.loadBitmap=function(t,e,i,n,s){if(t instanceof Object)return this.loadBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth);const r=DKTools.Utils.Bitmap.load(t,e,null,n,s);return!!this.setBitmap(r)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.loadCharacter=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/characters/",t,e,i,n)},DKTools.Sprite.prototype.loadEnemy=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/enemies/",t,e,i,n)},DKTools.Sprite.prototype.loadFace=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/faces/",t,e,i,n)},DKTools.Sprite.prototype.loadParallax=function(t,e,i,n){return t instanceof Object?this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t.filename,t.listener,t.hue,t.smooth):this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t,e,i,n)},DKTools.Sprite.prototype.loadPicture=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/pictures/",t,e,i,n)},DKTools.Sprite.prototype.loadSvActor=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_actors/",t,e,i,n)},DKTools.Sprite.prototype.loadSvEnemy=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_enemies/",t,e,i,n)},DKTools.Sprite.prototype.loadSystem=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/system/",t,e,i,n)},DKTools.Sprite.prototype.loadTileset=function(t,e,i,n){return t instanceof Object?this.loadBitmap(ImageManager.TILESETS_FOLDER,t.filename,t.listener,t.hue,t.smooth):this.loadBitmap(ImageManager.TILESETS_FOLDER,t,e,i,n)},DKTools.Sprite.prototype.loadTitle1=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles1/",t,e,i,n)},DKTools.Sprite.prototype.loadTitle2=function(t,e,i,n){return t instanceof Object?this.loadBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles2/",t,e,i,n)},DKTools.Sprite.prototype.loadWindowskin=function(t,e,i,n){return t instanceof Object?this.loadSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth):this.loadSystem(t||this.standardWindowskin(),e,i,n)},DKTools.Sprite.prototype.moveWithAnchor=function(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e),n=this.anchor;this.move(i.x+this.width*n.x,i.y+this.height*n.y)},DKTools.Sprite.prototype.standardAlign=function(){return"center"},DKTools.Sprite.prototype.standardAnchor=function(){return new Point(0,0)},DKTools.Sprite.prototype.standardFillColor=function(){return null},DKTools.Sprite.prototype.standardFont=function(){return{fontFace:this.standardFontFace(),fontItalic:this.standardFontItalic(),fontSize:this.standardFontSize()}},DKTools.Sprite.prototype.standardFontFace=function(){try{return Window_Base.prototype.standardFontFace.call(this)}catch(t){return"GameFont"}},DKTools.Sprite.prototype.standardFontItalic=function(){return!1},DKTools.Sprite.prototype.standardFontSize=function(){try{return Window_Base.prototype.standardFontSize.call(this)}catch(t){return 28}},DKTools.Sprite.prototype.standardFrame=function(){return new Rectangle(0,0,this.width,this.height)},DKTools.Sprite.prototype.standardGraphicFolder=function(){return"img/system/"},DKTools.Sprite.prototype.standardGraphicName=function(){return""},DKTools.Sprite.prototype.standardOpacity=function(){return 255},DKTools.Sprite.prototype.standardPaintOpacity=function(){return 255},DKTools.Sprite.prototype.standardTextColor=function(){return"#ffffff"},DKTools.Sprite.prototype.standardMask=function(){return null},DKTools.Sprite.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t),this.setupBitmap(t),this.setupFrame(t.frame),this.setupAnchor(t.anchor),this.setupAlign(t.align),this.setupFont(t.font),this.setupTextColor(t.textColor),this.setupPaintOpacity(t.paintOpacity),this.setupFillColor(t.fillColor),this.setupOpacity(t.opacity),this.setupGraphicFolder(t.graphicFolder),this.setupGraphicName(t.graphicName)},DKTools.Sprite.prototype.setupAlign=function(t){this._align=t||this.standardAlign()},DKTools.Sprite.prototype.setupAnchor=function(t,e){const i=DKTools.Utils.Point.tryToPoint(t,e),n=Object.assign(this.standardAnchor(),i);this.anchor.copy(n)},DKTools.Sprite.prototype.setupBitmap=function(t){let e=null;t instanceof DKTools.Sprite&&t.hasFixedBitmap()&&t.canCloneFixedBitmap()?e=DKTools.Utils.Bitmap.clone(t.bitmap):t instanceof Object&&(e=DKTools.Utils.Bitmap.load(t.bitmap||t)),e?(this.bitmap=e,this.bitmap.addLoadListener(this.setupSize.bind(this))):this.bitmap=null,this._fixedBitmap=!!this.bitmap},DKTools.Sprite.prototype.setupFillColor=function(t){this._fillColor=null!==t?_.defaultTo(t,this.standardFillColor()):null},DKTools.Sprite.prototype.setupFont=function(t){this._font=Object.assign(this.standardFont(),t)},DKTools.Sprite.prototype.setupFrame=function(t,e,i,n){const s=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,n),r=Object.assign(this.standardFrame(),s);Sprite.prototype.setFrame.call(this,r.x,r.y,r.width,r.height)},DKTools.Sprite.prototype.setupGraphicFolder=function(t){this._graphicFolder=_.defaultTo(t,this.standardGraphicFolder())},DKTools.Sprite.prototype.setupGraphicLoadListener=function(t){this._graphicLoadListener=t||null},DKTools.Sprite.prototype.setupGraphicName=function(t){this._graphicName=null!==t?_.defaultTo(t,this.standardGraphicName()):null},DKTools.Sprite.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this._bitmapHeight=this._checkHeight(t)},DKTools.Sprite.prototype.setupMask=function(t){this.mask=null!==t?_.defaultTo(t,this.standardMask()):null},DKTools.Sprite.prototype.setupOpacity=function(t){this._opacity=DKTools.Utils.Number.clamp(_.defaultTo(t,this.standardOpacity(),0,255))},DKTools.Sprite.prototype.setupPaintOpacity=function(t){this._paintOpacity=_.defaultTo(t,this.standardPaintOpacity())},DKTools.Sprite.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);this.setupWidth(t),this.setupHeight(e)},DKTools.Sprite.prototype.setupTextColor=function(t){this._textColor=t||this.standardTextColor()},DKTools.Sprite.prototype.setupWidth=function(t){this._bitmapWidth=this._checkWidth(t)},DKTools.Sprite.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let n=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setAlign(t.align,!0)&&n++,this.setAnchor(t.anchor)&&n++,this.setFont(t.font,!0)&&n++,this.setTextColor(t.textColor,!0)&&n++,this.setPaintOpacity(t.paintOpacity,!0)&&n++,this.setFillColor(t.fillColor,!0)&&n++,this.setOpacity(t.opacity,!0)&&n++,this.setGraphicFolder(t.graphicFolder,!0)&&n++,this.setGraphicName(t.graphicName,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n},DKTools.Sprite.prototype.setAlign=function(t,e=!1){if(this._align===t)return!1;const i=this._align;return this.setupAlign(t),this._align!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setAnchor=function(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.anchor,i))return!1;const n=DKTools.Utils.Point.clone(this.anchor);return this.setupAnchor(i),!DKTools.Utils.Point.equals(this.anchor,n)},DKTools.Sprite.prototype.setBitmap=function(t){return this.bitmap!==t&&(this.setupBitmap(t),!0)},DKTools.Sprite.prototype.setFillColor=function(t,e=!1){if(this._fillColor===t)return!1;const i=this._fillColor;return this.setupFillColor(t),this._fillColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setFont=function(t,e=!1){if(_.isEqual(this._font,Object.assign(this.standardFont(),t)))return!1;const i={...this._font};return this.setupFont(t),!_.isEqual(this._font,i)&&(e||this.start(),!0)},DKTools.Sprite.prototype.setFrame=function(t,e,i,n){const s=DKTools.Utils.Rectangle.toRectangle(t,e,i,n);if(DKTools.Utils.Rectangle.equals(this._frame,s))return!1;const r=DKTools.Utils.Rectangle.clone(this._frame);return this.setupFrame(s),!DKTools.Utils.Rectangle.equals(this._frame,r)},DKTools.Sprite.prototype.setGraphicFolder=function(t,e=!1){if(this._graphicFolder===t)return!1;const i=this._graphicFolder;return this.setupGraphicFolder(t),this._graphicFolder!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setGraphicName=function(t,e=!1){if(this._graphicName===t)return!1;const i=this._graphicName;return this.setupGraphicName(t),this._graphicName!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setHeight=function(t,e=!1){return this.resize(this._getBitmapWidth(),t,e)},DKTools.Sprite.prototype.setMask=function(t){return this.mask!==t&&(this.setupMask(t),!0)},DKTools.Sprite.prototype.setOpacity=function(t,e=!1){if(this._opacity===t)return!1;const i=this._opacity;return this.setupOpacity(t),this._opacity!==i&&(e||this.updateOpacity(),!0)},DKTools.Sprite.prototype.setPaintOpacity=function(t,e=!1){if(this._paintOpacity===t)return!1;const i=this._paintOpacity;return this.setupPaintOpacity(t),this._paintOpacity!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setTextColor=function(t,e=!1){if(this._textColor===t)return!1;const i=this._textColor;return this.setupTextColor(t),this._textColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setWidth=function(t,e=!1){return this.resize(t,this._getBitmapHeight(),e)},DKTools.Sprite.prototype.redrawAll=function(){this.clear(),this.drawAll(),this.updateRedrawAllEvents()},DKTools.Sprite.prototype.removeBitmap=function(){this.hasBitmap()&&this.setBitmap(null)},DKTools.Sprite.prototype.removeFillColor=function(){this.hasFillColor()&&this.setFillColor(null)},DKTools.Sprite.prototype.removeGraphicName=function(){this.hasGraphicName()&&this.setGraphicName(null)},DKTools.Sprite.prototype.removeText=function(t,e=!1){const i=this.findText(t);return i?(DKTools.Utils.Array.remove(this._texts,i),e||this.refreshAll(),i):null},DKTools.Sprite.prototype.reserveAnimation=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/animations/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveBattleback1=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks1/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveBattleback2=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks2/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveBitmap=function(t,e,i,n,s,r){if(t instanceof Object)return this.reserveBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);const o=DKTools.Utils.Bitmap.reserve(t,e,null,n,s,r);return!!this.setBitmap(o)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.reserveCharacter=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/characters/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveEnemy=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/enemies/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveFace=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/faces/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveParallax=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t,e,i,n,s)},DKTools.Sprite.prototype.reservePicture=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/pictures/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveSvActor=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_actors/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveSvEnemy=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_enemies/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveSystem=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/system/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveTileset=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap(ImageManager.TILESETS_FOLDER,t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap(ImageManager.TILESETS_FOLDER,t,e,i,n,s)},DKTools.Sprite.prototype.reserveTitle1=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles1/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveTitle2=function(t,e,i,n,s){return t instanceof Object?this.reserveBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles2/",t,e,i,n,s)},DKTools.Sprite.prototype.reserveWindowskin=function(t,e,i,n,s){return t instanceof Object?this.reserveSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth,t.reservationId):this.reserveSystem(t||this.standardWindowskin(),e,i,n,s)},DKTools.Sprite.prototype.resetAll=function(){this.resetFont(),this.resetPaintOpacity(),this.resetTextColor()},DKTools.Sprite.prototype.resetFont=function(){this.changeFont(this.font)},DKTools.Sprite.prototype.resetPaintOpacity=function(){this.changePaintOpacity(this.paintOpacity)},DKTools.Sprite.prototype.resetTextColor=function(){this.changeTextColor(this.textColor)},DKTools.Sprite.prototype.resize=function(t,e,i=!1,n=!1){if(!this.isResizable())return!1;if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._bitmapWidth===t&&this._bitmapHeight===e)return!1;const s=this._bitmapWidth,r=this._bitmapHeight;return this.setupSize(t,e),(this._bitmapWidth!==s||this._bitmapHeight!==r)&&(i||this.start(),n&&this.activate(),!0)},DKTools.Sprite.prototype.rotateHue=function(t){return!(!this.hasBitmap()||!t)&&(this.bitmap.rotateHue(t),!0)},DKTools.Sprite.prototype.updateAll=function(){DKTools.Base.prototype.updateAll.call(this),this.updateBitmap()},DKTools.Sprite.prototype.updateBitmap=function(){this.hasBitmap()&&(this.updateFont(),this.updatePaintOpacity(),this.updateTextColor())},DKTools.Sprite.prototype.updateDrawAllEvents=function(){this.updateEventsContainer("draw-all")},DKTools.Sprite.prototype.updateFill=function(){this.hasFillColor()&&this.fillAll(this.fillColor)},DKTools.Sprite.prototype.updateFont=function(t={}){t=t||{},this.bitmap.fontFace=t.fontFace||this.font.fontFace,this.bitmap.fontItalic=!!t.fontItalic,this.bitmap.fontSize=t.fontSize||this.font.fontSize},DKTools.Sprite.prototype.updatePaintOpacity=function(t){Number.isFinite(t)||(t=this.paintOpacity),this.bitmap.paintOpacity=t},DKTools.Sprite.prototype.updateTextColor=function(t){this.bitmap.textColor=t||this.textColor},DKTools.Sprite.prototype.updateOpacity=function(t){Number.isFinite(t)||(t=this.opacity),this.alpha=DKTools.Utils.Number.clamp(t,0,255)/255},DKTools.Sprite.Button=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearMousePressTime()}_clearMousePressTime(){this._mousePressTime=0}isPressed(){return this._mousePressTime>0&&!this.isLongPressed()}isLongPressed(){return this._mousePressTime>=this._longPressInterval}_setupEvents(){DKTools.Sprite.prototype._setupEvents.call(this),this._setupUpdateButtonStateEvent()}_setupOptions(){DKTools.Sprite.prototype._setupOptions.call(this),this._setupProcessMouseOption()}_setupUpdateButtonStateEvent(){this.addEvent({type:"update",onUpdate:this.updateButtonState.bind(this)})}_setupProcessMouseOption(){this.enableOption("process-mouse")}standardActive(){return!1}standardLongPressInterval(){return 18}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupLongPressInterval(t.longPressInterval)}setupLongPressInterval(t){this._longPressInterval=t||this.standardLongPressInterval()}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setLongPressInterval(t.longPressInterval)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setLongPressInterval(t){if(this._longPressInterval===t)return!1;const e=this._longPressInterval;return this.setupLongPressInterval(t),this._longPressInterval!==e}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processMousePress()}processMousePress(){if(this.isVisible()&&this.isMouseInside()&&(this.isActive()||this.isOptionEnabled("process-mouse-press-ignore-active")))if(TouchInput.isMousePressed()){let t;this._mousePressTime++,TouchInput.isLeftButtonPressed()?t="left":TouchInput.isMiddleButtonPressed()?t="middle":TouchInput.isRightButtonPressed()&&(t="right"),t&&(this.updateMouseDownEvents(t),this.isLongPressed()&&(this._mousePressTime===this._longPressInterval&&this.updateMouseLongPressStartedEvents(t),this.updateMouseLongPressEvents(t)))}else{let t;TouchInput.isLeftButtonReleased()?t="left":TouchInput.isMiddleButtonReleased()?t="middle":TouchInput.isRightButtonReleased()&&(t="right"),t&&(this.isLongPressed()?this.updateMouseLongPressFinishedEvents(t):this.isPressed()&&this.updateMouseClickEvents(t),this._mousePressTime>0&&this.updateMouseUpEvents(t)),this._clearMousePressTime()}else this._clearMousePressTime()}updateMouseDownEvents(t){this.updateEventsContainer("mouse-down-"+t)}updateMouseUpEvents(t){this.updateEventsContainer("mouse-up-"+t)}updateMouseClickEvents(t){this.updateEventsContainer("mouse-click-"+t)}updateMouseLongPressEvents(t){this.updateEventsContainer("mouse-long-press-"+t)}updateMouseLongPressStartedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-started`)}updateMouseLongPressFinishedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-finished`)}updateStateNormalEvents(){this.updateEventsContainer("state-normal")}updateStatePressedEvents(){this.updateEventsContainer("state-pressed")}updateButtonState(){this._mousePressTime>0?this.updateStatePressedEvents():this.updateStateNormalEvents()}},Object.defineProperties(DKTools.Sprite.Button.prototype,{longPressInterval:{get:function(){return this._longPressInterval},configurable:!0},mousePressTime:{get:function(){return this._mousePressTime},configurable:!0}}),DKTools.Sprite.Cursor=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearAnimationCount()}_clearAnimationCount(){this._animationCount=0}_createAll(){DKTools.Sprite.prototype._createAll.call(this),this._createWindowskin()}_createWindowskin(){this._windowskin=ImageManager.loadSystem(this.standardWindowskin())}refreshAll(){DKTools.Sprite.prototype.refreshAll.call(this),this.refreshCursor()}refreshCursor(){const t=this._cursorRect.x,e=this._cursorRect.y,i=this._cursorRect.width,n=this._cursorRect.height,s=this.parent,r=Math.min(i,s.width-t),o=Math.min(n,s.height-e);if(this.move(t,e),i>0&&n>0){const t=this._windowskin,e=new Bitmap(r,o),s=96,a=48;e.blt(t,s+4,s+4,a-8,a-8,4,4,i-8,n-8),e.blt(t,s+4,s,a-8,4,4,0,i-8,4),e.blt(t,s+4,s+a-4,a-8,4,4,0+n-4,i-8,4),e.blt(t,s,s+4,4,a-8,0,4,4,n-8),e.blt(t,s+a-4,s+4,4,a-8,0+i-4,4,4,n-8),e.blt(t,s,s,4,4,0,0,4,4),e.blt(t,s+a-4,s,4,4,0+i-4,0,4,4),e.blt(t,s,s+a-4,4,4,0,0+n-4,4,4),e.blt(t,s+a-4,s+a-4,4,4,0+i-4,0+n-4,4,4),this.setupBitmap(e)}}standardBlinkSpeed(){return 8}standardCursorRect(){return new Rectangle(0,0,0,0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupBlinkSpeed(t.blinkSpeed),this.setupCursorRect(t.cursorRect)}setupBlinkSpeed(t){this._blinkSpeed=_.defaultTo(t,this.standardBlinkSpeed())}setupCursorRect(t,e,i,n){const s=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,n);this._cursorRect=Object.assign(this.standardCursorRect(),s)}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setBlinkSpeed(t.blinkSpeed)&&n++,this.setCursorRect(t.cursorRect)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setBlinkSpeed(t){if(this._blinkSpeed===t)return!1;const e=this._blinkSpeed;return this.setupBlinkSpeed(t),this._blinkSpeed!==e}setCursorRect(t,e,i,n){const s=DKTools.Utils.Rectangle.toRectangle(t,e,i,n);if(DKTools.Utils.Rectangle.equals(this._cursorRect,s))return!1;const r=DKTools.Utils.Rectangle.clone(this._cursorRect);return this.setupCursorRect(s),!DKTools.Utils.Rectangle.equals(this._cursorRect,r)&&(this.refreshCursor(),!0)}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processCursorAnimation()}processCursorAnimation(){const t=this._animationCount%40;let e=this.parent.getCurrentOpacity();this.parent.isVisibleAndActive()&&(this._animationCount++,e-=t<20?t*this._blinkSpeed:(40-t)*this._blinkSpeed),this.setOpacity(e)}},Object.defineProperties(DKTools.Sprite.Cursor.prototype,{cursorRect:{get:function(){return this._cursorRect},configurable:!0},blinkSpeed:{get:function(){return this._blinkSpeed},configurable:!0}}),DKTools.Sprite.Arrow=class extends DKTools.Sprite.Button{static getRect(t){const e=24,i=12;let n,s,r,o;switch(t){case"up":n=132,s=24,r=e,o=i;break;case"down":n=132,s=60,r=e,o=i;break;case"left":n=120,s=36,r=i,o=e;break;case"right":n=156,s=36,r=i,o=e}return DKTools.Utils.Rectangle.tryToRectangle(n,s,r,o)}refreshAll(){DKTools.Sprite.Button.prototype.refreshAll.call(this),this.refreshArrow()}refreshArrow(){this.setFrame(DKTools.Sprite.Arrow.getRect(this._arrowType))}standardVisible(){return!1}standardGraphicName(){return this.standardWindowskin()}standardAnchor(){return new Point(.5,.5)}standardArrowType(){return null}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupArrowType(t.arrowType)}setupArrowType(t){this._arrowType=t||this.standardArrowType()}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setArrowType(t.arrowType,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setArrowType(t,e=!1){if(this._arrowType===t)return!1;const i=this._arrowType;return this.setupArrowType(t),this._arrowType!==i&&(e||this.refreshAll(),!0)}},Object.defineProperties(DKTools.Sprite.Arrow.prototype,{arrowType:{get:function(){return this._arrowType},configurable:!0}}),DKTools.Sprite.Selectable=class extends DKTools.Sprite.Button{_addAllChildren(){DKTools.Sprite.Button.prototype._addAllChildren.call(this),this._addCursorSprite()}_addCursorSprite(){this.addChild(this._cursorSprite)}activate(){DKTools.Sprite.Button.prototype.activate.call(this),this.reselect()}addItem(t,e=!1){const i=this.insertItem(t,this.getMaxItems()-1,!0);return e||this.refreshAll(),i}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return e||this.refreshAll(),i}_clearAll(){DKTools.Sprite.Button.prototype._clearAll.call(this),this._clearItems(),this._clearHandlers(),this._clearTopRow(),this._clearTopCol()}_clearItems(){this._items=[]}_clearHandlers(){this._handlers={}}_clearTopRow(){this._topRow=0}_clearTopCol(){this._topCol=0}_createAll(){DKTools.Sprite.Button.prototype._createAll.call(this),this._createCursorSprite()}_createCursorSprite(){this._cursorSprite=new DKTools.Sprite.Cursor}_checkItem(t){return void 0===t.enabled&&(t.enabled=!0),void 0===t.ext&&(t.ext=null),t.symbol&&DKTools.Utils.isFunction(t.handler)&&this.setHandler(t.symbol,t.handler),t}callHandler(t){this.isHandled(t)&&this._handlers[t](this._index,this)}callOkHandler(){const t=this.getCurrentItemSymbol();this.isHandled(t)?this.callHandler(t):this.isHandled("ok")?this.callHandler("ok"):this.activate()}callCancelHandler(){this.callHandler("cancel")}clearItem(t){this.clearRect(this.getItemRect(t))}cursorDown(t=!1){this.hasCursorDownHandler()&&this._cursorDownHandler(t,this)}cursorUp(t=!1){this.hasCursorUpHandler()&&this._cursorUpHandler(t,this)}cursorRight(t=!1){this.hasCursorRightHandler()&&this._cursorRightHandler(t,this)}cursorLeft(t=!1){this.hasCursorLeftHandler()&&this._cursorLeftHandler(t,this)}cursorPageDown(){this.hasCursorPageDownHandler()&&this._cursorPageDownHandler(this)}cursorPageUp(){this.hasCursorPageUpHandler()&&this._cursorPageUpHandler(this)}deactivate(t=!1){DKTools.Sprite.Button.prototype.deactivate.call(this),t&&this.deselect()}deselect(){this.selectItem(-1)}disableItem(t,e=!1){(this.getItem(t)||{}).enabled=!1,e||this.refreshAll()}drawAll(){DKTools.Sprite.Button.prototype.drawAll.call(this),this.drawAllItems()}drawAllItems(){const t=this.getMaxPageItems(),e=this.getMaxItems();let i=this.getTopIndex();for(let n=0;n0?this._index-1:t?this.getMaxItems()-1:-1}getNextIndex(t=!1){return this._index0}hasSymbol(t){return _.includes(this._items,{symbol:t})}hasExt(t){return _.includes(this._items,{ext:t})}hasCursorDownHandler(){return!!this._cursorDownHandler}hasCursorUpHandler(){return!!this._cursorUpHandler}hasCursorRightHandler(){return!!this._cursorRightHandler}hasCursorLeftHandler(){return!!this._cursorLeftHandler}hasCursorPageDownHandler(){return!!this._cursorPageDownHandler}hasCursorPageUpHandler(){return!!this._cursorPageUpHandler}hasDrawItemHandler(){return!!this._itemDrawHandler}hideCursor(){this._cursorSprite.hide()}hitTest(t,e){if(this.isOutside(t,e))return-1;const i=this.scale,n=this.getLocalPoint(t,e),s=this.getMaxPageItems(),r=this.getMaxItems();let o=this.getTopIndex();for(let t=0;tthis.insertItem(t,e+i,!0));return i||this.refreshAll(),n}isCursorFixed(){return this._cursorFixed}isCursorAll(){return this._cursorAll}isFixedHorizontal(){return this._fixedHorizontal}isHorizontal(){return this.isFixedHorizontal()||1===this.getMaxPageRows()}isVertical(){return!this.isHorizontal()}isCursorMovable(){return this.isVisibleAndActive()&&!this.isCursorFixed()&&!this.isCursorAll()&&this.hasItems()}isOkEnabled(){return!0}isCancelEnabled(){return this.isHandled("cancel")}isOkTriggered(){return Input.isRepeated("ok")}isCancelTriggered(){return Input.isRepeated("cancel")||TouchInput.isCancelled()}isCursorVisible(){if(!this._cursorSprite.isVisible())return!1;if(this.isHorizontal()){const t=this.getCurrentCol();return t>=this.getTopCol()&&t<=this.getBottomCol()}const t=this.getCurrentRow();return t>=this.getTopRow()&&t<=this.getBottomRow()}isItemEnabled(t){const e=(this.getItem(t)||{}).enabled;return DKTools.Utils.isFunction(e)?e(t,this):e}isCurrentItemEnabled(){return this.isItemEnabled(this._index)}isItemVisible(t){return DKTools.Utils.Number.inRange(t,this.getTopIndex(),this.getBottomIndex()+1)}isItemSelected(t){return this._index===t}isHandled(t){return!!this._handlers[t]}isItemHandled(t){const e=this.getItem(t)||{};return this.isHandled(e.symbol)||DKTools.Utils.isFunction(e.okHandler)}isCurrentItemHandled(){return this.isItemHandled(this._index)}_onTouch(t=!1){const e=this._index,i=TouchInput.x,n=TouchInput.y,s=this.hitTest(i,n);s>=0&&(this._index===s?t&&this.isOkEnabled()&&this.processOk():this.isCursorMovable()&&this.selectItem(s)),this._index!==e&&this.playCursorSound()}playOkSound(){SoundManager.playOk()}playCancelSound(){SoundManager.playCancel()}playCursorSound(){SoundManager.playCursor()}playBuzzerSound(){SoundManager.playBuzzer()}processAll(){DKTools.Sprite.Button.prototype.processAll.call(this),this.processCursorMove(),this.processHandling()}processCursorMove(){if(!this.isCursorMovable())return;const t=this._index;Input.isRepeated("down")&&this.cursorDown(Input.isTriggered("down")),Input.isRepeated("up")&&this.cursorUp(Input.isTriggered("up")),Input.isRepeated("right")&&this.cursorRight(Input.isTriggered("right")),Input.isRepeated("left")&&this.cursorLeft(Input.isTriggered("left")),Input.isTriggered("pagedown")&&this.cursorPageDown(),Input.isTriggered("pageup")&&this.cursorPageUp(),this._index!==t&&this.playCursorSound()}processHandling(){this.isVisibleAndActive()&&(this.isOkEnabled()&&this.isOkTriggered()?this.processOk():this.isCancelEnabled()&&this.isCancelTriggered()&&this.processCancel())}processMouseHover(){if(this.isOptionEnabled("process-mouse-hover")&&this.isCursorMovable()&&TouchInput.date>Input.date){const t=this._index,e=TouchInput.mouseX,i=TouchInput.mouseY,n=this.hitTest(e,i);n>=0&&n!==t&&this.selectItem(n,!0)}}processWheelScroll(){if(this.isOptionEnabled("process-wheel-scroll")&&this.isVisibleAndActive()){this._wheelY>0?this.isHorizontal()?this.scrollRight():this.scrollDown():this.isHorizontal()?this.scrollLeft():this.scrollUp()}}processOk(){if(this.isCurrentItemEnabled()){this.playOkSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem()||{};DKTools.Utils.isFunction(t.okHandler)?t.okHandler(this._index,this):this.callOkHandler()}else this.playBuzzerSound()}processCancel(){this.playCancelSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem();t&&DKTools.Utils.isFunction(t.cancelHandler)?t.cancelHandler(this._index,this):this.callCancelHandler()}redrawItem(t){this.isItemVisible(t)&&(this.clearItem(t),this.drawItem(t))}redrawCurrentItem(){this.redrawItem(this._index)}removeHandler(t){delete this._handlers[t]}removeItem(t,e=!1){const i=this.getItem(t);return i?(DKTools.Utils.Array.remove(this._items,i),e||this.refreshAll(),i):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return e||this.refreshAll(),i}replaceItem(t,e,i=!1){const n=this._checkItem(t);e=e||0;const s=this._items[e];return this._items[e]=n,i||this.refreshAll(),s}reselect(){this.selectItem(this._index)}resetScroll(){0!==this._index&&this.selectItem(0)}_setupEvents(){DKTools.Sprite.Button.prototype._setupEvents.call(this),this._setupMouseClickEvent(),this._setupMouseLongPressEvent(),this._setupMouseHoverEvents(),this._setupWheelScrollEvents()}_setupMouseClickEvent(){this.addEvent({type:"mouse-click-left",onUpdate:this._onTouch.bind(this,!0)})}_setupMouseLongPressEvent(){this.addEvent({type:"mouse-long-press-left",onUpdate:this._onTouch.bind(this,!1)})}_setupMouseHoverEvents(){this.addEvent({type:"mouse-enter",onUpdate:this.processMouseHover.bind(this)}),this.addEvent({type:"mouse-move",onUpdate:this.processMouseHover.bind(this)})}_setupWheelScrollEvents(){this.addEvent({type:"wheel-Y-inside",onUpdate:this.processWheelScroll.bind(this)}),this.addEvent({type:"wheel-Y-outside",onUpdate:this.processWheelScroll.bind(this)})}standardIndex(){return 0}standardMaxCols(){return 1}standardCursorFixed(){return!1}standardCursorAll(){return!1}standardFixedHorizontal(){return!1}standardHorizontalSpacing(){return 0}standardVerticalSpacing(){return 0}standardTextPadding(){return 6}standardCursorDownHandler(){return t=>{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),n=this.getMaxCols();(e{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),n=this.getMaxCols();(e>=n||t&&i===this.getMaxRows()*n)&&this.selectItem((e-n+i)%i)}}standardCursorRightHandler(){return t=>{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i>0||t)&&this.selectItem((i-1+e)%e)}else this.selectPrevItem(t)}}standardCursorPageDownHandler(){return()=>{if(this.isHorizontal()){const t=this.getTopCol(),e=this.getMaxPageCols(),i=this.getMaxItems();t+e{if(this.isHorizontal()){const t=this.getTopCol();t>0&&(this.setTopCol(t-this.getMaxPageCols()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}else{const t=this.getTopRow();t>0&&(this.setTopRow(t-this.getMaxPageRows()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}}}standardItems(){return[]}standardItemDrawHandler(){return t=>{const e=this.getItemName(t),i=this.getItemFont(t),n=this.getItemTextColor(t),s=this.getItemPaintOpacity(t),r=this.getItemAlign(t),o=this.getItemRectForText(t);this.drawText(e,{font:i,textColor:n,paintOpacity:s,align:r,rect:o,resetFont:!0,resetTextColor:!0,resetPaintOpacity:!0})}}standardItemWidth(){return()=>Math.floor((this.width+this._horizontalSpacing)/this.getMaxCols()-this._horizontalSpacing)}standardItemHeight(){return this.getLineHeight()}standardItemRect(){return t=>{const e=new Rectangle(0,0,this.getItemWidth(),this.getItemHeight()),i=this.getMaxCols();return this.isHorizontal()?(e.x=(t-this.getTopCol())*(e.width+this._horizontalSpacing),e.y=0):(e.x=t%i*(e.width+this._horizontalSpacing),e.y=(Math.floor(t/i)-this.getTopRow())*(e.height+this._verticalSpacing)),e}}standardItemFont(){return()=>this.font}standardItemTextColor(){return()=>this.textColor}standardItemPaintOpacity(){return t=>this.isItemEnabled(t)?this.standardEnabledItemPaintOpacity():this.standardDisabledItemPaintOpacity()}standardEnabledItemPaintOpacity(){return 255}standardDisabledItemPaintOpacity(){try{return Window_Base.prototype.translucentOpacity.call(this)}catch(t){return 160}}standardItemAlign(){return this.align}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupIndex(t.index),this.setupMaxCols(t.maxCols),this.setupFixedHorizontal(t.fixedHorizontal),this.setupCursorFixed(t.cursorFixed),this.setupCursorAll(t.cursorAll),this.setupCursorDownHandler(t.cursorDownHandler),this.setupCursorUpHandler(t.cursorUpHandler),this.setupCursorRightHandler(t.cursorRightHandler),this.setupCursorLeftHandler(t.cursorLeftHandler),this.setupCursorPageDownHandler(t.cursorPageDownHandler),this.setupCursorPageUpHandler(t.cursorPageUpHandler),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupTextPadding(t.textPadding),this.setupItems(t.items),this.setupItemDrawHandler(t.drawItemHandler),this.setupItemWidth(t.itemWidth),this.setupItemHeight(t.itemHeight),this.setupItemRect(t.itemRect),this.setupItemFont(t.itemFont),this.setupItemTextColor(t.itemTextColor),this.setupItemPaintOpacity(t.itemPaintOpacity),this.setupItemAlign(t.itemAlign)}setupIndex(t){this._lastIndex=this._index,this._index=_.defaultTo(t,this.standardIndex())}setupMaxCols(t){this._maxCols=t||this.standardMaxCols()}setupFixedHorizontal(t){this._fixedHorizontal=_.defaultTo(t,this.standardFixedHorizontal())}setupCursorFixed(t){this._cursorFixed=_.defaultTo(t,this.standardCursorFixed())}setupCursorAll(t){this._cursorAll=_.defaultTo(t,this.standardCursorAll())}setupCursorDownHandler(t){this._cursorDownHandler=t||this.standardCursorDownHandler()}setupCursorUpHandler(t){this._cursorUpHandler=t||this.standardCursorUpHandler()}setupCursorRightHandler(t){this._cursorRightHandler=t||this.standardCursorRightHandler()}setupCursorLeftHandler(t){this._cursorLeftHandler=t||this.standardCursorLeftHandler()}setupCursorPageDownHandler(t){this._cursorPageDownHandler=t||this.standardCursorPageDownHandler()}setupCursorPageUpHandler(t){this._cursorPageUpHandler=t||this.standardCursorPageUpHandler()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupTextPadding(t){this._textPadding=_.defaultTo(t,this.standardTextPadding())}setupItems(t){this._items=_.map(t||this.standardItems(),t=>this._checkItem(t))}setupItemDrawHandler(t){this._itemDrawHandler=t||this.standardItemDrawHandler()}setupItemWidth(t){this._itemWidth=t||this.standardItemWidth()}setupItemHeight(t){this._itemHeight=t||this.standardItemHeight()}setupItemRect(t){this._itemRect=t||this.standardItemRect()}setupItemFont(t){this._itemFont=t||this.standardItemFont()}setupItemTextColor(t){this._itemTextColor=t||this.standardItemTextColor()}setupItemPaintOpacity(t){this._itemPaintOpacity=t||this.standardItemPaintOpacity()}setupItemAlign(t){this._itemAlign=t||this.standardItemAlign()}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setIndex(t.index,!0)&&n++,this.setMaxCols(t.maxCols,!0)&&n++,this.setFixedHorizontal(t.fixedHorizontal,!0)&&n++,this.setCursorFixed(t.cursorFixed,!0)&&n++,this.setCursorAll(t.cursorAll,!0)&&n++,this.setCursorDownHandler(t.cursorDownHandler,!0)&&n++,this.setCursorUpHandler(t.cursorUpHandler,!0)&&n++,this.setCursorRightHandler(t.cursorRightHandler,!0)&&n++,this.setCursorLeftHandler(t.cursorLeftHandler,!0)&&n++,this.setCursorPageDownHandler(t.cursorPageDownHandler,!0)&&n++,this.setCursorPageUpHandler(t.cursorPageUpHandler,!0)&&n++,n+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setTextPadding(t.textPadding,!0)&&n++,this.setItems(t.items,!0)&&n++,this.setItemDrawHandler(t.drawItemHandler,!0)&&n++,this.setItemWidth(t.itemWidth,!0)&&n++,this.setItemHeight(t.itemHeight,!0)&&n++,this.setItemRect(t.itemRect,!0)&&n++,this.setItemFont(t.itemFont,!0)&&n++,this.setItemTextColor(t.itemTextColor,!0)&&n++,this.setItemPaintOpacity(t.itemPaintOpacity,!0)&&n++,this.setItemAlign(t.itemAlign,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setIndex(t,e=!1){return this._index!==t&&(this.setupIndex(t),this._index!==this._lastIndex&&(e||this.refreshAll(),!0))}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.refreshAll(),!0)}setFixedHorizontal(t,e=!1){if(this._fixedHorizontal===t)return!1;const i=this._fixedHorizontal;return this.setupFixedHorizontal(t),this._fixedHorizontal!==i&&(e||this.refreshAll(),!0)}setCursorFixed(t,e=!1){if(this._cursorFixed===t)return!1;const i=this._cursorFixed;return this.setupCursorFixed(t),this._cursorFixed!==i&&(e||this.refreshAll(),!0)}setCursorAll(t,e=!1){if(this._cursorAll===t)return!1;const i=this._cursorAll;return this.setupCursorAll(t),this._cursorAll!==i&&(e||this.refreshAll(),!0)}setCursorDownHandler(t,e=!1){if(this._cursorDownHandler===t)return!1;const i=this._cursorDownHandler;return this.setupCursorDownHandler(t),this._cursorDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorUpHandler(t,e=!1){if(this._cursorUpHandler===t)return!1;const i=this._cursorUpHandler;return this.setupCursorUpHandler(t),this._cursorUpHandler!==i&&(e||this.refreshAll(),!0)}setCursorRightHandler(t,e=!1){if(this._cursorRightHandler===t)return!1;const i=this._cursorRightHandler;return this.setupCursorRightHandler(t),this._cursorRightHandler!==i&&(e||this.refreshAll(),!0)}setCursorLeftHandler(t,e=!1){if(this._cursorLeftHandler===t)return!1;const i=this._cursorLeftHandler;return this.setupCursorLeftHandler(t),this._cursorLeftHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageDownHandler(t,e=!1){if(this._cursorPageDownHandler===t)return!1;const i=this._cursorPageDownHandler;return this.setupCursorPageDownHandler(t),this._cursorPageDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageUpHandler(t,e=!1){if(this._cursorPageUpHandler===t)return!1;const i=this._cursorPageUpHandler;return this.setupCursorPageUpHandler(t),this._cursorPageUpHandler!==i&&(e||this.refreshAll(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.refreshAll(),!0)}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.refreshAll(),!0)}setSpacing(t,e,i=!1){let n=0;return this.setHorizontalSpacing(t,!0)&&n++,this.setVerticalSpacing(e,!0)&&n++,n>0&&!i&&this.refreshAll(),n}setTextPadding(t,e=!1){if(this._textPadding===t)return!1;const i=this._textPadding;return this.setupTextPadding(t),this._textPadding!==i&&(e||this.refreshAll(),!0)}setItems(t,e=!1){return this._items!=t&&(this.setupItems(t),e||this.refreshAll(),!0)}setItemDrawHandler(t,e=!1){if(this._itemDrawHandler===t)return!1;const i=this._itemDrawHandler;return this.setupItemDrawHandler(t),this._itemDrawHandler!==i&&(e||this.refreshAll(),!0)}setItemWidth(t,e=!1){if(this._itemWidth===t)return!1;const i=this._itemWidth;return this.setupItemWidth(t),this._itemWidth!==i&&(e||this.refreshAll(),!0)}setItemHeight(t,e=!1){if(this._itemHeight===t)return!1;const i=this._itemHeight;return this.setupItemHeight(t),this._itemHeight!==i&&(e||this.refreshAll(),!0)}setItemFont(t,e=!1){if(this._itemFont===t)return!1;const i=this._itemFont;return this.setupItemFont(t),this._itemFont!==i&&(e||this.refreshAll(),!0)}setItemTextColor(t,e=!1){if(this._itemTextColor===t)return!1;const i=this._itemTextColor;return this.setupItemTextColor(t),this._itemTextColor!==i&&(e||this.refreshAll(),!0)}setItemPaintOpacity(t,e=!1){if(this._itemPaintOpacity===t)return!1;const i=this._itemPaintOpacity;return this.setupItemPaintOpacity(t),this._itemPaintOpacity!==i&&(e||this.refreshAll(),!0)}setItemAlign(t,e=!1){if(this._itemAlign===t)return!1;const i=this._itemAlign;return this.setupItemAlign(t),this._itemAlign!==i&&(e||this.refreshAll(),!0)}setTopRow(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopRow());this._topRow!==i&&(this._topRow=i,e||this.refreshAll())}setTopCol(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopCol());this._topCol!==i&&(this._topCol=i,e||this.refreshAll())}setBottomRow(t,e=!1){this.setTopRow(t-(this.getMaxPageRows()-1),e)}setBottomCol(t,e=!1){this.setTopCol(t-(this.getMaxPageCols()-1),e)}setHandler(t,e){this._handlers[t]=e}setCursorRect(t,e,i,n){return this._cursorSprite.setCursorRect(t,e,i,n)}showCursor(){this._cursorSprite.show(!0)}selectItem(t,e=!1){const i=this.getItem(t);this.setupIndex(t),this.refreshAll(),e&&this.playCursorSound(),i&&DKTools.Utils.isFunction(i.selectHandler)&&i.selectHandler(t,this),this.updateSelectEvents()}selectSymbol(t){const e=Math.max(0,this.findSymbol(t));this.selectItem(e)}selectExt(t){const e=Math.max(0,this.findExt(t));this.selectItem(e)}selectPrevItem(t=!1,e=!1){const i=this.getPrevIndex(t);i>=0&&this.selectItem(i,e)}selectNextItem(t=!1,e=!1){const i=this.getNextIndex(t);i>=0&&this.selectItem(i,e)}selectLastItem(t=!1){this.selectItem(this.getMaxItems()-1,t)}scrollDown(){this.getTopRow()+10&&this.cursorUp()}scrollRight(){this.getTopCol()+10&&this.cursorLeft()}updateAll(){DKTools.Sprite.Button.prototype.updateAll.call(this),this.updateCursor()}updateCursor(){if(this.isHorizontal()){const t=this.getCurrentCol();tthis.getBottomCol()&&this.setBottomCol(t)}else{const t=this.getCurrentRow();tthis.getBottomRow()&&this.setBottomRow(t)}if(this.isCursorAll()){const t=this.getMaxRows()*this.getItemHeight();this.setCursorRect(0,0,this.width,t),this.resetScroll()}else if(this.isCursorVisible()||!this._cursorSprite.hasBitmap()){const t=this.getItemRect(this._index);this.setCursorRect(t)}else this.setCursorRect(Rectangle.emptyRectangle)}updateSelectEvents(){this.updateEventsContainer("select")}},Object.defineProperties(DKTools.Sprite.Selectable.prototype,{cursorSprite:{get:function(){return this._cursorSprite},configurable:!0},lastIndex:{get:function(){return this._lastIndex},configurable:!0},index:{get:function(){return this._index},configurable:!0},maxCols:{get:function(){return this._maxCols},configurable:!0},cursorFixed:{get:function(){return this._cursorFixed},configurable:!0},cursorAll:{get:function(){return this._cursorAll},configurable:!0},cursorDownHandler:{get:function(){return this._cursorDownHandler},configurable:!0},cursorUpHandler:{get:function(){return this._cursorUpHandler},configurable:!0},cursorRightHandler:{get:function(){return this._cursorRightHandler},configurable:!0},cursorLeftHandler:{get:function(){return this._cursorLeftHandler},configurable:!0},cursorPageDownHandler:{get:function(){return this._cursorPageDownHandler},configurable:!0},cursorPageUpHandler:{get:function(){return this._cursorPageUpHandler},configurable:!0},horizontalSpacing:{get:function(){return this._horizontalSpacing},configurable:!0},verticalSpacing:{get:function(){return this._verticalSpacing},configurable:!0},textPadding:{get:function(){return this._textPadding},configurable:!0},items:{get:function(){return this._items},configurable:!0},itemDrawHandler:{get:function(){return this._itemDrawHandler},configurable:!0},itemWidth:{get:function(){return this._itemWidth},configurable:!0},itemHeight:{get:function(){return this._itemHeight},configurable:!0},itemFont:{get:function(){return this._itemFont},configurable:!0},itemTextColor:{get:function(){return this._itemTextColor},configurable:!0},itemPaintOpacity:{get:function(){return this._itemPaintOpacity},configurable:!0},itemAlign:{get:function(){return this._itemAlign},configurable:!0}}),DKTools.Sprite.ProgressBar=class extends DKTools.Sprite{addValue(t){t&&this.setValue(this._value+t)}aimateFull(t){return this.animateValue(this._maxValue,t)}animateEmpty(t){return this.animateValue(0,t)}animateValue(t,e){return this.addEvent({type:"update",repeatTime:e,repeats:0,onUpdate:this._updateAnimateValue.bind(this,t)})}canCloneFixedBitmap(){return!1}_drawProgressGraphic(){this.hasDrawGraphicHandler()&&this._drawGraphicHandler(this)}_drawProgressText(){this.hasDrawTextHandler()&&this._drawTextHandler(this)}drawAll(){DKTools.Sprite.prototype.drawAll.call(this),this.drawProgress()}drawProgress(){this._drawProgressGraphic(),this._drawProgressText()}getNextValue(){return Math.min(this._value+this._valueStep,this._maxValue)}getPercents(){return Math.ceil(this._value/this._maxValue*100)}getPrevValue(){return Math.max(0,this._value-this._valueStep)}hasDrawGraphicHandler(){return!!this._drawGraphicHandler}hasDrawTextHandler(){return!!this._drawTextHandler}isEmpty(){return 0===this._value}isFull(){return this._value===this._maxValue}isHorizontal(){return this.width>this.height}isVertical(){return!this.isHorizontal()}makeEmpty(){this.setValue(0)}makeFull(){this.setValue(this._maxValue)}nextValue(){return this.setValue(this.getNextValue())}prevValue(){return this.setValue(this.getPrevValue())}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setValueStep(t.valueStep,!0)&&n++,this.setMaxValue(t.maxValue,!0)&&n++,this.setValue(t.value,!0)&&n++,this.setBackgroundColor(t.backgroundColor,!0)&&n++,this.setProgressColor(t.progressColor,!0)&&n++,this.setDrawGraphicHandler(t.drawGraphicHandler,!0)&&n++,this.setDrawTextHandler(t.drawTextHandler,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setBackgroundColor(t,e=!1){if(this._backgroundColor===t)return!1;const i=this._backgroundColor;return this.setupBackgroundColor(t),this._backgroundColor!==i&&(e||this.refreshAll(),!0)}setDrawGraphicHandler(t,e=!1){return this._drawGraphicHandler!==t&&(this.setupDrawGraphicHandler(t),e||this.refreshAll(),!0)}setDrawTextHandler(t,e=!1){return this._drawTextHandler!==t&&(this.setupDrawTextHandler(t),e||this.refreshAll(),!0)}setMaxValue(t,e=!1){if(this._maxValue===t)return!1;const i=this._maxValue;return this.setupMaxValue(t),this._maxValue!==i&&(e||this.refreshAll(),!0)}setProgressColor(t,e=!1){if(this._progressColor===t)return!1;const i=this._progressColor;return this.setupProgressColor(t),this._progressColor!==i&&(e||this.refreshAll(),!0)}setValue(t,e=!1){if(this._value===t)return!1;const i=this._value;return this.setupValue(t),this._value!==i&&(e||this.refreshAll(),this.updateValueEvents(),!0)}setValueStep(t,e=!1){if(this._valueStep===t)return!1;const i=this._valueStep;return this.setupValueStep(t),this._valueStep!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupValueStep(t.valueStep),this.setupMaxValue(t.maxValue),this.setupValue(t.value),this.setupBackgroundColor(t.progressColor),this.setupProgressColor(t.progressColor),this.setupDrawGraphicHandler(t.drawGraphicHandler),this.setupDrawTextHandler(t.drawTextHandler)}setupBackgroundColor(t){this._backgroundColor=t||this.standardBackgroundColor()}setupDrawGraphicHandler(t){this._drawGraphicHandler=t||this.standardDrawGraphicHandler()}setupDrawTextHandler(t){this._drawTextHandler=t||this.standardDrawTextHandler()}setupMaxValue(t){this._maxValue=t||this.standardMaxValue()}setupProgressColor(t){this._progressColor=t||this.standardProgressColor()}setupValue(t){const e=this._maxValue,i=Math.max(0,Math.min(t,e));this._value=_.defaultTo(i,this.standardValue())}setupValueStep(t){this._valueStep=t||this.standardValueStep()}standardActive(){return!1}standardBackgroundColor(){return"grey"}standardDrawGraphicHandler(){return null}standardDrawTextHandler(){return null}standardMaxValue(){return 100}standardProgressColor(){return"#33ccff"}standardValue(){return 0}standardValueStep(){return 1}subValue(t){this.addValue(-t)}_updateAnimateValue(t,e){const i=e.remainingTime,n=(this._value*(i-1)+t)/i;this.setValue(n)}updateEmptyEvents(){this.isEmpty()&&this.updateEventsContainer("empty")}updateEvents(){DKTools.Sprite.prototype.updateEvents.call(this),this.updateEmptyEvents(),this.updateFullEvents()}updateFullEvents(){this.isFull()&&this.updateEventsContainer("full")}updateValueEvents(){this.updateEventsContainer("value")}},Object.defineProperties(DKTools.Sprite.ProgressBar.prototype,{valueStep:{get:function(){return this._valueStep},configurable:!0},maxValue:{get:function(){return this._maxValue},configurable:!0},value:{get:function(){return this._value},configurable:!0},backgroundColor:{get:function(){return this._backgroundColor},configurable:!0},progressColor:{get:function(){return this._progressColor},configurable:!0},drawGraphicHandler:{get:function(){return this._drawGraphicHandler},configurable:!0},drawTextHandler:{get:function(){return this._drawTextHandler},configurable:!0}}),DKTools.Sprite.ProgressBar.Rectangle=class extends DKTools.Sprite.ProgressBar{standardDrawGraphicHandler(){return()=>{let t;t=this.isHorizontal()?this.standardHorizontalDrawGraphicHandler():this.standardVerticalDrawGraphicHandler(),DKTools.Utils.isFunction(t)&&t(this)}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardHorizontalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue})}}standardVerticalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue,type:"vertical",reversed:!0})}}},DKTools.Sprite.ProgressBar.Circle=class extends DKTools.Sprite.ProgressBar{setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.ProgressBar.prototype.setAll.call(this,t,!0);return this.setLineWidth(t.lineWidth,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setLineWidth(t,e=!1){if(this._lineWidth===t)return!1;const i=this._lineWidth;return this.setupLineWidth(t),this._lineWidth!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.ProgressBar.prototype.setupAll.call(this,t),this.setupLineWidth(t.lineWidth)}setupLineWidth(t){this._lineWidth=t||this.standardLineWidth()}standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,n=i;this.strokeArc({x:i,y:n,radius:e,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:n,radius:e,startAngle:-Math.PI/2,endAngle:-Math.PI/2+2*Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardLineWidth(){return 10}},Object.defineProperties(DKTools.Sprite.ProgressBar.Circle.prototype,{lineWidth:{get:function(){return this._lineWidth},configurable:!0}}),DKTools.Sprite.ProgressBar.SemiCircle=class extends DKTools.Sprite.ProgressBar.Circle{standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,n=this.height;this.strokeArc({x:i,y:n,radius:e,startAngle:Math.PI,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:n,radius:e,startAngle:Math.PI,endAngle:-Math.PI+Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}},DKTools.Sprite.CheckBox=class extends DKTools.Sprite.Button{check(){this.isChecked()||(this.switch(),this.updateCheckedEvents())}isChecked(){return this._checked}_refreshCheckedGraphic(){let t=null;DKTools.Utils.isString(this._checkedGraphic)?t={folder:this._graphicFolder,filename:this._checkedGraphic}:this._checkedGraphic instanceof Object&&(t=this._checkedGraphic),t&&this.loadBitmap(t)}_refreshGraphic(){this.isChecked()?this._refreshCheckedGraphic():this._refreshUncheckedGraphic()}_refreshUncheckedGraphic(){let t=null;DKTools.Utils.isString(this._uncheckedGraphic)?t={folder:this._graphicFolder,filename:this._uncheckedGraphic}:this._uncheckedGraphic instanceof Object&&(t=this._uncheckedGraphic),t&&this.loadBitmap(t)}refreshAll(){this._refreshGraphic(),DKTools.Sprite.Button.prototype.refreshAll.call(this)}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setChecked(t.checked,!0)&&n++,this.setCheckedGraphic(t.checkedGraphic,!0)&&n++,this.setUncheckedGraphic(t.uncheckedGraphic,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setChecked(t,e=!1){if(this._checked===t)return!1;const i=this._checked;return this.setupChecked(t),this._checked!==i&&(e||this.refreshAll(),!0)}setCheckedGraphic(t,e=!1){const i=this._checkedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupCheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupCheckedGraphic(t),_.isEqual(this._checkedGraphic,e))return!1}}return e||this.refreshAll(),!0}setUncheckedGraphic(t,e=!1){const i=this._uncheckedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupUncheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupUncheckedGraphic(t),_.isEqual(this._uncheckedGraphic,e))return!1}}return e||this.refreshAll(),!0}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupChecked(t.checked),this.setupCheckedGraphic(t.checkedGraphic),this.setupUncheckedGraphic(t.uncheckedGraphic)}setupChecked(t){this._checked=_.defaultTo(t,this.standardChecked())}setupCheckedGraphic(t){this._checkedGraphic=t||this.standardCheckedGraphic()}setupUncheckedGraphic(t){this._uncheckedGraphic=t||this.standardUncheckedGraphic()}standardChecked(){return!1}standardCheckedGraphic(){return null}standardUncheckedGraphic(){return null}switch(){this.setChecked(!this.isChecked())}uncheck(){this.isChecked()&&(this.switch(),this.updateUncheckedEvents())}updateCheckedEvents(){this.updateEventsContainer("checked")}updateMouseClickEvents(t){this.switch(),DKTools.Sprite.Button.prototype.updateMouseClickEvents.call(this,t)}updateUncheckedEvents(){this.updateEventsContainer("unchecked")}},Object.defineProperties(DKTools.Sprite.CheckBox.prototype,{checked:{get:function(){return this._checked},configurable:!0},checkedGraphic:{get:function(){return this._checkedGraphic},configurable:!0},uncheckedGraphic:{get:function(){return this._uncheckedGraphic},configurable:!0}}),DKTools.Viewport=class extends DKTools.Sprite{canCloneFixedBitmap(){return!1}createAll(){DKTools.Sprite.prototype.createAll.call(this),this.createMask()}createMask(){DKTools.Sprite.prototype.createMask.call(this,this._maskShape)}setAll(t={},e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaskShape(t.maskShape,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setMaskShape(t,e=!1){if(this._maskShape===t)return!1;const i=this._maskShape;return this.setupShape(t),this._maskShape!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaskShape(t.maskShape)}setupMaskShape(t){this._maskShape=t||this.standardMaskShape()}standardMaskShape(){return"rect"}},Object.defineProperties(DKTools.Viewport.prototype,{maskShape:{get:function(){return this._maskShape},configurable:!0}}),DKTools.Layout=class extends DKTools.Sprite{activateItems(t=!1){this.iterateItems(t=>{t.activate()},t)}addAllChildren(){DKTools.Sprite.prototype.addAllChildren.call(this),this.addAllItems()}addAllItems(){this.hasItems()&&this.addChild.apply(this,this._items)}addCol(){this.addCols(1)}addCols(t){this.setMaxCols(this.getMaxCols()+t)}addItem(t,e=!1){return t instanceof DKTools.Sprite?(this._items.push(t),e||this.start(),t):null}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return i.length>0&&!e&&this.start(),i}alignCol(t){_.forEach(this.getItemsInCol(t),this.alignItem.bind(this))}alignItem(t){if(this.isReady()){const e=this.getItemRow(t),i=this.getItemCol(t),n=this.getRowHeight(e),s=this.getColWidth(i),r=this.getColX(i)+(s-t.width)/2,o=this.getRowY(e)+(n-t.height)/2;t.move(r,o)}else this.addOneTimeEvent({type:"ready",onSuccess:this.alignItem.bind(this,t)})}alignItems(){this.addOneTimeEvent({type:"ready",onSuccess:()=>{this.iterateItems(this.alignItem.bind(this))}})}alignRow(t){_.forEach(this.getItemsInRow(t),this.alignItem.bind(this))}_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearItems()}_clearItems(){this._items=[]}canCloneFixedBitmap(){return!1}clearItems(t=!1){this.removeAllItems(),this._clearItems(),t||this.start()}deactivateItems(t=!1){this.iterateItems(t=>{t.deactivate()},t)}_getBitmapHeight(){let t=0;const e=this.getMaxRows();for(let i=1;i<=e;i++)t+=this.getRowHeight(i)+this._verticalSpacing;return t-this._verticalSpacing}_getBitmapWidth(){let t=0;const e=this.getMaxCols();for(let i=1;i<=e;i++)t+=this.getColWidth(i)+this._horizontalSpacing;return t-this._horizontalSpacing}getCell(t,e){const i=this.getMaxCols()*(t-1)+(e-1);return{item:this.getItem(i),x:this.getColX(e),y:this.getRowY(t),width:this.getColWidth(e),height:this.getRowHeight(t)}}getColWidth(t){return DKTools.Utils.isFunction(this._colWidth)?this._colWidth(t,this):this._colWidth}getColX(t){let e=0;for(let i=1;i=0?e%this.getMaxCols()+1:-1}getItemIndex(t){return _.indexOf(this.getItems(),t)}getItemRow(t){const e=this.getItemIndex(t);return e>=0?Math.floor(e/this.getMaxCols())+1:-1}getItems(){return this.isInverted()?_.reverse(_.clone(this._items)):this._items}getItemsInCol(t){const e=[],i=this.getMaxRows(),n=this.getMaxCols();if(t<1||t>n)return e;const s=t-1;for(let t=0;tthis.getMaxRows())return e;const n=i*(t-1);for(let t=0;t=0}hasItems(){return!this.isEmpty()}hideItems(t=!1,e=!1){this.iterateItems(e=>{e.hide(t)},e)}insertItem(t,e,i=!1){return t instanceof DKTools.Sprite?(DKTools.Utils.Array.insert(this._items,t,e),i||this.start(),t):null}insertItems(t,e,i=!1){e=e||0;const n=_.map(t,(t,i)=>this.insertItem(t,e+i,!0));return n.length>0&&!i&&this.start(),n}invert(){this.setInverted(!this.isInverted())}isEmpty(){return 0===this.getMaxItems()}isHorizontal(){return 1===this.getMaxRows()}isInverted(){return this._inverted}isReady(){return this.isEmpty()||_.every(this._items,t=>t.isReady())}isVertical(){return 1===this.getMaxCols()}iterateItems(t,e=!1){_.forEach(this.getItems(),t),e&&this.start()}moveItem(t,e,i){const n=this.getItem(t);n&&n.move(e,i)}removeAllChildren(){DKTools.Sprite.prototype.removeAllChildren.call(this),this.removeAllItems()}removeAllItems(){this.hasItems()&&this.removeChild.apply(this,this._items)}removeCol(){this.removeCols(1)}removeCols(t){this.getMaxCols()-t>=1&&this.addCols(-t)}removeItem(t,e=!1){return Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)?(this.removeChild(t),DKTools.Utils.Array.remove(this._items,t),e||this.start(),t):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return i.length>0&&!e&&this.start(),i}resizeItem(t,e,i,n=!1){Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)&&t.resize(e,i)&&(n||this.start())}resizeItems(t,e,i=!1){this.iterateItems(i=>{this.resizeItem(i,t,e,!0)},!i)}setAll(t,e=!1,i=!1){t=t||{};let n=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaxCols(t.maxCols,!0)&&n++,n+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setItems(t.items,!0)&&n++,this.setRowHeight(t.rowHeight,!0)&&n++,this.setColWidth(t.colWidth,!0)&&n++,this.setInverted(t.reversed,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n}setColWidth(t,e=!1){if(this._colWidth===t)return!1;const i=this._colWidth;return this.setupColWidth(t),this._colWidth!==i&&(e||this.start(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.start(),!0)}setInverted(t,e=!1){if(this._inverted===t)return!1;const i=this._inverted;return this.setupInverted(t),this._inverted!==i&&(e||this.start(),!0)}setItems(t,e=!1){return this._items!=t&&(this.removeAllItems(),this.setupItems(t),e||this.start(),!0)}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.start(),!0)}setRowHeight(t,e=!1){if(this._rowHeight===t)return!1;const i=this._rowHeight;return this.setupRowHeight(t),this._rowHeight!==i&&(e||this.start(),!0)}setSpacing(t,e,i=!1){let n=0;return this.setHorizontalSpacing(t,!0)&&n++,this.setVerticalSpacing(e,!0)&&n++,n>0&&!i&&this.start(),n}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaxCols(t.maxCols),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupItems(t.items),this.setupRowHeight(t.rowHeight),this.setupColWidth(t.colWidth),this.setupInverted(t.inverted)}setupColWidth(t){this._colWidth=t||this.standardColWidth()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupInverted(t){this._inverted=_.defaultTo(t,this.standardInverted())}setupItems(t){this._items=_.clone(t||this.standardItems())}setupMaxCols(t){this._maxCols=_.defaultTo(t,this.standardMaxCols())}setupRowHeight(t){this._rowHeight=t||this.standardRowHeight()}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}showItems(t=!1,e=!1){this.iterateItems(e=>{e.show(t)},e)}standardActive(){return!1}standardColWidth(){return t=>{const e=this.getItemsInCol(t);return _.max(_.map(e,"width"))}}standardHorizontalSpacing(){return 12}standardInverted(){return!1}standardItems(){return[]}standardMaxCols(){return 1}standardRowHeight(){return t=>{const e=this.getItemsInRow(t);return _.max(_.map(e,"height"))}}standardVerticalSpacing(){return this.getLineHeight()/2}start(){this._started=!0,this.isReady()?DKTools.Sprite.prototype.start.call(this):this.addOneTimeEvent({type:"ready",onSuccess:this.start.bind(this)})}startItems(t=!1,e=!1){this.iterateItems(e=>{e.start(t)},!e)}updateAll(){DKTools.Sprite.prototype.updateAll.call(this),this.updateLayout()}updateLayout(){const t=this.getMaxItems(),e=this.getMaxRows(),i=this.getMaxCols();let n=0;for(let s=1;s<=e&&n{const e=this.findArrow(t);e&&this.addChild(e)})},DKTools.Window.prototype.activate=function(){DKTools.Base.prototype.activate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.activate()},DKTools.Window.prototype.addAllChildren=function(){DKTools.Base.prototype.addAllChildren.call(this),this.addContentsSprite()},DKTools.Window.prototype.addContentsSprite=function(){this._addContentsSprite(),this._refreshContents()},DKTools.Window.prototype._clearAll=function(){DKTools.Base.prototype._clearAll.call(this),this._clearIsWindow(),this._clearOpenness(),this._clearPadding(),this._clearMargin(),this._clearColorTone(),this._clearOrigin(),this._clearArrows()},DKTools.Window.prototype._clearIsWindow=function(){this._isWindow=!0},DKTools.Window.prototype._clearOpenness=function(){this._openness=this.standardOpenness()},DKTools.Window.prototype._clearPadding=function(){this._padding=this.standardPadding()},DKTools.Window.prototype._clearMargin=function(){this._margin=this.standardMargin()},DKTools.Window.prototype._clearColorTone=function(){this._colorTone=this.standardTone()},DKTools.Window.prototype._clearOrigin=function(){this._origin=this.standardOrigin()},DKTools.Window.prototype._clearArrows=function(){this._arrows=[]},DKTools.Window.prototype._createAll=function(){DKTools.Base.prototype._createAll.call(this),this._createAllParts(),this._createWindowskin()},DKTools.Window.prototype._createAllParts=function(){this._createSpriteContainer(),this._createBackSprite(),this._createFrameSprite(),this._createPauseSignSprite(),this._createArrows()},DKTools.Window.prototype._createSpriteContainer=function(){this._windowSpriteContainer=new PIXI.Container},DKTools.Window.prototype._createBackSprite=function(){this.needsCreateBackSprite()&&(this._windowBackSprite=new Sprite,this._windowBackSprite.opacity=this.standardBackOpacity(),this._windowBackSprite.visible=this.standardBackVisible())},DKTools.Window.prototype._createFrameSprite=function(){this.needsCreateFrameSprite()&&(this._windowFrameSprite=new Sprite,this._windowFrameSprite.visible=this.standardFrameVisible())},DKTools.Window.prototype._createPauseSignSprite=function(){this.needsCreatePauseSignSprite()&&(this._windowPauseSignSprite=new Sprite)},DKTools.Window.prototype._createArrows=function(){this.needsCreateArrowsSprites()&&(this.needsCreateUpArrowSprite()&&this.createArrow("up","up",{onUpdate:this.onUpArrowUpdate.bind(this),onMouseClick:this.onUpArrowMouseClick.bind(this),onMouseLongPress:this.onUpArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateDownArrowSprite()&&this.createArrow("down","down",{onUpdate:this.onDownArrowUpdate.bind(this),onMouseClick:this.onDownArrowMouseClick.bind(this),onMouseLongPress:this.onDownArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateLeftArrowSprite()&&this.createArrow("left","left",{onUpdate:this.onLeftArrowUpdate.bind(this),onMouseClick:this.onLeftArrowMouseClick.bind(this),onMouseLongPress:this.onLeftArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateRightArrowSprite()&&this.createArrow("right","right",{onUpdate:this.onRightArrowUpdate.bind(this),onMouseClick:this.onRightArrowMouseClick.bind(this),onMouseLongPress:this.onRightArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}))},DKTools.Window.prototype._createWindowskin=function(){this.windowskin=DKTools.Utils.Bitmap.load({folder:"img/system",filename:this.standardWindowskin()})},DKTools.Window.prototype.canRedrawAll=function(){return this.hasContentsSprite()&&DKTools.Base.prototype.canRedrawAll.call(this)},DKTools.Window.prototype.changeFont=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeFont(t)},DKTools.Window.prototype.changeTextColor=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeTextColor(t)},DKTools.Window.prototype.changePaintOpacity=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changePaintOpacity(t)},DKTools.Window.prototype.checkSize=function(){const t=this.getMinWidth(),e=this.getMinHeight();let i=0;return this._width{this.isOpenAndVisible()?n.show():n.hide(),DKTools.Utils.isFunction(i.onUpdate)&&i.onUpdate(t)}}),DKTools.Utils.isFunction(i.onMouseDown)&&n.addEvent({type:"mouse-down-left",onUpdate:i.onMouseDown}),DKTools.Utils.isFunction(i.onMouseUp)&&n.addEvent({type:"mouse-up-left",onUpdate:i.onMouseUp}),DKTools.Utils.isFunction(i.onMouseClick)&&n.addEvent({type:"mouse-click-left",onUpdate:i.onMouseClick}),DKTools.Utils.isFunction(i.onMouseLongPress)&&n.addEvent({type:"mouse-long-press-left",onUpdate:i.onMouseLongPress}),DKTools.Utils.isFunction(i.onMouseLongPressStarted)&&n.addEvent({type:"mouse-long-press-left-started",onUpdate:i.onMouseLongPressStarted}),DKTools.Utils.isFunction(i.onMouseLongPressFinished)&&n.addEvent({type:"mouse-long-press-left-finished",onUpdate:i.onMouseLongPressFinished}),DKTools.Utils.isFunction(i.onStateNormal)&&n.addEvent({type:"state-normal",onUpdate:i.onStateNormal}),DKTools.Utils.isFunction(i.onStatePressed)&&n.addEvent({type:"state-pressed",onUpdate:i.onStatePressed}),this._arrows.push(n),this.addChild(n),n},DKTools.Window.prototype.deactivate=function(){DKTools.Base.prototype.deactivate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.deactivate()},DKTools.Window.prototype.destroy=function(t){DKTools.Base.prototype.destroy.call(this,t),Window_Base.prototype.destroy.call(this,t)},DKTools.Window.prototype.drawText=function(t,e){return!!this.hasContentsSprite()&&this._windowContentsSprite.drawText(t,e)},DKTools.Window.prototype.findArrow=function(t){return _.find(this._arrows,{id:t})},DKTools.Window.prototype.getMinWidth=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinWidth.call(this)},DKTools.Window.prototype.getMinHeight=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinHeight.call(this)},DKTools.Window.prototype.getContentsWidth=function(){return DKTools.Utils.isFunction(this._contentsWidth)?this._contentsWidth(this):this._contentsWidth},DKTools.Window.prototype.getContentsHeight=function(){return DKTools.Utils.isFunction(this._contentsHeight)?this._contentsHeight(this):this._contentsHeight},DKTools.Window.prototype.getContentsSize=function(){return{width:this.getContentsWidth(),height:this.getContentsHeight()}},DKTools.Window.prototype.getCurrentOpacity=function(){return this.windowOpacity},DKTools.Window.prototype.hasBitmap=function(){return!!this.hasContentsSprite()&&this._windowContentsSprite.hasBitmap()},DKTools.Window.prototype.hasSpriteContainer=function(){return!!this._windowSpriteContainer},DKTools.Window.prototype.hasBackSprite=function(){return!!this._windowBackSprite},DKTools.Window.prototype.hasFrameSprite=function(){return!!this._windowFrameSprite},DKTools.Window.prototype.hasContentsSprite=function(){return!!this._windowContentsSprite},DKTools.Window.prototype.hasArrow=function(t){return!!this.findArrow(t)},DKTools.Window.prototype.hasArrowSprites=function(){return this.hasUpArrowSprite()&&this.hasDownArrowSprite()&&this.hasLeftArrowSprite()&&this.hasRightArrowSprite()},DKTools.Window.prototype.hasUpArrowSprite=function(){return this.hasArrow("up")},DKTools.Window.prototype.hasDownArrowSprite=function(){return this.hasArrow("down")},DKTools.Window.prototype.hasLeftArrowSprite=function(){return this.hasArrow("left")},DKTools.Window.prototype.hasRightArrowSprite=function(){return this.hasArrow("right")},DKTools.Window.prototype.hasPauseSignSprite=function(){return!!this._windowPauseSignSprite},DKTools.Window.prototype.hasBackgroundDimmer=function(){return!!this._dimmerSprite},DKTools.Window.prototype.hideBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!1)},DKTools.Window.prototype.hideContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.hide()},DKTools.Window.prototype.hideFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!1)},DKTools.Window.prototype.isOpenAndVisible=function(){return this.isOpen()&&this.isVisible()},DKTools.Window.prototype.isOpenAndActive=function(){return this.isOpen()&&this.isActive()},DKTools.Window.prototype.needsCreateBackSprite=function(){return!0},DKTools.Window.prototype.needsCreateFrameSprite=function(){return!0},DKTools.Window.prototype.needsCreateArrowsSprites=function(){return!1},DKTools.Window.prototype.needsCreateDownArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateUpArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateLeftArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateRightArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreatePauseSignSprite=function(){return!0},DKTools.Window.prototype.onUpArrowUpdate=function(t){},DKTools.Window.prototype.onDownArrowUpdate=function(t){},DKTools.Window.prototype.onLeftArrowUpdate=function(t){},DKTools.Window.prototype.onRightArrowUpdate=function(t){},DKTools.Window.prototype.onUpArrowMouseClick=function(t){},DKTools.Window.prototype.onDownArrowMouseClick=function(t){},DKTools.Window.prototype.onLeftArrowMouseClick=function(t){},DKTools.Window.prototype.onRightArrowMouseClick=function(t){},DKTools.Window.prototype.onUpArrowMouseLongPress=function(t){},DKTools.Window.prototype.onDownArrowMouseLongPress=function(t){},DKTools.Window.prototype.onLeftArrowMouseLongPress=function(t){},DKTools.Window.prototype.onRightArrowMouseLongPress=function(t){},DKTools.Window.prototype._refreshAllParts=function(){this._refreshBack(),this._refreshFrame(),this._refreshContents(),this._refreshPauseSign(),this._refreshArrows()},DKTools.Window.prototype._refreshBack=function(){this.hasBackSprite()&&Window.prototype._refreshBack.call(this)},DKTools.Window.prototype._refreshFrame=function(){this.hasFrameSprite()&&Window.prototype._refreshFrame.call(this)},DKTools.Window.prototype._refreshContents=function(){if(this.hasContentsSprite()){let t=this._contentsPosition;DKTools.Utils.isFunction(t)&&(t=t(this)),this._windowContentsSprite.move(t)}},DKTools.Window.prototype._refreshPauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._refreshPauseSign.call(this)},DKTools.Window.prototype._refreshArrows=function(){const t={up:this.standardUpArrowPosition(),down:this.standardDownArrowPosition(),left:this.standardLeftArrowPosition(),right:this.standardRightArrowPosition()};_.forEach(t,(t,e)=>{const i=this.findArrow(e);i&&i.move(t)})},DKTools.Window.prototype.redrawAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.redrawAll()},DKTools.Window.prototype.refreshAll=function(){this._refreshAllParts(),DKTools.Base.prototype.refreshAll.call(this)},DKTools.Window.prototype.refreshArrows=function(){_.forEach(this._arrows,t=>{t.refreshAll()})},DKTools.Window.prototype.removeAllChildren=function(){DKTools.Base.prototype.removeAllChildren.call(this),this.removeContentsSprite()},DKTools.Window.prototype.removeContentsSprite=function(){this.hasContentsSprite()&&this.removeChild(this._windowContentsSprite)},DKTools.Window.prototype.removeArrow=function(t){const e=this.findArrow(t);e&&(DKTools.Utils.Array.remove(this._arrows,e),this.removeChild(e))},DKTools.Window.prototype.resetAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetAll()},DKTools.Window.prototype.resetFont=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetFont()},DKTools.Window.prototype.resetTextColor=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetTextColor()},DKTools.Window.prototype.resetPaintOpacity=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetPaintOpacity()},DKTools.Window.prototype.resize=function(t,e,i=!1,n=!1){if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._width===t&&this._height===e)return!1;const s=this._width,r=this._height;return this.setupSize(t,e),(this._width!==s||this._height!==r)&&(i||this.start(),n&&this.activate(),!0)},DKTools.Window.prototype.standardOpenness=function(){return 255},DKTools.Window.prototype.standardOpennessSpeed=function(){return 16},DKTools.Window.prototype.standardMargin=function(){return 4},DKTools.Window.prototype.standardOrigin=function(){return new Point(0,0)},DKTools.Window.prototype.standardUpArrowPosition=function(){return new Point(this._width/2,12)},DKTools.Window.prototype.standardDownArrowPosition=function(){return new Point(this._width/2,this._height-12)},DKTools.Window.prototype.standardLeftArrowPosition=function(){return new Point(12,this._height/2)},DKTools.Window.prototype.standardRightArrowPosition=function(){return new Point(this._width-12,this._height/2)},DKTools.Window.prototype.standardArrowStateNormal=function(){return t=>{const e=t.target;e.setScale(1,1),e.setOpacity(255)}},DKTools.Window.prototype.standardArrowStatePressed=function(){return t=>{const e=t.target;e.setScale(.9,.9),e.setOpacity(160)}},DKTools.Window.prototype.standardContentsSprite=function(){return new DKTools.Sprite},DKTools.Window.prototype.standardChildX=function(){return this._padding},DKTools.Window.prototype.standardChildY=function(){return this._padding},DKTools.Window.prototype.standardChildPosition=function(){return()=>new Point(this.standardChildX(),this.standardChildY())},DKTools.Window.prototype.standardContentsPosition=function(){return this.standardChildPosition()},DKTools.Window.prototype.standardBackVisible=function(){return!0},DKTools.Window.prototype.standardFrameVisible=function(){return!0},DKTools.Window.prototype.standardContentsWidth=function(){return()=>this._width-2*this._padding},DKTools.Window.prototype.standardContentsHeight=function(){return()=>this._height-2*this._padding},DKTools.Window.prototype.standardWindowOpacity=function(){return 255},DKTools.Window.prototype.standardContentsOpacity=function(){return 255},DKTools.Window.prototype.standardFrameOpacity=function(){return 255},DKTools.Window.prototype.standardOpacity=function(){return{windowOpacity:this.standardWindowOpacity(),contentsOpacity:this.standardContentsOpacity(),frameOpacity:this.standardFrameOpacity(),backOpacity:this.standardBackOpacity()}},DKTools.Window.prototype.standardTone=function(){try{return _.clone($gameSystem.windowTone())}catch(t){return[0,0,0]}},DKTools.Window.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t);let e=t.contentsSprite;t instanceof DKTools.Window&&e instanceof DKTools.Sprite&&(e=e.clone({blockStart:!0})),this.setupPadding(t.padding),this.setupMargin(t.margin),this.setupContentsWidth(t.contentsWidth),this.setupContentsHeight(t.contentsHeight),this.setupContentsSprite(e),this.setupContentsPosition(t.contentsPosition),this.setupOpacity(t.opacity),this.setupTone(t.tone)},DKTools.Window.prototype.setupWidth=function(t){this.width=this._checkWidth(t)},DKTools.Window.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this.height=this._checkHeight(t)},DKTools.Window.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),t=this._checkWidth(t),e=this._checkHeight(e),Window.prototype.move.call(this,this.x,this.y,t,e)},DKTools.Window.prototype.setupPadding=function(t){this._padding=_.defaultTo(t,this.standardPadding())},DKTools.Window.prototype.setupMargin=function(t){this._margin=_.defaultTo(t,this.standardMargin())},DKTools.Window.prototype.setupContentsWidth=function(t){this._contentsWidth=t||this.standardContentsWidth()},DKTools.Window.prototype.setupContentsHeight=function(t){this._contentsHeight=t||this.standardContentsHeight()},DKTools.Window.prototype.setupContentsSprite=function(t){this._windowContentsSprite=t||this.standardContentsSprite()},DKTools.Window.prototype.setupContentsPosition=function(t,e){let i=t;DKTools.Utils.isFunction(t)||(i=DKTools.Utils.Point.tryToPoint(t,e)||this.standardContentsPosition()),this._contentsPosition=i},DKTools.Window.prototype.setupOpacity=function(t){this._opacity=Object.assign(this.standardOpacity(),t)},DKTools.Window.prototype.setupTone=function(t){this._tone=Object.assign(this.standardTone(),t)},DKTools.Window.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let n=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setPadding(t.padding,!0)&&n++,this.setMargin(t.margin,!0)&&n++,this.setOpacity(t.opacity,!0)&&n++,this.setTone(t.tone,!0)&&n++,n>0&&(e||this.start(),i&&this.activate()),n},DKTools.Window.prototype.setWidth=function(t,e=!1,i=!1){return this.resize(t,this._height,e,i)},DKTools.Window.prototype.setHeight=function(t,e=!1,i=!1){return this.resize(this._width,t,e,i)},DKTools.Window.prototype.setPadding=function(t,e=!1){if(this._padding===t)return!1;const i=this._padding;return this.setupPadding(t),this._padding!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setMargin=function(t,e=!1){if(this._margin===t)return!1;const i=this._margin;return this.setupMargin(padding),this._margin!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setContentsSprite=function(t,e=!1,i=!1){return this._windowContentsSprite!=t&&(this.removeContentsSprite(),this.setupContentsSprite(t),this.addContentsSprite(),e||this.start(),i&&this.activate(),!0)},DKTools.Window.prototype.setContentsPosition=function(t,e){const i=DKTools.Utils.isFunction,n=i(this._contentsPosition),s=i(t);if(n||s){if(this._contentsPosition===t)return!1;this.setupContentsPosition(t,e)}else{const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this._contentsPosition,i))return!1;const n=DKTools.Utils.Point.clone(this._contentsPosition);if(this.setupContentsPosition(i),DKTools.Utils.Point.equals(this._contentsPosition,n))return!1}return this._refreshContents(),!0},DKTools.Window.prototype.setOpacity=function(t,e=!1){if(_.isEqual(this._opacity,Object.assign(this.standardOpacity(),t)))return!1;const i=_.clone(this._opacity);return this.setupOpacity(t),!_.isEqual(this._opacity,i)&&(e||this.updateOpacity(),!0)},DKTools.Window.prototype.setTone=function(t,e=!1){if(_.isEqual(this._tone,Object.assign(this.standardTone(),t)))return!1;const i=_.clone(this._tone);return this.setupTone(t),!_.isEqual(this._tone,i)&&(e||this.updateTone(),!0)},DKTools.Window.prototype.start=function(t=!1){if(this.hasContentsSprite()){const e=this._windowContentsSprite;e.resize(this.getContentsWidth(),this.getContentsHeight(),!0),e.start(t)}DKTools.Base.prototype.start.call(this,t)},DKTools.Window.prototype.showBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!0)},DKTools.Window.prototype.showContents=function(t=!1){this.hasContentsSprite()&&this._windowContentsSprite.show(t)},DKTools.Window.prototype.showFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!0)},DKTools.Window.prototype._updateContents=function(){this.hasContentsSprite()&&Window.prototype._updateContents.call(this)},DKTools.Window.prototype._updatePauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._updatePauseSign.call(this)},DKTools.Window.prototype.updateOpenEvents=function(){this.updateEventsContainer("open")},DKTools.Window.prototype.updateCloseEvents=function(){this.updateEventsContainer("close")},DKTools.Window.prototype.updateAll=function(){this.updateContents(),DKTools.Base.prototype.updateAll.call(this),this.updateTone()},DKTools.Window.prototype.updateContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.updateAll()},DKTools.Window.prototype.updateTransform=function(){this._updateContents(),this._updatePauseSign(),PIXI.Container.prototype.updateTransform.call(this)},DKTools.Window.prototype.updateOpacity=function(t={}){t=t||{},this.hasSpriteContainer()&&(this.windowOpacity=_.defaultTo(t.windowOpacity,this.opacity.windowOpacity)),this.hasContentsSprite()&&(this.contentsOpacity=_.defaultTo(t.contentsOpacity,this.opacity.contentsOpacity)),this.hasFrameSprite()&&(this.frameOpacity=_.defaultTo(t.frameOpacity,this.opacity.frameOpacity)),this.hasBackSprite()&&(this.backOpacity=_.defaultTo(t.backOpacity,this.opacity.backOpacity))},DKTools.Window.prototype.updateTone=function(t){t=t||this.tone,this.hasBackSprite()&&Window.prototype.setTone.apply(this,t)},DKTools.Window.prototype.updateOpen=function(){this._opening&&(this.openness+=this.standardOpennessSpeed(),this.isOpen()&&(this._opening=!1,this.updateOpenEvents()))},DKTools.Window.prototype.updateClose=function(){this._closing&&(this.openness-=this.standardOpennessSpeed(),this.isClosed()&&(this._closing=!1,this.updateCloseEvents()))},DKTools.Window.prototype.update=function(){DKTools.Base.prototype.update.call(this),this.updateOpen(),this.updateClose(),this.updateBackgroundDimmer()},DKTools.Window.Selectable=class extends DKTools.Window{needsCreateArrowsSprites(){return!0}onUpArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()&&t.getTopRow()>0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onDownArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()){const i=t.getTopRow(),n=t.getMaxTopRow();n>0&&i0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onRightArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isHorizontal()){const i=t.getTopCol(),n=t.getMaxTopCol();n>0&&ithis.add(t))}finish(){this._queue=[],this._finished=!0}hasErrors(){return this._errors>0}isReady(){return this._finished}_onError(){this._errors++}start(){const t=_.map(this._queue,t=>t.catch(t=>{throw this._onError(),t}));Promise.all(t).then(()=>this.finish())}};const s=new DKTools.ParameterManager("DKTools");DKTools.PluginCommandManager.set("DKPluginsCheckUpdates",()=>{DKTools.Utils.openConsole(),DKTools.Utils._checkUpdates()}),DKTools.PluginCommandManager.set("UpdateFileSystemStamp",()=>{DKTools.IO._createStamp()});const r=window.onload;window.onload=function(){DKTools.Utils.initialize(),DKTools.IO.initialize(),r.call(this),DKTools.PluginManager.initialize()};const o=ImageCache.prototype.get;ImageCache.prototype.get=function(t){return o.call(this,t)||DKTools.PreloadManager.getCachedImageByKey(t)},ImageCache.prototype._truncateCache=function(){const t=this._items;let e=ImageCache.limit;Object.keys(t).map(e=>t[e]).filter(t=>!this._mustBeHeld(t)).sort((t,e)=>e.touch-t.touch).forEach(i=>{if(e>0&&!DKTools.PreloadManager.isImageCachedByKey(i.key)){const t=i.bitmap;e-=t.width*t.height}else delete t[i.key]})};const a=ImageCache.prototype._mustBeHeld;ImageCache.prototype._mustBeHeld=function(t){return!DKTools.PreloadManager.isImageCachedByKey(t.key)&&a.call(this,t)};const l=Graphics.initialize;Graphics.initialize=function(t,e,i){l.call(this,t,e,i);const n=s.get("FPS Meter");if(DKTools.Utils.isTest()&&n.Enabled){const t=this._fpsMeter;t&&(this.showFps(),"FPS"===n.Mode?(t.showFps(),this._fpsMeterToggled=!1):(t.showDuration(),this._fpsMeterToggled=!0))}};const h=Graphics.printError;Graphics.printError=function(t,e){h.call(this,t,e),this._errorPrinter&&this._updateErrorPrinter()};const u=Graphics._createFPSMeter;Graphics._createFPSMeter=function(){const t=s.get("FPS Meter");t.Enabled?(this._fpsMeter=new FPSMeter({theme:t.Theme,history:t.History,toggleOn:null,graph:1,decimals:0}),this._fpsMeter.hide()):u.call(this)},Graphics.printDetailedError=function(t){if(!this._errorPrinter)return;const e=t.stack.split(/(?:\r\n|\r|\n)/).map(t=>t.replace(/[\(](.*[\/])/,"("));this._errorPrinter.innerHTML=this._makeDetailedErrorHtml(t.name,t.message,e),this._applyCanvasFilter(),this._clearUpperCanvas()},Graphics._getErrorReferenceInfo=function(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e},Graphics._getErrorMessageForErrorPrint=function(){return s.get("Print Detailed Error","Error Message")},Graphics._getRestartMessageForErrorPrint=function(){return s.get("Print Detailed Error","Restart Message")},Graphics._makeDetailedErrorHtml=function(t,e,i){const n=this._getErrorMessageForErrorPrint(),s=this._getRestartMessageForErrorPrint(),r=this._getErrorReferenceInfo();let o="";return n&&(o=''+n+"

"),Object.keys(r).length>0&&(o+='Reference Information
',_.forEach(r,(t,e)=>{o+=''+e+": "+t+"
"}),o+="
"),o+=''+e+"
",_.forEach(i,t=>{o+=''+t+"
"}),s&&(o+='
'+s+"

"),o};const c=Graphics._updateErrorPrinter;Graphics._updateErrorPrinter=function(){c.call(this),this._errorPrinter&&this._errorShowed&&s.get("Print Detailed Error","Enabled")&&(this._errorPrinter.style.textAlign="left",this._errorPrinter.height=.8*this._height,this._centerElement(this._errorPrinter))};const p=TouchInput.initialize;TouchInput.initialize=function(){p.call(this);const t=s.get("Cursor Graphic");if(t.Enabled){const e=t.Graphic;e&&(document.body.style.cursor=`url('img/system/${e}.png'), default`)}};const d=TouchInput.clear;TouchInput.clear=function(){d.call(this),this._mouseMoved=!1,this._leftButtonPressed=!1,this._middleButtonPressed=!1,this._rightButtonPressed=!1,this._leftButtonReleased=!1,this._middleButtonReleased=!1,this._rightButtonReleased=!1,this._mouseX=0,this._mouseY=0,this._events.mouseMoved=!1,this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1};const f=TouchInput.update;TouchInput.update=function(){this._mouseMoved=this._events.mouseMoved,this._leftButtonPressed=this._events.leftButtonPressed,this._middleButtonPressed=this._events.middleButtonPressed,this._rightButtonPressed=this._events.rightButtonPressed,this._leftButtonReleased=this._events.leftButtonReleased,this._middleButtonReleased=this._events.middleButtonReleased,this._rightButtonReleased=this._events.rightButtonReleased,this._events.mouseMoved=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1,f.call(this)},TouchInput.isMouseMoved=function(){return this._mouseMoved},TouchInput.isMousePressed=function(){return this.isLeftButtonPressed()||this.isMiddleButtonPressed()||this.isRightButtonPressed()},TouchInput.isMouseReleased=function(){return this.isLeftButtonReleased()||this.isMiddleButtonReleased()||this.isRightButtonReleased()},TouchInput.isLeftButtonPressed=function(){return this._leftButtonPressed},TouchInput.isLeftButtonReleased=function(){return this._leftButtonReleased},TouchInput.isMiddleButtonPressed=function(){return this._middleButtonPressed},TouchInput.isMiddleButtonReleased=function(){return this._middleButtonReleased},TouchInput.isRightButtonPressed=function(){return this._rightButtonPressed},TouchInput.isRightButtonReleased=function(){return this._rightButtonReleased};const g=TouchInput._onLeftButtonDown;TouchInput._onLeftButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);g.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.leftButtonPressed=!0)};const m=TouchInput._onMiddleButtonDown;TouchInput._onMiddleButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);m.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.middleButtonPressed=!0)};const y=TouchInput._onRightButtonDown;TouchInput._onRightButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);y.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.rightButtonPressed=!0)};const T=TouchInput._onMouseMove;TouchInput._onMouseMove=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);T.call(this,t),this._mouseX===e&&this._mouseY===i||(this._events.mouseMoved=!0,this._date=Date.now(),this._mouseX=e,this._mouseY=i)};const D=TouchInput._onMouseUp;TouchInput._onMouseUp=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);D.call(this,t),this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,Graphics.isInsideCanvas(e,i)&&(0===t.button?this._events.leftButtonReleased=!0:1===t.button?this._events.middleButtonReleased=!0:2===t.button&&(this._events.rightButtonReleased=!0))},Object.defineProperties(TouchInput,{mouseX:{get:function(){return this._mouseX},configurable:!0},mouseY:{get:function(){return this._mouseY},configurable:!0}});const v=Tilemap.prototype.initialize;Tilemap.prototype.initialize=function(){v.call(this),this._tileWidth=Tilemap.TILE_WIDTH||this._tileWidth,this._tileHeight=Tilemap.TILE_HEIGHT||this._tileHeight};const w=WebAudio.prototype.addLoadListener;WebAudio.prototype.addLoadListener=function(t){this.isReady()?t(this):w.call(this,t)},WebAudio.prototype._onLoad=function(){for(;this._loadListeners.length>0;){this._loadListeners.shift()(this)}};const S=DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded=function(){return!!S.call(this)&&(this.__isDatabaseLoaded||(this.__isDatabaseLoaded=!0,this.onDatabaseLoad()),!0)},DataManager.onDatabaseLoad=function(){DKTools.PreloadManager.initialize()},Object.defineProperties(ImageManager,{PARALLAXES_FOLDER:{get:function(){const t=s.get("Tile Size");return t.Enabled?DKTools.IO.normalizePath(t["Parallaxes Folder"]+"/"):"img/parallaxes/"},configurable:!0},TILESETS_FOLDER:{get:function(){const t=s.get("Tile Size");return t.Enabled?DKTools.IO.normalizePath(t["Tilesets Folder"]+"/"):"img/tilesets/"},configurable:!0}}),ImageManager.loadParallax=function(t,e){return this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!0)},ImageManager.loadTileset=function(t,e){return this.loadBitmap(ImageManager.TILESETS_FOLDER,t,e,!1)},ImageManager.reserveParallax=function(t,e,i){return this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!1,i)},ImageManager.reserveTileset=function(t,e,i){return this.reserveBitmap(ImageManager.TILESETS_FOLDER,t,e,!1,i)},ImageManager.requestParallax=function(t,e){return this.requestBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!0)},ImageManager.requestTileset=function(t,e){return this.requestBitmap(ImageManager.TILESETS_FOLDER,t,e,!1)};const b=AudioManager.createBuffer;AudioManager.createBuffer=function(t,e){const i=this.audioFileExt(),n=this._path+t+"/"+encodeURIComponent(e)+i;return DKTools.PreloadManager.isAudioCachedByPath(n)?DKTools.PreloadManager.getCachedAudioByPath(n):b.call(this,t,e)};const K=SceneManager.initialize;SceneManager.initialize=async function(){await K.call(this),await DKTools.StartupManager.initialize()};const A=SceneManager.initGraphics;SceneManager.initGraphics=function(){const t=s.get("Screen Resolution");if(t.Enabled){const e=t.Width,i=t.Height;this._boxWidth=e,this._screenWidth=e,this._boxHeight=i,this._screenHeight=i,this.updateResolution()}A.call(this)},SceneManager.updateResolution=function(){const t=this._screenWidth-window.innerWidth,e=this._screenHeight-window.innerHeight;0!==t&&0!==e&&(window.moveBy(-1*t/2,-1*e/2),window.resizeBy(t,e))};const O=SceneManager.onKeyDown;SceneManager.onKeyDown=function(t){if(O.call(this,t),t.ctrlKey||t.altKey)return;const e=s.get("Quick Load","Key Code"),i=s.get("Screenshots","Key Code"),n=s.get("Grid","Key Code");switch(t.keyCode){case e:DKTools.Utils.__quickLoad();break;case i:s.get("Screenshots","Enabled")&&DKTools.Utils.makeScreenshot();break;case n:DKTools.Utils.__showGrid()}};const I=SceneManager.catchException;SceneManager.catchException=function(t){I.call(this,t),t instanceof Error&&s.get("Print Detailed Error","Enabled")&&Graphics.printDetailedError(t),DKTools.Utils.logError(t),s.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()};const C=SceneManager.onError;SceneManager.onError=function(t){C.call(this,t),DKTools.Utils.logError(t),s.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()},SceneManager.changeScene=function(){this.isSceneChanging()&&!this.isCurrentSceneBusy()&&(this._scene&&(this._scene.terminate(),this._scene.detachReservation(),this._previousClass=this._scene.constructor),this._scene=this._nextScene,this._scene&&(this._scene.attachReservation(),this._scene.startPreloading(),this._sceneCreated=!1,this._sceneStarted=!1,this._nextScene=null,this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate())),this._exiting&&this.terminate())},SceneManager.updateScene=function(){if(this._scene){if(!this._sceneCreated&&this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate()),this._sceneCreated&&!this._sceneStarted)try{this._scene.isReady()&&(this._scene.start(),this._sceneStarted=!0,this.onSceneStart())}catch(t){console.error(t),DKTools.Utils.logError(t),this._scene.start(),this._sceneStarted=!0,this.onSceneStart()}this.isCurrentSceneStarted()&&this._scene.update()}},SceneManager.isCurrentScene=function(t){return!!this._scene&&this._scene.constructor===t};const E=SceneManager.goto;SceneManager.goto=function(t){E.call(this,t),DKTools.Utils.__hideGrid()};const x=Scene_Base.prototype.initialize;Scene_Base.prototype.initialize=function(){x.call(this),this._preloader=new DKTools.Scene.Preloader},Scene_Base.prototype.activate=function(){this._active=!0},Scene_Base.prototype.deactivate=function(){this._active=!1},Scene_Base.prototype.isPreloaded=function(){return this._preloader.isReady()};const P=Scene_Base.prototype.isReady;Scene_Base.prototype.isReady=function(){return P.call(this)&&this.isPreloaded()},Scene_Base.prototype.setupPreloading=function(){},Scene_Base.prototype.startPreloading=function(){this.setupPreloading(),this._preloader.start()};const R=Scene_Base.prototype.terminate;Scene_Base.prototype.terminate=function(){R.call(this),this._preloader.finish()};const M=Scene_Boot.prototype.isReady;Scene_Boot.prototype.isReady=function(){return M.call(this)&&DKTools.StartupManager.isReady()&&DKTools.PreloadManager.isReady()};const B=Scene_Boot.prototype.start;Scene_Boot.prototype.start=function(){const t=s.get("Quick Start");t.Enabled?(B.call(this),DataManager.isBattleTest()||DataManager.isEventTest()||!t["Skip Saves"]&&DataManager.isAnySavefileExists()||(Scene_Base.prototype.start.call(this),SoundManager.preloadImportantSounds(),this.checkPlayerLocation(),DataManager.setupNewGame(),this.updateDocumentTitle(),SceneManager.goto(window[t["Scene Name"]]))):B.call(this)};const F=Scene_Map.prototype.isReady;Scene_Map.prototype.isReady=function(){return!!this.isPreloaded()&&F.call(this)};const L=Game_Map.prototype.tileWidth;Game_Map.prototype.tileWidth=function(){return Tilemap.TILE_WIDTH||L.call(this)};const H=Game_Map.prototype.tileHeight;Game_Map.prototype.tileHeight=function(){return Tilemap.TILE_HEIGHT||H.call(this)};const k=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(t,e){k.call(this,t,e),DKTools.PluginCommandManager.process(this,t,e)},s.get("Font Size","Enabled")&&(Window_Base.prototype.standardFontSize=function(){return s.get("Font Size","Size")},DKTools.Sprite.prototype.standardFontSize=function(){try{return Window_Base.prototype.standardFontSize.call(this)}catch(t){return s.get("Font Size","Size")}}),s.get("Line Height","Enabled")&&(Window_Base.prototype.lineHeight=function(){return s.get("Line Height","Height")},DKTools.Base.prototype.getLineHeight=function(){try{return Window_Base.prototype.lineHeight.call(this)}catch(t){return s.get("Line Height","Height")}},DKTools.Sprite.prototype.getLineHeight=function(){return DKTools.Base.prototype.getLineHeight.call(this)},DKTools.Window.prototype.getLineHeight=function(){return DKTools.Base.prototype.getLineHeight.call(this)}),s.get("Window Padding","Enabled")&&(Window_Base.prototype.standardPadding=function(){return s.get("Window Padding","Padding")})}).call(this,i(1)(t))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("nw.gui")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("os")},function(t,e){t.exports=require("path")}]); \ No newline at end of file +!function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(module,exports,__webpack_require__){"use strict";(function(module){var __WEBPACK_AMD_DEFINE_RESULT__;window.Imported=window.Imported||{},window.Imported.DKTools="8.3.0",function(){function t(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function e(t,e,i,s){for(var n=-1,r=null==t?0:t.length;++n"']/g,N=RegExp(j.source),V=RegExp(z.source),G=/<%-([\s\S]+?)%>/g,X=/<%([\s\S]+?)%>/g,q=/<%=([\s\S]+?)%>/g,$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Y=/^\w*$/,J=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,Q=RegExp(Z.source),tt=/^\s+|\s+$/g,et=/^\s+/,it=/\s+$/,st=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,nt=/\{\n\/\* \[wrapped with (.+)\] \*/,rt=/,? & /,ot=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,at=/\\(\\)?/g,lt=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ht=/\w*$/,ut=/^[-+]0x[0-9a-f]+$/i,ct=/^0b[01]+$/i,pt=/^\[object .+?Constructor\]$/,dt=/^0o[0-7]+$/i,ft=/^(?:0|[1-9]\d*)$/,gt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,_t=/($^)/,mt=/['\n\r\u2028\u2029\\]/g,Tt="[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?(?:\\u200d(?:[^\\ud800-\\udfff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])[\\ufe0e\\ufe0f]?(?:[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|\\ud83c[\\udffb-\\udfff])?)*",yt="(?:[\\u2700-\\u27bf]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff])"+Tt,Dt=RegExp("['’]","g"),wt=RegExp("[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]","g"),vt=RegExp("\\ud83c[\\udffb-\\udfff](?=\\ud83c[\\udffb-\\udfff])|(?:[^\\ud800-\\udfff][\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]?|[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]|(?:\\ud83c[\\udde6-\\uddff]){2}|[\\ud800-\\udbff][\\udc00-\\udfff]|[\\ud800-\\udfff])"+Tt,"g"),St=RegExp(["[A-Z\\xc0-\\xd6\\xd8-\\xde]?[a-z\\xdf-\\xf6\\xf8-\\xff]+(?:['’](?:d|ll|m|re|s|t|ve))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde]|$)|(?:[A-Z\\xc0-\\xd6\\xd8-\\xde]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:D|LL|M|RE|S|T|VE))?(?=[\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000]|[A-Z\\xc0-\\xd6\\xd8-\\xde](?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])|$)|[A-Z\\xc0-\\xd6\\xd8-\\xde]?(?:[a-z\\xdf-\\xf6\\xf8-\\xff]|[^\\ud800-\\udfff\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000\\d+\\u2700-\\u27bfa-z\\xdf-\\xf6\\xf8-\\xffA-Z\\xc0-\\xd6\\xd8-\\xde])+(?:['’](?:d|ll|m|re|s|t|ve))?|[A-Z\\xc0-\\xd6\\xd8-\\xde]+(?:['’](?:D|LL|M|RE|S|T|VE))?|\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])|\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])|\\d+",yt].join("|"),"g"),Kt=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]"),bt=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,At="Array Buffer DataView Date Error Float32Array Float64Array Function Int8Array Int16Array Int32Array Map Math Object Promise RegExp Set String Symbol TypeError Uint8Array Uint8ClampedArray Uint16Array Uint32Array WeakMap _ clearTimeout isFinite parseInt setTimeout".split(" "),It={};It["[object Float32Array]"]=It["[object Float64Array]"]=It["[object Int8Array]"]=It["[object Int16Array]"]=It["[object Int32Array]"]=It["[object Uint8Array]"]=It["[object Uint8ClampedArray]"]=It["[object Uint16Array]"]=It["[object Uint32Array]"]=!0,It["[object Arguments]"]=It["[object Array]"]=It["[object ArrayBuffer]"]=It["[object Boolean]"]=It["[object DataView]"]=It["[object Date]"]=It["[object Error]"]=It["[object Function]"]=It["[object Map]"]=It["[object Number]"]=It["[object Object]"]=It["[object RegExp]"]=It["[object Set]"]=It["[object String]"]=It["[object WeakMap]"]=!1;var Ot={};Ot["[object Arguments]"]=Ot["[object Array]"]=Ot["[object ArrayBuffer]"]=Ot["[object DataView]"]=Ot["[object Boolean]"]=Ot["[object Date]"]=Ot["[object Float32Array]"]=Ot["[object Float64Array]"]=Ot["[object Int8Array]"]=Ot["[object Int16Array]"]=Ot["[object Int32Array]"]=Ot["[object Map]"]=Ot["[object Number]"]=Ot["[object Object]"]=Ot["[object RegExp]"]=Ot["[object Set]"]=Ot["[object String]"]=Ot["[object Symbol]"]=Ot["[object Uint8Array]"]=Ot["[object Uint8ClampedArray]"]=Ot["[object Uint16Array]"]=Ot["[object Uint32Array]"]=!0,Ot["[object Error]"]=Ot["[object Function]"]=Ot["[object WeakMap]"]=!1;var Ct={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Et=parseFloat,xt=parseInt,Pt="object"==typeof global&&global&&global.Object===Object&&global,Mt="object"==typeof self&&self&&self.Object===Object&&self,Rt=Pt||Mt||Function("return this")(),Bt=exports&&!exports.nodeType&&exports,Lt=Bt&&"object"==typeof module&&module&&!module.nodeType&&module,Ft=Lt&&Lt.exports===Bt,Ht=Ft&&Pt.process,kt=function(){try{var t=Lt&&Lt.require&&Lt.require("util").types;return t||Ht&&Ht.binding&&Ht.binding("util")}catch(t){}}(),Ut=kt&&kt.isArrayBuffer,Wt=kt&&kt.isDate,jt=kt&&kt.isMap,zt=kt&&kt.isRegExp,Nt=kt&&kt.isSet,Vt=kt&&kt.isTypedArray,Gt=T("length"),Xt=y({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),qt=y({"&":"&","<":"<",">":">",'"':""","'":"'"}),$t=y({"&":"&","<":"<",">":">",""":'"',"'":"'"}),Yt=function y(Tt){function yt(t){if(js(t)&&!xo(t)&&!(t instanceof Pt)){if(t instanceof Ct)return t;if(xn.call(t,"__wrapped__"))return fs(t)}return new Ct(t)}function vt(){}function Ct(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=B}function Pt(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=4294967295,this.__views__=[]}function Mt(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function oe(t,e,s,n,r,o){var a,l=1&e,h=2&e,u=4&e;if(s&&(a=r?s(t,n,r,o):s(t)),a!==B)return a;if(!Ws(t))return t;if(n=xo(t)){if(a=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&xn.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return fi(t,a)}else{var c=Ur(t),p="[object Function]"==c||"[object GeneratorFunction]"==c;if(Mo(t))return li(t,l);if("[object Object]"==c||"[object Arguments]"==c||p&&!r){if(a=h||p?{}:Zi(t),!l)return h?function(t,e){return gi(t,kr(t),e)}(t,function(t,e){return t&&gi(e,nn(e),t)}(a,t)):function(t,e){return gi(t,Hr(t),e)}(t,ie(a,t))}else{if(!Ot[c])return r?t:{};a=function(t,e,i){var s=t.constructor;switch(e){case"[object ArrayBuffer]":return hi(t);case"[object Boolean]":case"[object Date]":return new s(+t);case"[object DataView]":return e=i?hi(t.buffer):t.buffer,new t.constructor(e,t.byteOffset,t.byteLength);case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return ui(t,i);case"[object Map]":return new s;case"[object Number]":case"[object String]":return new s(t);case"[object RegExp]":return(e=new t.constructor(t.source,ht.exec(t))).lastIndex=t.lastIndex,e;case"[object Set]":return new s;case"[object Symbol]":return Ar?Sn(Ar.call(t)):{}}}(t,c,l)}}if(o||(o=new kt),r=o.get(t))return r;if(o.set(t,a),Fo(t))return t.forEach(function(i){a.add(oe(i,e,s,i,t,o))}),a;if(Bo(t))return t.forEach(function(i,n){a.set(n,oe(i,e,s,n,t,o))}),a;h=u?h?Ni:zi:h?nn:sn;var d=n?B:h(t);return i(d||t,function(i,n){d&&(i=t[n=i]),Qt(a,n,oe(i,e,s,n,t,o))}),a}function ae(t,e,i){var s=i.length;if(null==t)return!s;for(t=Sn(t);s--;){var n=i[s],r=e[n],o=t[n];if(o===B&&!(n in t)||!r(o))return!1}return!0}function le(t,e,i){if("function"!=typeof t)throw new An("Expected a function");return zr(function(){t.apply(B,i)},e)}function he(t,e,i,s){var n=-1,l=r,h=!0,u=t.length,c=[],p=e.length;if(!u)return c;i&&(e=a(e,S(i))),s?(l=o,h=!1):200<=e.length&&(l=b,h=!1,e=new Ht(e));t:for(;++ne}function we(t,e){return null!=t&&xn.call(t,e)}function ve(t,e){return null!=t&&e in Sn(t)}function Se(t,e,i){for(var s=i?o:r,n=t[0].length,l=t.length,h=l,u=Tn(l),c=1/0,p=[];h--;){var d=t[h];h&&e&&(d=a(d,S(e))),c=ar(d.length,c),u[h]=!i&&(e||120<=n&&120<=d.length)?new Ht(h&&d):B}d=t[0];var f=-1,g=u[0];t:for(;++f(i=oi(i,e)).length?e:me(e,Ve(i,0,-1)))?e:e[cs(ys(i))])?B:t(i,e,s)}function be(t){return js(t)&&"[object Arguments]"==ye(t)}function Ae(t,e,i,s,n){if(t===e)return!0;if(null==t||null==e||!js(t)&&!js(e))return t!=t&&e!=e;t:{var r=xo(t),o=xo(e),a=r?"[object Array]":Ur(t),l=o?"[object Array]":Ur(e),h="[object Object]"==(a="[object Arguments]"==a?"[object Object]":a);o="[object Object]"==(l="[object Arguments]"==l?"[object Object]":l);if((l=a==l)&&Mo(t)){if(!Mo(e)){e=!1;break t}r=!0,h=!1}if(l&&!h)n||(n=new kt),e=r||Ho(t)?Wi(t,e,i,s,Ae,n):function(t,e,i,s,n,r,o){switch(i){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)break;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":if(t.byteLength!=e.byteLength||!r(new Un(t),new Un(e)))break;return!0;case"[object Boolean]":case"[object Date]":case"[object Number]":return Rs(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var a=C;case"[object Set]":if(a||(a=P),t.size!=e.size&&!(1&s))break;return(i=o.get(t))?i==e:(s|=2,o.set(t,e),e=Wi(a(t),a(e),s,n,r,o),o.delete(t),e);case"[object Symbol]":if(Ar)return Ar.call(t)==Ar.call(e)}return!1}(t,e,a,i,s,Ae,n);else{if(!(1&i)&&(r=h&&xn.call(t,"__wrapped__"),a=o&&xn.call(e,"__wrapped__"),r||a)){t=r?t.value():t,e=a?e.value():e,n||(n=new kt),e=Ae(t,e,i,s,n);break t}if(l)e:if(n||(n=new kt),r=1&i,a=zi(t),o=a.length,l=zi(e).length,o==l||r){for(h=o;h--;){var u=a[h];if(!(r?u in e:xn.call(e,u))){e=!1;break e}}if((l=n.get(t))&&n.get(e))e=l==e;else{l=!0,n.set(t,e),n.set(e,t);for(var c=r;++he?i:0,i)?t[e]:B}function Fe(t,e,i){var s=-1;return e=a(e.length?e:[cn],S(Xi())),function(t,e){var i=t.length;for(t.sort(e);i--;)t[i]=t[i].c;return t}(t=Pe(t,function(t,i,n){return{a:a(e,function(e){return e(t)}),b:++s,c:t}}),function(t,e){var s;t:{s=-1;for(var n=t.a,r=e.a,o=n.length,a=i.length;++s=a){s=l;break t}s=l*("desc"==i[s]?-1:1);break t}}s=t.b-e.b}return s})}function He(t,e,i){for(var s=-1,n=e.length,r={};++se||9007199254740991e&&(e=-e>n?0:n+e),0>(i=i>n?n:i)&&(i+=n),n=e>i?0:i-e>>>0,e>>>=0,i=Tn(n);++s=n){for(;s>>1,o=t[r];null!==o&&!Gs(o)&&(i?o<=e:o(e=oi(e,t)).length?t:me(t,Ve(e,0,-1)))||delete t[cs(ys(e))]}function ti(t,e,i,s){for(var n=t.length,r=s?n:-1;(s?r--:++rs)return s?Ze(t[0]):[];for(var n=-1,r=Tn(s);++n=s?t:Ve(t,e,i)}function li(t,e){if(e)return t.slice();var i=t.length;i=Wn?Wn(i):new t.constructor(i);return t.copy(i),i}function hi(t){var e=new t.constructor(t.byteLength);return new Un(e).set(new Un(t)),e}function ui(t,e){return new t.constructor(e?hi(t.buffer):t.buffer,t.byteOffset,t.length)}function ci(t,e){if(t!==e){var i=t!==B,s=null===t,n=t==t,r=Gs(t),o=e!==B,a=null===e,l=e==e,h=Gs(e);if(!a&&!h&&!r&&t>e||r&&o&&l&&!a&&!h||s&&o&&l||!i&&l||!n)return 1;if(!s&&!r&&!h&&tn?B:r,n=1),e=Sn(e);++so&&a[0]!==h&&a[o-1]!==h?[]:x(a,h)).length)i?i?je(e,t):e:(i=je(e,Qn(t/M(e))),Kt.test(e)?ai(R(i),0,t).join(""):i.slice(0,t))}function xi(e,i,s,n){var r=1&i,o=vi(e);return function i(){for(var a=-1,l=arguments.length,h=-1,u=n.length,c=Tn(u+l),p=this&&this!==Rt&&this instanceof i?o:e;++he||s)&&(1&t&&(r[2]=p[2],e|=1&i?0:4),(i=p[3])&&(s=r[3],r[3]=s?pi(s,i,p[4]):i,r[4]=s?x(r[3],"__lodash_placeholder__"):p[4]),(i=p[5])&&(s=r[5],r[5]=s?di(s,i,p[6]):i,r[6]=s?x(r[5],"__lodash_placeholder__"):p[6]),(i=p[7])&&(r[7]=i),128&t&&(r[8]=null==r[8]?p[8]:ar(r[8],p[8])),null==r[9]&&(r[9]=p[9]),r[0]=p[0],r[1]=e),t=r[0],e=r[1],i=r[2],s=r[3],n=r[4],!(a=r[9]=r[9]===B?l?0:t.length:or(r[9]-h,0))&&24&e&&(e&=-25),l=e&&1!=e?8==e||16==e?Si(t,e,a):32!=e&&33!=e||n.length?Ai.apply(B,r):xi(t,e,i,s):function(t,e,i){var s=1&e,n=vi(t);return function e(){return(this&&this!==Rt&&this instanceof e?n:t).apply(s?i:this,arguments)}}(t,e,i),ls((p?Mr:jr)(l,r),t,e)}function Hi(t,e,i,s){return t===B||Rs(t,On[i])&&!xn.call(s,i)?e:t}function ki(t,e,i,s,n,r){return Ws(t)&&Ws(e)&&(r.set(e,t),Be(t,e,B,ki,r),r.delete(e)),t}function Ui(t){return Ns(t)?B:t}function Wi(t,e,i,s,n,r){var o=1&i,a=t.length;if(a!=(l=e.length)&&!(o&&l>a))return!1;if((l=r.get(t))&&r.get(e))return l==e;var l=-1,h=!0,u=2&i?new Ht:B;for(r.set(t,e),r.set(e,t);++l(i=null==i?0:$s(i))&&(i=or(s+i,0)),d(t,Xi(e,3),i)):-1}function _s(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s-1;return i!==B&&(n=$s(i),n=0>i?or(s+n,0):ar(n,s-1)),d(t,Xi(e,3),n,!0)}function ms(t){return null!=t&&t.length?de(t,1):[]}function Ts(t){return t&&t.length?t[0]:B}function ys(t){var e=null==t?0:t.length;return e?t[e-1]:B}function Ds(t,e){return t&&t.length&&e&&e.length?ke(t,e):t}function ws(t){return null==t?t:cr.call(t)}function vs(t){if(!t||!t.length)return[];var e=0;return t=n(t,function(t){if(Ls(t))return e=or(t.length,e),!0}),v(e,function(e){return a(t,T(e))})}function Ss(e,i){if(!e||!e.length)return[];var s=vs(e);return null==i?s:a(s,function(e){return t(i,B,e)})}function Ks(t){return(t=yt(t)).__chain__=!0,t}function bs(t,e){return e(t)}function As(t,e){return(xo(t)?i:Cr)(t,Xi(e,3))}function Is(t,e){return(xo(t)?function(t,e){for(var i=null==t?0:t.length;i--&&!1!==e(t[i],i,t););return t}:Er)(t,Xi(e,3))}function Os(t,e){return(xo(t)?a:Pe)(t,Xi(e,3))}function Cs(t,e,i){return e=i?B:e,e=t&&null==e?t.length:e,Fi(t,128,B,B,B,B,e)}function Es(t,e){var i;if("function"!=typeof e)throw new An("Expected a function");return t=$s(t),function(){return 0<--t&&(i=e.apply(this,arguments)),1>=t&&(e=B),i}}function xs(t,e,i){function s(e){var i=l,s=h;return l=h=B,f=e,c=t.apply(s,i)}function n(t){var i=t-d;return t-=f,d===B||i>=e||0>i||_&&t>=u}function r(){var t=yo();if(n(t))return o(t);var i,s=zr;i=t-f,t=e-(t-d),i=_?ar(t,u-i):t,p=s(r,i)}function o(t){return p=B,m&&l?s(t):(l=h=B,c)}function a(){var t=yo(),i=n(t);if(l=arguments,h=this,d=t,i){if(p===B)return f=t=d,p=zr(r,e),g?s(t):c;if(_)return p=zr(r,e),s(d)}return p===B&&(p=zr(r,e)),c}var l,h,u,c,p,d,f=0,g=!1,_=!1,m=!0;if("function"!=typeof t)throw new An("Expected a function");return e=Js(e)||0,Ws(i)&&(g=!!i.leading,u=(_="maxWait"in i)?or(Js(i.maxWait)||0,e):u,m="trailing"in i?!!i.trailing:m),a.cancel=function(){p!==B&&Br(p),f=0,l=d=h=p=B},a.flush=function(){return p===B?c:o(yo())},a}function Ps(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new An("Expected a function");var i=function(){var s=arguments,n=e?e.apply(this,s):s[0],r=i.cache;return r.has(n)?r.get(n):(s=t.apply(this,s),i.cache=r.set(n,s)||r,s)};return i.cache=new(Ps.Cache||Lt),i}function Ms(t){if("function"!=typeof t)throw new An("Expected a function");return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}function Rs(t,e){return t===e||t!=t&&e!=e}function Bs(t){return null!=t&&Us(t.length)&&!Hs(t)}function Ls(t){return js(t)&&Bs(t)}function Fs(t){if(!js(t))return!1;var e=ye(t);return"[object Error]"==e||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!Ns(t)}function Hs(t){return!!Ws(t)&&("[object Function]"==(t=ye(t))||"[object GeneratorFunction]"==t||"[object AsyncFunction]"==t||"[object Proxy]"==t)}function ks(t){return"number"==typeof t&&t==$s(t)}function Us(t){return"number"==typeof t&&-1=t}function Ws(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function js(t){return null!=t&&"object"==typeof t}function zs(t){return"number"==typeof t||js(t)&&"[object Number]"==ye(t)}function Ns(t){return!(!js(t)||"[object Object]"!=ye(t))&&(null===(t=jn(t))||"function"==typeof(t=xn.call(t,"constructor")&&t.constructor)&&t instanceof t&&En.call(t)==Bn)}function Vs(t){return"string"==typeof t||!xo(t)&&js(t)&&"[object String]"==ye(t)}function Gs(t){return"symbol"==typeof t||js(t)&&"[object Symbol]"==ye(t)}function Xs(t){if(!t)return[];if(Bs(t))return Vs(t)?R(t):fi(t);if(Xn&&t[Xn]){t=t[Xn]();for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}return("[object Map]"==(e=Ur(t))?C:"[object Set]"==e?P:on)(t)}function qs(t){return t?(t=Js(t))===L||t===-L?1.7976931348623157e308*(0>t?-1:1):t==t?t:0:0===t?t:0}function $s(t){var e=(t=qs(t))%1;return t==t?e?t-e:t:0}function Ys(t){return t?re($s(t),0,4294967295):0}function Js(t){if("number"==typeof t)return t;if(Gs(t))return F;if(Ws(t)&&(t=Ws(t="function"==typeof t.valueOf?t.valueOf():t)?t+"":t),"string"!=typeof t)return 0===t?t:+t;t=t.replace(tt,"");var e=ct.test(t);return e||dt.test(t)?xt(t.slice(2),e?2:8):ut.test(t)?F:+t}function Zs(t){return gi(t,nn(t))}function Qs(t){return null==t?"":Je(t)}function tn(t,e,i){return(t=null==t?B:me(t,e))===B?i:t}function en(t,e){return null!=t&&Ji(t,e,ve)}function sn(t){return Bs(t)?Gt(t):Ee(t)}function nn(t){if(Bs(t))t=Gt(t,!0);else if(Ws(t)){var e,i=ns(t),s=[];for(e in t)("constructor"!=e||!i&&xn.call(t,e))&&s.push(e);t=s}else{if(e=[],null!=t)for(i in Sn(t))e.push(i);t=e}return t}function rn(t,e){if(null==t)return{};var i=a(Ni(t),function(t){return[t]});return e=Xi(e),He(t,i,function(t,i){return e(t,i[0])})}function on(t){return null==t?[]:K(t,sn(t))}function an(t){return ua(Qs(t).toLowerCase())}function ln(t){return(t=Qs(t))&&t.replace(gt,Xt).replace(wt,"")}function hn(t,e,i){return t=Qs(t),(e=i?B:e)===B?bt.test(t)?t.match(St)||[]:t.match(ot)||[]:t.match(e)||[]}function un(t){return function(){return t}}function cn(t){return t}function pn(t){return Ce("function"==typeof t?t:oe(t,1))}function dn(t,e,s){var n=sn(e),r=_e(e,n);null!=s||Ws(e)&&(r.length||!n.length)||(s=e,e=t,t=this,r=_e(e,sn(e)));var o=!(Ws(s)&&"chain"in s&&!s.chain),a=Hs(t);return i(r,function(i){var s=e[i];t[i]=s,a&&(t.prototype[i]=function(){var e=this.__chain__;if(o||e){var i=t(this.__wrapped__);return(i.__actions__=fi(this.__actions__)).push({func:s,args:arguments,thisArg:t}),i.__chain__=e,i}return s.apply(t,l([this.value()],arguments))})}),t}function fn(){}function gn(t){return is(t)?T(cs(t)):function(t){return function(e){return me(e,t)}}(t)}function _n(){return[]}function mn(){return!1}var Tn=(Tt=null==Tt?Rt:Yt.defaults(Rt.Object(),Tt,Yt.pick(Rt,At))).Array,yn=Tt.Date,Dn=Tt.Error,wn=Tt.Function,vn=Tt.Math,Sn=Tt.Object,Kn=Tt.RegExp,bn=Tt.String,An=Tt.TypeError,In=Tn.prototype,On=Sn.prototype,Cn=Tt["__core-js_shared__"],En=wn.prototype.toString,xn=On.hasOwnProperty,Pn=0,Mn=function(){var t=/[^.]+$/.exec(Cn&&Cn.keys&&Cn.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Rn=On.toString,Bn=En.call(Sn),Ln=Rt._,Fn=Kn("^"+En.call(xn).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Hn=Ft?Tt.Buffer:B,kn=Tt.Symbol,Un=Tt.Uint8Array,Wn=Hn?Hn.allocUnsafe:B,jn=E(Sn.getPrototypeOf,Sn),zn=Sn.create,Nn=On.propertyIsEnumerable,Vn=In.splice,Gn=kn?kn.isConcatSpreadable:B,Xn=kn?kn.iterator:B,qn=kn?kn.toStringTag:B,$n=function(){try{var t=Yi(Sn,"defineProperty");return t({},"",{}),t}catch(t){}}(),Yn=Tt.clearTimeout!==Rt.clearTimeout&&Tt.clearTimeout,Jn=yn&&yn.now!==Rt.Date.now&&yn.now,Zn=Tt.setTimeout!==Rt.setTimeout&&Tt.setTimeout,Qn=vn.ceil,tr=vn.floor,er=Sn.getOwnPropertySymbols,ir=Hn?Hn.isBuffer:B,sr=Tt.isFinite,nr=In.join,rr=E(Sn.keys,Sn),or=vn.max,ar=vn.min,lr=yn.now,hr=Tt.parseInt,ur=vn.random,cr=In.reverse,pr=Yi(Tt,"DataView"),dr=Yi(Tt,"Map"),fr=Yi(Tt,"Promise"),gr=Yi(Tt,"Set"),_r=Yi(Tt,"WeakMap"),mr=Yi(Sn,"create"),Tr=_r&&new _r,yr={},Dr=ps(pr),wr=ps(dr),vr=ps(fr),Sr=ps(gr),Kr=ps(_r),br=kn?kn.prototype:B,Ar=br?br.valueOf:B,Ir=br?br.toString:B,Or=function(){function t(){}return function(e){return Ws(e)?zn?zn(e):(t.prototype=e,e=new t,t.prototype=B,e):{}}}();yt.templateSettings={escape:G,evaluate:X,interpolate:q,variable:"",imports:{_:yt}},yt.prototype=vt.prototype,yt.prototype.constructor=yt,Ct.prototype=Or(vt.prototype),Ct.prototype.constructor=Ct,Pt.prototype=Or(vt.prototype),Pt.prototype.constructor=Pt,Mt.prototype.clear=function(){this.__data__=mr?mr(null):{},this.size=0},Mt.prototype.delete=function(t){return t=this.has(t)&&delete this.__data__[t],this.size-=t?1:0,t},Mt.prototype.get=function(t){var e=this.__data__;return mr?"__lodash_hash_undefined__"===(t=e[t])?B:t:xn.call(e,t)?e[t]:B},Mt.prototype.has=function(t){var e=this.__data__;return mr?e[t]!==B:xn.call(e,t)},Mt.prototype.set=function(t,e){var i=this.__data__;return this.size+=this.has(t)?0:1,i[t]=mr&&e===B?"__lodash_hash_undefined__":e,this},Bt.prototype.clear=function(){this.__data__=[],this.size=0},Bt.prototype.delete=function(t){var e=this.__data__;return!(0>(t=te(e,t))||(t==e.length-1?e.pop():Vn.call(e,t,1),--this.size,0))},Bt.prototype.get=function(t){var e=this.__data__;return 0>(t=te(e,t))?B:e[t][1]},Bt.prototype.has=function(t){return-1s?(++this.size,i.push([t,e])):i[s][1]=e,this},Lt.prototype.clear=function(){this.size=0,this.__data__={hash:new Mt,map:new(dr||Bt),string:new Mt}},Lt.prototype.delete=function(t){return t=qi(this,t).delete(t),this.size-=t?1:0,t},Lt.prototype.get=function(t){return qi(this,t).get(t)},Lt.prototype.has=function(t){return qi(this,t).has(t)},Lt.prototype.set=function(t,e){var i=qi(this,t),s=i.size;return i.set(t,e),this.size+=i.size==s?0:1,this},Ht.prototype.add=Ht.prototype.push=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this},Ht.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.clear=function(){this.__data__=new Bt,this.size=0},kt.prototype.delete=function(t){var e=this.__data__;return t=e.delete(t),this.size=e.size,t},kt.prototype.get=function(t){return this.__data__.get(t)},kt.prototype.has=function(t){return this.__data__.has(t)},kt.prototype.set=function(t,e){var i=this.__data__;if(i instanceof Bt){var s=i.__data__;if(!dr||199>s.length)return s.push([t,e]),this.size=++i.size,this;i=this.__data__=new Lt(s)}return i.set(t,e),this.size=i.size,this};var Cr=Ti(fe),Er=Ti(ge,!0),xr=yi(),Pr=yi(!0),Mr=Tr?function(t,e){return Tr.set(t,e),t}:cn,Rr=$n?function(t,e){return $n(t,"toString",{configurable:!0,enumerable:!1,value:un(e),writable:!0})}:cn,Br=Yn||function(t){return Rt.clearTimeout(t)},Lr=gr&&1/P(new gr([,-0]))[1]==L?function(t){return new gr(t)}:fn,Fr=Tr?function(t){return Tr.get(t)}:fn,Hr=er?function(t){return null==t?[]:(t=Sn(t),n(er(t),function(e){return Nn.call(t,e)}))}:_n,kr=er?function(t){for(var e=[];t;)l(e,Hr(t)),t=jn(t);return e}:_n,Ur=ye;(pr&&"[object DataView]"!=Ur(new pr(new ArrayBuffer(1)))||dr&&"[object Map]"!=Ur(new dr)||fr&&"[object Promise]"!=Ur(fr.resolve())||gr&&"[object Set]"!=Ur(new gr)||_r&&"[object WeakMap]"!=Ur(new _r))&&(Ur=function(t){var e=ye(t);if(t=(t="[object Object]"==e?t.constructor:B)?ps(t):"")switch(t){case Dr:return"[object DataView]";case wr:return"[object Map]";case vr:return"[object Promise]";case Sr:return"[object Set]";case Kr:return"[object WeakMap]"}return e});var Wr=Cn?Hs:mn,jr=hs(Mr),zr=Zn||function(t,e){return Rt.setTimeout(t,e)},Nr=hs(Rr),Vr=function(t){var e=(t=Ps(t,function(t){return 500===e.size&&e.clear(),t})).cache;return t}(function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(J,function(t,i,s,n){e.push(s?n.replace(at,"$1"):i||t)}),e}),Gr=ze(function(t,e){return Ls(t)?he(t,de(e,1,Ls,!0)):[]}),Xr=ze(function(t,e){var i=ys(e);return Ls(i)&&(i=B),Ls(t)?he(t,de(e,1,Ls,!0),Xi(i,2)):[]}),qr=ze(function(t,e){var i=ys(e);return Ls(i)&&(i=B),Ls(t)?he(t,de(e,1,Ls,!0),B,i):[]}),$r=ze(function(t){var e=a(t,ni);return e.length&&e[0]===t[0]?Se(e):[]}),Yr=ze(function(t){var e=ys(t),i=a(t,ni);return e===ys(i)?e=B:i.pop(),i.length&&i[0]===t[0]?Se(i,Xi(e,2)):[]}),Jr=ze(function(t){var e=ys(t),i=a(t,ni);return(e="function"==typeof e?e:B)&&i.pop(),i.length&&i[0]===t[0]?Se(i,B,e):[]}),Zr=ze(Ds),Qr=ji(function(t,e){var i=null==t?0:t.length,s=ne(t,e);return Ue(t,a(e,function(t){return ts(t,i)?+t:t}).sort(ci)),s}),to=ze(function(t){return Ze(de(t,1,Ls,!0))}),eo=ze(function(t){var e=ys(t);return Ls(e)&&(e=B),Ze(de(t,1,Ls,!0),Xi(e,2))}),io=ze(function(t){var e="function"==typeof(e=ys(t))?e:B;return Ze(de(t,1,Ls,!0),B,e)}),so=ze(function(t,e){return Ls(t)?he(t,e):[]}),no=ze(function(t){return ii(n(t,Ls))}),ro=ze(function(t){var e=ys(t);return Ls(e)&&(e=B),ii(n(t,Ls),Xi(e,2))}),oo=ze(function(t){var e="function"==typeof(e=ys(t))?e:B;return ii(n(t,Ls),B,e)}),ao=ze(vs),lo=ze(function(t){var e;return Ss(t,e="function"==typeof(e=1<(e=t.length)?t[e-1]:B)?(t.pop(),e):B)}),ho=ji(function(t){var e=t.length,i=e?t[0]:0,s=this.__wrapped__,n=function(e){return ne(e,t)};return!(1=e}),Eo=be(function(){return arguments}())?be:function(t){return js(t)&&xn.call(t,"callee")&&!Nn.call(t,"callee")},xo=Tn.isArray,Po=Ut?S(Ut):function(t){return js(t)&&"[object ArrayBuffer]"==ye(t)},Mo=ir||mn,Ro=Wt?S(Wt):function(t){return js(t)&&"[object Date]"==ye(t)},Bo=jt?S(jt):function(t){return js(t)&&"[object Map]"==Ur(t)},Lo=zt?S(zt):function(t){return js(t)&&"[object RegExp]"==ye(t)},Fo=Nt?S(Nt):function(t){return js(t)&&"[object Set]"==Ur(t)},Ho=Vt?S(Vt):function(t){return js(t)&&Us(t.length)&&!!It[ye(t)]},ko=Mi(xe),Uo=Mi(function(t,e){return t<=e}),Wo=mi(function(t,e){if(ns(e)||Bs(e))gi(e,sn(e),t);else for(var i in e)xn.call(e,i)&&Qt(t,i,e[i])}),jo=mi(function(t,e){gi(e,nn(e),t)}),zo=mi(function(t,e,i,s){gi(e,nn(e),t,s)}),No=mi(function(t,e,i,s){gi(e,sn(e),t,s)}),Vo=ji(ne),Go=ze(function(t,e){t=Sn(t);var i=-1,s=e.length;for((n=2--t)return e.apply(this,arguments)}},yt.ary=Cs,yt.assign=Wo,yt.assignIn=jo,yt.assignInWith=zo,yt.assignWith=No,yt.at=Vo,yt.before=Es,yt.bind=Do,yt.bindAll=pa,yt.bindKey=wo,yt.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return xo(t)?t:[t]},yt.chain=Ks,yt.chunk=function(t,e,i){if(e=(i?es(t,e,i):e===B)?1:or($s(e),0),!(i=null==t?0:t.length)||1>e)return[];for(var s=0,n=0,r=Tn(Qn(i/e));s(e=i||e===B?1:$s(e))?0:e,s):[]},yt.dropRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0,0>(e=s-(e=i||e===B?1:$s(e)))?0:e):[]},yt.dropRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0,!0):[]},yt.dropWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!0):[]},yt.fill=function(t,e,i,s){var n=null==t?0:t.length;if(!n)return[];for(i&&"number"!=typeof i&&es(t,e,i)&&(i=0,s=n),n=t.length,0>(i=$s(i))&&(i=-i>n?0:n+i),0>(s=s===B||s>n?n:$s(s))&&(s+=n),s=i>s?0:Ys(s);i>>0)?(t=Qs(t))&&("string"==typeof e||null!=e&&!Lo(e))&&(!(e=Je(e))&&Kt.test(t))?ai(R(t),0,i):t.split(e,i):[]},yt.spread=function(e,i){if("function"!=typeof e)throw new An("Expected a function");return i=null==i?0:or($s(i),0),ze(function(s){var n=s[i];return s=ai(s,0,i),n&&l(s,n),t(e,this,s)})},yt.tail=function(t){var e=null==t?0:t.length;return e?Ve(t,1,e):[]},yt.take=function(t,e,i){return t&&t.length?Ve(t,0,0>(e=i||e===B?1:$s(e))?0:e):[]},yt.takeRight=function(t,e,i){var s=null==t?0:t.length;return s?Ve(t,0>(e=s-(e=i||e===B?1:$s(e)))?0:e,s):[]},yt.takeRightWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3),!1,!0):[]},yt.takeWhile=function(t,e){return t&&t.length?ti(t,Xi(e,3)):[]},yt.tap=function(t,e){return e(t),t},yt.throttle=function(t,e,i){var s=!0,n=!0;if("function"!=typeof t)throw new An("Expected a function");return Ws(i)&&(s="leading"in i?!!i.leading:s,n="trailing"in i?!!i.trailing:n),xs(t,e,{leading:s,maxWait:e,trailing:n})},yt.thru=bs,yt.toArray=Xs,yt.toPairs=ea,yt.toPairsIn=ia,yt.toPath=function(t){return xo(t)?a(t,cs):Gs(t)?[t]:fi(Vr(Qs(t)))},yt.toPlainObject=Zs,yt.transform=function(t,e,s){var n=xo(t),r=n||Mo(t)||Ho(t);if(e=Xi(e,4),null==s){var o=t&&t.constructor;s=r?n?new o:[]:Ws(t)&&Hs(o)?Or(jn(t)):{}}return(r?i:fe)(t,function(t,i,n){return e(s,t,i,n)}),s},yt.unary=function(t){return Cs(t,1)},yt.union=to,yt.unionBy=eo,yt.unionWith=io,yt.uniq=function(t){return t&&t.length?Ze(t):[]},yt.uniqBy=function(t,e){return t&&t.length?Ze(t,Xi(e,2)):[]},yt.uniqWith=function(t,e){return e="function"==typeof e?e:B,t&&t.length?Ze(t,B,e):[]},yt.unset=function(t,e){return null==t||Qe(t,e)},yt.unzip=vs,yt.unzipWith=Ss,yt.update=function(t,e,i){return null!=t&&(t=Ne(t,e,(i=ri(i))(me(t,e)),void 0)),t},yt.updateWith=function(t,e,i,s){return s="function"==typeof s?s:B,null!=t&&(t=Ne(t,e,(i=ri(i))(me(t,e)),s)),t},yt.values=on,yt.valuesIn=function(t){return null==t?[]:K(t,nn(t))},yt.without=so,yt.words=hn,yt.wrap=function(t,e){return bo(ri(e),t)},yt.xor=no,yt.xorBy=ro,yt.xorWith=oo,yt.zip=ao,yt.zipObject=function(t,e){return si(t||[],e||[],Qt)},yt.zipObjectDeep=function(t,e){return si(t||[],e||[],Ne)},yt.zipWith=lo,yt.entries=ea,yt.entriesIn=ia,yt.extend=jo,yt.extendWith=zo,dn(yt,yt),yt.add=va,yt.attempt=ca,yt.camelCase=sa,yt.capitalize=an,yt.ceil=Sa,yt.clamp=function(t,e,i){return i===B&&(i=e,e=B),i!==B&&(i=(i=Js(i))==i?i:0),e!==B&&(e=(e=Js(e))==e?e:0),re(Js(t),e,i)},yt.clone=function(t){return oe(t,4)},yt.cloneDeep=function(t){return oe(t,5)},yt.cloneDeepWith=function(t,e){return oe(t,5,e="function"==typeof e?e:B)},yt.cloneWith=function(t,e){return oe(t,4,e="function"==typeof e?e:B)},yt.conformsTo=function(t,e){return null==e||ae(t,e,sn(e))},yt.deburr=ln,yt.defaultTo=function(t,e){return null==t||t!=t?e:t},yt.divide=Ka,yt.endsWith=function(t,e,i){t=Qs(t),e=Je(e);var s=t.length;s=i=i===B?s:re($s(i),0,s);return 0<=(i-=e.length)&&t.slice(i,s)==e},yt.eq=Rs,yt.escape=function(t){return(t=Qs(t))&&V.test(t)?t.replace(z,qt):t},yt.escapeRegExp=function(t){return(t=Qs(t))&&Q.test(t)?t.replace(Z,"\\$&"):t},yt.every=function(t,e,i){var n=xo(t)?s:ue;return i&&es(t,e,i)&&(e=B),n(t,Xi(e,3))},yt.find=co,yt.findIndex=gs,yt.findKey=function(t,e){return p(t,Xi(e,3),fe)},yt.findLast=po,yt.findLastIndex=_s,yt.findLastKey=function(t,e){return p(t,Xi(e,3),ge)},yt.floor=ba,yt.forEach=As,yt.forEachRight=Is,yt.forIn=function(t,e){return null==t?t:xr(t,Xi(e,3),nn)},yt.forInRight=function(t,e){return null==t?t:Pr(t,Xi(e,3),nn)},yt.forOwn=function(t,e){return t&&fe(t,Xi(e,3))},yt.forOwnRight=function(t,e){return t&&ge(t,Xi(e,3))},yt.get=tn,yt.gt=Oo,yt.gte=Co,yt.has=function(t,e){return null!=t&&Ji(t,e,we)},yt.hasIn=en,yt.head=Ts,yt.identity=cn,yt.includes=function(t,e,i,s){return t=Bs(t)?t:on(t),i=i&&!s?$s(i):0,s=t.length,0>i&&(i=or(s+i,0)),Vs(t)?i<=s&&-1(i=null==i?0:$s(i))&&(i=or(s+i,0)),f(t,e,i)):-1},yt.inRange=function(t,e,i){return e=qs(e),i===B?(i=e,e=0):i=qs(i),(t=Js(t))>=ar(e,i)&&t=t},yt.isSet=Fo,yt.isString=Vs,yt.isSymbol=Gs,yt.isTypedArray=Ho,yt.isUndefined=function(t){return t===B},yt.isWeakMap=function(t){return js(t)&&"[object WeakMap]"==Ur(t)},yt.isWeakSet=function(t){return js(t)&&"[object WeakSet]"==ye(t)},yt.join=function(t,e){return null==t?"":nr.call(t,e)},yt.kebabCase=na,yt.last=ys,yt.lastIndexOf=function(t,e,i){var s=null==t?0:t.length;if(!s)return-1;var n=s;if(i!==B&&(n=0>(n=$s(i))?or(s+n,0):ar(n,s-1)),e==e)t:{for(i=n+1;i--;)if(t[i]===e){t=i;break t}t=i}else t=d(t,_,n,!0);return t},yt.lowerCase=ra,yt.lowerFirst=oa,yt.lt=ko,yt.lte=Uo,yt.max=function(t){return t&&t.length?ce(t,cn,De):B},yt.maxBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),De):B},yt.mean=function(t){return m(t,cn)},yt.meanBy=function(t,e){return m(t,Xi(e,2))},yt.min=function(t){return t&&t.length?ce(t,cn,xe):B},yt.minBy=function(t,e){return t&&t.length?ce(t,Xi(e,2),xe):B},yt.stubArray=_n,yt.stubFalse=mn,yt.stubObject=function(){return{}},yt.stubString=function(){return""},yt.stubTrue=function(){return!0},yt.multiply=Aa,yt.nth=function(t,e){return t&&t.length?Le(t,$s(e)):B},yt.noConflict=function(){return Rt._===this&&(Rt._=Ln),this},yt.noop=fn,yt.now=yo,yt.pad=function(t,e,i){t=Qs(t);var s=(e=$s(e))?M(t):0;return!e||s>=e?t:Ei(tr(e=(e-s)/2),i)+t+Ei(Qn(e),i)},yt.padEnd=function(t,e,i){t=Qs(t);var s=(e=$s(e))?M(t):0;return e&&se){var s=t;t=e,e=s}return i||t%1||e%1?(i=ur(),ar(t+i*(e-t+Et("1e-"+((i+"").length-1))),e)):We(t,e)},yt.reduce=function(t,e,i){var s=xo(t)?h:D,n=3>arguments.length;return s(t,Xi(e,4),i,n,Cr)},yt.reduceRight=function(t,e,i){var s=xo(t)?u:D,n=3>arguments.length;return s(t,Xi(e,4),i,n,Er)},yt.repeat=function(t,e,i){return e=(i?es(t,e,i):e===B)?1:$s(e),je(Qs(t),e)},yt.replace=function(){var t=arguments,e=Qs(t[0]);return 3>t.length?e:e.replace(t[1],t[2])},yt.result=function(t,e,i){var s=-1,n=(e=oi(e,t)).length;for(n||(n=1,t=B);++s(t=$s(t))||9007199254740991=r)return t;if(1>(r=i-M(s)))return s;if(i=o?ai(o,0,r).join(""):t.slice(0,r),n===B)return i+s;if(o&&(r+=i.length-r),Lo(n)){if(t.slice(r).search(n)){var a=i;for(n.global||(n=Kn(n.source,Qs(ht.exec(n))+"g")),n.lastIndex=0;o=n.exec(a);)var l=o.index;i=i.slice(0,l===B?r:l)}}else t.indexOf(Je(n),r)!=r&&(-1<(n=i.lastIndexOf(n))&&(i=i.slice(0,n)));return i+s},yt.unescape=function(t){return(t=Qs(t))&&N.test(t)?t.replace(j,$t):t},yt.uniqueId=function(t){var e=++Pn;return Qs(t)+e},yt.upperCase=ha,yt.upperFirst=ua,yt.each=As,yt.eachRight=Is,yt.first=Ts,dn(yt,function(){var t={};return fe(yt,function(e,i){xn.call(yt.prototype,i)||(t[i]=e)}),t}(),{chain:!1}),yt.VERSION="4.17.11",i("bind bindKey curry curryRight partial partialRight".split(" "),function(t){yt[t].placeholder=yt}),i(["drop","take"],function(t,e){Pt.prototype[t]=function(i){i=i===B?1:or($s(i),0);var s=this.__filtered__&&!e?new Pt(this):this.clone();return s.__filtered__?s.__takeCount__=ar(i,s.__takeCount__):s.__views__.push({size:ar(i,4294967295),type:t+(0>s.__dir__?"Right":"")}),s},Pt.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}}),i(["filter","map","takeWhile"],function(t,e){var i=e+1,s=1==i||3==i;Pt.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:Xi(t,3),type:i}),e.__filtered__=e.__filtered__||s,e}}),i(["head","last"],function(t,e){var i="take"+(e?"Right":"");Pt.prototype[t]=function(){return this[i](1).value()[0]}}),i(["initial","tail"],function(t,e){var i="drop"+(e?"":"Right");Pt.prototype[t]=function(){return this.__filtered__?new Pt(this):this[i](1)}}),Pt.prototype.compact=function(){return this.filter(cn)},Pt.prototype.find=function(t){return this.filter(t).head()},Pt.prototype.findLast=function(t){return this.reverse().find(t)},Pt.prototype.invokeMap=ze(function(t,e){return"function"==typeof t?new Pt(this):this.map(function(i){return Ke(i,t,e)})}),Pt.prototype.reject=function(t){return this.filter(Ms(Xi(t)))},Pt.prototype.slice=function(t,e){t=$s(t);var i=this;return i.__filtered__&&(0e)?new Pt(i):(0>t?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==B&&(i=0>(e=$s(e))?i.dropRight(-e):i.take(e-t)),i)},Pt.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},Pt.prototype.toArray=function(){return this.take(4294967295)},fe(Pt.prototype,function(t,e){var i=/^(?:filter|find|map|reject)|While$/.test(e),s=/^(?:head|last)$/.test(e),n=yt[s?"take"+("last"==e?"Right":""):e],r=s||/^find/.test(e);n&&(yt.prototype[e]=function(){var e=this.__wrapped__,o=s?[1]:arguments,a=e instanceof Pt,h=o[0],u=a||xo(e),c=function(t){return t=n.apply(yt,l([t],o)),s&&p?t[0]:t};u&&i&&"function"==typeof h&&1!=h.length&&(a=u=!1);var p=this.__chain__,d=!!this.__actions__.length;h=r&&!p,a=a&&!d;return!r&&u?(e=a?e:new Pt(this),(e=t.apply(e,o)).__actions__.push({func:bs,args:[c],thisArg:B}),new Ct(e,p)):h&&a?t.apply(this,o):(e=this.thru(c),h?s?e.value()[0]:e.value():e)})}),i("pop push shift sort splice unshift".split(" "),function(t){var e=In[t],i=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",s=/^(?:pop|shift)$/.test(t);yt.prototype[t]=function(){var t=arguments;if(s&&!this.__chain__){var n=this.value();return e.apply(xo(n)?n:[],t)}return this[i](function(i){return e.apply(xo(i)?i:[],t)})}}),fe(Pt.prototype,function(t,e){var i=yt[e];if(i){var s=i.name+"";(yr[s]||(yr[s]=[])).push({name:e,func:i})}}),yr[Ai(B,2).name]=[{name:"wrapper",func:B}],Pt.prototype.clone=function(){var t=new Pt(this.__wrapped__);return t.__actions__=fi(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=fi(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=fi(this.__views__),t},Pt.prototype.reverse=function(){if(this.__filtered__){var t=new Pt(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},Pt.prototype.value=function(){var t,e=this.__wrapped__.value(),i=this.__dir__,s=xo(e),n=0>i,r=s?e.length:0;t=0;for(var o=r,a=this.__views__,l=-1,h=a.length;++l=this.__values__.length;return{done:t,value:t?B:this.__values__[this.__index__++]}},yt.prototype.plant=function(t){for(var e,i=this;i instanceof vt;){var s=fs(i);s.__index__=0,s.__values__=B,e?n.__wrapped__=s:e=s;var n=s;i=i.__wrapped__}return n.__wrapped__=t,e},yt.prototype.reverse=function(){var t=this.__wrapped__;return t instanceof Pt?(this.__actions__.length&&(t=new Pt(this)),(t=t.reverse()).__actions__.push({func:bs,args:[ws],thisArg:B}),new Ct(t,this.__chain__)):this.thru(ws)},yt.prototype.toJSON=yt.prototype.valueOf=yt.prototype.value=function(){return ei(this.__wrapped__,this.__actions__)},yt.prototype.first=yt.prototype.head,Xn&&(yt.prototype[Xn]=function(){return this}),yt}();Rt._=Yt,void 0===(__WEBPACK_AMD_DEFINE_RESULT__=function(){return Yt}.call(exports,__webpack_require__,exports,module))||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__)}.call(this),window.DKTools={},Object.defineProperties(DKTools,{SITE:{value:"https://dk-plugins.ru"},VERSION:{value:Imported.DKTools}}),DKTools.Sprite=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Window=function(t,e,i,s){this.initialize.apply(this,arguments)},DKTools.Scene=function(){this.initialize.apply(this,arguments)},DKTools.Utils=class{constructor(){return DKTools.Utils}static initialize(){this._saidHello=!1,this._isNwjs=Utils.isNwjs(),this._isTest=!!Utils.isOptionValid("test"),this._isMobileDevice=Utils.isMobileDevice(),this._isMobileSafari=Utils.isMobileSafari(),this._isAndroidChrome=Utils.isAndroidChrome(),this._gridSize=64,this._sayHello(),this.__tileSize(),this.__imageCacheLimit(),DKToolsParam.get("Debugging Console","Enabled")&&this.openConsole(),DKToolsParam.get("Check Updates","Enabled")&&this._checkUpdates()}static async _checkUpdates(){if(!this.isNwjs()||!this.isTest())return;let t=[];try{const e=new FormData;e.append("version",DKTools.VERSION),t=await DKTools.Network.fetchJson(`${DKTools.SITE}/plugins.php`,{method:"POST",body:e})}catch(t){return void console.error("DKTools can not check updates")}if(!t||0===t.length)return;const e=DKToolsParam.get("Check Updates","Show New Plugins");_.forEach(t,t=>{const i=t.version;if(DKTools.PluginManager.isRegistered(t.name)){if(i>DKTools.PluginManager.getVersion(t.name)){const e=[`Available a new version of ${t.name}: ${i} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}}else if(e){const e=[`Try the new plugin: ${t.name} \n`,`Description: ${t.description} \n`,`Visit site: ${t.url} \n`,`Download: ${DKTools.SITE}/download/${t.name}.js`];console.log.apply(console,e)}})}static _getErrorLogData(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e}static __hideGrid(){this._gridSprite&&(SceneManager._scene.removeChild(this._gridSprite),this._gridSprite=null)}static __imageCacheLimit(){const t=DKToolsParam.get("Image Cache Limit");t.Enabled&&(ImageCache.limit=t.Limit)}static isAndroidChrome(){return this._isAndroidChrome}static isArrayLike(t){return!!Array.isArray(t)||"[object Arguments]"===String(t)}static isBoolean(t){return"boolean"==typeof t}static isFunction(t){return"function"==typeof t}static isMobileDevice(){return this._isMobileDevice}static isMobileSafari(){return this._isMobileSafari}static isNumber(t){return Number.isFinite(t)}static isNwjs(){return this._isNwjs}static isString(t){return!!t&&"string"==typeof t}static isTest(){return this._isTest}static async logError(t){if(!t||!this.isNwjs())return;const e=DKToolsParam.get("Errors Log"),i=DKTools.Utils.isTest(),s=e.Enabled;if("None"===s||"Only Game"===s&&i||"Only Test"===s&&!i)return;const n=DKTools.IO.fs,r=DKTools.IO.os;if(!n||!r)return;const o=1024*e["File Size"]*1024,a=e.Filename,l=new DKTools.IO.File(a),h=await l.getStatsAsync().then(t=>t.data);if(h&&h.size>o){const t=DKTools.IO.parsePath(a).name,e=new Date,i=String(e.getDate()).padZero(2),s=String(e.getMonth()+1).padZero(2),n=e.getFullYear(),r=String(e.getHours()).padZero(2),o=String(e.getMinutes()).padZero(2),h=String(e.getSeconds()).padZero(2);await l.renameAsync(`${i}.${s}.${n}_${r}.${o}.${h}_${t}`)}const u=await n.openSync(a,"a"),c=this._getErrorLogData();let p=`Date: ${(new Date).toString()}`+r.EOL;_.forEach(c,(t,e)=>{p+=e+": "+t+r.EOL}),t instanceof Object?(p+=`Name: ${t.name}`+r.EOL,p+=`Message: ${t.message}`+r.EOL,void 0!==t.filename&&(p+=`Filename: ${t.filename}`+r.EOL),void 0!==t.lineNumber&&(p+=`Line: ${t.lineNumber}`+r.EOL),void 0!==t.columnNumber&&(p+=`Column: ${t.columnNumber}`+r.EOL),p+=`Stack: ${t.stack}`+r.EOL+r.EOL):p+=`Error: ${t}`+r.EOL+r.EOL,await n.writeSync(u,p),await n.closeSync(u)}static makeScreenshot(){if(!this.isNwjs())return;const t=DKToolsParam.get("Screenshots"),e=t.Path,i=t.Type,s=t.Quality,n=SceneManager.snap().canvas.toDataURL("image/"+i,s),r=new RegExp(`^data:image/${i};base64,`),o=n.replace(r,""),a=new Date;let l=t.Filename;const h=(l=(l=(l=(l=(l=(l=l.replace(/%year/gi,a.getFullYear())).replace(/%month/gi,a.getMonth()+1)).replace(/%day/gi,a.getDate())).replace(/%hours/gi,a.getHours())).replace(/%minutes/gi,a.getMinutes())).replace(/%seconds/gi,a.getSeconds()))+"."+i,u=DKTools.IO.normalizePath(e+"/"+h);new DKTools.IO.File(u).save(o,{createDirectory:!0,options:"base64"}),console.log("The screenshot is saved with the name: "+h)}static mixin(t,e){Object.defineProperties(t,Object.getOwnPropertyDescriptors(e))}static openConsole(){if(this.isTest()&&this.isNwjs())try{const t=__webpack_require__(2).Window.get();t.showDevTools(null,()=>t.focus())}catch(t){this.logError(t),console.error("DKTools can not open the console")}}static __tileSize(){const t=DKToolsParam.get("Tile Size");t.Enabled&&(Tilemap.TILE_WIDTH=t.Size,Tilemap.TILE_HEIGHT=t.Size)}static throwError(t){setTimeout(()=>{throw t},0)}static __quickLoad(){if(!DKTools.Utils.isTest()||!DKToolsParam.get("Quick Load","Enabled"))return;const t=DKToolsParam.get("Quick Load","Savefile ID"),e=SceneManager._scene;t>0?DataManager.loadGame(t)&&(SoundManager.playLoad(),e instanceof Scene_Base&&e.fadeOutAll(),$gameSystem.versionId()!==$dataSystem.versionId&&($gamePlayer.reserveTransfer($gameMap.mapId(),$gamePlayer.x,$gamePlayer.y),$gamePlayer.requestMapReload()),SceneManager.goto(Scene_Map)):e instanceof Scene_Load||SceneManager.push(Scene_Load)}static _sayHello(){if(!this._saidHello){if(navigator.userAgent.toLowerCase().indexOf("chrome")>=0){const t=[`%c %c %c DKTools.js ${DKTools.VERSION} %c %c ${DKTools.SITE} %c \n`,"background: #279EE8; padding:5px 0;","background: #279EE8; padding:5px 0;","color: #4CCBF5; background: #030307; padding:5px 0;","background: #279EE8; padding:5px 0;","background: #BDE5F2; padding:5px 0;","background: #279EE8; padding:5px 0;"];console.log.apply(console,t)}else window.console&&console.log(`DKTools.js ${DKTools.VERSION} - ${DKTools.SITE}`);this._saidHello=!0}}static __showGrid(){if(!DKTools.Utils.isTest()||!DKToolsParam.get("Grid","Enabled"))return;if(this._gridSprite)return void(this._gridSize>=32?(this._gridSize-=16,this._gridSprite.refreshAll()):(this._gridSize=64,this.__hideGrid()));const t=DKToolsParam.get("Grid");let e=null;this._gridSprite=new DKTools.Sprite.Button(Graphics),this._gridSprite.addEvent({type:"draw-all",onUpdate:()=>{const i=Graphics.boxWidth,s=Graphics.boxHeight,n=this._gridSize,r=t["Grid Color"],o=t["Grid Width"];_.times(Math.ceil(i/n),t=>{this._gridSprite.drawLine({x1:n*t,y1:0,x2:n*t,y2:s,color:r,lineWidth:o})}),_.times(Math.ceil(s/n),t=>{this._gridSprite.drawLine({x1:0,y1:n*t,x2:i,y2:n*t,color:r,lineWidth:o})}),e&&this._gridSprite.drawLine({x1:e.x,y1:e.y,x2:TouchInput.mouseX,y2:TouchInput.mouseY,color:e.color,lineWidth:t["Ruler Width"]})}}),this._gridSprite.addEvent({type:"mouse-inside",onUpdate:()=>{const t=TouchInput.mouseX,e=TouchInput.mouseY,s=Graphics.boxWidth,n=Graphics.boxHeight;let r=t+8,o=e+8;r+i.width>s&&(r=t-i.width-8),o+i.height>n&&(o=e-i.height-8),i.move(r,o),i.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-down-middle",onUpdate:()=>{e||(e={x:TouchInput.mouseX,y:TouchInput.mouseY,color:t["Ruler Color"]||DKTools.Utils.Random.getHexColor()}),this._gridSprite.refreshAll()}}),this._gridSprite.addEvent({type:"mouse-up-middle",onUpdate:()=>{e=null,this._gridSprite.refreshAll()}}),this._gridSprite.start(!0);const i=new DKTools.Sprite(0,0,220,"2");i.addEvent({type:"draw-all",onUpdate:()=>{if(e){const t={x:TouchInput.mouseX,y:TouchInput.mouseY},s=Math.floor(DKTools.Utils.Point.getDistance(e,t));i.drawText(`line: ${s} (${e.x}, ${e.y})`,{y:"0",align:"left"})}i.drawText(`x: ${TouchInput.mouseX}, y: ${TouchInput.mouseY}`,{y:"1",align:"left"})}}),i.start(),this._gridSprite.addChild(i),this._gridSprite.updateMouseInsideEvents(),SceneManager._scene.addChild(this._gridSprite)}},DKTools.Utils.Object=class{static toCamelCase(t){return _.reduce(t,(t,e,i)=>({...t,[_.camelCase(i)]:e}),{})}},DKTools.Utils.Number=class{static clamp(t,e,i){return _.clamp(t,e,i)}static inRange(t,e,i){return _.inRange(t,e,i)}},DKTools.Utils.String=class{static toBooleanArray(t){return _.map(this.toStringArray(t),Boolean)}static toNumberArray(t){return _.map(this.toStringArray(t),Number)}static toStringArray(t){return t.trim().replace(/\s*\,\s*/g,",").split(",")}},DKTools.Utils.Array=class{static avg(t){return this.sum(t)/t.length}static compact(t){return _.pull(t,"",null,void 0,Number.NaN)}static conjunction(t){return _.every(t,_.isEqual.bind(this,!0))}static contains(t,e){return _.includes(t,e)}static count(t,e){return _.size(t)-_.size(_.without(t,e))}static counts(t,e){return _.size(t)-_.size(_.difference(t,e))}static disjunction(t){return _.some(t,_.isEqual.bind(this,!0))}static insert(t,e,i=0){t.splice(i,0,e)}static isBitmapArray(t){return _.every(t,t=>t instanceof Bitmap)}static isBooleanArray(t){return _.every(t,t=>DKTools.Utils.isBoolean(t))}static isEmpty(t){return _.isEmpty(t)}static isNumberArray(t){return _.every(t,t=>DKTools.Utils.isNumber(t))}static isSpriteArray(t){return _.every(t,t=>t instanceof Sprite)}static isStringArray(t){return _.every(t,t=>DKTools.Utils.isString(t))}static isWindowArray(t){return _.every(t,t=>t instanceof Window)}static max(t){return Math.max.apply(Math,t)}static min(t){return Math.min.apply(Math,t)}static remove(t,e){return _.pull(t,e)}static sum(t){return _.reduce(t,(t,e)=>t+=e,0)}},DKTools.Utils.Point=class{static clone(t=0,e=0){return this.toPoint(t,e)}static equals(t,e=0,i=0){if(0===arguments.length)return!1;const s=this.toPoint(e,i);return(t=this.toPoint(t)).x===s.x&&t.y===s.y}static getDistance(t,e=0,i=0){const s=this.toPoint(e,i);return t=this.toPoint(t),Math.sqrt(Math.pow(t.x-s.x,2)+Math.pow(t.y-s.y,2))}static toArray(t){return[t.x,t.y]}static toPoint(t=0,e=0){const i=this.tryToPoint(t,e);if(null!==i)return i;const s=t=>Number.isFinite(t)?t:0;let n;return t instanceof Object&&(n=t.x,e=t.y),n=s(n),e=s(e),new Point(n,e)}static tryToPoint(t,e){let i,s;return t instanceof Object?(i=t.x,s=t.y):(i=t,s=e),DKTools.Utils.Array.isNumberArray([i,s])?new Point(i,s):null}},DKTools.Utils.Rectangle=class{static clone(t=0,e=0,i=0,s=0){return this.toRectangle(t,e,i,s)}static equals(t,e=0,i=0,s=0,n=0){if(0===arguments.length)return!1;const r=this.toRectangle(e,i,s,n);return(t=this.toRectangle(t)).x===r.x&&t.y===r.y&&t.width===r.width&&t.height===r.height}static isEmpty(t){return this.equals(t,Rectangle.emptyRectangle)}static toArray(t){return[t.x,t.y,t.width,t.height]}static toRectangle(t=0,e=0,i=0,s=0){const n=this.tryToRectangle(t,e,i,s);if(n)return n;const r=t=>Number.isFinite(t)?t:0;let o;return t instanceof Object&&(o=t.x,e=t.y,i=t.width,s=t.height),o=r(o),e=r(e),i=r(i),s=r(s),new Rectangle(o,e,i,s)}static tryToRectangle(t,e,i,s){let n,r,o,a;return t instanceof Object?(n=t.x,r=t.y,o=t.width,a=t.height):(n=t,r=e,o=i,a=s),DKTools.Utils.Array.isNumberArray([n,r,o,a])?new Rectangle(n,r,o,a):null}},DKTools.Utils.WebAudio=class{static load(t,e,i){if(!t)return null;if(t instanceof WebAudio)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const s=AudioManager.createBuffer(t,e);return DKTools.Utils.isFunction(i)&&s.addLoadListener(i),s}static async loadAsync(t,e,i){return new Promise(s=>{const n=this.load(t,e,i);n?n.addLoadListener(()=>s(n)):s(n)})}static loadBuffers(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof WebAudio?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBuffersAsync(t){const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}},DKTools.Utils.Bitmap=class{static clone(t){if(!t||t.url)return t;const e=t.canvas,i=new Bitmap(e.width,e.height);return i.context.drawImage(e,0,0),i}static drawLine(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.beginPath(),a.moveTo(e,i),a.lineTo(s,n),a.stroke(),a.restore(),t._setDirty()}static fillArc(t,e,i,s,n,r,o="white",a=!1){const l=t.context;l.save(),l.fillStyle=o,l.beginPath(),l.arc(e,i,s,n,r,a),l.fill(),l.restore(),t._setDirty()}static getBase64(t){return t&&t.canvas?t.canvas.toDataURL("image/png"):null}static load(t,e,i,s,n){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.load.apply(this,t);if(t instanceof Object)return this.load(t.folder,t.filename,t.listener,t.hue,t.smooth);if(!DKTools.Utils.isString(t))return null;const r=DKTools.IO.normalizePath(t+"/",!0),o=ImageManager.loadBitmap(r,e,s,n);return DKTools.Utils.isFunction(i)&&o.addLoadListener(i),o}static async loadAsync(t,e,i,s,n){return new Promise(r=>{const o=this.load(t,e,i,s,n);o?o.addLoadListener(()=>r(o)):r(o)})}static loadBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.load(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async loadBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.loadAsync(t));return Promise.all(e)}static reserve(t,e,i,s,n,r){if(!t)return null;if(t instanceof Bitmap)return t;if(DKTools.Utils.isArrayLike(t))return this.reserve.apply(this,t);if(t instanceof Object)return this.reserve(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);if(!DKTools.Utils.isString(t))return null;const o=DKTools.IO.normalizePath(t+"/",!0),a=ImageManager.reserveBitmap(o,e,s,n,r);return DKTools.Utils.isFunction(i)&&a.addLoadListener(i),a}static async reserveAsync(t,e,i,s,n,r){return new Promise(o=>{const a=this.reserve(t,e,i,s,n,r);a?a.addLoadListener(()=>o(a)):o(a)})}static reserveBitmaps(t,e,i){if(!DKTools.Utils.isFunction(e))return;t=_.map(t,t=>this.reserve(t));const s=[];let n=0;const r=(r,o)=>{e&&(s[r]=o,n++,DKTools.Utils.isFunction(i)&&i(o,s,t),t.length===n&&(e(t),e=null))};_.forEach(t,(t,e)=>{t instanceof Bitmap?t.addLoadListener(t=>r(e,t)):r(e,t)})}static async reserveBitmapsAsync(t){Array.isArray(t)||(t=[t]);const e=_.map(t,t=>this.reserveAsync(t));return Promise.all(e)}static strokeArc(t,e,i,s,n,r,o="white",a=1,l=!1){const h=t.context;h.save(),h.strokeStyle=o,h.lineWidth=a,h.beginPath(),h.arc(e,i,s,n,r,l),h.stroke(),h.restore(),t._setDirty()}static strokeRect(t,e,i,s,n,r="white",o=1){const a=t.context;a.save(),a.strokeStyle=r,a.lineWidth=o,a.strokeRect(e,i,s,n),a.restore(),t._setDirty()}},DKTools.Utils.Event=class{static getAllComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t?(t instanceof Game_Event&&(t=t.event()),_.reduce(t.pages,(t,e,i)=>(t[i+1]=_.reduce(e.list,(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]),t),{})):[]}static getComments(t){return Number.isFinite(t)&&(t=$gameMap.event(t)),t&&t.page()?_.reduce(t.list(),(t,e)=>(108!==e.code&&408!==e.code||t.push(e.parameters[0]),t),[]):[]}},DKTools.Utils.Random=class{constructor(){return DKTools.Utils.Random}static getBoolean(){return this.getInt(1)%2==0}static getFloat(t=1){return _.random(0,t,!0)}static getHexColor(){return"#"+(16777215*Math.random()<<0).toString(16)}static getInt(t=1){return _.random(0,t)}static getRgbaColor(t=1){const e=this.getInt(255),i=this.getInt(255),s=this.getInt(255);return"rgba(%1, %2, %3, %4)".format(e,i,s,t)}},DKTools.IO=class{constructor(){return DKTools.IO}static initialize(){let t="";this.isLocalMode()&&(this._fs=__webpack_require__(3),this._os=__webpack_require__(4),this._path=__webpack_require__(5),t=this.joinPath(this._path.dirname(process.mainModule.filename),"/")),this._projectPath=t,this._mode=DKToolsParam.get("File System","Mode"),this._stamp={},this._loadStamp(),this._createStamp()}static absolutePathExists(t){if(this.isLocalMode())return this._fs.existsSync(t);if(this.mode===DKTools.IO.MODE_NWJS_STAMP&&t.startsWith(this._projectPath)){if(this.isFile(t))return!0;if(this.isDirectory(t))return!0}return!1}static _createStamp(){if(!DKTools.Utils.isTest()||!this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;const t=DKToolsParam.get("File System","Ignored Directories").map(t=>new DKTools.IO.Directory(t)),e=DKTools.IO.getRootDirectory(),i=this._stamp;let s=null;const n=e=>{t.some(t=>t.getFullPath()===e.getFullPath())||e.getAllAsync().then(t=>t.data).then(t=>{t.forEach(t=>{t.getStatsAsync().then(t=>t.data).then(e=>{const n=t.getFullPath().substring(1).split("\\");t.isFile()?_.set(i,n,{__stats__:{...e,type:"file"}}):_.set(i,n,{__stats__:{...e,type:"directory"}}),s&&clearTimeout(s),s=setTimeout(()=>{new DKTools.IO.File("data/Stamp.json").saveJsonAsync(i,{compress:!0})})}),t.isDirectory()&&n(t)})})};n(e)}static getRootDirectory(){return new DKTools.IO.Directory}static getAbsolutePath(t){const e=this.joinPath(this._projectPath,t||"");return this.normalizePath(e)}static isLocalMode(){return DKTools.Utils.isNwjs()}static isFile(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isFile()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\");if(_.last(e).includes("."))return"file"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static isDirectory(t){if(this.isLocalMode()){const e=this.getAbsolutePath(t);if(this.absolutePathExists(e))return this._fs.lstatSync(e).isDirectory()}else if(this.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.normalizePath(t).split("\\").filter(t=>!!t);if(!_.last(e).includes("."))return"directory"===_.get(this._stamp,e.concat("__stats__"),{}).type}return!1}static joinPath(){if(this.isLocalMode())return this._path.join(...arguments);const t=_.filter(arguments,t=>DKTools.Utils.isString(t));let e=t.join("\\");return/^[\\\/]{2}[^\\\/]/.test(t[0])||(e=e.replace(/^[\\\/]{2,}/,"\\")),this.normalizePath(e)}static _loadStamp(){if(this.isLocalMode()||this.mode===DKTools.IO.MODE_NWJS)return;new DKTools.IO.File("data/Stamp.json").loadJson({sync:!0,decompress:!0,onSuccess:t=>{this._stamp=t.data||this._stamp}})}static normalizePath(t,e=!1){if(this.isLocalMode()){const i=this._path.normalize(t);return e?i.replace(/\\/g,"/"):i}const i=this._statPath(t),s=i.isUnc,n=i.isAbsolute;let r=i.device,o=i.tail;const a=/[\\\/]$/.test(o),l=_.filter(o.split(/[\\\/]+/),t=>t&&"."!==t),h=[];for(const t of l)".."===t?h.length>0&&".."!==h[h.length-1]?h.pop():n||h.push(".."):h.push(t);(o=h.join("\\"))||n||(o="."),o&&a&&(o+="\\"),s&&(r="\\\\"+r.replace(/^[\\\/]+/,"").replace(/[\\\/]+/g,"\\"));const u=r+(n?"\\":"")+o;return e?u.replace(/\\/g,"/"):u}static parsePath(t){if(this.isLocalMode())return this._path.parse(t);const e=this._splitPath(t);return{root:e[0],dir:e[0]+e[1].slice(0,-1),base:e[2],ext:e[3],name:e[2].slice(0,e[2].length-e[3].length)}}static pathExists(t){return this.absolutePathExists(this.getAbsolutePath(t))}static _statPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=e[1]||"",s=!!i&&":"!==i[1];return{device:i,isUnc:s,isAbsolute:s||!!e[2],tail:e[3]}}static _splitPath(t){const e=/^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(t),i=(e[1]||"")+(e[2]||""),s=e[3]||"",n=/^([\s\S]*?)((?:\.{1,2}|[^\\\/]+?|)(\.[^.\/\\]*|))(?:[\\\/]*)$/.exec(s);return[i,n[1],n[2],n[3]]}},Object.defineProperties(DKTools.IO,{fs:{get:function(){return this._fs},configurable:!0},os:{get:function(){return this._os},configurable:!0},path:{get:function(){return this._path},configurable:!0},sep:{get:function(){return this.isLocalMode()?this._path.sep:"/"},configurable:!0},projectPath:{get:function(){return this._projectPath},configurable:!0},mode:{get:function(){return this._mode},configurable:!0},stamp:{get:function(){return this._stamp},configurable:!0},OK:{value:0},EXPECT_CALLBACK:{value:1},ERROR_NOT_LOCAL_MODE:{value:2},ERROR_PATH_DOES_NOT_EXIST:{value:3},ERROR_CALLBACK_IS_NOT_AVAILABLE:{value:4},ERROR_DIRECTORY_ALREADY_EXISTS:{value:5},ERROR_DIRECTORY_IS_NOT_EMPTY:{value:6},ERROR_OVERWRITING_IS_NOT_AVAILABLE:{value:7},ERROR_OPTIONS_ARE_NOT_AVAILABLE:{value:8},ERROR_DECOMPRESSING_DATA:{value:9},ERROR_PARSING_DATA:{value:10},MODE_NWJS_STAMP:{value:0},MODE_NWJS:{value:1}}),DKTools.IO.Entity=class{constructor(){this.initialize.apply(this,arguments)}initialize(t=""){const e=DKTools.IO.parsePath(t);this._path=DKTools.IO.normalizePath(e.dir+"/"),this._name=e.name,this._initialExtension=e.ext,this._extension=e.ext}exists(){return DKTools.IO.absolutePathExists(this.getAbsolutePath())}getPath(){return this._path}getName(){return this._name}getExtension(){return this._extension}getFullPath(){return DKTools.IO.joinPath(this.getPath(),"/",this.getFullName())}getFullName(){return this._name+this._extension}getAbsolutePath(){return DKTools.IO.getAbsolutePath(this.getFullPath())}getStats(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const t=this.getFullPath().split("\\").filter(t=>!!t);return{data:_.get(DKTools.IO.stamp,t.concat("__stats__"),{}),status:DKTools.IO.OK}}const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.stat(i,(e,i)=>{e?this.__processError(e,t.onError):t.onSuccess({data:i,status:DKTools.IO.OK},this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{return{data:e.statSync(i),status:DKTools.IO.OK}}catch(e){this.__processError(e,t.onError)}}async getStatsAsync(){return new Promise((t,e)=>{const i=this.getStats({sync:!1,onSuccess:t,onError:e});i.status!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}hasExtension(){return!!this._extension}isFile(){if(this instanceof DKTools.IO.File){if(DKTools.IO.isLocalMode()){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.isFile(t)}return DKTools.IO.isFile(this.getFullPath())}return!!this.hasExtension()}return!1}isDirectory(){return this instanceof DKTools.IO.Directory&&(DKTools.IO.isLocalMode()?DKTools.IO.isDirectory(this.getFullPath()):!this.hasExtension())}__processError(t,e){DKTools.Utils.isFunction(e)?e(t,this):DKTools.Utils.throwError(t)}rename(t,e={}){if(e=e||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=DKTools.IO.normalizePath(this._path+"/"+t+this._extension),r=DKTools.IO.getAbsolutePath(n);if(!e.overwrite&&DKTools.IO.absolutePathExists(r))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;if(!e.sync)return i.rename(s,r,i=>{i?this.__processError(i,e.onError):(this._name=t,DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this))}),DKTools.IO.EXPECT_CALLBACK;try{return i.renameSync(s,r),this._name=t,DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async renameAsync(t,e={}){return new Promise((i,s)=>{const n=this.rename(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},Object.defineProperties(DKTools.IO.Entity.prototype,{path:{get:function(){return this._path},configurable:!0},name:{get:function(){return this._name},configurable:!0},initialExtension:{get:function(){return this._initialExtension},configurable:!0},extension:{get:function(){return this._extension},configurable:!0}}),DKTools.IO.File=class extends DKTools.IO.Entity{initialize(t=""){super.initialize(t),this._detectExtension()}copy(t,e={}){if(!e)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=new DKTools.IO.File(t).getDirectory();if(e.createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!e.sync)return i.copyFile(s,t,e.flags,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.copyFileSync(s,t,e.flags),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async copyAsync(t,e={}){return new Promise((i,s)=>{const n=this.copy(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}_detectExtension(){let t=this._extension;this.isAudio()?t=AudioManager.audioFileExt():this.isImage()?t=".png":this.isVideo()&&(t=Graphics.canPlayVideoType("video/webm")&&!DKTools.Utils.isMobileDevice()?".webm":".mp4"),this._extension=t}exists(){if(Decrypter.hasEncryptedAudio&&this.isAudio()||Decrypter.hasEncryptedImages&&this.isImage()){const t=DKTools.IO.normalizePath(this.getPath()+"/"+Decrypter.extToEncryptExt(this.getFullName()));return DKTools.IO.pathExists(t)}return super.exists()}getDirectory(){return new DKTools.IO.Directory(this._path)}getDirectoryName(){return this.getDirectory().getName()}isAudio(){return".ogg"===this._extension||".m4a"===this._extension||".rpgmvo"===this._extension}isJson(){return".json"===this._extension}isTxt(){return".txt"===this._extension}isImage(){return".png"===this._extension||".rpgmvp"===this._extension||".webp"===this._extension}isScript(){return".js"===this._extension}isVideo(){return".webm"===this._extension||".mp4"===this._extension}isSave(){return".rpgsave"===this._extension}load(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};const e=this.getAbsolutePath(),i=e=>{if(e){if(t.decompress)try{e=LZString.decompressFromBase64(e)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(t.parse)try{e=JSON.parse(e,t.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:e,status:DKTools.IO.OK}};if(DKTools.IO.isLocalMode()){if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=DKTools.IO.fs,n=t.options||{encoding:"utf8"};if(t.sync)try{const r=s.readFileSync(e,n);return i(r)}catch(e){this.__processError(e,t.onError)}else{if(!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};s.readFile(e,n,(e,s)=>{e?this.__processError(e,t.onError):t.onSuccess(i(s),this)})}}else{if(!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP&&"Stamp.json"!==this.getFullName()&&!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const s=new XMLHttpRequest;s.open("GET",e,!t.sync),s.overrideMimeType(t.mimeType||"application/json"),s.onload=(()=>{4===s.readyState&&(200===s.status?t.onSuccess(i(s.responseText),this):this.__processError(s,t.onError))}),s.onerror=(()=>{this.__processError(s,t.onError)});try{s.send()}catch(t){}}return{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async loadAsync(t={}){return new Promise((e,i)=>{const s=this.load({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadAudio(){return this.isAudio()&&(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP||this.exists())?DKTools.Utils.WebAudio.load(this.getDirectoryName(),this.getName()):null}async loadAudioAsync(){return DKTools.Utils.WebAudio.loadAsync(this.loadAudio())}loadJson(t){return t?(t.parse||(t.parse=!0),this.load(t)):{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE}}async loadJsonAsync(t={}){return new Promise((e,i)=>{const s=this.loadJson({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}loadBitmap(t,e,i){return t instanceof Object?this.loadBitmap(t.listener,t.hue,t.smooth):this.isImage()&&(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP||this.exists())?DKTools.Utils.Bitmap.load({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i}):null}async loadBitmapAsync(t,e,i){return DKTools.Utils.Bitmap.loadAsync(this.loadBitmap(t,e,i))}remove(t={}){if(t=t||{},!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.unlink(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.unlinkSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAsync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmap(t,e,i,s){return t instanceof Object?this.reserveBitmap(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserve({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}async reserveBitmapAsync(t,e,i,s){return t instanceof Object?this.reserveBitmapAsync(t.listener,t.hue,t.smooth,t.reservationId):this.isImage()&&this.exists()?DKTools.Utils.Bitmap.reserveAsync({folder:this.getPath(),filename:this.getName(),listener:t,hue:e,smooth:i,reservationId:s}):null}save(t,e={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;const i=DKTools.IO.fs,s=this.getAbsolutePath(),n=this.getDirectory();if((e=e||{}).createDirectory&&!n.exists()){const t=e.createDirectory instanceof Object?e.createDirectory:null;n.create({sync:!0,options:t})!==DKTools.IO.OK&&this.__processError(new Error(`Failed to create directory: ${n.getFullPath()}`),e.onError)}if(!n.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(e.stringify&&(t=JSON.stringify(t,e.stringify.replacer,e.stringify.space)),e.compress&&(t=LZString.compressToBase64(t)),!e.sync)return i.writeFile(s,t,e.options,t=>{t?this.__processError(t,e.onError):DKTools.Utils.isFunction(e.onSuccess)&&e.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return i.writeFileSync(s,t,e.options),DKTools.IO.OK}catch(t){this.__processError(t,e.onError)}}async saveAsync(t,e={}){return new Promise((i,s)=>{const n=this.save(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}saveJson(t,e={}){return(e=e||{}).stringify||(e.stringify={space:"\t"}),this.save(t,e)}async saveJsonAsync(t,e={}){return new Promise((i,s)=>{const n=this.saveJson(t,{...e,sync:!1,onSuccess:i,onError:s});n!==DKTools.IO.EXPECT_CALLBACK&&i(n)})}},DKTools.IO.Directory=class extends DKTools.IO.Entity{create(t){if(!t)return DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE;if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE;if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(this.exists())return DKTools.IO.ERROR_DIRECTORY_ALREADY_EXISTS;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.mkdir(i,t.options,e=>{e?this.__processError(e,t.onError):t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.mkdirSync(i,t.options),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async createAsync(t={}){return new Promise((e,i)=>{const s=this.create({...t,sync:!1,onSuccess:e,onError:i});s!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}createDirectory(t,e){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).create(e)}async createDirectoryAsync(t,e={}){const i=DKTools.IO.normalizePath(this.getFullPath()+"/"+t);return new DKTools.IO.Directory(i).createAsync(e)}findFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{if(n.isFile()){const e=n.getFullName();t.template instanceof RegExp&&t.template.test(e)?i.push(n):t.template&&e!==t.template||i.push(n)}else s{if(t.sync){const i=e.getAll({sync:!0,options:t.options}).data;r(i)}else e.getAll({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findFilesAsync(t={}){return new Promise((e,i)=>{const s=this.findFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}findDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode())return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=t.searchLimit||1,i=[];let s=1,n=0;const r=n=>{_.forEach(n,n=>{const r=n.getFullName();t.template instanceof RegExp&&t.template.test(r)?i.push(n):t.template&&r!==t.template||i.push(n),s{if(t.sync){const i=e.getDirectories({sync:!0,options:t.options}).data;r(i)}else e.getDirectories({sync:!1,options:t.options,onError:t.onError,onSuccess:e=>{n++,r(e.data),s===n&&t.onSuccess({data:i,status:DKTools.IO.OK})}})};return o(this),t.sync?{data:i,status:DKTools.IO.OK}:{data:null,status:DKTools.IO.EXPECT_CALLBACK}}async findDirectoriesAsync(t={}){return new Promise((e,i)=>{const s=this.findDirectories({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getAll(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS)return{data:null,status:DKTools.IO.ERROR_NOT_LOCAL_MODE};if(!this.exists())return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};const e=this.getFullPath(),i=i=>{return t.template instanceof RegExp?i=_.filter(i,e=>t.template.test(e)):DKTools.Utils.isString(t.template)&&(i=_.filter(i,e=>e===t.template)),{data:_.reduce(i,(t,i)=>{const s=DKTools.IO.normalizePath(e+"/"+i);return DKTools.IO.isFile(s)?t.push(new DKTools.IO.File(s)):DKTools.IO.isDirectory(s)&&t.push(new DKTools.IO.Directory(s)),t},[]),status:DKTools.IO.OK}};if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode===DKTools.IO.MODE_NWJS_STAMP){const e=this.getFullPath().split("\\"),s=_.get(DKTools.IO.stamp,e,{}),n=Object.keys(s);return t.sync?i(n):(t.onSuccess(i(n),this),{data:null,status:DKTools.IO.EXPECT_CALLBACK})}const s=DKTools.IO.fs,n=this.getAbsolutePath();if(!t.sync)return s.readdir(n,t.options,(e,s)=>{e?this.__processError(e,t.onError):t.onSuccess(i(s),this)}),{data:null,status:DKTools.IO.EXPECT_CALLBACK};try{const e=s.readdirSync(n,t.options);return i(e)}catch(e){this.__processError(e,t.onError)}}async getAllAsync(t={}){return new Promise((e,i)=>{const s=this.getAll({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getFiles(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isFile());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getFilesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isFile());return{...t,data:e}}return t})}getDirectories(t){if(!t)return{data:null,status:DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE};if(!t.sync&&!DKTools.Utils.isFunction(t.onSuccess))return{data:null,status:DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE};const e=t=>_.filter(t,t=>t.isDirectory());if(t.sync){const i=this.getAll(t);return i.status===DKTools.IO.OK?{...i,data:e(i.data)}:i}{const i=t.onSuccess;return t.onSuccess=((t,s)=>{t.status===DKTools.IO.OK?i({...t,data:e(t.data)},s):i(t,s)}),this.getAll(t)}}async getDirectoriesAsync(t={}){return this.getAllAsync(t).then(t=>{if(t.status===DKTools.IO.OK){const e=_.filter(t.data,t=>t.isDirectory());return{...t,data:e}}return t})}getAudioFiles(t){return this.getFiles({...t,template:/(.ogg|.rpgmvo)/})}async getAudioFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getAudioFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getJsonFiles(t){return this.getFiles({...t,template:/(.json)/})}async getJsonFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getJsonFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getTxtFiles(t){return this.getFiles({...t,template:/(.txt)/})}async getTxtFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getTxtFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getImageFiles(t){return this.getFiles({...t,template:/(.png|.webp|.rpgmvp)/})}async getImageFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getImageFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getVideoFiles(t){return this.getFiles({...t,template:/(.webm|.mp4)/})}async getVideoFilesAsync(t={}){return new Promise((e,i)=>{const s=this.getVideoFiles({...t,sync:!1,onSuccess:e,onError:i});s.status!==DKTools.IO.EXPECT_CALLBACK&&e(s)})}getRootDirectory(){return new DKTools.IO.Directory(this.getPath())}isEmpty(){const t=this.getAll({sync:!0}).data;return!t||0===t.length}loadAudioFiles(){const t=this.getAudioFiles({sync:!0});return t.status!==DKTools.IO.OK?[]:_.map(t.data,t=>t.loadAudio())}async loadAudioFilesAsync(){const t=await this.getAudioFilesAsync();if(t.status!==DKTools.IO.OK)return[];const e=_.map(t.data,t=>t.loadAudioAsync());return Promise.all(e)}loadBitmaps(t,e,i){const s=this.getImageFiles({sync:!0});return s.status!==DKTools.IO.OK?[]:_.map(s.data,s=>s.loadBitmap(t,e,i))}async loadBitmapsAsync(t,e,i){const s=await this.getImageFilesAsync();if(s.status!==DKTools.IO.OK)return[];const n=_.map(s.data,s=>s.loadBitmapAsync(t,e,i));return Promise.all(n)}remove(t={}){if(!DKTools.IO.isLocalMode())return DKTools.IO.ERROR_NOT_LOCAL_MODE;if(!this.exists())return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!this.isEmpty())return DKTools.IO.ERROR_DIRECTORY_IS_NOT_EMPTY;const e=DKTools.IO.fs,i=this.getAbsolutePath();if(!t.sync)return e.rmdir(i,e=>{e?this.__processError(e,t.onError):DKTools.Utils.isFunction(t.onSuccess)&&t.onSuccess(DKTools.IO.OK,this)}),DKTools.IO.EXPECT_CALLBACK;try{return e.rmdirSync(i),DKTools.IO.OK}catch(e){this.__processError(e,t.onError)}}async removeAync(){return new Promise((t,e)=>{const i=this.remove({sync:!1,onSuccess:t,onError:e});i!==DKTools.IO.EXPECT_CALLBACK&&t(i)})}reserveBitmaps(t,e,i,s){const n=this.getImageFiles({sync:!0});return n.status!==DKTools.IO.OK?[]:_.map(n.data,n=>n.reserveBitmap(t,e,i,s))}async reserveBitmapsAsync(t,e,i,s){const n=await this.getImageFilesAsync();if(n.status!==DKTools.IO.OK)return[];const r=_.map(n.data,n=>n.reserveBitmapAsync(t,e,i,s));return Promise.all(r)}},DKTools.IO.WebStorage=class{static exists(t){return localStorage.hasOwnProperty(t)}static load(t,e={}){if(!this.exists(t))return{data:null,status:DKTools.IO.ERROR_PATH_DOES_NOT_EXIST};let i=localStorage.getItem(t);if(i){if(e.decompress)try{i=LZString.decompressFromBase64(i)}catch(t){return{data:null,status:DKTools.IO.ERROR_DECOMPRESSING_DATA,error:t}}if(e.parse)try{i=JSON.parse(i,e.parse.reviver)}catch(t){return{data:null,status:DKTools.IO.ERROR_PARSING_DATA,error:t}}}return{data:i,status:DKTools.IO.OK}}static remove(t){return this.exists(t)?(localStorage.removeItem(t),DKTools.IO.OK):DKTools.IO.ERROR_PATH_DOES_NOT_EXIST}static rename(t,e,i=!1){if(!this.exists(t))return DKTools.IO.ERROR_PATH_DOES_NOT_EXIST;if(!i&&this.exists(e))return DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE;const s=localStorage.getItem(t);return localStorage.setItem(e,s),localStorage.removeItem(t),DKTools.IO.OK}static save(t,e,i={}){return i=i||{},!_.defaultTo(i.overwrite,!0)&&this.exists(t)?DKTools.IO.ERROR_OVERWRITING_IS_NOT_AVAILABLE:(i.stringify&&(e=JSON.stringify(e,i.stringify.replacer,i.stringify.space)),i.compress&&(e=LZString.compressToBase64(e)),localStorage.setItem(t,e),DKTools.IO.OK)}},DKTools.Network=class{constructor(){return DKTools.Network}static async fetchFile(t,e={}){return fetch(t,e).then(t=>{if(t.ok)return this._toFile(t);throw t})}static async fetchJson(t,e={}){return e.headers||(e.headers={}),e.headers.Accept="application/json",fetch(t,e).then(t=>{if(t.ok)return this._toJson(t);throw t})}static async _toFile(t){return t.arrayBuffer().catch(()=>null)}static async _toJson(t){return t.json().catch(()=>null)}},DKTools.ParameterManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._pluginName=t,this._params={},this.initializeParams()}initializeParams(){_.forEach(PluginManager.parameters(this._pluginName),(t,e)=>{this._params[e]=DKTools.ParameterManager.parse(t)})}get(t,e,i){if(!DKTools.Utils.isString(t))return void console.error("Parameter name is not a string!",this._pluginName,t,e,i);let s=this._params[t];return void 0!==s?(e instanceof Object?s=_.find(s,e):void 0!==e&&(s=s[e]),s instanceof Object&&(i instanceof Object?(void 0!==i.key&&(s=s[i.key]),void 0!==i.index&&(s=s[i.index])):void 0!==i&&(s=s[i])),s):void 0}static parse(t){try{return DKTools.Utils.isNumber(t)||DKTools.Utils.isBoolean(t)?t:JSON.parse(t,(t,e)=>{if(Array.isArray(e))return _.map(e,t=>this.parse(t));try{return this.parse(e)}catch(t){return e}})}catch(e){return t}}},Object.defineProperties(DKTools.ParameterManager.prototype,{pluginName:{get:function(){return this._pluginName},configurable:!0},params:{get:function(){return this._params},configurable:!0}}),DKTools.PluginManager=class{constructor(){return DKTools.PluginManager}static initialize(){this.registerPlugins(Imported),this._checkRequirements()}static _checkRequirements(){_.forEach(this._requirements,(t,e)=>{const i=_.max(t),s=this.getVersion(e);if(void 0===s){const t='Required to install the plugin "%1". Minimal version: %2'.format(e,i);throw new Error(t)}if(s{this.registerPlugin(e,t)})}static requirePlugin(t,e){this._requirements[t]||(this._requirements[t]=[]),this._requirements[t].push(e)}static requirePlugins(t){_.forEach(t,(t,e)=>{this.requirePlugin(e,t)})}},Object.defineProperties(DKTools.PluginManager,{_plugins:{value:{}},_requirements:{value:{}},plugins:{get:function(){return this._plugins},configurable:!0},requirements:{get:function(){return this._requirements},configurable:!0}}),DKTools.PluginCommandManager=class{constructor(){return DKTools.PluginCommandManager}static has(t){return!!this._pluginCommands[t.toLowerCase()]}static process(t,e,i){const s=this._pluginCommands[e.toLowerCase()];DKTools.Utils.isFunction(s)&&s.call(t,i)}static set(t,e){this._pluginCommands[t.toLowerCase()]=e}},Object.defineProperties(DKTools.PluginCommandManager,{_pluginCommands:{value:{}}}),DKTools.PreloadManager=class{constructor(){return DKTools.PreloadManager}static initialize(){this.clearCache();const t=DKToolsParam.get("Preload Manager");if(this._enabled=t.Enabled,!this.isEnabled())return;t["Audio Files"].forEach(t=>{this.preloadAudio({path:t.Path,caching:t.Caching})}),t["Image Files"].forEach(t=>{this.preloadImage({path:t.Path,hue:t.Hue,caching:t.Caching})});let e=!1;t["Progress Bar"].Enabled||(e=!0,this.onFileLoad(()=>{Graphics.updateLoading()}),this.onFinish(()=>{Graphics.endLoading()})),e&&this.start()}static clearCache(){this._cache={audio:{},image:{}}}static clearQueue(){this._queue={audio:[],image:[]}}static _finish(){this._finishTime=new Date,this.clearQueue();const t=(this._finishTime-this._startTime)/1e3,e=this.getTotal();if(this._log("Preloading complete! \nLoaded/Skipped/Total: "+this._loaded+"/"+this._skipped+"/"+e+"\nPreloading time: "+t+" sec"),this._finishListeners){const i={loaded:this._loaded,skipped:this._skipped,preloadingTime:t,total:e};for(;this._finishListeners.length>0;){this._finishListeners.shift()(i)}delete this._finishListeners}this._fileLoadListeners&&delete this._fileLoadListeners}static _generateAudioKey(t){return DKTools.IO.normalizePath(t,!0)}static _generateImageKey(t,e=0){return DKTools.IO.normalizePath(ImageManager._generateCacheKey(t,e||0),!0)}static getCachedAudioByKey(t){return this._cache.audio[t]}static getCachedAudioByPath(t){return this.getCachedAudioByKey(this._generateAudioKey(t))}static getCachedImageByKey(t){return this._cache.image[t]}static getCachedImageByPath(t){return this.getCachedImageByKey(this._generateImageKey(t))}static getTotal(){return _.size(this._queue.audio)+_.size(this._queue.image)}static isAudioCachedByKey(t){return!!this._cache.audio[t]}static isAudioCachedByPath(t){return this.isAudioCachedByKey(this._generateAudioKey(t))}static isEnabled(){return this._enabled}static isFinished(){return!!this._finishTime}static isReady(){return!this.isEnabled()||this.isFinished()}static isImageCachedByKey(t){return!!this._cache.image[t]}static isImageCachedByPath(t,e){return this.isImageCachedByKey(this._generateImageKey(t,e))}static _log(t){this.isEnabled()&&DKTools.Utils.isTest()&&DKToolsParam.get("Preload Manager","Debugging")&&t&&console.log(t)}static _onFileLoad(t){if(this._loaded++,this._log(`Loaded ${t instanceof WebAudio?"audio":"image"}: ${t.url}`),this._fileLoadListeners){const e={file:t,loadded:this._loaded,total:this.getTotal()};this._fileLoadListeners.forEach(t=>{t(e)})}}static onFileLoad(t){this._fileLoadListeners||(this._fileLoadListeners=[]),this._fileLoadListeners.push(t)}static onFinish(t){this._finishListeners||(this._finishListeners=[]),this._finishListeners.push(t)}static _preload(t,e){if(this.isEnabled()&&e instanceof Object&&DKTools.Utils.isString(e.path)){const i=new DKTools.IO.Directory(e.path);if(i.isDirectory()){if(!DKTools.IO.isLocalMode()&&DKTools.IO.mode!==DKTools.IO.MODE_NWJS_STAMP)throw new Error("Web browsers and mobile phones cannot load directories!");{const s={sync:!0};let n=[];"audio"===t?n=i.getAudioFiles(s).data:"image"===t&&(n=i.getImageFiles(s).data),n.forEach(i=>{const s=i.getFullPath();this._queue[t][s]||(this._queue[t][s]={...e,path:s})})}}else{let i=e.path;i.includes(".")||("image"===t?i+=".png":"audio"===t&&(i+=".ogg"));const s=new DKTools.IO.File(i),n=s.getFullPath();s.isFile()?this._queue[t][n]||(this._queue[t][n]={...e,path:i}):console.error("This is not a file: "+n)}}}static _processLoadAudioFiles(){const t=[];return _.forEach(this._queue.audio,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isAudio()){if(this.isAudioCachedByPath(s))return this._skipped++,void this._log("Audio already preloaded: "+s+". Skipped...");const n=i.loadAudio();n?(e.caching&&(this._cache.audio[this._generateAudioKey(n.url)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an audio: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an audio: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),t.map(t=>DKTools.Utils.WebAudio.loadAsync(t).then(()=>this._onFileLoad(t)))}static _processLoadImageFiles(){const t=[];return _.forEach(this._queue.image,e=>{const i=new DKTools.IO.File(e.path),s=i.getFullPath();if(i.isFile())if(i.isImage()){if(this.isImageCachedByPath(s,e.hue))return this._skipped++,void this._log("Image already preloaded: "+s+". Skipped...");const n=DKTools.Utils.Bitmap.reserve({folder:i.getPath(),filename:i.getName(),hue:e.hue});n?(e.caching&&(this._cache.image[this._generateImageKey(n.url,e.hue)]=n),t.push(n)):(this._skipped++,this._log("Cannot load an image: "+s+". Skipped..."))}else this._skipped++,this._log("This is not an image: "+s+". Skipped...");else this._skipped++,this._log("This is not a file: "+e.path+". Skipped...")}),t.map(t=>DKTools.Utils.Bitmap.loadAsync(t).then(()=>this._onFileLoad(t)))}static preloadAudio(t){this._preload("audio",t)}static preloadImage(t){this._preload("image",t)}static releaseAudioByKey(t){this._cache.audio[t]=void 0}static releaseAudioByPath(t){this.releaseAudioByKey(this._generateAudioKey(t))}static releaseImageByKey(t){this._cache.image[t]=void 0}static releaseImageByPath(t,e){this.releaseImageByKey(this._generateImageKey(t,e))}static start(){if(!this.isEnabled())return;const t=this.getTotal();if(this._loaded=0,this._skipped=0,this._startTime=new Date,this._finishTime=null,0===t)return void this._finish();this._log("DKTools Preload Manager is running... \nTotal files to load: "+t);const e=Promise.all(this._processLoadAudioFiles()),i=Promise.all(this._processLoadImageFiles());Promise.all([e,i]).then(()=>this._finish())}},Object.defineProperties(DKTools.PreloadManager,{_queue:{value:{audio:{},image:{}},writable:!0},_cache:{value:{audio:[],image:[]},writable:!0}}),DKTools.StartupManager=class{static async initialize(){this._isReady=!1,await this.checkErrors(),await this.initializeModules(),this._isReady=!0}static async initializeModules(){DKTools.PreloadManager.initialize()}static _checkRPGMakerVersion(){if(Utils.RPGMAKER_VERSION<"1.6.0")throw new Error("Required to update RPG Maker MV to minimal version 1.6.0 (Installed: %1)".format(Utils.RPGMAKER_VERSION))}static _checkWebStorage(){if(!DKTools.IO.isLocalMode()&&!window.hasOwnProperty("localStorage"))throw new Error("Your browser does not support localStorage API")}static async checkErrors(){await this._checkRPGMakerVersion(),await this._checkWebStorage()}static isReady(){return this._isReady}},DKTools.Audio=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._type=t.type.toLowerCase(),this._name=t.name,this._volume=_.defaultTo(t.volume,this.standardVolume()),this._pitch=_.defaultTo(t.pitch,this.standardPitch()),this._pan=_.defaultTo(t.pan,this.standardPan()),this._loop=_.defaultTo(t.loop,this.standardLoop()),this._buffer=this._createBuffer(),this._pausePos=null}_createBuffer(){return AudioManager.createBuffer(this._type,this._name)}clone(){return new DKTools.Audio(this)}equals(t){return!!t&&(this._type===t.type&&this._name===t.name&&this._volume===t.volume&&this._pitch===t.pitch&&this._pan===t.pan&&this._loop===t.loop)}fadeIn(t=0){this._buffer.fadeIn(t)}fadeOut(t=0){this._buffer.fadeOut(t)}isPaused(){return!this.isPlaying()&&null!=this._pausePos}isPlaying(){return this._buffer.isPlaying()}pause(){this.isPlaying()&&(this._pausePos=this.seek(),this.stop())}play(t=0){this._buffer.play(this._loop,t),this._updateBufferParameters(),this._pausePos=null}resume(){this.isPaused()&&this.play(this._pausePos)}seek(){return this._buffer.seek()}standardLoop(){return"bgm"===this._type||"bgs"===this._type}standardPan(){return 0}standardPitch(){return 100}standardVolume(){return 90}stop(){this.isPlaying()&&this._buffer.stop()}_updateBufferParameters(){const t=this._buffer;let e=AudioManager[this._type+"Volume"];Number.isFinite(e)||(e=100),t.volume=e*this._volume/1e4,t.pitch=this._pitch/100,t.pan=this._pan/100}},Object.defineProperties(DKTools.Audio.prototype,{id:{get:function(){return this._id},configurable:!0},type:{get:function(){return this._type},configurable:!0},name:{get:function(){return this._name},configurable:!0},volume:{get:function(){return this._volume},set:function(t){this._volume!==t&&(this._volume=t,this._updateBufferParameters())},configurable:!0},pitch:{get:function(){return this._pitch},set:function(t){this._pitch!==t&&(this._pitch=t,this._updateBufferParameters())},configurable:!0},pan:{get:function(){return this._pan},set:function(t){this._pan!==t&&(this._pan=t,this._updateBufferParameters())},configurable:!0},loop:{get:function(){return this._loop},configurable:!0},buffer:{get:function(){return this._buffer},configurable:!0},pos:{get:function(){return this.seek()},set:function(t){this.play(t)},configurable:!0}}),DKTools.Event=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this._id=t.id,this._target=t.target,this._type=t.type,this._repeatTime=t.repeatTime||-1,this._repeats=_.defaultTo(t.repeats,-1),this._remainingPauseTime=t.remainingPauseTime||0,this._onStart=t.onStart,this._onUpdate=t.onUpdate,this._onPause=t.onPause,this._onReset=t.onReset,this._onRepeat=t.onRepeat,this._onSuccess=t.onSuccess,this._onFail=t.onFail,this._started=!1,this._resetRemainingTime(),this._resetRemainingRepeats()}addRemainingPauseTime(t=1){this._remainingPauseTime+=t}addRemainingRepeats(t=1){this._remainingRepeats+=t}addRemainingTime(t=1){this._remainingTime+=t}_callOnPauseHandler(){this._canCallOnPauseHandler()&&this._onPause(this)}_callOnRepeatHandler(){this._canCallOnRepeatHandler()&&this._onRepeat(this)}_callOnResetHandler(){this._canCallOnResetHandler()&&this._onReset(this)}_callOnStartHandler(){this._canCallOnStartHandler()&&this._onStart(this),this._started=!0}_callOnSuccessHandler(t=!1){(this._canCallOnSuccessHandler()||t)&&this._onSuccess(this)}_callOnUpdateHandler(){this._canCallOnUpdateHandler()&&this._onUpdate(this)}_callonFailHandler(){this._canCallonFailHandler()&&this._onFail(this)}_canCallOnPauseHandler(){return this.hasOnPauseHandler()&&this.isPaused()}_canCallOnRepeatHandler(){return this.hasOnRepeatHandler()}_canCallOnResetHandler(){return this.hasOnResetHandler()}_canCallOnStartHandler(){return this.hasOnStartHandler()&&!this.isStarted()}_canCallOnSuccessHandler(){return this.hasOnSuccessHandler()&&this.isFinished()}_canCallOnUpdateHandler(){return this.hasOnUpdateHandler()&&this.isUpdated()}_canCallonFailHandler(){return this.hasonFailHandler()}_clearRemainingRepeats(){this._remainingRepeats=0}_clearRemainingTime(){this._remainingTime=0}clone(){return new this.constructor(this)}finish(t=!1){this.isFinished()||t?this._callOnSuccessHandler(t):this._callonFailHandler(),this._clearRemainingTime(),this._clearRemainingRepeats()}getElapsedRepeats(){return this._repeats-this._remainingRepeats}getElapsedTime(){return this._repeatTime-this._remainingTime}hasManager(){return!!this._manager}hasOnPauseHandler(){return!!this._onPause}hasOnRepeatHandler(){return!!this._onRepeat}hasOnResetHandler(){return!!this._onReset}hasOnStartHandler(){return!!this._onStart}hasOnSuccessHandler(){return!!this._onSuccess}hasOnUpdateHandler(){return!!this._onUpdate}hasTarget(){return!!this._target}hasType(){return!!this._type}hasonFailHandler(){return!!this._onFail}isAnimation(){return this instanceof DKTools.Animation}isAnimationAction(){return this instanceof DKTools.Animation.Action}isFinished(){return 0===this._remainingTime&&0===this._remainingRepeats}isPaused(){return 0!==this._remainingPauseTime}isStarted(){return this._started}isUpdated(){return this.isStarted()&&!this.isPaused()&&!this.isFinished()}pause(t=-1){this._remainingPauseTime=t}_resetRemainingRepeats(){this._remainingRepeats=this._repeats}_resetRemainingTime(){this._remainingTime=this._repeatTime}remove(){return!this.hasTarget()||this._target.removeEvent(this)}repeat(){this._remainingRepeats>0&&this._remainingRepeats--,this._resetRemainingTime(),this._callOnRepeatHandler()}reset(){this._resetRemainingTime(),this._resetRemainingRepeats(),this._callOnResetHandler()}resume(){this._remainingPauseTime=0}setManager(t){this._manager=t}setOnPauseHandler(t){this._onPause=t}setOnRepeatHandler(t){this._onRepeat=t}setOnResetHandler(t){this._onReset=t}setOnStartHandler(t){this._onStart=t}setOnSuccessHandler(t){this._onSuccess=t}setOnUpdateHandler(t){this._onUpdate=t}setTarget(t){this._target=t}setonFailHandler(t){this._onFail=t}stop(t=!1){this.finish(t),this.reset()}_update(){this._callOnUpdateHandler(),this._updateRemainingRepeats()}_updatePause(){this._callOnPauseHandler(),this._updateRemainingPauseTime()}_updateRemainingPauseTime(){this._remainingPauseTime>0&&this._remainingPauseTime--}_updateRemainingRepeats(){this.isFinished()||(0===this._remainingTime?this.repeat():this._updateRemainingTime())}_updateRemainingTime(){this._remainingTime>0&&this._remainingTime--}update(){this.isPaused()?this._updatePause():(this._callOnStartHandler(),this._update(),this.isFinished()&&this.finish())}},Object.defineProperties(DKTools.Event.prototype,{id:{get:function(){return this._id},configurable:!0},target:{get:function(){return this._target},configurable:!0},manager:{get:function(){return this._manager},configurable:!0},type:{get:function(){return this._type},configurable:!0},repeatTime:{get:function(){return this._duration},configurable:!0},repeats:{get:function(){return this._repeats},configurable:!0},remainingTime:{get:function(){return this._remainingTime},set:function(t){this._remainingTime=t},configurable:!0},remainingRepeats:{get:function(){return this._remainingRepeats},set:function(t){this._remainingRepeats=t},configurable:!0},remainingPauseTime:{get:function(){return this._remainingPauseTime},set:function(t){this._remainingPauseTime=t},configurable:!0},onStart:{get:function(){return this._onStart},configurable:!0},onUpdate:{get:function(){return this._onUpdate},configurable:!0},onPause:{get:function(){return this._onPause},configurable:!0},onReset:{get:function(){return this._onReset},configurable:!0},onRepeat:{get:function(){return this._onRepeat},configurable:!0},onSuccess:{get:function(){return this._onSuccess},configurable:!0},onFail:{get:function(){return this._onFail},configurable:!0}}),DKTools.Animation=class extends DKTools.Event{initialize(t){this._actions=[],DKTools.Event.prototype.initialize.call(this,t)}addAction(t){t&&(Number.isFinite(t.startTime)||(t.startTime=0),Number.isFinite(t.endTime)||(t.endTime=this._repeatTime),t.setAnimation(this),this._actions.push(t))}addActions(t){_.forEach(t,this.addAction.bind(this))}_canUpdateAction(t){return _.inRange(this.getElapsedTime(),t.startTime,t.endTime)}hasAction(t){return DKTools.Utils.Array.contains(this._actions,t)}hasActions(){return!DKTools.Utils.Array.isEmpty(this._actions)}isActionFinished(t){return t.isStarted()&&!t.isPaused()&&this.getElapsedTime()>=t.endTime}isActionUpdated(t){return t.isStarted()&&!t.isPaused()&&this._canUpdateAction(t)}isFinished(){return DKTools.Event.prototype.isFinished.call(this)||!this.hasActions()}removeAction(t){this.hasAction(t)&&DKTools.Utils.Array.remove(this._actions,t)}repeat(){this.repeatActions(),DKTools.Event.prototype.repeat.call(this)}repeatActions(){_.forEach(this._actions,function(t){t.repeat()})}reset(){this.resetActions(),DKTools.Event.prototype.reset.call(this)}resetActions(){_.forEach(this._actions,function(t){t.reset()})}_update(){this._updateActions(),DKTools.Event.prototype._update.call(this)}_updateAction(t){this._canUpdateAction(t)?t.update():this.getElapsedTime()===t.endTime&&this.isActionFinished(t)&&t.finish()}_updateActions(){_.forEach(this._actions,this._updateAction.bind(this))}},Object.defineProperties(DKTools.Animation.prototype,{actions:{get:function(){return this._actions},configurable:!0}}),DKTools.Animation.Action=class extends DKTools.Event{static Anchor(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.anchor,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setAnchor(o,a)}.bind(e)),e}static Close(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=-e.openness/t,s=e.openness+i;e.openness=s}.bind(e)),e}static Frame(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.frame,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=(i.width-s.width)/t,a=(i.height-s.height)/t,l=new Rectangle(s.x+n,s.y+r,s.width+o,s.height+a);e.setFrame(l)}.bind(e)),e}static Move(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.x-e.x)/t,s=(this._data.y-e.y)/t,n=e.x+i,r=e.y+s;e.move(n,r)}.bind(e)),e}static OpacitySprite(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.opacity)/t,s=e.opacity+i;e.setOpacity(s)}.bind(e)),e}static OpacityWindow(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data.windowOpacity-e.windowOpacity)/t,s=(this._data.contentsOpacity-e.contentsOpacity)/t,n=(this._data.frameOpacity-e.frameOpacity)/t,r=(this._data.backOpacity-e.backOpacity)/t,o={windowOpacity:e.windowOpacity+i,contentsOpacity:e.contentsOpacity+s,frameOpacity:e.frameOpacity+n,backOpacity:e.backOpacity+r};e.setOpacity(o)}.bind(e)),e}static Open(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(255-e.openness)/t;e.openness=e.openness+i}.bind(e)),e}static Pivot(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.pivot,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setPivot(o,a)}.bind(e)),e}static Rotation(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.rotation)/t,s=e.rotation+i;e.setRotation(s)}.bind(e)),e}static Scale(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.scale,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setScale(o,a)}.bind(e)),e}static Skew(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=this._data,s=e.skew,n=(i.x-s.x)/t,r=(i.y-s.y)/t,o=s.x+n,a=s.y+r;e.setSkew(o,a)}.bind(e)),e}static Sound(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this._data;t.isPlaying()||t.play()}.bind(e)),e}static Tint(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=(this._data-e.tint)/t,s=e.tint+i;e.setTint(s)}.bind(e)),e}static Tone(t){const e=new DKTools.Animation.Action(t);return e.setOnUpdateHandler(function(){const t=this.getRemainingTime(),e=this._target,i=e.tone,s=(this._data[0]-i[0])/t,n=(this._data[1]-i[1])/t,r=(this._data[2]-i[2])/t,o=i[0]+s,a=i[1]+n,l=i[2]+r;e.setTone([o,a,l])}.bind(e)),e}initialize(t){t=t||{},this._animation=null,this._startTime=t.startTime,this._endTime=t.endTime,this._data=t.data,DKTools.Event.prototype.initialize.call(this,t)}getElapsedTime(){return this._animation.getElapsedTime()-this._startTime}getRemainingTime(){return this._endTime-this._animation.getElapsedTime()}isFinished(){return this._animation.isActionFinished(this)}isUpdated(){return this._animation.isActionUpdated(this)}remove(){this._animation.removeAction(this)}repeat(){this._callOnRepeatHandler()}reset(){this._callOnResetHandler()}setAnimation(t){this._animation=t}},Object.defineProperties(DKTools.Animation.Action.prototype,{animation:{get:function(){return this._animation},configurable:!0},startTime:{get:function(){return this._startTime},set:function(t){this._startTime=t},configurable:!0},endTime:{get:function(){return this._endTime},set:function(t){this._endTime=t},configurable:!0},data:{get:function(){return this._data},configurable:!0}}),DKTools.OptionManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(){this.clear()}addOptionChangeListener(t,e){this._optionChangeListeners[t]||(this._optionChangeListeners[t]=[]),this._optionChangeListeners[t].push(e)}clear(){this._options=[],this._optionChangeListeners={}}clone(t=!1){const e=new DKTools.OptionManager;return e.enableOptions(this._options),t&&_.forEach(this._optionChangeListeners,(t,i)=>{_.forEach(t,t=>{e.addOptionChangeListener(i,t)})}),e}disableOption(t){this.isOptionEnabled(t)&&(DKTools.Utils.Array.remove(this._options,t),this._onOptionChange(t,!1))}disableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.disableOption.bind(this))}enableOption(t){this.isOptionDisabled(t)&&(this._options.push(t),this._onOptionChange(t,!0))}enableOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.enableOption.bind(this))}equals(t){return t instanceof DKTools.OptionManager&&_.isEqual(this._options,t.options)}isOptionDisabled(t){return!this.isOptionEnabled(t)}isOptionEnabled(t){return DKTools.Utils.Array.contains(this._options,t)}isOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionDisabled.bind(this))}isOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.every(e,this.isOptionEnabled.bind(this))}isSomeOptionEnabled(){return this._options.length>0}isSomeOptionsDisabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionDisabled.bind(this))}isSomeOptionsEnabled(t){const e=arguments.length>1?arguments:t;return _.some(e,this.isOptionEnabled.bind(this))}_onOptionChange(t,e){_.forEach(this._optionChangeListeners[t],i=>{i(t,e)})}removeOptionChangeListener(t,e){DKTools.Utils.Array.remove(this._optionChangeListeners[t],e)}switchOption(t){this.isOptionEnabled(t)?this.disableOption(t):this.enableOption(t)}switchOptions(t){const e=arguments.length>1?arguments:t;_.forEach(e,this.switchOption.bind(this))}},Object.defineProperties(DKTools.OptionManager,{options:{get:function(){return this._options},configurable:!0}}),DKTools.EventManager=class{constructor(){this.initialize.apply(this,arguments)}initialize(t){this._target=t,this._events={}}addAnimation(t){return this.addEventToContainer(t)}addEvent(t){let e;return t instanceof DKTools.Event||t instanceof DKTools.Animation?e=t:t instanceof Object&&(e=new DKTools.Event(t)),this.addEventToContainer(e)}addEventToContainer(t){if(!t)return null;return t.hasTarget()||t.setTarget(this._target),t.setManager(this),this.getEventsContainer(t).push(t),t}addOneTimeEvent(t){return t.repeatTime=1,t.repeats=0,this.addEvent(t)}_checkEvent(t){return t&&!t.isFinished()}_checkEvents(){_.forEach(this._events,(t,e)=>{this._events[e]=this._checkEventsContainer(t)})}_checkEventsContainer(t){return _.filter(t,this._checkEvent.bind(this))}clearEvents(t){t?Array.isArray(t)?_.forEach(t,t=>{this._events[t]=[]}):this._events[t]=[]:this._events={}}createEventsContainer(t){return this._events[t]=[],this._events[t]}findAnimation(t,e){return _.find(this.getAnimations(e),{id:t})}findEvent(t,e){return _.find(this.getEvents(e),{id:t})}finishEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.finish(e)})}getAnimations(t){return _.filter(this.getEvents(t),t=>t instanceof DKTools.Animation)}getEventIndex(t){return this.getEventsContainer(t).indexOf(t)}getEvents(t){if(t)return this.getEventsContainerByType(t);let e=[];return _.forEach(this._events,t=>{e=e.concat(t)}),e}getEventsContainer(t){return this.getEventsContainerByType(t.type)}getEventsContainerByType(t){return this._events[t]||this.createEventsContainer(t)}hasAnimation(t){return t instanceof DKTools.Animation&&this.getEventIndex(t)>=0}hasAnimations(t){return!DKTools.Utils.Array.isEmpty(this.getAnimations(t))}hasEvent(t){return this.getEventIndex(t)>=0}hasEvents(t){return!DKTools.Utils.Array.isEmpty(this.getEvents(t))}isEventsPaused(t){const e=this.getEventsContainerByType(t);return _.every(e,t=>t.isPaused())}iterateEventsContainer(t,e){const i=this.getEventsContainerByType(t);_.forEach(i,e)}pauseEvents(t,e=-1){this.iterateEventsContainer(t,t=>{t.pause(e)})}removeEvent(t){const e=this.getEventIndex(t);if(e>=0){return this.getEventsContainer(t)[e]=null,!0}return!1}resumeEvents(t){this.iterateEventsContainer(t,t=>{t.resume()})}stopEvents(t,e=!1){this.iterateEventsContainer(t,t=>{t.stop(e)})}update(){this._checkEvents()}updateEvent(t){t&&t.update()}updateEventsContainer(t){this.iterateEventsContainer(t,this.updateEvent.bind(this))}},Object.defineProperties(DKTools.EventManager,{events:{get:function(){return this._events},configurable:!0}}),DKTools.Unit=class{constructor(t){this.initialize.apply(this,arguments)}initialize(t){t=t||{},this.setSource(t.source),this.setPercents(t.percents),this.setGetValueHandler(t.getValueHandler)}add(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.add(e):this._source+=e,this):this}clone(){return new this.constructor(this)}div(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.div(e):this._source/=e,this):this}equals(t){return!!t&&(this===t||this._source===t.source&&this._percents===t.percents)}_getValueFromUnit(t){return t instanceof DKTools.Unit?t.getValue():t}getPercents(){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const t=this._percents(this);return Number.isFinite(t)?t:100}return 100}getValue(){let t;return(t=this.hasGetValueHandler()?this._getValueHandler(this):this.getValueBase())||0}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source instanceof DKTools.Unit?this._source.getValue()*t:this._source*t}hasGetValueHandler(){return DKTools.Utils.isFunction(this._getValueHandler)}hasPercents(){return DKTools.Utils.isFunction(this._percents)||Number.isFinite(this._percents)}hasSource(){return this._source instanceof DKTools.Unit||Number.isFinite(this._source)}mul(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.mul(e):this._source*=e,this):this}setGetValueHandler(t){this._getValueHandler=t}setPercents(t=100){this._percents=t}setSource(t){this._source=t}sub(t){if(!t)return this;const e=this._getValueFromUnit(t);return e?(this._source instanceof DKTools.Unit?this._source.rem(e):this._source-=e,this):this}},Object.defineProperties(DKTools.Unit.prototype,{source:{get:function(){return this._source},configurable:!0},percents:{get:function(){return this._percents},configurable:!0},getValueHandler:{get:function(){return this._getValueHandler},configurable:!0}}),DKTools.Unit.Property=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperty(t.property)}add(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.add(s):this._source[e]+=s,this):this}div(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.div(s):this._source[e]/=s,this):this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&this._percents===t.percents&&this._property===t.property)}getValueBase(){if(!this.hasSource()||!this.hasProperty())return Number.NaN;return new DKTools.Unit({source:this._source[this._property],percents:this.getPercents()}).getValue()}hasProperty(){return!!this._property}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.mul(s):this._source[e]*=s,this):this}setProperty(t){this._property=t}sub(t){if(!t)return this;const e=this._property,i=this._source[e];let s=this._getValueFromUnit(t);return s instanceof Object&&(s=s[e]),s?(i instanceof DKTools.Unit?i.rem(s):this._source[e]-=s,this):this}},Object.defineProperties(DKTools.Unit.Property.prototype,{property:{get:function(){return this._property},configurable:!0}}),DKTools.Unit.Properties=class extends DKTools.Unit{initialize(t){t=t||{},DKTools.Unit.prototype.initialize.call(this,t),this.setProperties(t.properties)}add(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].add(i):this._source[e]+=i)}),this}addProperty(t){Array.isArray(this._properties)&&this._properties.push(t)}div(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].div(i):this._source[e]/=i)}),this}equals(t){return!!t&&(this===t||_.isEqual(this._source,t.source)&&_.isEqual(this._percents,t.percents)&&_.isEqual(this._properties,t.properties))}_getProperties(){let t=this._properties;return DKTools.Utils.isFunction(t)&&(t=t(this)),Array.isArray(t)?t:[]}getPercents(t){if(Number.isFinite(this._percents))return this._percents;if(DKTools.Utils.isFunction(this._percents)){const e=this._percents(t,this);return Number.isFinite(e)?e:100}if(this._percents instanceof Object){if(DKTools.Utils.isFunction(this._percents[t])){const e=this._percents[t](this);return Number.isFinite(e)?e:100}return Number.isFinite(this._percents[t])?this._percents[t]:100}return 100}getValue(t){return this.hasGetValueHandler()?this._getValueHandler(t,this):this.getValueBase(t)}getValueBase(t){const e=t=>{if(!this.hasSource())return Number.NaN;const e=this._source,i=this.getPercents(t);return 0===i?0:e[t]instanceof DKTools.Unit?e[t].getValue(t)*i/100:new DKTools.Unit.Property({source:e,percents:i,property:t}).getValue()};if(t)return e(t);const i=this._getProperties();return _.reduce(i,(t,i)=>(t[i]=e(i),t),{})}hasProperty(t){return this._getProperties().includes(t)}hasProperties(){return this._getProperties().length>0}hasSource(){return this._source instanceof Object}mul(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].mul(i):this._source[e]*=i)}),this}removeProperty(t){Array.isArray(this._properties)&&DKTools.Utils.Array.remove(this._properties,t)}setProperties(t){this._properties=DKTools.Utils.isFunction(t)?t:_.clone(t)}sub(t){if(!t)return this;const e=this._getProperties();return _.forEach(e,e=>{let i=this._getValueFromUnit(t);i instanceof Object&&(i=i[e]),i&&(this._source[e]instanceof DKTools.Unit?this._source[e].rem(i):this._source[e]-=i)}),this}},Object.defineProperties(DKTools.Unit.Properties.prototype,{properties:{get:function(){return this._properties},configurable:!0}}),DKTools.Unit.Function=class extends DKTools.Unit{add(){return this}div(){return this}getValueBase(){if(!this.hasSource())return Number.NaN;const t=this.getPercents()/100;return 0===t?0:this._source(this)*t}hasSource(){return DKTools.Utils.isFunction(this._source)}mul(){return this}sub(){return this}},DKTools.Base=class{constructor(){throw new Error("This is an abstract class!")}initialize(t,e,i,s){let n;t instanceof Graphics?(i=Graphics.boxWidth,s=Graphics.boxHeight):t instanceof Object?(n=t.x,e=t.y,i=t.width,s=t.height):Number.isFinite(t)&&(n=t),this.move(n,e),this.setupSize(i,s),this._clearAll(),this._createAll(),this._setupAll(),this._addAllChildren(),this.setupAll(t)}_addAllChildren(){}activate(){this.setActive(!0)&&this.updateActivateEvents()}actorName(t){const e=t>=1?$gameActors.actor(t):null;return e?e.name():""}addAllChildren(){this.updateAddAllChildrenEvents()}addAnimation(t){this._eventManager.addAnimation(t)}addEvent(t){return this._eventManager.addEvent(t)}addOneTimeEvent(t){return this._eventManager.addOneTimeEvent(t)}addOptionChangeListener(t,e){this._optionManager.addOptionChangeListener(t,e)}addFilter(t){t&&(this.filters&&this.filters.length>0?this.filters.push(t):this.filters=[t])}_clearAll(){this._clearMouseEnterTime(),this._clearWheel()}_clearMouseEnterTime(){this._mouseEnterTime=0}_clearWheel(){this._clearWheelX(),this._clearWheelY()}_clearWheelX(){this._wheelX=0}_clearWheelY(){this._wheelY=0}_createAll(){this._createOptionManager(),this._createEventManager()}_createEventManager(){this._eventManager=new DKTools.EventManager(this)}_createOptionManager(){this._optionManager=new DKTools.OptionManager}_checkHeight(t){const e=this.getMinHeight();return t?Math.max(e,t):e}_checkWidth(t){const e=this.getMinWidth();return t?Math.max(e,t):e}calcTextHeight(t,e=!1){if(!this.hasBitmap()||!t)return 0;const i=this.bitmap.fontSize,s=t.text.slice(t.index).split("\n"),n=e?s.length:1;let r=0;for(let t=0;t{e.addText(t.text,{...t.options})}),t.cloneOptions&&e.enableOptions(this._optionManager.options),t.blockStart||e.start(),t.activate&&e.activate(),e}convertEscapeCharacters(t){try{return Window_Base.prototype.convertEscapeCharacters.call(this,t)}catch(e){return t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\x1b\x1b/g,"\\")).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bV\[(\d+)\]/gi,function(){return $gameVariables.value(parseInt(arguments[1]))}.bind(this))).replace(/\x1bN\[(\d+)\]/gi,function(){return this.actorName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bP\[(\d+)\]/gi,function(){return this.partyMemberName(parseInt(arguments[1]))}.bind(this))).replace(/\x1bG/gi,TextManager.currencyUnit)}}createAll(){this.updateCreateAllEvents()}deactivate(){this.setActive(!1)&&this.updateDeactivateEvents()}destroy(t={}){this._clearAll(),this.clearEvents(),this.hide()}disableOption(t){this._optionManager.disableOption(t)}disableOptions(t){this._optionManager.disableOptions.apply(this._optionManager,arguments)}drawAll(){}drawArrow(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=ImageManager.loadSystem(this.standardWindowskin()),s=DKTools.Sprite.Arrow.getRect(t);return this.drawBitmap(i,{...e,source:s})}drawBitmap(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=DKTools.Utils.Bitmap.load(t);if(!i||e.sync&&!i.isReady())return!1;let s=!0;return i.addLoadListener(()=>{const t=DKTools.Utils.isFunction,n=DKTools.Utils.isString,r=this.getLineHeight(),{paintOpacity:o,resetPaintOpacity:a}=e;let{source:l,destination:h}=e,u={};t(e.callback)&&(u=e.callback(i,this)),l=l||u.source||{},h=h||u.destination||{},t(l)&&(l=l(i,this)),t(h)&&(h=h(i,this));const c=_.defaultTo(l.x,0),p=_.defaultTo(l.width,i.width);let d=_.defaultTo(l.y,0),f=_.defaultTo(l.height,i.height);const g=_.defaultTo(h.x,0),m=_.defaultTo(h.width,p);let T=_.defaultTo(h.y,0),y=_.defaultTo(h.height,f);0!==p&&0!==f&&0!==m&&0!==y?(n(d)&&(d=r*parseFloat(d)),n(f)&&(f=r*parseFloat(f)),n(T)&&(T=r*parseFloat(T)),n(y)&&(y=r*parseFloat(y)),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.blt(i,c,d,p,f,g,T,m,y),a&&this.resetPaintOpacity()):s=!1}),s}async drawBitmapAsync(t,e={}){if(!t)return!1;const i=await DKTools.Utils.Bitmap.loadAsync(t);return this.drawBitmap(i,e)}drawCharacter(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const s=ImageManager.loadCharacter(t),n=ImageManager.isBigCharacter(t),r=s.width/(n?3:12),o=s.height/(n?4:8),a=(e%4*3+1)*r,l=4*Math.floor(e/4)*o,h=new Rectangle(a,l,r,o),u=i.pos;let{x:c,y:p}=i;return u instanceof Object&&(c=u.x,p=u.y),c=c||0,p=p||0,this.drawBitmap(s,{...i,source:h,destination:{x:c,y:p}})}drawCircle(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a}=t;return 0!==i&&(e instanceof Object&&(o=e.x,a=e.y),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),Number.isFinite(n)&&this.changePaintOpacity(n),this.bitmap.drawCircle(o||0,a||0,i||1,s||"white"),r&&this.resetPaintOpacity(),!0)}drawFace(t,e,i={}){if(!this.hasBitmap()||null==t||null==e)return!1;i=i||{};const{pos:s,rect:n}=i;let{x:r,y:o,width:a,height:l}=i;s instanceof Object&&(r=s.x,o=s.y),n instanceof Object&&(r=n.x,o=n.y,a=n.width,l=n.height),a=a||Window_Base._faceWidth,l=l||Window_Base._faceHeight;const h=ImageManager.loadFace(t),u=Window_Base._faceWidth,c=Window_Base._faceHeight,p=Math.min(a,u),d=Math.min(l,c),f=e%4*u+(u-p)/2,g=Math.floor(e/4)*c+(c-d)/2,_=new Rectangle(f,g,p,d);return r=Math.floor((r||0)+Math.max(a-u,0)/2),o=Math.floor((o||0)+Math.max(l-c,0)/2),this.drawBitmap(h,{...i,source:_,destination:{x:r,y:o}})}drawGauge(t={}){if(!this.hasBitmap())return!1;const{pos:e,rect:i,reversed:s,gradient:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x:a,y:l,width:h,height:u,type:c,rate:p,backgroundColor:d,color:f,color1:g,color2:m}=t;if(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(a=i.x,l=i.y,h=i.width,u=i.height),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),0===h||0===u)return!1;a=a||0,l=l||0,h=h||this.standardDrawingWidth(),u=u||this.standardDrawingHeight(),d=_.defaultTo(d,"black"),f=_.defaultTo(f,"white"),g=_.defaultTo(g,f),m=_.defaultTo(m,f),c=_.defaultTo(c,"horizontal"),p=_.defaultTo(p,1);const T={x:a,y:l,width:h,height:u};if("horizontal"===c)T.width*=p,s&&(T.x+=h-T.width);else{if("vertical"!==c)return!1;T.height*=p,s&&(T.y+=u-T.height)}return Number.isFinite(r)&&this.changePaintOpacity(r),this.fillRect({x:a,y:l,width:h,height:u,color:d}),this.gradientFillRect({rect:T,color1:g,color2:m,vertical:"vertical"===n}),o&&this.resetPaintOpacity(),!0}drawIcon(t,e={}){if(!this.hasBitmap()||null==t)return!1;const i=ImageManager.loadSystem("IconSet"),s=Window_Base._iconWidth,n=Window_Base._iconHeight,r=t%16*s,o=Math.floor(t/16)*n,a=new Rectangle(r,o,s,n),l=e.pos;let{x:h,y:u}=e;return l instanceof Object&&(h=l.x,u=l.y),this.drawBitmap(i,{...e,source:a,destination:{x:h,y:u}})}drawItemName(t,e={}){if(!this.hasBitmap()||!t)return!1;e=e||{};const i=Window_Base._iconWidth+4,{pos:s,iconPos:n,paintOpacity:r,resetPaintOpacity:o}=e;let{x:a,y:l,iconX:h,iconY:u}=e;return s instanceof Object&&(a=s.x,l=s.y),n instanceof Object&&(h=n.x,u=n.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),a=a||0,l=l||0,h=_.defaultTo(h,a+2),u=_.defaultTo(u,l+2),Number.isFinite(r)&&this.changePaintOpacity(r),this.drawIcon(t.iconIndex,{x:h,y:u}),this.drawText(t.name,{x:a+i,y:l,width:(e.width||312)-i,height:e.height,align:"left",font:e.font,textColor:e.textColor,resetFont:e.resetFont,resetTextColor:e.resetTextColor}),o&&this.resetPaintOpacity(),!0}drawLine(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos1:e,pos2:i,color:s,lineWidth:n,paintOpacity:r,resetPaintOpacity:o}=t;let{x1:a,y1:l,x2:h,y2:u}=t;return 0!==n&&(e instanceof Object&&(a=e.x,l=e.y),i instanceof Object&&(h=i.x,u=i.y),DKTools.Utils.isString(l)&&(l=this.getLineHeight()*parseFloat(l)),DKTools.Utils.isString(u)&&(u=this.getLineHeight()*parseFloat(u)),Number.isFinite(r)&&this.changePaintOpacity(r),DKTools.Utils.Bitmap.drawLine(this.bitmap,a||0,l||0,h||0,u||0,s,n),o&&this.resetPaintOpacity(),!0)}drawPolygon(t){if(!this.hasBitmap())return!1;t=t||{};const{points:e,paintOpacity:i,resetPaintOpacity:s}=t;if(!Array.isArray(e)||0===e.length)return!1;Number.isFinite(i)&&this.changePaintOpacity(i);for(let i=0;i=24&&(this.bitmap.fontSize-=12)}move(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e);this.position.copy(i)}obtainEscapeCode(t){return Window_Base.prototype.obtainEscapeCode.call(this,t)}obtainEscapeParam(t){return Window_Base.prototype.obtainEscapeParam.call(this,t)}partyMemberName(t){const e=t>=1?$gameParty.members()[t-1]:null;return e?e.name():""}pauseEvents(t,e){this._eventManager.pauseEvents(t,e)}processAll(){this.processMouse(),this.processWheel()}processCharacter(t){Window_Base.prototype.processCharacter.call(this,t)}processDrawIcon(t,e){this.drawIcon(t,{x:e.x+2,y:e.y+2}),e.x+=Window_Base._iconWidth+4}processEscapeCharacter(t,e){try{const i={...e};Window_Base.prototype.processEscapeCharacter.call(this,t,i),Object.assign(e,i)}catch(i){switch(t){case"C":this.changeTextColor(this.getWindowskinTextColor(this.obtainEscapeParam(e)));break;case"I":this.processDrawIcon(this.obtainEscapeParam(e),e);break;case"{":this.makeFontBigger();break;case"}":this.makeFontSmaller()}}}processMouse(){this.isOptionEnabled("process-mouse")&&this.isVisible()&&(this.isActive()||this.isOptionEnabled("process-mouse-ignore-active"))?this.isMouseInside()?(0===this._mouseEnterTime&&this.updateMouseEnterEvents(),this.updateMouseInsideEvents(),TouchInput.isMouseMoved()&&this.updateMouseMoveEvents(),this._mouseEnterTime++):(this._mouseEnterTime>0&&this.updateMouseLeaveEvents(),this.updateMouseOutsideEvents(),this._clearMouseEnterTime()):this._clearMouseEnterTime()}processNewLine(t){t.width?t.width0&&(e||this.start(),i&&this.activate()),s}setActive(t){if(this.active===t)return!1;const e=this.active;return this.setupActive(t),this.active!==e}setId(t){if(this._id===t)return!1;const e=this._id;return this.setupId(t),this._id!==e}setPivot(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.pivot,i))return!1;const s=DKTools.Utils.Point.clone(this.pivot);return this.setupPivot(i),!DKTools.Utils.Point.equals(this.pivot,s)}setRotation(t){if(this.rotation===t)return!1;const e=this.rotation;return this.setupRotation(t),this.rotation!==e}setScale(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.scale,i))return!1;const s=DKTools.Utils.Point.clone(this.scale);return this.setupScale(i),!DKTools.Utils.Point.equals(this.scale,s)}setSkew(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.skew,i))return!1;const s=DKTools.Utils.Point.clone(this.skew);return this.setupSkew(i),!DKTools.Utils.Point.equals(this.skew,s)}setTint(t){if(this.tint===t)return!1;const e=this.tint;return this.setupTint(t),this.tint!==e}setVisible(t){if(this.visible===t)return!1;const e=this.visible;return this.setupVisible(t),this.visible!==e}show(t=!1){this.setVisible(!0)&&this.updateShowEvents(),t&&this.activate()}start(t=!1){this._started=!0,this.removeAllChildren(),this.terminateAll(),this.removeAll(),this.checkAll(),this.createAll(),this.startAll(),this.addAllChildren(),this.refreshAll(),this.updateStartEvents(),t&&this.activate()}startAll(){this.updateStartAllEvents()}stopEvents(t,e=!1){this._eventManager.stopEvents(t,e)}strokeArc(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,radius:i,color:s,lineWidth:n,anticlockwise:r,paintOpacity:o,resetPaintOpacity:a}=t;let{x:l,y:h,startAngle:u,endAngle:c}=t;return e instanceof Object&&(l=e.x,h=e.y),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(o)&&this.changePaintOpacity(o),l=l||0,h=h||0,u=u||0,c=_.defaultTo(c,2*Math.PI),DKTools.Utils.Bitmap.strokeArc(this.bitmap,l,h,i,u,c,s,n,r),a&&this.resetPaintOpacity(),!0}strokeRect(t={}){if(!this.hasBitmap())return!1;t=t||{};const{pos:e,rect:i,lineWidth:s,paintOpacity:n,resetPaintOpacity:r}=t;let{x:o,y:a,width:l,height:h,color:u}=t;return e instanceof Object&&(o=e.x,a=pox.y),i instanceof Object&&(o=i.x,a=i.y,l=i.width,h=i.height),DKTools.Utils.isString(a)&&(a=this.getLineHeight()*parseFloat(a)),DKTools.Utils.isString(h)&&(h=this.getLineHeight()*parseFloat(h)),Number.isFinite(n)&&this.changePaintOpacity(n),o=o||0,a=a||0,l=l||this.standardDrawingWidth(),h=h||this.standardDrawingHeight(),u=u||"white",DKTools.Utils.Bitmap.strokeRect(this.bitmap,o,a,l,h,u,s),r&&this.resetPaintOpacity(),!0}switchOption(t){this._optionManager.switchOption(t)}switchOptions(t){this._optionManager.switchOptions.apply(this._optionManager,arguments)}terminate(){}terminateAll(){this.updateTerminateAllEvents()}textWrap(t,e={}){if(!this.hasBitmap()||""===t||null==t)return"";t=String(t),e=e||{};const i=t.split("\n"),s=e.maxWidth||this.bitmap.width,n=this.getTextWidth(" ");let r="",o=1;for(let t=0;ts){const t=i.split("");for(let e=0;el?(r+="\n"+t[e],l=s-i):(0===e&&(r+=" "),r+=t[e],l-=i)}}else{const a=h+n;if(0===t||a>l){if(t>0){if(e.maxLines===o)return r;r+="\n",o++}r+=i,l=s-h}else l-=a,r+=" "+i}}t{this[t.type](t.text,t.options)})},DKTools.Sprite.prototype.drawText=function(t,e={}){if(!this.hasBitmap()||null==t||""===t)return!1;t=String(t),e=e||{};const{pos:i,rect:s,font:n,textColor:r,paintOpacity:o,resetFont:a,resetTextColor:l,resetPaintOpacity:h}=e;let{x:u,y:c,width:p,height:d,align:f}=e;return i instanceof Object&&(u=i.x,c=i.y),s instanceof Object&&(u=s.x,c=s.y,p=s.width,d=s.height),DKTools.Utils.isString(c)&&(c=this.getLineHeight()*parseFloat(c)),DKTools.Utils.isString(d)&&(d=this.getLineHeight()*parseFloat(d)),0!==p&&0!==d&&(u=u||0,c=c||0,p=p||this.standardDrawingWidth(),d=d||this.getLineHeight(),f=f||this.align,n&&this.changeFont(n),r&&this.changeTextColor(r),Number.isFinite(o)&&this.changePaintOpacity(o),this.bitmap.drawText(t,u,c,p,d,f),a&&this.resetFont(),l&&this.resetTextColor(),h&&this.resetPaintOpacity(),!0)},DKTools.Sprite.prototype.findText=function(t){return _.find(this._texts,{id:t})},DKTools.Sprite.prototype._getBitmapHeight=function(){return this._bitmapHeight},DKTools.Sprite.prototype._getBitmapWidth=function(){return this._bitmapWidth},DKTools.Sprite.prototype.getCurrentOpacity=function(){return 255*this.alpha},DKTools.Sprite.prototype.getLocalPoint=function(t,e){const i=DKTools.Base.prototype.getLocalPoint.call(this,t,e),s=this.anchor;return i.x+=this.width*s.x,i.y+=this.height*s.y,i},DKTools.Sprite.prototype.hasFillColor=function(){return!!this._fillColor},DKTools.Sprite.prototype.hasFixedBitmap=function(){return!!this._fixedBitmap},DKTools.Sprite.prototype.hasGraphicFolder=function(){return!!this._graphicFolder},DKTools.Sprite.prototype.hasGraphicName=function(){return!!this._graphicName},DKTools.Sprite.prototype.hasTexts=function(){return this._texts.length>0},DKTools.Sprite.prototype.isResizable=function(){return!this.hasGraphicName()&&!this.hasFixedBitmap()},DKTools.Sprite.prototype._loadGraphic=function(){if(this.hasGraphicFolder()&&this.hasGraphicName()){const t=this._graphicFolder,e=this._graphicName,i=this._graphicLoadListener;this.loadBitmap(t,e,i),this.updateReadyEvents()}},DKTools.Sprite.prototype.loadAnimation=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/animations/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks1/",t,e,i,s)},DKTools.Sprite.prototype.loadBattleback2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/battlebacks2/",t,e,i,s)},DKTools.Sprite.prototype.loadBitmap=function(t,e,i,s,n){if(t instanceof Object)return this.loadBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth);const r=DKTools.Utils.Bitmap.load(t,e,null,s,n);return!!this.setBitmap(r)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.loadCharacter=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/characters/",t,e,i,s)},DKTools.Sprite.prototype.loadEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadFace=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/faces/",t,e,i,s)},DKTools.Sprite.prototype.loadParallax=function(t,e,i,s){return t instanceof Object?this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t.filename,t.listener,t.hue,t.smooth):this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t,e,i,s)},DKTools.Sprite.prototype.loadPicture=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/pictures/",t,e,i,s)},DKTools.Sprite.prototype.loadSvActor=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_actors/",t,e,i,s)},DKTools.Sprite.prototype.loadSvEnemy=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/sv_enemies/",t,e,i,s)},DKTools.Sprite.prototype.loadSystem=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/system/",t,e,i,s)},DKTools.Sprite.prototype.loadTileset=function(t,e,i,s){return t instanceof Object?this.loadBitmap(ImageManager.TILESETS_FOLDER,t.filename,t.listener,t.hue,t.smooth):this.loadBitmap(ImageManager.TILESETS_FOLDER,t,e,i,s)},DKTools.Sprite.prototype.loadTitle1=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles1/",t,e,i,s)},DKTools.Sprite.prototype.loadTitle2=function(t,e,i,s){return t instanceof Object?this.loadBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth):this.loadBitmap("img/titles2/",t,e,i,s)},DKTools.Sprite.prototype.loadWindowskin=function(t,e,i,s){return t instanceof Object?this.loadSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth):this.loadSystem(t||this.standardWindowskin(),e,i,s)},DKTools.Sprite.prototype.moveWithAnchor=function(t,e){t instanceof Object&&(e=t.y),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e));const i=DKTools.Utils.Point.toPoint(t,e),s=this.anchor;this.move(i.x+this.width*s.x,i.y+this.height*s.y)},DKTools.Sprite.prototype.standardAlign=function(){return"center"},DKTools.Sprite.prototype.standardAnchor=function(){return new Point(0,0)},DKTools.Sprite.prototype.standardFillColor=function(){return null},DKTools.Sprite.prototype.standardFont=function(){return{fontFace:this.standardFontFace(),fontItalic:this.standardFontItalic(),fontSize:this.standardFontSize()}},DKTools.Sprite.prototype.standardFontFace=function(){try{return Window_Base.prototype.standardFontFace.call(this)}catch(t){return"GameFont"}},DKTools.Sprite.prototype.standardFontItalic=function(){return!1},DKTools.Sprite.prototype.standardFontSize=function(){try{return Window_Base.prototype.standardFontSize.call(this)}catch(t){return 28}},DKTools.Sprite.prototype.standardFrame=function(){return new Rectangle(0,0,this.width,this.height)},DKTools.Sprite.prototype.standardGraphicFolder=function(){return"img/system/"},DKTools.Sprite.prototype.standardGraphicName=function(){return""},DKTools.Sprite.prototype.standardOpacity=function(){return 255},DKTools.Sprite.prototype.standardPaintOpacity=function(){return 255},DKTools.Sprite.prototype.standardTextColor=function(){return"#ffffff"},DKTools.Sprite.prototype.standardMask=function(){return null},DKTools.Sprite.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t),this.setupBitmap(t),this.setupFrame(t.frame),this.setupAnchor(t.anchor),this.setupAlign(t.align),this.setupFont(t.font),this.setupTextColor(t.textColor),this.setupPaintOpacity(t.paintOpacity),this.setupFillColor(t.fillColor),this.setupOpacity(t.opacity),this.setupGraphicFolder(t.graphicFolder),this.setupGraphicName(t.graphicName)},DKTools.Sprite.prototype.setupAlign=function(t){this._align=t||this.standardAlign()},DKTools.Sprite.prototype.setupAnchor=function(t,e){const i=DKTools.Utils.Point.tryToPoint(t,e),s=Object.assign(this.standardAnchor(),i);this.anchor.copy(s)},DKTools.Sprite.prototype.setupBitmap=function(t){let e=null;t instanceof DKTools.Sprite&&t.hasFixedBitmap()&&t.canCloneFixedBitmap()?e=DKTools.Utils.Bitmap.clone(t.bitmap):t instanceof Object&&(e=DKTools.Utils.Bitmap.load(t.bitmap||t)),e?(this.bitmap=e,this.bitmap.addLoadListener(this.setupSize.bind(this))):this.bitmap=null,this._fixedBitmap=!!this.bitmap},DKTools.Sprite.prototype.setupFillColor=function(t){this._fillColor=null!==t?_.defaultTo(t,this.standardFillColor()):null},DKTools.Sprite.prototype.setupFont=function(t){this._font=Object.assign(this.standardFont(),t)},DKTools.Sprite.prototype.setupFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s),r=Object.assign(this.standardFrame(),n);Sprite.prototype.setFrame.call(this,r.x,r.y,r.width,r.height)},DKTools.Sprite.prototype.setupGraphicFolder=function(t){this._graphicFolder=_.defaultTo(t,this.standardGraphicFolder())},DKTools.Sprite.prototype.setupGraphicLoadListener=function(t){this._graphicLoadListener=t||null},DKTools.Sprite.prototype.setupGraphicName=function(t){this._graphicName=null!==t?_.defaultTo(t,this.standardGraphicName()):null},DKTools.Sprite.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this._bitmapHeight=this._checkHeight(t)},DKTools.Sprite.prototype.setupMask=function(t){this.mask=null!==t?_.defaultTo(t,this.standardMask()):null},DKTools.Sprite.prototype.setupOpacity=function(t){this._opacity=DKTools.Utils.Number.clamp(_.defaultTo(t,this.standardOpacity(),0,255))},DKTools.Sprite.prototype.setupPaintOpacity=function(t){this._paintOpacity=_.defaultTo(t,this.standardPaintOpacity())},DKTools.Sprite.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);this.setupWidth(t),this.setupHeight(e)},DKTools.Sprite.prototype.setupTextColor=function(t){this._textColor=t||this.standardTextColor()},DKTools.Sprite.prototype.setupWidth=function(t){this._bitmapWidth=this._checkWidth(t)},DKTools.Sprite.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setAlign(t.align,!0)&&s++,this.setAnchor(t.anchor)&&s++,this.setFont(t.font,!0)&&s++,this.setTextColor(t.textColor,!0)&&s++,this.setPaintOpacity(t.paintOpacity,!0)&&s++,this.setFillColor(t.fillColor,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setGraphicFolder(t.graphicFolder,!0)&&s++,this.setGraphicName(t.graphicName,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Sprite.prototype.setAlign=function(t,e=!1){if(this._align===t)return!1;const i=this._align;return this.setupAlign(t),this._align!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setAnchor=function(t,e){const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this.anchor,i))return!1;const s=DKTools.Utils.Point.clone(this.anchor);return this.setupAnchor(i),!DKTools.Utils.Point.equals(this.anchor,s)},DKTools.Sprite.prototype.setBitmap=function(t){return this.bitmap!==t&&(this.setupBitmap(t),!0)},DKTools.Sprite.prototype.setFillColor=function(t,e=!1){if(this._fillColor===t)return!1;const i=this._fillColor;return this.setupFillColor(t),this._fillColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setFont=function(t,e=!1){if(_.isEqual(this._font,Object.assign(this.standardFont(),t)))return!1;const i={...this._font};return this.setupFont(t),!_.isEqual(this._font,i)&&(e||this.start(),!0)},DKTools.Sprite.prototype.setFrame=function(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._frame,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._frame);return this.setupFrame(n),!DKTools.Utils.Rectangle.equals(this._frame,r)},DKTools.Sprite.prototype.setGraphicFolder=function(t,e=!1){if(this._graphicFolder===t)return!1;const i=this._graphicFolder;return this.setupGraphicFolder(t),this._graphicFolder!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setGraphicName=function(t,e=!1){if(this._graphicName===t)return!1;const i=this._graphicName;return this.setupGraphicName(t),this._graphicName!==i&&(e||this.start(),!0)},DKTools.Sprite.prototype.setHeight=function(t,e=!1){return this.resize(this._getBitmapWidth(),t,e)},DKTools.Sprite.prototype.setMask=function(t){return this.mask!==t&&(this.setupMask(t),!0)},DKTools.Sprite.prototype.setOpacity=function(t,e=!1){if(this._opacity===t)return!1;const i=this._opacity;return this.setupOpacity(t),this._opacity!==i&&(e||this.updateOpacity(),!0)},DKTools.Sprite.prototype.setPaintOpacity=function(t,e=!1){if(this._paintOpacity===t)return!1;const i=this._paintOpacity;return this.setupPaintOpacity(t),this._paintOpacity!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setTextColor=function(t,e=!1){if(this._textColor===t)return!1;const i=this._textColor;return this.setupTextColor(t),this._textColor!==i&&(e||this.refreshAll(),!0)},DKTools.Sprite.prototype.setWidth=function(t,e=!1){return this.resize(t,this._getBitmapHeight(),e)},DKTools.Sprite.prototype.redrawAll=function(){this.clear(),this.drawAll(),this.updateRedrawAllEvents()},DKTools.Sprite.prototype.removeBitmap=function(){this.hasBitmap()&&this.setBitmap(null)},DKTools.Sprite.prototype.removeFillColor=function(){this.hasFillColor()&&this.setFillColor(null)},DKTools.Sprite.prototype.removeGraphicName=function(){this.hasGraphicName()&&this.setGraphicName(null)},DKTools.Sprite.prototype.removeText=function(t,e=!1){const i=this.findText(t);return i?(DKTools.Utils.Array.remove(this._texts,i),e||this.refreshAll(),i):null},DKTools.Sprite.prototype.reserveAnimation=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/animations/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/animations/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBattleback2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/battlebacks2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/battlebacks2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveBitmap=function(t,e,i,s,n,r){if(t instanceof Object)return this.reserveBitmap(t.folder,t.filename,t.listener,t.hue,t.smooth,t.reservationId);const o=DKTools.Utils.Bitmap.reserve(t,e,null,s,n,r);return!!this.setBitmap(o)&&(DKTools.Utils.isFunction(i)&&this.hasBitmap()&&this.bitmap.addLoadListener(i),!0)},DKTools.Sprite.prototype.reserveCharacter=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/characters/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/characters/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveFace=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/faces/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/faces/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveParallax=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t,e,i,s,n)},DKTools.Sprite.prototype.reservePicture=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/pictures/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/pictures/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvActor=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_actors/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_actors/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSvEnemy=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/sv_enemies/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/sv_enemies/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveSystem=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/system/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/system/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTileset=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap(ImageManager.TILESETS_FOLDER,t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap(ImageManager.TILESETS_FOLDER,t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle1=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles1/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles1/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveTitle2=function(t,e,i,s,n){return t instanceof Object?this.reserveBitmap("img/titles2/",t.filename,t.listener,t.hue,t.smooth,t.reservationId):this.reserveBitmap("img/titles2/",t,e,i,s,n)},DKTools.Sprite.prototype.reserveWindowskin=function(t,e,i,s,n){return t instanceof Object?this.reserveSystem(t.filename||this.standardWindowskin(),t.listener,t.hue,t.smooth,t.reservationId):this.reserveSystem(t||this.standardWindowskin(),e,i,s,n)},DKTools.Sprite.prototype.resetAll=function(){this.resetFont(),this.resetPaintOpacity(),this.resetTextColor()},DKTools.Sprite.prototype.resetFont=function(){this.changeFont(this.font)},DKTools.Sprite.prototype.resetPaintOpacity=function(){this.changePaintOpacity(this.paintOpacity)},DKTools.Sprite.prototype.resetTextColor=function(){this.changeTextColor(this.textColor)},DKTools.Sprite.prototype.resize=function(t,e,i=!1,s=!1){if(!this.isResizable())return!1;if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._bitmapWidth===t&&this._bitmapHeight===e)return!1;const n=this._bitmapWidth,r=this._bitmapHeight;return this.setupSize(t,e),(this._bitmapWidth!==n||this._bitmapHeight!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Sprite.prototype.rotateHue=function(t){return!(!this.hasBitmap()||!t)&&(this.bitmap.rotateHue(t),!0)},DKTools.Sprite.prototype.updateAll=function(){DKTools.Base.prototype.updateAll.call(this),this.updateBitmap()},DKTools.Sprite.prototype.updateBitmap=function(){this.hasBitmap()&&(this.updateFont(),this.updatePaintOpacity(),this.updateTextColor())},DKTools.Sprite.prototype.updateDrawAllEvents=function(){this.updateEventsContainer("draw-all")},DKTools.Sprite.prototype.updateFill=function(){this.hasFillColor()&&this.fillAll(this.fillColor)},DKTools.Sprite.prototype.updateFont=function(t={}){t=t||{},this.bitmap.fontFace=t.fontFace||this.font.fontFace,this.bitmap.fontItalic=!!t.fontItalic,this.bitmap.fontSize=t.fontSize||this.font.fontSize},DKTools.Sprite.prototype.updatePaintOpacity=function(t){Number.isFinite(t)||(t=this.paintOpacity),this.bitmap.paintOpacity=t},DKTools.Sprite.prototype.updateTextColor=function(t){this.bitmap.textColor=t||this.textColor},DKTools.Sprite.prototype.updateOpacity=function(t){Number.isFinite(t)||(t=this.opacity),this.alpha=DKTools.Utils.Number.clamp(t,0,255)/255},DKTools.Sprite.Button=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearMousePressTime()}_clearMousePressTime(){this._mousePressTime=0}isPressed(){return this._mousePressTime>0&&!this.isLongPressed()}isLongPressed(){return this._mousePressTime>=this._longPressInterval}_setupEvents(){DKTools.Sprite.prototype._setupEvents.call(this),this._setupUpdateButtonStateEvent()}_setupOptions(){DKTools.Sprite.prototype._setupOptions.call(this),this._setupProcessMouseOption()}_setupUpdateButtonStateEvent(){this.addEvent({type:"update",onUpdate:this.updateButtonState.bind(this)})}_setupProcessMouseOption(){this.enableOption("process-mouse")}standardActive(){return!1}standardLongPressInterval(){return 18}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupLongPressInterval(t.longPressInterval)}setupLongPressInterval(t){this._longPressInterval=t||this.standardLongPressInterval()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setLongPressInterval(t.longPressInterval)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLongPressInterval(t){if(this._longPressInterval===t)return!1;const e=this._longPressInterval;return this.setupLongPressInterval(t),this._longPressInterval!==e}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processMousePress()}processMousePress(){if(this.isVisible()&&this.isMouseInside()&&(this.isActive()||this.isOptionEnabled("process-mouse-press-ignore-active")))if(TouchInput.isMousePressed()){let t;this._mousePressTime++,TouchInput.isLeftButtonPressed()?t="left":TouchInput.isMiddleButtonPressed()?t="middle":TouchInput.isRightButtonPressed()&&(t="right"),t&&(this.updateMouseDownEvents(t),this.isLongPressed()&&(this._mousePressTime===this._longPressInterval&&this.updateMouseLongPressStartedEvents(t),this.updateMouseLongPressEvents(t)))}else{let t;TouchInput.isLeftButtonReleased()?t="left":TouchInput.isMiddleButtonReleased()?t="middle":TouchInput.isRightButtonReleased()&&(t="right"),t&&(this.isLongPressed()?this.updateMouseLongPressFinishedEvents(t):this.isPressed()&&this.updateMouseClickEvents(t),this._mousePressTime>0&&this.updateMouseUpEvents(t)),this._clearMousePressTime()}else this._clearMousePressTime()}updateMouseDownEvents(t){this.updateEventsContainer("mouse-down-"+t)}updateMouseUpEvents(t){this.updateEventsContainer("mouse-up-"+t)}updateMouseClickEvents(t){this.updateEventsContainer("mouse-click-"+t)}updateMouseLongPressEvents(t){this.updateEventsContainer("mouse-long-press-"+t)}updateMouseLongPressStartedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-started`)}updateMouseLongPressFinishedEvents(t){this.updateEventsContainer(`mouse-long-press-${t}-finished`)}updateStateNormalEvents(){this.updateEventsContainer("state-normal")}updateStatePressedEvents(){this.updateEventsContainer("state-pressed")}updateButtonState(){this._mousePressTime>0?this.updateStatePressedEvents():this.updateStateNormalEvents()}},Object.defineProperties(DKTools.Sprite.Button.prototype,{longPressInterval:{get:function(){return this._longPressInterval},configurable:!0},mousePressTime:{get:function(){return this._mousePressTime},configurable:!0}}),DKTools.Sprite.Cursor=class extends DKTools.Sprite{_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearAnimationCount()}_clearAnimationCount(){this._animationCount=0}_createAll(){DKTools.Sprite.prototype._createAll.call(this),this._createWindowskin()}_createWindowskin(){this._windowskin=ImageManager.loadSystem(this.standardWindowskin())}refreshAll(){DKTools.Sprite.prototype.refreshAll.call(this),this.refreshCursor()}refreshCursor(){const t=this._cursorRect.x,e=this._cursorRect.y,i=this._cursorRect.width,s=this._cursorRect.height,n=this.parent,r=Math.min(i,n.width-t),o=Math.min(s,n.height-e);if(this.move(t,e),i>0&&s>0){const t=this._windowskin,e=new Bitmap(r,o),n=96,a=48;e.blt(t,n+4,n+4,a-8,a-8,4,4,i-8,s-8),e.blt(t,n+4,n,a-8,4,4,0,i-8,4),e.blt(t,n+4,n+a-4,a-8,4,4,0+s-4,i-8,4),e.blt(t,n,n+4,4,a-8,0,4,4,s-8),e.blt(t,n+a-4,n+4,4,a-8,0+i-4,4,4,s-8),e.blt(t,n,n,4,4,0,0,4,4),e.blt(t,n+a-4,n,4,4,0+i-4,0,4,4),e.blt(t,n,n+a-4,4,4,0,0+s-4,4,4),e.blt(t,n+a-4,n+a-4,4,4,0+i-4,0+s-4,4,4),this.setupBitmap(e)}}standardBlinkSpeed(){return 8}standardCursorRect(){return new Rectangle(0,0,0,0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupBlinkSpeed(t.blinkSpeed),this.setupCursorRect(t.cursorRect)}setupBlinkSpeed(t){this._blinkSpeed=_.defaultTo(t,this.standardBlinkSpeed())}setupCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.tryToRectangle(t,e,i,s);this._cursorRect=Object.assign(this.standardCursorRect(),n)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setBlinkSpeed(t.blinkSpeed)&&s++,this.setCursorRect(t.cursorRect)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBlinkSpeed(t){if(this._blinkSpeed===t)return!1;const e=this._blinkSpeed;return this.setupBlinkSpeed(t),this._blinkSpeed!==e}setCursorRect(t,e,i,s){const n=DKTools.Utils.Rectangle.toRectangle(t,e,i,s);if(DKTools.Utils.Rectangle.equals(this._cursorRect,n))return!1;const r=DKTools.Utils.Rectangle.clone(this._cursorRect);return this.setupCursorRect(n),!DKTools.Utils.Rectangle.equals(this._cursorRect,r)&&(this.refreshCursor(),!0)}processAll(){DKTools.Sprite.prototype.processAll.call(this),this.processCursorAnimation()}processCursorAnimation(){const t=this._animationCount%40;let e=this.parent.getCurrentOpacity();this.parent.isVisibleAndActive()&&(this._animationCount++,e-=t<20?t*this._blinkSpeed:(40-t)*this._blinkSpeed),this.setOpacity(e)}},Object.defineProperties(DKTools.Sprite.Cursor.prototype,{cursorRect:{get:function(){return this._cursorRect},configurable:!0},blinkSpeed:{get:function(){return this._blinkSpeed},configurable:!0}}),DKTools.Sprite.Arrow=class extends DKTools.Sprite.Button{static getRect(t){const e=24,i=12;let s,n,r,o;switch(t){case"up":s=132,n=24,r=e,o=i;break;case"down":s=132,n=60,r=e,o=i;break;case"left":s=120,n=36,r=i,o=e;break;case"right":s=156,n=36,r=i,o=e}return DKTools.Utils.Rectangle.tryToRectangle(s,n,r,o)}refreshAll(){DKTools.Sprite.Button.prototype.refreshAll.call(this),this.refreshArrow()}refreshArrow(){this.setFrame(DKTools.Sprite.Arrow.getRect(this._arrowType))}standardVisible(){return!1}standardGraphicName(){return this.standardWindowskin()}standardAnchor(){return new Point(.5,.5)}standardArrowType(){return null}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupArrowType(t.arrowType)}setupArrowType(t){this._arrowType=t||this.standardArrowType()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setArrowType(t.arrowType,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setArrowType(t,e=!1){if(this._arrowType===t)return!1;const i=this._arrowType;return this.setupArrowType(t),this._arrowType!==i&&(e||this.refreshAll(),!0)}},Object.defineProperties(DKTools.Sprite.Arrow.prototype,{arrowType:{get:function(){return this._arrowType},configurable:!0}}),DKTools.Sprite.Selectable=class extends DKTools.Sprite.Button{_addAllChildren(){DKTools.Sprite.Button.prototype._addAllChildren.call(this),this._addCursorSprite()}_addCursorSprite(){this.addChild(this._cursorSprite)}activate(){DKTools.Sprite.Button.prototype.activate.call(this),this.reselect()}addItem(t,e=!1){const i=this.insertItem(t,this.getMaxItems()-1,!0);return e||this.refreshAll(),i}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return e||this.refreshAll(),i}_clearAll(){DKTools.Sprite.Button.prototype._clearAll.call(this),this._clearItems(),this._clearHandlers(),this._clearTopRow(),this._clearTopCol()}_clearItems(){this._items=[]}_clearHandlers(){this._handlers={}}_clearTopRow(){this._topRow=0}_clearTopCol(){this._topCol=0}_createAll(){DKTools.Sprite.Button.prototype._createAll.call(this),this._createCursorSprite()}_createCursorSprite(){this._cursorSprite=new DKTools.Sprite.Cursor}_checkItem(t){return void 0===t.enabled&&(t.enabled=!0),void 0===t.ext&&(t.ext=null),t.symbol&&DKTools.Utils.isFunction(t.handler)&&this.setHandler(t.symbol,t.handler),t}callHandler(t){this.isHandled(t)&&this._handlers[t](this._index,this)}callOkHandler(){const t=this.getCurrentItemSymbol();this.isHandled(t)?this.callHandler(t):this.isHandled("ok")?this.callHandler("ok"):this.activate()}callCancelHandler(){this.callHandler("cancel")}clearItem(t){this.clearRect(this.getItemRect(t))}cursorDown(t=!1){this.hasCursorDownHandler()&&this._cursorDownHandler(t,this)}cursorUp(t=!1){this.hasCursorUpHandler()&&this._cursorUpHandler(t,this)}cursorRight(t=!1){this.hasCursorRightHandler()&&this._cursorRightHandler(t,this)}cursorLeft(t=!1){this.hasCursorLeftHandler()&&this._cursorLeftHandler(t,this)}cursorPageDown(){this.hasCursorPageDownHandler()&&this._cursorPageDownHandler(this)}cursorPageUp(){this.hasCursorPageUpHandler()&&this._cursorPageUpHandler(this)}deactivate(t=!1){DKTools.Sprite.Button.prototype.deactivate.call(this),t&&this.deselect()}deselect(){this.selectItem(-1)}disableItem(t,e=!1){(this.getItem(t)||{}).enabled=!1,e||this.refreshAll()}drawAll(){DKTools.Sprite.Button.prototype.drawAll.call(this),this.drawAllItems()}drawAllItems(){const t=this.getMaxPageItems(),e=this.getMaxItems();let i=this.getTopIndex();for(let s=0;s0?this._index-1:t?this.getMaxItems()-1:-1}getNextIndex(t=!1){return this._index0}hasSymbol(t){return _.includes(this._items,{symbol:t})}hasExt(t){return _.includes(this._items,{ext:t})}hasCursorDownHandler(){return!!this._cursorDownHandler}hasCursorUpHandler(){return!!this._cursorUpHandler}hasCursorRightHandler(){return!!this._cursorRightHandler}hasCursorLeftHandler(){return!!this._cursorLeftHandler}hasCursorPageDownHandler(){return!!this._cursorPageDownHandler}hasCursorPageUpHandler(){return!!this._cursorPageUpHandler}hasDrawItemHandler(){return!!this._itemDrawHandler}hideCursor(){this._cursorSprite.hide()}hitTest(t,e){if(this.isOutside(t,e))return-1;const i=this.scale,s=this.getLocalPoint(t,e),n=this.getMaxPageItems(),r=this.getMaxItems();let o=this.getTopIndex();for(let t=0;tthis.insertItem(t,e+i,!0));return i||this.refreshAll(),s}isCursorFixed(){return this._cursorFixed}isCursorAll(){return this._cursorAll}isFixedHorizontal(){return this._fixedHorizontal}isHorizontal(){return this.isFixedHorizontal()||1===this.getMaxPageRows()}isVertical(){return!this.isHorizontal()}isCursorMovable(){return this.isVisibleAndActive()&&!this.isCursorFixed()&&!this.isCursorAll()&&this.hasItems()}isOkEnabled(){return!0}isCancelEnabled(){return this.isHandled("cancel")}isOkTriggered(){return Input.isRepeated("ok")}isCancelTriggered(){return Input.isRepeated("cancel")||TouchInput.isCancelled()}isCursorVisible(){if(!this._cursorSprite.isVisible())return!1;if(this.isHorizontal()){const t=this.getCurrentCol();return t>=this.getTopCol()&&t<=this.getBottomCol()}const t=this.getCurrentRow();return t>=this.getTopRow()&&t<=this.getBottomRow()}isItemEnabled(t){const e=(this.getItem(t)||{}).enabled;return DKTools.Utils.isFunction(e)?e(t,this):e}isCurrentItemEnabled(){return this.isItemEnabled(this._index)}isItemVisible(t){return DKTools.Utils.Number.inRange(t,this.getTopIndex(),this.getBottomIndex()+1)}isItemSelected(t){return this._index===t}isHandled(t){return!!this._handlers[t]}isItemHandled(t){const e=this.getItem(t)||{};return this.isHandled(e.symbol)||DKTools.Utils.isFunction(e.okHandler)}isCurrentItemHandled(){return this.isItemHandled(this._index)}_onTouch(t=!1){const e=this._index,i=TouchInput.x,s=TouchInput.y,n=this.hitTest(i,s);n>=0&&(this._index===n?t&&this.isOkEnabled()&&this.processOk():this.isCursorMovable()&&this.selectItem(n)),this._index!==e&&this.playCursorSound()}playOkSound(){SoundManager.playOk()}playCancelSound(){SoundManager.playCancel()}playCursorSound(){SoundManager.playCursor()}playBuzzerSound(){SoundManager.playBuzzer()}processAll(){DKTools.Sprite.Button.prototype.processAll.call(this),this.processCursorMove(),this.processHandling()}processCursorMove(){if(!this.isCursorMovable())return;const t=this._index;Input.isRepeated("down")&&this.cursorDown(Input.isTriggered("down")),Input.isRepeated("up")&&this.cursorUp(Input.isTriggered("up")),Input.isRepeated("right")&&this.cursorRight(Input.isTriggered("right")),Input.isRepeated("left")&&this.cursorLeft(Input.isTriggered("left")),Input.isTriggered("pagedown")&&this.cursorPageDown(),Input.isTriggered("pageup")&&this.cursorPageUp(),this._index!==t&&this.playCursorSound()}processHandling(){this.isVisibleAndActive()&&(this.isOkEnabled()&&this.isOkTriggered()?this.processOk():this.isCancelEnabled()&&this.isCancelTriggered()&&this.processCancel())}processMouseHover(){if(this.isOptionEnabled("process-mouse-hover")&&this.isCursorMovable()&&TouchInput.date>Input.date){const t=this._index,e=TouchInput.mouseX,i=TouchInput.mouseY,s=this.hitTest(e,i);s>=0&&s!==t&&this.selectItem(s,!0)}}processWheelScroll(){if(this.isOptionEnabled("process-wheel-scroll")&&this.isVisibleAndActive()){this._wheelY>0?this.isHorizontal()?this.scrollRight():this.scrollDown():this.isHorizontal()?this.scrollLeft():this.scrollUp()}}processOk(){if(this.isCurrentItemEnabled()){this.playOkSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem()||{};DKTools.Utils.isFunction(t.okHandler)?t.okHandler(this._index,this):this.callOkHandler()}else this.playBuzzerSound()}processCancel(){this.playCancelSound(),this.updateInputData(),this.deactivate();const t=this.getCurrentItem();t&&DKTools.Utils.isFunction(t.cancelHandler)?t.cancelHandler(this._index,this):this.callCancelHandler()}redrawItem(t){this.isItemVisible(t)&&(this.clearItem(t),this.drawItem(t))}redrawCurrentItem(){this.redrawItem(this._index)}removeHandler(t){delete this._handlers[t]}removeItem(t,e=!1){const i=this.getItem(t);return i?(DKTools.Utils.Array.remove(this._items,i),e||this.refreshAll(),i):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return e||this.refreshAll(),i}replaceItem(t,e,i=!1){const s=this._checkItem(t);e=e||0;const n=this._items[e];return this._items[e]=s,i||this.refreshAll(),n}reselect(){this.selectItem(this._index)}resetScroll(){0!==this._index&&this.selectItem(0)}_setupEvents(){DKTools.Sprite.Button.prototype._setupEvents.call(this),this._setupMouseClickEvent(),this._setupMouseLongPressEvent(),this._setupMouseHoverEvents(),this._setupWheelScrollEvents()}_setupMouseClickEvent(){this.addEvent({type:"mouse-click-left",onUpdate:this._onTouch.bind(this,!0)})}_setupMouseLongPressEvent(){this.addEvent({type:"mouse-long-press-left",onUpdate:this._onTouch.bind(this,!1)})}_setupMouseHoverEvents(){this.addEvent({type:"mouse-enter",onUpdate:this.processMouseHover.bind(this)}),this.addEvent({type:"mouse-move",onUpdate:this.processMouseHover.bind(this)})}_setupWheelScrollEvents(){this.addEvent({type:"wheel-Y-inside",onUpdate:this.processWheelScroll.bind(this)}),this.addEvent({type:"wheel-Y-outside",onUpdate:this.processWheelScroll.bind(this)})}standardIndex(){return 0}standardMaxCols(){return 1}standardCursorFixed(){return!1}standardCursorAll(){return!1}standardFixedHorizontal(){return!1}standardHorizontalSpacing(){return 0}standardVerticalSpacing(){return 0}standardTextPadding(){return 6}standardCursorDownHandler(){return t=>{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e{if(this.isHorizontal())return;const e=this._index,i=this.getMaxItems(),s=this.getMaxCols();(e>=s||t&&i===this.getMaxRows()*s)&&this.selectItem((e-s+i)%i)}}standardCursorRightHandler(){return t=>{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i{const e=this.getMaxItems();if(!(e<2))if(this.isVertical()){const i=this._index;this.getMaxCols()>=2&&(i>0||t)&&this.selectItem((i-1+e)%e)}else this.selectPrevItem(t)}}standardCursorPageDownHandler(){return()=>{if(this.isHorizontal()){const t=this.getTopCol(),e=this.getMaxPageCols(),i=this.getMaxItems();t+e{if(this.isHorizontal()){const t=this.getTopCol();t>0&&(this.setTopCol(t-this.getMaxPageCols()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}else{const t=this.getTopRow();t>0&&(this.setTopRow(t-this.getMaxPageRows()),this.selectItem(Math.max(0,this._index-this.getMaxPageItems())))}}}standardItems(){return[]}standardItemDrawHandler(){return t=>{const e=this.getItemName(t),i=this.getItemFont(t),s=this.getItemTextColor(t),n=this.getItemPaintOpacity(t),r=this.getItemAlign(t),o=this.getItemRectForText(t);this.drawText(e,{font:i,textColor:s,paintOpacity:n,align:r,rect:o,resetFont:!0,resetTextColor:!0,resetPaintOpacity:!0})}}standardItemWidth(){return()=>Math.floor((this.width+this._horizontalSpacing)/this.getMaxCols()-this._horizontalSpacing)}standardItemHeight(){return this.getLineHeight()}standardItemRect(){return t=>{const e=new Rectangle(0,0,this.getItemWidth(),this.getItemHeight()),i=this.getMaxCols();return this.isHorizontal()?(e.x=(t-this.getTopCol())*(e.width+this._horizontalSpacing),e.y=0):(e.x=t%i*(e.width+this._horizontalSpacing),e.y=(Math.floor(t/i)-this.getTopRow())*(e.height+this._verticalSpacing)),e}}standardItemFont(){return()=>this.font}standardItemTextColor(){return()=>this.textColor}standardItemPaintOpacity(){return t=>this.isItemEnabled(t)?this.standardEnabledItemPaintOpacity():this.standardDisabledItemPaintOpacity()}standardEnabledItemPaintOpacity(){return 255}standardDisabledItemPaintOpacity(){try{return Window_Base.prototype.translucentOpacity.call(this)}catch(t){return 160}}standardItemAlign(){return this.align}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupIndex(t.index),this.setupMaxCols(t.maxCols),this.setupFixedHorizontal(t.fixedHorizontal),this.setupCursorFixed(t.cursorFixed),this.setupCursorAll(t.cursorAll),this.setupCursorDownHandler(t.cursorDownHandler),this.setupCursorUpHandler(t.cursorUpHandler),this.setupCursorRightHandler(t.cursorRightHandler),this.setupCursorLeftHandler(t.cursorLeftHandler),this.setupCursorPageDownHandler(t.cursorPageDownHandler),this.setupCursorPageUpHandler(t.cursorPageUpHandler),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupTextPadding(t.textPadding),this.setupItems(t.items),this.setupItemDrawHandler(t.drawItemHandler),this.setupItemWidth(t.itemWidth),this.setupItemHeight(t.itemHeight),this.setupItemRect(t.itemRect),this.setupItemFont(t.itemFont),this.setupItemTextColor(t.itemTextColor),this.setupItemPaintOpacity(t.itemPaintOpacity),this.setupItemAlign(t.itemAlign)}setupIndex(t){this._lastIndex=this._index,this._index=_.defaultTo(t,this.standardIndex())}setupMaxCols(t){this._maxCols=t||this.standardMaxCols()}setupFixedHorizontal(t){this._fixedHorizontal=_.defaultTo(t,this.standardFixedHorizontal())}setupCursorFixed(t){this._cursorFixed=_.defaultTo(t,this.standardCursorFixed())}setupCursorAll(t){this._cursorAll=_.defaultTo(t,this.standardCursorAll())}setupCursorDownHandler(t){this._cursorDownHandler=t||this.standardCursorDownHandler()}setupCursorUpHandler(t){this._cursorUpHandler=t||this.standardCursorUpHandler()}setupCursorRightHandler(t){this._cursorRightHandler=t||this.standardCursorRightHandler()}setupCursorLeftHandler(t){this._cursorLeftHandler=t||this.standardCursorLeftHandler()}setupCursorPageDownHandler(t){this._cursorPageDownHandler=t||this.standardCursorPageDownHandler()}setupCursorPageUpHandler(t){this._cursorPageUpHandler=t||this.standardCursorPageUpHandler()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupTextPadding(t){this._textPadding=_.defaultTo(t,this.standardTextPadding())}setupItems(t){this._items=_.map(t||this.standardItems(),t=>this._checkItem(t))}setupItemDrawHandler(t){this._itemDrawHandler=t||this.standardItemDrawHandler()}setupItemWidth(t){this._itemWidth=t||this.standardItemWidth()}setupItemHeight(t){this._itemHeight=t||this.standardItemHeight()}setupItemRect(t){this._itemRect=t||this.standardItemRect()}setupItemFont(t){this._itemFont=t||this.standardItemFont()}setupItemTextColor(t){this._itemTextColor=t||this.standardItemTextColor()}setupItemPaintOpacity(t){this._itemPaintOpacity=t||this.standardItemPaintOpacity()}setupItemAlign(t){this._itemAlign=t||this.standardItemAlign()}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setIndex(t.index,!0)&&s++,this.setMaxCols(t.maxCols,!0)&&s++,this.setFixedHorizontal(t.fixedHorizontal,!0)&&s++,this.setCursorFixed(t.cursorFixed,!0)&&s++,this.setCursorAll(t.cursorAll,!0)&&s++,this.setCursorDownHandler(t.cursorDownHandler,!0)&&s++,this.setCursorUpHandler(t.cursorUpHandler,!0)&&s++,this.setCursorRightHandler(t.cursorRightHandler,!0)&&s++,this.setCursorLeftHandler(t.cursorLeftHandler,!0)&&s++,this.setCursorPageDownHandler(t.cursorPageDownHandler,!0)&&s++,this.setCursorPageUpHandler(t.cursorPageUpHandler,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setTextPadding(t.textPadding,!0)&&s++,this.setItems(t.items,!0)&&s++,this.setItemDrawHandler(t.drawItemHandler,!0)&&s++,this.setItemWidth(t.itemWidth,!0)&&s++,this.setItemHeight(t.itemHeight,!0)&&s++,this.setItemRect(t.itemRect,!0)&&s++,this.setItemFont(t.itemFont,!0)&&s++,this.setItemTextColor(t.itemTextColor,!0)&&s++,this.setItemPaintOpacity(t.itemPaintOpacity,!0)&&s++,this.setItemAlign(t.itemAlign,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setIndex(t,e=!1){return this._index!==t&&(this.setupIndex(t),this._index!==this._lastIndex&&(e||this.refreshAll(),!0))}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.refreshAll(),!0)}setFixedHorizontal(t,e=!1){if(this._fixedHorizontal===t)return!1;const i=this._fixedHorizontal;return this.setupFixedHorizontal(t),this._fixedHorizontal!==i&&(e||this.refreshAll(),!0)}setCursorFixed(t,e=!1){if(this._cursorFixed===t)return!1;const i=this._cursorFixed;return this.setupCursorFixed(t),this._cursorFixed!==i&&(e||this.refreshAll(),!0)}setCursorAll(t,e=!1){if(this._cursorAll===t)return!1;const i=this._cursorAll;return this.setupCursorAll(t),this._cursorAll!==i&&(e||this.refreshAll(),!0)}setCursorDownHandler(t,e=!1){if(this._cursorDownHandler===t)return!1;const i=this._cursorDownHandler;return this.setupCursorDownHandler(t),this._cursorDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorUpHandler(t,e=!1){if(this._cursorUpHandler===t)return!1;const i=this._cursorUpHandler;return this.setupCursorUpHandler(t),this._cursorUpHandler!==i&&(e||this.refreshAll(),!0)}setCursorRightHandler(t,e=!1){if(this._cursorRightHandler===t)return!1;const i=this._cursorRightHandler;return this.setupCursorRightHandler(t),this._cursorRightHandler!==i&&(e||this.refreshAll(),!0)}setCursorLeftHandler(t,e=!1){if(this._cursorLeftHandler===t)return!1;const i=this._cursorLeftHandler;return this.setupCursorLeftHandler(t),this._cursorLeftHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageDownHandler(t,e=!1){if(this._cursorPageDownHandler===t)return!1;const i=this._cursorPageDownHandler;return this.setupCursorPageDownHandler(t),this._cursorPageDownHandler!==i&&(e||this.refreshAll(),!0)}setCursorPageUpHandler(t,e=!1){if(this._cursorPageUpHandler===t)return!1;const i=this._cursorPageUpHandler;return this.setupCursorPageUpHandler(t),this._cursorPageUpHandler!==i&&(e||this.refreshAll(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.refreshAll(),!0)}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.refreshAll(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.refreshAll(),s}setTextPadding(t,e=!1){if(this._textPadding===t)return!1;const i=this._textPadding;return this.setupTextPadding(t),this._textPadding!==i&&(e||this.refreshAll(),!0)}setItems(t,e=!1){return this._items!=t&&(this.setupItems(t),e||this.refreshAll(),!0)}setItemDrawHandler(t,e=!1){if(this._itemDrawHandler===t)return!1;const i=this._itemDrawHandler;return this.setupItemDrawHandler(t),this._itemDrawHandler!==i&&(e||this.refreshAll(),!0)}setItemWidth(t,e=!1){if(this._itemWidth===t)return!1;const i=this._itemWidth;return this.setupItemWidth(t),this._itemWidth!==i&&(e||this.refreshAll(),!0)}setItemHeight(t,e=!1){if(this._itemHeight===t)return!1;const i=this._itemHeight;return this.setupItemHeight(t),this._itemHeight!==i&&(e||this.refreshAll(),!0)}setItemFont(t,e=!1){if(this._itemFont===t)return!1;const i=this._itemFont;return this.setupItemFont(t),this._itemFont!==i&&(e||this.refreshAll(),!0)}setItemTextColor(t,e=!1){if(this._itemTextColor===t)return!1;const i=this._itemTextColor;return this.setupItemTextColor(t),this._itemTextColor!==i&&(e||this.refreshAll(),!0)}setItemPaintOpacity(t,e=!1){if(this._itemPaintOpacity===t)return!1;const i=this._itemPaintOpacity;return this.setupItemPaintOpacity(t),this._itemPaintOpacity!==i&&(e||this.refreshAll(),!0)}setItemAlign(t,e=!1){if(this._itemAlign===t)return!1;const i=this._itemAlign;return this.setupItemAlign(t),this._itemAlign!==i&&(e||this.refreshAll(),!0)}setTopRow(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopRow());this._topRow!==i&&(this._topRow=i,e||this.refreshAll())}setTopCol(t,e=!1){const i=DKTools.Utils.Number.clamp(t,0,this.getMaxTopCol());this._topCol!==i&&(this._topCol=i,e||this.refreshAll())}setBottomRow(t,e=!1){this.setTopRow(t-(this.getMaxPageRows()-1),e)}setBottomCol(t,e=!1){this.setTopCol(t-(this.getMaxPageCols()-1),e)}setHandler(t,e){this._handlers[t]=e}setCursorRect(t,e,i,s){return this._cursorSprite.setCursorRect(t,e,i,s)}showCursor(){this._cursorSprite.show(!0)}selectItem(t,e=!1){const i=this.getItem(t);this.setupIndex(t),this.refreshAll(),e&&this.playCursorSound(),i&&DKTools.Utils.isFunction(i.selectHandler)&&i.selectHandler(t,this),this.updateSelectEvents()}selectSymbol(t){const e=Math.max(0,this.findSymbol(t));this.selectItem(e)}selectExt(t){const e=Math.max(0,this.findExt(t));this.selectItem(e)}selectPrevItem(t=!1,e=!1){const i=this.getPrevIndex(t);i>=0&&this.selectItem(i,e)}selectNextItem(t=!1,e=!1){const i=this.getNextIndex(t);i>=0&&this.selectItem(i,e)}selectLastItem(t=!1){this.selectItem(this.getMaxItems()-1,t)}scrollDown(){this.getTopRow()+10&&this.cursorUp()}scrollRight(){this.getTopCol()+10&&this.cursorLeft()}updateAll(){DKTools.Sprite.Button.prototype.updateAll.call(this),this.updateCursor()}updateCursor(){if(this.isHorizontal()){const t=this.getCurrentCol();tthis.getBottomCol()&&this.setBottomCol(t)}else{const t=this.getCurrentRow();tthis.getBottomRow()&&this.setBottomRow(t)}if(this.isCursorAll()){const t=this.getMaxRows()*this.getItemHeight();this.setCursorRect(0,0,this.width,t),this.resetScroll()}else if(this.isCursorVisible()||!this._cursorSprite.hasBitmap()){const t=this.getItemRect(this._index);this.setCursorRect(t)}else this.setCursorRect(Rectangle.emptyRectangle)}updateSelectEvents(){this.updateEventsContainer("select")}},Object.defineProperties(DKTools.Sprite.Selectable.prototype,{cursorSprite:{get:function(){return this._cursorSprite},configurable:!0},lastIndex:{get:function(){return this._lastIndex},configurable:!0},index:{get:function(){return this._index},configurable:!0},maxCols:{get:function(){return this._maxCols},configurable:!0},cursorFixed:{get:function(){return this._cursorFixed},configurable:!0},cursorAll:{get:function(){return this._cursorAll},configurable:!0},cursorDownHandler:{get:function(){return this._cursorDownHandler},configurable:!0},cursorUpHandler:{get:function(){return this._cursorUpHandler},configurable:!0},cursorRightHandler:{get:function(){return this._cursorRightHandler},configurable:!0},cursorLeftHandler:{get:function(){return this._cursorLeftHandler},configurable:!0},cursorPageDownHandler:{get:function(){return this._cursorPageDownHandler},configurable:!0},cursorPageUpHandler:{get:function(){return this._cursorPageUpHandler},configurable:!0},horizontalSpacing:{get:function(){return this._horizontalSpacing},configurable:!0},verticalSpacing:{get:function(){return this._verticalSpacing},configurable:!0},textPadding:{get:function(){return this._textPadding},configurable:!0},items:{get:function(){return this._items},configurable:!0},itemDrawHandler:{get:function(){return this._itemDrawHandler},configurable:!0},itemWidth:{get:function(){return this._itemWidth},configurable:!0},itemHeight:{get:function(){return this._itemHeight},configurable:!0},itemFont:{get:function(){return this._itemFont},configurable:!0},itemTextColor:{get:function(){return this._itemTextColor},configurable:!0},itemPaintOpacity:{get:function(){return this._itemPaintOpacity},configurable:!0},itemAlign:{get:function(){return this._itemAlign},configurable:!0}}),DKTools.Sprite.ProgressBar=class extends DKTools.Sprite{addValue(t){t&&this.setValue(this._value+t)}aimateFull(t){return this.animateValue(this._maxValue,t)}animateEmpty(t){return this.animateValue(0,t)}animateValue(t,e){return this.addEvent({type:"update",repeatTime:e,repeats:0,onUpdate:this._updateAnimateValue.bind(this,t)})}canCloneFixedBitmap(){return!1}_drawProgressGraphic(){this.hasDrawGraphicHandler()&&this._drawGraphicHandler(this)}_drawProgressText(){this.hasDrawTextHandler()&&this._drawTextHandler(this)}drawAll(){DKTools.Sprite.prototype.drawAll.call(this),this.drawProgress()}drawProgress(){this._drawProgressGraphic(),this._drawProgressText()}getNextValue(){return Math.min(this._value+this._valueStep,this._maxValue)}getPercents(){return Math.ceil(this._value/this._maxValue*100)}getPrevValue(){return Math.max(0,this._value-this._valueStep)}hasDrawGraphicHandler(){return!!this._drawGraphicHandler}hasDrawTextHandler(){return!!this._drawTextHandler}isEmpty(){return 0===this._value}isFull(){return this._value===this._maxValue}isHorizontal(){return this.width>this.height}isVertical(){return!this.isHorizontal()}makeEmpty(){this.setValue(0)}makeFull(){this.setValue(this._maxValue)}nextValue(){return this.setValue(this.getNextValue())}prevValue(){return this.setValue(this.getPrevValue())}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setValueStep(t.valueStep,!0)&&s++,this.setMaxValue(t.maxValue,!0)&&s++,this.setValue(t.value,!0)&&s++,this.setBackgroundColor(t.backgroundColor,!0)&&s++,this.setProgressColor(t.progressColor,!0)&&s++,this.setDrawGraphicHandler(t.drawGraphicHandler,!0)&&s++,this.setDrawTextHandler(t.drawTextHandler,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setBackgroundColor(t,e=!1){if(this._backgroundColor===t)return!1;const i=this._backgroundColor;return this.setupBackgroundColor(t),this._backgroundColor!==i&&(e||this.refreshAll(),!0)}setDrawGraphicHandler(t,e=!1){return this._drawGraphicHandler!==t&&(this.setupDrawGraphicHandler(t),e||this.refreshAll(),!0)}setDrawTextHandler(t,e=!1){return this._drawTextHandler!==t&&(this.setupDrawTextHandler(t),e||this.refreshAll(),!0)}setMaxValue(t,e=!1){if(this._maxValue===t)return!1;const i=this._maxValue;return this.setupMaxValue(t),this._maxValue!==i&&(e||this.refreshAll(),!0)}setProgressColor(t,e=!1){if(this._progressColor===t)return!1;const i=this._progressColor;return this.setupProgressColor(t),this._progressColor!==i&&(e||this.refreshAll(),!0)}setValue(t,e=!1){if(this._value===t)return!1;const i=this._value;return this.setupValue(t),this._value!==i&&(e||this.refreshAll(),this.updateValueEvents(),!0)}setValueStep(t,e=!1){if(this._valueStep===t)return!1;const i=this._valueStep;return this.setupValueStep(t),this._valueStep!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupValueStep(t.valueStep),this.setupMaxValue(t.maxValue),this.setupValue(t.value),this.setupBackgroundColor(t.progressColor),this.setupProgressColor(t.progressColor),this.setupDrawGraphicHandler(t.drawGraphicHandler),this.setupDrawTextHandler(t.drawTextHandler)}setupBackgroundColor(t){this._backgroundColor=t||this.standardBackgroundColor()}setupDrawGraphicHandler(t){this._drawGraphicHandler=t||this.standardDrawGraphicHandler()}setupDrawTextHandler(t){this._drawTextHandler=t||this.standardDrawTextHandler()}setupMaxValue(t){this._maxValue=t||this.standardMaxValue()}setupProgressColor(t){this._progressColor=t||this.standardProgressColor()}setupValue(t){const e=this._maxValue,i=Math.max(0,Math.min(t,e));this._value=_.defaultTo(i,this.standardValue())}setupValueStep(t){this._valueStep=t||this.standardValueStep()}standardActive(){return!1}standardBackgroundColor(){return"grey"}standardDrawGraphicHandler(){return null}standardDrawTextHandler(){return null}standardMaxValue(){return 100}standardProgressColor(){return"#33ccff"}standardValue(){return 0}standardValueStep(){return 1}subValue(t){this.addValue(-t)}_updateAnimateValue(t,e){const i=e.remainingTime,s=(this._value*(i-1)+t)/i;this.setValue(s)}updateEmptyEvents(){this.isEmpty()&&this.updateEventsContainer("empty")}updateEvents(){DKTools.Sprite.prototype.updateEvents.call(this),this.updateEmptyEvents(),this.updateFullEvents()}updateFullEvents(){this.isFull()&&this.updateEventsContainer("full")}updateValueEvents(){this.updateEventsContainer("value")}},Object.defineProperties(DKTools.Sprite.ProgressBar.prototype,{valueStep:{get:function(){return this._valueStep},configurable:!0},maxValue:{get:function(){return this._maxValue},configurable:!0},value:{get:function(){return this._value},configurable:!0},backgroundColor:{get:function(){return this._backgroundColor},configurable:!0},progressColor:{get:function(){return this._progressColor},configurable:!0},drawGraphicHandler:{get:function(){return this._drawGraphicHandler},configurable:!0},drawTextHandler:{get:function(){return this._drawTextHandler},configurable:!0}}),DKTools.Sprite.ProgressBar.Rectangle=class extends DKTools.Sprite.ProgressBar{standardDrawGraphicHandler(){return()=>{let t=this.standardVerticalDrawGraphicHandler();this.isHorizontal()&&(t=this.standardHorizontalDrawGraphicHandler()),DKTools.Utils.isFunction(t)&&t(this)}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardHorizontalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue})}}standardVerticalDrawGraphicHandler(){return()=>{this.drawGauge({backgroundColor:this._backgroundColor,color:this._progressColor,rate:this._value/this._maxValue,type:"vertical",reversed:!0})}}},DKTools.Sprite.ProgressBar.Circle=class extends DKTools.Sprite.ProgressBar{setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.ProgressBar.prototype.setAll.call(this,t,!0);return this.setLineWidth(t.lineWidth,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setLineWidth(t,e=!1){if(this._lineWidth===t)return!1;const i=this._lineWidth;return this.setupLineWidth(t),this._lineWidth!==i&&(e||this.refreshAll(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.ProgressBar.prototype.setupAll.call(this,t),this.setupLineWidth(t.lineWidth)}setupLineWidth(t){this._lineWidth=t||this.standardLineWidth()}standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,s=i;this.strokeArc({x:i,y:s,radius:e,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:-Math.PI/2,endAngle:-Math.PI/2+2*Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}standardDrawTextHandler(){return()=>{const t=`${this.getPercents()}%`;this.drawText(t,{height:this.height})}}standardLineWidth(){return 10}},Object.defineProperties(DKTools.Sprite.ProgressBar.Circle.prototype,{lineWidth:{get:function(){return this._lineWidth},configurable:!0}}),DKTools.Sprite.ProgressBar.SemiCircle=class extends DKTools.Sprite.ProgressBar.Circle{standardDrawGraphicHandler(){return()=>{const t=this._lineWidth,e=(this.width-t)/2,i=e+t/2,s=this.height;this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,color:this._backgroundColor,lineWidth:t}),this.strokeArc({x:i,y:s,radius:e,startAngle:Math.PI,endAngle:-Math.PI+Math.PI*this._value/this._maxValue,color:this._progressColor,lineWidth:t})}}},DKTools.Sprite.CheckBox=class extends DKTools.Sprite.Button{check(){this.isChecked()||(this.switch(),this.updateCheckedEvents())}isChecked(){return this._checked}_refreshCheckedGraphic(){let t=null;DKTools.Utils.isString(this._checkedGraphic)?t={folder:this._graphicFolder,filename:this._checkedGraphic}:this._checkedGraphic instanceof Object&&(t=this._checkedGraphic),t&&this.loadBitmap(t)}_refreshGraphic(){this.isChecked()?this._refreshCheckedGraphic():this._refreshUncheckedGraphic()}_refreshUncheckedGraphic(){let t=null;DKTools.Utils.isString(this._uncheckedGraphic)?t={folder:this._graphicFolder,filename:this._uncheckedGraphic}:this._uncheckedGraphic instanceof Object&&(t=this._uncheckedGraphic),t&&this.loadBitmap(t)}refreshAll(){this._refreshGraphic(),DKTools.Sprite.Button.prototype.refreshAll.call(this)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.Button.prototype.setAll.call(this,t,!0);return this.setChecked(t.checked,!0)&&s++,this.setCheckedGraphic(t.checkedGraphic,!0)&&s++,this.setUncheckedGraphic(t.uncheckedGraphic,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setChecked(t,e=!1){if(this._checked===t)return!1;const i=this._checked;return this.setupChecked(t),this._checked!==i&&(e||this.refreshAll(),!0)}setCheckedGraphic(t,e=!1){const i=this._checkedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupCheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupCheckedGraphic(t),_.isEqual(this._checkedGraphic,e))return!1}}return e||this.refreshAll(),!0}setUncheckedGraphic(t,e=!1){const i=this._uncheckedGraphic;if(i==t)return!1;if(i instanceof Bitmap)this.setupUncheckedGraphic(t);else{if(!(DKTools.Utils.isString(i)||i instanceof Object))return!1;{const e=i;if(this.setupUncheckedGraphic(t),_.isEqual(this._uncheckedGraphic,e))return!1}}return e||this.refreshAll(),!0}setupAll(t={}){t=t||{},DKTools.Sprite.Button.prototype.setupAll.call(this,t),this.setupChecked(t.checked),this.setupCheckedGraphic(t.checkedGraphic),this.setupUncheckedGraphic(t.uncheckedGraphic)}setupChecked(t){this._checked=_.defaultTo(t,this.standardChecked())}setupCheckedGraphic(t){this._checkedGraphic=t||this.standardCheckedGraphic()}setupUncheckedGraphic(t){this._uncheckedGraphic=t||this.standardUncheckedGraphic()}standardChecked(){return!1}standardCheckedGraphic(){return null}standardUncheckedGraphic(){return null}switch(){this.setChecked(!this.isChecked())}uncheck(){this.isChecked()&&(this.switch(),this.updateUncheckedEvents())}updateCheckedEvents(){this.updateEventsContainer("checked")}updateMouseClickEvents(t){this.switch(),DKTools.Sprite.Button.prototype.updateMouseClickEvents.call(this,t)}updateUncheckedEvents(){this.updateEventsContainer("unchecked")}},Object.defineProperties(DKTools.Sprite.CheckBox.prototype,{checked:{get:function(){return this._checked},configurable:!0},checkedGraphic:{get:function(){return this._checkedGraphic},configurable:!0},uncheckedGraphic:{get:function(){return this._uncheckedGraphic},configurable:!0}}),DKTools.Viewport=class extends DKTools.Sprite{canCloneFixedBitmap(){return!1}createAll(){DKTools.Sprite.prototype.createAll.call(this),this.createMask()}createMask(){DKTools.Sprite.prototype.createMask.call(this,this._maskShape)}setAll(t={},e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaskShape(t.maskShape,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setMaskShape(t,e=!1){if(this._maskShape===t)return!1;const i=this._maskShape;return this.setupShape(t),this._maskShape!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaskShape(t.maskShape)}setupMaskShape(t){this._maskShape=t||this.standardMaskShape()}standardMaskShape(){return"rect"}},Object.defineProperties(DKTools.Viewport.prototype,{maskShape:{get:function(){return this._maskShape},configurable:!0}}),DKTools.Layout=class extends DKTools.Sprite{activateItems(t=!1){this.iterateItems(t=>{t.activate()},t)}addAllChildren(){DKTools.Sprite.prototype.addAllChildren.call(this),this.addAllItems()}addAllItems(){this.hasItems()&&this.addChild.apply(this,this._items)}addCol(){this.addCols(1)}addCols(t){this.setMaxCols(this.getMaxCols()+t)}addItem(t,e=!1){return t instanceof DKTools.Sprite?(this._items.push(t),e||this.start(),t):null}addItems(t,e=!1){const i=_.map(t,t=>this.addItem(t,!0));return i.length>0&&!e&&this.start(),i}alignCol(t){_.forEach(this.getItemsInCol(t),this.alignItem.bind(this))}alignItem(t){if(this.isReady()){const e=this.getItemRow(t),i=this.getItemCol(t),s=this.getRowHeight(e),n=this.getColWidth(i),r=this.getColX(i)+(n-t.width)/2,o=this.getRowY(e)+(s-t.height)/2;t.move(r,o)}else this.addOneTimeEvent({type:"ready",onSuccess:this.alignItem.bind(this,t)})}alignItems(){this.addOneTimeEvent({type:"ready",onSuccess:()=>{this.iterateItems(this.alignItem.bind(this))}})}alignRow(t){_.forEach(this.getItemsInRow(t),this.alignItem.bind(this))}_clearAll(){DKTools.Sprite.prototype._clearAll.call(this),this._clearItems()}_clearItems(){this._items=[]}canCloneFixedBitmap(){return!1}clearItems(t=!1){this.removeAllItems(),this._clearItems(),t||this.start()}deactivateItems(t=!1){this.iterateItems(t=>{t.deactivate()},t)}_getBitmapHeight(){let t=0;const e=this.getMaxRows();for(let i=1;i<=e;i++)t+=this.getRowHeight(i)+this._verticalSpacing;return t-this._verticalSpacing}_getBitmapWidth(){let t=0;const e=this.getMaxCols();for(let i=1;i<=e;i++)t+=this.getColWidth(i)+this._horizontalSpacing;return t-this._horizontalSpacing}getCell(t,e){const i=this.getMaxCols()*(t-1)+(e-1);return{item:this.getItem(i),x:this.getColX(e),y:this.getRowY(t),width:this.getColWidth(e),height:this.getRowHeight(t)}}getColWidth(t){return DKTools.Utils.isFunction(this._colWidth)?this._colWidth(t,this):this._colWidth}getColX(t){let e=0;for(let i=1;i=0?e%this.getMaxCols()+1:-1}getItemIndex(t){return _.indexOf(this.getItems(),t)}getItemRow(t){const e=this.getItemIndex(t);return e>=0?Math.floor(e/this.getMaxCols())+1:-1}getItems(){return this.isInverted()?_.reverse(_.clone(this._items)):this._items}getItemsInCol(t){const e=[],i=this.getMaxRows(),s=this.getMaxCols();if(t<1||t>s)return e;const n=t-1;for(let t=0;tthis.getMaxRows())return e;const s=i*(t-1);for(let t=0;t=0}hasItems(){return!this.isEmpty()}hideItems(t=!1,e=!1){this.iterateItems(e=>{e.hide(t)},e)}insertItem(t,e,i=!1){return t instanceof DKTools.Sprite?(DKTools.Utils.Array.insert(this._items,t,e),i||this.start(),t):null}insertItems(t,e,i=!1){e=e||0;const s=_.map(t,(t,i)=>this.insertItem(t,e+i,!0));return s.length>0&&!i&&this.start(),s}invert(){this.setInverted(!this.isInverted())}isEmpty(){return 0===this.getMaxItems()}isHorizontal(){return 1===this.getMaxRows()}isInverted(){return this._inverted}isReady(){return this.isEmpty()||_.every(this._items,t=>t.isReady())}isVertical(){return 1===this.getMaxCols()}iterateItems(t,e=!1){_.forEach(this.getItems(),t),e&&this.start()}moveItem(t,e,i){const s=this.getItem(t);s&&s.move(e,i)}removeAllChildren(){DKTools.Sprite.prototype.removeAllChildren.call(this),this.removeAllItems()}removeAllItems(){this.hasItems()&&this.removeChild.apply(this,this._items)}removeCol(){this.removeCols(1)}removeCols(t){this.getMaxCols()-t>=1&&this.addCols(-t)}removeItem(t,e=!1){return Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)?(this.removeChild(t),DKTools.Utils.Array.remove(this._items,t),e||this.start(),t):null}removeItems(t,e=!1){const i=_.map(t,t=>this.removeItem(t,!0));return i.length>0&&!e&&this.start(),i}resizeItem(t,e,i,s=!1){Number.isFinite(t)&&(t=this.getItem(t)),this.hasItem(t)&&t.resize(e,i)&&(s||this.start())}resizeItems(t,e,i=!1){this.iterateItems(i=>{this.resizeItem(i,t,e,!0)},!i)}setAll(t,e=!1,i=!1){t=t||{};let s=DKTools.Sprite.prototype.setAll.call(this,t,!0);return this.setMaxCols(t.maxCols,!0)&&s++,s+=this.setSpacing(t.horizontalSpacing,t.verticalSpacing,!0),this.setItems(t.items,!0)&&s++,this.setRowHeight(t.rowHeight,!0)&&s++,this.setColWidth(t.colWidth,!0)&&s++,this.setInverted(t.reversed,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s}setColWidth(t,e=!1){if(this._colWidth===t)return!1;const i=this._colWidth;return this.setupColWidth(t),this._colWidth!==i&&(e||this.start(),!0)}setHorizontalSpacing(t,e=!1){if(this._horizontalSpacing===t)return!1;const i=this._horizontalSpacing;return this.setupHorizontalSpacing(t),this._horizontalSpacing!==i&&(e||this.start(),!0)}setInverted(t,e=!1){if(this._inverted===t)return!1;const i=this._inverted;return this.setupInverted(t),this._inverted!==i&&(e||this.start(),!0)}setItems(t,e=!1){return this._items!=t&&(this.removeAllItems(),this.setupItems(t),e||this.start(),!0)}setMaxCols(t,e=!1){if(this._maxCols===t)return!1;const i=this._maxCols;return this.setupMaxCols(t),this._maxCols!==i&&(e||this.start(),!0)}setRowHeight(t,e=!1){if(this._rowHeight===t)return!1;const i=this._rowHeight;return this.setupRowHeight(t),this._rowHeight!==i&&(e||this.start(),!0)}setSpacing(t,e,i=!1){let s=0;return this.setHorizontalSpacing(t,!0)&&s++,this.setVerticalSpacing(e,!0)&&s++,s>0&&!i&&this.start(),s}setVerticalSpacing(t,e=!1){if(this._verticalSpacing===t)return!1;const i=this._verticalSpacing;return this.setupVerticalSpacing(t),this._verticalSpacing!==i&&(e||this.start(),!0)}setupAll(t={}){t=t||{},DKTools.Sprite.prototype.setupAll.call(this,t),this.setupMaxCols(t.maxCols),this.setupSpacing(t.horizontalSpacing,t.verticalSpacing),this.setupItems(t.items),this.setupRowHeight(t.rowHeight),this.setupColWidth(t.colWidth),this.setupInverted(t.inverted)}setupColWidth(t){this._colWidth=t||this.standardColWidth()}setupHorizontalSpacing(t){this._horizontalSpacing=_.defaultTo(t,this.standardHorizontalSpacing())}setupInverted(t){this._inverted=_.defaultTo(t,this.standardInverted())}setupItems(t){this._items=_.clone(t||this.standardItems())}setupMaxCols(t){this._maxCols=_.defaultTo(t,this.standardMaxCols())}setupRowHeight(t){this._rowHeight=t||this.standardRowHeight()}setupSpacing(t,e){this.setupHorizontalSpacing(t),this.setupVerticalSpacing(e)}setupVerticalSpacing(t){this._verticalSpacing=_.defaultTo(t,this.standardVerticalSpacing())}showItems(t=!1,e=!1){this.iterateItems(e=>{e.show(t)},e)}standardActive(){return!1}standardColWidth(){return t=>{const e=this.getItemsInCol(t);return _.max(_.map(e,"width"))}}standardHorizontalSpacing(){return 12}standardInverted(){return!1}standardItems(){return[]}standardMaxCols(){return 1}standardRowHeight(){return t=>{const e=this.getItemsInRow(t);return _.max(_.map(e,"height"))}}standardVerticalSpacing(){return this.getLineHeight()/2}start(){this._started=!0,this.isReady()?DKTools.Sprite.prototype.start.call(this):this.addOneTimeEvent({type:"ready",onSuccess:this.start.bind(this)})}startItems(t=!1,e=!1){this.iterateItems(e=>{e.start(t)},!e)}updateAll(){DKTools.Sprite.prototype.updateAll.call(this),this.updateLayout()}updateLayout(){const t=this.getMaxItems(),e=this.getMaxRows(),i=this.getMaxCols();let s=0;for(let n=1;n<=e&&s{const e=this.findArrow(t);e&&this.addChild(e)})},DKTools.Window.prototype.activate=function(){DKTools.Base.prototype.activate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.activate()},DKTools.Window.prototype.addAllChildren=function(){DKTools.Base.prototype.addAllChildren.call(this),this.addContentsSprite()},DKTools.Window.prototype.addContentsSprite=function(){this._addContentsSprite(),this._refreshContents()},DKTools.Window.prototype._clearAll=function(){DKTools.Base.prototype._clearAll.call(this),this._clearIsWindow(),this._clearOpenness(),this._clearPadding(),this._clearMargin(),this._clearColorTone(),this._clearOrigin(),this._clearArrows()},DKTools.Window.prototype._clearIsWindow=function(){this._isWindow=!0},DKTools.Window.prototype._clearOpenness=function(){this._openness=this.standardOpenness()},DKTools.Window.prototype._clearPadding=function(){this._padding=this.standardPadding()},DKTools.Window.prototype._clearMargin=function(){this._margin=this.standardMargin()},DKTools.Window.prototype._clearColorTone=function(){this._colorTone=this.standardTone()},DKTools.Window.prototype._clearOrigin=function(){this._origin=this.standardOrigin()},DKTools.Window.prototype._clearArrows=function(){this._arrows=[]},DKTools.Window.prototype._createAll=function(){DKTools.Base.prototype._createAll.call(this),this._createAllParts(),this._createWindowskin()},DKTools.Window.prototype._createAllParts=function(){this._createSpriteContainer(),this._createBackSprite(),this._createFrameSprite(),this._createPauseSignSprite(),this._createArrows()},DKTools.Window.prototype._createSpriteContainer=function(){this._windowSpriteContainer=new PIXI.Container},DKTools.Window.prototype._createBackSprite=function(){this.needsCreateBackSprite()&&(this._windowBackSprite=new Sprite,this._windowBackSprite.opacity=this.standardBackOpacity(),this._windowBackSprite.visible=this.standardBackVisible())},DKTools.Window.prototype._createFrameSprite=function(){this.needsCreateFrameSprite()&&(this._windowFrameSprite=new Sprite,this._windowFrameSprite.visible=this.standardFrameVisible())},DKTools.Window.prototype._createPauseSignSprite=function(){this.needsCreatePauseSignSprite()&&(this._windowPauseSignSprite=new Sprite)},DKTools.Window.prototype._createArrows=function(){this.needsCreateArrowsSprites()&&(this.needsCreateUpArrowSprite()&&this.createArrow("up","up",{onUpdate:this.onUpArrowUpdate.bind(this),onMouseClick:this.onUpArrowMouseClick.bind(this),onMouseLongPress:this.onUpArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateDownArrowSprite()&&this.createArrow("down","down",{onUpdate:this.onDownArrowUpdate.bind(this),onMouseClick:this.onDownArrowMouseClick.bind(this),onMouseLongPress:this.onDownArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateLeftArrowSprite()&&this.createArrow("left","left",{onUpdate:this.onLeftArrowUpdate.bind(this),onMouseClick:this.onLeftArrowMouseClick.bind(this),onMouseLongPress:this.onLeftArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}),this.needsCreateRightArrowSprite()&&this.createArrow("right","right",{onUpdate:this.onRightArrowUpdate.bind(this),onMouseClick:this.onRightArrowMouseClick.bind(this),onMouseLongPress:this.onRightArrowMouseLongPress.bind(this),onStateNormal:this.standardArrowStateNormal(),onStatePressed:this.standardArrowStatePressed()}))},DKTools.Window.prototype._createWindowskin=function(){this.windowskin=DKTools.Utils.Bitmap.load({folder:"img/system",filename:this.standardWindowskin()})},DKTools.Window.prototype.canRedrawAll=function(){return this.hasContentsSprite()&&DKTools.Base.prototype.canRedrawAll.call(this)},DKTools.Window.prototype.changeFont=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeFont(t)},DKTools.Window.prototype.changeTextColor=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changeTextColor(t)},DKTools.Window.prototype.changePaintOpacity=function(t){this.hasContentsSprite()&&this._windowContentsSprite.changePaintOpacity(t)},DKTools.Window.prototype.checkSize=function(){const t=this.getMinWidth(),e=this.getMinHeight();let i=0;return this._width{this.isOpenAndVisible()?s.show():s.hide(),DKTools.Utils.isFunction(i.onUpdate)&&i.onUpdate(t)}}),DKTools.Utils.isFunction(i.onMouseDown)&&s.addEvent({type:"mouse-down-left",onUpdate:i.onMouseDown}),DKTools.Utils.isFunction(i.onMouseUp)&&s.addEvent({type:"mouse-up-left",onUpdate:i.onMouseUp}),DKTools.Utils.isFunction(i.onMouseClick)&&s.addEvent({type:"mouse-click-left",onUpdate:i.onMouseClick}),DKTools.Utils.isFunction(i.onMouseLongPress)&&s.addEvent({type:"mouse-long-press-left",onUpdate:i.onMouseLongPress}),DKTools.Utils.isFunction(i.onMouseLongPressStarted)&&s.addEvent({type:"mouse-long-press-left-started",onUpdate:i.onMouseLongPressStarted}),DKTools.Utils.isFunction(i.onMouseLongPressFinished)&&s.addEvent({type:"mouse-long-press-left-finished",onUpdate:i.onMouseLongPressFinished}),DKTools.Utils.isFunction(i.onStateNormal)&&s.addEvent({type:"state-normal",onUpdate:i.onStateNormal}),DKTools.Utils.isFunction(i.onStatePressed)&&s.addEvent({type:"state-pressed",onUpdate:i.onStatePressed}),this._arrows.push(s),this.addChild(s),s},DKTools.Window.prototype.deactivate=function(){DKTools.Base.prototype.deactivate.call(this),this.hasContentsSprite()&&this._windowContentsSprite.deactivate()},DKTools.Window.prototype.destroy=function(t){DKTools.Base.prototype.destroy.call(this,t),Window_Base.prototype.destroy.call(this,t)},DKTools.Window.prototype.drawText=function(t,e){return!!this.hasContentsSprite()&&this._windowContentsSprite.drawText(t,e)},DKTools.Window.prototype.findArrow=function(t){return _.find(this._arrows,{id:t})},DKTools.Window.prototype.getMinWidth=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinWidth.call(this)},DKTools.Window.prototype.getMinHeight=function(){return 2*this.standardPadding()+DKTools.Base.prototype.getMinHeight.call(this)},DKTools.Window.prototype.getContentsWidth=function(){return DKTools.Utils.isFunction(this._contentsWidth)?this._contentsWidth(this):this._contentsWidth},DKTools.Window.prototype.getContentsHeight=function(){return DKTools.Utils.isFunction(this._contentsHeight)?this._contentsHeight(this):this._contentsHeight},DKTools.Window.prototype.getContentsSize=function(){return{width:this.getContentsWidth(),height:this.getContentsHeight()}},DKTools.Window.prototype.getCurrentOpacity=function(){return this.windowOpacity},DKTools.Window.prototype.hasBitmap=function(){return!!this.hasContentsSprite()&&this._windowContentsSprite.hasBitmap()},DKTools.Window.prototype.hasSpriteContainer=function(){return!!this._windowSpriteContainer},DKTools.Window.prototype.hasBackSprite=function(){return!!this._windowBackSprite},DKTools.Window.prototype.hasFrameSprite=function(){return!!this._windowFrameSprite},DKTools.Window.prototype.hasContentsSprite=function(){return!!this._windowContentsSprite},DKTools.Window.prototype.hasArrow=function(t){return!!this.findArrow(t)},DKTools.Window.prototype.hasArrowSprites=function(){return this.hasUpArrowSprite()&&this.hasDownArrowSprite()&&this.hasLeftArrowSprite()&&this.hasRightArrowSprite()},DKTools.Window.prototype.hasUpArrowSprite=function(){return this.hasArrow("up")},DKTools.Window.prototype.hasDownArrowSprite=function(){return this.hasArrow("down")},DKTools.Window.prototype.hasLeftArrowSprite=function(){return this.hasArrow("left")},DKTools.Window.prototype.hasRightArrowSprite=function(){return this.hasArrow("right")},DKTools.Window.prototype.hasPauseSignSprite=function(){return!!this._windowPauseSignSprite},DKTools.Window.prototype.hasBackgroundDimmer=function(){return!!this._dimmerSprite},DKTools.Window.prototype.hideBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!1)},DKTools.Window.prototype.hideContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.hide()},DKTools.Window.prototype.hideFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!1)},DKTools.Window.prototype.isOpenAndVisible=function(){return this.isOpen()&&this.isVisible()},DKTools.Window.prototype.isOpenAndActive=function(){return this.isOpen()&&this.isActive()},DKTools.Window.prototype.needsCreateBackSprite=function(){return!0},DKTools.Window.prototype.needsCreateFrameSprite=function(){return!0},DKTools.Window.prototype.needsCreateArrowsSprites=function(){return!1},DKTools.Window.prototype.needsCreateDownArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateUpArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateLeftArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreateRightArrowSprite=function(){return!0},DKTools.Window.prototype.needsCreatePauseSignSprite=function(){return!0},DKTools.Window.prototype.onUpArrowUpdate=function(t){},DKTools.Window.prototype.onDownArrowUpdate=function(t){},DKTools.Window.prototype.onLeftArrowUpdate=function(t){},DKTools.Window.prototype.onRightArrowUpdate=function(t){},DKTools.Window.prototype.onUpArrowMouseClick=function(t){},DKTools.Window.prototype.onDownArrowMouseClick=function(t){},DKTools.Window.prototype.onLeftArrowMouseClick=function(t){},DKTools.Window.prototype.onRightArrowMouseClick=function(t){},DKTools.Window.prototype.onUpArrowMouseLongPress=function(t){},DKTools.Window.prototype.onDownArrowMouseLongPress=function(t){},DKTools.Window.prototype.onLeftArrowMouseLongPress=function(t){},DKTools.Window.prototype.onRightArrowMouseLongPress=function(t){},DKTools.Window.prototype._refreshAllParts=function(){this._refreshBack(),this._refreshFrame(),this._refreshContents(),this._refreshPauseSign(),this._refreshArrows()},DKTools.Window.prototype._refreshBack=function(){this.hasBackSprite()&&Window.prototype._refreshBack.call(this)},DKTools.Window.prototype._refreshFrame=function(){this.hasFrameSprite()&&Window.prototype._refreshFrame.call(this)},DKTools.Window.prototype._refreshContents=function(){if(this.hasContentsSprite()){let t=this._contentsPosition;DKTools.Utils.isFunction(t)&&(t=t(this)),this._windowContentsSprite.move(t)}},DKTools.Window.prototype._refreshPauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._refreshPauseSign.call(this)},DKTools.Window.prototype._refreshArrows=function(){const t={up:this.standardUpArrowPosition(),down:this.standardDownArrowPosition(),left:this.standardLeftArrowPosition(),right:this.standardRightArrowPosition()};_.forEach(t,(t,e)=>{const i=this.findArrow(e);i&&i.move(t)})},DKTools.Window.prototype.redrawAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.redrawAll()},DKTools.Window.prototype.refreshAll=function(){this._refreshAllParts(),DKTools.Base.prototype.refreshAll.call(this)},DKTools.Window.prototype.refreshArrows=function(){_.forEach(this._arrows,t=>{t.refreshAll()})},DKTools.Window.prototype.removeAllChildren=function(){DKTools.Base.prototype.removeAllChildren.call(this),this.removeContentsSprite()},DKTools.Window.prototype.removeContentsSprite=function(){this.hasContentsSprite()&&this.removeChild(this._windowContentsSprite)},DKTools.Window.prototype.removeArrow=function(t){const e=this.findArrow(t);e&&(DKTools.Utils.Array.remove(this._arrows,e),this.removeChild(e))},DKTools.Window.prototype.resetAll=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetAll()},DKTools.Window.prototype.resetFont=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetFont()},DKTools.Window.prototype.resetTextColor=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetTextColor()},DKTools.Window.prototype.resetPaintOpacity=function(){this.hasContentsSprite()&&this._windowContentsSprite.resetPaintOpacity()},DKTools.Window.prototype.resize=function(t,e,i=!1,s=!1){if(t=_.defaultTo(t,this.getMinWidth()),e=_.defaultTo(e,this.getMinHeight()),DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),this._width===t&&this._height===e)return!1;const n=this._width,r=this._height;return this.setupSize(t,e),(this._width!==n||this._height!==r)&&(i||this.start(),s&&this.activate(),!0)},DKTools.Window.prototype.standardOpenness=function(){return 255},DKTools.Window.prototype.standardOpennessSpeed=function(){return 16},DKTools.Window.prototype.standardMargin=function(){return 4},DKTools.Window.prototype.standardOrigin=function(){return new Point(0,0)},DKTools.Window.prototype.standardUpArrowPosition=function(){return new Point(this._width/2,12)},DKTools.Window.prototype.standardDownArrowPosition=function(){return new Point(this._width/2,this._height-12)},DKTools.Window.prototype.standardLeftArrowPosition=function(){return new Point(12,this._height/2)},DKTools.Window.prototype.standardRightArrowPosition=function(){return new Point(this._width-12,this._height/2)},DKTools.Window.prototype.standardArrowStateNormal=function(){return t=>{const e=t.target;e.setScale(1,1),e.setOpacity(255)}},DKTools.Window.prototype.standardArrowStatePressed=function(){return t=>{const e=t.target;e.setScale(.9,.9),e.setOpacity(160)}},DKTools.Window.prototype.standardContentsSprite=function(){return new DKTools.Sprite},DKTools.Window.prototype.standardChildX=function(){return this._padding},DKTools.Window.prototype.standardChildY=function(){return this._padding},DKTools.Window.prototype.standardChildPosition=function(){return()=>new Point(this.standardChildX(),this.standardChildY())},DKTools.Window.prototype.standardContentsPosition=function(){return this.standardChildPosition()},DKTools.Window.prototype.standardBackVisible=function(){return!0},DKTools.Window.prototype.standardFrameVisible=function(){return!0},DKTools.Window.prototype.standardContentsWidth=function(){return()=>this._width-2*this._padding},DKTools.Window.prototype.standardContentsHeight=function(){return()=>this._height-2*this._padding},DKTools.Window.prototype.standardWindowOpacity=function(){return 255},DKTools.Window.prototype.standardContentsOpacity=function(){return 255},DKTools.Window.prototype.standardFrameOpacity=function(){return 255},DKTools.Window.prototype.standardOpacity=function(){return{windowOpacity:this.standardWindowOpacity(),contentsOpacity:this.standardContentsOpacity(),frameOpacity:this.standardFrameOpacity(),backOpacity:this.standardBackOpacity()}},DKTools.Window.prototype.standardTone=function(){try{return _.clone($gameSystem.windowTone())}catch(t){return[0,0,0]}},DKTools.Window.prototype.setupAll=function(t={}){t=t||{},DKTools.Base.prototype.setupAll.call(this,t);let e=t.contentsSprite;t instanceof DKTools.Window&&e instanceof DKTools.Sprite&&(e=e.clone({blockStart:!0})),this.setupPadding(t.padding),this.setupMargin(t.margin),this.setupContentsWidth(t.contentsWidth),this.setupContentsHeight(t.contentsHeight),this.setupContentsSprite(e),this.setupContentsPosition(t.contentsPosition),this.setupOpacity(t.opacity),this.setupTone(t.tone)},DKTools.Window.prototype.setupWidth=function(t){this.width=this._checkWidth(t)},DKTools.Window.prototype.setupHeight=function(t){DKTools.Utils.isString(t)&&(t=this.getLineHeight()*parseFloat(t)),this.height=this._checkHeight(t)},DKTools.Window.prototype.setupSize=function(t,e){if(t instanceof Object)return this.setupSize(t.width,t.height);DKTools.Utils.isString(e)&&(e=this.getLineHeight()*parseFloat(e)),t=this._checkWidth(t),e=this._checkHeight(e),Window.prototype.move.call(this,this.x,this.y,t,e)},DKTools.Window.prototype.setupPadding=function(t){this._padding=_.defaultTo(t,this.standardPadding())},DKTools.Window.prototype.setupMargin=function(t){this._margin=_.defaultTo(t,this.standardMargin())},DKTools.Window.prototype.setupContentsWidth=function(t){this._contentsWidth=t||this.standardContentsWidth()},DKTools.Window.prototype.setupContentsHeight=function(t){this._contentsHeight=t||this.standardContentsHeight()},DKTools.Window.prototype.setupContentsSprite=function(t){this._windowContentsSprite=t||this.standardContentsSprite()},DKTools.Window.prototype.setupContentsPosition=function(t,e){let i=t;DKTools.Utils.isFunction(t)||(i=DKTools.Utils.Point.tryToPoint(t,e)||this.standardContentsPosition()),this._contentsPosition=i},DKTools.Window.prototype.setupOpacity=function(t){this._opacity=Object.assign(this.standardOpacity(),t)},DKTools.Window.prototype.setupTone=function(t){this._tone=Object.assign(this.standardTone(),t)},DKTools.Window.prototype.setAll=function(t={},e=!1,i=!1){t=t||{};let s=DKTools.Base.prototype.setAll.call(this,t,!0);return this.setPadding(t.padding,!0)&&s++,this.setMargin(t.margin,!0)&&s++,this.setOpacity(t.opacity,!0)&&s++,this.setTone(t.tone,!0)&&s++,s>0&&(e||this.start(),i&&this.activate()),s},DKTools.Window.prototype.setWidth=function(t,e=!1,i=!1){return this.resize(t,this._height,e,i)},DKTools.Window.prototype.setHeight=function(t,e=!1,i=!1){return this.resize(this._width,t,e,i)},DKTools.Window.prototype.setPadding=function(t,e=!1){if(this._padding===t)return!1;const i=this._padding;return this.setupPadding(t),this._padding!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setMargin=function(t,e=!1){if(this._margin===t)return!1;const i=this._margin;return this.setupMargin(padding),this._margin!==i&&(e||this.start(),!0)},DKTools.Window.prototype.setContentsSprite=function(t,e=!1,i=!1){return this._windowContentsSprite!=t&&(this.removeContentsSprite(),this.setupContentsSprite(t),this.addContentsSprite(),e||this.start(),i&&this.activate(),!0)},DKTools.Window.prototype.setContentsPosition=function(t,e){const i=DKTools.Utils.isFunction,s=i(this._contentsPosition),n=i(t);if(s||n){if(this._contentsPosition===t)return!1;this.setupContentsPosition(t,e)}else{const i=DKTools.Utils.Point.toPoint(t,e);if(DKTools.Utils.Point.equals(this._contentsPosition,i))return!1;const s=DKTools.Utils.Point.clone(this._contentsPosition);if(this.setupContentsPosition(i),DKTools.Utils.Point.equals(this._contentsPosition,s))return!1}return this._refreshContents(),!0},DKTools.Window.prototype.setOpacity=function(t,e=!1){if(_.isEqual(this._opacity,Object.assign(this.standardOpacity(),t)))return!1;const i=_.clone(this._opacity);return this.setupOpacity(t),!_.isEqual(this._opacity,i)&&(e||this.updateOpacity(),!0)},DKTools.Window.prototype.setTone=function(t,e=!1){if(_.isEqual(this._tone,Object.assign(this.standardTone(),t)))return!1;const i=_.clone(this._tone);return this.setupTone(t),!_.isEqual(this._tone,i)&&(e||this.updateTone(),!0)},DKTools.Window.prototype.start=function(t=!1){if(this.hasContentsSprite()){const e=this._windowContentsSprite;e.resize(this.getContentsWidth(),this.getContentsHeight(),!0),e.start(t)}DKTools.Base.prototype.start.call(this,t)},DKTools.Window.prototype.showBack=function(){this.hasBackSprite()&&(this._windowBackSprite.visible=!0)},DKTools.Window.prototype.showContents=function(t=!1){this.hasContentsSprite()&&this._windowContentsSprite.show(t)},DKTools.Window.prototype.showFrame=function(){this.hasFrameSprite()&&(this._windowFrameSprite.visible=!0)},DKTools.Window.prototype._updateContents=function(){this.hasContentsSprite()&&Window.prototype._updateContents.call(this)},DKTools.Window.prototype._updatePauseSign=function(){this.hasPauseSignSprite()&&Window.prototype._updatePauseSign.call(this)},DKTools.Window.prototype.updateOpenEvents=function(){this.updateEventsContainer("open")},DKTools.Window.prototype.updateCloseEvents=function(){this.updateEventsContainer("close")},DKTools.Window.prototype.updateAll=function(){this.updateContents(),DKTools.Base.prototype.updateAll.call(this),this.updateTone()},DKTools.Window.prototype.updateContents=function(){this.hasContentsSprite()&&this._windowContentsSprite.updateAll()},DKTools.Window.prototype.updateTransform=function(){this._updateContents(),this._updatePauseSign(),PIXI.Container.prototype.updateTransform.call(this)},DKTools.Window.prototype.updateOpacity=function(t={}){t=t||{},this.hasSpriteContainer()&&(this.windowOpacity=_.defaultTo(t.windowOpacity,this.opacity.windowOpacity)),this.hasContentsSprite()&&(this.contentsOpacity=_.defaultTo(t.contentsOpacity,this.opacity.contentsOpacity)),this.hasFrameSprite()&&(this.frameOpacity=_.defaultTo(t.frameOpacity,this.opacity.frameOpacity)),this.hasBackSprite()&&(this.backOpacity=_.defaultTo(t.backOpacity,this.opacity.backOpacity))},DKTools.Window.prototype.updateTone=function(t){t=t||this.tone,this.hasBackSprite()&&Window.prototype.setTone.apply(this,t)},DKTools.Window.prototype.updateOpen=function(){this._opening&&(this.openness+=this.standardOpennessSpeed(),this.isOpen()&&(this._opening=!1,this.updateOpenEvents()))},DKTools.Window.prototype.updateClose=function(){this._closing&&(this.openness-=this.standardOpennessSpeed(),this.isClosed()&&(this._closing=!1,this.updateCloseEvents()))},DKTools.Window.prototype.update=function(){DKTools.Base.prototype.update.call(this),this.updateOpen(),this.updateClose(),this.updateBackgroundDimmer()},DKTools.Window.Selectable=class extends DKTools.Window{needsCreateArrowsSprites(){return!0}onUpArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()&&t.getTopRow()>0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onDownArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isVertical()){const i=t.getTopRow(),s=t.getMaxTopRow();s>0&&i0&&e.show(this.isVisibleAndActive()&&t.isActive())}}onRightArrowUpdate(t){const e=t.target;if(e.hide(),this.hasContentsSprite()){const t=this._windowContentsSprite;if(this.isChild(t)&&t.isVisible()&&t.isSelectable()&&t.isHorizontal()){const i=t.getTopCol(),s=t.getMaxTopCol();s>0&&ithis.add(t))}finish(){this._queue=[],this._finished=!0}hasErrors(){return this._errors>0}isReady(){return this._finished}_onError(){this._errors++}start(){const t=_.map(this._queue,t=>t.catch(t=>{throw this._onError(),t}));Promise.all(t).then(()=>this.finish())}};const DKToolsParam=new DKTools.ParameterManager("DKTools");DKTools.PluginCommandManager.set("DKPluginsCheckUpdates",()=>{DKTools.Utils.openConsole(),DKTools.Utils._checkUpdates()}),DKTools.PluginCommandManager.set("UpdateFileSystemStamp",()=>{DKTools.IO._createStamp()});const DKTools_window_onload=window.onload;window.onload=function(){DKTools.Utils.initialize(),DKTools.IO.initialize(),DKTools_window_onload.call(this),DKTools.PluginManager.initialize()};const DKTools_ImageCache_get=ImageCache.prototype.get;ImageCache.prototype.get=function(t){return DKTools_ImageCache_get.call(this,t)||DKTools.PreloadManager.getCachedImageByKey(t)},ImageCache.prototype._truncateCache=function(){const t=this._items;let e=ImageCache.limit;Object.keys(t).map(e=>t[e]).filter(t=>!this._mustBeHeld(t)).sort((t,e)=>e.touch-t.touch).forEach(i=>{if(e>0&&!DKTools.PreloadManager.isImageCachedByKey(i.key)){const t=i.bitmap;e-=t.width*t.height}else delete t[i.key]})};const DKTools_ImageCache_mustBeHeld=ImageCache.prototype._mustBeHeld;ImageCache.prototype._mustBeHeld=function(t){return!DKTools.PreloadManager.isImageCachedByKey(t.key)&&DKTools_ImageCache_mustBeHeld.call(this,t)};const DKTools_Graphics_initialize=Graphics.initialize;Graphics.initialize=function(t,e,i){DKTools_Graphics_initialize.call(this,t,e,i);const s=DKToolsParam.get("FPS Meter");if(DKTools.Utils.isTest()&&s.Enabled){const t=this._fpsMeter;t&&(this.showFps(),"FPS"===s.Mode?(t.showFps(),this._fpsMeterToggled=!1):(t.showDuration(),this._fpsMeterToggled=!0))}};const DKTools_Graphics_printError=Graphics.printError;Graphics.printError=function(t,e){DKTools_Graphics_printError.call(this,t,e),this._errorPrinter&&this._updateErrorPrinter()};const DKTools_Graphics_createFPSMeter=Graphics._createFPSMeter;Graphics._createFPSMeter=function(){const t=DKToolsParam.get("FPS Meter");t.Enabled?(this._fpsMeter=new FPSMeter({theme:t.Theme,history:t.History,toggleOn:null,graph:1,decimals:0}),this._fpsMeter.hide()):DKTools_Graphics_createFPSMeter.call(this)},Graphics.printDetailedError=function(t){if(!this._errorPrinter)return;const e=t.stack.split(/(?:\r\n|\r|\n)/).map(t=>t.replace(/[\(](.*[\/])/,"("));this._errorPrinter.innerHTML=this._makeDetailedErrorHtml(t.name,t.message,e),this._applyCanvasFilter(),this._clearUpperCanvas()},Graphics._getErrorReferenceInfo=function(){const t=SceneManager._scene,e={};if(t&&t.constructor.name&&(e.Scene=t.constructor.name,SceneManager.isCurrentScene(Scene_Map))){const t=$gameMap._interpreter;if(t){if(t._mapId>0&&(e["Map ID"]=t._mapId),t._eventId>0){e["Event ID"]=t._eventId;const i=$gameMap.event(t._eventId);i&&(e["Event Page"]=i._pageIndex+1)}if(t._list&&t._list.length>0){let i=t._list[t._index];i&&0===i.code&&t._index>0&&(i=t._list[t._index-1]),i&&i.code>0&&(e["Last Event Command"]=i.code)}t._params&&t._params.length>0&&(e.Params=JSON.stringify(t._params))}}return e},Graphics._getErrorMessageForErrorPrint=function(){return DKToolsParam.get("Print Detailed Error","Error Message")},Graphics._getRestartMessageForErrorPrint=function(){return DKToolsParam.get("Print Detailed Error","Restart Message")},Graphics._makeDetailedErrorHtml=function(t,e,i){const s=this._getErrorMessageForErrorPrint(),n=this._getRestartMessageForErrorPrint(),r=this._getErrorReferenceInfo();let o="";return s&&(o=''+s+"

"),Object.keys(r).length>0&&(o+='Reference Information
',_.forEach(r,(t,e)=>{o+=''+e+": "+t+"
"}),o+="
"),o+=''+e+"
",_.forEach(i,t=>{o+=''+t+"
"}),n&&(o+='
'+n+"

"),o};const DKTools_Graphics_updateErrorPrinter=Graphics._updateErrorPrinter;Graphics._updateErrorPrinter=function(){DKTools_Graphics_updateErrorPrinter.call(this),this._errorPrinter&&this._errorShowed&&DKToolsParam.get("Print Detailed Error","Enabled")&&(this._errorPrinter.style.textAlign="left",this._errorPrinter.height=.8*this._height,this._centerElement(this._errorPrinter))};const DKTools_TouchInput_initialize=TouchInput.initialize;TouchInput.initialize=function(){DKTools_TouchInput_initialize.call(this);const t=DKToolsParam.get("Cursor Graphic");if(t.Enabled){const e=t.Graphic;e&&(document.body.style.cursor=`url('img/system/${e}.png'), default`)}};const DKTools_TouchInput_clear=TouchInput.clear;TouchInput.clear=function(){DKTools_TouchInput_clear.call(this),this._mouseMoved=!1,this._leftButtonPressed=!1,this._middleButtonPressed=!1,this._rightButtonPressed=!1,this._leftButtonReleased=!1,this._middleButtonReleased=!1,this._rightButtonReleased=!1,this._mouseX=0,this._mouseY=0,this._events.mouseMoved=!1,this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1};const DKTools_TouchInput_update=TouchInput.update;TouchInput.update=function(){this._mouseMoved=this._events.mouseMoved,this._leftButtonPressed=this._events.leftButtonPressed,this._middleButtonPressed=this._events.middleButtonPressed,this._rightButtonPressed=this._events.rightButtonPressed,this._leftButtonReleased=this._events.leftButtonReleased,this._middleButtonReleased=this._events.middleButtonReleased,this._rightButtonReleased=this._events.rightButtonReleased,this._events.mouseMoved=!1,this._events.leftButtonReleased=!1,this._events.middleButtonReleased=!1,this._events.rightButtonReleased=!1,DKTools_TouchInput_update.call(this)},TouchInput.isMouseMoved=function(){return this._mouseMoved},TouchInput.isMousePressed=function(){return this.isLeftButtonPressed()||this.isMiddleButtonPressed()||this.isRightButtonPressed()},TouchInput.isMouseReleased=function(){return this.isLeftButtonReleased()||this.isMiddleButtonReleased()||this.isRightButtonReleased()},TouchInput.isLeftButtonPressed=function(){return this._leftButtonPressed},TouchInput.isLeftButtonReleased=function(){return this._leftButtonReleased},TouchInput.isMiddleButtonPressed=function(){return this._middleButtonPressed},TouchInput.isMiddleButtonReleased=function(){return this._middleButtonReleased},TouchInput.isRightButtonPressed=function(){return this._rightButtonPressed},TouchInput.isRightButtonReleased=function(){return this._rightButtonReleased};const DKTools_TouchInput_onLeftButtonDown=TouchInput._onLeftButtonDown;TouchInput._onLeftButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onLeftButtonDown.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.leftButtonPressed=!0)};const DKTools_TouchInput_onMiddleButtonDown=TouchInput._onMiddleButtonDown;TouchInput._onMiddleButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onMiddleButtonDown.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.middleButtonPressed=!0)};const DKTools_TouchInput_onRightButtonDown=TouchInput._onRightButtonDown;TouchInput._onRightButtonDown=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onRightButtonDown.call(this,t),Graphics.isInsideCanvas(e,i)&&(this._events.rightButtonPressed=!0)};const DKTools_TouchInput_onMouseMove=TouchInput._onMouseMove;TouchInput._onMouseMove=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onMouseMove.call(this,t),this._mouseX===e&&this._mouseY===i||(this._events.mouseMoved=!0,this._date=Date.now(),this._mouseX=e,this._mouseY=i)};const DKTools_TouchInput_onMouseUp=TouchInput._onMouseUp;TouchInput._onMouseUp=function(t){const e=Graphics.pageToCanvasX(t.pageX),i=Graphics.pageToCanvasY(t.pageY);DKTools_TouchInput_onMouseUp.call(this,t),this._events.leftButtonPressed=!1,this._events.middleButtonPressed=!1,this._events.rightButtonPressed=!1,Graphics.isInsideCanvas(e,i)&&(0===t.button?this._events.leftButtonReleased=!0:1===t.button?this._events.middleButtonReleased=!0:2===t.button&&(this._events.rightButtonReleased=!0))},Object.defineProperties(TouchInput,{mouseX:{get:function(){return this._mouseX},configurable:!0},mouseY:{get:function(){return this._mouseY},configurable:!0}});const DKTools_Tilemap_initialize=Tilemap.prototype.initialize;Tilemap.prototype.initialize=function(){DKTools_Tilemap_initialize.call(this),this._tileWidth=Tilemap.TILE_WIDTH||this._tileWidth,this._tileHeight=Tilemap.TILE_HEIGHT||this._tileHeight};const DKTools_WebAudio_addLoadListener=WebAudio.prototype.addLoadListener;WebAudio.prototype.addLoadListener=function(t){this.isReady()?t(this):DKTools_WebAudio_addLoadListener.call(this,t)},WebAudio.prototype._onLoad=function(){for(;this._loadListeners.length>0;){this._loadListeners.shift()(this)}};const DKTools_DataManager_isDatabaseLoaded=DataManager.isDatabaseLoaded;DataManager.isDatabaseLoaded=function(){return!!DKTools_DataManager_isDatabaseLoaded.call(this)&&(this.__isDatabaseLoaded||(this.__isDatabaseLoaded=!0,this.onDatabaseLoad()),!0)},DataManager.onDatabaseLoad=function(){},Object.defineProperties(ImageManager,{PARALLAXES_FOLDER:{get:function(){const t=DKToolsParam.get("Tile Size");return t.Enabled?DKTools.IO.normalizePath(t["Parallaxes Folder"]+"/"):"img/parallaxes/"},configurable:!0},TILESETS_FOLDER:{get:function(){const t=DKToolsParam.get("Tile Size");return t.Enabled?DKTools.IO.normalizePath(t["Tilesets Folder"]+"/"):"img/tilesets/"},configurable:!0}}),ImageManager.loadParallax=function(t,e){return this.loadBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!0)},ImageManager.loadTileset=function(t,e){return this.loadBitmap(ImageManager.TILESETS_FOLDER,t,e,!1)},ImageManager.reserveParallax=function(t,e,i){return this.reserveBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!1,i)},ImageManager.reserveTileset=function(t,e,i){return this.reserveBitmap(ImageManager.TILESETS_FOLDER,t,e,!1,i)},ImageManager.requestParallax=function(t,e){return this.requestBitmap(ImageManager.PARALLAXES_FOLDER,t,e,!0)},ImageManager.requestTileset=function(t,e){return this.requestBitmap(ImageManager.TILESETS_FOLDER,t,e,!1)};const DKTools_AudioManager_createBuffer=AudioManager.createBuffer;AudioManager.createBuffer=function(t,e){const i=this.audioFileExt(),s=this._path+t+"/"+encodeURIComponent(e)+i;return DKTools.PreloadManager.isAudioCachedByPath(s)?DKTools.PreloadManager.getCachedAudioByPath(s):DKTools_AudioManager_createBuffer.call(this,t,e)};const DKTools_SceneManager_initialize=SceneManager.initialize;SceneManager.initialize=async function(){await DKTools_SceneManager_initialize.call(this),await DKTools.StartupManager.initialize()};const DKTools_SceneManager_initGraphics=SceneManager.initGraphics;SceneManager.initGraphics=function(){const t=DKToolsParam.get("Screen Resolution");if(t.Enabled){const e=t.Width,i=t.Height;this._boxWidth=e,this._screenWidth=e,this._boxHeight=i,this._screenHeight=i,this.updateResolution()}DKTools_SceneManager_initGraphics.call(this)},SceneManager.updateResolution=function(){const t=this._screenWidth-window.innerWidth,e=this._screenHeight-window.innerHeight;0!==t&&0!==e&&(window.moveBy(-1*t/2,-1*e/2),window.resizeBy(t,e))};const DKTools_SceneManager_onKeyDown=SceneManager.onKeyDown;SceneManager.onKeyDown=function(t){if(DKTools_SceneManager_onKeyDown.call(this,t),t.ctrlKey||t.altKey)return;const e=DKToolsParam.get("Quick Load","Key Code"),i=DKToolsParam.get("Screenshots","Key Code"),s=DKToolsParam.get("Grid","Key Code");switch(t.keyCode){case e:DKTools.Utils.__quickLoad();break;case i:DKToolsParam.get("Screenshots","Enabled")&&DKTools.Utils.makeScreenshot();break;case s:DKTools.Utils.__showGrid()}};const DKTools_SceneManager_catchException=SceneManager.catchException;SceneManager.catchException=function(t){DKTools_SceneManager_catchException.call(this,t),t instanceof Error&&DKToolsParam.get("Print Detailed Error","Enabled")&&Graphics.printDetailedError(t),DKTools.Utils.logError(t),DKToolsParam.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()};const DKTools_SceneManager_onError=SceneManager.onError;SceneManager.onError=function(t){DKTools_SceneManager_onError.call(this,t),DKTools.Utils.logError(t),DKToolsParam.get("Debugging Console","Open On Error")&&DKTools.Utils.openConsole()},SceneManager.changeScene=function(){this.isSceneChanging()&&!this.isCurrentSceneBusy()&&(this._scene&&(this._scene.terminate(),this._scene.detachReservation(),this._previousClass=this._scene.constructor),this._scene=this._nextScene,this._scene&&(this._scene.attachReservation(),this._scene.startPreloading(),this._sceneCreated=!1,this._sceneStarted=!1,this._nextScene=null,this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate())),this._exiting&&this.terminate())},SceneManager.updateScene=function(){if(this._scene){if(!this._sceneCreated&&this._scene.isPreloaded()&&(this._scene.create(),this._sceneCreated=!0,this.onSceneCreate()),this._sceneCreated&&!this._sceneStarted)try{this._scene.isReady()&&(this._scene.start(),this._sceneStarted=!0,this.onSceneStart())}catch(t){console.error(t),DKTools.Utils.logError(t),this._scene.start(),this._sceneStarted=!0,this.onSceneStart()}this.isCurrentSceneStarted()&&this._scene.update()}},SceneManager.isCurrentScene=function(t){return!!this._scene&&this._scene.constructor===t};const DKTools_SceneManager_goto=SceneManager.goto;SceneManager.goto=function(t){DKTools_SceneManager_goto.call(this,t),DKTools.Utils.__hideGrid()};const DKTools_Scene_Base_initialize=Scene_Base.prototype.initialize;Scene_Base.prototype.initialize=function(){DKTools_Scene_Base_initialize.call(this),this._preloader=new DKTools.Scene.Preloader},Scene_Base.prototype.activate=function(){this._active=!0},Scene_Base.prototype.deactivate=function(){this._active=!1},Scene_Base.prototype.isPreloaded=function(){return this._preloader.isReady()};const DKTools_Scene_Base_isReady=Scene_Base.prototype.isReady;Scene_Base.prototype.isReady=function(){return DKTools_Scene_Base_isReady.call(this)&&this.isPreloaded()},Scene_Base.prototype.setupPreloading=function(){},Scene_Base.prototype.startPreloading=function(){this.setupPreloading(),this._preloader.start()};const DKTools_Scene_Base_terminate=Scene_Base.prototype.terminate;Scene_Base.prototype.terminate=function(){DKTools_Scene_Base_terminate.call(this),this._preloader.finish()};const DKTools_Scene_Boot_create=Scene_Boot.prototype.create;Scene_Boot.prototype.create=function(){DKTools_Scene_Boot_create.call(this);const t=DKToolsParam.get("Preload Manager","Progress Bar");this._showProgressBar=t.Enabled&&DKTools.PreloadManager.isEnabled(),this._showProgressBar&&(t.Background&&(this._background=new DKTools.Sprite,this._background.loadSystem(t.Background),this.addChild(this._background)),this.createProgressBar(t))},Scene_Boot.prototype.createProgressBar=function(params){const width=eval(params["Progress Bar Width"]),height=eval(params["Progress Bar Height"]),x=eval(params["Progress Bar X"]),y=eval(params["Progress Bar Y"]);this._progressBar=new DKTools.Sprite.ProgressBar.Rectangle(x,y,width,height),this._progressBar.setupBackgroundColor(params["Progress Bar Background Color"]),this._progressBar.setupProgressColor(params["Progress Bar Progress Color"]),this._progressBar.setupMaxValue(DKTools.PreloadManager.getTotal()),this._progressBar.setupValue(0),this._progressBar.start(),this._progressBar.setupDrawTextHandler(function(){const t=params["Progress Bar Text"].format(...this._data);this.drawText(t,{height:this.height})}.bind(this._progressBar)),this.addChild(this._progressBar)};const DKTools_Scene_Boot_isReady=Scene_Boot.prototype.isReady;Scene_Boot.prototype.isReady=function(){return!(!DKTools_Scene_Boot_isReady.call(this)||!DKTools.StartupManager.isReady())&&(!!this._showProgressBar||DKTools.PreloadManager.isReady())};const DKTools_Scene_Boot_start=Scene_Boot.prototype.start;Scene_Boot.prototype.start=function(){if(this._showProgressBar&&!DKTools.PreloadManager.isFinished()){const t=DKTools.PreloadManager.getTotal(),e=180,i=t>e?1:Math.ceil(e/t);return DKTools.PreloadManager.onFileLoad(t=>{this._progressBar.addEvent({type:"queue",repeats:0,repeatTime:i,onStart:()=>{this._progressBar._data=[t.file.url,t.loaded,t.total],this._progressBar.nextValue()}})}),this._progressBar.addOneTimeEvent({type:"full",onSuccess:()=>{this.start()}}),void DKTools.PreloadManager.start()}const t=DKToolsParam.get("Quick Start");t.Enabled?(DKTools_Scene_Boot_start.call(this),DataManager.isBattleTest()||DataManager.isEventTest()||!t["Skip Saves"]&&DataManager.isAnySavefileExists()||(Scene_Base.prototype.start.call(this),SoundManager.preloadImportantSounds(),this.checkPlayerLocation(),DataManager.setupNewGame(),this.updateDocumentTitle(),SceneManager.goto(window[t["Scene Name"]]))):DKTools_Scene_Boot_start.call(this)};const DKTools_Scene_Map_isReady=Scene_Map.prototype.isReady;Scene_Map.prototype.isReady=function(){return!!this.isPreloaded()&&DKTools_Scene_Map_isReady.call(this)};const DKTools_Game_Map_tileWidth=Game_Map.prototype.tileWidth;Game_Map.prototype.tileWidth=function(){return Tilemap.TILE_WIDTH||DKTools_Game_Map_tileWidth.call(this)};const DKTools_Game_Map_tileHeight=Game_Map.prototype.tileHeight;Game_Map.prototype.tileHeight=function(){return Tilemap.TILE_HEIGHT||DKTools_Game_Map_tileHeight.call(this)};const DKTools_Game_Interpreter_pluginCommand=Game_Interpreter.prototype.pluginCommand;Game_Interpreter.prototype.pluginCommand=function(t,e){DKTools_Game_Interpreter_pluginCommand.call(this,t,e),DKTools.PluginCommandManager.process(this,t,e)},DKToolsParam.get("Font Size","Enabled")&&(Window_Base.prototype.standardFontSize=function(){return DKToolsParam.get("Font Size","Size")},DKTools.Sprite.prototype.standardFontSize=function(){try{return Window_Base.prototype.standardFontSize.call(this)}catch(t){return DKToolsParam.get("Font Size","Size")}}),DKToolsParam.get("Line Height","Enabled")&&(Window_Base.prototype.lineHeight=function(){return DKToolsParam.get("Line Height","Height")},DKTools.Base.prototype.getLineHeight=function(){try{return Window_Base.prototype.lineHeight.call(this)}catch(t){return DKToolsParam.get("Line Height","Height")}},DKTools.Sprite.prototype.getLineHeight=function(){return DKTools.Base.prototype.getLineHeight.call(this)},DKTools.Window.prototype.getLineHeight=function(){return DKTools.Base.prototype.getLineHeight.call(this)}),DKToolsParam.get("Window Padding","Enabled")&&(Window_Base.prototype.standardPadding=function(){return DKToolsParam.get("Window Padding","Padding")})}).call(this,__webpack_require__(1)(module))},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),t.webpackPolyfill=1),t}},function(t,e){t.exports=require("nw.gui")},function(t,e){t.exports=require("fs")},function(t,e){t.exports=require("os")},function(t,e){t.exports=require("path")}]); \ No newline at end of file diff --git a/src/DKTools.js b/src/DKTools.js index 6b4f68c..a84c831 100644 --- a/src/DKTools.js +++ b/src/DKTools.js @@ -3,7 +3,7 @@ Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Version: 8.2.0 +Version: 8.3.0 Release: 31.10.2019 First release: 13.01.2016 Supported languages: Russian, English @@ -14,14 +14,14 @@ Supported languages: Russian, English Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru E-mail: kuznetsovdenis96@gmail.com -Версия: 8.2.0 +Версия: 8.3.0 Релиз: 31.10.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский */ /*: -* @plugindesc v.8.2.0 Library for RPG Maker. Made with ♥ by DKPlugins +* @plugindesc v.8.3.0 Library for RPG Maker. Made with ♥ by DKPlugins * @author DK (Denis Kuznetsov) * @help @@ -29,7 +29,7 @@ E-mail: kuznetsovdenis96@gmail.com Title: DKTools Author: DK (Denis Kuznetsov) Site: https://dk-plugins.ru - Version: 8.2.0 + Version: 8.3.0 Release: 31.10.2019 First release: 13.01.2016 Supported languages: Russian, English @@ -288,7 +288,7 @@ E-mail: kuznetsovdenis96@gmail.com * @parent Functions * @desc Preloading resources * @type struct - * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]"} + * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]","Progress":"{\"Enabled\":\"false\",\"Background\":\"\",\"Progress Bar Width\":\"Graphics.boxWidth * 2 / 4\",\"Progress Bar Height\":\"48\",\"Progress Bar X\":\"(Graphics.boxWidth - width) * 2 / 4\",\"Progress Bar Y\":\"(Graphics.boxHeight - height) * 2 / 4\",\"Progress Bar Background Color\":\"grey\",\"Progress Bar Progress Color\":\"#33ccff\",\"Progress Bar Text\":\"Loading: %1\"}"} * @param Screenshots * @parent Functions @@ -299,7 +299,7 @@ E-mail: kuznetsovdenis96@gmail.com */ /*:ru -* @plugindesc v.8.2.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins +* @plugindesc v.8.3.0 Библиотека для RPG Maker. Сделано с ♥ от DKPlugins * @author DK (Денис Кузнецов) * @help @@ -307,7 +307,7 @@ E-mail: kuznetsovdenis96@gmail.com Название: DKTools Автор: DK (Денис Кузнецов) Сайт: https://dk-plugins.ru - Версия: 8.2.0 + Версия: 8.3.0 Релиз: 31.10.2019 Первый релиз: 13.01.2016 Поддерживаемые языки: Русский, Английский @@ -588,7 +588,7 @@ E-mail: kuznetsovdenis96@gmail.com * @parent Functions * @desc Предварительная загрузка ресурсов * @type struct - * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]"} + * @default {"Enabled":"false","Debugging":"false","Audio Files":"[]","Image Files":"[]","Progress":"{\"Enabled\":\"false\",\"Background\":\"\",\"Progress Bar Width\":\"Graphics.boxWidth * 2 / 4\",\"Progress Bar Height\":\"48\",\"Progress Bar X\":\"(Graphics.boxWidth - width) * 2 / 4\",\"Progress Bar Y\":\"(Graphics.boxHeight - height) * 2 / 4\",\"Progress Bar Background Color\":\"grey\",\"Progress Bar Progress Color\":\"#33ccff\",\"Progress Bar Text\":\"Загрузка: %1\"}"} * @param Screenshots * @text Скриншоты @@ -818,7 +818,10 @@ E-mail: kuznetsovdenis96@gmail.com * @default false * @param Scene Name - * @desc Name of scene which will be launched instead the title screen. Standard: Scene_Map + * @desc Name of scene which will be launched instead the title screen. Standard: Scene_Title + * @type combo + * @option Scene_Map + * @option Scene_Title * @default Scene_Map * @param Skip Saves @@ -838,7 +841,10 @@ E-mail: kuznetsovdenis96@gmail.com * @param Scene Name * @text Название сцены - * @desc Название сцены, которая запускается вместо титульного экрана. Стандартно: Scene_Map + * @desc Название сцены, которая запускается вместо титульного экрана. Стандартно: Scene_Title + * @type combo + * @option Scene_Map + * @option Scene_Title * @default Scene_Map * @param Skip Saves @@ -911,6 +917,11 @@ E-mail: kuznetsovdenis96@gmail.com * @type struct[] * @default [] + * @param Progress Bar + * @desc Preloading process display + * @type struct + * @default {"Enabled":"false","Background":"","Progress Bar Width":"Graphics.boxWidth * 2 / 4","Progress Bar Height":"48","Progress Bar X":"(Graphics.boxWidth - width) * 2 / 4","Progress Bar Y":"(Graphics.boxHeight - height) * 2 / 4","Progress Bar Background Color":"grey","Progress Bar Progress Color":"#33ccff","Progress Bar Text":"Loading: %1"} + */ /*~struct~PreloadManager:ru @@ -939,6 +950,12 @@ E-mail: kuznetsovdenis96@gmail.com * @type struct[] * @default [] + * @param Progress Bar + * @text Прогресс + * @desc Отображение процесса предзагрузки + * @type struct + * @default {"Enabled":"false","Background":"","Progress Bar Width":"Graphics.boxWidth * 2 / 4","Progress Bar Height":"48","Progress Bar X":"(Graphics.boxWidth - width) * 2 / 4","Progress Bar Y":"(Graphics.boxHeight - height) * 2 / 4","Progress Bar Background Color":"grey","Progress Bar Progress Color":"#33ccff","Progress Bar Text":"Загрузка: %1"} + */ /*~struct~PreloadManagerImage: @@ -1012,6 +1029,155 @@ E-mail: kuznetsovdenis96@gmail.com */ +/*~struct~PreloadManagerProgressBar: + + * @param Enabled + * @desc Enable visual display of preloading ? + * @type boolean + * @default false + + * @param Background + * @desc Background picture + * @type file + * @dir img/system + + * @param Progress Bar Width + * @desc Width of the progress bar + * @type combo + * @option Graphics.boxWidth * 1 / 4 + * @option Graphics.boxWidth * 2 / 4 + * @option Graphics.boxWidth * 3 / 4 + * @default Graphics.boxWidth * 2 / 4 + + * @param Progress Bar Height + * @desc Height of the progress bar + * @type combo + * @option 36 + * @option 42 + * @option 48 + * @default 48 + + * @param Progress Bar X + * @desc The X coordinate of the progress bar + * @type combo + * @option (Graphics.boxWidth - width) * 1 / 4 + * @option (Graphics.boxWidth - width) * 2 / 4 + * @option (Graphics.boxWidth - width) * 3 / 4 + * @option (Graphics.boxWidth - width) * 1 / 5 + * @option (Graphics.boxWidth - width) * 1 / 6 + * @option (Graphics.boxWidth - width) * 4 / 5 + * @option (Graphics.boxWidth - width) * 5 / 6 + * @default (Graphics.boxWidth - width) * 2 / 4 + + * @param Progress Bar Y + * @desc The Y coordinate of the progress bar + * @type combo + * @option (Graphics.boxHeight - height) * 1 / 4 + * @option (Graphics.boxHeight - height) * 2 / 4 + * @option (Graphics.boxHeight - height) * 3 / 4 + * @option (Graphics.boxHeight - height) * 1 / 5 + * @option (Graphics.boxHeight - height) * 1 / 6 + * @option (Graphics.boxHeight - height) * 4 / 5 + * @option (Graphics.boxHeight - height) * 5 / 6 + * @default (Graphics.boxHeight - height) * 2 / 4 + + * @param Progress Bar Background Color + * @desc Progress bar background color + * @type combo + * @option grey + * @default grey + + * @param Progress Bar Progress Color + * @desc Progress bar progress color + * @type combo + * @option #33ccff + * @default #33ccff + + * @param Progress Bar Text + * @desc Progress bar text. Use to substitute: %1 - url, %2 - loaded, %3 - total + * @default Loading: %1 + +*/ + +/*~struct~PreloadManagerProgressBar:ru + + * @param Enabled + * @text Включено + * @desc Включить визуальное отображение загрузки ? + * @type boolean + * @default false + + * @param Background + * @text Фоновое изображение + * @desc Фоновое изображение + * @type file + * @dir img/system + + * @param Progress Bar Width + * @text Ширина прогресс бара + * @desc Ширина прогресс бара + * @type combo + * @option Graphics.boxWidth * 1 / 4 + * @option Graphics.boxWidth * 2 / 4 + * @option Graphics.boxWidth * 3 / 4 + * @default Graphics.boxWidth * 2 / 4 + + * @param Progress Bar Height + * @text Высота прогресс бара + * @desc Высота прогресс бара + * @type combo + * @option 36 + * @option 42 + * @option 48 + * @default 48 + + * @param Progress Bar X + * @text X прогресс бара + * @desc X прогресс бара + * @type combo + * @option (Graphics.boxWidth - width) * 1 / 4 + * @option (Graphics.boxWidth - width) * 2 / 4 + * @option (Graphics.boxWidth - width) * 3 / 4 + * @option (Graphics.boxWidth - width) * 1 / 5 + * @option (Graphics.boxWidth - width) * 1 / 6 + * @option (Graphics.boxWidth - width) * 4 / 5 + * @option (Graphics.boxWidth - width) * 5 / 6 + * @default (Graphics.boxWidth - width) * 2 / 4 + + * @param Progress Bar Y + * @text Y прогресс бара + * @desc Y прогресс бара + * @type combo + * @option (Graphics.boxHeight - height) * 1 / 4 + * @option (Graphics.boxHeight - height) * 2 / 4 + * @option (Graphics.boxHeight - height) * 3 / 4 + * @option (Graphics.boxHeight - height) * 1 / 5 + * @option (Graphics.boxHeight - height) * 1 / 6 + * @option (Graphics.boxHeight - height) * 4 / 5 + * @option (Graphics.boxHeight - height) * 5 / 6 + * @default (Graphics.boxHeight - height) * 2 / 4 + + * @param Progress Bar Background Color + * @text Фон прогресс бара + * @desc Фон прогресс бара в веб формате + * @type combo + * @option grey + * @default grey + + * @param Progress Bar Progress Color + * @text Цвет прогресс бара + * @desc Цвет прогресс бара в веб формате + * @type combo + * @option #33ccff + * @default #33ccff + + * @param Progress Bar Text + * @text Текст прогресс бара + * @desc Текст прогресс бара. Используйте, чтобы подставить: %1 - файл, %2 - загружено, %3 - всего + * @default Загрузка: %1 + +*/ + /*~struct~Screenshots: * @param Enabled diff --git a/src/DKTools/Base.js b/src/DKTools/Base.js index 4f5f94c..bd38ddc 100644 --- a/src/DKTools/Base.js +++ b/src/DKTools/Base.js @@ -702,6 +702,7 @@ DKTools.Base = class { /** * Turns off the option * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String} option - Name of the option @@ -715,6 +716,7 @@ DKTools.Base = class { /** * Turns off the options * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -1671,6 +1673,7 @@ DKTools.Base = class { /** * Turns on the option * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String} option - Name of the option @@ -1684,6 +1687,7 @@ DKTools.Base = class { /** * Turns on the options * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -4131,6 +4135,7 @@ DKTools.Base = class { /** * Switches the option * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String} option - Name of the option @@ -4144,6 +4149,7 @@ DKTools.Base = class { /** * Switches the options * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String[] | ...String} object - Names of the options diff --git a/src/DKTools/IO File.js b/src/DKTools/IO File.js index ac23fd7..057ad28 100644 --- a/src/DKTools/IO File.js +++ b/src/DKTools/IO File.js @@ -322,7 +322,7 @@ DKTools.IO.File = class extends DKTools.IO.Entity { * DKTools.IO.ERROR_DECOMPRESSING_DATA * DKTools.IO.ERROR_PARSING_DATA * - * @version 8.0.0 + * @version 8.3.0 * * @param {Object} object - Options of an operation * @@ -332,6 +332,7 @@ DKTools.IO.File = class extends DKTools.IO.Entity { * @param {Function} [object.onError] - Callback function upon completion of an operation with error (only for object.sync == false) * @param {Boolean} [object.decompress] - Use LZString.decompressFromBase64 for a data * @param {Boolean | Object} [object.parse] - Use JSON.parse for a data + * @param {String} [object.mimeType] - Mime type (only for XMLHttpRequest) * * @param {String} [object.options.encoding] - Encoding * @param {String} [object.options.flag] - File system flag @@ -369,10 +370,6 @@ DKTools.IO.File = class extends DKTools.IO.Entity { return { data: null, status: DKTools.IO.ERROR_OPTIONS_ARE_NOT_AVAILABLE }; } - if (!object.sync && !DKTools.Utils.isFunction(object.onSuccess)) { - return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; - } - const absolutePath = this.getAbsolutePath(); const processData = (data) => { if (data) { @@ -413,6 +410,10 @@ DKTools.IO.File = class extends DKTools.IO.Entity { this.__processError(error, object.onError); } } else { + if (!DKTools.Utils.isFunction(object.onSuccess)) { + return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; + } + fs.readFile(absolutePath, options, (error, data) => { if (error) { this.__processError(error, object.onError); @@ -422,6 +423,10 @@ DKTools.IO.File = class extends DKTools.IO.Entity { }); } } else { + if (!DKTools.Utils.isFunction(object.onSuccess)) { + return { data: null, status: DKTools.IO.ERROR_CALLBACK_IS_NOT_AVAILABLE }; + } + if (DKTools.IO.mode === DKTools.IO.MODE_NWJS_STAMP && this.getFullName() !== 'Stamp.json' && !this.exists()) { return { data: null, status: DKTools.IO.ERROR_PATH_DOES_NOT_EXIST }; } diff --git a/src/DKTools/Imported.js b/src/DKTools/Imported.js index 1fd980a..971d1ad 100644 --- a/src/DKTools/Imported.js +++ b/src/DKTools/Imported.js @@ -7,7 +7,7 @@ * @type {Object} */ window.Imported = window.Imported || {}; -window.Imported.DKTools = '8.2.0'; +window.Imported.DKTools = '8.3.0'; diff --git a/src/DKTools/PreloadManager.js b/src/DKTools/PreloadManager.js index f34bc80..812e066 100644 --- a/src/DKTools/PreloadManager.js +++ b/src/DKTools/PreloadManager.js @@ -21,32 +21,33 @@ DKTools.PreloadManager = class { /** * Initializes the manager * + * @version 8.3.0 * @static */ static initialize() { this.clearCache(); - const param = DKToolsParam.get('Preload Manager'); + const params = DKToolsParam.get('Preload Manager'); /** * @private * @readonly * @type {Boolean} */ - this._enabled = param['Enabled']; + this._enabled = params['Enabled']; if (!this.isEnabled()) { return; } - _.forEach(param['Audio Files'], data => { + params['Audio Files'].forEach((data) => { this.preloadAudio({ path: data.Path, caching: data.Caching }); }); - _.forEach(param['Image Files'], data => { + params['Image Files'].forEach((data) => { this.preloadImage({ path: data.Path, hue: data.Hue, @@ -54,7 +55,24 @@ DKTools.PreloadManager = class { }); }); - this.start(); + const progressParams = params['Progress Bar']; + let start = false; + + if (!progressParams.Enabled) { + start = true; + + this.onFileLoad(() => { + Graphics.updateLoading(); + }); + + this.onFinish(() => { + Graphics.endLoading(); + }); + } + + if (start) { + this.start(); + } } // C methods @@ -94,6 +112,7 @@ DKTools.PreloadManager = class { /** * Finishes the preloading * + * @version 8.3.0 * @private * @static * @@ -104,11 +123,33 @@ DKTools.PreloadManager = class { this.clearQueue(); + const preloadingTime = (this._finishTime - this._startTime) / 1000; + const total = this.getTotal(); + this._log('Preloading complete! \n' + - 'Loaded/Skipped/Total: ' + this._loaded + '/' + this._skipped + '/' + this._total + '\n' + - 'Preloading time: ' + (this._finishTime - this._startTime) / 1000 + ' sec'); + 'Loaded/Skipped/Total: ' + this._loaded + '/' + this._skipped + '/' + total + '\n' + + 'Preloading time: ' + preloadingTime + ' sec'); + + if (this._finishListeners) { + const data = { + loaded: this._loaded, + skipped: this._skipped, + preloadingTime, + total + }; + + while (this._finishListeners.length > 0) { + const handler = this._finishListeners.shift(); - Graphics.endLoading(); + handler(data); + } + + delete this._finishListeners; + } + + if (this._fileLoadListeners) { + delete this._fileLoadListeners; + } } // G methods @@ -208,6 +249,19 @@ DKTools.PreloadManager = class { return this.getCachedImageByKey(this._generateImageKey(path)); } + /** + * Returns the total amount of resources to preload + * + * @static + * + * @since 8.3.0 + * + * @returns {Number} Total amount of resources to preload + */ + static getTotal() { + return _.size(this._queue.audio) + _.size(this._queue.image); + } + // I methods /** @@ -328,6 +382,7 @@ DKTools.PreloadManager = class { /** * Processes the loading of the data * + * @version 8.3.0 * @since 5.0.0 * @private * @static @@ -339,7 +394,57 @@ DKTools.PreloadManager = class { this._log(`Loaded ${data instanceof WebAudio ? 'audio': 'image'}: ${data.url}`); - Graphics.updateLoading(); + if (this._fileLoadListeners) { + const obj = { + file: data, + loadded: this._loaded, + total: this.getTotal() + }; + + this._fileLoadListeners.forEach((callback) => { + callback(obj); + }); + } + } + + /** + * Adds a callback function to handle file load + * All callback functions will be cleared after the preload is finished + * Callback function takes 1 argument - object with following properties: + * file (WebAudio or Bitmap), loaded, total + * + * @static + * + * @since 8.3.0 + * + * @param {Function} callback + */ + static onFileLoad(callback) { + if (!this._fileLoadListeners) { + this._fileLoadListeners = []; + } + + this._fileLoadListeners.push(callback); + } + + /** + * Adds a callback function to handle finish of preloading + * All callback functions will be cleared after the preload is finished + * Callback function takes 1 argument - object with following properties: + * loaded, skipped, preloadingTime (seconds), total + * + * @static + * + * @since 8.3.0 + * + * @param {Function} callback + */ + static onFinish(callback) { + if (!this._finishListeners) { + this._finishListeners = []; + } + + this._finishListeners.push(callback); } // P methods @@ -378,7 +483,7 @@ DKTools.PreloadManager = class { files = entity.getImageFiles(options).data; } - _.forEach(files, file => { + files.forEach((file) => { const fullPath = file.getFullPath(); if (this._queue[type][fullPath]) { @@ -427,7 +532,7 @@ DKTools.PreloadManager = class { static _processLoadAudioFiles() { const buffers = []; - _.forEach(this._queue.audio, data => { + _.forEach(this._queue.audio, (data) => { const file = new DKTools.IO.File(data.path); const fullPath = file.getFullPath(); @@ -462,7 +567,7 @@ DKTools.PreloadManager = class { } }); - return _.map(buffers, buffer => DKTools.Utils.WebAudio.loadAsync(buffer).then(() => this._onFileLoad(buffer))); + return buffers.map(buffer => DKTools.Utils.WebAudio.loadAsync(buffer).then(() => this._onFileLoad(buffer))); } /** @@ -477,7 +582,7 @@ DKTools.PreloadManager = class { static _processLoadImageFiles() { const bitmaps = []; - _.forEach(this._queue.image, data => { + _.forEach(this._queue.image, (data) => { const file = new DKTools.IO.File(data.path); const fullPath = file.getFullPath(); @@ -516,7 +621,7 @@ DKTools.PreloadManager = class { } }); - return _.map(bitmaps, bitmap => DKTools.Utils.Bitmap.loadAsync(bitmap).then(() => this._onFileLoad(bitmap))); + return bitmaps.map(bitmap => DKTools.Utils.Bitmap.loadAsync(bitmap).then(() => this._onFileLoad(bitmap))); } /** @@ -613,7 +718,7 @@ DKTools.PreloadManager = class { /** * Starts the preloading * - * @version 5.0.0 + * @version 8.3.0 * @static */ static start() { @@ -621,25 +726,27 @@ DKTools.PreloadManager = class { return; } + const total = this.getTotal(); + this._loaded = 0; this._skipped = 0; - this._total = _.size(this._queue.audio) + _.size(this._queue.image); this._startTime = new Date(); this._finishTime = null; - this._log('DKTools Preload Manager is running... \n' + - 'Total files to load: ' + this._total); - - if (this._total === 0) { + if (total === 0) { this._finish(); return; } + this._log('DKTools Preload Manager is running... \n' + + 'Total files to load: ' + total); + const audioPromise = Promise.all(this._processLoadAudioFiles()); const imagePromise = Promise.all(this._processLoadImageFiles()); - Promise.all([audioPromise, imagePromise]).then(() => this._finish()); + Promise.all([audioPromise, imagePromise]) + .then(() => this._finish()); } }; diff --git a/src/DKTools/Scene.js b/src/DKTools/Scene.js index 88cf504..ac8c15e 100644 --- a/src/DKTools/Scene.js +++ b/src/DKTools/Scene.js @@ -41,6 +41,7 @@ DKTools.Scene.prototype._addAllChildren = function() { /** * Adds a listener of change of the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -179,6 +180,7 @@ DKTools.Scene.prototype._createEventManager = function() { /** * Clears the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @see DKTools.OptionManager.prototype.clear @@ -190,6 +192,7 @@ DKTools.Scene.prototype.clearOptions = function() { /** * Clears the events * + * @deprecated 8.3.0 * @version 2.0.0 * * @param {String[] | String} object Array with event types or event type @@ -265,7 +268,8 @@ DKTools.Scene.prototype.createForeground = function() { DKTools.Scene.prototype.destroy = function(options) { this._clearAll(); - this.clearEvents(); + this._eventManager.clearEvents(); + this.deactivate(); Stage.prototype.destroy.call(this, options); @@ -274,6 +278,7 @@ DKTools.Scene.prototype.destroy = function(options) { /** * Turns off the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -287,6 +292,7 @@ DKTools.Scene.prototype.disableOption = function(option) { /** * Turns off the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -302,6 +308,7 @@ DKTools.Scene.prototype.disableOptions = function(object) { /** * Turns on the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -315,6 +322,7 @@ DKTools.Scene.prototype.enableOption = function(option) { /** * Turns on the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -330,6 +338,7 @@ DKTools.Scene.prototype.enableOptions = function(object) { /** * Finishes the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -346,6 +355,7 @@ DKTools.Scene.prototype.finishEvents = function(type, forcedSuccess = false) { /** * Returns a container for the events by event type * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -361,6 +371,7 @@ DKTools.Scene.prototype.getEventsContainerByType = function(type) { /** * Returns a container for the events by event * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -376,6 +387,7 @@ DKTools.Scene.prototype.getEventsContainer = function(event) { /** * Returns an index of the event in its container * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -391,6 +403,7 @@ DKTools.Scene.prototype.getEventIndex = function(event) { /** * Returns an array with the all events or events of a certain type * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} [type] - Type of the events @@ -406,6 +419,7 @@ DKTools.Scene.prototype.getEvents = function(type) { /** * Returns an array with the all animations or animations of a certain type * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} [type] - Type of animation @@ -433,6 +447,7 @@ DKTools.Scene.prototype.hasWindowLayer = function() { * Checks for existence of the event in the object * Returns true if the event exists * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -449,6 +464,7 @@ DKTools.Scene.prototype.hasEvent = function(event) { * Checks for existence of the events of a certain type * Returns true if the events exists * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} [type] - Type of the Events @@ -465,6 +481,7 @@ DKTools.Scene.prototype.hasEvents = function(type) { * Checks for existence of the animation in the object * Returns true if the animation exists * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Animation} animation - Animation @@ -481,6 +498,7 @@ DKTools.Scene.prototype.hasAnimation = function(animation) { * Checks for existence of the animations of a certain type * Returns true if the animations exists * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} [type] - Type of the animations @@ -501,7 +519,7 @@ DKTools.Scene.prototype.hasAnimations = function(type) { * @param {Function} callback - Function for the child objects */ DKTools.Scene.prototype.iterateChildren = function(callback) { - _.forEach(this.children, callback); + this.children.forEach(callback); }; /** @@ -513,10 +531,10 @@ DKTools.Scene.prototype.iterateChildren = function(callback) { */ DKTools.Scene.prototype.isChild = function(object) { if (object instanceof Window && this.hasWindowLayer()) { - return DKTools.Utils.Array.contains(this._windowLayer.children, object); + return this._windowLayer.children.includes(object); } - return DKTools.Utils.Array.contains(this.children, object); + return this.children.includes(object); }; /** @@ -533,6 +551,7 @@ DKTools.Scene.prototype.isDestroyed = function() { /** * Returns true if the option is enabled * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -548,6 +567,7 @@ DKTools.Scene.prototype.isOptionEnabled = function(option) { /** * Returns conjunction of the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -563,6 +583,7 @@ DKTools.Scene.prototype.isOptionsEnabled = function(object) { /** * Returns disjunction of the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -578,6 +599,7 @@ DKTools.Scene.prototype.isSomeOptionsEnabled = function(object) { /** * Returns true if the option is disabled * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -593,6 +615,7 @@ DKTools.Scene.prototype.isOptionDisabled = function(option) { /** * Returns conjunction of the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -608,6 +631,7 @@ DKTools.Scene.prototype.isOptionsDisabled = function(object) { /** * Returns disjunction of the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -623,6 +647,7 @@ DKTools.Scene.prototype.isSomeOptionsDisabled = function(object) { /** * Returns true if some option is enabled * + * @deprecated 8.3.0 * @since 2.0.0 * * @see DKTools.OptionManager.prototype.isSomeOptionEnabled @@ -636,6 +661,7 @@ DKTools.Scene.prototype.isSomeOptionEnabled = function() { /** * Performs a callback function for the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -651,6 +677,7 @@ DKTools.Scene.prototype.iterateEventsContainer = function(type, callback) { * Checks the events for pause * Returns the conjunction of pauses of the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -668,6 +695,7 @@ DKTools.Scene.prototype.isEventsPaused = function(type) { /** * Pauses the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -684,6 +712,7 @@ DKTools.Scene.prototype.pauseEvents = function(type, duration) { /** * Removes the listener of change of the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -699,6 +728,7 @@ DKTools.Scene.prototype.removeOptionChangeListener = function(option, listener) * Removes the event from a container * Returns true if the event was removed * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -714,6 +744,7 @@ DKTools.Scene.prototype.removeEvent = function(event) { /** * Resumes the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -726,13 +757,22 @@ DKTools.Scene.prototype.resumeEvents = function(type) { /** * Removes the window from the scene + * Returns true if the window is removed + * + * @version 8.3.0 * * @param {DKTools.Window | *} window - Window to remove + * + * @returns {Boolean} Window is removed */ DKTools.Scene.prototype.removeWindow = function(window) { if (this.hasWindowLayer() && this.isChild(window)) { this._windowLayer.removeChild(window); + + return true; } + + return false; }; // S methods @@ -831,6 +871,7 @@ DKTools.Scene.prototype.stopAll = function() { /** * Stops the events * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -845,6 +886,7 @@ DKTools.Scene.prototype.stopEvents = function(type, forcedSuccess = false) { /** * Switches the option * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} option - Name of the option @@ -858,6 +900,7 @@ DKTools.Scene.prototype.switchOption = function(option) { /** * Switches the options * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String[] | ...String} object - Names of the options @@ -951,6 +994,7 @@ DKTools.Scene.prototype.updateEvents = function() { /** * Updates the event * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {DKTools.Event | DKTools.Animation} event - Event @@ -964,6 +1008,7 @@ DKTools.Scene.prototype.updateEvent = function(event) { /** * Updates the events from container * + * @deprecated 8.3.0 * @since 2.0.0 * * @param {String} type - Type of the events @@ -977,39 +1022,42 @@ DKTools.Scene.prototype.updateEventsContainer = function(type) { /** * Updates the events with type: ready * + * @version 8.3.0 * @since 2.0.0 * * @see DKTools.EventManager.prototype.updateEventsContainer */ DKTools.Scene.prototype.updateReadyEvents = function() { if (this.isReady()) { - this.updateEventsContainer('ready'); + this._eventManager.updateEventsContainer('ready'); } }; /** * Updates the events with type: update * + * @version 8.3.0 * @since 2.0.0 * * @see DKTools.EventManager.prototype.updateEventsContainer */ DKTools.Scene.prototype.updateUpdateEvents = function() { - this.updateEventsContainer('update'); + this._eventManager.updateEventsContainer('update'); }; /** * Updates the events with type: queue * + * @version 8.3.0 * @since 2.0.0 * * @see DKTools.EventManager.prototype.updateEventsContainer */ DKTools.Scene.prototype.updateQueueEvents = function() { - const container = this.getEventsContainerByType('queue'); + const container = this._eventManager.getEventsContainerByType('queue'); const event = container[0]; - this.updateEvent(event); + this._eventManager.updateEvent(event); }; diff --git a/src/DKTools/Sprite ProgressBar Rectangle.js b/src/DKTools/Sprite ProgressBar Rectangle.js index bd2d0f1..bb3ec7f 100644 --- a/src/DKTools/Sprite ProgressBar Rectangle.js +++ b/src/DKTools/Sprite ProgressBar Rectangle.js @@ -29,12 +29,10 @@ DKTools.Sprite.ProgressBar.Rectangle = class extends DKTools.Sprite.ProgressBar */ standardDrawGraphicHandler() { return () => { - let handler; + let handler = this.standardVerticalDrawGraphicHandler(); if (this.isHorizontal()) { handler = this.standardHorizontalDrawGraphicHandler(); - } else { - handler = this.standardVerticalDrawGraphicHandler(); } if (DKTools.Utils.isFunction(handler)) { diff --git a/src/DKTools/StartupManager.js b/src/DKTools/StartupManager.js index 5f83f4b..de1ba6d 100644 --- a/src/DKTools/StartupManager.js +++ b/src/DKTools/StartupManager.js @@ -39,12 +39,12 @@ DKTools.StartupManager = class { /** * Initializes modules * - * @version 7.0.0 + * @version 8.3.0 * @static * @async */ static async initializeModules() { - // to be overridden by plugins + DKTools.PreloadManager.initialize(); } // C methods diff --git a/src/DKTools/overrides.js b/src/DKTools/overrides.js index 99ae7e2..7f2eff0 100644 --- a/src/DKTools/overrides.js +++ b/src/DKTools/overrides.js @@ -622,7 +622,7 @@ DataManager.isDatabaseLoaded = function() { }; DataManager.onDatabaseLoad = function() { - DKTools.PreloadManager.initialize(); + // to be overriden by plugins }; @@ -1006,15 +1006,95 @@ Scene_Base.prototype.terminate = function() { // Scene_Boot //=========================================================================== +const DKTools_Scene_Boot_create = Scene_Boot.prototype.create; +Scene_Boot.prototype.create = function() { + DKTools_Scene_Boot_create.call(this); + + const params = DKToolsParam.get('Preload Manager', 'Progress Bar'); + + this._showProgressBar = params.Enabled && DKTools.PreloadManager.isEnabled(); + + if (this._showProgressBar) { + if (params.Background) { + this._background = new DKTools.Sprite(); + + this._background.loadSystem(params.Background); + + this.addChild(this._background); + } + + this.createProgressBar(params); + } +}; + +Scene_Boot.prototype.createProgressBar = function(params) { + const width = eval(params['Progress Bar Width']); + const height = eval(params['Progress Bar Height']); + const x = eval(params['Progress Bar X']); + const y = eval(params['Progress Bar Y']); + + this._progressBar = new DKTools.Sprite.ProgressBar.Rectangle(x, y, width, height); + + this._progressBar.setupBackgroundColor(params['Progress Bar Background Color']) + this._progressBar.setupProgressColor(params['Progress Bar Progress Color']); + this._progressBar.setupMaxValue(DKTools.PreloadManager.getTotal()); + this._progressBar.setupValue(0); + + this._progressBar.start(); + + this._progressBar.setupDrawTextHandler(function() { + const text = params['Progress Bar Text'].format(...this._data); + + this.drawText(text, { height: this.height }); + }.bind(this._progressBar)); + + this.addChild(this._progressBar); +}; + const DKTools_Scene_Boot_isReady = Scene_Boot.prototype.isReady; Scene_Boot.prototype.isReady = function() { - return DKTools_Scene_Boot_isReady.call(this) - && DKTools.StartupManager.isReady() - && DKTools.PreloadManager.isReady(); + if (!DKTools_Scene_Boot_isReady.call(this) || !DKTools.StartupManager.isReady()) { + return false; + } + + if (!this._showProgressBar) { + return DKTools.PreloadManager.isReady(); + } + + return true; }; const DKTools_Scene_Boot_start = Scene_Boot.prototype.start; Scene_Boot.prototype.start = function() { + if (this._showProgressBar && !DKTools.PreloadManager.isFinished()) { + const total = DKTools.PreloadManager.getTotal(); + const maxFrames = 180; + const repeatTime = (total > maxFrames ? 1 : Math.ceil(maxFrames / total)); + + DKTools.PreloadManager.onFileLoad((data) => { + this._progressBar.addEvent({ + type: 'queue', + repeats: 0, + repeatTime, + onStart: () => { + this._progressBar._data = [data.file.url, data.loaded, data.total]; + this._progressBar.nextValue(); + } + }); + }); + + this._progressBar.addOneTimeEvent({ + type: 'full', + onSuccess: () => { + this.start(); + } + }); + + DKTools.PreloadManager.start(); + + return; + } + const quickStart = DKToolsParam.get('Quick Start'); if (quickStart['Enabled']) {