code:
/*:
 * @plugindesc Manage Skip and Already-Read Texts
 * @author siguren
 *
 * @target MZ
 *
 * @command DisableReadCheck
 * @text Disable Already-Read Check
 * @desc Disables recording and check for Already-Read until this event is completed.
 *
 * @command EnableReadCheck
 * @text Enable Already-Read Check
 * @desc Enables recording and check for Already-Read until this event is completed.
 * Nothing happens if you enable it during a common event.
 *
 * @command DisplayKidokuState
 * @text Open Already-Read Flag viewing screen.
 * @desc The content is for advanced users.
 *
 * @param skipModeSwtich
 * @text Skip:Control Switch
 * @desc When turned ON, fast-forwards when an Already-Read text appears.
 * @type switch
 * @default 0
 *
 * @param ctrlSkip
 * @text Skip:Enable skip with CTRL key
 * @desc It will be in Skip mode while CTRL key is pressed.
 * @type boolean
 * @default true
 *
 * @param kidokuTextColorIndex
 * @text Setting for Already-Read text color
 * @type number
 * @default 6
 *
 * @param excludedCharacters
 * @text Events that do not record Already-Read Texts
 * @desc There will be no Already-Read Check for events with the specified walking graphic.
 *
 * @type file[]
 * @dir img/characters
 * @default ["!SF_Chest","!Chest"]
 *
 * @help
 * Manage Already-Read for sentences.
 * One Already-Read Flag uses 8bytes.
 *
 * The line number of the event command is used for saving.
 * Rewriting the event data makes the Already-Read data inaccurate.
 * Since line numbers are saved in 12bit (max4095),
 * if the event's page content is too large, it may not be saved correctly.
 *
 *It will not record if the call hierarchy of common events is deep.
 *
 * The Already-Read flag is independent of each page of events.
 * Data is not mixed with other events or event pages.
 *
 * ■Changing Already-Read text color
 * Change the color of sentences or options that have already been displayed or selected.
 * The color is changed when the text color is set to default or \c[0].
 *
 * ■Disabling Already-Read Check
 * Already-Read Check can be disabled for events that
 * do not require them, such as texts in stores and inns.
 *
 * ■Already-Read Check Restriction for Common Events
 * Already-Read Check cannot be activated when restricted.
 * Already-Read Check is prohibited in the following situations.
 * ・Common Events of Parallel Execution
 * ・Common Events under Automatic Execution
 * ・Events that are invoked during combat
 *
 * ■About Already-Read Skip Mode
 * It will be in Already-Read Skip Mode when the specified switch is ON, or while the CTRL key is pressed.
 *
 * In this mode, texts that are already read will be skipped.
 * It will pause if there is an unread text.
 *
 * ■About Already-Read Flag viewing screen
 * The Already-Read Flag viewing screen can be opened by the plugin command.
 * Although it is made to be somewhat easy to read,
 * it is intended for advanced users.
 *
 * ■About the Already-Read Flag Save Data
 * A dedicated file is created for this.
 * It will be shared among multiple saved data.
 * The file size will be about 100KB at the most.
 *
 */

////////////////////////////////////////////////////////////////////////////////////////

/*:
 * @plugindesc 既読の管理・スキップ
 * @author しぐれん
 *
 * @target MZ
 *
 * @command DisableReadCheck
 * @text 既読チェックの無効化
 * @desc このイベントが終了するまで既読の記録・確認を無効化します。
 *
 * @command EnableReadCheck
 * @text 既読チェックの有効化
 * @desc このイベントが終了するまで既読の記録・確認を有効化します。
 * コモンイベント内で実行した場合は、何も起きません。
 *
 * @command DisplayKidokuState
 * @text 既読フラグ閲覧画面を開く
 * @desc 表示内容は上級者向けです。
 *
 * @param skipModeSwtich
 * @text スキップ:制御スイッチ
 * @desc ONの場合、既読テキストが来た時に早送りします。
 * スキップ中キャンセル操作を行うと、スイッチをOFFにします。
 * @type switch
 * @default 0
 *
 * @param ctrlSkip
 * @text スキップ:CTRLキーで有効化
 * @desc CTRLキーが押されている間、スキップモードになります。
 * @type boolean
 * @default true
 *
 * @param kidokuTextColorIndex
 * @text 既読テキスト色設定
 * @type number
 * @default 6
 *
 * @param excludedCharacters
 * @text 既読を記録しないイベント
 * @desc 指定した歩行グラフィックのイベントは
 * 既読チェックを行いません。
 * @type file[]
 * @dir img/characters
 * @default ["!SF_Chest","!Chest"]
 *
 * @help
 * 文章の既読を管理します。
 * 一つの既読フラグで8byte使います。
 *
 * イベントコマンドの行番号を使って保存しています。
 * イベントデータを書き換えると、既読データが不正確になります。
 * 行番号は12bit(最大4095)で保存しているため、
 * イベントのページ内容が巨大だと正しく保存されない可能性があります。
 *
 * コモンイベントの呼び出し階層が深い場合、記録を行いません。
 *
 * 既読フラグはイベントのページごとに独立しています。
 * 他のイベントや他のイベントページとデータが混ざることはありません。
 *
 * ■既読テキストの色変更
 * 既に表示されたことのある文章・既に選んだことのある選択肢の色を変えます。
 * テキストの色が初期値または\c[0]で通常色になっている場合、色が変更されます。
 *
 * ■既読チェックの無効化
 * ショップや宿屋などの既読チェックをする必要が無いイベントでは、
 * 既読チェックを無効化できます。
 *
 * ■コモンイベントでの既読チェック禁止処理
 * 禁止されている状態では、既読チェックを有効化できません。
 * 以下の状況では既読チェックが禁止されます。
 * ・並列実行のコモンイベント
 * ・自動実行のコモンイベント
 * ・戦闘中に呼び出されたイベント
 *
 * ■既読スキップモードについて
 * 指定のスイッチがONの場合、またはCTRLキーが押し続けられている間は、
 * 既読スキップモードになります。
 * 既読スキップモードでは、既読文章が表示された場合に文章をスキップします。
 * 既読ではない文章の場合、そこで一時停止します。
 *
 * スイッチがONの場合にキャンセル操作が行われると、
 * スイッチをOFFにしてスキップ状態を終了します。
 *
 * ■既読フラグ閲覧画面について
 * プラグインコマンドで既読フラグ閲覧画面を呼び出せます。
 * ある程度は見やすくしてありますが、
 * 上級者向け扱いです。
 *
 * ■既読フラグのセーブデータについて
 * 専用のファイルを作成します。
 * 複数のセーブデータ間で共有されます。
 * 大きくても100KBほどに収まります。
 *
 */

const _0x5f0d0a = _0x21a4;
(function (_0x24c5f5, _0x349418) {
  const _0x470911 = _0x21a4,
    _0x4a8a70 = _0x24c5f5();
  while (!![]) {
    try {
      const _0x2cd823 =
        (parseInt(_0x470911(0x152)) / 0x1) *
          (parseInt(_0x470911(0x1d5)) / 0x2) +
        (parseInt(_0x470911(0x21a)) / 0x3) *
          (-parseInt(_0x470911(0x1a5)) / 0x4) +
        parseInt(_0x470911(0x1a7)) / 0x5 +
        (parseInt(_0x470911(0x21f)) / 0x6) *
          (-parseInt(_0x470911(0x173)) / 0x7) +
        -parseInt(_0x470911(0x155)) / 0x8 +
        (parseInt(_0x470911(0x1b3)) / 0x9) *
          (-parseInt(_0x470911(0x18d)) / 0xa) +
        parseInt(_0x470911(0x1bc)) / 0xb;
      if (_0x2cd823 === _0x349418) break;
      else _0x4a8a70["push"](_0x4a8a70["shift"]());
    } catch (_0x2cab71) {
      _0x4a8a70["push"](_0x4a8a70["shift"]());
    }
  }
})(_0x3526, 0xc9c6c);
class KidokuEventData {
  [_0x5f0d0a(0x16d)]() {
    const _0x48d5d3 = _0x5f0d0a;
    return this[_0x48d5d3(0x1f6)];
  }
  get [_0x5f0d0a(0x1ea)]() {
    return this["_eventId"];
  }
  ["getPageIndex"]() {
    const _0x1950b8 = _0x5f0d0a;
    return this[_0x1950b8(0x221)];
  }
  get [_0x5f0d0a(0x16a)]() {
    const _0x1c0878 = _0x5f0d0a;
    return this[_0x1c0878(0x221)];
  }
  constructor() {
    const _0x1f5190 = _0x5f0d0a;
    this[_0x1f5190(0x168)]();
  }
  ["clear"]() {
    this["set"](0x0, 0x0);
  }
  [_0x5f0d0a(0x1aa)](_0x1ade9d, _0x49d3b6) {
    const _0xc01f6c = _0x5f0d0a;
    (this["_eventId"] = _0x1ade9d), (this[_0xc01f6c(0x221)] = _0x49d3b6);
  }
}
class KidokuEventState {
  constructor() {
    const _0x3dfd5b = _0x5f0d0a;
    this[_0x3dfd5b(0x1d2)](),
      this[_0x3dfd5b(0x17f)](NaN),
      this[_0x3dfd5b(0x222)](![]);
  }
  [_0x5f0d0a(0x222)](_0x4011d1) {
    const _0x47e654 = _0x5f0d0a;
    this[_0x47e654(0x1fd)] = _0x4011d1;
  }
  [_0x5f0d0a(0x200)]() {
    const _0x5e9ac3 = _0x5f0d0a;
    return this[_0x5e9ac3(0x1fd)];
  }
  ["setLastMassageLine"](_0x4ec06c, _0x2f6225) {
    const _0x3477e2 = _0x5f0d0a;
    (this[_0x3477e2(0x1f0)] = _0x2f6225), (this[_0x3477e2(0x1bf)] = _0x4ec06c);
  }
  [_0x5f0d0a(0x1d2)]() {
    this["setLastMassageLine"](0x0, 0x0);
  }
  [_0x5f0d0a(0x203)]() {
    return this["_lastMessageLine"];
  }
  [_0x5f0d0a(0x1ef)]() {
    const _0x2ce652 = _0x5f0d0a;
    return this[_0x2ce652(0x1bf)];
  }
  [_0x5f0d0a(0x17f)](_0xc89f77) {
    const _0x267778 = _0x5f0d0a;
    this[_0x267778(0x1d6)] = _0xc89f77;
  }
  [_0x5f0d0a(0x20f)]() {
    const _0x16cdb7 = _0x5f0d0a;
    return this[_0x16cdb7(0x1d6)];
  }
}
class KidokuFlags {
  constructor() {
    const _0x6275c5 = _0x5f0d0a;
    this[_0x6275c5(0x1af)] = [null];
  }
  [_0x5f0d0a(0x159)](_0x7e8c37) {
    const _0xa62840 = _0x5f0d0a;
    if (_0x7e8c37 > 0x0) {
      if (this["_table"][_0x7e8c37]) return this[_0xa62840(0x1af)][_0x7e8c37];
    }
    return [];
  }
  [_0x5f0d0a(0x193)](_0x5e924b, _0x2186da) {
    const _0x19f5cd = _0x5f0d0a;
    if (_0x5e924b > 0x0) {
      const _0x398f79 = Array[_0x19f5cd(0x201)](_0x2186da);
      this[_0x19f5cd(0x1af)][_0x5e924b] = _0x398f79;
    }
  }
  [_0x5f0d0a(0x215)]() {
    const _0x2e6438 = _0x5f0d0a,
      _0x1b6445 = [],
      _0x3d4482 = this[_0x2e6438(0x1af)][_0x2e6438(0x1b9)];
    for (let _0x8be226 = 0x0; _0x8be226 < _0x3d4482; _0x8be226++) {
      this[_0x2e6438(0x1af)][_0x8be226] &&
        _0x1b6445[_0x2e6438(0x19f)](_0x8be226);
    }
    return _0x1b6445;
  }
}
function _0x21a4(_0x20b4bc, _0x347ab6) {
  const _0x3526e0 = _0x3526();
  return (
    (_0x21a4 = function (_0x21a4b3, _0x572f6d) {
      _0x21a4b3 = _0x21a4b3 - 0x152;
      let _0x1a680d = _0x3526e0[_0x21a4b3];
      return _0x1a680d;
    }),
    _0x21a4(_0x20b4bc, _0x347ab6)
  );
}
class KidokuContents {
  ["setReadcheckEnable"](_0x5ecad2) {
    const _0x3e482a = _0x5f0d0a;
    this[_0x3e482a(0x1b4)][_0x3e482a(0x222)](_0x5ecad2);
  }
  constructor(_0x52f4a4) {
    const _0x3488f8 = _0x5f0d0a;
    (this[_0x3488f8(0x1a4)] = new KidokuFlags()),
      (this[_0x3488f8(0x202)] = new KidokuEventData()),
      (this[_0x3488f8(0x1b4)] = new KidokuEventState()),
      (this[_0x3488f8(0x1c0)] = _0x52f4a4),
      this["setMapId"](0x0);
  }
  [_0x5f0d0a(0x215)]() {
    const _0x4b69be = _0x5f0d0a;
    return this["_flags"][_0x4b69be(0x215)]();
  }
  [_0x5f0d0a(0x176)](_0x2c50d3, _0x42fd77) {
    const _0x60ea51 = _0x5f0d0a;
    this[_0x60ea51(0x202)][_0x60ea51(0x1aa)](_0x2c50d3, _0x42fd77);
  }
  [_0x5f0d0a(0x163)]() {
    const _0x39261e = _0x5f0d0a;
    this["_eventData"][_0x39261e(0x168)](),
      this[_0x39261e(0x1b4)]["setWritePermission"](![]);
  }
  [_0x5f0d0a(0x1ad)](_0xf3e15a, _0x5a8fa7) {
    const _0x316453 = _0x5f0d0a,
      _0x5e534b = this[_0x316453(0x1b4)][_0x316453(0x20f)]();
    if (
      this[_0x316453(0x1b4)][_0x316453(0x1ef)]() === _0xf3e15a &&
      !isNaN(_0x5e534b)
    )
      return this[_0x316453(0x20e)](
        this[_0x316453(0x202)],
        _0xf3e15a,
        _0x5e534b,
        _0x5a8fa7
      );
    return 0x0;
  }
  ["shift32bit"](_0xd99bf9) {
    return (_0xd99bf9 & 0x7fffffff) * 0x100000000;
  }
  [_0x5f0d0a(0x20e)](_0x2d1f56, _0x3326d2, _0x19a109, _0x442caf) {
    const _0x208773 = _0x5f0d0a,
      _0x490b48 =
        (_0x2d1f56[_0x208773(0x16d)]() & 0xff) |
        ((_0x2d1f56["getPageIndex"]() & 0x1f) << 0x8) |
        ((_0x3326d2 & 0x7) << 0xd) |
        ((_0x442caf & 0x7fff) << 0x10),
      _0x4d1f58 = this["shift32bit"](_0x19a109);
    return _0x490b48 + _0x4d1f58;
  }
  ["createMessageBit"](_0x2e7b2b, _0x3d1924) {
    const _0x2c4d5e = _0x5f0d0a;
    return this[_0x2c4d5e(0x20e)](
      this["_eventData"],
      _0x2e7b2b,
      _0x3d1924,
      0x7fff
    );
  }
  [_0x5f0d0a(0x17f)](_0x26bd42) {
    const _0x460c32 = _0x5f0d0a;
    this[_0x460c32(0x1b4)]["setChoiceHedder"](_0x26bd42);
  }
  ["setLastMassageLine"](_0x19ff79, _0x2adc11) {
    const _0x38a21f = _0x5f0d0a;
    this[_0x38a21f(0x1b4)][_0x38a21f(0x17c)](_0x19ff79, _0x2adc11);
  }
  [_0x5f0d0a(0x1a0)]() {
    const _0x173f1e = _0x5f0d0a;
    return this[_0x173f1e(0x1c0)];
  }
  [_0x5f0d0a(0x1ef)]() {
    const _0xfe1f5c = _0x5f0d0a;
    return this[_0xfe1f5c(0x1b4)][_0xfe1f5c(0x1ef)]();
  }
  ["saveMapData"](_0x866bc5) {
    const _0x3fe892 = _0x5f0d0a;
    this["_flags"][_0x3fe892(0x193)](this[_0x3fe892(0x1c7)](), _0x866bc5);
  }
  [_0x5f0d0a(0x15e)]() {
    const _0x5b82c8 = _0x5f0d0a;
    return (
      this[_0x5b82c8(0x202)] &&
      this[_0x5b82c8(0x202)][_0x5b82c8(0x1ea)] > 0x0 &&
      this["_state"]["canWriteng"]()
    );
  }
  ["eventId"]() {
    const _0x40f8cb = _0x5f0d0a;
    return this["_eventData"][_0x40f8cb(0x16d)]();
  }
  [_0x5f0d0a(0x1c7)]() {
    const _0x3025fd = _0x5f0d0a;
    return this[_0x3025fd(0x1a3)];
  }
  [_0x5f0d0a(0x205)](_0x14c67f) {
    const _0x57243c = _0x5f0d0a;
    this[_0x57243c(0x1a3)] = _0x14c67f;
  }
  [_0x5f0d0a(0x17b)](_0x527f66) {
    const _0x1521e6 = _0x5f0d0a;
    return this["_flags"][_0x1521e6(0x159)](_0x527f66);
  }
}
function _0x3526() {
  const _0x23594a = [
    "_eventId",
    "setHandler",
    "prototype",
    "processColorChange",
    "DisableReadCheck",
    "isEndOfText",
    "getMapFlags",
    "_writePermission",
    "extractSaveContents",
    "setContents",
    "canWriteng",
    "from",
    "_eventData",
    "lastMessageLine",
    "popScene",
    "setMapId",
    "ctrlSkip",
    "drawItem",
    "startWait",
    "DisplayKidokuState",
    "toString",
    "control",
    "onMessage",
    "right",
    "createEventBitV2",
    "choiceHedder",
    "_showFast",
    "isCtrlSkipPressed",
    "loadPlayerData",
    "setup",
    "round",
    "mapNumbers",
    "changeTextColor",
    "isCancelled",
    "obtainEventName",
    "currentEventId",
    "48YQMDUE",
    "padStart",
    "updateShowFast",
    "itemAt",
    "kidokuFlagRect",
    "2809644vmZgZl",
    "makeContents",
    "_pageIndex",
    "setWritePermission",
    "isPressed",
    "setReadcheckEnable",
    "1hvsnZy",
    "isClicked",
    "callUpdateHelp",
    "302576hFebxF",
    "obtainEventId",
    "drawText",
    "createKidokFlagWindow",
    "getFlags",
    "contents",
    "left",
    "setValue",
    "isSelectedChoice",
    "canWrite",
    "isSheredStorage",
    "fileAccessEnd",
    "terminateSkipMode",
    "needsMessageShowFast",
    "clearEventData",
    "skipModeSwtich",
    "KIDOKU",
    "isEventValid",
    "_mapId",
    "clear",
    "index",
    "pageIndex",
    "width",
    "parameters",
    "getEventId",
    "select",
    "setupChoices",
    "save",
    "_set",
    "isSkipMode",
    "21dzHilD",
    "bind",
    "value",
    "setupEventData",
    "maxItems",
    "advanced",
    "onChoiceSelected",
    "gameId",
    "loadMapData",
    "setLastMassageLine",
    "getSaveContents",
    "call",
    "setChoiceHedder",
    "onEventStart",
    "excludedCharacters",
    "lastIndexOf",
    "setupMapData",
    "onMadLoad",
    "areReadChecksAllowed",
    "indexOf",
    "table",
    "_pauseSkip",
    "error",
    "_list",
    "map",
    "createMessageBit",
    "178870PiNcxV",
    "currentMapValues",
    "onMapListOk",
    "colorIndex",
    "saveGame",
    "_mapListWindow",
    "saveMapData",
    "onChoiceDrawItem",
    "loadContents",
    "hasChanged",
    "mainAreaTop",
    "saveKidokBits",
    "ManoUZ_Kidoku_AlreadyRead",
    "tryLoadContents",
    "_flagWindow",
    "create",
    "cancel",
    "loadObject",
    "push",
    "version",
    "mapListWindowRect",
    "deselect",
    "_mapIdV2",
    "_flags",
    "58472MVVAZR",
    "saveCurrentData",
    "5748490LPRJre",
    "needsColorChange",
    "_sharedAccessState",
    "set",
    "Kidoku\x20Load\x20falled",
    "depthValid",
    "createChoiceBit",
    "setText",
    "_table",
    "valueAt",
    "finally",
    "clearTemp",
    "414kVcseX",
    "_state",
    "_index",
    "flushTextState",
    "canFileAccess",
    "Map",
    "length",
    "refresh",
    "numberWindowWidth",
    "7097827FUkuql",
    "_parallelGuard",
    "kidokuTextColor",
    "_depth",
    "_version",
    "event",
    "KidokuValue:",
    "textColor",
    "mapNameText",
    "updateHelp",
    "command402",
    "mapId",
    "saveShared",
    "page:",
    "name",
    "onEventEnd",
    "createMapListWindow",
    "command101",
    "choiceTable",
    "addWindow",
    "add",
    "has",
    "clearLastMessageLine",
    "initialize",
    "update",
    "3061710rsAGqc",
    "_choiceHedder",
    "itemRectWithPadding",
    "obtainPageIndex",
    "isTriggered",
    "resetTextColor",
    "colorChanging",
    "setParallelGuard",
    "windowLink",
    "selectOf",
    "createAllWindows",
    "mainAreaHeight",
    "_flagListWindow",
    "createGameObjects",
    "_helpWindow",
    "then",
    "updateWait",
    "setFlagWindow",
    "onSetupChoice",
    "_contents",
    "onKidokuFlagCancel",
    "eventId",
    "setHelpWindow",
    "registerCommand",
    "createHelpText",
    "setMapNumbers",
    "depth",
    "_lastMessageLine",
    "canWriting",
    "_readonlryData",
    "loadShared",
    "activate",
    "_temp",
  ];
  _0x3526 = function () {
    return _0x23594a;
  };
  return _0x3526();
}
(function () {
  "use stirct";
  const _0x3bd751 = _0x5f0d0a;
  const _0x587dd2 = 0x1348c57,
    _0x5e1531 = _0x3bd751(0x165),
    _0x4b9938 = "kidoku",
    _0x439506 = _0x3bd751(0x199);
  function _0x56401c() {
    const _0x1ef3eb = _0x3bd751;
    return PluginManager[_0x1ef3eb(0x16c)](_0x439506);
  }
  const _0x1b6c8e = (_0x1f40e2) => {
    return (_0x1f40e2 & 0x7fffffff) * 0x100000000;
  };
  class _0x416219 {
    [_0x3bd751(0x224)](_0x548375) {
      const _0x3f7dda = _0x3bd751;
      this[_0x3f7dda(0x1e8)][_0x3f7dda(0x224)](_0x548375);
    }
    constructor(_0x1adb3e) {
      const _0x1ddaed = _0x3bd751;
      (this["_readonlryData"] = _0x1adb3e),
        (this[_0x1ddaed(0x171)] = new Set()),
        this[_0x1ddaed(0x1ff)](null),
        this[_0x1ddaed(0x1b2)](),
        (this[_0x1ddaed(0x1a9)] = ""),
        this[_0x1ddaed(0x1dc)](![]);
    }
    [_0x3bd751(0x166)](_0x28d79d) {
      const _0x35b485 = _0x3bd751;
      if (_0x28d79d) {
        const _0x3dfdb5 = _0x28d79d["characterName"]();
        return !this[_0x35b485(0x1f2)]["excludedCharacters"][_0x35b485(0x1d1)](
          _0x3dfdb5
        );
      }
      return ![];
    }
    [_0x3bd751(0x185)](_0x70e3ca) {}
    [_0x3bd751(0x180)](_0x369117, _0x209564) {
      const _0x129f4b = _0x3bd751,
        _0x434cc6 = $gameMap[_0x129f4b(0x1c1)](_0x369117),
        _0x2f7e43 = this["isEventValid"](_0x434cc6);
      this[_0x129f4b(0x1e8)]["setReadcheckEnable"](_0x2f7e43);
      if (_0x369117 > 0x0) {
        const _0x2b0f9e = _0x434cc6[_0x129f4b(0x221)];
        this[_0x129f4b(0x1e8)][_0x129f4b(0x176)](_0x369117, _0x2b0f9e),
          this[_0x129f4b(0x183)](_0x209564);
      } else this["_contents"][_0x129f4b(0x163)]();
    }
    ["onEventEnd"](_0x14acb8) {}
    [_0x3bd751(0x1b2)]() {
      const _0x252a38 = _0x3bd751;
      this[_0x252a38(0x1f5)] = {
        hasChanged: ![],
        colorChanging: ![],
        choiceTable: [],
      };
    }
    [_0x3bd751(0x220)]() {
      const _0x2b2104 = _0x3bd751;
      !this[_0x2b2104(0x1e8)] &&
        ((this[_0x2b2104(0x1e8)] = new KidokuContents(
          this[_0x2b2104(0x1a0)]()
        )),
        (this[_0x2b2104(0x171)] = new Set()));
    }
    [_0x3bd751(0x1a0)]() {
      return _0x587dd2;
    }
    [_0x3bd751(0x198)](_0x31ce1f) {
      const _0x279c25 = _0x3bd751;
      if (_0x31ce1f > 0x0)
        this[_0x279c25(0x171)][_0x279c25(0x1d0)](_0x31ce1f),
          (this[_0x279c25(0x1f5)]["hasChanged"] = !![]);
      else {
        const _0x810cd6 = _0x31ce1f[_0x279c25(0x20a)](0x10);
        throw new Error(_0x279c25(0x1c2) + _0x810cd6);
      }
    }
    [_0x3bd751(0x1ff)](_0xe6f75d) {
      const _0x133d91 = _0x3bd751;
      this[_0x133d91(0x1e8)] = _0xe6f75d;
    }
    [_0x3bd751(0x17d)]() {
      const _0x3fb34e = _0x3bd751;
      return this["saveCurrentData"](), this[_0x3fb34e(0x1e8)];
    }
    [_0x3bd751(0x195)](_0xcd4f11) {
      const _0x20a879 = _0x3bd751;
      this[_0x20a879(0x1ff)](null), (this[_0x20a879(0x171)] = null);
      if (this[_0x20a879(0x19a)](_0xcd4f11)) {
      }
      this[_0x20a879(0x220)]();
    }
    [_0x3bd751(0x19a)](_0x506b7c) {
      const _0x456a82 = _0x3bd751;
      if (!_0x506b7c) return !![];
      try {
        if (_0x587dd2 === _0x506b7c[_0x456a82(0x1a0)]()) {
          const _0x3e4ce1 = _0x506b7c[_0x456a82(0x1c7)](),
            _0x5dc833 = _0x506b7c["loadMapData"](_0x3e4ce1);
          return (
            this[_0x456a82(0x1ff)](_0x506b7c),
            (this[_0x456a82(0x171)] = new Set(_0x5dc833)),
            !![]
          );
        }
      } catch (_0x35ac82) {
        console[_0x456a82(0x189)](_0x456a82(0x1ab)),
          console[_0x456a82(0x187)](_0x506b7c);
      }
      return ![];
    }
    [_0x3bd751(0x219)]() {
      const _0x193d86 = _0x3bd751;
      return this[_0x193d86(0x1e8)][_0x193d86(0x1ea)]();
    }
    ["depthValid"](_0x1b5d89) {
      return _0x1b5d89 <= 0x7;
    }
    [_0x3bd751(0x20c)](_0x57aa32, _0x15ee9f) {
      const _0x1d400d = _0x3bd751;
      if (this["canWriting"]() && this[_0x1d400d(0x1ac)](_0x57aa32)) {
        this[_0x1d400d(0x1e8)][_0x1d400d(0x17c)](_0x57aa32, _0x15ee9f);
        const _0x6fbb1a = this[_0x1d400d(0x1e8)][_0x1d400d(0x18c)](
          _0x57aa32,
          _0x15ee9f
        );
        (this["_temp"][_0x1d400d(0x1db)] =
          this[_0x1d400d(0x171)][_0x1d400d(0x1d1)](_0x6fbb1a)),
          this[_0x1d400d(0x198)](_0x6fbb1a);
      } else this[_0x1d400d(0x1f5)]["colorChanging"] = ![];
    }
    [_0x3bd751(0x1e7)](_0x3edb24, _0x285f8a, _0x208b0e) {
      const _0x5db5b9 = _0x3bd751;
      if (this[_0x5db5b9(0x1f1)]() && this[_0x5db5b9(0x1ac)](_0x285f8a)) {
        this[_0x5db5b9(0x1e8)][_0x5db5b9(0x17f)](_0x3edb24);
        const _0x5bb982 = _0x208b0e[_0x5db5b9(0x18b)](
          (_0x2e96bd, _0x5b1588) => {
            const _0x32d5c7 = _0x5db5b9,
              _0x2339c5 = this[_0x32d5c7(0x1e8)]["createChoiceBit"](
                _0x285f8a,
                _0x5b1588
              );
            return this[_0x32d5c7(0x171)]["has"](_0x2339c5);
          }
        );
        this[_0x5db5b9(0x1f5)][_0x5db5b9(0x1ce)] = _0x5bb982;
      } else this["_temp"][_0x5db5b9(0x1ce)] = [];
    }
    [_0x3bd751(0x179)](_0x482098, _0x5ccf7c, _0x4e4420) {
      const _0x121464 = _0x3bd751;
      if (this[_0x121464(0x1f1)]()) {
        const _0x590fc4 = this["_contents"][_0x121464(0x1ad)](
          _0x482098,
          _0x5ccf7c
        );
        (this[_0x121464(0x1f5)]["colorChanging"] = ![]),
          this[_0x121464(0x198)](_0x590fc4),
          this[_0x121464(0x1e8)][_0x121464(0x17f)](NaN);
      }
    }
    ["isSelectedChoice"](_0x5560f4, _0x5825bb) {
      const _0x11e04b = _0x3bd751;
      return !!this[_0x11e04b(0x1f5)][_0x11e04b(0x1ce)][_0x5560f4];
    }
    [_0x3bd751(0x1a8)]() {
      return this["_temp"]["colorChanging"];
    }
    ["kidokuTextColor"]() {
      const _0x33ede9 = _0x3bd751;
      return ColorManager[_0x33ede9(0x1c3)](
        this[_0x33ede9(0x1f2)][_0x33ede9(0x190)]
      );
    }
    [_0x3bd751(0x194)](_0x1acf13) {
      const _0x3b5a28 = _0x3bd751;
      this[_0x3b5a28(0x1f5)][_0x3b5a28(0x1db)] = this[_0x3b5a28(0x15d)](
        _0x1acf13,
        ""
      );
    }
    [_0x3bd751(0x18e)]() {
      const _0x93c9d5 = _0x3bd751;
      return this[_0x93c9d5(0x171)];
    }
    [_0x3bd751(0x184)](_0xb7e9ec) {
      this["saveCurrentData"]();
    }
    [_0x3bd751(0x183)](_0xc6742a) {
      const _0x2cb482 = _0x3bd751;
      if (this[_0x2cb482(0x1e8)][_0x2cb482(0x1c7)]() !== _0xc6742a) {
        const _0x3a6ee3 = this[_0x2cb482(0x1e8)][_0x2cb482(0x17b)](_0xc6742a);
        (this["_set"] = new Set(_0x3a6ee3)),
          this["_contents"][_0x2cb482(0x205)](_0xc6742a);
      }
    }
    [_0x3bd751(0x1a6)]() {
      const _0x3c9d6f = _0x3bd751;
      this[_0x3c9d6f(0x1f5)][_0x3c9d6f(0x196)] &&
        this[_0x3c9d6f(0x171)]["size"] > 0x0 &&
        (this[_0x3c9d6f(0x1e8)][_0x3c9d6f(0x193)](this[_0x3c9d6f(0x171)]),
        (this["_temp"][_0x3c9d6f(0x196)] = ![]));
    }
    [_0x3bd751(0x215)]() {
      const _0x3e36ea = _0x3bd751;
      return this[_0x3e36ea(0x1e8)][_0x3e36ea(0x215)]();
    }
    ["getMapFlags"](_0xc2cdac) {
      const _0x517a74 = _0x3bd751,
        _0x387b6e =
          this[_0x517a74(0x1e8)][_0x517a74(0x1a4)]["getFlags"](_0xc2cdac);
      return _0x387b6e;
    }
    [_0x3bd751(0x15f)]() {
      return !![];
    }
    [_0x3bd751(0x1b7)]() {
      const _0x3e70e1 = _0x3bd751;
      return this[_0x3e70e1(0x15f)]() && this[_0x3e70e1(0x1a9)] === "";
    }
    ["fileAccessEnd"]() {
      const _0x2f43c4 = _0x3bd751;
      this[_0x2f43c4(0x1a9)] = "";
    }
    [_0x3bd751(0x1f3)]() {
      const _0x559693 = _0x3bd751;
      this[_0x559693(0x1b7)]() &&
        ((this["_sharedAccessState"] = "load"),
        StorageManager[_0x559693(0x19e)](_0x4b9938)
          [_0x559693(0x1e4)]((_0x1b2cfc) => {
            const _0x4b0fb1 = _0x559693;
            return (
              $dataSystem[_0x4b0fb1(0x178)][_0x4b0fb1(0x17a)] ===
                _0x1b2cfc[_0x4b0fb1(0x17a)] &&
                this["loadContents"](_0x1b2cfc[_0x4b0fb1(0x15a)]),
              0x0
            );
          })
          ["catch"](() => {
            const _0x50fd09 = _0x559693;
            this[_0x50fd09(0x220)]();
          })
          [_0x559693(0x1b1)](() => {
            const _0x1e7ad8 = _0x559693;
            this[_0x1e7ad8(0x160)]();
          }));
    }
    [_0x3bd751(0x1c8)]() {
      const _0x479df5 = _0x3bd751;
      if (this["canFileAccess"]()) {
        (this["_sharedAccessState"] = _0x479df5(0x170)), $dataSystem;
        const _0xf4fea5 = {
          gameId: $dataSystem["advanced"][_0x479df5(0x17a)],
          contents: this[_0x479df5(0x1e8)],
        };
        StorageManager["saveObject"](_0x4b9938, _0xf4fea5)
          [_0x479df5(0x1e4)](() => {
            return 0x0;
          })
          [_0x479df5(0x1b1)](() => this[_0x479df5(0x160)]());
      }
    }
    [_0x3bd751(0x1f1)]() {
      const _0x5501f6 = _0x3bd751;
      return !this[_0x5501f6(0x1bd)] && this["_contents"][_0x5501f6(0x15e)]();
    }
    [_0x3bd751(0x1dc)](_0x16d796) {
      const _0xa023c6 = _0x3bd751;
      this[_0xa023c6(0x1bd)] = _0x16d796;
    }
    ["isSkipMode"]() {
      const _0x116a2f = _0x3bd751;
      return $gameSwitches[_0x116a2f(0x175)](
        this["_readonlryData"][_0x116a2f(0x164)]
      );
    }
    [_0x3bd751(0x162)]() {
      const _0x2c283e = _0x3bd751;
      return (
        this[_0x2c283e(0x1f5)]["colorChanging"] &&
        (this[_0x2c283e(0x172)]() || this[_0x2c283e(0x211)]())
      );
    }
    [_0x3bd751(0x211)]() {
      const _0x1b195a = _0x3bd751;
      return (
        this[_0x1b195a(0x1f2)][_0x1b195a(0x206)] &&
        this[_0x1b195a(0x1f5)]["colorChanging"] &&
        Input[_0x1b195a(0x223)](_0x1b195a(0x20b))
      );
    }
    [_0x3bd751(0x161)]() {
      const _0x409528 = _0x3bd751;
      $gameSwitches[_0x409528(0x15c)](
        this["_readonlryData"][_0x409528(0x164)],
        ![]
      );
    }
  }
  const _0x203713 = (() => {
      const _0x2cc572 = _0x3bd751,
        _0xa45ce0 = _0x56401c(),
        _0xf76974 = JSON["parse"](_0xa45ce0[_0x2cc572(0x181)] || "[]"),
        _0x1dea7c = {
          ctrlSkip: !![],
          colorIndex: Number(_0xa45ce0["kidokuTextColorIndex"] || 0x6),
          skipModeSwtich: Number(_0xa45ce0["skipModeSwtich"] || 0x0),
          excludedCharacters: new Set(_0xf76974),
        };
      return new _0x416219(_0x1dea7c);
    })(),
    _0x2b2107 = Game_Interpreter[_0x3bd751(0x1f8)]["command402"];
  Game_Interpreter[_0x3bd751(0x1f8)][_0x3bd751(0x1c6)] = function (_0x2f2903) {
    const _0x4270a6 = _0x3bd751,
      _0x572df7 = this[_0x4270a6(0x1b5)],
      _0x3686fb = _0x2b2107[_0x4270a6(0x17e)](this, _0x2f2903);
    return (
      _0x572df7 === this[_0x4270a6(0x1b5)] &&
        _0x203713["onChoiceSelected"](
          this["_depth"],
          _0x2f2903[0x0],
          _0x2f2903[0x1]
        ),
      _0x3686fb
    );
  };
  const _0x2e7c19 = Game_Interpreter[_0x3bd751(0x1f8)]["command101"];
  Game_Interpreter[_0x3bd751(0x1f8)][_0x3bd751(0x1cd)] = function (_0x108bb2) {
    const _0x57652c = _0x3bd751,
      _0x5118b3 = this[_0x57652c(0x1b5)],
      _0x2d1934 = _0x2e7c19[_0x57652c(0x17e)](this, _0x108bb2);
    return (
      _0x2d1934 &&
        _0x203713[_0x57652c(0x20c)](this[_0x57652c(0x1bf)], _0x5118b3),
      _0x2d1934
    );
  };
  const _0x3b7505 = Game_Interpreter[_0x3bd751(0x1f8)][_0x3bd751(0x16f)];
  Game_Interpreter[_0x3bd751(0x1f8)][_0x3bd751(0x16f)] = function (_0x42856e) {
    const _0x4366d2 = _0x3bd751;
    _0x203713[_0x4366d2(0x1e7)](
      this[_0x4366d2(0x1b5)],
      this[_0x4366d2(0x1bf)],
      _0x42856e[0x0]
    ),
      _0x3b7505[_0x4366d2(0x17e)](this, _0x42856e);
  };
  const _0x930846 = Game_Interpreter["prototype"][_0x3bd751(0x213)];
  Game_Interpreter[_0x3bd751(0x1f8)][_0x3bd751(0x213)] = function (
    _0x1c3b1f,
    _0x1ff985
  ) {
    const _0xc3644a = _0x3bd751;
    _0x930846["call"](this, _0x1c3b1f, _0x1ff985),
      _0x1ff985 > 0x0
        ? this["_depth"] === 0x0 &&
          _0x203713["onEventStart"](_0x1ff985, this[_0xc3644a(0x167)])
        : _0x203713[_0xc3644a(0x180)](0x0, 0x0);
  };
  const _0x5a88e7 = Game_Interpreter[_0x3bd751(0x1f8)]["terminate"];
  Game_Interpreter[_0x3bd751(0x1f8)]["terminate"] = function () {
    const _0x383f08 = _0x3bd751;
    this[_0x383f08(0x1bf)] === 0x0 &&
      this["_eventId"] > 0x0 &&
      _0x203713[_0x383f08(0x1cb)](this[_0x383f08(0x1f6)]),
      _0x5a88e7[_0x383f08(0x17e)](this);
  };
  const _0x326b7b = Game_CommonEvent["prototype"][_0x3bd751(0x1d4)];
  Game_CommonEvent["prototype"][_0x3bd751(0x1d4)] = function () {
    const _0x95d229 = _0x3bd751;
    _0x203713[_0x95d229(0x1dc)](!![]),
      _0x326b7b["call"](this),
      _0x203713[_0x95d229(0x1dc)](![]);
  };
  const _0x1cf28b = Window_Message["prototype"]["processColorChange"];
  Window_Message["prototype"][_0x3bd751(0x1f9)] = function (_0x16f185) {
    const _0x189974 = _0x3bd751;
    _0x16f185 === 0x0 && _0x203713[_0x189974(0x1a8)]()
      ? this[_0x189974(0x216)](_0x203713["kidokuTextColor"]())
      : _0x1cf28b["call"](this, _0x16f185);
  };
  const _0x4563a6 = Window_Message[_0x3bd751(0x1f8)][_0x3bd751(0x1da)];
  Window_Message[_0x3bd751(0x1f8)][_0x3bd751(0x1da)] = function () {
    const _0x175e0b = _0x3bd751;
    _0x4563a6[_0x175e0b(0x17e)](this),
      _0x203713[_0x175e0b(0x1a8)]() &&
        this[_0x175e0b(0x216)](_0x203713[_0x175e0b(0x1be)]());
  };
  const _0xaecad3 = Window_Message[_0x3bd751(0x1f8)][_0x3bd751(0x21c)];
  Window_Message[_0x3bd751(0x1f8)][_0x3bd751(0x21c)] = function () {
    const _0x5f6655 = _0x3bd751;
    _0xaecad3["call"](this),
      (this[_0x5f6655(0x210)] =
        this[_0x5f6655(0x210)] || _0x203713["needsMessageShowFast"]());
  };
  const _0x2db192 = Window_Message[_0x3bd751(0x1f8)][_0x3bd751(0x1b6)];
  Window_Message[_0x3bd751(0x1f8)][_0x3bd751(0x1b6)] = function (_0xd8f7a0) {
    const _0x2d69e4 = _0x3bd751;
    _0x2db192["call"](this, _0xd8f7a0),
      !this[_0x2d69e4(0x188)] &&
        _0x203713[_0x2d69e4(0x162)]() &&
        this[_0x2d69e4(0x1fb)](_0xd8f7a0) &&
        ((this["pause"] = ![]),
        (this["_pauseSkip"] = !![]),
        this[_0x2d69e4(0x208)](0xa));
  };
  const _0x4d48c7 = Window_Message[_0x3bd751(0x1f8)][_0x3bd751(0x1e5)];
  Window_Message["prototype"][_0x3bd751(0x1e5)] = function () {
    const _0x5af762 = _0x3bd751,
      _0x2446fb = _0x4d48c7["call"](this);
    return (
      _0x203713[_0x5af762(0x172)]() &&
        (Input["isPressed"](_0x5af762(0x19d)) ||
          TouchInput[_0x5af762(0x217)]() ||
          TouchInput[_0x5af762(0x153)]()) &&
        (Input["update"](), _0x203713[_0x5af762(0x161)]()),
      _0x2446fb
    );
  };
  const _0x2acddf = Window_Message[_0x3bd751(0x1f8)][_0x3bd751(0x1d9)];
  Window_Message["prototype"][_0x3bd751(0x1d9)] = function () {
    const _0xc21cfd = _0x3bd751;
    return (
      _0x2acddf[_0xc21cfd(0x17e)](this) || _0x203713["needsMessageShowFast"]()
    );
  };
  const _0x4a3e9e = Window_ChoiceList[_0x3bd751(0x1f8)]["processColorChange"];
  Window_ChoiceList["prototype"][_0x3bd751(0x1f9)] = function (_0x1a484c) {
    const _0x86e029 = _0x3bd751;
    _0x1a484c === 0x0 && _0x203713[_0x86e029(0x1a8)]()
      ? this[_0x86e029(0x216)](_0x203713[_0x86e029(0x1be)]())
      : _0x4a3e9e[_0x86e029(0x17e)](this, _0x1a484c);
  };
  const _0x237b68 = Window_ChoiceList[_0x3bd751(0x1f8)]["resetTextColor"];
  Window_ChoiceList[_0x3bd751(0x1f8)][_0x3bd751(0x1da)] = function () {
    const _0x5edee7 = _0x3bd751;
    _0x237b68["call"](this),
      _0x203713[_0x5edee7(0x1a8)]() &&
        this[_0x5edee7(0x216)](_0x203713[_0x5edee7(0x1be)]());
  };
  const _0x5dcbdb = Window_ChoiceList[_0x3bd751(0x1f8)][_0x3bd751(0x207)];
  Window_ChoiceList[_0x3bd751(0x1f8)][_0x3bd751(0x207)] = function (_0x4159bd) {
    const _0x5d3855 = _0x3bd751;
    _0x203713["onChoiceDrawItem"](_0x4159bd),
      _0x5dcbdb[_0x5d3855(0x17e)](this, _0x4159bd);
  };
  const _0x650c76 = DataManager[_0x3bd751(0x1e2)];
  DataManager["createGameObjects"] = function () {
    const _0x5fc334 = _0x3bd751;
    _0x203713[_0x5fc334(0x220)](), _0x650c76[_0x5fc334(0x17e)](this);
  };
  const _0x34e6e8 = DataManager[_0x3bd751(0x17b)];
  DataManager["loadMapData"] = function (_0x4c5c2b) {
    const _0x450005 = _0x3bd751;
    _0x203713["onMadLoad"](_0x4c5c2b),
      _0x34e6e8[_0x450005(0x17e)](this, _0x4c5c2b);
  };
  const _0x3d9553 = DataManager[_0x3bd751(0x1fe)];
  DataManager["extractSaveContents"] = function (_0x19366e) {
    const _0x267e2b = _0x3bd751;
    _0x3d9553[_0x267e2b(0x17e)](this, _0x19366e);
    if (!_0x203713[_0x267e2b(0x15f)]()) {
      const _0xe3f23a = _0x19366e[_0x5e1531];
      _0x203713["loadContents"](_0xe3f23a);
    }
  };
  const _0x3ff2cc = DataManager[_0x3bd751(0x191)];
  DataManager["saveGame"] = function (_0x233430) {
    const _0x462de0 = _0x3bd751,
      _0x4c9772 = _0x3ff2cc["call"](this, _0x233430);
    return _0x203713[_0x462de0(0x1c8)](), _0x4c9772;
  };
  const _0xce7b62 = Scene_Boot[_0x3bd751(0x1f8)][_0x3bd751(0x212)];
  Scene_Boot[_0x3bd751(0x1f8)][_0x3bd751(0x212)] = function () {
    const _0x5505c1 = _0x3bd751;
    _0xce7b62[_0x5505c1(0x17e)](this), _0x203713["loadShared"]();
  };
  class _0x36303e extends Window_Selectable {
    ["initialize"](_0x43d32e) {
      const _0x1e4f5b = _0x3bd751;
      (this[_0x1e4f5b(0x18a)] = []), super[_0x1e4f5b(0x1d3)](_0x43d32e);
    }
    [_0x3bd751(0x1e6)](_0x5db244) {
      const _0x1f21ee = _0x3bd751;
      this[_0x1f21ee(0x19b)] = _0x5db244;
    }
    [_0x3bd751(0x16e)](_0xd34277) {
      const _0x37777b = _0x3bd751;
      super[_0x37777b(0x16e)](_0xd34277);
      if (this[_0x37777b(0x19b)]) {
        const _0x4aaa4 = this[_0x37777b(0x21d)](_0xd34277),
          _0x4aaed5 = _0x203713[_0x37777b(0x1fc)](_0x4aaa4);
        this[_0x37777b(0x19b)]["setContents"](_0x4aaed5, _0x4aaa4);
      }
    }
    [_0x3bd751(0x1de)](_0x5d3788) {
      const _0x35d7dd = _0x3bd751,
        _0x34e329 = Math[_0x35d7dd(0x214)](
          this[_0x35d7dd(0x18a)]["length"] / 0x2
        ),
        _0x4979f0 = this[_0x35d7dd(0x18a)][_0x34e329];
      if (_0x5d3788 < _0x4979f0) {
        const _0x3e5eec = this[_0x35d7dd(0x18a)][_0x35d7dd(0x186)](_0x5d3788);
        this[_0x35d7dd(0x16e)](_0x3e5eec);
      } else {
        const _0xb3b966 = this[_0x35d7dd(0x18a)][_0x35d7dd(0x182)](_0x5d3788);
        this[_0x35d7dd(0x16e)](_0xb3b966);
      }
      this[_0x35d7dd(0x1b5)] <= 0x0 && this[_0x35d7dd(0x16e)](0x0);
    }
    [_0x3bd751(0x1ee)](_0x43d904) {
      const _0x57c579 = _0x3bd751;
      (this[_0x57c579(0x18a)] = _0x43d904), this[_0x57c579(0x1ba)]();
    }
    ["maxItems"]() {
      const _0x1ffc9a = _0x3bd751;
      return this[_0x1ffc9a(0x18a)][_0x1ffc9a(0x1b9)];
    }
    [_0x3bd751(0x21d)](_0x44772c) {
      return this["_list"][_0x44772c];
    }
    [_0x3bd751(0x1c5)]() {
      const _0x26de00 = _0x3bd751,
        _0x3ecfde = this["mapNameText"](this[_0x26de00(0x169)]());
      this[_0x26de00(0x1e3)][_0x26de00(0x1ae)](_0x3ecfde);
    }
    [_0x3bd751(0x1c4)](_0x587998) {
      const _0xd518d3 = _0x3bd751,
        _0x43de29 = this[_0xd518d3(0x21d)](_0x587998);
      if (isNaN(_0x43de29)) return "";
      const _0x449b15 = _0x43de29[_0xd518d3(0x20a)]()["padStart"](0x4, "0"),
        _0x52f90a = $dataMapInfos[_0x43de29];
      return (
        _0xd518d3(0x1b8) +
        _0x449b15 +
        ":" +
        (_0x52f90a ? _0x52f90a["name"] : "")
      );
    }
    [_0x3bd751(0x207)](_0x593ae2) {
      const _0x397899 = _0x3bd751,
        _0x2e4cc6 = this[_0x397899(0x21d)](_0x593ae2);
      if (isNaN(_0x2e4cc6)) return;
      const _0x16f48e = this[_0x397899(0x1d7)](_0x593ae2),
        _0x58d563 =
          _0x397899(0x1b8) +
          _0x2e4cc6[_0x397899(0x20a)]()["padStart"](0x4, "0");
      this[_0x397899(0x157)](
        _0x58d563,
        _0x16f48e["x"],
        _0x16f48e["y"],
        _0x16f48e[_0x397899(0x16b)]
      );
    }
  }
  class _0xa9e6dd extends Window_Selectable {
    [_0x3bd751(0x1d3)](_0x343e3d) {
      const _0x4cad50 = _0x3bd751;
      (this[_0x4cad50(0x18a)] = []), super[_0x4cad50(0x1d3)](_0x343e3d);
    }
    [_0x3bd751(0x1ff)](_0x338941, _0x5c6489) {
      const _0x186f7c = _0x3bd751;
      (this[_0x186f7c(0x167)] = _0x5c6489),
        (this[_0x186f7c(0x18a)] = Array[_0x186f7c(0x201)](_0x338941)),
        this[_0x186f7c(0x1ba)]();
    }
    [_0x3bd751(0x205)](_0xba1588) {
      const _0x2aa630 = _0x3bd751;
      (this[_0x2aa630(0x18a)] = _0x203713[_0x2aa630(0x1fc)](_0xba1588)),
        (this["_mapId"] = _0xba1588),
        this["refresh"]();
    }
    [_0x3bd751(0x177)]() {
      const _0x10d45f = _0x3bd751;
      return this[_0x10d45f(0x18a)][_0x10d45f(0x1b9)];
    }
    [_0x3bd751(0x1d8)](_0x345947) {
      const _0x149787 = 0x1f00 & _0x345947,
        _0x278677 = _0x149787 >> 0x8;
      return _0x278677;
    }
    [_0x3bd751(0x156)](_0x323132) {
      return 0xff & _0x323132;
    }
    [_0x3bd751(0x218)](_0x386ecc) {
      const _0x5dd3ac = _0x3bd751,
        _0xa4177 = this[_0x5dd3ac(0x156)](_0x386ecc);
      if (this[_0x5dd3ac(0x167)] === $gameMap[_0x5dd3ac(0x1c7)]()) {
        const _0x4975eb = $gameMap[_0x5dd3ac(0x1c1)](_0xa4177);
        if (_0x4975eb) return _0x4975eb[_0x5dd3ac(0x1c1)]()[_0x5dd3ac(0x1ca)];
      }
      return "EV" + _0xa4177["toString"]()[_0x5dd3ac(0x21b)](0x3, "0");
    }
    ["createHelpText"](_0x2c1259) {
      const _0x1481e9 = _0x3bd751,
        _0x55ca18 = this["obtainPageIndex"](_0x2c1259),
        _0x2d2396 = this[_0x1481e9(0x156)](_0x2c1259);
      return _0x1481e9(0x1c9) + (_0x55ca18 + 0x1);
    }
    [_0x3bd751(0x1c5)]() {
      const _0x32df51 = _0x3bd751,
        _0x34e656 = this[_0x32df51(0x1b0)](this[_0x32df51(0x169)]());
      if (isNaN(_0x34e656)) this["_helpWindow"][_0x32df51(0x168)]();
      else {
        const _0x19325c = this[_0x32df51(0x1ed)](_0x34e656);
        this[_0x32df51(0x1e3)]["setText"](_0x19325c);
      }
    }
    [_0x3bd751(0x1b0)](_0x1d43d2) {
      const _0x449729 = _0x3bd751;
      return this[_0x449729(0x18a)][_0x1d43d2];
    }
    ["drawItem"](_0x493433) {
      const _0x3ebb81 = _0x3bd751;
      if (_0x493433 < this["_list"][_0x3ebb81(0x1b9)]) {
        const _0x492b1b = this["itemLineRect"](_0x493433),
          _0x2634eb = this["valueAt"](_0x493433),
          _0x1b93e7 = this[_0x3ebb81(0x218)](_0x2634eb),
          _0x250a4 = _0x2634eb[_0x3ebb81(0x20a)](0x10)[_0x3ebb81(0x21b)](
            0xc,
            "0"
          );
        this[_0x3ebb81(0x157)](
          _0x250a4,
          _0x492b1b["x"],
          _0x492b1b["y"],
          _0x492b1b[_0x3ebb81(0x16b)],
          _0x3ebb81(0x20d)
        ),
          this[_0x3ebb81(0x157)](
            _0x1b93e7,
            _0x492b1b["x"],
            _0x492b1b["y"],
            _0x492b1b["width"],
            _0x3ebb81(0x15b)
          );
      }
    }
  }
  class _0x4bc31c extends Scene_MenuBase {
    [_0x3bd751(0x19c)]() {
      const _0x338ddf = _0x3bd751;
      super["create"](), this[_0x338ddf(0x1df)]();
    }
    [_0x3bd751(0x1df)]() {
      const _0x56ff2c = _0x3bd751;
      this["createHelpWindow"](),
        this[_0x56ff2c(0x1cc)](),
        this["createKidokFlagWindow"](),
        this[_0x56ff2c(0x1dd)]();
    }
    [_0x3bd751(0x1dd)]() {
      const _0xe0b35a = _0x3bd751;
      this["_mapListWindow"]["setHelpWindow"](this[_0xe0b35a(0x1e3)]),
        this[_0xe0b35a(0x192)][_0xe0b35a(0x1e6)](this[_0xe0b35a(0x1e1)]),
        this[_0xe0b35a(0x192)][_0xe0b35a(0x1de)]($gameMap["mapId"]()),
        this[_0xe0b35a(0x192)][_0xe0b35a(0x154)]();
    }
    [_0x3bd751(0x1cc)]() {
      const _0x417b01 = _0x3bd751,
        _0x301ebc = this[_0x417b01(0x1a1)](),
        _0x2396ac = new _0x36303e(_0x301ebc);
      _0x2396ac[_0x417b01(0x1ee)](_0x203713[_0x417b01(0x215)]()),
        _0x2396ac["setHandler"](
          "ok",
          this[_0x417b01(0x18f)][_0x417b01(0x174)](this)
        ),
        _0x2396ac[_0x417b01(0x1f7)](
          "cancel",
          this[_0x417b01(0x204)][_0x417b01(0x174)](this)
        ),
        (this[_0x417b01(0x192)] = _0x2396ac),
        this[_0x417b01(0x1cf)](_0x2396ac);
    }
    [_0x3bd751(0x18f)]() {
      const _0x56bdc7 = _0x3bd751;
      this[_0x56bdc7(0x1e1)][_0x56bdc7(0x16e)](0x0),
        this["_flagListWindow"][_0x56bdc7(0x1f4)]();
    }
    ["mapListWindowRect"]() {
      const _0x317c32 = _0x3bd751,
        _0x3b5d91 = this[_0x317c32(0x1bb)]();
      return new Rectangle(
        0x0,
        this[_0x317c32(0x197)](),
        _0x3b5d91,
        this[_0x317c32(0x1e0)]()
      );
    }
    [_0x3bd751(0x1bb)]() {
      return 0xa0;
    }
    [_0x3bd751(0x21e)]() {
      const _0x29d7e1 = _0x3bd751,
        _0x2906ab = this["numberWindowWidth"](),
        _0x51383f = Graphics["boxWidth"] - _0x2906ab;
      return new Rectangle(
        _0x2906ab,
        this[_0x29d7e1(0x197)](),
        _0x51383f,
        this[_0x29d7e1(0x1e0)]()
      );
    }
    [_0x3bd751(0x158)]() {
      const _0x2be88c = _0x3bd751,
        _0x3b4faa = this[_0x2be88c(0x21e)](),
        _0x471a67 = new _0xa9e6dd(_0x3b4faa);
      _0x471a67[_0x2be88c(0x1ff)](
        _0x203713[_0x2be88c(0x18e)](),
        $gameMap[_0x2be88c(0x1c7)]()
      ),
        _0x471a67[_0x2be88c(0x1f4)](),
        _0x471a67[_0x2be88c(0x1f7)](
          _0x2be88c(0x19d),
          this[_0x2be88c(0x1e9)][_0x2be88c(0x174)](this)
        ),
        _0x471a67[_0x2be88c(0x1eb)](this[_0x2be88c(0x1e3)]),
        _0x471a67[_0x2be88c(0x16e)](0x0),
        (this["_flagListWindow"] = _0x471a67),
        this[_0x2be88c(0x1cf)](_0x471a67);
    }
    [_0x3bd751(0x1e9)]() {
      const _0x4df73f = _0x3bd751;
      this["_flagListWindow"][_0x4df73f(0x1a2)](),
        this[_0x4df73f(0x192)][_0x4df73f(0x1f4)]();
    }
  }
  PluginManager[_0x3bd751(0x1ec)](_0x439506, _0x3bd751(0x209), () => {
    const _0x1c90d8 = _0x3bd751;
    _0x203713[_0x1c90d8(0x1a6)](), SceneManager[_0x1c90d8(0x19f)](_0x4bc31c);
  }),
    PluginManager[_0x3bd751(0x1ec)](_0x439506, _0x3bd751(0x1fa), function () {
      const _0x724258 = _0x3bd751;
      this[_0x724258(0x1bf)] === 0x0 && _0x203713[_0x724258(0x224)](![]);
    }),
    PluginManager[_0x3bd751(0x1ec)](_0x439506, "EnableReadCheck", function () {
      const _0x50aa88 = _0x3bd751;
      this[_0x50aa88(0x1bf)] === 0x0 &&
        this["_eventId"] > 0x0 &&
        this[_0x50aa88(0x1f6)] == _0x203713["currentEventId"]() &&
        _0x203713[_0x50aa88(0x224)](!![]);
    });
  function _0x2332b0(_0x2f744a, _0x41a611) {
    window[_0x41a611] = _0x2f744a;
  }
  const _0x12f18b = [
    KidokuEventData,
    KidokuEventState,
    KidokuFlags,
    KidokuContents,
  ];
  for (const _0x350fab of _0x12f18b) {
    _0x2332b0(_0x350fab, _0x350fab[_0x3bd751(0x1ca)]);
  }
})();