@wwawing/engine 4.1.0-unstable.based-on.3.12.11.p.2 → 4.1.0-unstable.based-on.3.12.11.p.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/wwa.js CHANGED
@@ -1,7 +1,7 @@
1
1
  /*!
2
2
  * @license WWA Wing Engine (c) NAO / WWA Wing Team / MIT License https://github.com/WWAWing/WWAWing/blob/develop/packages/engine/LICENSE
3
3
  * @license crypto-js (c) Jeff Mott / Evan Vosberg / MIT License https://github.com/brix/crypto-js/blob/develop/LICENSE
4
- */!function(){var t={452:function(t,e,s){var i;t.exports=(i=s(359),s(139),s(174),s(844),s(951),function(){var t=i,e=t.lib.BlockCipher,s=t.algo,a=[],r=[],n=[],o=[],h=[],c=[],_=[],l=[],u=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var s=0,i=0;for(e=0;e<256;e++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,a[s]=p,r[p]=s;var m=t[s],E=t[m],g=t[E],w=257*t[p]^16843008*p;n[s]=w<<24|w>>>8,o[s]=w<<16|w>>>16,h[s]=w<<8|w>>>24,c[s]=w,w=16843009*g^65537*E^257*m^16843008*s,_[p]=w<<24|w>>>8,l[p]=w<<16|w>>>16,u[p]=w<<8|w>>>24,d[p]=w,s?(s=m^t[t[t[g^m]]],i^=t[t[i]]):s=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=s.AES=e.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,s=t.sigBytes/4,i=4*((this._nRounds=s+6)+1),r=this._keySchedule=[],n=0;n<i;n++)n<s?r[n]=e[n]:(c=r[n-1],n%s?s>6&&n%s==4&&(c=a[c>>>24]<<24|a[c>>>16&255]<<16|a[c>>>8&255]<<8|a[255&c]):(c=a[(c=c<<8|c>>>24)>>>24]<<24|a[c>>>16&255]<<16|a[c>>>8&255]<<8|a[255&c],c^=p[n/s|0]<<24),r[n]=r[n-s]^c);for(var o=this._invKeySchedule=[],h=0;h<i;h++){if(n=i-h,h%4)var c=r[n];else c=r[n-4];o[h]=h<4||n<=4?c:_[a[c>>>24]]^l[a[c>>>16&255]]^u[a[c>>>8&255]]^d[a[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,n,o,h,c,a)},decryptBlock:function(t,e){var s=t[e+1];t[e+1]=t[e+3],t[e+3]=s,this._doCryptBlock(t,e,this._invKeySchedule,_,l,u,d,r),s=t[e+1],t[e+1]=t[e+3],t[e+3]=s},_doCryptBlock:function(t,e,s,i,a,r,n,o){for(var h=this._nRounds,c=t[e]^s[0],_=t[e+1]^s[1],l=t[e+2]^s[2],u=t[e+3]^s[3],d=4,p=1;p<h;p++){var m=i[c>>>24]^a[_>>>16&255]^r[l>>>8&255]^n[255&u]^s[d++],E=i[_>>>24]^a[l>>>16&255]^r[u>>>8&255]^n[255&c]^s[d++],g=i[l>>>24]^a[u>>>16&255]^r[c>>>8&255]^n[255&_]^s[d++],w=i[u>>>24]^a[c>>>16&255]^r[_>>>8&255]^n[255&l]^s[d++];c=m,_=E,l=g,u=w}m=(o[c>>>24]<<24|o[_>>>16&255]<<16|o[l>>>8&255]<<8|o[255&u])^s[d++],E=(o[_>>>24]<<24|o[l>>>16&255]<<16|o[u>>>8&255]<<8|o[255&c])^s[d++],g=(o[l>>>24]<<24|o[u>>>16&255]<<16|o[c>>>8&255]<<8|o[255&_])^s[d++],w=(o[u>>>24]<<24|o[c>>>16&255]<<16|o[_>>>8&255]<<8|o[255&l])^s[d++],t[e]=m,t[e+1]=E,t[e+2]=g,t[e+3]=w},keySize:8});t.AES=e._createHelper(m)}(),i.AES)},466:function(t,e,s){var i;t.exports=(i=s(359),s(139),s(174),s(844),s(951),function(){var t=i,e=t.lib.BlockCipher,s=t.algo;const a=16,r=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],n=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function h(t,e){let s=e>>24&255,i=e>>16&255,a=e>>8&255,r=255&e,n=t.sbox[0][s]+t.sbox[1][i];return n^=t.sbox[2][a],n+=t.sbox[3][r],n}function c(t,e,s){let i,r=e,n=s;for(let e=0;e<a;++e)r^=t.pbox[e],n=h(t,r)^n,i=r,r=n,n=i;return i=r,r=n,n=i,n^=t.pbox[a],r^=t.pbox[a+1],{left:r,right:n}}function _(t,e,s){let i,r=e,n=s;for(let e=a+1;e>1;--e)r^=t.pbox[e],n=h(t,r)^n,i=r,r=n,n=i;return i=r,r=n,n=i,n^=t.pbox[1],r^=t.pbox[0],{left:r,right:n}}function l(t,e,s){for(let e=0;e<4;e++){t.sbox[e]=[];for(let s=0;s<256;s++)t.sbox[e][s]=n[e][s]}let i=0;for(let n=0;n<a+2;n++)t.pbox[n]=r[n]^e[i],i++,i>=s&&(i=0);let o=0,h=0,_=0;for(let e=0;e<a+2;e+=2)_=c(t,o,h),o=_.left,h=_.right,t.pbox[e]=o,t.pbox[e+1]=h;for(let e=0;e<4;e++)for(let s=0;s<256;s+=2)_=c(t,o,h),o=_.left,h=_.right,t.sbox[e][s]=o,t.sbox[e][s+1]=h;return!0}var u=s.Blowfish=e.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,s=t.sigBytes/4;l(o,e,s)}},encryptBlock:function(t,e){var s=c(o,t[e],t[e+1]);t[e]=s.left,t[e+1]=s.right},decryptBlock:function(t,e){var s=_(o,t[e],t[e+1]);t[e]=s.left,t[e+1]=s.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=e._createHelper(u)}(),i.Blowfish)},951:function(t,e,s){var i;t.exports=(i=s(359),s(844),void(i.lib.Cipher||function(t){var e=i,s=e.lib,a=s.Base,r=s.WordArray,n=s.BufferedBlockAlgorithm,o=e.enc,h=(o.Utf8,o.Base64),c=e.algo.EvpKDF,_=s.Cipher=n.extend({cfg:a.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,s){this.cfg=this.cfg.extend(s),this._xformMode=t,this._key=e,this.reset()},reset:function(){n.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?f:g}return function(e){return{encrypt:function(s,i,a){return t(i).encrypt(e,s,i,a)},decrypt:function(s,i,a){return t(i).decrypt(e,s,i,a)}}}}()}),l=(s.StreamCipher=_.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),e.mode={}),u=s.BlockCipherMode=a.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),d=l.CBC=function(){var e=u.extend();function s(e,s,i){var a,r=this._iv;r?(a=r,this._iv=t):a=this._prevBlock;for(var n=0;n<i;n++)e[s+n]^=a[n]}return e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,a=i.blockSize;s.call(this,t,e,a),i.encryptBlock(t,e),this._prevBlock=t.slice(e,e+a)}}),e.Decryptor=e.extend({processBlock:function(t,e){var i=this._cipher,a=i.blockSize,r=t.slice(e,e+a);i.decryptBlock(t,e),s.call(this,t,e,a),this._prevBlock=r}}),e}(),p=(e.pad={}).Pkcs7={pad:function(t,e){for(var s=4*e,i=s-t.sigBytes%s,a=i<<24|i<<16|i<<8|i,n=[],o=0;o<i;o+=4)n.push(a);var h=r.create(n,i);t.concat(h)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},m=(s.BlockCipher=_.extend({cfg:_.cfg.extend({mode:d,padding:p}),reset:function(){var t;_.reset.call(this);var e=this.cfg,s=e.iv,i=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=i.createEncryptor:(t=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,s&&s.words):(this._mode=t.call(i,this,s&&s.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),s.CipherParams=a.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),E=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,s=t.salt;return(s?r.create([1398893684,1701076831]).concat(s).concat(e):e).toString(h)},parse:function(t){var e,s=h.parse(t),i=s.words;return 1398893684==i[0]&&1701076831==i[1]&&(e=r.create(i.slice(2,4)),i.splice(0,4),s.sigBytes-=16),m.create({ciphertext:s,salt:e})}},g=s.SerializableCipher=a.extend({cfg:a.extend({format:E}),encrypt:function(t,e,s,i){i=this.cfg.extend(i);var a=t.createEncryptor(s,i),r=a.finalize(e),n=a.cfg;return m.create({ciphertext:r,key:s,iv:n.iv,algorithm:t,mode:n.mode,padding:n.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,s,i){return i=this.cfg.extend(i),e=this._parse(e,i.format),t.createDecryptor(s,i).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),w=(e.kdf={}).OpenSSL={execute:function(t,e,s,i,a){if(i||(i=r.random(8)),a)n=c.create({keySize:e+s,hasher:a}).compute(t,i);else var n=c.create({keySize:e+s}).compute(t,i);var o=r.create(n.words.slice(e),4*s);return n.sigBytes=4*e,m.create({key:n,iv:o,salt:i})}},f=s.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:w}),encrypt:function(t,e,s,i){var a=(i=this.cfg.extend(i)).kdf.execute(s,t.keySize,t.ivSize,i.salt,i.hasher);i.iv=a.iv;var r=g.encrypt.call(this,t,e,a.key,i);return r.mixIn(a),r},decrypt:function(t,e,s,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var a=i.kdf.execute(s,t.keySize,t.ivSize,e.salt,i.hasher);return i.iv=a.iv,g.decrypt.call(this,t,e,a.key,i)}})}()))},359:function(t,e,s){var i;t.exports=(i=i||function(t,e){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==s.g&&s.g.crypto&&(i=s.g.crypto),!i)try{i=s(633)}catch(t){}var a=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function t(){}return function(e){var s;return t.prototype=e,s=new t,t.prototype=null,s}}(),n={},o=n.lib={},h=o.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},c=o.WordArray=h.extend({init:function(t,s){t=this.words=t||[],this.sigBytes=s!=e?s:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,s=t.words,i=this.sigBytes,a=t.sigBytes;if(this.clamp(),i%4)for(var r=0;r<a;r++){var n=s[r>>>2]>>>24-r%4*8&255;e[i+r>>>2]|=n<<24-(i+r)%4*8}else for(var o=0;o<a;o+=4)e[i+o>>>2]=s[o>>>2];return this.sigBytes+=a,this},clamp:function(){var e=this.words,s=this.sigBytes;e[s>>>2]&=4294967295<<32-s%4*8,e.length=t.ceil(s/4)},clone:function(){var t=h.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],s=0;s<t;s+=4)e.push(a());return new c.init(e,t)}}),_=n.enc={},l=_.Hex={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],a=0;a<s;a++){var r=e[a>>>2]>>>24-a%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i+=2)s[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new c.init(s,e/2)}},u=_.Latin1={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],a=0;a<s;a++){var r=e[a>>>2]>>>24-a%4*8&255;i.push(String.fromCharCode(r))}return i.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i++)s[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new c.init(s,e)}},d=_.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},p=o.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var s,i=this._data,a=i.words,r=i.sigBytes,n=this.blockSize,o=r/(4*n),h=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*n,_=t.min(4*h,r);if(h){for(var l=0;l<h;l+=n)this._doProcessBlock(a,l);s=a.splice(0,h),i.sigBytes-=_}return new c.init(s,_)},clone:function(){var t=h.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),m=(o.Hasher=p.extend({cfg:h.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,s){return new t.init(s).finalize(e)}},_createHmacHelper:function(t){return function(e,s){return new m.HMAC.init(t,s).finalize(e)}}}),n.algo={});return n}(Math),i)},139:function(t,e,s){var i;t.exports=(i=s(359),function(){var t=i,e=t.lib.WordArray;function s(t,s,i){for(var a=[],r=0,n=0;n<s;n++)if(n%4){var o=i[t.charCodeAt(n-1)]<<n%4*2|i[t.charCodeAt(n)]>>>6-n%4*2;a[r>>>2]|=o<<24-r%4*8,r++}return e.create(a,r)}t.enc.Base64={stringify:function(t){var e=t.words,s=t.sigBytes,i=this._map;t.clamp();for(var a=[],r=0;r<s;r+=3)for(var n=(e[r>>>2]>>>24-r%4*8&255)<<16|(e[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|e[r+2>>>2]>>>24-(r+2)%4*8&255,o=0;o<4&&r+.75*o<s;o++)a.push(i.charAt(n>>>6*(3-o)&63));var h=i.charAt(64);if(h)for(;a.length%4;)a.push(h);return a.join("")},parse:function(t){var e=t.length,i=this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var r=0;r<i.length;r++)a[i.charCodeAt(r)]=r}var n=i.charAt(64);if(n){var o=t.indexOf(n);-1!==o&&(e=o)}return s(t,e,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),i.enc.Base64)},950:function(t,e,s){var i;t.exports=(i=s(359),function(){var t=i,e=t.lib.WordArray;function s(t,s,i){for(var a=[],r=0,n=0;n<s;n++)if(n%4){var o=i[t.charCodeAt(n-1)]<<n%4*2|i[t.charCodeAt(n)]>>>6-n%4*2;a[r>>>2]|=o<<24-r%4*8,r++}return e.create(a,r)}t.enc.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var s=t.words,i=t.sigBytes,a=e?this._safe_map:this._map;t.clamp();for(var r=[],n=0;n<i;n+=3)for(var o=(s[n>>>2]>>>24-n%4*8&255)<<16|(s[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|s[n+2>>>2]>>>24-(n+2)%4*8&255,h=0;h<4&&n+.75*h<i;h++)r.push(a.charAt(o>>>6*(3-h)&63));var c=a.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(t,e){void 0===e&&(e=!0);var i=t.length,a=e?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var n=0;n<a.length;n++)r[a.charCodeAt(n)]=n}var o=a.charAt(64);if(o){var h=t.indexOf(o);-1!==h&&(i=h)}return s(t,i,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),i.enc.Base64url)},164:function(t,e,s){var i;t.exports=(i=s(359),function(){var t=i,e=t.lib.WordArray,s=t.enc;function a(t){return t<<8&4278255360|t>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],a=0;a<s;a+=2){var r=e[a>>>2]>>>16-a%4*8&65535;i.push(String.fromCharCode(r))}return i.join("")},parse:function(t){for(var s=t.length,i=[],a=0;a<s;a++)i[a>>>1]|=t.charCodeAt(a)<<16-a%2*16;return e.create(i,2*s)}},s.Utf16LE={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],r=0;r<s;r+=2){var n=a(e[r>>>2]>>>16-r%4*8&65535);i.push(String.fromCharCode(n))}return i.join("")},parse:function(t){for(var s=t.length,i=[],r=0;r<s;r++)i[r>>>1]|=a(t.charCodeAt(r)<<16-r%2*16);return e.create(i,2*s)}}}(),i.enc.Utf16)},844:function(t,e,s){var i,a,r,n,o,h,c,_;t.exports=(_=s(359),s(637),s(423),a=(i=_).lib,r=a.Base,n=a.WordArray,o=i.algo,h=o.MD5,c=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:h,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var s,i=this.cfg,a=i.hasher.create(),r=n.create(),o=r.words,h=i.keySize,c=i.iterations;o.length<h;){s&&a.update(s),s=a.update(t).finalize(e),a.reset();for(var _=1;_<c;_++)s=a.finalize(s),a.reset();r.concat(s)}return r.sigBytes=4*h,r}}),i.EvpKDF=function(t,e,s){return c.create(s).compute(t,e)},_.EvpKDF)},333:function(t,e,s){var i,a,r,n;t.exports=(n=s(359),s(951),a=(i=n).lib.CipherParams,r=i.enc.Hex,i.format.Hex={stringify:function(t){return t.ciphertext.toString(r)},parse:function(t){var e=r.parse(t);return a.create({ciphertext:e})}},n.format.Hex)},423:function(t,e,s){var i,a,r,n;t.exports=(i=s(359),r=(a=i).lib.Base,n=a.enc.Utf8,void(a.algo.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=n.parse(e));var s=t.blockSize,i=4*s;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var a=this._oKey=e.clone(),r=this._iKey=e.clone(),o=a.words,h=r.words,c=0;c<s;c++)o[c]^=1549556828,h[c]^=909522486;a.sigBytes=r.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,s=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(s))}})))},23:function(t,e,s){var i;t.exports=(i=s(359),s(467),s(816),s(164),s(139),s(950),s(174),s(637),s(93),s(640),s(834),s(716),s(140),s(293),s(423),s(414),s(844),s(951),s(173),s(782),s(655),s(957),s(129),s(994),s(236),s(476),s(921),s(181),s(333),s(452),s(567),s(830),s(480),s(730),s(466),i)},816:function(t,e,s){var i;t.exports=(i=s(359),function(){if("function"==typeof ArrayBuffer){var t=i.lib.WordArray,e=t.init,s=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var s=t.byteLength,i=[],a=0;a<s;a++)i[a>>>2]|=t[a]<<24-a%4*8;e.call(this,i,s)}else e.apply(this,arguments)};s.prototype=t}}(),i.lib.WordArray)},174:function(t,e,s){var i;t.exports=(i=s(359),function(t){var e=i,s=e.lib,a=s.WordArray,r=s.Hasher,n=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var h=n.MD5=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var s=0;s<16;s++){var i=e+s,a=t[i];t[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var r=this._hash.words,n=t[e+0],h=t[e+1],d=t[e+2],p=t[e+3],m=t[e+4],E=t[e+5],g=t[e+6],w=t[e+7],f=t[e+8],v=t[e+9],y=t[e+10],S=t[e+11],A=t[e+12],T=t[e+13],I=t[e+14],C=t[e+15],D=r[0],P=r[1],N=r[2],O=r[3];D=c(D,P,N,O,n,7,o[0]),O=c(O,D,P,N,h,12,o[1]),N=c(N,O,D,P,d,17,o[2]),P=c(P,N,O,D,p,22,o[3]),D=c(D,P,N,O,m,7,o[4]),O=c(O,D,P,N,E,12,o[5]),N=c(N,O,D,P,g,17,o[6]),P=c(P,N,O,D,w,22,o[7]),D=c(D,P,N,O,f,7,o[8]),O=c(O,D,P,N,v,12,o[9]),N=c(N,O,D,P,y,17,o[10]),P=c(P,N,O,D,S,22,o[11]),D=c(D,P,N,O,A,7,o[12]),O=c(O,D,P,N,T,12,o[13]),N=c(N,O,D,P,I,17,o[14]),D=_(D,P=c(P,N,O,D,C,22,o[15]),N,O,h,5,o[16]),O=_(O,D,P,N,g,9,o[17]),N=_(N,O,D,P,S,14,o[18]),P=_(P,N,O,D,n,20,o[19]),D=_(D,P,N,O,E,5,o[20]),O=_(O,D,P,N,y,9,o[21]),N=_(N,O,D,P,C,14,o[22]),P=_(P,N,O,D,m,20,o[23]),D=_(D,P,N,O,v,5,o[24]),O=_(O,D,P,N,I,9,o[25]),N=_(N,O,D,P,p,14,o[26]),P=_(P,N,O,D,f,20,o[27]),D=_(D,P,N,O,T,5,o[28]),O=_(O,D,P,N,d,9,o[29]),N=_(N,O,D,P,w,14,o[30]),D=l(D,P=_(P,N,O,D,A,20,o[31]),N,O,E,4,o[32]),O=l(O,D,P,N,f,11,o[33]),N=l(N,O,D,P,S,16,o[34]),P=l(P,N,O,D,I,23,o[35]),D=l(D,P,N,O,h,4,o[36]),O=l(O,D,P,N,m,11,o[37]),N=l(N,O,D,P,w,16,o[38]),P=l(P,N,O,D,y,23,o[39]),D=l(D,P,N,O,T,4,o[40]),O=l(O,D,P,N,n,11,o[41]),N=l(N,O,D,P,p,16,o[42]),P=l(P,N,O,D,g,23,o[43]),D=l(D,P,N,O,v,4,o[44]),O=l(O,D,P,N,A,11,o[45]),N=l(N,O,D,P,C,16,o[46]),D=u(D,P=l(P,N,O,D,d,23,o[47]),N,O,n,6,o[48]),O=u(O,D,P,N,w,10,o[49]),N=u(N,O,D,P,I,15,o[50]),P=u(P,N,O,D,E,21,o[51]),D=u(D,P,N,O,A,6,o[52]),O=u(O,D,P,N,p,10,o[53]),N=u(N,O,D,P,y,15,o[54]),P=u(P,N,O,D,h,21,o[55]),D=u(D,P,N,O,f,6,o[56]),O=u(O,D,P,N,C,10,o[57]),N=u(N,O,D,P,g,15,o[58]),P=u(P,N,O,D,T,21,o[59]),D=u(D,P,N,O,m,6,o[60]),O=u(O,D,P,N,S,10,o[61]),N=u(N,O,D,P,d,15,o[62]),P=u(P,N,O,D,v,21,o[63]),r[0]=r[0]+D|0,r[1]=r[1]+P|0,r[2]=r[2]+N|0,r[3]=r[3]+O|0},_doFinalize:function(){var e=this._data,s=e.words,i=8*this._nDataBytes,a=8*e.sigBytes;s[a>>>5]|=128<<24-a%32;var r=t.floor(i/4294967296),n=i;s[15+(a+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),s[14+(a+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(s.length+1),this._process();for(var o=this._hash,h=o.words,c=0;c<4;c++){var _=h[c];h[c]=16711935&(_<<8|_>>>24)|4278255360&(_<<24|_>>>8)}return o},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,s,i,a,r,n){var o=t+(e&s|~e&i)+a+n;return(o<<r|o>>>32-r)+e}function _(t,e,s,i,a,r,n){var o=t+(e&i|s&~i)+a+n;return(o<<r|o>>>32-r)+e}function l(t,e,s,i,a,r,n){var o=t+(e^s^i)+a+n;return(o<<r|o>>>32-r)+e}function u(t,e,s,i,a,r,n){var o=t+(s^(e|~i))+a+n;return(o<<r|o>>>32-r)+e}e.MD5=r._createHelper(h),e.HmacMD5=r._createHmacHelper(h)}(Math),i.MD5)},173:function(t,e,s){var i;t.exports=(i=s(359),s(951),i.mode.CFB=function(){var t=i.lib.BlockCipherMode.extend();function e(t,e,s,i){var a,r=this._iv;r?(a=r.slice(0),this._iv=void 0):a=this._prevBlock,i.encryptBlock(a,0);for(var n=0;n<s;n++)t[e+n]^=a[n]}return t.Encryptor=t.extend({processBlock:function(t,s){var i=this._cipher,a=i.blockSize;e.call(this,t,s,a,i),this._prevBlock=t.slice(s,s+a)}}),t.Decryptor=t.extend({processBlock:function(t,s){var i=this._cipher,a=i.blockSize,r=t.slice(s,s+a);e.call(this,t,s,a,i),this._prevBlock=r}}),t}(),i.mode.CFB)},655:function(t,e,s){var i;t.exports=(i=s(359),s(951),
4
+ */!function(){var t={452:function(t,e,s){var i;t.exports=(i=s(359),s(139),s(174),s(844),s(951),function(){var t=i,e=t.lib.BlockCipher,s=t.algo,a=[],r=[],n=[],o=[],h=[],c=[],_=[],l=[],u=[],d=[];!function(){for(var t=[],e=0;e<256;e++)t[e]=e<128?e<<1:e<<1^283;var s=0,i=0;for(e=0;e<256;e++){var p=i^i<<1^i<<2^i<<3^i<<4;p=p>>>8^255&p^99,a[s]=p,r[p]=s;var m=t[s],E=t[m],g=t[E],w=257*t[p]^16843008*p;n[s]=w<<24|w>>>8,o[s]=w<<16|w>>>16,h[s]=w<<8|w>>>24,c[s]=w,w=16843009*g^65537*E^257*m^16843008*s,_[p]=w<<24|w>>>8,l[p]=w<<16|w>>>16,u[p]=w<<8|w>>>24,d[p]=w,s?(s=m^t[t[t[g^m]]],i^=t[t[i]]):s=i=1}}();var p=[0,1,2,4,8,16,32,64,128,27,54],m=s.AES=e.extend({_doReset:function(){if(!this._nRounds||this._keyPriorReset!==this._key){for(var t=this._keyPriorReset=this._key,e=t.words,s=t.sigBytes/4,i=4*((this._nRounds=s+6)+1),r=this._keySchedule=[],n=0;n<i;n++)n<s?r[n]=e[n]:(c=r[n-1],n%s?s>6&&n%s==4&&(c=a[c>>>24]<<24|a[c>>>16&255]<<16|a[c>>>8&255]<<8|a[255&c]):(c=a[(c=c<<8|c>>>24)>>>24]<<24|a[c>>>16&255]<<16|a[c>>>8&255]<<8|a[255&c],c^=p[n/s|0]<<24),r[n]=r[n-s]^c);for(var o=this._invKeySchedule=[],h=0;h<i;h++){if(n=i-h,h%4)var c=r[n];else c=r[n-4];o[h]=h<4||n<=4?c:_[a[c>>>24]]^l[a[c>>>16&255]]^u[a[c>>>8&255]]^d[a[255&c]]}}},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,n,o,h,c,a)},decryptBlock:function(t,e){var s=t[e+1];t[e+1]=t[e+3],t[e+3]=s,this._doCryptBlock(t,e,this._invKeySchedule,_,l,u,d,r),s=t[e+1],t[e+1]=t[e+3],t[e+3]=s},_doCryptBlock:function(t,e,s,i,a,r,n,o){for(var h=this._nRounds,c=t[e]^s[0],_=t[e+1]^s[1],l=t[e+2]^s[2],u=t[e+3]^s[3],d=4,p=1;p<h;p++){var m=i[c>>>24]^a[_>>>16&255]^r[l>>>8&255]^n[255&u]^s[d++],E=i[_>>>24]^a[l>>>16&255]^r[u>>>8&255]^n[255&c]^s[d++],g=i[l>>>24]^a[u>>>16&255]^r[c>>>8&255]^n[255&_]^s[d++],w=i[u>>>24]^a[c>>>16&255]^r[_>>>8&255]^n[255&l]^s[d++];c=m,_=E,l=g,u=w}m=(o[c>>>24]<<24|o[_>>>16&255]<<16|o[l>>>8&255]<<8|o[255&u])^s[d++],E=(o[_>>>24]<<24|o[l>>>16&255]<<16|o[u>>>8&255]<<8|o[255&c])^s[d++],g=(o[l>>>24]<<24|o[u>>>16&255]<<16|o[c>>>8&255]<<8|o[255&_])^s[d++],w=(o[u>>>24]<<24|o[c>>>16&255]<<16|o[_>>>8&255]<<8|o[255&l])^s[d++],t[e]=m,t[e+1]=E,t[e+2]=g,t[e+3]=w},keySize:8});t.AES=e._createHelper(m)}(),i.AES)},466:function(t,e,s){var i;t.exports=(i=s(359),s(139),s(174),s(844),s(951),function(){var t=i,e=t.lib.BlockCipher,s=t.algo;const a=16,r=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],n=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var o={pbox:[],sbox:[]};function h(t,e){let s=e>>24&255,i=e>>16&255,a=e>>8&255,r=255&e,n=t.sbox[0][s]+t.sbox[1][i];return n^=t.sbox[2][a],n+=t.sbox[3][r],n}function c(t,e,s){let i,r=e,n=s;for(let e=0;e<a;++e)r^=t.pbox[e],n=h(t,r)^n,i=r,r=n,n=i;return i=r,r=n,n=i,n^=t.pbox[a],r^=t.pbox[a+1],{left:r,right:n}}function _(t,e,s){let i,r=e,n=s;for(let e=a+1;e>1;--e)r^=t.pbox[e],n=h(t,r)^n,i=r,r=n,n=i;return i=r,r=n,n=i,n^=t.pbox[1],r^=t.pbox[0],{left:r,right:n}}function l(t,e,s){for(let e=0;e<4;e++){t.sbox[e]=[];for(let s=0;s<256;s++)t.sbox[e][s]=n[e][s]}let i=0;for(let n=0;n<a+2;n++)t.pbox[n]=r[n]^e[i],i++,i>=s&&(i=0);let o=0,h=0,_=0;for(let e=0;e<a+2;e+=2)_=c(t,o,h),o=_.left,h=_.right,t.pbox[e]=o,t.pbox[e+1]=h;for(let e=0;e<4;e++)for(let s=0;s<256;s+=2)_=c(t,o,h),o=_.left,h=_.right,t.sbox[e][s]=o,t.sbox[e][s+1]=h;return!0}var u=s.Blowfish=e.extend({_doReset:function(){if(this._keyPriorReset!==this._key){var t=this._keyPriorReset=this._key,e=t.words,s=t.sigBytes/4;l(o,e,s)}},encryptBlock:function(t,e){var s=c(o,t[e],t[e+1]);t[e]=s.left,t[e+1]=s.right},decryptBlock:function(t,e){var s=_(o,t[e],t[e+1]);t[e]=s.left,t[e+1]=s.right},blockSize:2,keySize:4,ivSize:2});t.Blowfish=e._createHelper(u)}(),i.Blowfish)},951:function(t,e,s){var i;t.exports=(i=s(359),s(844),void(i.lib.Cipher||function(t){var e=i,s=e.lib,a=s.Base,r=s.WordArray,n=s.BufferedBlockAlgorithm,o=e.enc,h=(o.Utf8,o.Base64),c=e.algo.EvpKDF,_=s.Cipher=n.extend({cfg:a.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,s){this.cfg=this.cfg.extend(s),this._xformMode=t,this._key=e,this.reset()},reset:function(){n.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(){function t(t){return"string"==typeof t?f:g}return function(e){return{encrypt:function(s,i,a){return t(i).encrypt(e,s,i,a)},decrypt:function(s,i,a){return t(i).decrypt(e,s,i,a)}}}}()}),l=(s.StreamCipher=_.extend({_doFinalize:function(){return this._process(!0)},blockSize:1}),e.mode={}),u=s.BlockCipherMode=a.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}}),d=l.CBC=function(){var e=u.extend();function s(e,s,i){var a,r=this._iv;r?(a=r,this._iv=t):a=this._prevBlock;for(var n=0;n<i;n++)e[s+n]^=a[n]}return e.Encryptor=e.extend({processBlock:function(t,e){var i=this._cipher,a=i.blockSize;s.call(this,t,e,a),i.encryptBlock(t,e),this._prevBlock=t.slice(e,e+a)}}),e.Decryptor=e.extend({processBlock:function(t,e){var i=this._cipher,a=i.blockSize,r=t.slice(e,e+a);i.decryptBlock(t,e),s.call(this,t,e,a),this._prevBlock=r}}),e}(),p=(e.pad={}).Pkcs7={pad:function(t,e){for(var s=4*e,i=s-t.sigBytes%s,a=i<<24|i<<16|i<<8|i,n=[],o=0;o<i;o+=4)n.push(a);var h=r.create(n,i);t.concat(h)},unpad:function(t){var e=255&t.words[t.sigBytes-1>>>2];t.sigBytes-=e}},m=(s.BlockCipher=_.extend({cfg:_.cfg.extend({mode:d,padding:p}),reset:function(){var t;_.reset.call(this);var e=this.cfg,s=e.iv,i=e.mode;this._xformMode==this._ENC_XFORM_MODE?t=i.createEncryptor:(t=i.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==t?this._mode.init(this,s&&s.words):(this._mode=t.call(i,this,s&&s.words),this._mode.__creator=t)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t,e=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(e.pad(this._data,this.blockSize),t=this._process(!0)):(t=this._process(!0),e.unpad(t)),t},blockSize:4}),s.CipherParams=a.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}})),E=(e.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext,s=t.salt;return(s?r.create([1398893684,1701076831]).concat(s).concat(e):e).toString(h)},parse:function(t){var e,s=h.parse(t),i=s.words;return 1398893684==i[0]&&1701076831==i[1]&&(e=r.create(i.slice(2,4)),i.splice(0,4),s.sigBytes-=16),m.create({ciphertext:s,salt:e})}},g=s.SerializableCipher=a.extend({cfg:a.extend({format:E}),encrypt:function(t,e,s,i){i=this.cfg.extend(i);var a=t.createEncryptor(s,i),r=a.finalize(e),n=a.cfg;return m.create({ciphertext:r,key:s,iv:n.iv,algorithm:t,mode:n.mode,padding:n.padding,blockSize:t.blockSize,formatter:i.format})},decrypt:function(t,e,s,i){return i=this.cfg.extend(i),e=this._parse(e,i.format),t.createDecryptor(s,i).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}}),w=(e.kdf={}).OpenSSL={execute:function(t,e,s,i,a){if(i||(i=r.random(8)),a)n=c.create({keySize:e+s,hasher:a}).compute(t,i);else var n=c.create({keySize:e+s}).compute(t,i);var o=r.create(n.words.slice(e),4*s);return n.sigBytes=4*e,m.create({key:n,iv:o,salt:i})}},f=s.PasswordBasedCipher=g.extend({cfg:g.cfg.extend({kdf:w}),encrypt:function(t,e,s,i){var a=(i=this.cfg.extend(i)).kdf.execute(s,t.keySize,t.ivSize,i.salt,i.hasher);i.iv=a.iv;var r=g.encrypt.call(this,t,e,a.key,i);return r.mixIn(a),r},decrypt:function(t,e,s,i){i=this.cfg.extend(i),e=this._parse(e,i.format);var a=i.kdf.execute(s,t.keySize,t.ivSize,e.salt,i.hasher);return i.iv=a.iv,g.decrypt.call(this,t,e,a.key,i)}})}()))},359:function(t,e,s){var i;t.exports=(i=i||function(t,e){var i;if("undefined"!=typeof window&&window.crypto&&(i=window.crypto),"undefined"!=typeof self&&self.crypto&&(i=self.crypto),"undefined"!=typeof globalThis&&globalThis.crypto&&(i=globalThis.crypto),!i&&"undefined"!=typeof window&&window.msCrypto&&(i=window.msCrypto),!i&&void 0!==s.g&&s.g.crypto&&(i=s.g.crypto),!i)try{i=s(633)}catch(t){}var a=function(){if(i){if("function"==typeof i.getRandomValues)try{return i.getRandomValues(new Uint32Array(1))[0]}catch(t){}if("function"==typeof i.randomBytes)try{return i.randomBytes(4).readInt32LE()}catch(t){}}throw new Error("Native crypto module could not be used to get secure random number.")},r=Object.create||function(){function t(){}return function(e){var s;return t.prototype=e,s=new t,t.prototype=null,s}}(),n={},o=n.lib={},h=o.Base={extend:function(t){var e=r(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},c=o.WordArray=h.extend({init:function(t,s){t=this.words=t||[],this.sigBytes=s!=e?s:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,s=t.words,i=this.sigBytes,a=t.sigBytes;if(this.clamp(),i%4)for(var r=0;r<a;r++){var n=s[r>>>2]>>>24-r%4*8&255;e[i+r>>>2]|=n<<24-(i+r)%4*8}else for(var o=0;o<a;o+=4)e[i+o>>>2]=s[o>>>2];return this.sigBytes+=a,this},clamp:function(){var e=this.words,s=this.sigBytes;e[s>>>2]&=4294967295<<32-s%4*8,e.length=t.ceil(s/4)},clone:function(){var t=h.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],s=0;s<t;s+=4)e.push(a());return new c.init(e,t)}}),_=n.enc={},l=_.Hex={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],a=0;a<s;a++){var r=e[a>>>2]>>>24-a%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i+=2)s[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new c.init(s,e/2)}},u=_.Latin1={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],a=0;a<s;a++){var r=e[a>>>2]>>>24-a%4*8&255;i.push(String.fromCharCode(r))}return i.join("")},parse:function(t){for(var e=t.length,s=[],i=0;i<e;i++)s[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new c.init(s,e)}},d=_.Utf8={stringify:function(t){try{return decodeURIComponent(escape(u.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return u.parse(unescape(encodeURIComponent(t)))}},p=o.BufferedBlockAlgorithm=h.extend({reset:function(){this._data=new c.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var s,i=this._data,a=i.words,r=i.sigBytes,n=this.blockSize,o=r/(4*n),h=(o=e?t.ceil(o):t.max((0|o)-this._minBufferSize,0))*n,_=t.min(4*h,r);if(h){for(var l=0;l<h;l+=n)this._doProcessBlock(a,l);s=a.splice(0,h),i.sigBytes-=_}return new c.init(s,_)},clone:function(){var t=h.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),m=(o.Hasher=p.extend({cfg:h.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,s){return new t.init(s).finalize(e)}},_createHmacHelper:function(t){return function(e,s){return new m.HMAC.init(t,s).finalize(e)}}}),n.algo={});return n}(Math),i)},139:function(t,e,s){var i;t.exports=(i=s(359),function(){var t=i,e=t.lib.WordArray;function s(t,s,i){for(var a=[],r=0,n=0;n<s;n++)if(n%4){var o=i[t.charCodeAt(n-1)]<<n%4*2|i[t.charCodeAt(n)]>>>6-n%4*2;a[r>>>2]|=o<<24-r%4*8,r++}return e.create(a,r)}t.enc.Base64={stringify:function(t){var e=t.words,s=t.sigBytes,i=this._map;t.clamp();for(var a=[],r=0;r<s;r+=3)for(var n=(e[r>>>2]>>>24-r%4*8&255)<<16|(e[r+1>>>2]>>>24-(r+1)%4*8&255)<<8|e[r+2>>>2]>>>24-(r+2)%4*8&255,o=0;o<4&&r+.75*o<s;o++)a.push(i.charAt(n>>>6*(3-o)&63));var h=i.charAt(64);if(h)for(;a.length%4;)a.push(h);return a.join("")},parse:function(t){var e=t.length,i=this._map,a=this._reverseMap;if(!a){a=this._reverseMap=[];for(var r=0;r<i.length;r++)a[i.charCodeAt(r)]=r}var n=i.charAt(64);if(n){var o=t.indexOf(n);-1!==o&&(e=o)}return s(t,e,a)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),i.enc.Base64)},950:function(t,e,s){var i;t.exports=(i=s(359),function(){var t=i,e=t.lib.WordArray;function s(t,s,i){for(var a=[],r=0,n=0;n<s;n++)if(n%4){var o=i[t.charCodeAt(n-1)]<<n%4*2|i[t.charCodeAt(n)]>>>6-n%4*2;a[r>>>2]|=o<<24-r%4*8,r++}return e.create(a,r)}t.enc.Base64url={stringify:function(t,e){void 0===e&&(e=!0);var s=t.words,i=t.sigBytes,a=e?this._safe_map:this._map;t.clamp();for(var r=[],n=0;n<i;n+=3)for(var o=(s[n>>>2]>>>24-n%4*8&255)<<16|(s[n+1>>>2]>>>24-(n+1)%4*8&255)<<8|s[n+2>>>2]>>>24-(n+2)%4*8&255,h=0;h<4&&n+.75*h<i;h++)r.push(a.charAt(o>>>6*(3-h)&63));var c=a.charAt(64);if(c)for(;r.length%4;)r.push(c);return r.join("")},parse:function(t,e){void 0===e&&(e=!0);var i=t.length,a=e?this._safe_map:this._map,r=this._reverseMap;if(!r){r=this._reverseMap=[];for(var n=0;n<a.length;n++)r[a.charCodeAt(n)]=n}var o=a.charAt(64);if(o){var h=t.indexOf(o);-1!==h&&(i=h)}return s(t,i,r)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",_safe_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"}}(),i.enc.Base64url)},164:function(t,e,s){var i;t.exports=(i=s(359),function(){var t=i,e=t.lib.WordArray,s=t.enc;function a(t){return t<<8&4278255360|t>>>8&16711935}s.Utf16=s.Utf16BE={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],a=0;a<s;a+=2){var r=e[a>>>2]>>>16-a%4*8&65535;i.push(String.fromCharCode(r))}return i.join("")},parse:function(t){for(var s=t.length,i=[],a=0;a<s;a++)i[a>>>1]|=t.charCodeAt(a)<<16-a%2*16;return e.create(i,2*s)}},s.Utf16LE={stringify:function(t){for(var e=t.words,s=t.sigBytes,i=[],r=0;r<s;r+=2){var n=a(e[r>>>2]>>>16-r%4*8&65535);i.push(String.fromCharCode(n))}return i.join("")},parse:function(t){for(var s=t.length,i=[],r=0;r<s;r++)i[r>>>1]|=a(t.charCodeAt(r)<<16-r%2*16);return e.create(i,2*s)}}}(),i.enc.Utf16)},844:function(t,e,s){var i,a,r,n,o,h,c,_;t.exports=(_=s(359),s(637),s(423),a=(i=_).lib,r=a.Base,n=a.WordArray,o=i.algo,h=o.MD5,c=o.EvpKDF=r.extend({cfg:r.extend({keySize:4,hasher:h,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){for(var s,i=this.cfg,a=i.hasher.create(),r=n.create(),o=r.words,h=i.keySize,c=i.iterations;o.length<h;){s&&a.update(s),s=a.update(t).finalize(e),a.reset();for(var _=1;_<c;_++)s=a.finalize(s),a.reset();r.concat(s)}return r.sigBytes=4*h,r}}),i.EvpKDF=function(t,e,s){return c.create(s).compute(t,e)},_.EvpKDF)},333:function(t,e,s){var i,a,r,n;t.exports=(n=s(359),s(951),a=(i=n).lib.CipherParams,r=i.enc.Hex,i.format.Hex={stringify:function(t){return t.ciphertext.toString(r)},parse:function(t){var e=r.parse(t);return a.create({ciphertext:e})}},n.format.Hex)},423:function(t,e,s){var i,a,r,n;t.exports=(i=s(359),r=(a=i).lib.Base,n=a.enc.Utf8,void(a.algo.HMAC=r.extend({init:function(t,e){t=this._hasher=new t.init,"string"==typeof e&&(e=n.parse(e));var s=t.blockSize,i=4*s;e.sigBytes>i&&(e=t.finalize(e)),e.clamp();for(var a=this._oKey=e.clone(),r=this._iKey=e.clone(),o=a.words,h=r.words,c=0;c<s;c++)o[c]^=1549556828,h[c]^=909522486;a.sigBytes=r.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher,s=e.finalize(t);return e.reset(),e.finalize(this._oKey.clone().concat(s))}})))},23:function(t,e,s){var i;t.exports=(i=s(359),s(467),s(816),s(164),s(139),s(950),s(174),s(637),s(93),s(640),s(834),s(716),s(140),s(293),s(423),s(414),s(844),s(951),s(173),s(782),s(655),s(957),s(129),s(994),s(236),s(476),s(921),s(181),s(333),s(452),s(567),s(830),s(480),s(730),s(466),i)},816:function(t,e,s){var i;t.exports=(i=s(359),function(){if("function"==typeof ArrayBuffer){var t=i.lib.WordArray,e=t.init,s=t.init=function(t){if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),(t instanceof Int8Array||"undefined"!=typeof Uint8ClampedArray&&t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array||t instanceof Float64Array)&&(t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)),t instanceof Uint8Array){for(var s=t.byteLength,i=[],a=0;a<s;a++)i[a>>>2]|=t[a]<<24-a%4*8;e.call(this,i,s)}else e.apply(this,arguments)};s.prototype=t}}(),i.lib.WordArray)},174:function(t,e,s){var i;t.exports=(i=s(359),function(t){var e=i,s=e.lib,a=s.WordArray,r=s.Hasher,n=e.algo,o=[];!function(){for(var e=0;e<64;e++)o[e]=4294967296*t.abs(t.sin(e+1))|0}();var h=n.MD5=r.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,e){for(var s=0;s<16;s++){var i=e+s,a=t[i];t[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var r=this._hash.words,n=t[e+0],h=t[e+1],d=t[e+2],p=t[e+3],m=t[e+4],E=t[e+5],g=t[e+6],w=t[e+7],f=t[e+8],v=t[e+9],y=t[e+10],S=t[e+11],A=t[e+12],T=t[e+13],I=t[e+14],C=t[e+15],P=r[0],D=r[1],N=r[2],O=r[3];P=c(P,D,N,O,n,7,o[0]),O=c(O,P,D,N,h,12,o[1]),N=c(N,O,P,D,d,17,o[2]),D=c(D,N,O,P,p,22,o[3]),P=c(P,D,N,O,m,7,o[4]),O=c(O,P,D,N,E,12,o[5]),N=c(N,O,P,D,g,17,o[6]),D=c(D,N,O,P,w,22,o[7]),P=c(P,D,N,O,f,7,o[8]),O=c(O,P,D,N,v,12,o[9]),N=c(N,O,P,D,y,17,o[10]),D=c(D,N,O,P,S,22,o[11]),P=c(P,D,N,O,A,7,o[12]),O=c(O,P,D,N,T,12,o[13]),N=c(N,O,P,D,I,17,o[14]),P=_(P,D=c(D,N,O,P,C,22,o[15]),N,O,h,5,o[16]),O=_(O,P,D,N,g,9,o[17]),N=_(N,O,P,D,S,14,o[18]),D=_(D,N,O,P,n,20,o[19]),P=_(P,D,N,O,E,5,o[20]),O=_(O,P,D,N,y,9,o[21]),N=_(N,O,P,D,C,14,o[22]),D=_(D,N,O,P,m,20,o[23]),P=_(P,D,N,O,v,5,o[24]),O=_(O,P,D,N,I,9,o[25]),N=_(N,O,P,D,p,14,o[26]),D=_(D,N,O,P,f,20,o[27]),P=_(P,D,N,O,T,5,o[28]),O=_(O,P,D,N,d,9,o[29]),N=_(N,O,P,D,w,14,o[30]),P=l(P,D=_(D,N,O,P,A,20,o[31]),N,O,E,4,o[32]),O=l(O,P,D,N,f,11,o[33]),N=l(N,O,P,D,S,16,o[34]),D=l(D,N,O,P,I,23,o[35]),P=l(P,D,N,O,h,4,o[36]),O=l(O,P,D,N,m,11,o[37]),N=l(N,O,P,D,w,16,o[38]),D=l(D,N,O,P,y,23,o[39]),P=l(P,D,N,O,T,4,o[40]),O=l(O,P,D,N,n,11,o[41]),N=l(N,O,P,D,p,16,o[42]),D=l(D,N,O,P,g,23,o[43]),P=l(P,D,N,O,v,4,o[44]),O=l(O,P,D,N,A,11,o[45]),N=l(N,O,P,D,C,16,o[46]),P=u(P,D=l(D,N,O,P,d,23,o[47]),N,O,n,6,o[48]),O=u(O,P,D,N,w,10,o[49]),N=u(N,O,P,D,I,15,o[50]),D=u(D,N,O,P,E,21,o[51]),P=u(P,D,N,O,A,6,o[52]),O=u(O,P,D,N,p,10,o[53]),N=u(N,O,P,D,y,15,o[54]),D=u(D,N,O,P,h,21,o[55]),P=u(P,D,N,O,f,6,o[56]),O=u(O,P,D,N,C,10,o[57]),N=u(N,O,P,D,g,15,o[58]),D=u(D,N,O,P,T,21,o[59]),P=u(P,D,N,O,m,6,o[60]),O=u(O,P,D,N,S,10,o[61]),N=u(N,O,P,D,d,15,o[62]),D=u(D,N,O,P,v,21,o[63]),r[0]=r[0]+P|0,r[1]=r[1]+D|0,r[2]=r[2]+N|0,r[3]=r[3]+O|0},_doFinalize:function(){var e=this._data,s=e.words,i=8*this._nDataBytes,a=8*e.sigBytes;s[a>>>5]|=128<<24-a%32;var r=t.floor(i/4294967296),n=i;s[15+(a+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),s[14+(a+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(s.length+1),this._process();for(var o=this._hash,h=o.words,c=0;c<4;c++){var _=h[c];h[c]=16711935&(_<<8|_>>>24)|4278255360&(_<<24|_>>>8)}return o},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function c(t,e,s,i,a,r,n){var o=t+(e&s|~e&i)+a+n;return(o<<r|o>>>32-r)+e}function _(t,e,s,i,a,r,n){var o=t+(e&i|s&~i)+a+n;return(o<<r|o>>>32-r)+e}function l(t,e,s,i,a,r,n){var o=t+(e^s^i)+a+n;return(o<<r|o>>>32-r)+e}function u(t,e,s,i,a,r,n){var o=t+(s^(e|~i))+a+n;return(o<<r|o>>>32-r)+e}e.MD5=r._createHelper(h),e.HmacMD5=r._createHmacHelper(h)}(Math),i.MD5)},173:function(t,e,s){var i;t.exports=(i=s(359),s(951),i.mode.CFB=function(){var t=i.lib.BlockCipherMode.extend();function e(t,e,s,i){var a,r=this._iv;r?(a=r.slice(0),this._iv=void 0):a=this._prevBlock,i.encryptBlock(a,0);for(var n=0;n<s;n++)t[e+n]^=a[n]}return t.Encryptor=t.extend({processBlock:function(t,s){var i=this._cipher,a=i.blockSize;e.call(this,t,s,a,i),this._prevBlock=t.slice(s,s+a)}}),t.Decryptor=t.extend({processBlock:function(t,s){var i=this._cipher,a=i.blockSize,r=t.slice(s,s+a);e.call(this,t,s,a,i),this._prevBlock=r}}),t}(),i.mode.CFB)},655:function(t,e,s){var i;t.exports=(i=s(359),s(951),
5
5
  /** @preserve
6
6
  * Counter block mode compatible with Dr Brian Gladman fileenc.c
7
7
  * derived from CryptoJS.mode.CTR
@@ -18,4 +18,4 @@ i.mode.CTRGladman=function(){var t=i.lib.BlockCipherMode.extend();function e(t){
18
18
 
19
19
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20
20
  */
21
- function(t){var e=i,s=e.lib,a=s.WordArray,r=s.Hasher,n=e.algo,o=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),_=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=a.create([0,1518500249,1859775393,2400959708,2840853838]),u=a.create([1352829926,1548603684,1836072691,2053994217,0]),d=n.RIPEMD160=r.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var s=0;s<16;s++){var i=e+s,a=t[i];t[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var r,n,d,v,y,S,A,T,I,C,D,P=this._hash.words,N=l.words,O=u.words,M=o.words,x=h.words,b=c.words,L=_.words;for(S=r=P[0],A=n=P[1],T=d=P[2],I=v=P[3],C=y=P[4],s=0;s<80;s+=1)D=r+t[e+M[s]]|0,D+=s<16?p(n,d,v)+N[0]:s<32?m(n,d,v)+N[1]:s<48?E(n,d,v)+N[2]:s<64?g(n,d,v)+N[3]:w(n,d,v)+N[4],D=(D=f(D|=0,b[s]))+y|0,r=y,y=v,v=f(d,10),d=n,n=D,D=S+t[e+x[s]]|0,D+=s<16?w(A,T,I)+O[0]:s<32?g(A,T,I)+O[1]:s<48?E(A,T,I)+O[2]:s<64?m(A,T,I)+O[3]:p(A,T,I)+O[4],D=(D=f(D|=0,L[s]))+C|0,S=C,C=I,I=f(T,10),T=A,A=D;D=P[1]+d+I|0,P[1]=P[2]+v+C|0,P[2]=P[3]+y+S|0,P[3]=P[4]+r+A|0,P[4]=P[0]+n+T|0,P[0]=D},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(e.length+1),this._process();for(var a=this._hash,r=a.words,n=0;n<5;n++){var o=r[n];r[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return a},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,s){return t^e^s}function m(t,e,s){return t&e|~t&s}function E(t,e,s){return(t|~e)^s}function g(t,e,s){return t&s|e&~s}function w(t,e,s){return t^(e|~s)}function f(t,e){return t<<e|t>>>32-e}e.RIPEMD160=r._createHelper(d),e.HmacRIPEMD160=r._createHmacHelper(d)}(Math),i.RIPEMD160)},637:function(t,e,s){var i,a,r,n,o,h,c,_;t.exports=(_=s(359),a=(i=_).lib,r=a.WordArray,n=a.Hasher,o=i.algo,h=[],c=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var s=this._hash.words,i=s[0],a=s[1],r=s[2],n=s[3],o=s[4],c=0;c<80;c++){if(c<16)h[c]=0|t[e+c];else{var _=h[c-3]^h[c-8]^h[c-14]^h[c-16];h[c]=_<<1|_>>>31}var l=(i<<5|i>>>27)+o+h[c];l+=c<20?1518500249+(a&r|~a&n):c<40?1859775393+(a^r^n):c<60?(a&r|a&n|r&n)-1894007588:(a^r^n)-899497514,o=n,n=r,r=a<<30|a>>>2,a=i,i=l}s[0]=s[0]+i|0,s[1]=s[1]+a|0,s[2]=s[2]+r|0,s[3]=s[3]+n|0,s[4]=s[4]+o|0},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=Math.floor(s/4294967296),e[15+(i+64>>>9<<4)]=s,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),i.SHA1=n._createHelper(c),i.HmacSHA1=n._createHmacHelper(c),_.SHA1)},640:function(t,e,s){var i,a,r,n,o,h;t.exports=(h=s(359),s(93),a=(i=h).lib.WordArray,r=i.algo,n=r.SHA256,o=r.SHA224=n.extend({_doReset:function(){this._hash=new a.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}}),i.SHA224=n._createHelper(o),i.HmacSHA224=n._createHmacHelper(o),h.SHA224)},93:function(t,e,s){var i;t.exports=(i=s(359),function(t){var e=i,s=e.lib,a=s.WordArray,r=s.Hasher,n=e.algo,o=[],h=[];!function(){function e(e){for(var s=t.sqrt(e),i=2;i<=s;i++)if(!(e%i))return!1;return!0}function s(t){return 4294967296*(t-(0|t))|0}for(var i=2,a=0;a<64;)e(i)&&(a<8&&(o[a]=s(t.pow(i,.5))),h[a]=s(t.pow(i,1/3)),a++),i++}();var c=[],_=n.SHA256=r.extend({_doReset:function(){this._hash=new a.init(o.slice(0))},_doProcessBlock:function(t,e){for(var s=this._hash.words,i=s[0],a=s[1],r=s[2],n=s[3],o=s[4],_=s[5],l=s[6],u=s[7],d=0;d<64;d++){if(d<16)c[d]=0|t[e+d];else{var p=c[d-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,E=c[d-2],g=(E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10;c[d]=m+c[d-7]+g+c[d-16]}var w=i&a^i&r^a&r,f=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),v=u+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&_^~o&l)+h[d]+c[d];u=l,l=_,_=o,o=n+v|0,n=r,r=a,a=i,i=v+(f+w)|0}s[0]=s[0]+i|0,s[1]=s[1]+a|0,s[2]=s[2]+r|0,s[3]=s[3]+n|0,s[4]=s[4]+o|0,s[5]=s[5]+_|0,s[6]=s[6]+l|0,s[7]=s[7]+u|0},_doFinalize:function(){var e=this._data,s=e.words,i=8*this._nDataBytes,a=8*e.sigBytes;return s[a>>>5]|=128<<24-a%32,s[14+(a+64>>>9<<4)]=t.floor(i/4294967296),s[15+(a+64>>>9<<4)]=i,e.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=r._createHelper(_),e.HmacSHA256=r._createHmacHelper(_)}(Math),i.SHA256)},140:function(t,e,s){var i;t.exports=(i=s(359),s(467),function(t){var e=i,s=e.lib,a=s.WordArray,r=s.Hasher,n=e.x64.Word,o=e.algo,h=[],c=[],_=[];!function(){for(var t=1,e=0,s=0;s<24;s++){h[t+5*e]=(s+1)*(s+2)/2%64;var i=(2*t+3*e)%5;t=e%5,e=i}for(t=0;t<5;t++)for(e=0;e<5;e++)c[t+5*e]=e+(2*t+3*e)%5*5;for(var a=1,r=0;r<24;r++){for(var o=0,l=0,u=0;u<7;u++){if(1&a){var d=(1<<u)-1;d<32?l^=1<<d:o^=1<<d-32}128&a?a=a<<1^113:a<<=1}_[r]=n.create(o,l)}}();var l=[];!function(){for(var t=0;t<25;t++)l[t]=n.create()}();var u=o.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new n.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var s=this._state,i=this.blockSize/2,a=0;a<i;a++){var r=t[e+2*a],n=t[e+2*a+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),(P=s[a]).high^=n,P.low^=r}for(var o=0;o<24;o++){for(var u=0;u<5;u++){for(var d=0,p=0,m=0;m<5;m++)d^=(P=s[u+5*m]).high,p^=P.low;var E=l[u];E.high=d,E.low=p}for(u=0;u<5;u++){var g=l[(u+4)%5],w=l[(u+1)%5],f=w.high,v=w.low;for(d=g.high^(f<<1|v>>>31),p=g.low^(v<<1|f>>>31),m=0;m<5;m++)(P=s[u+5*m]).high^=d,P.low^=p}for(var y=1;y<25;y++){var S=(P=s[y]).high,A=P.low,T=h[y];T<32?(d=S<<T|A>>>32-T,p=A<<T|S>>>32-T):(d=A<<T-32|S>>>64-T,p=S<<T-32|A>>>64-T);var I=l[c[y]];I.high=d,I.low=p}var C=l[0],D=s[0];for(C.high=D.high,C.low=D.low,u=0;u<5;u++)for(m=0;m<5;m++){var P=s[y=u+5*m],N=l[y],O=l[(u+1)%5+5*m],M=l[(u+2)%5+5*m];P.high=N.high^~O.high&M.high,P.low=N.low^~O.low&M.low}P=s[0];var x=_[o];P.high^=x.high,P.low^=x.low}},_doFinalize:function(){var e=this._data,s=e.words,i=(this._nDataBytes,8*e.sigBytes),r=32*this.blockSize;s[i>>>5]|=1<<24-i%32,s[(t.ceil((i+1)/r)*r>>>5)-1]|=128,e.sigBytes=4*s.length,this._process();for(var n=this._state,o=this.cfg.outputLength/8,h=o/8,c=[],_=0;_<h;_++){var l=n[_],u=l.high,d=l.low;u=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),c.push(d),c.push(u)}return new a.init(c,o)},clone:function(){for(var t=r.clone.call(this),e=t._state=this._state.slice(0),s=0;s<25;s++)e[s]=e[s].clone();return t}});e.SHA3=r._createHelper(u),e.HmacSHA3=r._createHmacHelper(u)}(Math),i.SHA3)},716:function(t,e,s){var i,a,r,n,o,h,c,_;t.exports=(_=s(359),s(467),s(834),a=(i=_).x64,r=a.Word,n=a.WordArray,o=i.algo,h=o.SHA512,c=o.SHA384=h.extend({_doReset:function(){this._hash=new n.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var t=h._doFinalize.call(this);return t.sigBytes-=16,t}}),i.SHA384=h._createHelper(c),i.HmacSHA384=h._createHmacHelper(c),_.SHA384)},834:function(t,e,s){var i;t.exports=(i=s(359),s(467),function(){var t=i,e=t.lib.Hasher,s=t.x64,a=s.Word,r=s.WordArray,n=t.algo;function o(){return a.create.apply(a,arguments)}var h=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],c=[];!function(){for(var t=0;t<80;t++)c[t]=o()}();var _=n.SHA512=e.extend({_doReset:function(){this._hash=new r.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var s=this._hash.words,i=s[0],a=s[1],r=s[2],n=s[3],o=s[4],_=s[5],l=s[6],u=s[7],d=i.high,p=i.low,m=a.high,E=a.low,g=r.high,w=r.low,f=n.high,v=n.low,y=o.high,S=o.low,A=_.high,T=_.low,I=l.high,C=l.low,D=u.high,P=u.low,N=d,O=p,M=m,x=E,b=g,L=w,R=f,B=v,U=y,k=S,W=A,V=T,F=I,Y=C,G=D,H=P,K=0;K<80;K++){var j,X,J=c[K];if(K<16)X=J.high=0|t[e+2*K],j=J.low=0|t[e+2*K+1];else{var $=c[K-15],Z=$.high,q=$.low,z=(Z>>>1|q<<31)^(Z>>>8|q<<24)^Z>>>7,Q=(q>>>1|Z<<31)^(q>>>8|Z<<24)^(q>>>7|Z<<25),tt=c[K-2],et=tt.high,st=tt.low,it=(et>>>19|st<<13)^(et<<3|st>>>29)^et>>>6,at=(st>>>19|et<<13)^(st<<3|et>>>29)^(st>>>6|et<<26),rt=c[K-7],nt=rt.high,ot=rt.low,ht=c[K-16],ct=ht.high,_t=ht.low;X=(X=(X=z+nt+((j=Q+ot)>>>0<Q>>>0?1:0))+it+((j+=at)>>>0<at>>>0?1:0))+ct+((j+=_t)>>>0<_t>>>0?1:0),J.high=X,J.low=j}var lt,ut=U&W^~U&F,dt=k&V^~k&Y,pt=N&M^N&b^M&b,mt=O&x^O&L^x&L,Et=(N>>>28|O<<4)^(N<<30|O>>>2)^(N<<25|O>>>7),gt=(O>>>28|N<<4)^(O<<30|N>>>2)^(O<<25|N>>>7),wt=(U>>>14|k<<18)^(U>>>18|k<<14)^(U<<23|k>>>9),ft=(k>>>14|U<<18)^(k>>>18|U<<14)^(k<<23|U>>>9),vt=h[K],yt=vt.high,St=vt.low,At=G+wt+((lt=H+ft)>>>0<H>>>0?1:0),Tt=gt+mt;G=F,H=Y,F=W,Y=V,W=U,V=k,U=R+(At=(At=(At=At+ut+((lt+=dt)>>>0<dt>>>0?1:0))+yt+((lt+=St)>>>0<St>>>0?1:0))+X+((lt+=j)>>>0<j>>>0?1:0))+((k=B+lt|0)>>>0<B>>>0?1:0)|0,R=b,B=L,b=M,L=x,M=N,x=O,N=At+(Et+pt+(Tt>>>0<gt>>>0?1:0))+((O=lt+Tt|0)>>>0<lt>>>0?1:0)|0}p=i.low=p+O,i.high=d+N+(p>>>0<O>>>0?1:0),E=a.low=E+x,a.high=m+M+(E>>>0<x>>>0?1:0),w=r.low=w+L,r.high=g+b+(w>>>0<L>>>0?1:0),v=n.low=v+B,n.high=f+R+(v>>>0<B>>>0?1:0),S=o.low=S+k,o.high=y+U+(S>>>0<k>>>0?1:0),T=_.low=T+V,_.high=A+W+(T>>>0<V>>>0?1:0),C=l.low=C+Y,l.high=I+F+(C>>>0<Y>>>0?1:0),P=u.low=P+H,u.high=D+G+(P>>>0<H>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(s/4294967296),e[31+(i+128>>>10<<5)]=s,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=e.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});t.SHA512=e._createHelper(_),t.HmacSHA512=e._createHmacHelper(_)}(),i.SHA512)},567:function(t,e,s){var i;t.exports=(i=s(359),s(139),s(174),s(844),s(951),function(){var t=i,e=t.lib,s=e.WordArray,a=e.BlockCipher,r=t.algo,n=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],_=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=r.DES=a.extend({_doReset:function(){for(var t=this._key.words,e=[],s=0;s<56;s++){var i=n[s]-1;e[s]=t[i>>>5]>>>31-i%32&1}for(var a=this._subKeys=[],r=0;r<16;r++){var c=a[r]=[],_=h[r];for(s=0;s<24;s++)c[s/6|0]|=e[(o[s]-1+_)%28]<<31-s%6,c[4+(s/6|0)]|=e[28+(o[s+24]-1+_)%28]<<31-s%6;for(c[0]=c[0]<<1|c[0]>>>31,s=1;s<7;s++)c[s]=c[s]>>>4*(s-1)+3;c[7]=c[7]<<5|c[7]>>>27}var l=this._invSubKeys=[];for(s=0;s<16;s++)l[s]=a[15-s]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,s){this._lBlock=t[e],this._rBlock=t[e+1],u.call(this,4,252645135),u.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),u.call(this,1,1431655765);for(var i=0;i<16;i++){for(var a=s[i],r=this._lBlock,n=this._rBlock,o=0,h=0;h<8;h++)o|=c[h][((n^a[h])&_[h])>>>0];this._lBlock=n,this._rBlock=r^o}var l=this._lBlock;this._lBlock=this._rBlock,this._rBlock=l,u.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(t,e){var s=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=s,this._lBlock^=s<<t}function d(t,e){var s=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=s,this._rBlock^=s<<t}t.DES=a._createHelper(l);var p=r.TripleDES=a.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),i=t.length<4?t.slice(0,2):t.slice(2,4),a=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=l.createEncryptor(s.create(e)),this._des2=l.createEncryptor(s.create(i)),this._des3=l.createEncryptor(s.create(a))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=a._createHelper(p)}(),i.TripleDES)},467:function(t,e,s){var i;t.exports=(i=s(359),function(t){var e=i,s=e.lib,a=s.Base,r=s.WordArray,n=e.x64={};n.Word=a.extend({init:function(t,e){this.high=t,this.low=e}}),n.WordArray=a.extend({init:function(e,s){e=this.words=e||[],this.sigBytes=s!=t?s:8*e.length},toX32:function(){for(var t=this.words,e=t.length,s=[],i=0;i<e;i++){var a=t[i];s.push(a.high),s.push(a.low)}return r.create(s,this.sigBytes)},clone:function(){for(var t=a.clone.call(this),e=t.words=this.words.slice(0),s=e.length,i=0;i<s;i++)e[i]=e[i].clone();return t}})}(),i)},633:function(){},106:function(){}},e={};function s(i){var a=e[i];if(void 0!==a)return a.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,s),r.exports}s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,{a:e}),e},s.d=function(t,e){for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){"use strict";const t=Object.freeze({CONFIRM_LOAD_SOUND:{code:1,defaultText:"効果音・BGMデータをロードしますか?",mapdataParams:{messageArea:"systemMessage",index:2}},NO_MONEY:{code:101,defaultText:"所持金がたりない。",mapdataParams:{messageArea:"message",index:6}},NO_ITEM:{code:201,mapdataParams:{messageArea:"message",index:7},defaultText:"アイテムを持っていない。"},ITEM_BOX_FULL:{code:202,defaultText:"これ以上、アイテムを持てません。",mapdataParams:{messageArea:"systemMessage",index:1}},ITEM_SELECT_TUTORIAL:{code:203,defaultText:"このアイテムは%HOW_TO_USE_ITEM%ことで使用できます。\n使用できるアイテムは色枠で囲まれます。",mapdataParams:{messageArea:"systemMessage",index:0}},CONFIRM_USE_ITEM:{code:204,defaultText:"このアイテムを使用します。\nよろしいですか?",mapdataParams:{messageArea:"message",index:8}},CANNOT_DAMAGE_MONSTER:{code:301,defaultText:"相手の防御能力が高すぎる!"},BATTLE_NOT_SETTLED:{code:302,defaultText:"勝負がつかない!"},CONFIRM_ENTER_URL_GATE:{code:401,defaultText:"他のページにリンクします。\nよろしいですか?",mapdataParams:{messageArea:"message",index:5}},GAME_SPEED_CHANGED:{code:501,defaultText:"移動速度を【%GAME_SPEED_NAME%】に切り替えました。\n%HIGH_SPEED_MESSAGE%(%MAX_SPEED_INDEX%段階中%GAME_SPEED_INDEX%)\n速度を落とすには%SPEED_DOWN_BUTTON%, 速度を上げるには%SPEED_UP_BUTTON%を押してください。"},GAME_SPEED_CHANGE_DISABLED:{code:502,defaultText:"ここでは移動速度を\n変更できません。"}}),e=Object.keys(t),i=e.reduce(((t,e)=>({...t,[e]:e})),{}),a=t;function r(t){return e.some((e=>e===t))}function n(t){for(let s of e)if(a[s].code===t)return s}class o{add(t){return this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return new o(this.strength+t.strength,this.defence+t.defence)}minus(t){return new o(this.strength-t.strength,this.defence-t.defence)}equals(t){return this.strength===t.strength&&this.defence===t.defence}constructor(t,e){this.strength=t,this.defence=e}}class h extends o{add(t){return t instanceof h&&(this.energy+=t.energy,this.gold+=t.gold),this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return t instanceof h?new h(this.energy+t.energy,this.strength+t.strength,this.defence+t.defence,this.gold+t.gold):new h(this.energy,this.strength+t.strength,this.defence+t.defence,this.gold)}minus(t){return t instanceof h?new h(this.energy-t.energy,this.strength-t.strength,this.defence-t.defence,this.gold-t.gold):new h(this.energy,this.strength-t.strength,this.defence-t.defence,this.gold)}equals(t){return this.energy===t.energy&&this.strength===t.strength&&this.defence===t.defence&&this.gold===t.gold}calculateScore(t){return Object.keys(t.rates).reduce(((e,s)=>e+t.rates[s]*this[s]),0)}clone(){return new h(this.energy,this.strength,this.defence,this.gold)}constructor(t,e,s,i){super(e,s),this.energy=t,this.gold=i}}class c{equals(t){return this.x===t.x&&this.y===t.y}substract(t){return new c(this.x-t.x,this.y-t.y)}clone(){return new c(this.x,this.y)}convertIntoPosition(t){return new _(t,this.x,this.y,0,0)}getDirectionTo(t){return this.x<t.x?this.y>t.y?p.RIGHT_UP:this.y===t.y?p.RIGHT:p.RIGHT_DOWN:this.x===t.x?this.y>t.y?p.UP:this.y===t.y?p.NO_DIRECTION:p.DOWN:this.y>t.y?p.LEFT_UP:this.y===t.y?p.LEFT:p.LEFT_DOWN}toString(){return"("+this.x+", "+this.y+")"}constructor(t=0,e=0){this.x=t,this.y=e}}class _{getPartsCoord(){return this._partsCoord}getOffsetCoord(){return this._offsetCoord}getScreenTopPosition(){var t=Math.floor(this._partsCoord.x/(V.H_PARTS_NUM_IN_WINDOW-1))*(V.H_PARTS_NUM_IN_WINDOW-1),e=Math.floor(this._partsCoord.y/(V.V_PARTS_NUM_IN_WINDOW-1))*(V.V_PARTS_NUM_IN_WINDOW-1);return new _(this._wwa,t,e,0,0)}getDefaultCameraPosition(){var t=this.getScreenTopPosition(),e=t.getPartsCoord(),s=this._wwa.getMapWidth(),i=t.getPartsCoord().clone();return e.x===s-1&&i.x--,e.y===s-1&&i.y--,i.convertIntoPosition(this._wwa).getScreenTopPosition()}getNextJustPosition(t){if(void 0!==t){var e=this._partsCoord;return new _(this._wwa,e.x+m[t],e.y+E[t],0,0)}var s=this._partsCoord.x,i=this._partsCoord.y;return this._offsetCoord.x<0?s--:this._offsetCoord.x>0&&s++,this._offsetCoord.y<0?i--:this._offsetCoord.y>0&&i++,new _(this._wwa,s,i,0,0)}getNextFramePosition(t,e,s){var i=this._partsCoord.x,a=this._partsCoord.y,r=this._offsetCoord.x+m[t]*e,n=this._offsetCoord.y+E[t]*s;if(r<0){var o=Math.floor(Math.abs(r)/V.CHIP_SIZE);i-=o,r=(r+o*V.CHIP_SIZE)%V.CHIP_SIZE}if(n<0){var h=Math.floor(Math.abs(n)/V.CHIP_SIZE);a-=h,n=(n+h*V.CHIP_SIZE)%V.CHIP_SIZE}return r>=V.CHIP_SIZE&&(i+=Math.floor(r/V.CHIP_SIZE),r=(r+V.CHIP_SIZE)%V.CHIP_SIZE),n>=V.CHIP_SIZE&&(a+=Math.floor(n/V.CHIP_SIZE),n=(n+V.CHIP_SIZE)%V.CHIP_SIZE),new _(this._wwa,i,a,r,n)}isJustPosition(){return 0==this._offsetCoord.x&&0==this._offsetCoord.y}isScreenTopPosition(){var t=this.getScreenTopPosition();return this.equals(t)}equals(t){return this._partsCoord.equals(t.getPartsCoord())&&this._offsetCoord.equals(t.getOffsetCoord())}isInCameraRange(t,e=!1){var s=t.getPosition()._partsCoord,i=this._partsCoord.x,a=this._partsCoord.y,r=e?1:0;return s.x<=i&&i<s.x+V.H_PARTS_NUM_IN_WINDOW-r&&s.y<=a&&a<s.y+V.V_PARTS_NUM_IN_WINDOW-r}hasLocalGate(){return this._wwa.getMapTypeByPosition(this)===V.MAP_LOCALGATE||this._wwa.getObjectTypeByPosition(this)===V.OBJECT_LOCALGATE}clone(){return new _(this._wwa,this._partsCoord.x,this._partsCoord.y,this._offsetCoord.x,this._offsetCoord.y)}constructor(t,e,s,i=0,a=0){if(this._wwa=t,void 0===this._wwa)throw new Error("WWAのインスタンスが存在しません. ");var r=this._wwa.getMapWidth();if(e<0||e>=r||e>=r-1&&i>0||s<0||s>=r||s>=r-1&&a>0)throw new Error("範囲外の座標です!! parts:("+e+", "+s+"), offset:("+i+", "+a+"), mapWidth = "+r);this._partsCoord=new c(e,s),this._offsetCoord=new c(i,a)}}class l{constructor(t,e,s){this.destPos=t.clone(),this.srcPos=e.clone(),this.srcSize=s.clone()}}class u{constructor(t,e,s,i,a){this.partsIDObj=t,this.x=e,this.y=s,this.isStatic=i,this.isFighting=a}}var d,p;!function(t){t[t.GOTO_WWA=0]="GOTO_WWA",t[t.BATTLE_REPORT=1]="BATTLE_REPORT",t[t.GAME_END=2]="GAME_END"}(d||(d={})),function(t){t[t.UNUSED=0]="UNUSED",t[t.LEFT=4]="LEFT",t[t.RIGHT=6]="RIGHT",t[t.DOWN=2]="DOWN",t[t.UP=8]="UP",t[t.LEFT_DOWN=1]="LEFT_DOWN",t[t.LEFT_UP=7]="LEFT_UP",t[t.RIGHT_DOWN=3]="RIGHT_DOWN",t[t.RIGHT_UP=9]="RIGHT_UP",t[t.NO_DIRECTION=5]="NO_DIRECTION"}(p||(p={}));const m=[0,-1,0,1,-1,0,1,-1,0,1],E=[0,1,1,1,0,0,0,-1,-1,-1];var g,w,f,v,y,S,A,T,I,C,D,P,N;!function(t){t[t.YES=0]="YES",t[t.NO=1]="NO",t[t.UNSELECTED=2]="UNSELECTED"}(g||(g={})),function(t){t[t.MAP=0]="MAP",t[t.OBJECT=1]="OBJECT",t[t.CHOICE_YES=2]="CHOICE_YES",t[t.CHOICE_NO=3]="CHOICE_NO"}(w||(w={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.CAN_USE=1]="CAN_USE",t[t.NOT_DISAPPEAR=2]="NOT_DISAPPEAR"}(f||(f={})),function(t){t[t.MAP=1]="MAP",t[t.OBJECT=0]="OBJECT"}(v||(v={}));class O{constructor(){var t=window.navigator.userAgent;this.os=this._getOS(t),this.browser=this.getBrowser(t),this.device=this.getDevice()}_getOS(t){return t.match(/xbox/i)?y.XBOX:t.match(/windows/i)?y.WINDOWS:t.match(/macintosh/i)?"ontouchstart"in document?y.IOS:y.MACINTOSH:t.match(/iphone|ipad|ipod/i)?y.IOS:t.match(/oculus/i)?y.OCULUS:t.match(/android/i)?y.ANDROID:t.match(/nintendo/i)?y.NINTENDO:t.match(/playstation/i)?y.PLAY_STATION:t.match(/linux/i)?y.LINUX:y.OTHERS}getBrowser(t){return t.match(/chrome/i)?A.CHROME:t.match(/firefox/i)?A.FIREFOX:t.match(/safari/i)?A.SAFARI:A.OTHERS}getDevice(){switch(this.os){case y.WINDOWS:case y.MACINTOSH:case y.LINUX:return S.PC;case y.IOS:case y.ANDROID:return S.SP;case y.OCULUS:return S.VR;case y.NINTENDO:case y.PLAY_STATION:case y.XBOX:return S.GAME}return S.OTHERS}}!function(t){t[t.WINDOWS=1]="WINDOWS",t[t.MACINTOSH=2]="MACINTOSH",t[t.LINUX=3]="LINUX",t[t.ANDROID=4]="ANDROID",t[t.IOS=5]="IOS",t[t.NINTENDO=6]="NINTENDO",t[t.PLAY_STATION=7]="PLAY_STATION",t[t.OCULUS=8]="OCULUS",t[t.XBOX=9]="XBOX",t[t.OTHERS=9999]="OTHERS"}(y||(y={})),function(t){t[t.PC=1]="PC",t[t.SP=2]="SP",t[t.VR=3]="VR",t[t.GAME=4]="GAME",t[t.OTHERS=9999]="OTHERS"}(S||(S={})),function(t){t[t.CHROME=1]="CHROME",t[t.FIREFOX=2]="FIREFOX",t[t.SAFARI=3]="SAFARI",t[t.OTHERS=9999]="OTHERS"}(A||(A={})),function(t){t[t.NONE=0]="NONE",t[t.CALL_BY_MAP_PARTS=1]="CALL_BY_MAP_PARTS",t[t.CALL_BY_OBJECT_PARTS=2]="CALL_BY_OBJECT_PARTS",t[t.CALL_BY_ITEM_USE=3]="CALL_BY_ITEM_USE",t[t.CALL_BY_QUICK_SAVE=4]="CALL_BY_QUICK_SAVE",t[t.CALL_BY_QUICK_LOAD=5]="CALL_BY_QUICK_LOAD",t[t.CALL_BY_RESTART_GAME=6]="CALL_BY_RESTART_GAME",t[t.CALL_BY_GOTO_WWA=7]="CALL_BY_GOTO_WWA",t[t.CALL_BY_PASSWORD_SAVE=8]="CALL_BY_PASSWORD_SAVE",t[t.CALL_BY_PASSWORD_LOAD=9]="CALL_BY_PASSWORD_LOAD",t[t.CALL_BY_END_GAME=10]="CALL_BY_END_GAME",t[t.CALL_BY_SUSPEND=11]="CALL_BY_SUSPEND",t[t.CALL_BY_LOG_QUICK_SAVE=12]="CALL_BY_LOG_QUICK_SAVE",t[t.CALL_BY_LOG_QUICK_LOAD=13]="CALL_BY_LOG_QUICK_LOAD"}(T||(T={})),function(t){t[t.QUICK_LOAD=0]="QUICK_LOAD",t[t.QUICK_SAVE=1]="QUICK_SAVE",t[t.RESTART_GAME=2]="RESTART_GAME",t[t.GOTO_WWA=3]="GOTO_WWA"}(I||(I={})),function(t){t[t.UP=0]="UP",t[t.DOWN=1]="DOWN"}(C||(C={})),function(t){t[t.QUICK_LOAD=0]="QUICK_LOAD",t[t.RESTART_GAME=1]="RESTART_GAME",t[t.PASSWORD=2]="PASSWORD"}(D||(D={})),function(t){t[t.STATIC=0]="STATIC",t[t.CHASE_PLAYER=1]="CHASE_PLAYER",t[t.RUN_OUT=2]="RUN_OUT",t[t.HANG_AROUND=3]="HANG_AROUND"}(P||(P={})),function(t){t[t.MODE_X=0]="MODE_X",t[t.MODE_Y=1]="MODE_Y",t[t.UNDECIDED=2]="UNDECIDED"}(N||(N={}));var M,x=["cell-load","cell-save","cell-restart","cell-gotowwa"];!function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.IMGPLAYER=1]="IMGPLAYER",t[t.IMGYESNO=2]="IMGYESNO",t[t.HPMAX=3]="HPMAX",t[t.SAVE=4]="SAVE",t[t.ITEM=5]="ITEM",t[t.DEFAULT=6]="DEFAULT",t[t.OLDMAP=7]="OLDMAP",t[t.PARTS=8]="PARTS",t[t.MOVE=9]="MOVE",t[t.MAP=10]="MAP",t[t.DIRMAP=11]="DIRMAP",t[t.IMGFRAME=12]="IMGFRAME",t[t.IMGBOM=13]="IMGBOM",t[t.DELPLAYER=14]="DELPLAYER",t[t.FACE=15]="FACE",t[t.EFFECT=16]="EFFECT",t[t.GAMEOVER=17]="GAMEOVER",t[t.IMGCLICK=18]="IMGCLICK",t[t.STATUS=19]="STATUS",t[t.EFFITEM=20]="EFFITEM",t[t.COLOR=21]="COLOR",t[t.WAIT=22]="WAIT",t[t.SOUND=23]="SOUND",t[t.JUMPGATE=24]="JUMPGATE",t[t.RECPOSITION=25]="RECPOSITION",t[t.JUMPRECPOSITION=26]="JUMPRECPOSITION",t[t.CONSOLE_LOG=27]="CONSOLE_LOG",t[t.COPY_HP_TO=28]="COPY_HP_TO",t[t.SET_HP=29]="SET_HP",t[t.COPY_HPMAX_TO=30]="COPY_HPMAX_TO",t[t.SET_HPMAX=31]="SET_HPMAX",t[t.COPY_AT_TO=32]="COPY_AT_TO",t[t.SET_AT=33]="SET_AT",t[t.COPY_DF_TO=34]="COPY_DF_TO",t[t.SET_DF=35]="SET_DF",t[t.COPY_MONEY_TO=36]="COPY_MONEY_TO",t[t.SET_MONEY=37]="SET_MONEY",t[t.COPY_STEP_COUNT_TO=38]="COPY_STEP_COUNT_TO",t[t.VAR_SET_VAL=39]="VAR_SET_VAL",t[t.VAR_SET=40]="VAR_SET",t[t.VAR_ADD=41]="VAR_ADD",t[t.VAR_SUB=42]="VAR_SUB",t[t.VAR_MUL=43]="VAR_MUL",t[t.VAR_DIV=44]="VAR_DIV",t[t.VAR_SET_RAND=45]="VAR_SET_RAND",t[t.SHOW_STR=46]="SHOW_STR",t[t.GAME_SPEED=47]="GAME_SPEED",t[t.IF=50]="IF",t[t.SET_SPEED=51]="SET_SPEED",t[t.COPY_TIME_TO=52]="COPY_TIME_TO",t[t.HIDE_STATUS=53]="HIDE_STATUS",t[t.VAR_MAP=54]="VAR_MAP",t[t.VAR_MOD=55]="VAR_MOD",t[t.NO_GAMEOVER=56]="NO_GAMEOVER",t[t.ELSE_IF=57]="ELSE_IF",t[t.ELSE=58]="ELSE",t[t.END_IF=59]="END_IF",t[t.SET=60]="SET",t[t.MAP2=61]="MAP2",t[t.SHOW_STR2=62]="SHOW_STR2",t[t.CONSOLE_LOG2=63]="CONSOLE_LOG2",t[t.DELAYBGM=64]="DELAYBGM",t[t.SYSMSG=65]="SYSMSG",t[t.PICTURE=66]="PICTURE",t[t.GAMEPAD_BUTTON=100]="GAMEPAD_BUTTON",t[t.OLDMOVE=101]="OLDMOVE",t[t.LEGACY_IF=10050]="LEGACY_IF"}(M||(M={}));var b,L,R,B={"":0,$imgplayer:1,$imgyesno:2,$hpmax:3,$save:4,$item:5,$default:6,$oldmap:7,$parts:8,$move:9,$map:10,$dirmap:11,$imgframe:12,$imgbom:13,$delplayer:14,$face:15,$effect:16,$gameover:17,$imgclick:18,$status:19,$effitem:20,$color:21,$wait:22,$sound:23,$jumpgate:24,$rec_pos:25,$jump_rec_pos:26,$console_log:27,$copy_hp_to:28,$set_hp:29,$copy_hpmax_to:30,$set_hpmax:31,$copy_at_to:32,$set_at:33,$copy_df_to:34,$set_df:35,$copy_money_to:36,$set_money:37,$copy_step_count_to:38,$var_set_val:39,$var_set:40,$var_add:41,$var_sub:42,$var_mul:43,$var_div:44,$var_set_rand:45,$show_str:46,$game_speed:47,$if:50,$set_speed:51,$copy_time_to:52,$hide_status:53,$var_map:54,$var_mod:55,$no_gameover:56,$else_if:57,$else:58,$endif:59,$set:60,$map2:61,$show_str2:62,$console_log2:63,$delaybgm:64,$sysmsg:65,$picture:66,$gamepad_button:100,$oldmove:101};!function(t){t[t.ENERGY=0]="ENERGY",t[t.STRENGTH=1]="STRENGTH",t[t.DEFENCE=2]="DEFENCE",t[t.GOLD=3]="GOLD",t[t.MOVES=4]="MOVES"}(b||(b={})),function(t){t[t.ENERGY=0]="ENERGY",t[t.STRENGTH=1]="STRENGTH",t[t.DEFENCE=2]="DEFENCE",t[t.GOLD=3]="GOLD",t[t.WIDE_CELL_ROW=4]="WIDE_CELL_ROW",t[t.ITEM_BG=5]="ITEM_BG",t[t.MAIN_FRAME=6]="MAIN_FRAME"}(L||(L={})),function(t){t[t.DECISION=1]="DECISION",t[t.ATTACK=3]="ATTACK",t[t.BGM_LB=70]="BGM_LB",t[t.NO_SOUND=99]="NO_SOUND"}(R||(R={}));const U=[1,2,5,8,10,20],k=["超低速","低速","準低速","中速","高速","超高速"],W=["energy","strength","defence","gold"];class V{}V.WWA_HOME="http://wwajp.com",V.ITEMBOX_SIZE=12,V.MAP_ATR_MAX=60,V.OBJ_ATR_MAX=60,V.OLD_MAP_ATR_MAX=40,V.OLD_OBJ_ATR_MAX=40,V.ATR_TYPE=3,V.ATR_MODE=4,V.ATR_STRING=5,V.ATR_X=6,V.ATR_Y=7,V.ATR_X2=8,V.ATR_Y2=9,V.ATR_ENERGY=10,V.ATR_STRENGTH=11,V.ATR_DEFENCE=12,V.ATR_GOLD=13,V.ATR_ITEM=14,V.ATR_NUMBER=15,V.ATR_JUMP_X=16,V.ATR_MOVE=16,V.ATR_JUMP_Y=17,V.ATR_SOUND=19,V.ATR_APPERANCE_BASE=20,V.REL_ATR_APPERANCE_ID=0,V.REL_ATR_APPERANCE_X=1,V.REL_ATR_APPERANCE_Y=2,V.REL_ATR_APPERANCE_TYPE=3,V.REL_ATR_APPERANCE_UNIT_LENGTH=4,V.ATR_RANDOM_BASE=10,V.RANDOM_ATR_NUM=10,V.RANDOM_ITERATION_MAX=10,V.MAP_STREET=0,V.MAP_WALL=1,V.MAP_LOCALGATE=2,V.MAP_URLGATE=4,V.OBJECT_NORMAL=0,V.OBJECT_MESSAGE=1,V.OBJECT_URLGATE=2,V.OBJECT_STATUS=3,V.OBJECT_ITEM=4,V.OBJECT_DOOR=5,V.OBJECT_MONSTER=6,V.OBJECT_SCORE=11,V.OBJECT_SELL=14,V.OBJECT_BUY=15,V.OBJECT_RANDOM=16,V.OBJECT_SELECT=17,V.OBJECT_LOCALGATE=18,V.SYSTEM_MESSAGE_NUM=20,V.IMGPOS_DEFAULT_YESNO_X=3,V.IMGPOS_DEFAULT_YESNO_Y=1,V.IMGRELPOS_YESNO_YES_X=0,V.IMGRELPOS_YESNO_NO_X=1,V.IMGRELPOS_YESNO_YESP_X=2,V.IMGRELPOS_YESNO_NOP_X=3,V.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0,V.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0,V.IMGPOS_DEFAULT_FRAME_X=0,V.IMGPOS_DEFAULT_FRAME_Y=1,V.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3,V.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3,V.DEFAULT_DISABLE_SAVE=!1,V.DEFAULT_OLDMAP=!1,V.DEFAULT_OBJECT_NO_COLLAPSE=!1,V.SPLASH_SCREEN_DISP_MILLS=100,V.DEFAULT_FRAME_INTERVAL=20,V.GAMEOVER_FRAME_INTERVAL=50,V.YESNO_PRESS_DISP_FRAME_NUM=20,V.WAIT_TIME_FRAME_NUM=6,V.CHIP_SIZE=40,V.MAP_WINDOW_WIDTH=440,V.MAP_WINDOW_HEIGHT=440,V.H_PARTS_NUM_IN_WINDOW=V.MAP_WINDOW_WIDTH/V.CHIP_SIZE,V.V_PARTS_NUM_IN_WINDOW=V.MAP_WINDOW_HEIGHT/V.CHIP_SIZE,V.MIN_SPEED_INDEX=0,V.MAX_SPEED_INDEX=U.length-1,V.QUICK_BATTLE_SPEED_INDECIES=[U.length-2,U.length-1],V.ANIMATION_REP_HALF_FRAME=22,V.PLAYER_LOOKING_AROUND_START_FRAME=4*V.ANIMATION_REP_HALF_FRAME,V.RELATIVE_COORD_BIAS=1e4,V.RELATIVE_COORD_LOWER=V.RELATIVE_COORD_BIAS-1e3,V.PLAYER_COORD=V.RELATIVE_COORD_BIAS-1e3,V.LOCALGATE_PLAYER_WAIT_FRAME=5,V.STATUS_CHANGED_EFFECT_FRAME_NUM=20,V.PASSABLE_OBJECT=1,V.APPERANCE_PARTS_MIN_INDEX=0,V.APPERANCE_PARTS_MAX_INDEX=9,V.APPERANCE_PARTS_MIN_INDEX_NO=5,V.APPERANCE_PARTS_MAX_INDEX_YES=4,V.FADEOUT_SPEED=8,V.STATUS_MINUS_BORDER=3e4,V.ITEMBOX_IS_FULL=-1,V.BATTLE_INTERVAL_FRAME_NUM=10,V.BATTLE_SPEED_CHANGE_TURN_NUM=40,V.RANDOM_MOVE_ITERATION_NUM=50,V.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31=8,V.BATTLE_ESTIMATE_MONSTER_TYPE_MAX=8,V.SOUND_MAX=100,V.ITEM_BORDER_IMG_DATA_URL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAArklEQVRYR+2Y0QqAIAxFt///aENJHwxxuJUSxzeh3S7HXaNpEkly4FIRzba0GEyHeVTN7jqDWvb7V4Y1NLibZIY0NbiL5G3MZLCe / 1fn3XJgJYjB7mgg6O1VCEKwXo79JeklY62nB62kRs9BEIKkeNIDhISQEBJC4k0BBCF4D7D4cV9shf99ixdB + MrM0y3fa3zV05D45GOqhwPMGPkYlccIOEY2VKUN0UNVXxC7ADj7mDi9aFZZAAAAAElFTkSuQmCC",V.LOAD_STAGE_MAX_EXCEPT_AUDIO=7,V.WWA_STYLE_TAG_ID="wwa-additional-style",V.DEFAULT_FRAME_COLOR_R=255,V.DEFAULT_FRAME_COLOR_G=255,V.DEFAULT_FRAME_COLOR_B=255,V.DEFAULT_FRAMEOUT_COLOR_R=96,V.DEFAULT_FRAMEOUT_COLOR_G=96,V.DEFAULT_FRAMEOUT_COLOR_B=96,V.DEFAULT_STRBACK_COLOR_R=0,V.DEFAULT_STRBACK_COLOR_G=0,V.DEFAULT_STRBACK_COLOR_B=0,V.DEFAULT_STATUS_COLOR_R=0,V.DEFAULT_STATUS_COLOR_G=0,V.DEFAULT_STATUS_COLOR_B=0,V.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM=20,V.WWAP_SERVER_OLD="http://wwawing.com/wwap",V.WWAP_SERVER="https://wwaphoenix.github.io",V.WWAP_SERVER_AUDIO_DIR="audio",V.WWAP_SERVER_TITLE_IMG="cover_p.gif",V.WWAP_SERVER_LOADER_NO_WORKER="wwaload.noworker.js",V.SCREEN_WIDTH=560,V.SCREEN_HEIGHT=440,V.LOADING_FONT="Times New Roman",V.MSG_STR_WIDTH=16,V.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME=20,V.ITEMBOX_TOP_Y=140,V.USER_VAR_NUM=256,V.USER_VAR_NUM_MAX_VALUE=9007199254740991,V.USET_VAR_NUM_MIN_VALUE=-9007199254740991,V.CONTROLL_WAIT_FRAME=6,V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM=10,V.FIGHT_DRAW_TURN=40;class F{}F.QUICK_SAVE_MAX=4,F.QUICK_SAVE_THUMNAIL_WIDTH=99,F.QUICK_SAVE_THUMNAIL_HEIGHT=99,F.SAVE_INTERVAL_MOVE=200,F.INDEXEDDB_DB_NAME="WWA_WING_DB",F.INDEXEDDB_TABLE_NAME="SAVE_TABLE",F.DATE_LAST_SAVE_TEXT_COLOR="rgba(255,255,0,1)";class Y{}Y.EMPTY_LOAD="",Y.EMPTY_SAVE="",Y.PASSWORD="Password",Y.QUICK_SAVE="Quick Save",Y.QUICK_LOAD="Quick Load",Y.BATTLE_REPORT="Battle Report",Y.GAME_END="Game End",Y.GOTO_WWA="Goto WWA",Y.RESTART_GAME="Restart Game";class G{}var H;!function(t){t[t.INIT=0]="INIT",t[t.MAP_LOAD=1]="MAP_LOAD",t[t.OBJ_LOAD=2]="OBJ_LOAD",t[t.MAP_ATTR=3]="MAP_ATTR",t[t.OBJ_ATTR=4]="OBJ_ATTR",t[t.RAND_PARTS=5]="RAND_PARTS",t[t.MESSAGE=6]="MESSAGE",t[t.GAME_INIT=7]="GAME_INIT",t[t.AUDIO=8]="AUDIO",t[t.FINISH=9]="FINISH"}(H||(H={}));var K,j,X,J,$,Z,q,z,Q,tt,et,st=["ロードの準備をしています。","背景パーツを読み込んでいます。","物体パーツを読み込んでます。","背景パーツの属性を読み込んでます。","物体パーツの属性を読み込んでます。","ランダムパーツを置換しています。","メッセージを読み込んでます。","Welcome to WWA Wing!"],it=["Welcome to WWA Wing!","Now Map Data Loading .....","Now CG Data Loading .....","Now Making chara CG ....."];!function(t){t[t.LINE=30]="LINE",t[t.TITLE_X=100]="TITLE_X",t[t.TITLE_Y=70]="TITLE_Y",t[t.LOADING_X=50]="LOADING_X",t[t.LOADING_Y=140]="LOADING_Y",t[t.ERROR_X=10]="ERROR_X",t[t.ERROR_Y=180]="ERROR_Y",t[t.FOOTER_X=160]="FOOTER_X",t[t.FOOTER_Y=360]="FOOTER_Y",t[t.WORLD_Y=330]="WORLD_Y",t[t.COPYRIGHT_Y=390]="COPYRIGHT_Y"}(K||(K={})),function(t){t[t.TITLE=32]="TITLE",t[t.LOADING=22]="LOADING",t[t.FOOTER=18]="FOOTER",t[t.ERRROR=16]="ERRROR"}(j||(j={})),function(t){t[t.COLOR_FRAME=0]="COLOR_FRAME",t[t.COLOR_FRAMEOUT=1]="COLOR_FRAMEOUT",t[t.COLOR_STR=2]="COLOR_STR",t[t.COLOR_STATUS_STR=4]="COLOR_STATUS_STR"}(X||(X={})),function(t){t[t.MESSAGE_WINDOW=0]="MESSAGE_WINDOW",t[t.SIDEBAR=1]="SIDEBAR"}(J||(J={})),function(t){t[t.BITSHIFT=16]="BITSHIFT",t[t.BITMASK=65535]="BITMASK"}($||($={})),function(t){t[t.NONE=0]="NONE",t[t.KEYDOWN=1]="KEYDOWN",t[t.KEYPRESS=2]="KEYPRESS",t[t.KEYUP=3]="KEYUP",t[t.KEYPRESS_MESSAGECHANGE=4]="KEYPRESS_MESSAGECHANGE"}(Z||(Z={})),function(t){t[t.KEY_ENTER=13]="KEY_ENTER",t[t.KEY_SHIFT=16]="KEY_SHIFT",t[t.KEY_ESC=27]="KEY_ESC",t[t.KEY_SPACE=32]="KEY_SPACE",t[t.KEY_LEFT=37]="KEY_LEFT",t[t.KEY_UP=38]="KEY_UP",t[t.KEY_RIGHT=39]="KEY_RIGHT",t[t.KEY_DOWN=40]="KEY_DOWN",t[t.KEY_1=49]="KEY_1",t[t.KEY_2=50]="KEY_2",t[t.KEY_3=51]="KEY_3",t[t.KEY_A=65]="KEY_A",t[t.KEY_B=66]="KEY_B",t[t.KEY_C=67]="KEY_C",t[t.KEY_D=68]="KEY_D",t[t.KEY_E=69]="KEY_E",t[t.KEY_F=70]="KEY_F",t[t.KEY_G=71]="KEY_G",t[t.KEY_H=72]="KEY_H",t[t.KEY_I=73]="KEY_I",t[t.KEY_J=74]="KEY_J",t[t.KEY_K=75]="KEY_K",t[t.KEY_L=76]="KEY_L",t[t.KEY_M=77]="KEY_M",t[t.KEY_N=78]="KEY_N",t[t.KEY_O=79]="KEY_O",t[t.KEY_P=80]="KEY_P",t[t.KEY_Q=81]="KEY_Q",t[t.KEY_R=82]="KEY_R",t[t.KEY_S=83]="KEY_S",t[t.KEY_T=84]="KEY_T",t[t.KEY_U=85]="KEY_U",t[t.KEY_V=86]="KEY_V",t[t.KEY_W=87]="KEY_W",t[t.KEY_X=88]="KEY_X",t[t.KEY_Y=89]="KEY_Y",t[t.KEY_Z=90]="KEY_Z",t[t.KEY_F1=112]="KEY_F1",t[t.KEY_F2=113]="KEY_F2",t[t.KEY_F3=114]="KEY_F3",t[t.KEY_F4=115]="KEY_F4",t[t.KEY_F5=116]="KEY_F5",t[t.KEY_F6=117]="KEY_F6",t[t.KEY_F7=118]="KEY_F7",t[t.KEY_F8=119]="KEY_F8",t[t.KEY_F9=120]="KEY_F9",t[t.KEY_F10=121]="KEY_F10",t[t.KEY_F12=123]="KEY_F12"}(q||(q={}));class at{checkHitKey(t){var e=this.getKeyState(t);return e===Z.KEYDOWN||e===Z.KEYPRESS}getKeyState(t){return this._prevKeyState[t]?this._keyState[t]?Z.KEYPRESS:Z.KEYUP:this._keyState[t]?Z.KEYDOWN:Z.NONE}getKeyStateForControllPlayer(t){return this._prevKeyStateOnControllable[t]?this._keyState[t]?Z.KEYPRESS:Z.KEYUP:this._keyState[t]?Z.KEYDOWN:Z.NONE}getKeyStateForMessageCheck(t){return this._prevKeyState[t]?this._keyState[t]?this._keyInputContinueFrameNum[t]>=V.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM?Z.KEYPRESS_MESSAGECHANGE:Z.KEYPRESS:Z.KEYUP:this._keyState[t]?Z.KEYDOWN:Z.NONE}setPressInfo(t){this._nextKeyState[t]=!0,this._keyInputContinueFrameNum[t]=-1}setReleaseInfo(t){this._nextKeyState[t]=!1,this._keyInputContinueFrameNum[t]=-1}update(){var t;for(this._prevKeyState=this._keyState.slice(),this._keyState=this._nextKeyState.slice(),t=0;t<at.KEY_BUFFER_MAX;t++)this._keyState[t]&&this._keyInputContinueFrameNum[t]++}memorizeKeyStateOnControllableFrame(){this._prevKeyStateOnControllable=this._keyState.slice()}allClear(){var t;for(this._nextKeyState=new Array(at.KEY_BUFFER_MAX),t=0;t<at.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1}constructor(){var t;for(this._nextKeyState=new Array(at.KEY_BUFFER_MAX),this._keyState=new Array(at.KEY_BUFFER_MAX),this._prevKeyState=new Array(at.KEY_BUFFER_MAX),this._prevKeyStateOnControllable=new Array(at.KEY_BUFFER_MAX),this._keyInputContinueFrameNum=new Array(at.KEY_BUFFER_MAX),t=0;t<at.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1,this._keyState[t]=!1,this._prevKeyState[t]=!1,this._prevKeyStateOnControllable[t]=!1,this._keyInputContinueFrameNum[t]=0}}at.KEY_BUFFER_MAX=256,function(t){t[t.NONE=0]="NONE",t[t.MOUSEDOWN=1]="MOUSEDOWN",t[t.MOUSEPRESS=2]="MOUSEPRESS",t[t.MOUSEUP=3]="MOUSEUP"}(z||(z={})),function(t){t[t.DIR_KEY=1]="DIR_KEY"}(Q||(Q={}));class rt{checkClickMouse(t){var e;return(e=void 0!==t?this.getMouseState(t):this.getMouseState())===z.MOUSEDOWN||e===z.MOUSEPRESS}getMouseState(t){return void 0!==t&&this._inputDir!==t?z.NONE:this._prevMouseState?this._mouseState?z.MOUSEPRESS:z.MOUSEUP:this._mouseState?z.MOUSEDOWN:z.NONE}getMouseStateForControllPlayer(t){return void 0!==t&&this._inputDir!==t?z.NONE:this._prevMouseStateOnControllable?this._mouseState?z.MOUSEPRESS:z.MOUSEUP:this._mouseState?z.MOUSEDOWN:z.NONE}setPressInfo(t,e){this._nextMouseState=!0,this._inputDir=t,this._touchID=e}setReleaseInfo(){this._touchID=0,this._nextMouseState=!1}touchIDIsSetDir(){return this._touchID===Q.DIR_KEY}memorizeMouseStateOnControllableFrame(){this._prevMouseStateOnControllable=this._mouseState}update(){this._prevMouseState=this._mouseState,this._mouseState=this._nextMouseState}clear(){this._nextMouseState=!1}getTouchID(){return this._touchID}constructor(){this._prevMouseState=!1,this._mouseState=!1,this._nextMouseState=!1}}!function(t){t[t.BUTTON_INDEX_B=0]="BUTTON_INDEX_B",t[t.BUTTON_INDEX_A=1]="BUTTON_INDEX_A",t[t.BUTTON_INDEX_Y=2]="BUTTON_INDEX_Y",t[t.BUTTON_INDEX_X=3]="BUTTON_INDEX_X",t[t.BUTTON_INDEX_L=4]="BUTTON_INDEX_L",t[t.BUTTON_INDEX_R=5]="BUTTON_INDEX_R",t[t.BUTTON_INDEX_ZL=6]="BUTTON_INDEX_ZL",t[t.BUTTON_INDEX_ZR=7]="BUTTON_INDEX_ZR",t[t.BUTTON_INDEX_MINUS=8]="BUTTON_INDEX_MINUS",t[t.BUTTON_INDEX_PLUS=9]="BUTTON_INDEX_PLUS",t[t.BUTTON_INDEX_LEFT_STICK=10]="BUTTON_INDEX_LEFT_STICK",t[t.BUTTON_INDEX_RIGHT_STICK=11]="BUTTON_INDEX_RIGHT_STICK",t[t.BUTTON_CROSS_KEY_UP=12]="BUTTON_CROSS_KEY_UP",t[t.BUTTON_CROSS_KEY_DOWN=13]="BUTTON_CROSS_KEY_DOWN",t[t.BUTTON_CROSS_KEY_LEFT=14]="BUTTON_CROSS_KEY_LEFT",t[t.BUTTON_CROSS_KEY_RIGHT=15]="BUTTON_CROSS_KEY_RIGHT"}(tt||(tt={})),function(t){t[t.AXES_L_HORIZONTAL_INDEX=0]="AXES_L_HORIZONTAL_INDEX",t[t.AXES_L_VERTICAL_INDEX=1]="AXES_L_VERTICAL_INDEX",t[t.AXES_R_HORIZONTAL_INDEX=2]="AXES_R_HORIZONTAL_INDEX",t[t.AXES_R_VERTICAL_INDEX=3]="AXES_R_VERTICAL_INDEX",t[t.AXES_CROSS_KEY=9]="AXES_CROSS_KEY"}(et||(et={}));class nt{constructor(){var t;for(this.gamepad=null,this.triggers=[],t=0;t<16;t++)this.triggers[t]=!1}update(){this.gamepad=null;var t=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];if(t&&t.length>0&&t[0]){var e=t[0];this.gamepad=e}}buttonTrigger(...t){if(!this.gamepad)return!1;var e,s,i,a,r;for(s=t.length,e=0;e<s;e++){i=t[e];var n=this.gamepad.buttons[i];if(!n)return!1;if(a="object"==typeof n?!0===n.pressed:1===n,r=this.triggers[i],this.triggers[i]=a,a&&!r)return!0}return!1}buttonPressed(...t){if(!this.gamepad)return!1;var e,s,i;for(s=t.length,e=0;e<s;e++){i=t[e];var a=this.gamepad.buttons[i];if(!a)return!1;if("object"==typeof a?!0===a.pressed:1===a)return!0}return!1}crossPressed(...t){if(!this.gamepad)return!1;var e,s;for(s=t.length,e=0;e<s;e++)switch(t[e]){case tt.BUTTON_CROSS_KEY_UP:if(this.gamepad.axes[et.AXES_L_VERTICAL_INDEX]<=-.6||this.gamepad.axes[et.AXES_R_VERTICAL_INDEX]<=-.6||-1===this.stickFloor(et.AXES_CROSS_KEY)||this.buttonPressed(tt.BUTTON_CROSS_KEY_UP))return!0;break;case tt.BUTTON_CROSS_KEY_DOWN:if(this.gamepad.axes[et.AXES_L_VERTICAL_INDEX]>=.7||this.gamepad.axes[et.AXES_R_VERTICAL_INDEX]>=.7||.1===this.stickFloor(et.AXES_CROSS_KEY)||this.buttonPressed(tt.BUTTON_CROSS_KEY_DOWN))return!0;break;case tt.BUTTON_CROSS_KEY_LEFT:if(this.gamepad.axes[et.AXES_L_HORIZONTAL_INDEX]<=-.7||this.gamepad.axes[et.AXES_R_HORIZONTAL_INDEX]<=-.7||.7===this.stickFloor(et.AXES_CROSS_KEY)||this.buttonPressed(tt.BUTTON_CROSS_KEY_LEFT))return!0;break;case tt.BUTTON_CROSS_KEY_RIGHT:if(this.gamepad.axes[et.AXES_L_HORIZONTAL_INDEX]>.6||this.gamepad.axes[et.AXES_R_HORIZONTAL_INDEX]>.6||-.5===this.stickFloor(et.AXES_CROSS_KEY)||this.buttonPressed(tt.BUTTON_CROSS_KEY_RIGHT))return!0}return!1}vibration(t){return!!this.gamepad&&(!!this.gamepad.vibrationActuator&&void(t?this.gamepad.vibrationActuator.playEffect("dual-rumble",{startDelay:0,duration:100,weakMagnitude:1,strongMagnitude:.5}):this.gamepad.vibrationActuator.playEffect("dual-rumble",{startDelay:0,duration:100,weakMagnitude:.5,strongMagnitude:1})))}stickFloor(...t){if(!this.gamepad)return 0;var e,s,i;for(s=t.length,e=0;e<s;e++){i=t[e];var a=this.gamepad.axes[i];return"number"!=typeof a?0:Math.floor(10*a)/10}return 0}}class ot{constructor(t=0){this.lastCalculatedTimeUnixMs=Date.now(),this.lastCalculatedPlayTimeMs=t}calculateTimeMs(){const t=Date.now(),e=t-this.lastCalculatedTimeUnixMs+this.lastCalculatedPlayTimeMs;return this.lastCalculatedTimeUnixMs=t,this.lastCalculatedPlayTimeMs=e,e}calculatePlayTimeFormat(){return ot.formatPlayTimeText(this.calculateTimeMs()/1e3)}static formatPlayTimeText(t){const e=Math.floor(t);return e>=36e6?"9999:99:99":("000"+(e/60/60|0)).slice(-4)+":"+("0"+(e/60|0)%60).slice(-2)+":"+("0"+e%60).slice(-2)}}const ht=["BUTTON_ENTER","BUTTON_ESC","BUTTON_SIDEBAR","BUTTON_FAST","BUTTON_SLOW","BUTTON_LEFT","BUTTON_UP","BUTTON_RIGHT","BUTTON_DOWN"],ct=["BUTTON_LEFT","BUTTON_UP","BUTTON_RIGHT","BUTTON_DOWN"],_t=new Set(ct);class lt{constructor(t,e=!1,s=null,i=null,a=null,r=null){if(this._enabled=null!==t,this._visible=e,this._onTouchStart=a||null,this._onTouchEnd=r||null,this._availableButtons=[],this._isTouchingButtons={},this._moveButtonsElement=i,this._buttonWrapperElement=s,this._setVisible(e),this._moveButtonsElement&&(this._moveButtonsElement.style.visibility="visible"),this._buttonWrapperElement&&(this._buttonWrapperElement.style.visibility="visible"),null!==t){for(const e in t){const s=t[e];if(!s)continue;const i=e;this._availableButtons.push(i),s.setAttribute("type",e),this._isTouchingButtons[i]={prev:!1,current:!1,next:!1};const a=t=>{t.cancelable&&t.preventDefault()},r=t=>{a(t),this.allClear()};s.addEventListener("touchstart",(t=>{a(t),this.setTouchInfo(i)})),s.addEventListener("touchcancel",r),lt.isMoveButton(i)?(s.addEventListener("touchmove",this._detectMovingMoveButton.bind(this)),s.addEventListener("touchend",this.allMoveClear.bind(this))):s.addEventListener("touchend",(t=>{a(t),this.clearTouchInfo(i)}))}null!==i&&i.addEventListener("touchmove",this._detectMovingMoveButton.bind(this))}}_detectMovingMoveButton(t){t.preventDefault(),this.allMoveClear();const e=t.targetTouches.item(0);if(!this._moveButtonsElement||null===e)return;const s=this._moveButtonsElement.getBoundingClientRect(),i=document.body.getBoundingClientRect(),a=s.left-i.left+s.width/2,r=s.top-i.top+s.height/2,n=e.pageX-a,o=e.pageY-r;n>=o?n<=-o?this.setTouchInfo("BUTTON_UP"):this.setTouchInfo("BUTTON_RIGHT"):n>=-o?this.setTouchInfo("BUTTON_DOWN"):this.setTouchInfo("BUTTON_LEFT")}_setVisible(t){null!==this._moveButtonsElement&&(this._moveButtonsElement.style.display=t?"grid":"none"),null!==this._buttonWrapperElement&&(this._buttonWrapperElement.style.display=t?"grid":"none"),this._visible=t}checkTouchButton(t){if(!this._enabled)return!1;return"TOUCH"===this.getButtonState(t)}checkTouchingButton(t){if(!this._enabled)return!1;const e=this.getButtonState(t);return"TOUCH"===e||"TOUCHING"===e}getButtonState(t){const e=this._isTouchingButtons[t];if(!this._enabled||void 0===e)return"NONE";const s=e.prev,i=e.current;return s&&i?"TOUCHING":i?"TOUCH":s?"LEAVE":"NONE"}setTouchInfo(t){const e=this._isTouchingButtons[t];this._enabled&&void 0!==e&&(e.next=!0)}clearTouchInfo(t){const e=this._isTouchingButtons[t];this._enabled&&void 0!==e&&(e.next=!1)}allMoveClear(){ct.forEach((t=>{this._availableButtons.includes(t)&&this.clearTouchInfo(t)}))}allClear(){this._availableButtons.forEach((t=>{if(void 0!==t){const e=this._isTouchingButtons[t];void 0!==e&&(e.next=!1)}}))}static isMoveButton(t){return _t.has(t)}update(){this._availableButtons.forEach((t=>{var e,s;if(void 0===t)return;const i=this._isTouchingButtons[t];if(void 0!==i)switch(this._isTouchingButtons[t].prev=i.current,this._isTouchingButtons[t].current=i.next,this.getButtonState(t)){case"TOUCH":null===(e=this._onTouchStart)||void 0===e||e.call(this,t);break;case"LEAVE":null===(s=this._onTouchEnd)||void 0===s||s.call(this,t)}}))}toggleVisible(){this._setVisible(!this._visible)}}function ut(){const t=document.querySelector("meta[name='viewport']"),e=window.innerWidth,s=window.innerHeight;let i="user-scalable=no";if(e>s){i=`width=${Math.floor(e/s*456)},${i}`}else e<=s&&(i=`width=576,${i}`);null==t||t.setAttribute("content",`${i}`)}var dt=t=>document.getElementById(t),pt=t=>document.getElementsByTagName(t),mt=t=>document.querySelector(t),Et=t=>document.querySelector(t),gt=t=>document.querySelectorAll(t),wt=(t,e)=>{var s,i,a=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,r=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;return s=t-dt("wwa-wrapper").offsetLeft+a,i=e-dt("wwa-wrapper").offsetTop+r,new c(s,i)},ft=t=>t.match(/^https?:\/\//)||t.match(/^\.\.\//)?t:location.href="./"+t,vt=t=>{var e="";if(t instanceof Array){for(var s=0;s<t.length;s++)e+=vt(t[s])+"/";return e}return t+""};const yt=t=>t.split("").reverse().join("");function St(t,e){if("number"!=typeof t)throw new TypeError(`${e} が数値ではありません。`);return!0}function At(t,e){if("string"==typeof t){const s=[...t];return e&&s.length>10?`"${s.slice(0,10).join("")}…`:`"${t}"`}return String(t)}const Tt=[{name:"pos",type:"numberArray"},{name:"time",type:"number"},{name:"size",type:"numberArray"},{name:"repeat",type:"numberArray"},{name:"img",type:"numberArray"},{name:"imgFile",type:"string"},{name:"crop",type:"numberArray"},{name:"text",type:"string"},{name:"font",type:"string"},{name:"color",type:"numberArray"},{name:"textAlign",type:"string"},{name:"opacity",type:"number"},{name:"next",type:"numberArray"},{name:"map",type:"numberArray"},{name:"script",type:"string"}],It="-?\\d+",Ct=`v\\[(${It})\\]`,Dt=`m\\[${It}\\]\\[${It}\\]`,Pt=`m\\[(${It})\\]\\[(${It})\\]`,Nt=`o\\[${It}\\]\\[${It}\\]`,Ot=`o\\[(${It})\\]\\[(${It})\\]`,Mt=`ITEM\\[${It}\\]`,xt=`ITEM\\[(${It})\\]`,bt=`${`v\\[${It}\\]`}|${Dt}|${Nt}|${Mt}`,Lt="HP|HPMAX|AT|DF|GD|STEP|PDIR",Rt=`${bt}|${Dt}|${Nt}|${Mt}|${Lt}`,Bt=`${It}|${bt}|AT_TOTAL|AT_ITEMS|DF_TOTAL|DF_ITEMS|TIME|X|Y|PX|PY|ID|TYPE|ITEM_COUNT_ALL|${Lt}`,Ut=`RAND\\((${Bt})\\)`,kt=`ITEM_COUNT\\((${Bt})\\)`,Wt=`${Bt}|${`${`RAND\\((?:${Bt})\\)`}|${`ITEM_COUNT\\((?:${Bt})\\)`}`}`,Vt="\\+|\\-|\\*|\\/|%",Ft="^\\(",Yt="\\)$",Gt=new RegExp(`^${It}$`),Ht=new RegExp(`^${Ct}$`),Kt=new RegExp(`^${Pt}$`),jt=new RegExp(`^${Ot}$`),Xt=new RegExp(`^${xt}$`),Jt=new RegExp(`^${Ut}$`),$t=new RegExp(`${kt}$`),Zt=new RegExp(`${Ft}(${Rt})=(${Wt})(${Vt})(${Wt})${Yt}`),qt=new RegExp(`${Ft}(${Rt})(=|\\+=|\\-=|\\*=|\\/=|%=)(${Wt})${Yt}`),zt=new RegExp(`^(${Wt})(?:(${Vt})(${Wt}))?$`),Qt=new RegExp(`${Ft}(${Wt})(>|<|<=|>=|==|!=)(${Wt})${Yt}`),te=new RegExp(`{{(${Wt})}}`,"g");function ee(t){return"RAND"!==t.type&&"ITEM_COUNT"!==t.type}function se(t){switch(t){case"HP":case"HPMAX":case"AT":case"AT_TOTAL":case"AT_ITEMS":case"DF":case"DF_TOTAL":case"DF_ITEMS":case"GD":case"STEP":case"TIME":case"X":case"Y":case"PX":case"PY":case"PDIR":case"ID":case"TYPE":case"ITEM_COUNT_ALL":return{type:t};default:const e=t.match(Ht);if(e){const t=ie(e);return null===t?null:{type:"VARIABLE",index:t}}const s=t.match(Kt);if(s){const t=ae(s);return null===t?null:{type:"MAP",x:t[0],y:t[1]}}const i=t.match(jt);if(i){const t=ae(i);return null===t?null:{type:"OBJECT",x:t[0],y:t[1]}}const a=t.match(Xt);if(a){const t=ie(a);return null===t?null:{type:"ITEM",boxIndex1To12:t}}if(t.match(Gt)){const e=parseInt(t,10);return null===e||isNaN(e)?null:{type:"NUMBER",rawValue:e}}const r=t.match(Jt);if(r){const t=r.length>=2?se(r[1]):null;return null!==t&&ee(t)?{type:"RAND",argument:t}:null}const n=t.match($t);if(n){const t=n.length>=2?se(n[1]):null;return null!==t&&ee(t)?{type:"ITEM_COUNT",argument:t}:null}return null}}function ie(t){const e=t.length>=2?Number(t[1]):null;return null===e||isNaN(e)?null:e}function ae(t){if(t.length<3)return null;const e=Number(t[1]),s=Number(t[2]);return isNaN(e)||isNaN(s)?null:[e,s]}function re(t,e,s=0){if("boolean"==typeof t)return t;const i=ne(t.left,e,s),a=ne(t.right,e,s);return function(t,e,s){switch(t){case">":return e>s;case"<":return e<s;case">=":return e>=s;case"<=":return e<=s;case"==":return e===s;case"!=":return e!==s;default:return!1}}(t.operator,i,a)}function ne(t,e,s=0){switch(t.type){case"HP":return e.totalStatus.energy;case"HPMAX":return e.energyMax;case"AT":return e.bareStatus.strength;case"AT_TOTAL":return e.totalStatus.strength;case"AT_ITEMS":return e.itemStatus.strength;case"DF":return e.bareStatus.defence;case"DF_TOTAL":return e.totalStatus.defence;case"DF_ITEMS":return e.itemStatus.defence;case"GD":return e.totalStatus.gold;case"STEP":return e.moveCount;case"VARIABLE":{const s=e.userVars[t.index];return St(s,`v${t.index}`)?s:0}case"MAP":return t.y<0||t.y>=e.map.length||t.x<0||t.x>=e.map[t.y].length?0:e.map[t.y][t.x];case"OBJECT":return t.y<0||t.y>=e.mapObject.length||t.x<0||t.x>=e.mapObject[t.y].length?0:e.mapObject[t.y][t.x];case"ITEM":return t.boxIndex1To12<1||t.boxIndex1To12>12?0:e.itemBox[t.boxIndex1To12-1];case"ITEM_COUNT_ALL":return e.itemBox.filter((t=>0!==t)).length;case"NUMBER":return t.rawValue;case"TIME":return e.playTime;case"X":return e.partsPosition.x;case"Y":return e.partsPosition.y;case"PX":return e.playerCoord.x;case"PY":return e.playerCoord.y;case"PDIR":return e.playerDirection;case"ID":return e.partsId;case"TYPE":return e.partsType;case"RAND":return Math.floor(Math.random()*ne(t.argument,e));case"ITEM_COUNT":return e.itemBox.filter((s=>s===ne(t.argument,e))).length;default:return s}}function oe(t,e,s){switch(t){case"=":return s;case"+":case"+=":return e+s;case"-":case"-=":return e-s;case"*":case"*=":return e*s;case"/":case"/=":return 0===s?0:e/s;case"%":case"%=":return 0===s?0:e%s;default:throw new Error("未定義の演算子です")}}function he(t,e){var s;switch(null===(s=se(e))||void 0===s?void 0:s.type){case"VARIABLE":{const s=e.match(/^v\[(\d+)\]$/),i=Number(s[1]);if(null===i||isNaN(i))throw new Error("ユーザ変数の添字のパースに失敗しました");return{assignee:"variable",index:i,rawValue:t}}case"MAP":{const s=e.match(/^m\[(\d+)\]\[(\d+)\]$/),i=Number(s[1]),a=Number(s[2]);if(null===i||null===a||isNaN(i)||isNaN(a))throw new Error("背景パーツの添字のパースに失敗しました");return{assignee:"map",x:i,y:a,rawValue:t}}case"OBJECT":{const s=e.match(/^o\[(\d+)\]\[(\d+)\]$/),i=Number(s[1]),a=Number(s[2]);if(null===i||null===a||isNaN(i)||isNaN(a))throw new Error("物体パーツの添字のパースに失敗しました");return{assignee:"mapObject",x:i,y:a,rawValue:t}}case"ITEM":{const s=e.match(/^ITEM\[(\d+)\]$/),i=Number(s[1]);if(null===i||isNaN(i))throw new Error("アイテムの添字のパースに失敗しました");return{assignee:"item",boxIndex1to12:i,rawValue:t}}case"ITEM_COUNT_ALL":case"ITEM_COUNT":throw new Error("左辺値に所持アイテム数は入れられません");case"NUMBER":throw new Error("左辺値に定数は入れられません");case"HP":return{assignee:"energy",rawValue:t};case"HPMAX":return{assignee:"energyMax",rawValue:t};case"AT":return{assignee:"strength",rawValue:t};case"AT_TOTAL":throw new Error("左辺値に合計攻撃力は入れられません");case"AT_ITEMS":throw new Error("左辺値にアイテム攻撃力は入れられません");case"DF":return{assignee:"defence",rawValue:t};case"DF_TOTAL":throw new Error("左辺値に合計防御力は入れられません");case"DF_ITEMS":throw new Error("左辺値にアイテム防御力は入れられません");case"GD":return{assignee:"gold",rawValue:t};case"STEP":return{assignee:"moveCount",rawValue:t};case"TIME":throw new Error("左辺値にプレイ時間は入れられません");case"PX":throw new Error("左辺値にプレイヤーX座標は入れられません");case"PY":throw new Error("左辺値にプレイヤーY座標は入れられません");case"X":throw new Error("左辺値にパーツX座標は入れられません");case"Y":throw new Error("左辺値にパーツY座標は入れられません");case"ID":throw new Error("左辺値にパーツ番号座標は入れられません");case"TYPE":throw new Error("左辺値にパーツ種別は入れられません");case"PDIR":return{assignee:"playerDirection",rawValue:t};case"RAND":throw new Error("左辺値に乱数は入れられません");default:throw new Error("この文字列から代入操作オブジェクトは生成できません")}}function ce(t){return t.replace(/\s/g,"")}function _e(t,e,s=0){return ne(se(t),e,s)}function le(t,e,s=0){const i=ce(t).match(zt);if(null!==i){const t=_e(i[1],e,s),a=i[3]?_e(i[3],e,s):void 0,r=i[2];return r&&a?oe(r,t,a):t}throw new Error("マクロ引数のフォーマットを満たしていません: "+t)}function ue(t){const e=ce(t).match(Qt);if(null===e||e.length<=3)return void console.error(`判定式が異常です: ${t}`);const s=se(e[1]),i=se(e[3]);if(s&&i)return{left:s,right:i,operator:e[2]};console.error(`判定式が異常です: ${t}`)}const de=t=>{try{const e=JSON.parse(t.propertiesText);if(Array.isArray(e))throw new Error("配列形式ではなくオブジェクト形式で記述してください。");if("object"!=typeof e)throw new Error("オブジェクト形式で記述してください。");return{...t,properties:e}}catch(t){console.error(`JSON パースエラーが発生しました!: ${t.message}`)}},pe=(t,e)=>{const s=Tt.find((({name:e})=>e===t));if(!s)return console.warn(`定義外のプロパティ ${t} を見つけました。`),!1;if("string"===s.type)if("string"!=typeof e)return"number"!=typeof e&&console.warn(`プロパティ ${t} では文字列形式である必要があります。実際に入った値は ${e} です。`),!1;return!0};class me{}me.ITEMBOX_SIZE=12,me.MAP_ATR_MAX=60,me.OBJ_ATR_MAX=60,me.OLD_MAP_ATR_MAX=40,me.OLD_OBJ_ATR_MAX=40,me.ATR_CROP1=1,me.ATR_CROP2=2,me.ATR_TYPE=3,me.ATR_JUMP_X=16,me.ATR_JUMP_Y=17,me.MAP_LOCALGATE=2,me.OBJECT_LOCALGATE=18,me.SYSTEM_MESSAGE_NUM=20,me.IMGPOS_DEFAULT_YESNO_X=3,me.IMGPOS_DEFAULT_YESNO_Y=1,me.IMGPOS_DEFAULT_PLAYER_X=2,me.IMGPOS_DEFAULT_PLAYER_Y=0,me.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0,me.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0,me.IMGPOS_DEFAULT_STATUS_X=3,me.IMGPOS_DEFAULT_STATUS_Y=2,me.IMGRELPOS_ENERGY_ICON_X=0,me.IMGRELPOS_STRENGTH_ICON_X=1,me.IMGRELPOS_DEFENCE_ICON_X=2,me.IMGRELPOS_GOLD_ICON_X=3,me.IMGPOS_DEFAULT_WIDE_CELL_X=4,me.IMGPOS_DEFAULT_WIDE_CELL_Y=3,me.IMGPOS_DEFAULT_ITEMBOX_X=1,me.IMGPOS_DEFAULT_ITEMBOX_Y=2,me.IMGPOS_DEFAULT_FRAME_X=0,me.IMGPOS_DEFAULT_FRAME_Y=1,me.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3,me.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3,me.DEFAULT_DISABLE_SAVE=!1,me.DEFAULT_OLDMAP=!1,me.DEFAULT_OBJECT_NO_COLLAPSE=!1,me.DEFAULT_FRAME_COLOR_R=255,me.DEFAULT_FRAME_COLOR_G=255,me.DEFAULT_FRAME_COLOR_B=255,me.DEFAULT_FRAMEOUT_COLOR_R=96,me.DEFAULT_FRAMEOUT_COLOR_G=96,me.DEFAULT_FRAMEOUT_COLOR_B=96,me.DEFAULT_STR_COLOR_R=0,me.DEFAULT_STR_COLOR_G=0,me.DEFAULT_STR_COLOR_B=0,me.DEFAULT_STATUS_COLOR_R=0,me.DEFAULT_STATUS_COLOR_G=0,me.DEFAULT_STATUS_COLOR_B=0,me.DEFAULT_MOVES=0,me.DEFAULT_SPEED_INDEX=3,me.USER_VAR_NUM=256;var Ee,ge;!function(t){t[t.MAP=1]="MAP",t[t.OBJECT=0]="OBJECT"}(Ee||(Ee={})),function(t){t[t.INIT=0]="INIT",t[t.MAP_LOAD=1]="MAP_LOAD",t[t.OBJ_LOAD=2]="OBJ_LOAD",t[t.MAP_ATTR=3]="MAP_ATTR",t[t.OBJ_ATTR=4]="OBJ_ATTR",t[t.RAND_PARTS=5]="RAND_PARTS",t[t.MESSAGE=6]="MESSAGE"}(ge||(ge={}));class we{constructor(t,e,s){var i,a,r,n,o,h,c,_,l,u,d,p,m,E,g,w,f,v,y,S,A,T,I;this._registry=t,this._canvas=e;const{properties:C}=t;this._posX=null!==(a=null===(i=C.pos)||void 0===i?void 0:i[0])&&void 0!==a?a:0,this._posY=null!==(n=null===(r=C.pos)||void 0===r?void 0:r[1])&&void 0!==n?n:0,[this._imgMainX,this._imgMainY]=we._getImgPosByPicture(this._registry,!0),[this._imgSubX,this._imgSubY]=we._getImgPosByPicture(this._registry,!1),this._repeatX=null!==(h=null===(o=C.repeat)||void 0===o?void 0:o[0])&&void 0!==h?h:1,this._repeatY=null!==(_=null===(c=C.repeat)||void 0===c?void 0:c[1])&&void 0!==_?_:1,this._imgFile=s,this._cropX=this._imgFile?1:null!==(u=null===(l=C.crop)||void 0===l?void 0:l[0])&&void 0!==u?u:1,this._cropY=this._imgFile?1:null!==(p=null===(d=C.crop)||void 0===d?void 0:d[1])&&void 0!==p?p:1,this._totalWidth=(null!==(E=null===(m=C.size)||void 0===m?void 0:m[0])&&void 0!==E?E:this._imgFile?this._imgFile.width:V.CHIP_SIZE)*this._cropX,this._totalHeight=(null!==(w=null===(g=C.size)||void 0===g?void 0:g[1])&&void 0!==w?w:this._imgFile?this._imgFile.height:V.CHIP_SIZE)*this._cropY,this._chipWidth=Math.floor(this._totalWidth/this._cropX),this._chipHeight=Math.floor(this._totalHeight/this._cropY),this._displayStockTime=C.time,this._canvas.ctx.globalAlpha=C.opacity?we._roundPercentage(C.opacity)/100:1,this._canvas.ctx.font=null!==(f=C.font)&&void 0!==f?f:getComputedStyle(dt("wwa-wrapper")).font,C.textAlign&&(this._canvas.ctx.textAlign=we._convertTextAlign(C.textAlign));const D=null!==(y=null===(v=C.color)||void 0===v?void 0:v[0])&&void 0!==y?y:0,P=null!==(A=null===(S=C.color)||void 0===S?void 0:S[1])&&void 0!==A?A:0,N=null!==(I=null===(T=C.color)||void 0===T?void 0:T[2])&&void 0!==I?I:0;this._canvas.ctx.fillStyle=`rgb(${D}, ${P}, ${N})`}get layerNumber(){return this._registry.layerNumber}get cvs(){return this._canvas.cvs}get nextPictureParts(){var t;if(this._registry.properties.next&&void 0!==this._registry.properties.next[0])return{partsNumber:this._registry.properties.next[0],partsType:null!==(t=this._registry.properties.next[1])&&void 0!==t?t:Ee.OBJECT}}get appearParts(){var t;if(this._registry.properties.map&&!(this._registry.properties.map.length<3))return{partsNumber:this._registry.properties.map[0],x:this._registry.properties.map[1],y:this._registry.properties.map[2],partsType:null!==(t=this._registry.properties.map[3])&&void 0!==t?t:Ee.OBJECT}}get executeScriptFunctionName(){return this._registry.properties.script}draw(t,e){const s=e?this._imgMainX:this._imgSubX,i=e?this._imgMainY:this._imgSubY;for(let e=0;e<this._repeatY;e++)for(let a=0;a<this._repeatX;a++){const r=this._posX+this._totalWidth*a,n=this._posY+this._totalHeight*e;if(this._registry.properties.text&&this._canvas.drawFont(this._registry.properties.text,r,n),this._imgFile)this._canvas.drawCanvasFree(this._imgFile,r,n,this._totalWidth,this._totalHeight);else for(let e=0;e<this._cropY;e++)for(let a=0;a<this._cropX;a++)this._canvas.drawCanvas(t,s+a,i+e,r+this._chipWidth*a,n+this._chipHeight*e,this._chipWidth,this._chipHeight)}}hasDisplayTimeStock(){return void 0!==this._displayStockTime}decrementDisplayTimeStock(t){return this._displayStockTime-=t}isDeadlineOver(){return this._displayStockTime<=0}clearCanvas(){this._canvas.clear()}getRegistryData(){return this._registry}getTriggerPartsCoord(){return new c(this._registry.triggerPartsX,this._registry.triggerPartsY)}static _getImgPosByPicture(t,e){var s,i;const{properties:a}=t;return void 0!==(null===(s=a.img)||void 0===s?void 0:s[0])&&void 0!==(null===(i=a.img)||void 0===i?void 0:i[1])?e?[a.img[0],a.img[1]]:void 0!==a.img[2]&&void 0!==a.img[3]?[a.img[2],a.img[3]]:[a.img[0],a.img[1]]:e||0===t.imgPosX2&&0===t.imgPosY2?[t.imgPosX,t.imgPosY]:[t.imgPosX2,t.imgPosY2]}static _convertTextAlign(t){if(["center","end","left","right","start"].includes(t))return t;console.warn(`textAlign プロパティで不正な値が検出されました。: ${t}`)}static _roundPercentage(t){return t<0?0:t>100?100:t}}const fe=async t=>fetch(t).then((e=>200===e.status||304===e.status?{kind:"data",data:e}:{kind:"httpError",errorMessage:`ファイル ${t} が読み込めませんでした。ステータスコード: ${e.status}`})).catch((e=>({kind:"connectionError",errorMessage:`ファイル ${t} が読み込めませんでした。通信状態がいい場所で再度お試しください。`}))).then((async t=>"data"===t.kind?{kind:"data",data:await t.data.json()}:t)).catch((e=>({kind:"brokenJson",errorMessage:`ファイル ${t} が壊れています。`})));class ve{constructor(t,e){this._wwa=t,this._pictures=new Map,this._externalImageFiles=new Map,this._frameTimerValue=ve._getNowFrameValue(),this._setupExternalImageFiles(e)}async _setupExternalImageFiles(t){if(!t)return;const e=await fe(t);if(e)if("data"===e.kind)if(e.data&&"object"==typeof e.data){if("files"in e.data){const{files:s}=e.data;"object"==typeof s?Object.entries(e.data.files).forEach((([t,e])=>{const s=new Image;s.src=e,s.onerror=t=>{alert(`ピクチャ画像ファイル ${e} が見つかりませんでした。エラーメッセージ: ${t.toString()}`)},this._externalImageFiles.set(t,s)})):alert(`ピクチャ画像の定義ファイル ${t} の files が正しい形式で書かれていません。`)}}else alert(`ピクチャ画像の定義ファイル ${t} が正しい形式で書かれていません。`);else alert(`ピクチャ画像の定義ファイル ${t} が見つかりませんでした。エラーメッセージ: ${e.errorMessage}`)}static _getNowFrameValue(){return performance.now()}registerPicture(t){const e=new ye(V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,!0),s=Object.keys(t.properties).filter((t=>!Tt.some((({name:e})=>e===t))));if(s.length>0)throw new Error(`不明なプロパティ名 ${s.map((t=>`"${t}"`)).join(", ")} が検出されました。`);const i=t.properties.imgFile?this._externalImageFiles.get(t.properties.imgFile):void 0;t.properties.imgFile&&!i&&console.warn(`ピクチャ画像ファイル ${t.properties.imgFile} が定義に含まれていません。定義ファイルがあるかご確認ください。`),this._pictures.set(t.layerNumber,new we(t,e,i))}registerPictureFromText(t,e,s){const i=de(t);return this.registerPicture(((t,e)=>{const s=t=>"number"==typeof t?t:le(t,e),i=Object.entries(t.properties).map((([t,e])=>{if(!pe(t,e))return[t,e];switch(Tt.find((({name:e})=>e===t)).type){case"number":return[t,s(e)];case"numberArray":return[t,e.map(s)];case"string":if("string"!=typeof e)return[t,e];let i=String(e);return Array.from(e.matchAll(te)).forEach((t=>{t.length<2&&console.warn(`テンプレート文字列で合致した文字列の中の値を取り出すことができませんでした。文字列そのものの値は ${e} です。`);const a=t[0],r=t[1],n=s(r);i=i.replace(a,"number"==typeof n?n.toString():n)})),[t,i];default:return[t,e]}}));return{...t,properties:Object.fromEntries(i)}})(i,this._wwa.generateTokenValues({id:e,type:s,position:new c(t.triggerPartsX,t.triggerPartsY)}))),this.getPictureRegistryData()}registerPictureFromRawText(t,e){const s=de({imgPosX:0,imgPosY:0,imgPosX2:0,imgPosY2:0,layerNumber:t,triggerPartsX:0,triggerPartsY:0,propertiesText:e});return this.registerPicture((t=>{const e=Object.entries(t.properties).map((([t,e])=>(pe(t,e),[t,e])));return{...t,properties:Object.fromEntries(e)}})(s)),this.getPictureRegistryData()}deletePicture(t){if(this._pictures.has(t))return this._pictures.get(t).clearCanvas(),this._pictures.delete(t),this.getPictureRegistryData();console.warn(`${t} 番のピクチャが見つかりませんでした。`)}clearAllPictures(){this._pictures.forEach((t=>{t.clearCanvas()})),this._pictures.clear()}forEachPictures(t){this._pictures.forEach(t)}updatePicturesCache(t,e){this.forEachPictures((s=>{0!==s.layerNumber&&s.clearCanvas(),s.draw(t,e)}))}updateFrameTimerValue(){this._frameTimerValue=ve._getNowFrameValue()}decrementPictureDisplayTimeStock(){const t=ve._getNowFrameValue()-this._frameTimerValue;this.forEachPictures((e=>{if(e.hasDisplayTimeStock()&&(e.decrementDisplayTimeStock(t),e.isDeadlineOver())){const t=e.layerNumber,s=e.nextPictureParts,i=e.appearParts,a=e.executeScriptFunctionName,r=e.getTriggerPartsCoord();this.deletePicture(t),void 0!==s&&this._wwa.setPictureRegistry(t,s.partsNumber,s.partsType,r),void 0!==i&&this._wwa.setPartsOnPosition(i.partsType,i.partsNumber,new c(i.x,i.y)),a&&this._wwa.callUserScript(a)}}))}getPictureRegistryData(){return Array.from(this._pictures.values()).map((t=>t.getRegistryData()))}}class ye{constructor(t,e,s){this.cvs=document.createElement("canvas"),this.cvs.width=t,this.cvs.height=e,this.ctx=this.cvs.getContext("2d",{alpha:s}),this.ctx.imageSmoothingEnabled=!1,this._isTransparent=s}drawCanvas(t,e,s,i,a,r=V.CHIP_SIZE,n=V.CHIP_SIZE){this.ctx.drawImage(t,V.CHIP_SIZE*e,V.CHIP_SIZE*s,V.CHIP_SIZE,V.CHIP_SIZE,i,a,r,n)}drawCanvasFree(t,e,s,i,a){this.ctx.drawImage(t,e,s,i,a)}drawFont(t,e,s){this.ctx.fillText(t,e,s)}clear(){this.clearRect(0,0,this.cvs.width,this.cvs.height)}clearRectWithLowerYLimit(t){this.clearRect(0,0,this.cvs.width,t)}clearRect(t,e,s,i){this._isTransparent?this.ctx.clearRect(t,e,s,i):(this.ctx.fillStyle="#9E9E9E",this.ctx.fillRect(t,e,s,i))}}class Se{_load(){this._frameCoord,this._isLoaded||(this.mapCache=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],this.mapObjectCache=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],this._image=new Image,this._image.addEventListener("load",(()=>{this.createFrame(),this._loadCompleteCallBack()})),this._image.addEventListener("error",(()=>{throw new Error("Image Load Failed!!\nfile name:"+this._fileName)})),this._image.src=this._fileName,this._isLoaded=!0)}createFrame(){this._frameCanvas.clear(),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y,0,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y,V.MAP_WINDOW_WIDTH-V.CHIP_SIZE,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+2,0,V.MAP_WINDOW_HEIGHT-V.CHIP_SIZE),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+2,V.MAP_WINDOW_WIDTH-V.CHIP_SIZE,V.MAP_WINDOW_HEIGHT-V.CHIP_SIZE);for(var t=1;t<V.H_PARTS_NUM_IN_WINDOW-1;t++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y,V.CHIP_SIZE*t,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y+2,V.CHIP_SIZE*t,V.MAP_WINDOW_HEIGHT-V.CHIP_SIZE);for(t=1;t<V.V_PARTS_NUM_IN_WINDOW-1;t++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+1,0,V.CHIP_SIZE*t),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+1,V.MAP_WINDOW_WIDTH-V.CHIP_SIZE,V.CHIP_SIZE*t)}updateEffects(t){var e;if(t){var s,i=t.length;for(e=0;e<i;e++){var a=t[e];(s=this._effectCanvases[e])?s.clear():s=this._effectCanvases[e]=new ye(V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,!0);for(var r=0;r<V.V_PARTS_NUM_IN_WINDOW;r++)for(var n=0;n<V.H_PARTS_NUM_IN_WINDOW;n++)s.drawCanvas(this._image,a.x,a.y,n*V.CHIP_SIZE,r*V.CHIP_SIZE)}}}updatePictures(t){this.picture.clearAllPictures(),t.forEach((t=>{this.picture.registerPicture(t)}))}updatePicturesCache(t=!0){this.picture.updatePicturesCache(this._image,t)}drawFrame(){this._ctx.drawImage(this._frameCanvas.cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-1),V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE,0,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-1),V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,V.CHIP_SIZE,V.CHIP_SIZE,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-2),0,V.CHIP_SIZE,V.CHIP_SIZE,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-2)),this._ctx.drawImage(this._frameCanvas.cvs,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-1),V.CHIP_SIZE,V.CHIP_SIZE,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-2),V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-1),V.CHIP_SIZE,V.CHIP_SIZE,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-2))}drawEffect(t){var e=this._effectCanvases[t];e&&this._ctx.drawImage(e.cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW)}drawPictures(){this.picture.forEachPictures((t=>{this._ctx.drawImage(t.cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW)}))}drawCanvas(t,e,s,i){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._image,V.CHIP_SIZE*t,V.CHIP_SIZE*e,V.CHIP_SIZE,V.CHIP_SIZE,s,i,V.CHIP_SIZE,V.CHIP_SIZE)}drawCanvasWithSize(t,e,s,i,a,r){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._image,V.CHIP_SIZE*t,V.CHIP_SIZE*e,V.CHIP_SIZE*s,V.CHIP_SIZE*i,a,r,V.CHIP_SIZE*s,V.CHIP_SIZE*i)}drawCanvasWithUpperYLimit(t,e,s,i,a){if(!this._isLoaded)throw new Error("No image was loaded.");var r=Math.max(0,i+V.CHIP_SIZE-a);r>=V.CHIP_SIZE||this._ctx.drawImage(this._image,V.CHIP_SIZE*t,V.CHIP_SIZE*e,V.CHIP_SIZE,V.CHIP_SIZE-r,s,i,V.CHIP_SIZE,V.CHIP_SIZE)}copyCanvas(t,e){return(s,i,a,r,n)=>{if(!this._isLoaded)throw new Error("No image was loaded.");const o=Math.max(0,e(r,n));o>=V.CHIP_SIZE||t.ctx.drawImage(this._image,V.CHIP_SIZE*s,V.CHIP_SIZE*i+o,V.CHIP_SIZE,V.CHIP_SIZE-o,a,r+o,V.CHIP_SIZE,V.CHIP_SIZE)}}copyBackCanvasWithUpperYLimit(t,e,s,i,a){this.copyCanvas(this._backCanvas,((t,e)=>t+V.CHIP_SIZE-e))(t,e,s,i,a)}copyBackCanvasWithLowerYLimit(t,e,s,i,a){this.copyCanvas(this._backCanvas,((t,e)=>e-t))(t,e,s,i,a)}copyObjectCanvasWithUpperYLimit(t,e,s,i,a,r){this.copyCanvas(this._objectCanvases[t],((t,e)=>t+V.CHIP_SIZE-e))(e,s,i,a,r)}copyObjectCanvasWithLowerYLimit(t,e,s,i,a,r){this.copyCanvas(this._objectCanvases[t],((t,e)=>e-t))(e,s,i,a,r)}drawBackCanvas(){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._backCanvas.cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW)}drawObjectCanvas(t){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._objectCanvases[t].cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW)}clearBackCanvas(){this._backCanvas.clear()}clearBackCanvasWithLowerYLimit(t){this._backCanvas.clearRectWithLowerYLimit(t)}clearObjectCanvases(){var t;for(t=0;t<2;t++)this._objectCanvases[t].clear()}clearObjectCanvasesWithLowerYLimit(t){var e;for(e=0;e<2;e++)this._objectCanvases[e].clearRectWithLowerYLimit(t)}drawCanvasWithLowerYLimit(t,e,s,i,a){if(!this._isLoaded)throw new Error("No image was loaded.");var r=Math.max(0,a-i);r>=V.CHIP_SIZE||this._ctx.drawImage(this._image,V.CHIP_SIZE*t,V.CHIP_SIZE*e+r,V.CHIP_SIZE,V.CHIP_SIZE-r,s,i+r,V.CHIP_SIZE,V.CHIP_SIZE)}clearCanvas(t,e,s,i){this._ctx.clearRect(t,e,s,i)}drawBase(t,e,s,i){this._ctx.fillStyle="#9E9E9E",this._ctx.fillRect(t,e,s,i)}setFrameImage(t){this._frameCoord=t,this.createFrame()}constructor(t,e,s,i,a,r){var n;for(this._isLoaded=!1,this.mapCache=void 0,this.mapObjectCache=void 0,this.mapCacheYLimit=0,this._frameCanvas=new ye(V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,!0),this._backCanvas=new ye(V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,!1),this._objectCanvases=[],this._effectCanvases=[],this.picture=new ve(i,a),n=0;n<2;n++)this._objectCanvases[n]=new ye(V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,!0);this._ctx=t,this._fileName=e,this._loadCompleteCallBack=r,this._load(),this._frameCoord=s.clone(),this.cpPartsLog=new c(0,0)}}class Ae{constructor(t){this._position=null,this.reset(t)}setPlayer(t){this._player=t}isResetting(){return this._isResetting}getPosition(){return this._position}getPreviousPosition(){return this._positionPrev}resetPreviousPosition(){this._positionPrev=null}move(t){var e=U[this._player.getSpeedIndex()];this._position=this._position.getNextFramePosition(t,e*(V.H_PARTS_NUM_IN_WINDOW-1),e*(V.V_PARTS_NUM_IN_WINDOW-1))}getTransitionStepNum(){return this._transitionStep}advanceTransitionStepNum(){return++this._transitionStep,this._transitionStep===V.V_PARTS_NUM_IN_WINDOW&&(this._isResetting=!1,this._transitionStep=0),this._transitionStep}isFinalStep(){if(!1===this._isResetting)throw new Error("リセット中ではありません。");return this._transitionStep===V.V_PARTS_NUM_IN_WINDOW-1}reset(t){this._positionPrev=this._position,this._position=t.getDefaultCameraPosition(),this._transitionStep=0,this._isResetting=!0}}class Te{getPosition(){return this._position}constructor(t){this._position=t}}class Ie extends Te{constructor(t){super(t)}}var Ce;!function(t){t[t.CONTROLLABLE=0]="CONTROLLABLE",t[t.MOVING=1]="MOVING",t[t.CAMERA_MOVING=2]="CAMERA_MOVING",t[t.MESSAGE_WAITING=3]="MESSAGE_WAITING",t[t.LOCALGATE_JUMPED=4]="LOCALGATE_JUMPED",t[t.BATTLE=5]="BATTLE",t[t.ESTIMATE_WINDOW_WAITING=6]="ESTIMATE_WINDOW_WAITING",t[t.PASSWORD_WINDOW_WAITING=7]="PASSWORD_WINDOW_WAITING",t[t.LOCALGATE_JUMPED_WITH_MESSAGE=8]="LOCALGATE_JUMPED_WITH_MESSAGE"}(Ce||(Ce={}));class De extends Ie{move(){if(this.isControllable())this.controll(this._dir);else if(this._state===Ce.CAMERA_MOVING){try{this._camera.move(this._dir)}catch(t){}this._isOnCameraStopPosition()&&(this._state=Ce.CONTROLLABLE)}else if(this._state===Ce.MOVING){try{var t=this._position.getNextFramePosition(this._dir,U[this._speedIndex],U[this._speedIndex])}catch(t){}t.isJustPosition()&&(this._state=Ce.CONTROLLABLE,this.toggleMovingImage(),this._moves++,this._isPartsEventExecuted=!1,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,this._wwa.callMoveUserDefineFunction()),this._position=t}}controll(t){var e,s;if(this.isControllable()){this._isPreparedForLookingAround=!1,this._dir=t;try{e=this._position.getNextFramePosition(this._dir,U[this._speedIndex],U[this._speedIndex]),s=this._position.getNextJustPosition(t)}catch(t){return}if(this._isOnCameraMovingPosition()){if(0!==this._wwa.getMapIdByPosition(s)||this._wwa.isOldMap()||this._wwa.debug)try{this._camera.move(this._dir),this._state=Ce.CAMERA_MOVING}catch(t){this._state=Ce.CONTROLLABLE}return}if(!this.canMoveTo(s))return this._wwa.getMapTypeByPosition(s)===V.MAP_WALL&&this._wwa.checkMap(s.getPartsCoord()),void this._wwa.checkObject(s.getPartsCoord());this._position=e,this._state=Ce.MOVING,this._wwa.getMapAttributeByPosition(this._position.getNextJustPosition(t),V.ATR_TYPE)!==V.MAP_LOCALGATE&&this._wwa.moveObjects(!0)}}setDir(t){this._isPreparedForLookingAround=!1,this._dir=t}canMoveTo(t){if(null===t)return!1;if(this._wwa.debug)return!0;this._wwa.getMapWidth(),t.getPartsCoord(),t.getOffsetCoord();return!(0===this._wwa.getMapIdByPosition(t)&&!this._wwa.isOldMap())&&(this._wwa.getMapTypeByPosition(t)!==V.MAP_WALL&&(0===this._wwa.getObjectIdByPosition(t)||(this._wwa.getObjectTypeByPosition(t)===V.OBJECT_NORMAL&&this._wwa.getObjectAttributeByPosition(t,V.ATR_MODE)===V.PASSABLE_OBJECT||this._wwa.getObjectTypeByPosition(t)===V.OBJECT_DOOR&&this._wwa.getObjectAttributeByPosition(t,V.ATR_NUMBER)===V.PASSABLE_OBJECT&&!this.hasItem(this._wwa.getObjectAttributeByPosition(t,V.ATR_ITEM)))))}isMoving(){return this._state==Ce.MOVING||this._state==Ce.CAMERA_MOVING}_isOnCameraMovingPosition(){var t=this._camera.getPosition().getPartsCoord(),e=this.getPosition().getPartsCoord();return e.x-t.x==V.H_PARTS_NUM_IN_WINDOW-1&&this._dir===p.RIGHT||e.x===t.x&&this._dir===p.LEFT||e.y-t.y==V.V_PARTS_NUM_IN_WINDOW-1&&this._dir===p.DOWN||e.y===t.y&&this._dir===p.UP}_isOnCameraStopPosition(){var t=this._camera.getPosition().getPartsCoord(),e=this.getPosition().getPartsCoord();return e.x-t.x==V.H_PARTS_NUM_IN_WINDOW-1&&this._dir===p.LEFT||e.x===t.x&&this._dir===p.RIGHT||e.y-t.y==V.V_PARTS_NUM_IN_WINDOW-1&&this._dir===p.UP||e.y===t.y&&this._dir===p.DOWN}isControllable(){var t=this._afterMoveMacroFlag;return this._afterMoveMacroFlag=!1,this._state===Ce.CONTROLLABLE&&!this._partsAppeared&&(this._wwa.getMapTypeByPosition(this._position)!==V.MAP_LOCALGATE&&this._wwa.getMapTypeByPosition(this._position)!==V.MAP_URLGATE||!this._wwa.isPrevFrameEventExecuted())&&0===this._moveMacroWaitingRemainMoves&&0===this._moveObjectAutoExecTimer&&!t&&this._wwa.canInput()}getCopyOfItemBox(){return this._itemBox.slice()}getDir(){return this._dir}isMovingImage(){return this._isMovingImage}toggleMovingImage(){this._isMovingImage?this._isMovingImage=!1:this._isMovingImage=!0}getEnergyMax(){return this._energyMax}isJumped(){return this._state===Ce.LOCALGATE_JUMPED||this._state===Ce.LOCALGATE_JUMPED_WITH_MESSAGE}setMessageWaiting(){this._state=Ce.MESSAGE_WAITING}isWaitingMessage(){return this._state===Ce.MESSAGE_WAITING}isDelayFrame(){return this._messageDelayFrameCount>0}updateDelayFrame(){this._messageDelayFrameCount--}setDelayFrame(){this._messageDelayFrameCount=1}clearMessageWaiting(){this._state!==Ce.MESSAGE_WAITING&&this._state!==Ce.LOCALGATE_JUMPED_WITH_MESSAGE||(this._state===Ce.MESSAGE_WAITING?this._state=Ce.CONTROLLABLE:this._state===Ce.LOCALGATE_JUMPED_WITH_MESSAGE&&(this._state=Ce.LOCALGATE_JUMPED),this._isPartsEventExecuted=!0,this._isPreparedForLookingAround&&(this._lookingAroundTimer=V.PLAYER_LOOKING_AROUND_START_FRAME))}setEstimateWindowWating(){this._state=Ce.ESTIMATE_WINDOW_WAITING}isWaitingEstimateWindow(){return this._state===Ce.ESTIMATE_WINDOW_WAITING}clearEstimateWindowWaiting(){this._state===Ce.ESTIMATE_WINDOW_WAITING&&(this._state=Ce.CONTROLLABLE)}setPasswordWindowWating(){this._state=Ce.PASSWORD_WINDOW_WAITING}isWaitingPasswordWindow(){return this._state===Ce.PASSWORD_WINDOW_WAITING}clearPasswordWindowWaiting(){this._state===Ce.PASSWORD_WINDOW_WAITING&&(this._state=Ce.CONTROLLABLE)}isPartsEventExecuted(){return this._isPartsEventExecuted}resetEventExecutionInfo(){this._isPartsEventExecuted=!1}getLastExecPartsIDOnSamePosition(t){return t===v.MAP?this._samePosLastExecutedMapID:this._samePosLastExecutedObjID}setLastExecInfoOnSamePosition(t,e){t===v.MAP?this._samePosLastExecutedMapID=e:this._samePosLastExecutedObjID=e}processAfterJump(){this._state!==Ce.LOCALGATE_JUMPED&&this._state!==Ce.LOCALGATE_JUMPED_WITH_MESSAGE||0==--this._jumpWaitFramesRemain&&(this._state=this._state===Ce.LOCALGATE_JUMPED?Ce.CONTROLLABLE:Ce.MESSAGE_WAITING)}jumpTo(t){var e=this._camera.getPosition();this.getPosition();return!this._position.equals(t)&&(this._position=t,t.isInCameraRange(this._camera,!0)||this._camera.reset(t),this._state=this._state===Ce.MESSAGE_WAITING?Ce.LOCALGATE_JUMPED_WITH_MESSAGE:Ce.LOCALGATE_JUMPED,this._jumpWaitFramesRemain=V.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,t.hasLocalGate()?this._dir=p.DOWN:t.getPartsCoord().y<=this._wwa.getMapWidth()-2&&t.getNextJustPosition(p.DOWN).hasLocalGate()?this._dir=p.UP:t.getPartsCoord().y>=1&&t.getNextJustPosition(p.UP).hasLocalGate()?this._dir=p.DOWN:t.getPartsCoord().x<=this._wwa.getMapWidth()-2&&t.getNextJustPosition(p.RIGHT).hasLocalGate()?this._dir=p.LEFT:t.getPartsCoord().x>=1&&t.getNextJustPosition(p.LEFT).hasLocalGate()?this._dir=p.RIGHT:this._dir=p.DOWN,this._camera.getPosition().equals(e)||(this._isPreparedForLookingAround=!0,this._lookingAroundTimer=V.PLAYER_LOOKING_AROUND_START_FRAME),this._wwa.callJumpGateUserDefineFunction(),!0)}systemJumpTo(t){this._position=t,this._camera.reset(t),this._camera.resetPreviousPosition(),this._state=Ce.LOCALGATE_JUMPED,this._jumpWaitFramesRemain=V.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,this._dir=p.DOWN,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=V.PLAYER_LOOKING_AROUND_START_FRAME}addStatusAll(t){return this._status.add(t),this.isDead()&&(this._status.energy=0),0!==this._energyMax&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),this._status}setEnergyMax(t){return this._energyMax=t,0!==t&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),t}setEnergy(t){return this._status.energy=t,this.isDead()&&(this._status.energy=0),0!==this._energyMax&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),t}damage(t){this._status.energy=Math.max(0,this._status.energy-t),this.isDead()&&(this._status.energy=0),0!==this._energyMax&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox()}setStrength(t){return this._status.strength=t,this.updateStatusValueBox(),t}setDefence(t){return this._status.defence=t,this.updateStatusValueBox(),t}setGold(t){return this._status.gold=t,this.updateStatusValueBox(),t}getStatus(){return this._status.plus(this._equipStatus)}getStatusWithoutEquipments(){return this._status.plus(new o(0,0))}getStatusOfEquipments(){return this._equipStatus.plus(new o(0,0))}updateStatusValueBox(){var t;const e=this._status.plus(this._equipStatus);this._energyValueElement.textContent=this._wwa.isVisibleStatus("energy")?String(e.energy):"",this._strengthValueElement.textContent=this._wwa.isVisibleStatus("strength")?String(e.strength):"",this._defenceValueElement.textContent=this._wwa.isVisibleStatus("defence")?String(e.defence):"",this._goldValueElement.textContent=this._wwa.isVisibleStatus("gold")?String(e.gold):"",null===(t=this._wwa._messageWindow)||void 0===t||t.update(),this._wwa.updateScore()}updateItemBox(t){for(let e=0;e<this._itemBoxElement.length;e++){const s=this._itemBoxElement[e],i=mt("#item"+e);if(0===this._itemBox[e]){s.style.backgroundPosition="-40px 0px",this.disposeItemEffect(e,this._itemBoxElement[e],i);continue}const a=this._wwa.getObjectCropXById(this._itemBox[e]),r=this._wwa.getObjectCropYById(this._itemBox[e]);if(!t||e!==t.insertPos-1){s.style.backgroundPosition="-"+a+"px -"+r+"px",this.disposeItemEffect(e,this._itemBoxElement[e],i);continue}const n=t.itemScreenPixelCoord.x-t.itemBoxScreenPixelCoord.x,o=t.itemScreenPixelCoord.y-t.itemBoxScreenPixelCoord.y,h=-n*V.DEFAULT_FRAME_INTERVAL/V.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME,c=0===t.overwrittenObjectId||void 0===t.overwrittenObjectId,_=c?t.itemBoxBackgroundImageCoord.x:this._wwa.getObjectCropXById(t.overwrittenObjectId),l=c?t.itemBoxBackgroundImageCoord.y:this._wwa.getObjectCropYById(t.overwrittenObjectId);s.style.left=n+"px",s.style.top=o+"px","number"==typeof this.itemEffectStartTimers[e]&&clearInterval(this.itemEffectStartTimers[e]),this.itemEffectStartTimers[e]=window.setTimeout((()=>{this.itemEffectStartTimers[e]=void 0,this.startItemEffect(e,s,i,{target:{x:a,y:r},overwritten:{x:_,y:l}},h)}),V.DEFAULT_FRAME_INTERVAL)}}startItemEffect(t,e,s,i,a){const r=s.querySelector(this.overwittenItemSelector);r&&s.removeChild(r);const n=document.createElement("div");n.classList.add(this.overwittenItemClassName),n.style.backgroundPosition="-"+i.overwritten.x+"px -"+i.overwritten.y+"px",n.style.backgroundImage=s.style.backgroundImage,s.appendChild(n),e.style.backgroundPosition="-"+i.target.x+"px -"+i.target.y+"px",e.style.transitionDuration=a+"ms",e.style.transitionProperty="left,top",e.style.transitionTimingFunction="linear",e.style.left="0",e.style.top="0",s.classList.add(this.itemTransitioningClassName),e.addEventListener("transitionend",(()=>{this.disposeItemEffect(t,e,s)}),{once:!0})}disposeItemEffect(t,e,s){"number"==typeof this.itemEffectStartTimers[t]&&(clearInterval(this.itemEffectStartTimers[t]),this.itemEffectStartTimers[t]=void 0),e.style.transitionDuration="0s",e.style.transitionProperty="",e.style.left="0",e.style.top="0",s.classList.contains(this.itemTransitioningClassName)&&s.classList.remove(this.itemTransitioningClassName);const i=s.querySelector(this.overwittenItemSelector);i&&s.removeChild(i)}isDead(){return this._status.energy<=0}addItem(t,e=0,s=!1,i){var a,r,n,o=this._wwa.getObjectAttributeById(t,V.ATR_NUMBER),h=0;if(0===e&&0!==o&&(e=o),0===e){if(0===t)return;if((a=this._getBlankItemPos())===V.ITEMBOX_IS_FULL)throw this._wwa.setEvalCalcWwaNodeEarnedItem(t,-1),this._wwa.callGetItemFullUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),new Error("これ以上、アイテムを持てません。");h=this._itemBox[a-1],this._forceSetItemBox(a,t)}else if(!1===s)if(a=e,n=this._itemBox[a-1],this._wwa.getObjectAttributeById(n,V.ATR_NUMBER)!==this._wwa.getObjectAttributeById(t,V.ATR_NUMBER)){if((r=this._getBlankItemPos())===V.ITEMBOX_IS_FULL)throw this._wwa.setEvalCalcWwaNodeEarnedItem(t,-1),this._wwa.callGetItemFullUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),new Error("これ以上、アイテムを持てません。");this._forceSetItemBox(r,n),this._forceSetItemBox(a,t)}else h=this._itemBox[a-1],this._forceSetItemBox(a,t);else a=e,h=this._itemBox[a-1],this._forceSetItemBox(a,t);this._updateEquipmentStatus(),this.updateItemBox(i?{insertPos:a,itemScreenPixelCoord:i.screenPixelCoord,itemBoxBackgroundImageCoord:i.itemBoxBackgroundImageCoord,itemBoxScreenPixelCoord:new c(V.MAP_WINDOW_WIDTH+(a-1)%3*V.CHIP_SIZE,V.ITEMBOX_TOP_Y+Math.floor((a-1)/3)*V.CHIP_SIZE),overwrittenObjectId:h}:void 0)}_forceSetItemBox(t,e){var s=this,a=Et("#item"+(t-1)+">.item-click-border"),r=this._wwa.getObjectAttributeById(e,V.ATR_MODE);if(this.removeItemByItemPosition(t),this._itemBox[t-1]=e,this._wwa.setEvalCalcWwaNodeEarnedItem(e,t),this._wwa.callGetItemUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),0!==e&&r!==f.NORMAL){const e=this._wwa.resolveSystemMessage(i.ITEM_SELECT_TUTORIAL);this._isClickableItemGot||("BLANK"!==e&&this._wwa.generatePageAndReserveExecution(e,!1,!0),this._isClickableItemGot=!0),a.style.display="block",(t=>{s._itemUsingEvent[t-1]=()=>{(s.isControllable()||s._wwa._messageWindow.isItemMenuChoice())&&(s._wwa._itemMenu.close(),s._wwa._setNextPage(),s._wwa.onselectitem(t))}})(t),a.addEventListener("click",this._itemUsingEvent[t-1])}}_getBlankItemPos(){var t;for(t=1;t<this._itemBox.length+1;t++)if(0===this._itemBox[t-1])return t;return V.ITEMBOX_IS_FULL}_updateEquipmentStatus(){var t,e=new o(0,0);for(t=0;t<V.ITEMBOX_SIZE;t++)0!==this._itemBox[t]&&(e.strength+=this._wwa.getObjectAttributeById(this._itemBox[t],V.ATR_STRENGTH),e.defence+=this._wwa.getObjectAttributeById(this._itemBox[t],V.ATR_DEFENCE));var s=e.minus(this._equipStatus);this._wwa.setStatusChangedEffect(s),this._equipStatus=e,this.updateStatusValueBox()}hasItem(t){for(var e=0;e<V.ITEMBOX_SIZE;e++)if(this._itemBox[e]===t)return!0;return!1}canUseItem(t){var e=this._itemBox[t-1];return 0!==e&&this._wwa.getObjectAttributeById(e,V.ATR_MODE)!==f.NORMAL}useItem(){var t;t=this._itemBox[this._readyToUseItemPos-1],this._wwa.getObjectAttributeById(t,V.ATR_MODE)!==f.NOT_DISAPPEAR&&this.removeItemByItemPosition(this._readyToUseItemPos);var e=dt("item"+(this._readyToUseItemPos-1));return setTimeout((()=>{e.classList.contains("onpress")&&e.classList.remove("onpress")}),V.DEFAULT_FRAME_INTERVAL),this._wwa.setEvalCalcWwaNodeEarnedItem(t,this._readyToUseItemPos-1),this._wwa.callUseItemUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),this._isReadyToUseItem=!1,this._readyToUseItemPos=void 0,t}canHaveMoreItems(){return this._getBlankItemPos()!==V.ITEMBOX_IS_FULL}removeItemByItemPosition(t){var e;0!==this._itemBox[t-1]&&(this._wwa.getObjectAttributeById(this._itemBox[t-1],V.ATR_MODE)!==f.NORMAL&&((e=Et("#item"+(t-1)+">.item-click-border")).removeEventListener("click",this._itemUsingEvent[t-1]),e.style.display="none"),this._itemBox[t-1]=0,this._updateEquipmentStatus(),this.updateItemBox())}removeItemByPartsID(t){var e;if(!this.hasItem(t))throw new Error("アイテムを持っていない");for(var s=0;s<V.ITEMBOX_SIZE;s++)if(this._itemBox[s]===t)return this._wwa.getObjectAttributeById(this._itemBox[s],V.ATR_MODE)!==f.NORMAL&&((e=Et("#item"+s+">.item-click-border")).removeEventListener("click",this._itemUsingEvent[s]),e.style.display="none"),this._itemBox[s]=0,this._updateEquipmentStatus(),void this.updateItemBox()}clearItemBox(){for(var t=1;t<=V.ITEMBOX_SIZE;t++)this.removeItemByItemPosition(t);this._updateEquipmentStatus(),this.updateItemBox()}hasGold(t){return this._status.gold>=t}payGold(t){if(!this.hasGold(t))throw new Error("お金が足りない");this.setGold(this._status.gold-t)}earnGold(t){this.setGold(this._status.gold+t)}setPartsAppearedFlag(){this._partsAppeared=!0}clearPartsAppearedFlag(){this._partsAppeared=!1}isPartsAppearedTime(){return!0===this._partsAppeared}startBattleWith(t){this._isPlayerTurn=!0,this._battleFrameCounter=V.BATTLE_INTERVAL_FRAME_NUM,this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=t,this._state=Ce.BATTLE}isFighting(){return this._state===Ce.BATTLE}isTurn(){return this._isPlayerTurn}getTurnNum(){return this._battleTurnLength}isBattleStartFrame(){return this._battleFrameCounter===V.BATTLE_INTERVAL_FRAME_NUM&&0===this._battleTurnLength}calcBattleResultForPlayerTurn(t,e,s=!1){const i=this._wwa.callUserDefinedBattleDamageFunction("playerToEnemy",s?{playerStatus:t,enemyStatus:e}:void 0);return i||{damage:this._calcDamageDefault(t,e)}}calcBattleResultForEnemyTurn(t,e,s=!1){const i=this._wwa.callUserDefinedBattleDamageFunction("enemyToPlayer",s?{playerStatus:e,enemyStatus:t}:void 0);return i||{damage:this._calcDamageDefault(t,e)}}_calcDamageDefault(t,e){const s=t.strength-e.defence;return s>0?s:0}fight(){if(!this.isFighting())throw new Error("バトルが開始されていません。");if(0===this._battleTurnLength&&this._battleFrameCounter===V.BATTLE_INTERVAL_FRAME_NUM&&this._wwa.showMonsterWindow(),--this._battleFrameCounter>0)return;this._battleTurnLength++,this._wwa.isBattleSpeedIndexForQuickBattle(this._speedIndex)||this._battleTurnLength>V.BATTLE_SPEED_CHANGE_TURN_NUM?(1===this._battleTurnLength&&(this._wwa.playSound(R.ATTACK),this._wwa.vibration(!1)),this._battleFrameCounter=1):(this._battleFrameCounter=V.BATTLE_INTERVAL_FRAME_NUM,this._wwa.playSound(R.ATTACK),this._wwa.vibration(!0));var t=this.getStatus(),e=this._enemy.status;let s=!1;if(this._isPlayerTurn){if(1===this._battleTurnLength&&this._wwa.isUsingDefaultDamageCalcFunction()&&t.strength<=e.defence&&t.defence>=e.strength){this._enemy.battleEndProcess();const t=this._wwa.resolveSystemMessage(i.CANNOT_DAMAGE_MONSTER);return"BLANK"!==t&&this._wwa.generatePageAndReserveExecution(t,!1,!0),this._battleTurnLength=0,this._enemy=null,void(this._state=Ce.CONTROLLABLE)}const{damage:a,aborted:r}=this.calcBattleResultForPlayerTurn(t,e);this._enemy.damage(a),s=Boolean(r),this._enemy.status.energy<=0&&(this._wwa.playSound(this._wwa.getObjectAttributeById(this._enemy.partsID,V.ATR_SOUND)),this.earnGold(e.gold),this._wwa.setStatusChangedEffect(new h(0,0,0,e.gold)),0!==this._enemy.item?this._wwa.setPartsOnPosition(v.OBJECT,this._enemy.item,this._enemy.position):this._wwa.setPartsOnPosition(v.OBJECT,0,this._enemy.position),this._wwa.reserveAppearPartsInNextFrame(this._enemy.position,w.OBJECT,this._enemy.partsID),this._state=Ce.CONTROLLABLE,this._wwa.generatePageAndReserveExecution(this._enemy.message,!1,!1,this._enemy.partsID,v.OBJECT,this._enemy.position),this._enemy.battleEndProcess(),this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null),null!==this._enemy&&(0===a?this._battleNoDamageTurnLength++:this._battleNoDamageTurnLength=0),this._isPlayerTurn=!1}else{const{damage:i,aborted:a}=this.calcBattleResultForEnemyTurn(e,t);this.damage(i),s=Boolean(a),this._status.energy<=0&&(this.setEnergy(0),this._enemy.battleEndProcess(),this._state=Ce.CONTROLLABLE,this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null,this._wwa.shouldApplyGameOver({isCalledByMacro:!1})&&this._wwa.gameover()),0===i?this._battleNoDamageTurnLength++:this._battleNoDamageTurnLength=0,this._isPlayerTurn=!0}if(this._battleNoDamageTurnLength>V.FIGHT_DRAW_TURN||s){this._enemy.battleEndProcess();const t=this._wwa.resolveSystemMessage(i.BATTLE_NOT_SETTLED);"BLANK"!==t&&this._wwa.generatePageAndReserveExecution(t,!1,!0),this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null}}readyToUseItem(t){var e;if(!this.canUseItem(t))throw new Error("アイテムがないか、アイテムが使えません。");e=this._itemBox[t-1],this._wwa.getObjectAttributeById(e,V.ATR_STRING),this._wwa.reserveAppearPartsInNextFrame(this._position.getPartsCoord(),w.OBJECT,e),this._readyToUseItemPos=t,this._isReadyToUseItem=!0}isReadyToUseItem(){return this._isReadyToUseItem}getDrawingCenterPosition(){var t=this._position.getPartsCoord(),e=this._position.getOffsetCoord(),s=this._camera.getPosition(),i=s.getPartsCoord(),a=s.getOffsetCoord(),r=(t.x-i.x)*V.CHIP_SIZE+e.x-a.x+V.CHIP_SIZE/2,n=(t.y-i.y)*V.CHIP_SIZE+e.y-a.y+V.CHIP_SIZE/2;return new c(r,n)}mainFrameCount(){this._frameCount++}getFrameCount(){return this._frameCount}setFrameCount(t){return"number"!=typeof t&&(t=0),this._frameCount=t}getMoveCount(){return this._moves}setMoveCount(t){return this._moves=t}isMoveObjectAutoExecTime(){return 0===this._moveObjectAutoExecTimer}setMoveMacroWaiting(t){t<0||(this._moveMacroWaitingRemainMoves=t,this._moveObjectAutoExecTimer=0)}resetMoveObjectAutoExecTimer(){this._moveObjectAutoExecTimer=V.CHIP_SIZE/U[this._speedIndex],this._moveMacroWaitingRemainMoves--}decrementMoveObjectAutoExecTimer(){return this._moveMacroWaitingRemainMoves>=0&&this._moveObjectAutoExecTimer>0&&(this._moveObjectAutoExecTimer--,0===this._moveMacroWaitingRemainMoves&&0===this._moveObjectAutoExecTimer&&(this._afterMoveMacroFlag=!0)),0}isWaitingMoveMacro(){return 0!==this._moveMacroWaitingRemainMoves||0!==this._moveObjectAutoExecTimer}decrementLookingAroundTimer(){return this._isPreparedForLookingAround&&this._lookingAroundTimer>0?--this._lookingAroundTimer:0}isLookingAround(){return this._isPreparedForLookingAround&&0===this._lookingAroundTimer}getSpeedIndex(){return this._speedIndex}speedUp(){return this._speedIndex=Math.min(V.MAX_SPEED_INDEX,this._speedIndex+1)}speedDown(){return this._speedIndex=Math.max(V.MIN_SPEED_INDEX,this._speedIndex-1)}setSpeedIndex(t){if(t<V.MIN_SPEED_INDEX||V.MAX_SPEED_INDEX<t)throw new Error("#set_speed の引数が異常です:"+t);return this._speedIndex=t,this._speedIndex}constructor(t,e,s,i,a,r,n){super(e),this.itemTransitioningClassName="item-transitioning",this.overwittenItemClassName="item-overwritten",this.overwittenItemSelector=`.${this.overwittenItemClassName}`,this.itemEffectStartTimers=new Array(V.ITEMBOX_SIZE),this._status=i,this._equipStatus=new o(0,0),this._itemBox=new Array(V.ITEMBOX_SIZE),this._itemBoxElement=new Array(V.ITEMBOX_SIZE),this._itemUsingEvent=new Array(V.ITEMBOX_SIZE);for(var h=0;h<this._itemBox.length;h++)this._itemBox[h]=0,this._itemBoxElement[h]=Et("#item"+h+">.item-disp");this.updateItemBox(),this._energyMax=a,this._dir=p.DOWN,this._isMovingImage=!1,this._wwa=t,this._state=Ce.CONTROLLABLE,this._camera=s,this._isPartsEventExecuted=!1,this._energyValueElement=Et("#disp-energy>.status-value-box"),this._strengthValueElement=Et("#disp-strength>.status-value-box"),this._defenceValueElement=Et("#disp-defence>.status-value-box"),this._goldValueElement=Et("#disp-gold>.status-value-box"),this._isReadyToUseItem=!1,this._isClickableItemGot=!1,this._moves=r,this._moveMacroWaitingRemainMoves=0,this._moveObjectAutoExecTimer=0,this.updateStatusValueBox(),this._partsAppeared=!1,this._afterMoveMacroFlag=!1,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=V.PLAYER_LOOKING_AROUND_START_FRAME,this._speedIndex=n,this._messageDelayFrameCount=0,this._battleNoDamageTurnLength=0}}class Pe{constructor(t,e,s,i,a,r,n){this._partsID=t,this._position=e,this._imgCoord=s,this._status=i,this._message=a,this._item=r,this._battleEndCallback=n}get partsID(){return this._partsID}get position(){return this._position}get imgCoord(){return this._imgCoord}get status(){return this._status}get message(){return this._message}get item(){return this._item}damage(t){this._status.energy=Math.max(0,this._status.energy-t)}battleEndProcess(){var t;null===(t=this._battleEndCallback)||void 0===t||t.call(this)}setStatus(t){null!==t.energy&&(this._status.energy=t.energy),null!==t.strength&&(this._status.strength=t.strength),null!==t.defence&&(this._status.defence=t.defence)}clone(){return new Pe(this._partsID,this._position.clone(),this._imgCoord.clone(),this._status.clone(),this._message,this._item,this._battleEndCallback)}}class Ne{constructor(t,e,s,i,a){this._player=t,this._objectID=e,this._srcPos=s,this._destPos=i,this._dir=a,this._currentPos=this._srcPos.clone()}update(){var t=this._player.getSpeedIndex();return this._currentPos=this._currentPos.getNextFramePosition(this._dir,U[t],U[t]),this._currentPos}get isAchievedDestination(){return this._currentPos.equals(this._destPos)}get currentPosition(){return this._currentPos}get beforePosition(){return this._srcPos}get destination(){return this._destPos}get objID(){return this._objectID}}class Oe{constructor(t,e){this._wwa=t,this._player=e,this.clear()}add(t,e,s,i){this._queue.push(new Ne(this._player,t,e,s,i))}update(){for(var t=[],e=[],s=0;s<this._queue.length;s++)this._queue[s].update(),this._queue[s].isAchievedDestination?(t.push(this._queue[s]),this._wwa.setPartsOnPosition(v.OBJECT,0,this._queue[s].beforePosition.getPartsCoord()),this._wwa.setPartsOnPosition(v.OBJECT,this._queue[s].objID,this._queue[s].destination.getPartsCoord())):e.push(this._queue[s]);return this._queue=e,t}clear(){this._queue=[]}get objectMovingData(){return this.objectMovingData}getOffsetByBeforePartsCoord(t){var e=this._queue.filter((e=>e.beforePosition.getPartsCoord().equals(t)));return 0===e.length?null:e[0].currentPosition.getOffsetCoord()}}class Me{constructor(t,e,s,i,a,r){this.firstNode=t,this.isLastPage=e,this.showChoice=s,this.isSystemMessage=i,this.scoreOptions=a,this.extraInfo=r}}class xe{constructor(){}}class be extends xe{constructor(t=[]){super(),this.branches=t}appendBranch(t){this.branches.push(t)}getLastUnconnectedBranch(){for(let t of this.branches)if(!t.next)return t}evaluateAndGetNextNode(t){for(let e of this.branches)if(!e.descriminant||re(e.descriminant,t()))return e.next}hasElseBranch(){return this.branches.filter((t=>Boolean(t.elseBranch))).length>=1}}class Le extends xe{constructor(t,e,s){super(),this.macro=e,this.next=s,this.messageSegments=this.parseMessage(t),void 0===this.macro&&(this.macro=[])}isEmpty(){return this.messageSegments.reduce(((t,e)=>t&&""===e),!0)}generatePrintableMessage(){return this.messageSegments.reduce(((t,e)=>`${t}${"string"==typeof e?e:e()}`),"")}appendMessage(t,e=!1){this.messageSegments=this.messageSegments.concat(e?["\n"]:[],this.parseMessage(t))}parseMessage(t){return"string"==typeof t?[t]:t}}function Re(t){return void 0===t||(t instanceof be?t.branches.reduce(((t,e)=>t&&Re(e.next)),!0):t instanceof Le?t.isEmpty()&&Re(t.next):void 0)}const Be=t=>t===M.SHOW_STR||t===M.SHOW_STR2||"text"===t||"normalMacro"===t;class Ue{constructor(t,e,s,i,a,r){this._wwa=t,this._triggerPartsID=e,this._triggerPartsType=s,this._triggerPartsPosition=i,this.macroType=a,this.macroArgs=r}isJunction(){return[M.IF,M.ELSE_IF,M.ELSE,M.END_IF].includes(this.macroType)}execute(){try{switch(this.macroType){case M.IMGPLAYER:return this._executeImgPlayerMacro(),{};case M.IMGYESNO:return this._executeImgYesNoMacro(),{};case M.HPMAX:return this._executeHPMaxMacro(),{};case M.SAVE:return this._executeSaveMacro(),{};case M.ITEM:return this._executeItemMacro(),{};case M.DEFAULT:return this._executeDefaultMacro(),{};case M.OLDMAP:return this._executeOldMapMacro(),{};case M.PARTS:return this._executePartsMacro(),{};case M.MOVE:return this._executeMoveMacro(),{};case M.MAP:return this._executeMapMacro(1),{};case M.DIRMAP:return this._executeDirMapMacro(),{};case M.IMGFRAME:return this._executeImgFrameMacro(),{};case M.IMGBOM:return this._executeImgBomMacro(),{};case M.DELPLAYER:return this._executeDelPlayerMacro(),{};case M.FACE:return this._executeFaceMacro(),{};case M.EFFECT:return this._executeEffectMacro(),{};case M.GAMEOVER:return this._executeGameOverMacro(),{};case M.IMGCLICK:return this._executeImgClickMacro(),{};case M.STATUS:{const{isGameOver:t}=this._executeStatusMacro();return{isGameOver:t}}case M.EFFITEM:return this._executeEffItemMacro(),{};case M.COLOR:return this._executeColorMacro(),{};case M.WAIT:return this._executeWaitMacro(),{};case M.SOUND:return this._executeSoundMacro(),{};case M.GAMEPAD_BUTTON:return this._executeGamePadButtonMacro(),{};case M.OLDMOVE:return this._executeOldMoveMacro(),{};case M.JUMPGATE:return this._executeJumpGateMacro(),{};case M.RECPOSITION:return this._executeRecPositionMacro(),{};case M.JUMPRECPOSITION:return this._executeJumpRecPositionMacro(),{};case M.CONSOLE_LOG:return this._executeConsoleLogMacro(1),{};case M.COPY_HP_TO:return this._executeCopyHpToMacro(),{};case M.SET_HP:{const{isGameOver:t}=this._executeSetHPMacro();return{isGameOver:t}}case M.COPY_HPMAX_TO:return this._executeCopyHpMaxToMacro(),{};case M.SET_HPMAX:return this._executeSetHpMaxMacro(),{};case M.COPY_AT_TO:return this._executeCopyAtToMacro(),{};case M.SET_AT:return this._executeSetAtMacro(),{};case M.COPY_DF_TO:return this._executeCopyDfToMacro(),{};case M.SET_DF:return this._executeSetDfMacro(),{};case M.COPY_MONEY_TO:return this._executeCopyMoneyToMacro(),{};case M.SET_MONEY:return this._executeSetMoneyMacro(),{};case M.COPY_STEP_COUNT_TO:return this._executeSetStepCountMacro(),{};case M.VAR_SET_VAL:return this._executeVarSetValMacro(),{};case M.VAR_SET:return this._executeVarSetMacro(),{};case M.VAR_ADD:return this._executeVarAddMacro(),{};case M.VAR_SUB:return this._executeVarSubMacro(),{};case M.VAR_MUL:return this._executeVarMulMacro(),{};case M.VAR_DIV:return this._executeVarDivMacro(),{};case M.VAR_MOD:return this._executeVarModMacro(),{};case M.VAR_SET_RAND:return this._executeVarSetRandMacro(),{};case M.GAME_SPEED:return this._executeGameSpeedMacro(),{};case M.SHOW_STR:case M.SHOW_STR2:case M.IF:return{};case M.LEGACY_IF:return this._executeLegacyIfMacro(),{};case M.ELSE_IF:case M.ELSE:case M.END_IF:return{};case M.SET_SPEED:return this._executeSetSpeedMacro(),{};case M.COPY_TIME_TO:return this._executeCopyTimeToMacro(),{};case M.HIDE_STATUS:return this._executeHideStatusMacro(),{};case M.VAR_MAP:return this._executeVarMapMacro(),{};case M.NO_GAMEOVER:return this._executeNoGameOverMacro(),{};case M.SET:{const{isGameOver:t}=this._executeSetMacro();return{isGameOver:t}}case M.MAP2:return this._executeMapMacro(2),{};case M.CONSOLE_LOG2:return this._executeConsoleLogMacro(2),{};case M.DELAYBGM:return this._executeDelayBgmMacro(),{};case M.SYSMSG:return this._executeSysMsgMacro(),{};case M.PICTURE:return this._executePictureMacro(),{};default:return console.log("不明なマクロIDが実行されました:"+this.macroType),{}}}catch(t){}}_concatEmptyArgs(t){if(this.macroArgs.length<t){for(var e=new Array(t-this.macroArgs.length),s=0;s<e.length;s++)e[s]="";this.macroArgs=this.macroArgs.concat(e)}}_evaluateIntValue(t,e=0){const s=this.macroArgs[t];if(""===s)return e;const i=Number(s),a=i>=0?Math.floor(i):Math.ceil(i);return isNaN(a)?le(s,this._wwa.generateTokenValues({id:this._triggerPartsID,type:this._triggerPartsType,position:this._triggerPartsPosition}),e):a}_executeJumpGateMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.forcedJumpGate(t,e)}_executeRecPositionMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.recUserPosition(t,e)}_executeJumpRecPositionMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.jumpRecUserPosition(t,e)}_executeConsoleLogMacro(t){this._concatEmptyArgs(1);const e=this._evaluateIntValue(0);switch(t){case 1:return void this._wwa.outputUserVar(e);case 2:return void console.log(`${this.macroArgs[0]} = ${e}`)}}_executeCopyHpToMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarHP(t)}_executeCopyHpMaxToMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarHPMAX(t)}_executeCopyAtToMacro(){this._concatEmptyArgs(2);const t=this._evaluateIntValue(0),e=this._parseStatusKind(this._evaluateIntValue(1));this._wwa.setUserVarAT(t,e)}_executeCopyDfToMacro(){this._concatEmptyArgs(2);const t=this._evaluateIntValue(0),e=this._parseStatusKind(this._evaluateIntValue(1));this._wwa.setUserVarDF(t,e)}_parseStatusKind(t){switch(t){case 0:default:return"all";case 1:return"bare";case 2:return"equipment"}}_executeCopyMoneyToMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarMONEY(t)}_executeSetHPMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);return this._wwa.setHPUserVar(t,!0)}_executeSetHpMaxMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setHPMAXUserVar(t)}_executeSetAtMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setATUserVar(t)}_executeSetDfMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setDFUserVar(t)}_executeSetMoneyMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setMONEYUserVar(t)}_executeSetStepCountMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarStep(t)}_executeVarSetValMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserVarVal(t,e)}_executeVarSetMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValOtherUserVal(t,e)}_executeVarAddMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValAdd(t,e)}_executeVarSubMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValSub(t,e)}_executeVarMulMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValMul(t,e)}_executeVarDivMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValDiv(t,e)}_executeVarModMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValMod(t,e)}_executeVarSetRandMacro(){this._concatEmptyArgs(3);const t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2,0);this._wwa.setUserValRandNum(t,e,s)}_executeGameSpeedMacro(){this._concatEmptyArgs(1);var t=!!this._evaluateIntValue(0);this._wwa.speedChangeJudge(t)}_executeLegacyIfMacro(){for(var t=new Array(11),e=0;e<10;e++)t[e]=this.macroArgs[e];this._wwa.userVarUserIf(this._triggerPartsPosition,t)}_executeSetSpeedMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setPlayerSpeedIndex(t-1)}_executeCopyTimeToMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarPlayTime(t)}_executeHideStatusMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=0!==this._evaluateIntValue(1);this._wwa.hideStatus(t,e)}_executeVarMapMacro(){this._concatEmptyArgs(4);var t=this._evaluateIntValue(0),e=this.macroArgs[1],s=this.macroArgs[2],i=this._evaluateIntValue(3,v.OBJECT);if(t<0)throw new Error("入力変数が不正です");this._wwa.varMap(this._triggerPartsPosition,e,s,t,i)}_executeImgPlayerMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setPlayerImgCoord(new c(t,e))}_executeImgYesNoMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setYesNoImgCoord(new c(t,e))}_executeHPMaxMacro(){this._concatEmptyArgs(1);var t=Math.max(0,this._evaluateIntValue(0));this._wwa.setPlayerEnergyMax(t)}_executeSaveMacro(){this._concatEmptyArgs(1);var t=!!this._evaluateIntValue(0);this._wwa.disableSave(t)}_executeItemMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setPlayerGetItem(t,e)}_executeDefaultMacro(){this._concatEmptyArgs(1);var t=!!this._evaluateIntValue(0);this._wwa.setObjectNotCollapseOnPartsOnPlayer(t)}_executeOldMapMacro(){this._concatEmptyArgs(1);var t=!!this._evaluateIntValue(0);this._wwa.setOldMap(t)}_executePartsMacro(){this._concatEmptyArgs(4);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2,v.OBJECT),i=this._evaluateIntValue(3);if(s!==v.OBJECT&&s!==v.MAP)throw new Error("パーツ種別が不明です");if(0!==i&&1!==i&&(i=1),t<0||e<0)throw new Error("パーツ番号が不正です");if(s===v.OBJECT){if(t>=this._wwa.getObjectPartsNum()||e>=this._wwa.getObjectPartsNum())throw new Error("パーツ番号が不正です")}else if(t>=this._wwa.getMapPartsNum()||e>=this._wwa.getMapPartsNum())throw new Error("パーツ番号が不正です");this._wwa.replaceParts(t,e,s,!!i)}_executeMoveMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setMoveMacroWaitingToPlayer(t)}_executeMapMacro(t){this._concatEmptyArgs(4);const e=this._evaluateIntValue(0);var s=this._evaluateIntValue(3,v.OBJECT);if(e<0)throw new Error("パーツ番号が不正です");if(s===v.OBJECT){if(e>=this._wwa.getObjectPartsNum())throw new Error("パーツ番号が不正です")}else if(e>=this._wwa.getMapPartsNum())throw new Error("パーツ番号が不正です");if(1===t){const t=this.macroArgs[1],i=this.macroArgs[2];this._wwa.appearPartsEval(this._triggerPartsPosition,t,i,e,s)}else if(2===t){const t=this._evaluateIntValue(1),i=this._evaluateIntValue(2);if(isNaN(t)||isNaN(i))throw new Error("出現先座標が不正です");this._wwa.appearPartsEval(this._triggerPartsPosition,`${t}`,`${i}`,e,s)}}_executeDirMapMacro(){this._concatEmptyArgs(3);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2,v.OBJECT);if(isNaN(t)||isNaN(e)||isNaN(s))throw new Error("引数が整数ではありません");if(t<0)throw new Error("パーツ番号が不正です");if(s===v.OBJECT){if(t>=this._wwa.getObjectPartsNum())throw new Error("パーツ番号が不正です")}else if(t>=this._wwa.getMapPartsNum())throw new Error("パーツ番号が不正です");this._wwa.appearPartsByDirection(e,t,s)}_executeImgFrameMacro(){this._concatEmptyArgs(3);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2);if(e<0||s<0)throw new Error("座標は正でなければなりません。");if(t===L.ENERGY||t===L.STRENGTH||t===L.DEFENCE||t===L.GOLD)this._wwa.setStatusIconCoord(t,new c(e,s));else if(t===L.WIDE_CELL_ROW)this._wwa.setWideCellCoord(new c(e,s));else if(t===L.ITEM_BG)this._wwa.setItemboxBackgroundPosition({x:e,y:s});else{if(t!==L.MAIN_FRAME)throw new Error("種別が不正です。");this._wwa.setFrameCoord(new c(e,s))}}_executeImgBomMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||e<0)throw new Error("座標は正でなければなりません。");this._wwa.setBattleEffectCoord(new c(t,e))}_executeDelPlayerMacro(){this._concatEmptyArgs(1);const t=this._evaluateIntValue(0);this._wwa.setDelPlayer(!!t)}_executeFaceMacro(){this._concatEmptyArgs(6);var t,e=this._evaluateIntValue(0),s=this._evaluateIntValue(1),i=this._evaluateIntValue(2),a=this._evaluateIntValue(3),r=this._evaluateIntValue(4),n=this._evaluateIntValue(5);if(e<0||s<0||i<0||a<0||r<0||n<0)throw new Error("各引数は0以上の整数でなければなりません。");t=new l(new c(e,s),new c(i,a),new c(r,n)),this._wwa.addFace(t)}_executeEffectMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);if(t<0)throw new Error("待ち時間は0以上の整数でなければなりません。");if(0!==t){for(var e=[],s=1;s<this.macroArgs.length;s+=2){var i,a=this._evaluateIntValue(s);if(a<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");if(s+1===this.macroArgs.length)throw new Error("画像のパーツ座標指定で、Y座標が指定されていません。");if((i=this._evaluateIntValue(s+1))<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");e.push(new c(a,i))}this._wwa.setEffect(t,e)}else this._wwa.stopEffect()}_executeGameOverMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||t>=this._wwa.getMapWidth()||e<0||e>=this._wwa.getMapWidth())throw new Error("マップの範囲外が指定されています!");this._wwa.setGameOverPosition(new c(t,e))}_executeImgClickMacro(){if(this._concatEmptyArgs(2),this.macroArgs.length<1)throw new Error("引数が少なすぎます");var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||e<0)throw new Error("引数が0以上の整数ではありません");this._wwa.setImgClick(new c(t,e))}_executeEffItemMacro(){if(this.macroArgs.length<1)throw new Error("引数が少なすぎます");var t=this._evaluateIntValue(0);this._wwa.updateItemEffectEnabled(!!t)}_executeStatusMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||4<t)throw new Error("ステータス種別が範囲外です。");return this._wwa.setPlayerStatus(t,e,!0)}_executeColorMacro(){this._concatEmptyArgs(4);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2),i=this._evaluateIntValue(3);if(t<0||t>5)throw new Error("種別は0から5までです");if(e<0||e>255||s<0||s>255||i<0||i>255)throw new Error("色が範囲外です");this._wwa.changeStyleRule(t,e,s,i)}_executeWaitMacro(){throw new Error("Not implemented!")}_executeSoundMacro(){this._concatEmptyArgs(2);const t=parseInt(this.macroArgs[0]),e=parseInt(this.macroArgs[1]);this._wwa.playSound(t,e)}_executeGamePadButtonMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||e<0)throw new Error("各引数は0以上の整数でなければなりません。");if(e>V.ITEMBOX_SIZE)throw new Error("アイテムボックス上限を超えた数値が指定されました。");this._wwa.setGamePadButtonItemTable(t,e)}_executeOldMoveMacro(){this._concatEmptyArgs(1);const t=!!this._evaluateIntValue(0);this._wwa.setOldMove(t)}_executeNoGameOverMacro(){this._concatEmptyArgs(1);const t=this._evaluateIntValue(0);this._wwa.setGameOverPolicy(t)}_executeSetMacro(){return this._wwa.execSetMacro(this.macroArgs[0],{triggerParts:{position:this._triggerPartsPosition,id:this._triggerPartsID,type:this._triggerPartsType}})}_executePictureMacro(){if(this._concatEmptyArgs(3),this.macroArgs.length<1)throw new Error("引数が少なすぎます");const t=this._evaluateIntValue(0),e=this.macroArgs[1].length>0?this.macroArgs[1]:"+0";if("0"===e)return void this._wwa.deletePictureRegistry(t);const s=((t,e)=>{if("+"===t[0]){const s=parseInt(t.substring(1,10));if(Number.isNaN(s))throw new Error("+ 以降の文字列は数値形式で記載してください。");return e+s}if("-"===t[0]){const s=parseInt(t.substring(1,10));if(Number.isNaN(s))throw new Error("- 以降の文字列は数値形式で記載してください。");return e-s}const s=parseInt(t,10);if(Number.isNaN(s))throw new Error("数値形式ではないため、解析できません。");return s})(e,this._triggerPartsID);if(0===s)throw new Error("パーツ番号の相対値算出で0が検出されました。ピクチャを消去する場合は0のまま指定してください。");if(s<0)throw new Error("パーツ番号は0以上の整数でなければなりません。");const i=this._evaluateIntValue(2,v.OBJECT);this._wwa.setPictureRegistry(t,s,i,this._triggerPartsPosition)}_executeDelayBgmMacro(){this._concatEmptyArgs(1);const t=this._evaluateIntValue(0);this._wwa.setBgmDelay(t)}_executeSysMsgMacro(){this._concatEmptyArgs(2);const t=this.resolveSystemMessageKeyFromMacroArg(this.macroArgs[0]);if(!t)throw new Error("該当するシステムメッセージの定義がありません");const e=""===this.macroArgs[1]?void 0:this.macroArgs[1].replaceAll("\\n","\n");this._wwa.overwriteSystemMessage(t,e)}resolveSystemMessageKeyFromMacroArg(t){if(r(t))return t;return n(this._evaluateIntValue(0))}}class ke{constructor(t,e,s,i,a,r,n){this._wwa=t,this._coord=e,this._width=s,this._height=i,this._isVisible=a,this._parentElement=r,this._element=document.createElement("div"),this._element.style.position="absolute",this._element.style.borderWidth="2px",this._element.style.borderStyle="solid",t.isClassicMode()?this._element.style.borderRadius="15px":this._element.style.borderRadius="10px",this._element.classList.add("wwa-message-window"),this._element.style.zIndex=n+"",this._element.style.left=this._coord.x+"px",this._element.style.top=this._coord.y+"px",this._element.style.width=this._width+"px",this._element.style.height=this._height+"px",this._parentElement.appendChild(this._element)}update(t){}show(){this._isVisible=!0,this._element.style.display="block",this.update(),this._wwa.wwaCustomEvent("wwa_window_show",{name:this.windowName,element:this._element,text:this._element.textContent})}hide(){this._isVisible=!1,this._element.style.display="none",this.update(),this._wwa.wwaCustomEvent("wwa_window_hide",{name:this.windowName})}isVisible(){return this._isVisible}get windowName(){return"TextWindow"}}class We extends ke{constructor(t,e,s,i,a,r,n){super(t,new c(e.x,e.y),s,i,a,r,201),this._cgFileName=n,this._monsterBox=document.createElement("div"),this._monsterBox.style.width=V.CHIP_SIZE+"px",this._monsterBox.style.height=V.CHIP_SIZE+"px",this._monsterBox.style.position="absolute",this._monsterBox.style.left="10px",this._monsterBox.style.top="10px",this._monsterBox.style.backgroundImage="url("+this._cgFileName.replace("(","\\(").replace(")","\\)")+")",this._monsterBox.style.backgroundPosition="0 0",this._element.appendChild(this._monsterBox),this._energyBox=document.createElement("div"),this._energyBox.style.position="absolute",this._energyBox.style.left="80px",this._energyBox.style.top="10px",this._energyBox.textContent="生命力 0",this._element.appendChild(this._energyBox),this._strengthBox=document.createElement("div"),this._strengthBox.style.position="absolute",this._strengthBox.style.left="80px",this._strengthBox.style.top="30px",this._strengthBox.textContent="攻撃力 0",this._element.appendChild(this._strengthBox),this._defenceBox=document.createElement("div"),this._defenceBox.style.position="absolute",this._defenceBox.style.left="180px",this._defenceBox.style.top="30px",this._defenceBox.textContent="防御力 0",this._element.appendChild(this._defenceBox),this._isVisible?this._element.style.display="block":this._element.style.display="none"}update(t){void 0!==t&&(this._monsterBox.style.backgroundPosition="-"+t.imgCoord.x+"px -"+t.imgCoord.y+"px",this._energyBox.textContent="生命力 "+t.status.energy,this._strengthBox.textContent="攻撃力 "+t.status.strength,this._defenceBox.textContent="防御力 "+t.status.defence)}get windowName(){return"MonsterWindow"}}class Ve extends ke{constructor(t,e,s,i){t.isClassicMode()?(super(t,new c(2*V.CHIP_SIZE,30),7*V.CHIP_SIZE,40,s,i,202),this._element.style.borderWidth="0",this._element.style.borderRadius="4px",this._element.style.fontSize="20px",this._element.style.lineHeight="40px"):super(t,new c(e.x,e.y),340,30,s,i,202),this._element.style.textAlign="center",this._isVisible?this._element.style.display="block":this._element.style.display="none",this.update(0)}update(t){void 0!==t&&(this._element.textContent="Score: "+t)}get windowName(){return"ScoreWindow"}}var Fe,Ye;Ve.WINDOW_NAME="ScoreWindow",function(t){t[t.TOP=0]="TOP",t[t.CENTER=1]="CENTER",t[t.BOTTOM=2]="BOTTOM",t[t.SCORE=3]="SCORE"}(Fe||(Fe={}));class Ge{constructor(t,e,s,i,a,r,n,o,h,c){this._wwaSave=void 0,this._save_select_id=0,this._save_counter=0,this._save_close=!1;var _=this,l=r.replace("(","\\(").replace(")","\\)");switch(this._wwa=t,this._cgFileName=r,this._x=e,this._y=s,this._width=i,this._height=a,this._message="",this._isVisible=n,this._isYesno=o,this._isItemMenu=h,this._element=document.createElement("div"),this._element.id="wwa-text-message-window",this._element.classList.add("wwa-message-window"),this._msgWrapperElement=document.createElement("div"),this._msgWrapperElement.style.textAlign="left",this._msgWrapperElement.style.wordWrap="break-word",this._msgWrapperElement.style.margin=t.isClassicMode()?"8px 0 8px 16px":"0",this._msgWrapperElement.style.padding=t.isClassicMode()?"0":"7px",this._element.appendChild(this._msgWrapperElement),this._saveElement=document.createElement("div"),this._saveElement.style.padding="0",this._saveElement.style.margin="0",this._element.appendChild(this._saveElement),this._dummyElement=document.createElement("div"),this._dummyElement.style.display="none",this._dummyElement.style.padding="0",this._dummyElement.style.margin="0",this._dummyElement.style.height="55px",this._element.appendChild(this._dummyElement),this._ynWrapperElement=document.createElement("div"),this._ynWrapperElement.classList.add("wwa-yesno-wrapper"),this._element.appendChild(this._ynWrapperElement),this._parentElement=c,this._parentElement.appendChild(this._element),this._divYesElement=document.createElement("div"),this._divYesElement.classList.add("wwa-yes-button"),this._divYesElement.style.background="url("+l+")",this._divYesElement.onclick=function(){_._isInputDisable||(t.setYesNoInput(g.YES),_.update())},this._divYesElement.style.cursor="pointer",this._divNoElement=document.createElement("div"),this._divNoElement.classList.add("wwa-no-button"),this._divNoElement.style.background="url("+l+")",this._divNoElement.onclick=function(){_._isInputDisable||(t.setYesNoInput(g.NO),_.update())},this._ynWrapperElement.appendChild(this._divYesElement),this._ynWrapperElement.appendChild(this._divNoElement),_._isInputDisable=!1,t.userDevice.device){case S.SP:case S.VR:this._parentElement.classList.add("useScaleUp")}this.update()}setPosition(t,e,s,i){this._x=t,this._y=e,this._width=s,this._height=i,this.update()}setPositionByPlayerPosition(t,e,s,i,a){var r,n=i.getPartsCoord().substract(a.getPartsCoord()).y;r=t?Fe.BOTTOM:e?Fe.SCORE:s?Fe.CENTER:n>=Math.ceil(V.V_PARTS_NUM_IN_WINDOW/2)?Fe.TOP:Fe.BOTTOM,this.setPositionEasy(r)}setPositionEasy(t){var e=Math.floor(this._element.clientHeight/2);return t===Fe.CENTER?(this._y=V.MAP_WINDOW_HEIGHT/2-e,void this.update()):t===Fe.TOP?(this._y=Math.max(20,V.MAP_WINDOW_HEIGHT/4-e)+10,void this.update()):t===Fe.BOTTOM?(this._y=Math.min(V.MAP_WINDOW_HEIGHT-20-this._element.clientHeight,3*V.MAP_WINDOW_HEIGHT/4-e),void this.update()):t===Fe.SCORE?(this._y=80,void this.update()):void 0}setMessage(t){this._message=t,this.update()}clear(){this._message="",this.update()}setYesNoChoice(t){return this._isInputDisable=!1,this._isYesno=t,this.update(),this._isYesno}isYesNoChoice(){return this._isYesno}isSaveChoice(){return this._isSave}setItemMenuChoice(t){return this._isInputDisable=!1,this._isItemMenu=t,this.update(),this._isItemMenu}isItemMenuChoice(){return this._isItemMenu}setInputDisable(){this._isInputDisable=!0}isInputDisable(){return this._isInputDisable}show(){this._isVisible=!0,this.update()}hide(){this._isVisible=!1,this.update()}isVisible(){return this._isVisible}isWideChar(t){return null!==t.match(/^[^\x01-\x7E\xA1-\xDF]+$/)}createClassicTextElement(t){var e=document.createElement("span");let s=0,i="";for(let r=0;r<t.length||0!=s;r++)if(this.isWideChar(t.charAt(r))?s+=2:s+=1,i+=t.charAt(r),s+1>2*V.MSG_STR_WIDTH){"。"!==t.charAt(r+1)&&"、"!==t.charAt(r+1)||(i+=t.charAt(r+1),r++);var a=document.createElement("span");a.style.display="inline-block",a.style.width="100%",a.textContent=i,e.appendChild(a),s=0,i=""}return e}update(){var t=this._wwa.getYesNoImgCoord();this._isYesno?(this._wwa.getYesNoState()===g.YES?(this._divYesElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_YESP_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_NO_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px"):this._wwa.getYesNoState()===g.NO?(this._divYesElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_YES_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_NOP_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px"):(this._divYesElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_YES_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_NO_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px"),this._ynWrapperElement.style.display="block"):this._ynWrapperElement.style.display="none",this._msgWrapperElement.textContent="";var e=this._message.split("\n");e.forEach(((t,s)=>{let i;this._wwa.isClassicMode()?i=this.createClassicTextElement(t):(i=document.createElement("span"),i.textContent=e[s]),this._msgWrapperElement.appendChild(i),this._msgWrapperElement.appendChild(document.createElement("br"))})),this._isVisible?(this._element.style.left=this._x+"px",this._element.style.top=this._y+"px"):(this._element.style.left="-999999px",this._element.style.top="-999999px"),this._isSave?this._saveElement.style.display="block":this._saveElement.style.display="none",this._element.style.width=this._width+"px",this._element.style.minHeight=this._height+"px"}setWWASave(t){this._wwaSave=t}createSaveDom(){var t,e,s,i,a,r,n,o,h,c,_;e=document.createElement("div"),c=(o=document.getElementById("disp-energy")).style.backgroundPosition,_=o.style.backgroundImage;for(var l=this._wwaSave.list.length,u=0;u<l;u++)t=this._wwaSave.list[u],(s=document.createElement("div")).classList.add("savedata"),s.setAttribute("save_id",u),s.addEventListener("click",(t=>{this.setSaveID(0|t.currentTarget.getAttribute("save_id")),this._save_close=!0,t.preventDefault()})),(i=document.createElement("div")).classList.add("ss"),s.appendChild(i),(a=document.createElement("div")).classList.add("wide-cell-row"),a.style.backgroundPosition=c,a.style.backgroundImage=_,s.appendChild(a),e.appendChild(s),t.flag&&(i.appendChild(t.cvs),(r=document.createElement("span")).textContent=t.getDateText(),t.isLastSaveData()&&(r.style.color=F.DATE_LAST_SAVE_TEXT_COLOR),i.appendChild(r),(n=document.createElement("div")).classList.add("status-icon"),n.style.backgroundImage=_,n.style.backgroundPosition="-120px -80px",a.appendChild(n),(h=document.createElement("div")).classList.add("status-value-box"),h.textContent=t.getStatusEnergy(),a.appendChild(h));this._saveElement.textContent="",this._saveElement.appendChild(e),this.setSaveID(this._save_select_id),this._isSave=!0,this._save_counter=0,this._save_close=!1}deleteSaveDom(){this._saveElement.textContent="",this._isSave=!1}setSaveID(t){this._save_select_id=t;for(var e,s=document.querySelectorAll(".savedata"),i=s.length,a=0;a<i;a++)e=s[a],t===a?e.classList.add("select"):e.classList.remove("select")}save(t,e){return this._wwaSave.save(t,e,this._save_select_id)}load(){return this._wwaSave.load(this._save_select_id)}saveUpdate(){this._save_counter>0&&this._save_counter--}isSaveClose(){return this._save_close}cursor_wait(){this._save_counter=V.CONTROLL_WAIT_FRAME}saveControll(t){if(!(this._save_counter>0||this._isInputDisable)){switch(t){case p.DOWN:this._save_select_id-=2,this.cursor_wait();break;case p.UP:this._save_select_id+=2,this.cursor_wait();break;case p.LEFT:this._save_select_id--,this.cursor_wait();break;case p.RIGHT:this._save_select_id++,this.cursor_wait()}this.setSaveID((this._save_select_id+F.QUICK_SAVE_MAX)%F.QUICK_SAVE_MAX)}}get windowName(){return"MessageWindow"}}class He{constructor(t,e,s){this.id=t,this.imgFileName=e,this.parent=s,this.elem=document.createElement("div"),this.elem.classList.add("est"),this.elem.setAttribute("id","wwa-est-"+t),this.imgElem=document.createElement("div"),this.imgElem.classList.add("est-img-wrapper"),this.imgElem.style.backgroundImage="url("+this.imgFileName.replace("(","\\(").replace(")","\\)")+")",this.statusElem=document.createElement("div"),this.statusElem.classList.add("est-status-wrapper"),this.energyElem=document.createElement("div"),this.energyElem.classList.add("est-energy"),this.energyDispElem=document.createElement("span"),this.energyDispElem.classList.add("est-energy-disp"),this.energyElem.appendChild(this.energyDispElem),this.statusElem.appendChild(this.energyElem),this.strengthElem=document.createElement("div"),this.strengthElem.classList.add("est-strength"),this.strengthDispElem=document.createElement("span"),this.strengthDispElem.classList.add("est-strength-disp"),this.strengthElem.appendChild(this.strengthDispElem),this.statusElem.appendChild(this.strengthElem),this.defenceElem=document.createElement("div"),this.defenceElem.classList.add("est-defence"),this.defenceDispElem=document.createElement("span"),this.defenceDispElem.classList.add("est-defence-disp"),this.defenceElem.appendChild(this.defenceDispElem),this.statusElem.appendChild(this.defenceElem),this.damageElem=document.createElement("div"),this.damageElem.classList.add("est-damage"),this.damageDispElem=document.createElement("span"),this.damageDispElem.classList.add("est-damage-disp"),this.damageElem.appendChild(this.damageDispElem),this.statusElem.appendChild(this.damageElem),this.elem.appendChild(this.imgElem),this.elem.appendChild(this.statusElem)}hide(){this.elem.style.display="none"}show(){this.elem.style.display="block"}setResult(t,e,s){this.imgElem.style.backgroundPosition="-"+t.x+"px -"+t.y+"px",this.energyDispElem.textContent="生命力 "+e.energy,this.strengthDispElem.textContent="攻撃力 "+e.strength,this.defenceDispElem.textContent="防御力 "+e.defence,s.cannotDamageMonster?this.damageDispElem.textContent="攻撃無効":s.noSettled?this.damageDispElem.textContent="勝負がつきません":s.isOverMaxTurn?this.damageDispElem.textContent="長期戦が予想されます":this.damageDispElem.textContent="予測ダメージ "+s.estimatedDamage}}class Ke{constructor(t,e,s){var i;this._wwa=t,this._imgFileName=e,this._parent=s,this._element=document.createElement("div"),this._element.setAttribute("id","wwa-battle-estimate"),this._element.style.display="none",this._edes=[];for(var a=0;a<V.BATTLE_ESTIMATE_MONSTER_TYPE_MAX;a++)i=new He(a,this._imgFileName,this._element),this._edes.push(i),this._element.appendChild(i.elem);this._element.addEventListener("click",(()=>{this._wwa.hideBattleEstimateWindow()})),this._parent.appendChild(this._element)}update(t,e,s,i,a){for(let r=0;r<V.BATTLE_ESTIMATE_MONSTER_TYPE_MAX;r++){if(r>=e.length){this._edes[r].hide();continue}const n=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_X),o=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_Y),_=new c(n,o),l=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_ENERGY),u=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_STRENGTH),d=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_DEFENCE),p=new h(l,u,d,0),m=je(t,e[r],s,i,a);this._edes[r].setResult(_,p,m),this._edes[r].show()}}show(){this._element.style.display="block"}hide(){this._element.style.display="none"}}function je(t,e,s,i,a){const r=e.clone(),n=t.clone();let o=0,h=0,c=0;const _=t.energy;if(a&&n.strength<=r.status.defence&&n.defence>=r.status.strength)return{cannotDamageMonster:!0,estimatedDamage:0};for(;;){h++;const t=s(n,r);if(r.status.energy-=t.damage,0===t.damage?c++:c=0,r.status.energy<=0)return{estimatedDamage:o};if(c>V.FIGHT_DRAW_TURN||t.aborted)return{noSettled:(_<=0||n.energy>0)&&r.status.energy>0,estimatedDamage:o};if(h>2e4)return{isOverMaxTurn:!0,estimatedDamage:0};h++;const e=i(r,n),a=Math.max(e.damage,0);if(0===a?c++:c=0,o+=a,n.energy=Math.max(n.energy-a,0),c>V.FIGHT_DRAW_TURN||e.aborted)return{noSettled:(_<=0||n.energy>0)&&r.status.energy>0,estimatedDamage:o};if(h>2e4)return{isOverMaxTurn:!0,estimatedDamage:0}}}!function(t){t[t.SAVE=0]="SAVE",t[t.LOAD=1]="LOAD"}(Ye||(Ye={}));class Xe{constructor(t,e,s){this._wwa=t,this._parent=e,this._isDisallowLoadOldSave=s,this.COPIED_MESSAGE_DISPLAY_MS=1e3,this._element=document.createElement("div"),this._element.setAttribute("id","wwa-password-window"),this._element.style.display="none",this._descriptionElement=document.createElement("div"),this._descriptionElement.classList.add("wwa-password-description"),this._passwordBoxElement=document.createElement("textarea"),this._passwordBoxElement.setAttribute("cols","50"),this._passwordBoxElement.setAttribute("rows","16"),this._passwordBoxElement.addEventListener("focus",(t=>{this._passwordBoxElement.select()})),this._buttonWrapperElement=document.createElement("div"),this._buttonWrapperElement.classList.add("wwa-password-submit"),this._okButtonElement=document.createElement("button"),this._okButtonElement.textContent="OK",this._okButtonElement.addEventListener("click",(()=>{this._wwa.hidePasswordWindow()})),this._cancelButtonElement=document.createElement("button"),this._cancelButtonElement.textContent="キャンセル",this._cancelButtonElement.addEventListener("click",(()=>{this._wwa.hidePasswordWindow(!0)})),this._copyButtonElement=document.createElement("button"),this._copyButtonElement.textContent="コピー",this._copyButtonElement.addEventListener("click",(async()=>{await navigator.clipboard.writeText(this.password),this._copyButtonElement.textContent="コピーしました",this._copyButtonElement.disabled=!0,setTimeout((()=>{this._copyButtonElement&&(this._copyButtonElement.textContent="コピー",this._copyButtonElement.disabled=!1)}),this.COPIED_MESSAGE_DISPLAY_MS)})),this._buttonWrapperElement.appendChild(this._okButtonElement),this._buttonWrapperElement.appendChild(this._cancelButtonElement),this._buttonWrapperElement.appendChild(this._copyButtonElement),this._mode=Ye.LOAD,this._element.appendChild(this._descriptionElement),this._element.appendChild(this._passwordBoxElement),this._element.appendChild(this._buttonWrapperElement),this._parent.appendChild(this._element),this.update()}get mode(){return this._mode}set mode(t){this._mode=t,t===Ye.LOAD&&(this.password="")}get password(){return this._passwordBoxElement.value}set password(t){this._passwordBoxElement.value=t}show(t){void 0!==t&&(this.mode=t),this._isVisible=!0,this.update()}hide(){this._isVisible=!1,this.update()}update(){var t="";if(this._mode===Ye.LOAD){t=`下のボックスに前回のプレイで取得した\n復帰用パスワードを貼り付けてください。\nJava 版 WWA で取得したパスワードはご利用になれません。\n作成者が ${this._isDisallowLoadOldSave?"マップの内容":"ワールド名 か マップの暗証番号"} を変更した場合は\nそれ以前に取得したパスワードは使えなくなります。`;try{this._passwordBoxElement.removeAttribute("readonly")}catch(t){}this._cancelButtonElement.style.display="inline",this._copyButtonElement.style.display="none"}else t="下記テキストがデータ復帰用のパスワードになっています。\nコピーしてメモ帳などのテキストエディタに貼り付けて\n保存してください。",this._passwordBoxElement.setAttribute("readonly","readonly"),this._cancelButtonElement.style.display="none",this._copyButtonElement.style.display="inline";var e=t.split("\n");this._descriptionElement.textContent="";for(var s=0;s<e.length;s++){var i=document.createElement("span");i.textContent=e[s],this._descriptionElement.appendChild(i),this._descriptionElement.appendChild(document.createElement("br"))}this._isVisible?this._element.style.display="block":this._element.style.display="none"}}function Je(){return"ontouchstart"in window&&"ontouchend"in window&&"ontouchmove"in window}function $e(t,e,s){var i=document.createElement("style");i.type="text/css",i.setAttribute("id",V.WWA_STYLE_TAG_ID),pt("head")[0].appendChild(i),t.innerHTML=function(t,e){return`\n <canvas id="wwa-map" class="wwa-canvas" width="440" height="440">\n このブラウザは、Canvas要素をサポートしていません。\n </canvas>\n <canvas id="wwa-map-sub" class="wwa-canvas" width="440" height="440"></canvas>\n <div id="wwa-sidebar">\n <div class="wide-cell-row" id="disp-energy"><div class="status-icon"></div><div class="status-value-box">0</div></div>\n <div class="wide-cell-row" id="disp-strength"><div class="status-icon"></div><div class="status-value-box"> 0 </div></div>\n <div class="wide-cell-row" id="disp-defence"><div class="status-icon"></div><div class="status-value-box">0</div></div>\n <div class="wide-cell-row" id="disp-gold"><div class="status-icon"></div><div class="status-value-box">0</div></div>\n <div class="item-cell" id="item0"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item1"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item2"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item3"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item4"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item5"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item6"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item7"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item8"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item9"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item10"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item11"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="wide-cell-row" id="cell-load">Password</div><div class="wide-button" id="button-load"></div>\n <div class="wide-cell-row" id="cell-save">Quick Save</div><div class="wide-button" id="button-save"></div>\n <div class="wide-cell-row" id="cell-restart">Restart Game</div><div class="wide-button" id="button-restart"></div>\n <div class="wide-cell-row" id="cell-gotowwa">Goto WWA</div><div class="wide-button" id="button-gotowwa"></div>\n </div>\n <div id="wwa-controller"></div>\n <div id="wwa-fader"></div>\n${t?'\n <div id="wwa-cover">\n <div id="unstable-version-warning"></div>\n <div id="version"></div>\n <div id="progress-message-container">開始しています...</div>\n <div id="progress-bar-bg"></div>\n <div id="progress-bar" class="progress-bar"></div>\n <div id="progress-bar-audio" class="progress-bar"></div>\n <div id="progress-disp">---</div>\n </div>\n ':`\n <div id="wwa-cover">\n <canvas id="progress-panel" width="${V.SCREEN_WIDTH}" height="${V.SCREEN_HEIGHT}"></canvas>\n </div>`}\n${e?'\n <div id="wwa-virtualpad-left">\n <button class="wwa-virtualpad__button" id="wwa-up-button"></button>\n <button class="wwa-virtualpad__button" id="wwa-left-button"></button>\n <button class="wwa-virtualpad__button" id="wwa-right-button"></button>\n <button class="wwa-virtualpad__button" id="wwa-down-button"></button>\n <div class="wwa-virtualpad__hole"></div>\n </div>\n <div id="wwa-virtualpad-right">\n <button class="wwa-virtualpad__button" id="wwa-slow-button">I</button>\n <button class="wwa-virtualpad__button" id="wwa-fast-button">P</button>\n <button class="wwa-virtualpad__button" id="wwa-enter-button">Y</button>\n <button class="wwa-virtualpad__button" id="wwa-esc-button">N</button>\n </div>':""}\n`}(null!==e,s),null!==e&&(dt("wwa-cover").style.backgroundImage=`url(${e})`,dt("wwa-cover").style.backgroundRepeat="no-repeat",dt("wwa-cover").style.backgroundPosition="0 0")}class Ze{update(){this.counter>0&&this.counter--}cursor_wait(){this.counter=V.CONTROLL_WAIT_FRAME}allClear(){this.col=0,this.row=0,this.counter=0}controll(t){if(!(this.counter>0))switch(t){case p.DOWN:this.row<Ze.ROW_MAX-1&&(this.row++,this.openView(),this.cursor_wait());break;case p.UP:this.row>0&&(this.row--,this.openView(),this.cursor_wait());break;case p.LEFT:this.col>0&&(this.col--,this.openView(),this.cursor_wait());break;case p.RIGHT:this.col<Ze.COL_MAX-1&&(this.col++,this.openView(),this.cursor_wait())}}ok(){this.close();var t=null;(t=Et(Ze.CLICK_DOM_QUERY_TABLE[this.row][this.col])).classList.contains("item-click-border")||this.allClear();var e=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});return t.dispatchEvent(e)}ng(){this.close()}close(){var t,e,s=null;for(t=0;t<Ze.COL_MAX;t++)for(e=0;e<Ze.ROW_MAX;e++)(s=dt(Ze.DOM_ID_TABLE[e][t])).classList.contains("onpress")&&s.classList.remove("onpress")}openView(){this.close();dt(Ze.DOM_ID_TABLE[this.row][this.col]).classList.add("onpress")}init(){this.allClear(),this.openView()}constructor(){this.allClear()}}Ze.ROW_MAX=8,Ze.COL_MAX=3,Ze.DOM_ID_TABLE=[["item0","item1","item2"],["item3","item4","item5"],["item6","item7","item8"],["item9","item10","item11"],["cell-load","cell-load","cell-load"],["cell-save","cell-save","cell-save"],["cell-restart","cell-restart","cell-restart"],["cell-gotowwa","cell-gotowwa","cell-gotowwa"]],Ze.CLICK_DOM_QUERY_TABLE=[["#item0 .item-click-border","#item1 .item-click-border","#item2 .item-click-border"],["#item3 .item-click-border","#item4 .item-click-border","#item5 .item-click-border"],["#item6 .item-click-border","#item7 .item-click-border","#item8 .item-click-border"],["#item9 .item-click-border","#item10 .item-click-border","#item11 .item-click-border"],["#button-load","#button-load","#button-load"],["#button-save","#button-save","#button-save"],["#button-restart","#button-restart","#button-restart"],["#button-gotowwa"," #button-gotowwa","#button-gotowwa"]];var qe=s(23);function ze(t){return`^ /${231*t+8310}P+>A[]`}function Qe(t){return(0,qe.MD5)(t).toString()}const ts=Object.freeze({MAP:"map",MAP_OBJECT:"mapObject",SYSTEM_MESSAGE:"systemMessage",USER_VAR:"userVar"}),es=Object.freeze({mapAttribute:!0,objectAttribute:!0,message:!0});class ss{static compress(t){var e,s,i={};for(e in t)if(!es[e]){switch(typeof(s=t[e])){case"number":case"string":case"boolean":if(this._restartData[e]===s&&"worldName"!==e)continue;break;case"object":if(null===s){if(this._restartData[e]===s)continue}else if(void 0===(s=this.compressObject(e,s,this._restartData[e])))continue;break;case"undefined":break;case"function":continue}i[e]=s}return i}static compressObject(t,e,s){var i,a,r,n;switch(t){case ts.MAP:case ts.MAP_OBJECT:var o,h,c,_,l,u,d,p,m,E,g,w,f,v;for(l in i={},m={},p={},e)for(_ in a=e[l],r=s[l],n={},h=-1,a)(d=a[_])!==r[_]&&(n[_]=d,void 0===m[d]&&(m[d]={}),void 0===(g=m[d])[l]&&(g[l]=[]),(f=g[l]).push(Number(_)));for(w in m)for(l in g=m[w],void 0===p[w]&&(p[w]={}),E=p[w],void 0===i[w]&&(i[w]=[]),h=-1,g)1===(f=g[l]).length?(void 0===E[u=f[0]]&&(E[u]=[]),(v=E[u]).push(Number(l))):(c=(o=Number(l))-h-1,h=o,i[w].push(this.getCompressArray(f),c));for(w in p)for(_ in d=Number(w),h=-1,E=p[w])v=E[_],c=(o=Number(_))-h-1,h=o,1===v.length?i[w].push(c,v[0]):i[w].push(c,this.getCompressArray(v));var y=[];for(w in h=-1,i)c=(o=Number(w))-h-1,h=o,y.push(c,i[w]);return this._usingByteFlag&&JSON.stringify(y).length>=this._mapByteLength?this.compressMapAllObject(e,s,this._firstRandomMapObjectUtf8Table[t]):y;case ts.SYSTEM_MESSAGE:var S;for(t in i={},e)S=e[t],s[t]!==S&&(i[t]=S);break;case ts.USER_VAR:return this.compressUserVars(e);default:return e}if(0!==Object.keys(i).length)return i}static compressUserVars(t){return t.map(((t,e)=>[e,t])).filter((([t,e])=>0!==e))}static compressMapAllObject(t,e,s){var i,a,r,n,o,h,c,_,l,u,d,p,m,E,g,w,f=this._restartData.mapWidth,v=new Uint8Array(this._mapByteLength),y=-1;for(r=0,n=0,h=0,c=0,g=0,d=[],E={},l=[],u=[],a=0;a<f;a++)for(i=0;i<f;i++)(_=t[a][i])!==e[a][i]&&(-1===y&&(y=n),v[n]=v[n]|1<<r,h=n,void 0===E[_]&&(E[_]=new as(_,g++)),E[_].count++),8===++r&&(r=0,n++);for(o in E)d[E[o].index]=E[o];for(p in d.sort(this.idSort),m={},d)m[_=d[p].id]=Number(p),l[p]=_;for(a=0;a<f;a++)for(i=0;i<f;i++)(_=t[a][i])!==e[a][i]&&(u[c++]=m[_]);if(s){for(w=v.length,y=-1,h=0,n=0;n<w;n++)v[n]=v[n]&~s[n],0!==v[n]&&(-1===y&&(y=n),h=n);-1===y&&(y=0,h=0)}return[y,v.subarray(y,h+1),l,this.indexListCompress(u,l.length)]}static indexListCompress(t,e){var s,i,a,r,n,o,h=[];for(r=t.length,i=0,s=0;s<r;s++){for(n=t[s],o=0,a=s+1;a<r&&n===t[a];a++)o++,s=a;switch(o){case 0:h[i++]=n;break;case 1:h[i++]=n,h[i++]=n;break;default:h[i++]=n,h[i++]=e+o}}return h}static idSort(t,e){return e.count-t.count}static getCompressArray(t){var e,s,i,a,r,n,o,h,c=[];for(e=-1,r=t.length,n=0,a=0;a<r;a++){for(s=(i=t[a])-e,o=0,h=a;h<r-1&&t[h]+1===t[h+1];)h++,o++;o<this.MIN_LOOP_COUNT?c[n++]=s:(a=h,i+=o,c[n++]=0,c[n++]=s,c[n++]=o-this.MIN_LOOP_COUNT),e=i}return c}static getDecompressArray(t){var e,s,i,a,r,n,o,h=[];for(e=-1,r=t.length,a=0,o=0;a<r;a++)if(0===(s=t[a])){for(n=(i=e+(s=t[++a]))+t[++a]+this.MIN_LOOP_COUNT;i<=n;i++)h[o++]=i;e=n}else i=e+s,h[o++]=i,e=i;return h}static decompress(t){var e,s,i;for(s in e=JSON.parse(JSON.stringify(this._restartData)),t){switch(typeof(i=t[s])){case"number":case"string":case"boolean":case"undefined":break;case"object":null!==i&&(i=this.decompressObject(s,i,e[s]));break;case"function":continue}e[s]=i}return[e,{isWorldNameEmpty:void 0===t.worldName}]}static decompressObject(t,e,s){var i;switch(t){case ts.MAP:case ts.MAP_OBJECT:var a,r,n,o,h,c,_,l;i={},r=-1;var u,d,p=e;if(4===(l=p.length)&&"number"==typeof p[0]&&(p[1]instanceof Uint8Array||p[1]instanceof Array)&&p[2]instanceof Array&&p[3]instanceof Array)return this.decompressAllMapObject(p,s,this._firstRandomMapObjectUtf8Table[t]),s;for(_=0;_<l;_+=2)r=a=r+Number(p[_])+1,h=a,i[a]=p[_+1];for(c in i){for(h=Number(c),l=(p=i[c]).length,u=[],d=[],_=0;_<l;_+=2){var m=p[_],E=p[_+1];m instanceof Array&&(m=this.getDecompressArray(m)),E instanceof Array&&(E=this.getDecompressArray(E)),"object"==typeof m?u.push({x:m,y:E}):d.push({x:m,y:E})}var g;for(g in r=-1,u)if(r=a=r+Number(u[g].y)+1,m=u[g].x,o=String(a),m instanceof Array)for(l=(p=m).length,_=0;_<l;_++)n=String(p[_]),s[o][n]=h;else n=String(m),s[o][n]=h;for(g in r=-1,d)if(r=a=r+Number(d[g].x)+1,E=d[g].y,n=String(a),E instanceof Array)for(l=(p=E).length,_=0;_<l;_++)s[o=String(p[_])][n]=h;else s[o=String(E)][n]=h}return s;case ts.USER_VAR:return this.decompressUserVars(e);case ts.SYSTEM_MESSAGE:default:if(s);else{if(!e)return;s=s instanceof Array?[]:{}}for(t in e)s[t]=e[t];return s}}static decompressUserVars(t){return t.reduce(((t,[e,s])=>(t[e]=s,t)),this.generateEmptyUserVars())}static generateEmptyUserVars(){const t=new Array(V.USER_VAR_NUM);for(let e=0;e<V.USER_VAR_NUM;e++)t[e]=0;return t}static decompressAllMapObject(t,e,s){var i,a,r,n,o,h,c,_,l,u,d,p=this._restartData.mapWidth,m=new Uint8Array(this._mapByteLength);d=t[0],n=t[2],a=t[3];var E=t[1];if(m.set(E,d),s)for(g=m.length,l=0;l<g;l++)m[l]=m[l]|s[l];r=[];var g,w,f,v,y,S,A=n.length;for(g=a.length,w=0,f=0;w<g;w++){if((o=a[w])>=A)for(v=o-A,y=0;y<v;y++)r[f++]=S;else r[f++]=o;S=o}for(_=0,l=0,u=0,h=0,g=m.length,l=0;l<g;l++)for(_=0;_<8;_++){if(0!=(m[l]&1<<_)){if(void 0===(o=r[h++]))return!1;i=n[o],c=u%p,e[u/p|0][c]=i}u++}return!0}static setRestartData(t,e){this._restartData=t,this._mapByteLength=Math.ceil(t.mapWidth*t.mapWidth/8),this._firstRandomMapObjectUtf8Table[ts.MAP_OBJECT]=this.getChangedUint8Array(e[ts.MAP_OBJECT],t[ts.MAP_OBJECT])}static getChangedUint8Array(t,e){var s,i,a,r,n=this._restartData.mapWidth,o=new Uint8Array(this._mapByteLength),h=-1;for(a=0,r=0,i=0;i<n;i++)for(s=0;s<n;s++)t[i][s]!==e[i][s]&&(-1===h&&(h=r),o[r]=o[r]|1<<a),8===++a&&(a=0,r++);return o}static getStartWWAData(t){if(!t)return this._restartData;try{var e=JSON.parse(t)}catch(t){return this._restartData}var s;if(e)try{if([s]=this.decompress(e),s)return s}catch(t){}return this._restartData}static usingByte(t){this._usingByteFlag=t}}ss._usingByteFlag=!1,ss.MIN_LOOP_COUNT=3,ss._restartData=void 0,ss._mapByteLength=0,ss._firstRandomMapObjectUtf8Table=new class{};var is=ss;class as{constructor(t,e){this.id=0,this.index=0,this.count=0,this.id=t,this.index=e}}class rs{constructor(t,e){this._id=0,this.flag=!1,this.date=void 0,this.cvs=void 0,this.ctx=void 0,this.quickSaveData=void 0,this._id=t,this._parent=e,this.cvs=document.createElement("canvas"),this.cvs.width=F.QUICK_SAVE_THUMNAIL_WIDTH,this.cvs.height=F.QUICK_SAVE_THUMNAIL_HEIGHT,this.ctx=this.cvs.getContext("2d",{alpha:!1})}showQickLoad(){dt("cell-load").textContent=Y.QUICK_LOAD}save(t,e){return this._statusEnergy=e.statusEnergy,this.ctx.clearRect(0,0,this.cvs.width,this.cvs.height),this.ctx.drawImage(t,0,0,t.width,t.height,0,0,this.cvs.width,this.cvs.height),this.quickSaveData=e,this.flag=!0,this.date=new Date,this.showQickLoad(),!0}getStatusEnergy(){return this.flag?this._statusEnergy:-1}load(){return this.quickSaveData}saveDataSet(t,e,s){try{this.quickSaveData=e,this._statusEnergy=e.statusEnergy,this.date=s,this.flag=!0;var i=document.createElement("img");i.src=t,i.addEventListener("load",(()=>{this.flag=!0,this.ctx.drawImage(i,0,0,i.width,i.height,0,0,this.cvs.width,this.cvs.height)})),this.showQickLoad()}catch(t){}}getDateText(){let t,e,s,i,a,r;return this.date?(t=this.date.getFullYear(),e=this.date.getMonth()+1,s=this.date.getDate(),i=this.date.getHours(),a=this.date.getMinutes(),r=this.date.getSeconds(),t=("000"+t).slice(-4),e=("0"+e).slice(-2),s=("0"+s).slice(-2),i=("0"+i).slice(-2),a=("0"+a).slice(-2),r=("0"+r).slice(-2),t+"/"+e+"/"+s+" "+i+":"+a+":"+r):""}isLastSaveData(){return this===this._parent.getLastSaveData()}}class ns extends rs{save(t,e){var s=super.save.apply(this,arguments);return this._parent.dbUpdateSaveData(this._id,t,e,this.date),s}}class os extends Array{constructor(){super(),Object.setPrototypeOf(this,Object.create(os.prototype))}hasSaveData(){for(var t=0;t<F.QUICK_SAVE_MAX;t++)if(this[t].flag)return!0;return!1}getLastSaveData(){for(var t,e,s=0;s<F.QUICK_SAVE_MAX;s++)(e=this[s]).flag&&(t?e.date&&t.date&&e.date.getTime()>t.date.getTime()&&(t=e):t=e);return t}}const hs=t=>{return"boolean"!=typeof(e=t).isGameOverDisabled?e:!0===e.isGameOverDisabled?{...e,isGameOverDisabled:void 0,gameOverPolicy:"never"}:!1===e.isGameOverDisabled?{...e,isGameOverDisabled:void 0,gameOverPolicy:"default"}:e;var e};class cs extends os{constructor(t,e,s=cs.prototype){super(),this.IDBTransaction={READ_ONLY:"readonly",READ_WRITE:"readwrite",VERSION_CHANGE:"versionchangetransaction"},this.keyPath=["id","url"],Object.setPrototypeOf(this,Object.create(s));for(var i=0;i<F.QUICK_SAVE_MAX;i++)this[i]=new ns(i,this);this.onCheckLoadingSaveData=t,this.onCompleteLoadingSaveData=e,this.createDataBase(),this.selectSaveData()}indexDBOpen(){return indexedDB.open(F.INDEXEDDB_DB_NAME,201205201)}createDataBase(){try{var t=this.indexDBOpen();t.onupgradeneeded=e=>{var s=t.result,i={keyPath:this.keyPath};s.objectStoreNames.contains(F.INDEXEDDB_TABLE_NAME)||s.createObjectStore(F.INDEXEDDB_TABLE_NAME,i).createIndex("url","url",{unique:!1})},t.onsuccess=cs.doNotAnything,t.onerror=cs.doNotAnything,t.onblocked=cs.doNotAnything}catch(t){}}getObjectStore(t){const e=t;try{var s=e.transaction(F.INDEXEDDB_TABLE_NAME,this.IDBTransaction.READ_WRITE).objectStore(F.INDEXEDDB_TABLE_NAME)}catch(t){return}return s}makeSaveDataItem(t,e,s,i){return{url:location.href,id:t,hash:ms.checkOriginalMapString,image:e.toDataURL(),data:s,date:i,worldName:ms.worldName,mapDataRevisionKey:ms.mapDataRevisionKey}}getSaveDataResult(t,e){const s=t.index("url"),i=IDBKeyRange.only(location.href),a=s.getAll(i);a.onsuccess=()=>{e(a.result)}}dbUpdateSaveData(t,e,s,i){const a=this.indexDBOpen();a.onupgradeneeded=cs.doNotAnything,a.onsuccess=()=>{const r=this.getObjectStore(a.result),n=is.compress(s),o=this.makeSaveDataItem(t,e,n,i);this.selectDatas[t]=o;const h=r.put(o);h.onsuccess=cs.doNotAnything,h.onerror=cs.doNotAnything},a.onerror=cs.doNotAnything,a.onblocked=cs.doNotAnything}dbDeleteSaveData(t){const e=this.indexDBOpen();e.onupgradeneeded=cs.doNotAnything,e.onsuccess=()=>{const s=this.getObjectStore(e.result);t.forEach((t=>{s.delete([t,location.href])}))},e.onerror=cs.doNotAnything,e.onblocked=cs.doNotAnything}selectSaveData(){const t=this.indexDBOpen();t.onupgradeneeded=cs.doNotAnything,t.onsuccess=()=>{const e=this.getObjectStore(t.result);this.selectDatas=[];this.getSaveDataResult(e,(t=>{var e,s,i;let a=[];for(s=t.length,e=0;e<s;e++){var r=t[e];try{i={id:r.id,hash:r.hash,data:r.data,date:r.date,image:r.image,worldName:r.worldName,mapDataRevisionKey:r.mapDataRevisionKey}}catch(t){continue}const s=this.onCheckLoadingSaveData(i.worldName,i.hash,i.mapDataRevisionKey);if(null!==s){a.push({id:i.id,cause:s});continue}if(!this[i.id])continue;const n=hs(is.decompress(i.data)[0]);this[i.id].saveDataSet(i.image,n,i.date)}a.length>0&&this.dbDeleteSaveData(a.map((t=>t.id)));const n=a.map((t=>t.cause)).filter(((t,e,s)=>s.indexOf(t)===e));this.onCompleteLoadingSaveData(n)}))},t.onerror=cs.doNotAnything,t.onblocked=cs.doNotAnything}}cs.doNotAnything=()=>{};var _s,ls=cs;class us extends rs{}class ds extends os{constructor(){super(),this._saveNo=0,this._lastAutoSaveMove=0,this._autoInterval=F.SAVE_INTERVAL_MOVE,Object.setPrototypeOf(this,Object.create(ds.prototype));for(var t=0;t<F.QUICK_SAVE_MAX;t++)this[t]=new us(t,this);this._saveNo=0,this._lastAutoSaveMove=0}resumeStart(){this._lastAutoSaveMove=-1}setPlayer(t){this._lastAutoSaveMove=t.getMoveCount()}isAutoSaveFrame(t){if(0===this._autoInterval)return!1;var e=t.getMoveCount();return!(this._lastAutoSaveMove>=e)&&(e%this._autoInterval==0&&(this._lastAutoSaveMove=e,!0))}autoSave(t,e){this[this._saveNo].save(t,e),this._saveNo++,this._saveNo=this._saveNo%F.QUICK_SAVE_MAX}setAutoSaveInterval(t){t<0?console.warn(`オートセーブの歩数 (${t}) に負の値が設定されています。`):this._autoInterval=0|t}}function ps(t,e){return(0,qe.MD5)(t+e).toString()}class ms{constructor(t,e,s,i,a){ms.checkOriginalMapString=t.checkOriginalMapString,ms.worldName=e,ms.mapDataRevisionKey=ps(e,s),this._wwaDBSaveList=new ls(i,a),this._wwaLogSaveList=new ds,this.selectDBSaveDataList()}resumeStart(){this._wwaLogSaveList.resumeStart()}isAutoSaveFrame(t){return this._wwaLogSaveList.isAutoSaveFrame(t)}autoSave(t,e){this._wwaLogSaveList.autoSave(t,e)}selectDBSaveDataList(){this.list=this._wwaDBSaveList}selectLogSaveDataList(){this.list=this._wwaLogSaveList}save(t,e,s){var i=this.list[s];return!!i&&i.save(t,e)}load(t){var e=this.list[t];return e?e.load():null}hasSaveData(){return this.list.hasSaveData()}setAutoSaveInterval(t){return this._wwaLogSaveList.setAutoSaveInterval(t)}getFirstSaveChoiceCallInfo(t){return t?T.CALL_BY_PASSWORD_LOAD:this._wwaDBSaveList.hasSaveData()?T.CALL_BY_QUICK_LOAD:this._wwaLogSaveList.hasSaveData()?T.CALL_BY_LOG_QUICK_LOAD:T.CALL_BY_PASSWORD_LOAD}getSecondSaveChoiceCallInfo(t){return this.list===this._wwaDBSaveList&&this._wwaLogSaveList.hasSaveData()?T.CALL_BY_LOG_QUICK_LOAD:t?T.CALL_BY_PASSWORD_LOAD:T.NONE}gameStart(t,e){this._wwaLogSaveList.setPlayer(e),this.quickSaveButtonUpdate(t)}quickSaveButtonUpdate(t){t.disableSaveFlag?dt("cell-save").textContent=Y.EMPTY_SAVE:dt("cell-save").textContent=Y.QUICK_SAVE}}!function(t){t.UNMATCHED_WORLD_NAME="UNMATCHED_WORLD_NAME",t.UNMATCHED_WORLD_PASS_NUMBER="UNMATCHED_WORLD_PASS_NUMBER",t.DISALLOW_OLD_REVISION_WORLD_SAVE_DATA="DISALLOW_OLD_REVISION_WORLD_SAVE_DATA"}(_s||(_s={}));class Es{constructor(t,e,s,i){this.id=t,this.fileName=e,this.audioContext=s,this.audioGain=i,this.disposeBufferSource=t=>{try{t.stop(),t.disconnect(this.audioGain),t.buffer=null}catch(t){}t.onended=null},this.audioContext=s,this.audioGain=i,this.audioBuffer=null,this.bufferSources=[],this.isLoaded=!1,this.delayBgmTimeoutId=null,this.load()}async fetchSoundFile(){try{return await fetch(this.fileName)}catch(t){return void console.warn(`サウンド ${this.id} 番の音声ファイルの取得失敗 (fetch)`)}}async getArrayBuffer(t){try{return await t.arrayBuffer()}catch(t){return void console.warn(`サウンド ${this.id} 番の音声ファイルの取得失敗 (arrayBuffer)`)}}async load(t=0){if(t>=10)return console.log(`サウンド ${this.id} 番の音声ファイルの取得失敗 (最大リトライ回数超過)`),void(this.isExceededMaxRetryCount=!0);const e=await this.fetchSoundFile();if(!e)return void this.retry(t);if(0!==e.status&&200!==e.status)return console.warn(`サウンド ${this.id} 番の音声ファイルが見つかりません! HTTPエラー番号: ${e.status}`),void this.cancelLoad();const s=await this.getArrayBuffer(e);s?this.audioContext.decodeAudioData(s,(e=>{if(0===e.length)return console.log(`サウンド ${this.id} 番の音声ファイルのバッファサイズが 0 です `),void this.retry(t);this.setData(e)})):this.retry(t)}retry(t){window.setTimeout((async()=>{await this.load(t+1)}),100)}setData(t){this.audioBuffer=t,this.isLoaded=!0}cancelLoad(){this.audioBuffer=null,this.isLoaded=!0}play(t=0){const e=this.audioContext.createBufferSource();this.bufferSources.push(e),e.buffer=this.audioBuffer,this.isBgm()&&(e.loop=!0),e.connect(this.audioGain);let s=e.duration;(!isFinite(s)||s<0||"number"!=typeof s)&&(s=0),e.onended=()=>{const t=this.bufferSources.indexOf(e);-1!==t&&this.bufferSources.splice(t,1),this.disposeBufferSource(e)},this.delayBgmTimeoutId=window.setTimeout((()=>{this.delayBgmTimeoutId=null,e.start()}),t),this.audioGain.connect(this.audioContext.destination)}pause(){null!==this.delayBgmTimeoutId&&(window.clearTimeout(this.delayBgmTimeoutId),this.delayBgmTimeoutId=null),this.bufferSources.forEach(this.disposeBufferSource),this.bufferSources.length=0}isBgm(){return this.id>=R.BGM_LB}hasData(){return null!==this.audioBuffer}isPlaying(){return this.hasData()||null!==this.delayBgmTimeoutId}isLoading(){return!this.isLoaded}isError(){return this.isExceededMaxRetryCount||this.isLoaded&&null===this.audioBuffer}}const gs=(t,e)=>{const s=new Array(t);for(let t=0;t<s.length;t++)s[t]=new Array(e);return s},ws=t=>(t%=256)>=128?t-256:t;var fs;function vs(t,e){const s=function(t){return t[fs.CHECK]+256*t[fs.CHECK+1]}(t),i=function(t,e){let s=0;if(t[fs.VERSION]>=29){for(let i=2;i<e;i++)s+=ws(t[i])*(i%8+1);s=s%65536&65535}return s}(t,e);if(s!==i)throw new Error("マップデータが壊れているようです。\n チェックサムの値は"+s+"ですが、実際の和は"+i+"でした。")}!function(t){t[t.CHECK=0]="CHECK",t[t.VERSION=2]="VERSION",t[t.OLD_MAP_COUNT=3]="OLD_MAP_COUNT",t[t.OLD_OBJ_COUNT=4]="OLD_OBJ_COUNT",t[t.OLD_PLAYER_X=5]="OLD_PLAYER_X",t[t.OLD_PLAYER_Y=6]="OLD_PLAYER_Y",t[t.STATUS_ENERGY=10]="STATUS_ENERGY",t[t.STATUS_STRENGTH=12]="STATUS_STRENGTH",t[t.STATUS_DEFENCE=14]="STATUS_DEFENCE",t[t.STATUS_GOLD=16]="STATUS_GOLD",t[t.OLD_GAMEOVER_X=18]="OLD_GAMEOVER_X",t[t.OLD_GAMEOVER_Y=19]="OLD_GAMEOVER_Y",t[t.OLD_ITEMBOX_TOP=20]="OLD_ITEMBOX_TOP",t[t.STATUS_ENERGY_MAX=32]="STATUS_ENERGY_MAX",t[t.MAP_COUNT=34]="MAP_COUNT",t[t.OBJ_COUNT=36]="OBJ_COUNT",t[t.PLAYER_X=38]="PLAYER_X",t[t.PLAYER_Y=40]="PLAYER_Y",t[t.GAMEOVER_X=42]="GAMEOVER_X",t[t.GAMEOVER_Y=44]="GAMEOVER_Y",t[t.MAP_SIZE=46]="MAP_SIZE",t[t.MESSAGE_NUM=48]="MESSAGE_NUM",t[t.ITEMBOX_TOP=60]="ITEMBOX_TOP",t[t.MAPDATA_TOP=90]="MAPDATA_TOP",t[t.OLD_MAPDATA_TOP=100]="OLD_MAPDATA_TOP"}(fs||(fs={}));class ys{constructor(t,e,s){this.byteMapData=t,this.eventEmitter=s,vs(t,e),this.wwaData={version:void 0,gameoverX:void 0,gameoverY:void 0,playerX:void 0,playerY:void 0,mapPartsMax:void 0,objPartsMax:void 0,isOldMap:void 0,isOldMove:void 0,statusEnergyMax:void 0,statusEnergy:void 0,statusStrength:void 0,statusDefence:void 0,statusGold:void 0,itemBox:void 0,mapWidth:void 0,messageNum:void 0,map:void 0,mapObject:void 0,mapCompressed:void 0,mapObjectCompressed:void 0,mapAttribute:void 0,objectAttribute:void 0,worldPassword:void 0,message:void 0,worldName:void 0,worldPassNumber:void 0,charCGName:void 0,mapCGName:void 0,systemMessage:void 0,moves:void 0,yesnoImgPosX:void 0,yesnoImgPosY:void 0,playerImgPosX:void 0,playerImgPosY:void 0,clickableItemSignImgPosX:void 0,clickableItemSignImgPosY:void 0,disableSaveFlag:void 0,compatibleForOldMapFlag:void 0,objectNoCollapseDefaultFlag:void 0,delPlayerFlag:void 0,bgm:void 0,effectCoords:void 0,effectWaits:void 0,imgStatusEnergyX:void 0,imgStatusEnergyY:void 0,imgStatusStrengthX:void 0,imgStatusStrengthY:void 0,imgStatusDefenceX:void 0,imgStatusDefenceY:void 0,imgStatusGoldX:void 0,imgStatusGoldY:void 0,imgWideCellX:void 0,imgWideCellY:void 0,imgItemboxX:void 0,imgItemboxY:void 0,imgFrameX:void 0,imgFrameY:void 0,imgBattleEffectX:void 0,imgBattleEffectY:void 0,imgClickX:void 0,imgClickY:void 0,frameColorR:void 0,frameColorG:void 0,frameColorB:void 0,frameOutColorR:void 0,frameOutColorG:void 0,frameOutColorB:void 0,fontColorR:void 0,fontColorG:void 0,fontColorB:void 0,statusColorR:void 0,statusColorG:void 0,statusColorB:void 0,checkOriginalMapString:void 0,checkString:void 0,isItemEffectEnabled:void 0,frameCount:void 0,gamePadButtonItemTable:void 0,userVar:void 0,userNamedVar:void 0,permitChangeGameSpeed:void 0,gameSpeedIndex:void 0,playTime:void 0,isVisibleStatusEnergy:void 0,isVisibleStatusStrength:void 0,isVisibleStatusDefence:void 0,isVisibleStatusGold:void 0,isGameOverDisabled:void 0,gameOverPolicy:"default",bgmDelayDurationMs:void 0,customSystemMessages:{},pictureRegistry:[]}}extractAllData(){var t,e;return this.wwaData.version=this.byteMapData[fs.VERSION],this._extractInitialParameters(),this.wwaData.version>=29?this.currentPosition=fs.MAPDATA_TOP:this.currentPosition=fs.OLD_MAPDATA_TOP,this.wwaData.map=this._getFieldDataFromBits(Ee.MAP,this.wwaData.mapPartsMax).concat(),this.wwaData.mapObject=this._getFieldDataFromBits(Ee.OBJECT,this.wwaData.objPartsMax).concat(),t=this.wwaData.version>29?me.MAP_ATR_MAX:me.OLD_MAP_ATR_MAX,e=this.wwaData.version>29?me.OBJ_ATR_MAX:me.OLD_OBJ_ATR_MAX,this.wwaData.mapAttribute=this._getPartsDataFromBits(Ee.MAP,this.wwaData.mapPartsMax,t).concat(),this.wwaData.objectAttribute=this._getPartsDataFromBits(Ee.OBJECT,this.wwaData.objPartsMax,e).concat(),this.wwaData.version<=29&&(this._convertAttributeV2toV3(Ee.MAP),this._convertAttributeV2toV3(Ee.OBJECT)),this._replaceAllRandomObjects(),this.wwaData}_convertAttributeV2toV3(t){var e,s,i;if(t==Ee.MAP)e=this.wwaData.mapPartsMax,s=this.wwaData.mapAttribute,i=me.MAP_LOCALGATE;else{if(t!=Ee.OBJECT)throw new Error("謎のパーツ種別が指定されました");e=this.wwaData.objPartsMax,s=this.wwaData.objectAttribute,i=me.OBJECT_LOCALGATE}for(var a=0;a<e;a++){for(var r=9;r>=0;r--){var n=255&s[a][20+2*r],o=s[a][20+2*r]>>8,h=255&s[a][20+2*r+1],c=s[a][20+2*r+1]>>8;250===h?h=9e3:h>100&&(h+=9840),250===c?c=9e3:c>100&&(c+=9840),s[a][20+4*r]=n,s[a][20+4*r+3]=o,s[a][20+4*r+1]=h,s[a][20+4*r+2]=c}s[a][me.ATR_TYPE]===i&&(s[a][me.ATR_JUMP_X]>100&&(s[a][me.ATR_JUMP_X]+=9840),s[a][me.ATR_JUMP_Y]>100&&(s[a][me.ATR_JUMP_Y]+=9840))}}_get1ByteNumber(t){return this.byteMapData[t]}_get2BytesNumber(t){return this.byteMapData[t]+256*this.byteMapData[t+1]}_extractInitialParameters(){this.wwaData.version>29?(this.wwaData.gameoverX=this._get2BytesNumber(fs.GAMEOVER_X),this.wwaData.gameoverY=this._get2BytesNumber(fs.GAMEOVER_Y),this.wwaData.playerX=this._get2BytesNumber(fs.PLAYER_X),this.wwaData.playerY=this._get2BytesNumber(fs.PLAYER_Y),this.wwaData.mapPartsMax=this._get2BytesNumber(fs.MAP_COUNT),this.wwaData.objPartsMax=this._get2BytesNumber(fs.OBJ_COUNT),this.wwaData.isOldMap=!1):(this.wwaData.gameoverX=this._get1ByteNumber(fs.OLD_GAMEOVER_X),this.wwaData.gameoverY=this._get1ByteNumber(fs.OLD_GAMEOVER_Y),this.wwaData.playerX=this._get1ByteNumber(fs.OLD_PLAYER_X),this.wwaData.playerY=this._get1ByteNumber(fs.OLD_PLAYER_Y),this.wwaData.mapPartsMax=this._get1ByteNumber(fs.OLD_MAP_COUNT),this.wwaData.objPartsMax=this._get1ByteNumber(fs.OLD_OBJ_COUNT),this.wwaData.isOldMap=!0),this.wwaData.statusEnergyMax=this._get2BytesNumber(fs.STATUS_ENERGY_MAX),this.wwaData.statusEnergy=this._get2BytesNumber(fs.STATUS_ENERGY),this.wwaData.statusStrength=this._get2BytesNumber(fs.STATUS_STRENGTH),this.wwaData.statusDefence=this._get2BytesNumber(fs.STATUS_DEFENCE),this.wwaData.statusGold=this._get2BytesNumber(fs.STATUS_GOLD),this._extractInitialItemData(),this.wwaData.mapWidth=this._get2BytesNumber(fs.MAP_SIZE),this.wwaData.messageNum=this._get2BytesNumber(fs.MESSAGE_NUM),this.wwaData.version<28?this.wwaData.mapWidth=71:this.wwaData.version<=29&&(this.wwaData.mapWidth=101)}_extractInitialItemData(){const t=this.wwaData.version>29?fs.ITEMBOX_TOP:fs.OLD_ITEMBOX_TOP;this.wwaData.itemBox=new Array(me.ITEMBOX_SIZE);for(let e=0;e<me.ITEMBOX_SIZE;e++)this.wwaData.itemBox[e]=this._get1ByteNumber(t+e)}_getFieldDataFromBits(t,e){var s,i,a;for(a=gs(this.wwaData.mapWidth,this.wwaData.mapWidth),s=0;s<this.wwaData.mapWidth;s++)for(i=0;i<this.wwaData.mapWidth;i++)this.wwaData.version>29?(a[s][i]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(a[s][i]=this._get1ByteNumber(this.currentPosition),this.currentPosition+=1),(s*this.wwaData.mapWidth+i)%200==0&&this.emitProgress(s*this.wwaData.mapWidth+i,this.wwaData.mapWidth*this.wwaData.mapWidth,t===Ee.MAP?ge.MAP_LOAD:ge.OBJ_LOAD),a[s][i]>=e&&(a[s][i]=0);return this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,t===Ee.MAP?ge.MAP_LOAD:ge.OBJ_LOAD),a}_getPartsDataFromBits(t,e,s){var i,a,r;for(r=gs(e,s),i=0;i<e;i++)for(a=0;a<s;a++)(i*this.wwaData.mapWidth+a)%200==0&&this.emitProgress(i*s+a,e*s,t===Ee.MAP?ge.MAP_ATTR:ge.OBJ_ATTR),a!==me.ATR_CROP1&&a!==me.ATR_CROP2?(r[i][a]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(r[i][a]=0,this.currentPosition+=2);return this.emitProgress(e*s,e*s,t===Ee.MAP?ge.MAP_ATTR:ge.OBJ_ATTR),r}_replaceAllRandomObjects(){this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,ge.RAND_PARTS)}emitProgress(t,e,s){this.eventEmitter.dispatch("progress",{current:t,total:e,stage:s})}}class Ss{constructor(t,e,s,i){this.wwaData=t,this.compressedMapData=e,this.startPosition=s,this.eventEmitter=i,this.OLDVER_MESSAGE_MAX=400}load(){const t=this.wwaData;this.currentPos=this.startPosition,t.version>=30&&(t.worldPassword=this.getMessageFromData()),t.version<=29&&(t.messageNum=this.OLDVER_MESSAGE_MAX),t.message=new Array(t.messageNum);for(let e=0;e<t.message.length;e++)t.message[e]=this.getMessageFromData(),e%200==0&&this.eventEmitter.dispatch("progress",{current:e,total:t.message.length,stage:ge.MESSAGE});for(;t.messageNum<10;)t.message.push(""),t.messageNum++;this.eventEmitter.dispatch("progress",{current:t.message.length,total:t.message.length,stage:ge.MESSAGE}),t.worldName=this.getMessageFromData(),t.version<=29?t.worldPassword=this.getMessageFromData():this.getMessageFromData(),""===t.worldPassword?t.worldPassNumber=0:t.version>=29?t.worldPassNumber=(parseInt(t.worldPassword)/10-1197)/17-2357:t.worldPassNumber=parseInt(t.worldPassword),t.charCGName=this.getMessageFromData(),t.mapCGName=this.getMessageFromData(),t.systemMessage=new Array(me.SYSTEM_MESSAGE_NUM);for(let e=0;e<me.SYSTEM_MESSAGE_NUM;e++)t.version>=30?t.systemMessage[e]=this.getMessageFromData():t.systemMessage[e]="";return t.yesnoImgPosX=me.IMGPOS_DEFAULT_YESNO_X,t.yesnoImgPosY=me.IMGPOS_DEFAULT_YESNO_Y,t.playerImgPosX=me.IMGPOS_DEFAULT_PLAYER_X,t.playerImgPosY=me.IMGPOS_DEFAULT_PLAYER_Y,t.clickableItemSignImgPosX=me.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X,t.clickableItemSignImgPosY=me.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y,t.disableSaveFlag=me.DEFAULT_DISABLE_SAVE,t.isOldMap=me.DEFAULT_OLDMAP,t.isOldMove=t.version<31,t.objectNoCollapseDefaultFlag=me.DEFAULT_OBJECT_NO_COLLAPSE,t.delPlayerFlag=!1,t.bgm=0,t.effectCoords=[],t.effectWaits=0,t.imgStatusEnergyX=me.IMGPOS_DEFAULT_STATUS_X+me.IMGRELPOS_ENERGY_ICON_X,t.imgStatusEnergyY=me.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusStrengthX=me.IMGPOS_DEFAULT_STATUS_X+me.IMGRELPOS_STRENGTH_ICON_X,t.imgStatusStrengthY=me.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusDefenceX=me.IMGPOS_DEFAULT_STATUS_X+me.IMGRELPOS_DEFENCE_ICON_X,t.imgStatusDefenceY=me.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusGoldX=me.IMGPOS_DEFAULT_STATUS_X+me.IMGRELPOS_GOLD_ICON_X,t.imgStatusGoldY=me.IMGPOS_DEFAULT_STATUS_Y,t.imgWideCellX=me.IMGPOS_DEFAULT_WIDE_CELL_X,t.imgWideCellY=me.IMGPOS_DEFAULT_WIDE_CELL_Y,t.imgItemboxX=me.IMGPOS_DEFAULT_ITEMBOX_X,t.imgItemboxY=me.IMGPOS_DEFAULT_ITEMBOX_Y,t.imgFrameX=me.IMGPOS_DEFAULT_FRAME_X,t.imgFrameY=me.IMGPOS_DEFAULT_FRAME_Y,t.imgBattleEffectX=me.IMGPOS_DEFAULT_BATTLE_EFFECT_X,t.imgBattleEffectY=me.IMGPOS_DEFAULT_BATTLE_EFFECT_Y,t.imgClickX=0,t.imgClickY=0,t.frameColorR=me.DEFAULT_FRAME_COLOR_R,t.frameColorG=me.DEFAULT_FRAME_COLOR_G,t.frameColorB=me.DEFAULT_FRAME_COLOR_B,t.frameOutColorR=me.DEFAULT_FRAMEOUT_COLOR_R,t.frameOutColorG=me.DEFAULT_FRAMEOUT_COLOR_G,t.frameOutColorB=me.DEFAULT_FRAMEOUT_COLOR_B,t.fontColorR=me.DEFAULT_STR_COLOR_R,t.fontColorG=me.DEFAULT_STR_COLOR_G,t.fontColorB=me.DEFAULT_STR_COLOR_B,t.statusColorR=me.DEFAULT_STATUS_COLOR_R,t.statusColorG=me.DEFAULT_STATUS_COLOR_G,t.statusColorB=me.DEFAULT_STATUS_COLOR_B,t.moves=me.DEFAULT_MOVES,t.gameSpeedIndex=me.DEFAULT_SPEED_INDEX,t.permitChangeGameSpeed=!0,t.userVar=Array.from({length:me.USER_VAR_NUM}).map((()=>0)),t.userNamedVar=[],t.playTime=0,t.isVisibleStatusEnergy=!0,t.isVisibleStatusStrength=!0,t.isVisibleStatusDefence=!0,t.isVisibleStatusGold=!0,t.gameOverPolicy="default",t.bgmDelayDurationMs=0,t.pictureRegistry=[],t}getMessageFromData(){let t="",e=0;for(e=0;e<1500&&(0!=this.compressedMapData[this.currentPos+2*e]||0!=this.compressedMapData[this.currentPos+2*e+1]);e++)t+=String.fromCharCode((this.compressedMapData[this.currentPos+2*e+1]<<8)+this.compressedMapData[this.currentPos+2*e]);return this.currentPos+=2*e+2,t}}class As{constructor(){}}class Ts extends As{constructor(t){super(),this.uri=t}static async fetch(t){try{return await fetch(t)}catch(e){throw new Error(`マップデータ 「${t}」の読み込みに失敗しました。\n 通信環境の良いところで再度お試しください。\n ローカルテストの場合は、ブラウザが対応していない可能性があります。`)}}static handleError(t,e){const s=`HTTPステータスコードは ${e.status} です。`;switch(e.status){case 200:case 304:return;case 403:throw new Error(`マップデータ「${t}」を読み取る権限がないようです。\n 管理者の方へ: マップデータのパーミッションを確認してください。\n ${s}`);case 404:throw new Error(`マップデータ「${t}」が見つかりませんでした。\n ${s}`);default:throw new Error(`マップデータ「${t}」の読み込みに失敗しました。\n ${s}`)}}async request(){const t=await Ts.fetch(this.uri);Ts.handleError(this.uri,t);return await t.arrayBuffer()}}var Is=s(106),Cs=s.n(Is);class Ds extends As{constructor(t){super(),this.fileName=t}async request(){return new Promise(((t,e)=>{Cs().readFile(this.fileName,((s,i)=>{s&&e(s),t(i.buffer)}))}))}}class Ps{constructor(t,e){this.fileName=t,this.eventEmitter=e}async requestAndLoadMapData(){const t=(e=this.fileName,"undefined"!=typeof window?new Ts(e):new Ds(e));var e;try{const e=await t.request();if(!e)return void this.eventEmitter.dispatch("error",{name:"マップデータ取得に失敗しました",message:"mapdata is empty"});const s=this.loadMapData(e);this.eventEmitter.dispatch("mapData",s)}catch(t){const e=t.name||"",s=t.message||"";this.eventEmitter.dispatch("error",{name:e,message:s})}}loadMapData(t){try{const e=new Uint8Array(t),{byteMapData:s,byteMapLength:i,compressedEndPosition:a}=function(t){let e,s,i=new Uint8Array(t.length);for(e=0,s=0;e<t.length&&(0!==t[e]||0!==t[e+1]||0!==t[e+2]);e++){if(i[s++]=t[e],t[e]===t[e+1]){const a=t[e+2];for(let r=0;r<a;r++)i[s++]=t[e];e+=2}if(s+255>=i.length){var a=new Uint8Array(i.length+65e3);a.set(i),i=a}}return console.log("EXTRACT DATA = "+s+" "+e),{byteMapData:i,byteMapLength:s,compressedEndPosition:e+3}}(e),r=new ys(s,i,this.eventEmitter).extractAllData();return new Ss(r,e,a,this.eventEmitter).load()}catch(t){throw t}}}class Ns{constructor(t){this.target=null!=t?t:document.createElement("div")}dispatch(t,e){const s=new CustomEvent(t,{detail:e});this.target.dispatchEvent(s)}addListener(t,e){const s=t=>e(t.detail);return this.target.addEventListener(t,s),s}removeListener(t,e){this.target.removeEventListener(t,e)}}var Os={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},Ms="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",xs={5:Ms,"5module":Ms+" export import",6:Ms+" const class extends export import super"},bs=/^in(stanceof)?$/,Ls="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Rs="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",Bs=new RegExp("["+Ls+"]"),Us=new RegExp("["+Ls+Rs+"]");Ls=Rs=null;var ks=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938],Ws=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function Vs(t,e){for(var s=65536,i=0;i<e.length;i+=2){if((s+=e[i])>t)return!1;if((s+=e[i+1])>=t)return!0}}function Fs(t,e){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&Bs.test(String.fromCharCode(t)):!1!==e&&Vs(t,ks)))}function Ys(t,e){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&Us.test(String.fromCharCode(t)):!1!==e&&(Vs(t,ks)||Vs(t,Ws)))))}var Gs=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};function Hs(t,e){return new Gs(t,{beforeExpr:!0,binop:e})}var Ks={beforeExpr:!0},js={startsExpr:!0},Xs={};function Js(t,e){return void 0===e&&(e={}),e.keyword=t,Xs[t]=new Gs(t,e)}var $s={num:new Gs("num",js),regexp:new Gs("regexp",js),string:new Gs("string",js),name:new Gs("name",js),eof:new Gs("eof"),bracketL:new Gs("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new Gs("]"),braceL:new Gs("{",{beforeExpr:!0,startsExpr:!0}),braceR:new Gs("}"),parenL:new Gs("(",{beforeExpr:!0,startsExpr:!0}),parenR:new Gs(")"),comma:new Gs(",",Ks),semi:new Gs(";",Ks),colon:new Gs(":",Ks),dot:new Gs("."),question:new Gs("?",Ks),questionDot:new Gs("?."),arrow:new Gs("=>",Ks),template:new Gs("template"),invalidTemplate:new Gs("invalidTemplate"),ellipsis:new Gs("...",Ks),backQuote:new Gs("`",js),dollarBraceL:new Gs("${",{beforeExpr:!0,startsExpr:!0}),eq:new Gs("=",{beforeExpr:!0,isAssign:!0}),assign:new Gs("_=",{beforeExpr:!0,isAssign:!0}),incDec:new Gs("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new Gs("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Hs("||",1),logicalAND:Hs("&&",2),bitwiseOR:Hs("|",3),bitwiseXOR:Hs("^",4),bitwiseAND:Hs("&",5),equality:Hs("==/!=/===/!==",6),relational:Hs("</>/<=/>=",7),bitShift:Hs("<</>>/>>>",8),plusMin:new Gs("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Hs("%",10),star:Hs("*",10),slash:Hs("/",10),starstar:new Gs("**",{beforeExpr:!0}),coalesce:Hs("??",1),_break:Js("break"),_case:Js("case",Ks),_catch:Js("catch"),_continue:Js("continue"),_debugger:Js("debugger"),_default:Js("default",Ks),_do:Js("do",{isLoop:!0,beforeExpr:!0}),_else:Js("else",Ks),_finally:Js("finally"),_for:Js("for",{isLoop:!0}),_function:Js("function",js),_if:Js("if"),_return:Js("return",Ks),_switch:Js("switch"),_throw:Js("throw",Ks),_try:Js("try"),_var:Js("var"),_const:Js("const"),_while:Js("while",{isLoop:!0}),_with:Js("with"),_new:Js("new",{beforeExpr:!0,startsExpr:!0}),_this:Js("this",js),_super:Js("super",js),_class:Js("class",js),_extends:Js("extends",Ks),_export:Js("export"),_import:Js("import",js),_null:Js("null",js),_true:Js("true",js),_false:Js("false",js),_in:Js("in",{beforeExpr:!0,binop:7}),_instanceof:Js("instanceof",{beforeExpr:!0,binop:7}),_typeof:Js("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:Js("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:Js("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Zs=/\r\n?|\n|\u2028|\u2029/,qs=new RegExp(Zs.source,"g");function zs(t,e){return 10===t||13===t||!e&&(8232===t||8233===t)}var Qs=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ti=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ei=Object.prototype,si=ei.hasOwnProperty,ii=ei.toString;function ai(t,e){return si.call(t,e)}var ri=Array.isArray||function(t){return"[object Array]"===ii.call(t)};function ni(t){return new RegExp("^(?:"+t.replace(/ /g,"|")+")$")}var oi=function(t,e){this.line=t,this.column=e};oi.prototype.offset=function(t){return new oi(this.line,this.column+t)};var hi=function(t,e,s){this.start=e,this.end=s,null!==t.sourceFile&&(this.source=t.sourceFile)};function ci(t,e){for(var s=1,i=0;;){qs.lastIndex=i;var a=qs.exec(t);if(!(a&&a.index<e))return new oi(s,e-i);++s,i=a.index+a[0].length}}var _i={ecmaVersion:10,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1};function li(t){var e={};for(var s in _i)e[s]=t&&ai(t,s)?t[s]:_i[s];if(e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),ri(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return ri(e.onComment)&&(e.onComment=function(t,e){return function(s,i,a,r,n,o){var h={type:s?"Block":"Line",value:i,start:a,end:r};t.locations&&(h.loc=new hi(this,n,o)),t.ranges&&(h.range=[a,r]),e.push(h)}}(e,e.onComment)),e}function ui(t,e){return 2|(t?4:0)|(e?8:0)}var di=function(t,e,s){this.options=t=li(t),this.sourceFile=t.sourceFile,this.keywords=ni(xs[t.ecmaVersion>=6?6:"module"===t.sourceType?"5module":5]);var i="";if(!0!==t.allowReserved){for(var a=t.ecmaVersion;!(i=Os[a]);a--);"module"===t.sourceType&&(i+=" await")}this.reservedWords=ni(i);var r=(i?i+" ":"")+Os.strict;this.reservedWordsStrict=ni(r),this.reservedWordsStrictBind=ni(r+" "+Os.strictBind),this.input=String(e),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf("\n",s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(Zs).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=$s.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports={},0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null},pi={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0}};di.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},pi.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},pi.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0},pi.inAsync.get=function(){return(4&this.currentVarScope().flags)>0},pi.allowSuper.get=function(){return(64&this.currentThisScope().flags)>0},pi.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},pi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},di.prototype.inNonArrowFunction=function(){return(2&this.currentThisScope().flags)>0},di.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var s=this,i=0;i<t.length;i++)s=t[i](s);return s},di.parse=function(t,e){return new this(e,t).parse()},di.parseExpressionAt=function(t,e,s){var i=new this(s,t,e);return i.nextToken(),i.parseExpression()},di.tokenizer=function(t,e){return new this(e,t)},Object.defineProperties(di.prototype,pi);var mi=di.prototype,Ei=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;function gi(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}mi.strictDirective=function(t){for(;;){ti.lastIndex=t,t+=ti.exec(this.input)[0].length;var e=Ei.exec(this.input.slice(t));if(!e)return!1;if("use strict"===(e[1]||e[2])){ti.lastIndex=t+e[0].length;var s=ti.exec(this.input),i=s.index+s[0].length,a=this.input.charAt(i);return";"===a||"}"===a||Zs.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(a)||"!"===a&&"="===this.input.charAt(i+1))}t+=e[0].length,ti.lastIndex=t,t+=ti.exec(this.input)[0].length,";"===this.input[t]&&t++}},mi.eat=function(t){return this.type===t&&(this.next(),!0)},mi.isContextual=function(t){return this.type===$s.name&&this.value===t&&!this.containsEsc},mi.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},mi.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},mi.canInsertSemicolon=function(){return this.type===$s.eof||this.type===$s.braceR||Zs.test(this.input.slice(this.lastTokEnd,this.start))},mi.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},mi.semicolon=function(){this.eat($s.semi)||this.insertSemicolon()||this.unexpected()},mi.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},mi.expect=function(t){this.eat(t)||this.unexpected()},mi.unexpected=function(t){this.raise(null!=t?t:this.start,"Unexpected token")},mi.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,"Parenthesized pattern")}},mi.checkExpressionErrors=function(t,e){if(!t)return!1;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},mi.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},mi.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var wi=di.prototype;wi.parseTopLevel=function(t){var e={};for(t.body||(t.body=[]);this.type!==$s.eof;){var s=this.parseStatement(null,!0,e);t.body.push(s)}if(this.inModule)for(var i=0,a=Object.keys(this.undefinedExports);i<a.length;i+=1){var r=a[i];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var fi={kind:"loop"},vi={kind:"switch"};wi.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ti.lastIndex=this.pos;var e=ti.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(91===i)return!0;if(t)return!1;if(123===i)return!0;if(Fs(i,!0)){for(var a=s+1;Ys(this.input.charCodeAt(a),!0);)++a;var r=this.input.slice(s,a);if(!bs.test(r))return!0}return!1},wi.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ti.lastIndex=this.pos;var t=ti.exec(this.input),e=this.pos+t[0].length;return!(Zs.test(this.input.slice(this.pos,e))||"function"!==this.input.slice(e,e+8)||e+8!==this.input.length&&Ys(this.input.charAt(e+8)))},wi.parseStatement=function(t,e,s){var i,a=this.type,r=this.startNode();switch(this.isLet(t)&&(a=$s._var,i="let"),a){case $s._break:case $s._continue:return this.parseBreakContinueStatement(r,a.keyword);case $s._debugger:return this.parseDebuggerStatement(r);case $s._do:return this.parseDoStatement(r);case $s._for:return this.parseForStatement(r);case $s._function:return t&&(this.strict||"if"!==t&&"label"!==t)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case $s._class:return t&&this.unexpected(),this.parseClass(r,!0);case $s._if:return this.parseIfStatement(r);case $s._return:return this.parseReturnStatement(r);case $s._switch:return this.parseSwitchStatement(r);case $s._throw:return this.parseThrowStatement(r);case $s._try:return this.parseTryStatement(r);case $s._const:case $s._var:return i=i||this.value,t&&"var"!==i&&this.unexpected(),this.parseVarStatement(r,i);case $s._while:return this.parseWhileStatement(r);case $s._with:return this.parseWithStatement(r);case $s.braceL:return this.parseBlock(!0,r);case $s.semi:return this.parseEmptyStatement(r);case $s._export:case $s._import:if(this.options.ecmaVersion>10&&a===$s._import){ti.lastIndex=this.pos;var n=ti.exec(this.input),o=this.pos+n[0].length,h=this.input.charCodeAt(o);if(40===h||46===h)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),a===$s._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var c=this.value,_=this.parseExpression();return a===$s.name&&"Identifier"===_.type&&this.eat($s.colon)?this.parseLabeledStatement(r,c,_,t):this.parseExpressionStatement(r,_)}},wi.parseBreakContinueStatement=function(t,e){var s="break"===e;this.next(),this.eat($s.semi)||this.insertSemicolon()?t.label=null:this.type!==$s.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var a=this.labels[i];if(null==t.label||a.name===t.label.name){if(null!=a.kind&&(s||"loop"===a.kind))break;if(t.label&&s)break}}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")},wi.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},wi.parseDoStatement=function(t){return this.next(),this.labels.push(fi),t.body=this.parseStatement("do"),this.labels.pop(),this.expect($s._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat($s.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},wi.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction)&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(fi),this.enterScope(0),this.expect($s.parenL),this.type===$s.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===$s._var||this.type===$s._const||s){var i=this.startNode(),a=s?"let":this.value;return this.next(),this.parseVar(i,!0,a),this.finishNode(i,"VariableDeclaration"),(this.type===$s._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===i.declarations.length?(this.options.ecmaVersion>=9&&(this.type===$s._in?e>-1&&this.unexpected(e):t.await=e>-1),this.parseForIn(t,i)):(e>-1&&this.unexpected(e),this.parseFor(t,i))}var r=new gi,n=this.parseExpression(!0,r);return this.type===$s._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.options.ecmaVersion>=9&&(this.type===$s._in?e>-1&&this.unexpected(e):t.await=e>-1),this.toAssignable(n,!1,r),this.checkLVal(n),this.parseForIn(t,n)):(this.checkExpressionErrors(r,!0),e>-1&&this.unexpected(e),this.parseFor(t,n))},wi.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,Si|(s?0:Ai),!1,e)},wi.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat($s._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")},wi.parseReturnStatement=function(t){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat($s.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},wi.parseSwitchStatement=function(t){var e;this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect($s.braceL),this.labels.push(vi),this.enterScope(0);for(var s=!1;this.type!==$s.braceR;)if(this.type===$s._case||this.type===$s._default){var i=this.type===$s._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!0,e.test=null),this.expect($s.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},wi.parseThrowStatement=function(t){return this.next(),Zs.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var yi=[];wi.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===$s._catch){var e=this.startNode();if(this.next(),this.eat($s.parenL)){e.param=this.parseBindingAtom();var s="Identifier"===e.param.type;this.enterScope(s?32:0),this.checkLVal(e.param,s?4:2),this.expect($s.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0);e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat($s._finally)?this.parseBlock():null,t.handler||t.finalizer||this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},wi.parseVarStatement=function(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")},wi.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(fi),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")},wi.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")},wi.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},wi.parseLabeledStatement=function(t,e,s,i){for(var a=0,r=this.labels;a<r.length;a+=1){r[a].name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var n=this.type.isLoop?"loop":this.type===$s._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var h=this.labels[o];if(h.statementStart!==t.start)break;h.statementStart=this.start,h.kind=n}return this.labels.push({name:e,kind:n,statementStart:this.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")},wi.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},wi.parseBlock=function(t,e,s){for(void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),e.body=[],this.expect($s.braceL),t&&this.enterScope(0);this.type!==$s.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")},wi.parseFor=function(t,e){return t.init=e,this.expect($s.semi),t.test=this.type===$s.semi?null:this.parseExpression(),this.expect($s.semi),t.update=this.type===$s.parenR?null:this.parseExpression(),this.expect($s.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")},wi.parseForIn=function(t,e){var s=this.type===$s._in;return this.next(),"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(!s||this.options.ecmaVersion<8||this.strict||"var"!==e.kind||"Identifier"!==e.declarations[0].id.type)?this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"):"AssignmentPattern"===e.type&&this.raise(e.start,"Invalid left-hand side in for-loop"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect($s.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")},wi.parseVar=function(t,e,s){for(t.declarations=[],t.kind=s;;){var i=this.startNode();if(this.parseVarId(i,s),this.eat($s.eq)?i.init=this.parseMaybeAssign(e):"const"!==s||this.type===$s._in||this.options.ecmaVersion>=6&&this.isContextual("of")?"Identifier"===i.id.type||e&&(this.type===$s._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),t.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat($s.comma))break}return t},wi.parseVarId=function(t,e){t.id=this.parseBindingAtom(),this.checkLVal(t.id,"var"===e?1:2,!1)};var Si=1,Ai=2;wi.parseFunction=function(t,e,s,i){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===$s.star&&e&Ai&&this.unexpected(),t.generator=this.eat($s.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&Si&&(t.id=4&e&&this.type!==$s.name?null:this.parseIdent(),!t.id||e&Ai||this.checkLVal(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?1:2:3));var a=this.yieldPos,r=this.awaitPos,n=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ui(t.async,t.generator)),e&Si||(t.id=this.type===$s.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,!1),this.yieldPos=a,this.awaitPos=r,this.awaitIdentPos=n,this.finishNode(t,e&Si?"FunctionDeclaration":"FunctionExpression")},wi.parseFunctionParams=function(t){this.expect($s.parenL),t.params=this.parseBindingList($s.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},wi.parseClass=function(t,e){this.next();var s=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.startNode(),a=!1;for(i.body=[],this.expect($s.braceL);this.type!==$s.braceR;){var r=this.parseClassElement(null!==t.superClass);r&&(i.body.push(r),"MethodDefinition"===r.type&&"constructor"===r.kind&&(a&&this.raise(r.start,"Duplicate constructor in the same class"),a=!0))}return this.strict=s,this.next(),t.body=this.finishNode(i,"ClassBody"),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},wi.parseClassElement=function(t){var e=this;if(this.eat($s.semi))return null;var s=this.startNode(),i=function(t,i){void 0===i&&(i=!1);var a=e.start,r=e.startLoc;return!!e.eatContextual(t)&&(!(e.type===$s.parenL||i&&e.canInsertSemicolon())||(s.key&&e.unexpected(),s.computed=!1,s.key=e.startNodeAt(a,r),s.key.name=t,e.finishNode(s.key,"Identifier"),!1))};s.kind="method",s.static=i("static");var a=this.eat($s.star),r=!1;a||(this.options.ecmaVersion>=8&&i("async",!0)?(r=!0,a=this.options.ecmaVersion>=9&&this.eat($s.star)):i("get")?s.kind="get":i("set")&&(s.kind="set")),s.key||this.parsePropertyName(s);var n=s.key,o=!1;return s.computed||s.static||!("Identifier"===n.type&&"constructor"===n.name||"Literal"===n.type&&"constructor"===n.value)?s.static&&"Identifier"===n.type&&"prototype"===n.name&&this.raise(n.start,"Classes may not have a static property named prototype"):("method"!==s.kind&&this.raise(n.start,"Constructor can't have get/set modifier"),a&&this.raise(n.start,"Constructor can't be a generator"),r&&this.raise(n.start,"Constructor can't be an async method"),s.kind="constructor",o=t),this.parseClassMethod(s,a,r,o),"get"===s.kind&&0!==s.value.params.length&&this.raiseRecoverable(s.value.start,"getter should have no params"),"set"===s.kind&&1!==s.value.params.length&&this.raiseRecoverable(s.value.start,"setter should have exactly one param"),"set"===s.kind&&"RestElement"===s.value.params[0].type&&this.raiseRecoverable(s.value.params[0].start,"Setter cannot use rest params"),s},wi.parseClassMethod=function(t,e,s,i){return t.value=this.parseMethod(e,s,i),this.finishNode(t,"MethodDefinition")},wi.parseClassId=function(t,e){this.type===$s.name?(t.id=this.parseIdent(),e&&this.checkLVal(t.id,2,!1)):(!0===e&&this.unexpected(),t.id=null)},wi.parseClassSuper=function(t){t.superClass=this.eat($s._extends)?this.parseExprSubscripts():null},wi.parseExport=function(t,e){if(this.next(),this.eat($s.star))return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseIdent(!0),this.checkExport(e,t.exported.name,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==$s.string&&this.unexpected(),t.source=this.parseExprAtom(),this.semicolon(),this.finishNode(t,"ExportAllDeclaration");if(this.eat($s._default)){var s;if(this.checkExport(e,"default",this.lastTokStart),this.type===$s._function||(s=this.isAsyncFunction())){var i=this.startNode();this.next(),s&&this.next(),t.declaration=this.parseFunction(i,4|Si,!1,s)}else if(this.type===$s._class){var a=this.startNode();t.declaration=this.parseClass(a,"nullableID")}else t.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(t,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())t.declaration=this.parseStatement(null),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id.name,t.declaration.id.start),t.specifiers=[],t.source=null;else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==$s.string&&this.unexpected(),t.source=this.parseExprAtom();else{for(var r=0,n=t.specifiers;r<n.length;r+=1){var o=n[r];this.checkUnreserved(o.local),this.checkLocalExport(o.local)}t.source=null}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},wi.checkExport=function(t,e,s){t&&(ai(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=!0)},wi.checkPatternExport=function(t,e){var s=e.type;if("Identifier"===s)this.checkExport(t,e.name,e.start);else if("ObjectPattern"===s)for(var i=0,a=e.properties;i<a.length;i+=1){var r=a[i];this.checkPatternExport(t,r)}else if("ArrayPattern"===s)for(var n=0,o=e.elements;n<o.length;n+=1){var h=o[n];h&&this.checkPatternExport(t,h)}else"Property"===s?this.checkPatternExport(t,e.value):"AssignmentPattern"===s?this.checkPatternExport(t,e.left):"RestElement"===s?this.checkPatternExport(t,e.argument):"ParenthesizedExpression"===s&&this.checkPatternExport(t,e.expression)},wi.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var a=i[s];this.checkPatternExport(t,a.id)}},wi.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},wi.parseExportSpecifiers=function(t){var e=[],s=!0;for(this.expect($s.braceL);!this.eat($s.braceR);){if(s)s=!1;else if(this.expect($s.comma),this.afterTrailingComma($s.braceR))break;var i=this.startNode();i.local=this.parseIdent(!0),i.exported=this.eatContextual("as")?this.parseIdent(!0):i.local,this.checkExport(t,i.exported.name,i.exported.start),e.push(this.finishNode(i,"ExportSpecifier"))}return e},wi.parseImport=function(t){return this.next(),this.type===$s.string?(t.specifiers=yi,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===$s.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},wi.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===$s.name){var s=this.startNode();if(s.local=this.parseIdent(),this.checkLVal(s.local,2),t.push(this.finishNode(s,"ImportDefaultSpecifier")),!this.eat($s.comma))return t}if(this.type===$s.star){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdent(),this.checkLVal(i.local,2),t.push(this.finishNode(i,"ImportNamespaceSpecifier")),t}for(this.expect($s.braceL);!this.eat($s.braceR);){if(e)e=!1;else if(this.expect($s.comma),this.afterTrailingComma($s.braceR))break;var a=this.startNode();a.imported=this.parseIdent(!0),this.eatContextual("as")?a.local=this.parseIdent():(this.checkUnreserved(a.imported),a.local=a.imported),this.checkLVal(a.local,2),t.push(this.finishNode(a,"ImportSpecifier"))}return t},wi.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},wi.isDirectiveCandidate=function(t){return"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var Ti=di.prototype;Ti.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,!0);for(var i=0,a=t.properties;i<a.length;i+=1){var r=a[i];this.toAssignable(r,e),"RestElement"!==r.type||"ArrayPattern"!==r.argument.type&&"ObjectPattern"!==r.argument.type||this.raise(r.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);case"AssignmentPattern":break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,!0);return t},Ti.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var a=t[i];a&&this.toAssignable(a,e)}if(s){var r=t[s-1];6===this.options.ecmaVersion&&e&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return t},Ti.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},Ti.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==$s.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},Ti.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case $s.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList($s.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case $s.braceL:return this.parseObj(!0)}return this.parseIdent()},Ti.parseBindingList=function(t,e,s){for(var i=[],a=!0;!this.eat(t);)if(a?a=!1:this.expect($s.comma),e&&this.type===$s.comma)i.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===$s.ellipsis){var r=this.parseRestBinding();this.parseBindingListItem(r),i.push(r),this.type===$s.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}var n=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(n),i.push(n)}return i},Ti.parseBindingListItem=function(t){return t},Ti.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat($s.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},Ti.checkLVal=function(t,e,s){switch(void 0===e&&(e=0),t.type){case"Identifier":2===e&&"let"===t.name&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(e?"Binding ":"Assigning to ")+t.name+" in strict mode"),s&&(ai(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=!0),0!==e&&5!==e&&this.declareName(t.name,e,t.start);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":e&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ObjectPattern":for(var i=0,a=t.properties;i<a.length;i+=1){var r=a[i];this.checkLVal(r,e,s)}break;case"Property":this.checkLVal(t.value,e,s);break;case"ArrayPattern":for(var n=0,o=t.elements;n<o.length;n+=1){var h=o[n];h&&this.checkLVal(h,e,s)}break;case"AssignmentPattern":this.checkLVal(t.left,e,s);break;case"RestElement":this.checkLVal(t.argument,e,s);break;case"ParenthesizedExpression":this.checkLVal(t.expression,e,s);break;default:this.raise(t.start,(e?"Binding":"Assigning to")+" rvalue")}};var Ii=di.prototype;Ii.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i,a=t.key;switch(a.type){case"Identifier":i=a.name;break;case"Literal":i=String(a.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6)"__proto__"===i&&"init"===r&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=a.start):this.raiseRecoverable(a.start,"Redefinition of __proto__ property")),e.proto=!0);else{var n=e[i="$"+i];if(n)("init"===r?this.strict&&n.init||n.get||n.set:n.init||n[r])&&this.raiseRecoverable(a.start,"Redefinition of property");else n=e[i]={init:!1,get:!1,set:!1};n[r]=!0}}},Ii.parseExpression=function(t,e){var s=this.start,i=this.startLoc,a=this.parseMaybeAssign(t,e);if(this.type===$s.comma){var r=this.startNodeAt(s,i);for(r.expressions=[a];this.eat($s.comma);)r.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(r,"SequenceExpression")}return a},Ii.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,a=-1,r=-1;e?(a=e.parenthesizedAssign,r=e.trailingComma,e.parenthesizedAssign=e.trailingComma=-1):(e=new gi,i=!0);var n=this.start,o=this.startLoc;this.type!==$s.parenL&&this.type!==$s.name||(this.potentialArrowAt=this.start);var h=this.parseMaybeConditional(t,e);if(s&&(h=s.call(this,h,n,o)),this.type.isAssign){var c=this.startNodeAt(n,o);return c.operator=this.value,c.left=this.type===$s.eq?this.toAssignable(h,!1,e):h,i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=c.left.start&&(e.shorthandAssign=-1),this.checkLVal(h),this.next(),c.right=this.parseMaybeAssign(t),this.finishNode(c,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),a>-1&&(e.parenthesizedAssign=a),r>-1&&(e.trailingComma=r),h},Ii.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,a=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return a;if(this.eat($s.question)){var r=this.startNodeAt(s,i);return r.test=a,r.consequent=this.parseMaybeAssign(),this.expect($s.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return a},Ii.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,a=this.parseMaybeUnary(e,!1);return this.checkExpressionErrors(e)||a.start===s&&"ArrowFunctionExpression"===a.type?a:this.parseExprOp(a,s,i,-1,t)},Ii.parseExprOp=function(t,e,s,i,a){var r=this.type.binop;if(null!=r&&(!a||this.type!==$s._in)&&r>i){var n=this.type===$s.logicalOR||this.type===$s.logicalAND,o=this.type===$s.coalesce;o&&(r=$s.logicalAND.binop);var h=this.value;this.next();var c=this.start,_=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1),c,_,r,a),u=this.buildBinary(e,s,t,l,h,n||o);return(n&&this.type===$s.coalesce||o&&(this.type===$s.logicalOR||this.type===$s.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(u,e,s,i,a)}return t},Ii.buildBinary=function(t,e,s,i,a,r){var n=this.startNodeAt(t,e);return n.left=s,n.operator=a,n.right=i,this.finishNode(n,r?"LogicalExpression":"BinaryExpression")},Ii.parseMaybeUnary=function(t,e){var s,i=this.start,a=this.startLoc;if(this.isContextual("await")&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction))s=this.parseAwait(),e=!0;else if(this.type.prefix){var r=this.startNode(),n=this.type===$s.incDec;r.operator=this.value,r.prefix=!0,this.next(),r.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),n?this.checkLVal(r.argument):this.strict&&"delete"===r.operator&&"Identifier"===r.argument.type?this.raiseRecoverable(r.start,"Deleting local variable in strict mode"):e=!0,s=this.finishNode(r,n?"UpdateExpression":"UnaryExpression")}else{if(s=this.parseExprSubscripts(t),this.checkExpressionErrors(t))return s;for(;this.type.postfix&&!this.canInsertSemicolon();){var o=this.startNodeAt(i,a);o.operator=this.value,o.prefix=!1,o.argument=s,this.checkLVal(s),this.next(),s=this.finishNode(o,"UpdateExpression")}}return!e&&this.eat($s.starstar)?this.buildBinary(i,a,s,this.parseMaybeUnary(null,!1),"**",!1):s},Ii.parseExprSubscripts=function(t){var e=this.start,s=this.startLoc,i=this.parseExprAtom(t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var a=this.parseSubscripts(i,e,s);return t&&"MemberExpression"===a.type&&(t.parenthesizedAssign>=a.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=a.start&&(t.parenthesizedBind=-1)),a},Ii.parseSubscripts=function(t,e,s,i){for(var a=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start==5&&this.potentialArrowAt===t.start,r=!1;;){var n=this.parseSubscript(t,e,s,i,a,r);if(n.optional&&(r=!0),n===t||"ArrowFunctionExpression"===n.type){if(r){var o=this.startNodeAt(e,s);o.expression=n,n=this.finishNode(o,"ChainExpression")}return n}t=n}},Ii.parseSubscript=function(t,e,s,i,a,r){var n=this.options.ecmaVersion>=11,o=n&&this.eat($s.questionDot);i&&o&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat($s.bracketL);if(h||o&&this.type!==$s.parenL&&this.type!==$s.backQuote||this.eat($s.dot)){var c=this.startNodeAt(e,s);c.object=t,c.property=h?this.parseExpression():this.parseIdent("never"!==this.options.allowReserved),c.computed=!!h,h&&this.expect($s.bracketR),n&&(c.optional=o),t=this.finishNode(c,"MemberExpression")}else if(!i&&this.eat($s.parenL)){var _=new gi,l=this.yieldPos,u=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var p=this.parseExprList($s.parenR,this.options.ecmaVersion>=8,!1,_);if(a&&!o&&!this.canInsertSemicolon()&&this.eat($s.arrow))return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=l,this.awaitPos=u,this.awaitIdentPos=d,this.parseArrowExpression(this.startNodeAt(e,s),p,!0);this.checkExpressionErrors(_,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=u||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var m=this.startNodeAt(e,s);m.callee=t,m.arguments=p,n&&(m.optional=o),t=this.finishNode(m,"CallExpression")}else if(this.type===$s.backQuote){(o||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(e,s);E.tag=t,E.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(E,"TaggedTemplateExpression")}return t},Ii.parseExprAtom=function(t){this.type===$s.slash&&this.readRegexp();var e,s=this.potentialArrowAt===this.start;switch(this.type){case $s._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),e=this.startNode(),this.next(),this.type!==$s.parenL||this.allowDirectSuper||this.raise(e.start,"super() call outside constructor of a subclass"),this.type!==$s.dot&&this.type!==$s.bracketL&&this.type!==$s.parenL&&this.unexpected(),this.finishNode(e,"Super");case $s._this:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case $s.name:var i=this.start,a=this.startLoc,r=this.containsEsc,n=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!r&&"async"===n.name&&!this.canInsertSemicolon()&&this.eat($s._function))return this.parseFunction(this.startNodeAt(i,a),0,!1,!0);if(s&&!this.canInsertSemicolon()){if(this.eat($s.arrow))return this.parseArrowExpression(this.startNodeAt(i,a),[n],!1);if(this.options.ecmaVersion>=8&&"async"===n.name&&this.type===$s.name&&!r)return n=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat($s.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(i,a),[n],!0)}return n;case $s.regexp:var o=this.value;return(e=this.parseLiteral(o.value)).regex={pattern:o.pattern,flags:o.flags},e;case $s.num:case $s.string:return this.parseLiteral(this.value);case $s._null:case $s._true:case $s._false:return(e=this.startNode()).value=this.type===$s._null?null:this.type===$s._true,e.raw=this.type.keyword,this.next(),this.finishNode(e,"Literal");case $s.parenL:var h=this.start,c=this.parseParenAndDistinguishExpression(s);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(t.parenthesizedAssign=h),t.parenthesizedBind<0&&(t.parenthesizedBind=h)),c;case $s.bracketL:return e=this.startNode(),this.next(),e.elements=this.parseExprList($s.bracketR,!0,!0,t),this.finishNode(e,"ArrayExpression");case $s.braceL:return this.parseObj(!1,t);case $s._function:return e=this.startNode(),this.next(),this.parseFunction(e,0);case $s._class:return this.parseClass(this.startNode(),!1);case $s._new:return this.parseNew();case $s.backQuote:return this.parseTemplate();case $s._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}},Ii.parseExprImport=function(){var t=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var e=this.parseIdent(!0);switch(this.type){case $s.parenL:return this.parseDynamicImport(t);case $s.dot:return t.meta=e,this.parseImportMeta(t);default:this.unexpected()}},Ii.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),!this.eat($s.parenR)){var e=this.start;this.eat($s.comma)&&this.eat($s.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")},Ii.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),"meta"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")},Ii.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),110===e.raw.charCodeAt(e.raw.length-1)&&(e.bigint=e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")},Ii.parseParenExpression=function(){this.expect($s.parenL);var t=this.parseExpression();return this.expect($s.parenR),t},Ii.parseParenAndDistinguishExpression=function(t){var e,s=this.start,i=this.startLoc,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var r,n=this.start,o=this.startLoc,h=[],c=!0,_=!1,l=new gi,u=this.yieldPos,d=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==$s.parenR;){if(c?c=!1:this.expect($s.comma),a&&this.afterTrailingComma($s.parenR,!0)){_=!0;break}if(this.type===$s.ellipsis){r=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===$s.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}h.push(this.parseMaybeAssign(!1,l,this.parseParenItem))}var p=this.start,m=this.startLoc;if(this.expect($s.parenR),t&&!this.canInsertSemicolon()&&this.eat($s.arrow))return this.checkPatternErrors(l,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=u,this.awaitPos=d,this.parseParenArrowList(s,i,h);h.length&&!_||this.unexpected(this.lastTokStart),r&&this.unexpected(r),this.checkExpressionErrors(l,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=d||this.awaitPos,h.length>1?((e=this.startNodeAt(n,o)).expressions=h,this.finishNodeAt(e,"SequenceExpression",p,m)):e=h[0]}else e=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(s,i);return E.expression=e,this.finishNode(E,"ParenthesizedExpression")}return e},Ii.parseParenItem=function(t){return t},Ii.parseParenArrowList=function(t,e,s){return this.parseArrowExpression(this.startNodeAt(t,e),s)};var Ci=[];Ii.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode(),e=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat($s.dot)){t.meta=e;var s=this.containsEsc;return t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.inNonArrowFunction()||this.raiseRecoverable(t.start,"'new.target' can only be used in functions"),this.finishNode(t,"MetaProperty")}var i=this.start,a=this.startLoc,r=this.type===$s._import;return t.callee=this.parseSubscripts(this.parseExprAtom(),i,a,!0),r&&"ImportExpression"===t.callee.type&&this.raise(i,"Cannot use new with import()"),this.eat($s.parenL)?t.arguments=this.parseExprList($s.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Ci,this.finishNode(t,"NewExpression")},Ii.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===$s.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value,cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),s.tail=this.type===$s.backQuote,this.finishNode(s,"TemplateElement")},Ii.parseTemplate=function(t){void 0===t&&(t={});var e=t.isTagged;void 0===e&&(e=!1);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(s.quasis=[i];!i.tail;)this.type===$s.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect($s.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect($s.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(s,"TemplateLiteral")},Ii.isAsyncProp=function(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.type===$s.name||this.type===$s.num||this.type===$s.string||this.type===$s.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===$s.star)&&!Zs.test(this.input.slice(this.lastTokEnd,this.start))},Ii.parseObj=function(t,e){var s=this.startNode(),i=!0,a={};for(s.properties=[],this.next();!this.eat($s.braceR);){if(i)i=!1;else if(this.expect($s.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma($s.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,a,e),s.properties.push(r)}return this.finishNode(s,t?"ObjectPattern":"ObjectExpression")},Ii.parseProperty=function(t,e){var s,i,a,r,n=this.startNode();if(this.options.ecmaVersion>=9&&this.eat($s.ellipsis))return t?(n.argument=this.parseIdent(!1),this.type===$s.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.finishNode(n,"RestElement")):(this.type===$s.parenL&&e&&(e.parenthesizedAssign<0&&(e.parenthesizedAssign=this.start),e.parenthesizedBind<0&&(e.parenthesizedBind=this.start)),n.argument=this.parseMaybeAssign(!1,e),this.type===$s.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(n,"SpreadElement"));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(t||e)&&(a=this.start,r=this.startLoc),t||(s=this.eat($s.star)));var o=this.containsEsc;return this.parsePropertyName(n),!t&&!o&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(n)?(i=!0,s=this.options.ecmaVersion>=9&&this.eat($s.star),this.parsePropertyName(n,e)):i=!1,this.parsePropertyValue(n,t,s,i,a,r,e,o),this.finishNode(n,"Property")},Ii.parsePropertyValue=function(t,e,s,i,a,r,n,o){if((s||i)&&this.type===$s.colon&&this.unexpected(),this.eat($s.colon))t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,n),t.kind="init";else if(this.options.ecmaVersion>=6&&this.type===$s.parenL)e&&this.unexpected(),t.kind="init",t.method=!0,t.value=this.parseMethod(s,i);else if(e||o||!(this.options.ecmaVersion>=5)||t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.type===$s.comma||this.type===$s.braceR||this.type===$s.eq)this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?((s||i)&&this.unexpected(),this.checkUnreserved(t.key),"await"!==t.key.name||this.awaitIdentPos||(this.awaitIdentPos=a),t.kind="init",e?t.value=this.parseMaybeDefault(a,r,t.key):this.type===$s.eq&&n?(n.shorthandAssign<0&&(n.shorthandAssign=this.start),t.value=this.parseMaybeDefault(a,r,t.key)):t.value=t.key,t.shorthand=!0):this.unexpected();else{(s||i)&&this.unexpected(),t.kind=t.key.name,this.parsePropertyName(t),t.value=this.parseMethod(!1);var h="get"===t.kind?0:1;if(t.value.params.length!==h){var c=t.value.start;"get"===t.kind?this.raiseRecoverable(c,"getter should have no params"):this.raiseRecoverable(c,"setter should have exactly one param")}else"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")}},Ii.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat($s.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect($s.bracketR),t.key;t.computed=!1}return t.key=this.type===$s.num||this.type===$s.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},Ii.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},Ii.parseMethod=function(t,e,s){var i=this.startNode(),a=this.yieldPos,r=this.awaitPos,n=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|ui(e,i.generator)|(s?128:0)),this.expect($s.parenL),i.params=this.parseBindingList($s.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0),this.yieldPos=a,this.awaitPos=r,this.awaitIdentPos=n,this.finishNode(i,"FunctionExpression")},Ii.parseArrowExpression=function(t,e,s){var i=this.yieldPos,a=this.awaitPos,r=this.awaitIdentPos;return this.enterScope(16|ui(s,!1)),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=r,this.finishNode(t,"ArrowFunctionExpression")},Ii.parseFunctionBody=function(t,e,s){var i=e&&this.type!==$s.braceL,a=this.strict,r=!1;if(i)t.body=this.parseMaybeAssign(),t.expression=!0,this.checkParams(t,!1);else{var n=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);a&&!n||(r=this.strictDirective(this.end))&&n&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list");var o=this.labels;this.labels=[],r&&(this.strict=!0),this.checkParams(t,!a&&!r&&!e&&!s&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLVal(t.id,5),t.body=this.parseBlock(!1,void 0,r&&!a),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=o}this.exitScope()},Ii.isSimpleParamList=function(t){for(var e=0,s=t;e<s.length;e+=1){if("Identifier"!==s[e].type)return!1}return!0},Ii.checkParams=function(t,e){for(var s={},i=0,a=t.params;i<a.length;i+=1){var r=a[i];this.checkLVal(r,1,e?null:s)}},Ii.parseExprList=function(t,e,s,i){for(var a=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect($s.comma),e&&this.afterTrailingComma(t))break;var n=void 0;s&&this.type===$s.comma?n=null:this.type===$s.ellipsis?(n=this.parseSpread(i),i&&this.type===$s.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):n=this.parseMaybeAssign(!1,i),a.push(n)}return a},Ii.checkUnreserved=function(t){var e=t.start,s=t.end,i=t.name;(this.inGenerator&&"yield"===i&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(e,s).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(this.inAsync||"await"!==i||this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))},Ii.parseIdent=function(t,e){var s=this.startNode();return this.type===$s.name?s.name=this.value:this.type.keyword?(s.name=this.type.keyword,"class"!==s.name&&"function"!==s.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop()):this.unexpected(),this.next(!!t),this.finishNode(s,"Identifier"),t||(this.checkUnreserved(s),"await"!==s.name||this.awaitIdentPos||(this.awaitIdentPos=s.start)),s},Ii.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===$s.semi||this.canInsertSemicolon()||this.type!==$s.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat($s.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")},Ii.parseAwait=function(){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!1),this.finishNode(t,"AwaitExpression")};var Di=di.prototype;Di.raise=function(t,e){var s=ci(this.input,t);e+=" ("+s.line+":"+s.column+")";var i=new SyntaxError(e);throw i.pos=t,i.loc=s,i.raisedAt=this.pos,i},Di.raiseRecoverable=Di.raise,Di.curPosition=function(){if(this.options.locations)return new oi(this.curLine,this.pos-this.lineStart)};var Pi=di.prototype,Ni=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};Pi.enterScope=function(t){this.scopeStack.push(new Ni(t))},Pi.exitScope=function(){this.scopeStack.pop()},Pi.treatFunctionsAsVarInScope=function(t){return 2&t.flags||!this.inModule&&1&t.flags},Pi.declareName=function(t,e,s){var i=!1;if(2===e){var a=this.currentScope();i=a.lexical.indexOf(t)>-1||a.functions.indexOf(t)>-1||a.var.indexOf(t)>-1,a.lexical.push(t),this.inModule&&1&a.flags&&delete this.undefinedExports[t]}else if(4===e){this.currentScope().lexical.push(t)}else if(3===e){var r=this.currentScope();i=this.treatFunctionsAsVar?r.lexical.indexOf(t)>-1:r.lexical.indexOf(t)>-1||r.var.indexOf(t)>-1,r.functions.push(t)}else for(var n=this.scopeStack.length-1;n>=0;--n){var o=this.scopeStack[n];if(o.lexical.indexOf(t)>-1&&!(32&o.flags&&o.lexical[0]===t)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(t)>-1){i=!0;break}if(o.var.push(t),this.inModule&&1&o.flags&&delete this.undefinedExports[t],3&o.flags)break}i&&this.raiseRecoverable(s,"Identifier '"+t+"' has already been declared")},Pi.checkLocalExport=function(t){-1===this.scopeStack[0].lexical.indexOf(t.name)&&-1===this.scopeStack[0].var.indexOf(t.name)&&(this.undefinedExports[t.name]=t)},Pi.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Pi.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(3&e.flags)return e}},Pi.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(3&e.flags&&!(16&e.flags))return e}};var Oi=function(t,e,s){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new hi(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},Mi=di.prototype;function xi(t,e,s,i){return t.type=e,t.end=s,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=s),t}Mi.startNode=function(){return new Oi(this,this.start,this.startLoc)},Mi.startNodeAt=function(t,e){return new Oi(this,t,e)},Mi.finishNode=function(t,e){return xi.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},Mi.finishNodeAt=function(t,e,s,i){return xi.call(this,t,e,s,i)};var bi=function(t,e,s,i,a){this.token=t,this.isExpr=!!e,this.preserveSpace=!!s,this.override=i,this.generator=!!a},Li={b_stat:new bi("{",!1),b_expr:new bi("{",!0),b_tmpl:new bi("${",!1),p_stat:new bi("(",!1),p_expr:new bi("(",!0),q_tmpl:new bi("`",!0,!0,(function(t){return t.tryReadTemplateToken()})),f_stat:new bi("function",!1),f_expr:new bi("function",!0),f_expr_gen:new bi("function",!0,!1,null,!0),f_gen:new bi("function",!1,!1,null,!0)},Ri=di.prototype;Ri.initialContext=function(){return[Li.b_stat]},Ri.braceIsBlock=function(t){var e=this.curContext();return e===Li.f_expr||e===Li.f_stat||(t!==$s.colon||e!==Li.b_stat&&e!==Li.b_expr?t===$s._return||t===$s.name&&this.exprAllowed?Zs.test(this.input.slice(this.lastTokEnd,this.start)):t===$s._else||t===$s.semi||t===$s.eof||t===$s.parenR||t===$s.arrow||(t===$s.braceL?e===Li.b_stat:t!==$s._var&&t!==$s._const&&t!==$s.name&&!this.exprAllowed):!e.isExpr)},Ri.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if("function"===e.token)return e.generator}return!1},Ri.updateContext=function(t){var e,s=this.type;s.keyword&&t===$s.dot?this.exprAllowed=!1:(e=s.updateContext)?e.call(this,t):this.exprAllowed=s.beforeExpr},$s.parenR.updateContext=$s.braceR.updateContext=function(){if(1!==this.context.length){var t=this.context.pop();t===Li.b_stat&&"function"===this.curContext().token&&(t=this.context.pop()),this.exprAllowed=!t.isExpr}else this.exprAllowed=!0},$s.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?Li.b_stat:Li.b_expr),this.exprAllowed=!0},$s.dollarBraceL.updateContext=function(){this.context.push(Li.b_tmpl),this.exprAllowed=!0},$s.parenL.updateContext=function(t){var e=t===$s._if||t===$s._for||t===$s._with||t===$s._while;this.context.push(e?Li.p_stat:Li.p_expr),this.exprAllowed=!0},$s.incDec.updateContext=function(){},$s._function.updateContext=$s._class.updateContext=function(t){!t.beforeExpr||t===$s.semi||t===$s._else||t===$s._return&&Zs.test(this.input.slice(this.lastTokEnd,this.start))||(t===$s.colon||t===$s.braceL)&&this.curContext()===Li.b_stat?this.context.push(Li.f_stat):this.context.push(Li.f_expr),this.exprAllowed=!1},$s.backQuote.updateContext=function(){this.curContext()===Li.q_tmpl?this.context.pop():this.context.push(Li.q_tmpl),this.exprAllowed=!1},$s.star.updateContext=function(t){if(t===$s._function){var e=this.context.length-1;this.context[e]===Li.f_expr?this.context[e]=Li.f_expr_gen:this.context[e]=Li.f_gen}this.exprAllowed=!0},$s.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==$s.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Bi="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Ui=Bi+" Extended_Pictographic",ki={9:Bi,10:Ui,11:Ui},Wi="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Vi="Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Fi=Vi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Yi={9:Vi,10:Fi,11:Fi+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"},Gi={};function Hi(t){var e=Gi[t]={binary:ni(ki[t]+" "+Wi),nonBinary:{General_Category:ni(Wi),Script:ni(Yi[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}Hi(9),Hi(10),Hi(11);var Ki=di.prototype,ji=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":""),this.unicodeProperties=Gi[t.options.ecmaVersion>=11?11:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};function Xi(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Ji(t){return 36===t||t>=40&&t<=43||46===t||63===t||t>=91&&t<=94||t>=123&&t<=125}function $i(t){return t>=65&&t<=90||t>=97&&t<=122}function Zi(t){return $i(t)||95===t}function qi(t){return Zi(t)||zi(t)}function zi(t){return t>=48&&t<=57}function Qi(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function ta(t){return t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:t-48}function ea(t){return t>=48&&t<=55}ji.prototype.reset=function(t,e,s){var i=-1!==s.indexOf("u");this.start=0|t,this.source=e+"",this.flags=s,this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchN=i&&this.parser.options.ecmaVersion>=9},ji.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},ji.prototype.at=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return-1;var a=s.charCodeAt(t);if(!e&&!this.switchU||a<=55295||a>=57344||t+1>=i)return a;var r=s.charCodeAt(t+1);return r>=56320&&r<=57343?(a<<10)+r-56613888:a},ji.prototype.nextIndex=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return i;var a,r=s.charCodeAt(t);return!e&&!this.switchU||r<=55295||r>=57344||t+1>=i||(a=s.charCodeAt(t+1))<56320||a>57343?t+1:t+2},ji.prototype.current=function(t){return void 0===t&&(t=!1),this.at(this.pos,t)},ji.prototype.lookahead=function(t){return void 0===t&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},ji.prototype.advance=function(t){void 0===t&&(t=!1),this.pos=this.nextIndex(this.pos,t)},ji.prototype.eat=function(t,e){return void 0===e&&(e=!1),this.current(e)===t&&(this.advance(e),!0)},Ki.validateRegExpFlags=function(t){for(var e=t.validFlags,s=t.flags,i=0;i<s.length;i++){var a=s.charAt(i);-1===e.indexOf(a)&&this.raise(t.start,"Invalid regular expression flag"),s.indexOf(a,i+1)>-1&&this.raise(t.start,"Duplicate regular expression flag")}},Ki.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&t.groupNames.length>0&&(t.switchN=!0,this.regexp_pattern(t))},Ki.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames.length=0,t.backReferenceNames.length=0,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,s=t.backReferenceNames;e<s.length;e+=1){var i=s[e];-1===t.groupNames.indexOf(i)&&t.raise("Invalid named capture referenced")}},Ki.regexp_disjunction=function(t){for(this.regexp_alternative(t);t.eat(124);)this.regexp_alternative(t);this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")},Ki.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););},Ki.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):!!(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))&&(this.regexp_eatQuantifier(t),!0)},Ki.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var s=!1;if(this.options.ecmaVersion>=9&&(s=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!s,!0}return t.pos=e,!1},Ki.regexp_eatQuantifier=function(t,e){return void 0===e&&(e=!1),!!this.regexp_eatQuantifierPrefix(t,e)&&(t.eat(63),!0)},Ki.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)},Ki.regexp_eatBracedQuantifier=function(t,e){var s=t.pos;if(t.eat(123)){var i=0,a=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(a=t.lastIntValue),t.eat(125)))return-1!==a&&a<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=s}return!1},Ki.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)},Ki.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1},Ki.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)&&t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}t.pos=e}return!1},Ki.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):63===t.current()&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1},Ki.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)},Ki.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1},Ki.regexp_eatSyntaxCharacter=function(t){var e=t.current();return!!Ji(e)&&(t.lastIntValue=e,t.advance(),!0)},Ki.regexp_eatPatternCharacters=function(t){for(var e=t.pos,s=0;-1!==(s=t.current())&&!Ji(s);)t.advance();return t.pos!==e},Ki.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return!(-1===e||36===e||e>=40&&e<=43||46===e||63===e||91===e||94===e||124===e)&&(t.advance(),!0)},Ki.regexp_groupSpecifier=function(t){if(t.eat(63)){if(this.regexp_eatGroupName(t))return-1!==t.groupNames.indexOf(t.lastStringValue)&&t.raise("Duplicate capture group name"),void t.groupNames.push(t.lastStringValue);t.raise("Invalid group")}},Ki.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1},Ki.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=Xi(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Xi(t.lastIntValue);return!0}return!1},Ki.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),function(t){return Fs(t,!0)||36===t||95===t}(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},Ki.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),function(t){return Ys(t,!0)||36===t||95===t||8204===t||8205===t}(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},Ki.regexp_eatAtomEscape=function(t){return!!(this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t))||(t.switchU&&(99===t.current()&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)},Ki.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var s=t.lastIntValue;if(t.switchU)return s>t.maxBackReference&&(t.maxBackReference=s),!0;if(s<=t.numCapturingParens)return!0;t.pos=e}return!1},Ki.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},Ki.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},Ki.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},Ki.regexp_eatZero=function(t){return 48===t.current()&&!zi(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},Ki.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},Ki.regexp_eatControlLetter=function(t){var e=t.current();return!!$i(e)&&(t.lastIntValue=e%32,t.advance(),!0)},Ki.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){void 0===e&&(e=!1);var s,i=t.pos,a=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var r=t.lastIntValue;if(a&&r>=55296&&r<=56319){var n=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var o=t.lastIntValue;if(o>=56320&&o<=57343)return t.lastIntValue=1024*(r-55296)+(o-56320)+65536,!0}t.pos=n,t.lastIntValue=r}return!0}if(a&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&((s=t.lastIntValue)>=0&&s<=1114111))return!0;a&&t.raise("Invalid unicode escape"),t.pos=i}return!1},Ki.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e)&&(t.lastIntValue=e,t.advance(),!0)},Ki.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do{t.lastIntValue=10*t.lastIntValue+(e-48),t.advance()}while((e=t.current())>=48&&e<=57);return!0}return!1},Ki.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(function(t){return 100===t||68===t||115===t||83===t||119===t||87===t}(e))return t.lastIntValue=-1,t.advance(),!0;if(t.switchU&&this.options.ecmaVersion>=9&&(80===e||112===e)){if(t.lastIntValue=-1,t.advance(),t.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(t)&&t.eat(125))return!0;t.raise("Invalid property name")}return!1},Ki.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var s=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,s,i),!0}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var a=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,a),!0}return!1},Ki.regexp_validateUnicodePropertyNameAndValue=function(t,e,s){ai(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(s)||t.raise("Invalid property value")},Ki.regexp_validateUnicodePropertyNameOrValue=function(t,e){t.unicodeProperties.binary.test(e)||t.raise("Invalid property name")},Ki.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Zi(e=t.current());)t.lastStringValue+=Xi(e),t.advance();return""!==t.lastStringValue},Ki.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";qi(e=t.current());)t.lastStringValue+=Xi(e),t.advance();return""!==t.lastStringValue},Ki.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},Ki.regexp_eatCharacterClass=function(t){if(t.eat(91)){if(t.eat(94),this.regexp_classRanges(t),t.eat(93))return!0;t.raise("Unterminated character class")}return!1},Ki.regexp_classRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var s=t.lastIntValue;!t.switchU||-1!==e&&-1!==s||t.raise("Invalid character class"),-1!==e&&-1!==s&&e>s&&t.raise("Range out of order in character class")}}},Ki.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var s=t.current();(99===s||ea(s))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return 93!==i&&(t.lastIntValue=i,t.advance(),!0)},Ki.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)},Ki.regexp_eatClassControlLetter=function(t){var e=t.current();return!(!zi(e)&&95!==e)&&(t.lastIntValue=e%32,t.advance(),!0)},Ki.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1},Ki.regexp_eatDecimalDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;zi(s=t.current());)t.lastIntValue=10*t.lastIntValue+(s-48),t.advance();return t.pos!==e},Ki.regexp_eatHexDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Qi(s=t.current());)t.lastIntValue=16*t.lastIntValue+ta(s),t.advance();return t.pos!==e},Ki.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var s=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=64*e+8*s+t.lastIntValue:t.lastIntValue=8*e+s}else t.lastIntValue=e;return!0}return!1},Ki.regexp_eatOctalDigit=function(t){var e=t.current();return ea(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)},Ki.regexp_eatFixedHexDigits=function(t,e){var s=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var a=t.current();if(!Qi(a))return t.pos=s,!1;t.lastIntValue=16*t.lastIntValue+ta(a),t.advance()}return!0};var sa=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new hi(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},ia=di.prototype;function aa(t){return"function"!=typeof BigInt?null:BigInt(t.replace(/_/g,""))}function ra(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}ia.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new sa(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},ia.getToken=function(){return this.next(),new sa(this)},"undefined"!=typeof Symbol&&(ia[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===$s.eof,value:e}}}}),ia.curContext=function(){return this.context[this.context.length-1]},ia.nextToken=function(){var t=this.curContext();return t&&t.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken($s.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},ia.readToken=function(t){return Fs(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},ia.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);return t<=55295||t>=57344?t:(t<<10)+this.input.charCodeAt(this.pos+1)-56613888},ia.skipBlockComment=function(){var t,e=this.options.onComment&&this.curPosition(),s=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(-1===i&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(qs.lastIndex=s;(t=qs.exec(this.input))&&t.index<this.pos;)++this.curLine,this.lineStart=t.index+t[0].length;this.options.onComment&&this.options.onComment(!0,this.input.slice(s+2,i),s,this.pos,e,this.curPosition())},ia.skipLineComment=function(t){for(var e=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!zs(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,s,this.curPosition())},ia.skipSpace=function(){t:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(!(t>8&&t<14||t>=5760&&Qs.test(String.fromCharCode(t))))break t;++this.pos}}},ia.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.updateContext(s)},ia.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken($s.ellipsis)):(++this.pos,this.finishToken($s.dot))},ia.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp($s.assign,2):this.finishOp($s.slash,1)},ia.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),s=1,i=42===t?$s.star:$s.modulo;return this.options.ecmaVersion>=7&&42===t&&42===e&&(++s,i=$s.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp($s.assign,s+1):this.finishOp(i,s)},ia.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp($s.assign,3);return this.finishOp(124===t?$s.logicalOR:$s.logicalAND,2)}return 61===e?this.finishOp($s.assign,2):this.finishOp(124===t?$s.bitwiseOR:$s.bitwiseAND,1)},ia.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp($s.assign,2):this.finishOp($s.bitwiseXOR,1)},ia.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45!==e||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!Zs.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp($s.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===e?this.finishOp($s.assign,2):this.finishOp($s.plusMin,1)},ia.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),s=1;return e===t?(s=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+s)?this.finishOp($s.assign,s+1):this.finishOp($s.bitShift,s)):33!==e||60!==t||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===e&&(s=2),this.finishOp($s.relational,s)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},ia.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp($s.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken($s.arrow)):this.finishOp(61===t?$s.eq:$s.prefix,1)},ia.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(46===e){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp($s.questionDot,2)}if(63===e){if(t>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp($s.assign,3);return this.finishOp($s.coalesce,2)}}return this.finishOp($s.question,1)},ia.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken($s.parenL);case 41:return++this.pos,this.finishToken($s.parenR);case 59:return++this.pos,this.finishToken($s.semi);case 44:return++this.pos,this.finishToken($s.comma);case 91:return++this.pos,this.finishToken($s.bracketL);case 93:return++this.pos,this.finishToken($s.bracketR);case 123:return++this.pos,this.finishToken($s.braceL);case 125:return++this.pos,this.finishToken($s.braceR);case 58:return++this.pos,this.finishToken($s.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken($s.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp($s.prefix,1)}this.raise(this.pos,"Unexpected character '"+ra(t)+"'")},ia.finishOp=function(t,e){var s=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,s)},ia.readRegexp=function(){for(var t,e,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(Zs.test(i)&&this.raise(s,"Unterminated regular expression"),t)t=!1;else{if("["===i)e=!0;else if("]"===i&&e)e=!1;else if("/"===i&&!e)break;t="\\"===i}++this.pos}var a=this.input.slice(s,this.pos);++this.pos;var r=this.pos,n=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new ji(this));o.reset(s,a,n),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(a,n)}catch(t){}return this.finishToken($s.regexp,{pattern:a,flags:n,value:h})},ia.readInt=function(t,e,s){for(var i=this.options.ecmaVersion>=12&&void 0===e,a=s&&48===this.input.charCodeAt(this.pos),r=this.pos,n=0,o=0,h=0,c=null==e?1/0:e;h<c;++h,++this.pos){var _=this.input.charCodeAt(this.pos),l=void 0;if(i&&95===_)a&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===h&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=_;else{if((l=_>=97?_-97+10:_>=65?_-65+10:_>=48&&_<=57?_-48:1/0)>=t)break;o=_,n=n*t+l}}return i&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||null!=e&&this.pos-r!==e?null:n},ia.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var s=this.readInt(t);return null==s&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(s=aa(this.input.slice(e,this.pos)),++this.pos):Fs(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken($s.num,s)},ia.readNumber=function(t){var e=this.pos;t||null!==this.readInt(10,void 0,!0)||this.raise(e,"Invalid number");var s=this.pos-e>=2&&48===this.input.charCodeAt(e);s&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!t&&this.options.ecmaVersion>=11&&110===i){var a=aa(this.input.slice(e,this.pos));return++this.pos,Fs(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken($s.num,a)}s&&/[89]/.test(this.input.slice(e,this.pos))&&(s=!1),46!==i||s||(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),69!==i&&101!==i||s||(43!==(i=this.input.charCodeAt(++this.pos))&&45!==i||++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number")),Fs(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r,n=(r=this.input.slice(e,this.pos),s?parseInt(r,8):parseFloat(r.replace(/_/g,"")));return this.finishToken($s.num,n)},ia.readCodePoint=function(){var t;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var e=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(e,"Code point out of bounds")}else t=this.readHexChar(4);return t},ia.readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;92===i?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(!1),s=this.pos):(zs(i,this.options.ecmaVersion>=10)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken($s.string,e)};var na={};ia.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==na)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},ia.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw na;this.raise(t,e)},ia.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(96===s||36===s&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==$s.template&&this.type!==$s.invalidTemplate?(t+=this.input.slice(e,this.pos),this.finishToken($s.template,t)):36===s?(this.pos+=2,this.finishToken($s.dollarBraceL)):(++this.pos,this.finishToken($s.backQuote));if(92===s)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(zs(s)){switch(t+=this.input.slice(e,this.pos),++this.pos,s){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(s)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},ia.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken($s.invalidTemplate,this.input.slice(this.start,this.pos))}this.raise(this.start,"Unterminated template")},ia.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ra(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(t){var s=this.pos-1;return this.invalidStringToken(s,"Invalid escape sequence in template string"),null}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],a=parseInt(i,8);return a>255&&(i=i.slice(0,-1),a=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),"0"===i&&56!==e&&57!==e||!this.strict&&!t||this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(a)}return zs(e)?"":String.fromCharCode(e)}},ia.readHexChar=function(t){var e=this.pos,s=this.readInt(16,t);return null===s&&this.invalidStringToken(e,"Bad character escape sequence"),s},ia.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var a=this.fullCharCodeAtPos();if(Ys(a,i))this.pos+=a<=65535?1:2;else{if(92!==a)break;this.containsEsc=!0,t+=this.input.slice(s,this.pos);var r=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var n=this.readCodePoint();(e?Fs:Ys)(n,i)||this.invalidStringToken(r,"Invalid Unicode escape"),t+=ra(n),s=this.pos}e=!1}return t+this.input.slice(s,this.pos)},ia.readWord=function(){var t=this.readWord1(),e=$s.name;return this.keywords.test(t)&&(e=Xs[t]),this.finishToken(e,t)};function oa(t){return e=t,s={ecmaVersion:2020},di.parse(e,s);var e,s}function ha(t){return["Array1D","Array2D","Literal","Symbol","UnaryOperation","BinaryOperation","Random","CallDefinedFunction","AnyFunction","ConditionalExpression"].includes(t.type)}function ca(t){switch(t.type){case"Program":return function(t){if(1!==t.body.length)throw new Error("bodyが1以外の場合評価できません。");return ca(t.body[0])}(t);case"ExpressionStatement":return function(t){return ca(t.expression)}(t);case"AssignmentExpression":return function(t){const e=ca(t.left),s=ca(t.right);if(!ha(s))throw new Error("値以外を代入式の右辺に設定できません");switch(t.operator){case"=":case"+=":case"-=":case"*=":case"/=":if("Array2D"===e.type){if("m"===e.name||"o"===e.name)return{type:"PartsAssignment",partsKind:"m"===e.name?"map":"object",destinationX:e.index0,destinationY:e.index1,value:s,operator:t.operator};throw new Error("想定していない記号が2次元配列ででてきました")}if("Array1D"===e.type){if("ITEM"===e.name)return{type:"ItemAssignment",itemBoxPosition1to12:e.index0,value:s,operator:t.operator};if("v"===e.name)return{type:"UserVariableAssignment",index:e.index0,value:s,operator:t.operator};throw new Error("")}if("Symbol"===e.type){if("m"===e.name||"o"===e.name||"v"===e.name||"ITEM"===e.name)throw new Error("このシンボルには代入できません");if("AT_TOTAL"===e.name)throw new Error('"装備品込みの攻撃力(AT_TOTAL)への代入はできません。"');if("DF_TOTAL"===e.name)throw new Error('"装備品込みの防御力(DF_TOTAL)への代入はできません。"');if("ENEMY_HP"===e.name||"ENEMY_AT"===e.name||"ENEMY_DF"===e.name||"ENEMY_GD"===e.name)throw new Error("敵ステータス (ENEMY_HP, ENEMY_AT, ENEMY_DF, ENEMY_GD) への代入はできません。");return{type:"SpecialParameterAssignment",kind:e.name,value:s,operator:t.operator}}throw"Literal"===e.type?new Error("数値には代入できません"):new Error("代入できません");default:throw new Error("想定していないオペレーターです")}}(t);case"MemberExpression":return function(t){const e=ca(t.object),s=ca(t.property);if("Symbol"===e.type){if("v"!==e.name&&"m"!==e.name&&"o"!==e.name&&"ITEM"!==e.name)throw new Error("このシンボルは配列にできません");if("Literal"===s.type||"Symbol"===s.type||"BinaryOperation"===s.type||"Array1D"===s.type)return{type:"Array1D",name:e.name,index0:s};throw new Error("WWAでは存在しない構文です")}if("Array1D"===e.type){if("ITEM"===e.name||"v"===e.name)throw new Error("この配列は2次元以上にはできません。");if("Literal"===s.type||"Symbol"===s.type||"BinaryOperation"===s.type||"Array1D"===s.type)return{type:"Array2D",name:e.name,index0:e.index0,index1:s};throw new Error("WWAでは存在しない構文です")}}(t);case"UnaryExpression":return function(t){const e=ca(t.argument);if(!["+","-","!"].includes(t.operator))throw new Error("未定義の演算子です :"+t.operator);if(!ha(e))throw new Error("単項演算子が適用できません");return{type:"UnaryOperation",operator:t.operator,argument:e}}(t);case"BinaryExpression":return function(t){const e=ca(t.left),s=ca(t.right);if(!ha(e)||!ha(s))throw new Error("左辺または右辺が評価不能です");switch(t.operator){case"+":case"-":case"*":case"/":case"%":case">":case"<":case">=":case"<=":case"==":case"!=":return{type:"BinaryOperation",operator:t.operator,left:e,right:s};default:throw new Error("未定義の演算子です :"+t.operator)}}(t);case"Identifier":return function(t){switch(t.name){case"m":case"o":case"ITEM":case"X":case"Y":case"PX":case"PY":case"v":case"HP":case"HPMAX":case"AT":case"AT_TOTAL":case"DF":case"DF_TOTAL":case"GD":case"STEP":case"TIME":case"PDIR":case"i":case"j":case"k":case"LOOPLIMIT":case"ITEM_ID":case"ITEM_POS":case"ENEMY_HP":case"ENEMY_AT":case"ENEMY_DF":return{type:"Symbol",name:t.name};default:throw new Error("未定義のシンボルです :\n"+t.name)}}(t);case"Literal":return function(t){return{type:"Literal",value:t.value}}(t);case"CallExpression":return function(t){const e=t.callee.name;switch(e){case"RAND":return function(t){if(t.length<1)throw new Error("RAND関数には引数が必要です。");return{type:"Random",value:ca(t[0])}}(t.arguments);case"JUMPGATE":return function(t){if(t.length<2)throw new Error("RAND関数には引数が2つ必要です。");const e={x:t[0],y:t[1]};return{type:"Jumpgate",x:ca(e.x),y:ca(e.y)}}(t.arguments);case"MSG":case"MESSAGE":return{type:"Msg",value:ca(t.arguments[0])};case"SOUND":case"SAVE":case"LOG":case"ABLE_CHANGE_SPEED":case"SET_SPEED":case"CHANGE_GAMEOVER_POS":case"DEL_PLAYER":case"RESTART_GAME":case"URL_JUMPGATE":case"HIDE_STATUS":case"PARTS":case"FACE":case"EFFECT":case"CHANGE_PLAYER_IMAGE":case"HAS_ITEM":case"REMOVE_ITEM":case"MOVE":case"IS_PLAYER_WAITING_MESSAGE":case"GET_UNIXTIME":case"GET_DATE_YEAR":case"GET_DATE_MONTH":case"GET_DATE_DAY":case"GET_DATE_HOUR":case"GET_DATE_MINUTES":case"GET_DATE_SECONDS":case"GET_DATE_MILLISECONDS":case"GET_DATE_WEEKDAY":case"CHANGE_SYSMSG":case"PICTURE":case"SHOW_USER_DEF_VAR":case"ABS":case"GET_GAMEOVER_POS_X":case"GET_GAMEOVER_POS_Y":case"ABORT_BATTLE":case"EXIT":return function(t,e){return{type:"AnyFunction",functionName:e,value:t.map((t=>ca(t)))}}(t.arguments,e);default:return{type:"CallDefinedFunction",functionName:e}}}(t);case"IfStatement":return function(t){const e=ca(t.consequent),s=ca(t.test);return{type:"IfStatement",consequent:e,test:s,alternate:t.alternate?ca(t.alternate):void 0}}(t);case"BlockStatement":return function(t){return{type:"BlockStatement",value:t.body.map((t=>ca(t)))}}(t);case"FunctionDeclaration":return function(t){return{type:"DefinedFunction",functionName:t.id.name,body:ca(t.body)}}(t);case"ForStatement":return function(t){const e=t.body.body.map((t=>ca(t)));return{type:"ForStatement",body:e,init:ca(t.init),test:ca(t.test),update:ca(t.update)}}(t);case"BreakStatement":return function(t){return{type:"Break",label:t.label}}(t);case"ReturnStatement":return function(t){return{type:"Return",argument:ca(t.argument)}}(t);case"ContinueStatement":return function(t){return{type:"Continue",label:t.label}}(t);case"UpdateExpression":return function(t){return{type:"UpdateExpression",operator:t.operator,argument:ca(t.argument)}}(t);case"LogicalExpression":return function(t){return{type:"LogicalExpression",operator:t.operator,left:ca(t.left),right:ca(t.right)}}(t);case"TemplateLiteral":return function(t){return{type:"TemplateLiteral",expressions:t.expressions.map((t=>ca(t))),quasis:t.quasis.map((t=>ca(t)))}}(t);case"TemplateElement":return function(t){return{type:"TemplateElement",value:t.value}}(t);case"ConditionalExpression":return function(t){const e=ca(t.consequent),s=ca(t.alternate),i=ca(t.test);return{type:"ConditionalExpression",consequent:e,test:i,alternate:s}}(t);default:throw console.log(t),new Error("未定義の AST ノードです :"+t.type)}}di.acorn={Parser:di,version:"7.4.1",defaultOptions:_i,Position:oi,SourceLocation:hi,getLineInfo:ci,Node:Oi,TokenType:Gs,tokTypes:$s,keywordTypes:Xs,TokContext:bi,tokContexts:Li,isIdentifierChar:Ys,isIdentifierStart:Fs,Token:sa,isNewLine:zs,lineBreak:Zs,lineBreakG:qs,nonASCIIwhitespace:Qs};class _a{constructor(t){this.wwa=t,this.loop_limit=1e5,this.state={}}setEarnedItem(t,e){this.state={...this.state,earnedItem:{partsId:t,itemPos:e}}}clearEarnedItem(){this.state={...this.state,earnedItem:void 0}}setBattleDamageCalculationMode(t){this.state={...this.state,battleDamageCalculation:{estimatingParams:t}}}clearBattleDamageCalculationMode(){this.state={...this.state,battleDamageCalculation:void 0}}evalWwaNodes(t){return this.evalWwaNode({type:"BlockStatement",value:t})}evalWwaNode(t){if("BlockStatement"!==t.type||!Array.isArray(t.value)||0!==t.value.length)try{return new la(this).evalWwaNode(t)}catch(t){if(t instanceof ua||t instanceof da)return t.value;throw t}}updateLoopLimit(t){this.loop_limit=t}}class la{constructor(t){this.generator=t,this.for_id={i:null,j:null,k:null,loopCount:0,break_flag:!1,continue_flag:!1}}evalWwaNodes(t){let e;return t.forEach((t=>{e=this.evalWwaNode(t)})),e}evalWwaNode(t){if(!this.for_id.break_flag&&!this.for_id.continue_flag)switch(t.type){case"UnaryOperation":return this.evalUnaryOperation(t);case"BinaryOperation":return this.evalBinaryOperation(t);case"Symbol":return this.evalSymbol(t);case"Array1D":return this.evalArray1D(t);case"Array2D":return this.evalArray2D(t);case"Literal":return this.evalNumber(t);case"UserVariableAssignment":return this.evalSetUserVariable(t);case"SpecialParameterAssignment":return this.evalSetSpecialParameter(t);case"Random":return this.evalRandom(t);case"Jumpgate":return this.evalJumpgate(t);case"Msg":return this.evalMessage(t);case"ItemAssignment":return this.itemAssignment(t);case"IfStatement":return this.ifStatement(t);case"BlockStatement":return this.blockStatement(t);case"PartsAssignment":return this.partsAssignment(t);case"ForStatement":return this.forStateMent(t);case"AnyFunction":return this.wrapCallFunction(t,(t=>this.evalAnyFunction(t)));case"CallDefinedFunction":return this.wrapCallFunction(t,(t=>this.callDefinedFunction(t)));case"Break":return this.breakStatement(t);case"Return":throw new ua(this.returnStatement(t));case"Continue":return this.contunueStatment(t);case"UpdateExpression":return this.updateExpression(t);case"LogicalExpression":return this.logicalExpression(t);case"TemplateLiteral":return this.convertTemplateLiteral(t);case"ConditionalExpression":return this.convertConditionalExpression(t);default:throw console.log(t),new Error("未定義または未実装のノードです")}}wrapCallFunction(t,e){try{return e(t)}catch(t){if(t instanceof ua)return t.value;throw t}}callDefinedFunction(t){const e=this.generator.wwa.getUserScript(t.functionName);if(null===e)throw new Error(`未定義の関数が呼び出されました: ${t.functionName}`);return this.evalWwaNode(e)}updateExpression(t){if("Symbol"!==t.argument.type)throw console.log(t),new Error("node.argument.typeがSymbolではありません。:"+t.argument.type);{const e=this.evalSymbol(t.argument),s=(()=>{switch(t.operator){case"++":return e+1;case"--":return e-1;default:throw new Error("想定外のOperatorが渡されました :"+t.operator)}})(),i={type:"SpecialParameterAssignment",kind:t.argument.name,value:{type:"Literal",value:s}};this.evalSetSpecialParameter(i)}}logicalExpression(t){const e=this.evalWwaNode(t.left),s=this.evalWwaNode(t.right);switch(t.operator){case"||":return e||s;case"&&":return e&&s;default:throw new Error("存在しない論理式です!: "+t.operator)}}convertTemplateLiteral(t){const e=t.expressions.map((t=>this.evalWwaNode(t))),s=t.quasis.map((t=>t.value.cooked));let i="";return s.forEach(((t,s)=>{i+=t,e[s]&&(i+=e[s])})),i}contunueStatment(t){this.for_id.continue_flag=!0}breakStatement(t){this.for_id.break_flag=!0}returnStatement(t){return this.evalWwaNode(t.argument)}forStateMent(t){const e=t.init;for((()=>{switch(e.kind){case"i":if(null!==this.for_id.i)throw new Error("iの値が既に外側のforループで使われています。");break;case"j":if(null!==this.for_id.j)throw new Error("jの値が既に外側のforループで使われています。");break;case"k":if(null!==this.for_id.k)throw new Error("kの値が既に外側のforループで使われています。");break;default:throw new Error("予想外の変数がfor文内で使用されました :"+e.kind)}this.evalWwaNode(t.init)})();this.evalWwaNode(t.test);this.evalWwaNode(t.update)){if(this.for_id.loopCount++,this.for_id.loopCount>this.generator.loop_limit)throw new Error("処理回数が多すぎます!\n上限値は LOOPLIMIT で変えられます。");if(this.for_id.break_flag)break;if(!this.evalWwaNode(t.test))break;this.evalWwaNodes(t.body),this.for_id.continue_flag=!1}switch(this.for_id.break_flag=!1,e.kind){case"i":this.for_id.i=null;break;case"j":this.for_id.j=null;break;case"k":this.for_id.k=null}}_checkArgsLength(t,e){if(e.value.length<t)throw new Error(`関数 ${e.functionName} の引数が不足しています!`)}evalAnyFunction(t){const e=this.generator.wwa.getGameStatus();switch(t.functionName){case"SOUND":{this._checkArgsLength(1,t);const e=this.evalWwaNode(t.value[0]);return this.generator.wwa.playSound(e),e}case"SAVE":{this._checkArgsLength(1,t);const e=Boolean(this.evalWwaNode(t.value[0]));return this.generator.wwa.disableSave(e),e}case"LOG":{this._checkArgsLength(1,t);const e=this.evalWwaNode(t.value[0]);return void console.log(e)}case"ABLE_CHANGE_SPEED":{this._checkArgsLength(1,t);const e=Boolean(this.evalWwaNode(t.value[0]));return this.generator.wwa.speedChangeJudge(e),e}case"SET_SPEED":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0]));return void this.generator.wwa.setPlayerSpeedIndex(e)}case"CHANGE_GAMEOVER_POS":{this._checkArgsLength(2,t);const e={x:Number(this.evalWwaNode(t.value[0])),y:Number(this.evalWwaNode(t.value[1]))};if(e.x<0||e.x>=this.generator.wwa.getMapWidth()||e.y<0||e.y>this.generator.wwa.getMapWidth())throw new Error("マップの範囲外が指定されています!");return void this.generator.wwa.setGameOverPosition(new c(e.x,e.y))}case"DEL_PLAYER":{this._checkArgsLength(1,t);const e=Boolean(this.evalWwaNode(t.value[0]));return void this.generator.wwa.setDelPlayer(e)}case"RESTART_GAME":return void this.generator.wwa.restartGame();case"URL_JUMPGATE":throw new Error("URL_JUMPGATE 関数は調整中のためご利用になれません");case"HIDE_STATUS":{this._checkArgsLength(2,t);const e=Number(this.evalWwaNode(t.value[0])),s=Boolean(this.evalWwaNode(t.value[1]));return void this.generator.wwa.hideStatus(e,s)}case"PARTS":{this._checkArgsLength(2,t);const e=Number(this.evalWwaNode(t.value[0])),s=Number(this.evalWwaNode(t.value[1]));let i=t.value[2]?Number(this.evalWwaNode(t.value[2])):0,a=!t.value[3]||Boolean(this.evalWwaNode(t.value[3]));const r=[v.OBJECT,v.MAP];if(e<0||s<0)throw new Error("パーツ番号が不正です");if(!r.includes(i))throw new Error("パーツ種別が不明です");return void this.generator.wwa.replaceParts(e,s,i,a)}case"FACE":{this._checkArgsLength(6,t);const e=Number(this.evalWwaNode(t.value[0])),s=Number(this.evalWwaNode(t.value[1])),i=Number(this.evalWwaNode(t.value[2])),a=Number(this.evalWwaNode(t.value[3])),r=Number(this.evalWwaNode(t.value[4])),n=Number(this.evalWwaNode(t.value[5]));if(e<0||s<0||i<0||a<0||r<0||n<0)throw new Error("各引数は0以上の整数でなければなりません。");return void this.generator.wwa.addFace(new l(new c(e,s),new c(i,a),new c(r,n)))}case"EFFECT":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0]));if(e<0)throw new Error("待ち時間は0以上の整数でなければなりません。");if(0===e)return void this.generator.wwa.stopEffect();const s=[];for(let e=1;e<t.value.length;e+=2){const i=Number(this.evalWwaNode(t.value[e]));if(i<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");if(e+1===t.value.length)throw new Error("画像のパーツ座標指定で、Y座標が指定されていません。");const a=Number(this.evalWwaNode(t.value[e+1]));if(a<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");s.push(new c(i,a))}return void this.generator.wwa.setEffect(e,s)}case"CHANGE_PLAYER_IMAGE":{this._checkArgsLength(2,t);const e=Number(this.evalWwaNode(t.value[0])),s=Number(this.evalWwaNode(t.value[1])),i=new c(e,s);return void this.generator.wwa.setPlayerImgCoord(i)}case"HAS_ITEM":{this._checkArgsLength(1,t);const s=Number(this.evalWwaNode(t.value[0]));return e.itemBox.includes(s)}case"REMOVE_ITEM":{this._checkArgsLength(1,t);const s=Number(this.evalWwaNode(t.value[0])),i=!!t.value[1]&&1===this.evalWwaNode(t.value[1]);let a=0;for(let t=0;t<e.itemBox.length;t++)if(s===e.itemBox[t]&&(this.generator.wwa.setPlayerGetItem(t+1,0),a++,!i))return a;return a}case"MOVE":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0]));if(e<=0||e>9)throw Error("MOVEの移動先は2/4/6/8で指定してください!");return this.generator.wwa.movePlayer(e),this.generator.wwa.movePlayer(e),0}case"IS_PLAYER_WAITING_MESSAGE":return this.generator.wwa.isPlayerWaitingMessage();case"GET_UNIXTIME":return Math.floor((new Date).getTime()/1e3);case"GET_DATE_YEAR":return(new Date).getFullYear();case"GET_DATE_MONTH":return(new Date).getMonth()+1;case"GET_DATE_DAY":return(new Date).getDate();case"GET_DATE_HOUR":return(new Date).getHours();case"GET_DATE_MINUTES":return(new Date).getMinutes();case"GET_DATE_SECONDS":return(new Date).getSeconds();case"GET_DATE_MILLISECONDS":return(new Date).getMilliseconds();case"GET_DATE_WEEKDAY":return(new Date).getDay();case"SHOW_USER_DEF_VAR":return void console.log(this.generator.wwa.getAllUserNameVar());case"CHANGE_SYSMSG":{this._checkArgsLength(1,t);const e=this.evalWwaNode(t.value[0]),s=t.value.length>=2?this.evalWwaNode(t.value[1]):void 0,i=this.resolveSystemMessageKeyFromMacroArg(e);if(!i)throw new Error("このIDのシステムメッセージは未定義です。");if("number"==typeof s||"string"==typeof s||"boolean"==typeof s)this.generator.wwa.overwriteSystemMessage(i,String(s));else{if(null!=s)throw new Error("この値は文字列に変換できないため、システムメッセージを表示できません。");this.generator.wwa.overwriteSystemMessage(i,void 0)}break}case"PICTURE":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0])),s=t.value.length>=2?this.evalWwaNode(t.value[1]):void 0;if(void 0===s)return void this.generator.wwa.deletePictureRegistry(e);if("string"!=typeof s)throw new Error("ピクチャのプロパティ定義は文字列である必要があります。");this.generator.wwa.setPictureRegistryFromRawText(e,s);break}case"ABS":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0]));return Math.abs(e)}case"GET_GAMEOVER_POS_X":return this.generator.wwa.getGemeOverPosition().x;case"GET_GAMEOVER_POS_Y":return this.generator.wwa.getGemeOverPosition().y;case"ABORT_BATTLE":throw this.generator.state.battleDamageCalculation&&(this.generator.state.battleDamageCalculation.aborted=!0),new da("ABORT_BATTLE");case"EXIT":throw new da("EXIT",this.evalWwaNode(t.value[0]));default:throw new Error("未定義の関数が指定されました: "+t.functionName)}}resolveSystemMessageKeyFromMacroArg(t){return"string"==typeof t?r(t)?t:void 0:"number"==typeof t?n(t):void 0}partsAssignment(t){const e=this.generator.wwa.getGameStatus(),s=this.evalWwaNode(t.destinationX),i=this.evalWwaNode(t.destinationY),a=this.evalWwaNode(t.value),r="map"===t.partsKind?v.MAP:v.OBJECT;this.generator.wwa.appearPartsEval(e.playerCoord,s,i,a,r)}blockStatement(t){return this.evalWwaNodes(t.value)}ifStatement(t){return this.evalWwaNode(t.test)?this.evalWwaNode(t.consequent):t.alternate?this.evalWwaNode(t.alternate):void 0}convertConditionalExpression(t){const e=this.evalWwaNode(t.test)?t.consequent:t.alternate;return this.evalWwaNode(e)}itemAssignment(t){const e=this.evalWwaNode(t.itemBoxPosition1to12),s=this.evalWwaNode(t.value);this.generator.wwa.setPlayerGetItem(e,s)}evalMessage(t){const e=this.evalWwaNode(t.value),s=isNaN(e)?e:e.toString();this.generator.wwa.reserveMessageDisplayWhenShouldOpen(s)}evalJumpgate(t){const e=this.evalWwaNode(t.x),s=this.evalWwaNode(t.y);if(isNaN(e)||isNaN(s))throw new Error(`飛び先の値が数値になっていません。 x=${e} / y=${s}`);this.generator.wwa.forcedJumpGate(e,s)}evalRandom(t){const e=this.evalWwaNode(t.value);return Math.floor(Math.random()*e)}evalSetSpecialParameter(t){const e=this.evalWwaNode(t.value);if(!this.generator.wwa||isNaN(e))return e;const s=this.evalSymbol({type:"Symbol",name:t.kind}),i=(()=>{switch(t.operator){case"+=":return s+e;case"-=":return s-e;case"*=":return s*e;case"/=":return s/e;default:return e}})();switch(t.kind){case"PX":return this.generator.wwa.jumpSpecifiedXPos(i),i;case"PY":return this.generator.wwa.jumpSpecifiedYPos(i),i;case"AT":return this.generator.wwa.setPlayerStatus(b.STRENGTH,i,!1),i;case"DF":return this.generator.wwa.setPlayerStatus(b.DEFENCE,i,!1),i;case"GD":return this.generator.wwa.setPlayerStatus(b.GOLD,i,!1),i;case"HP":return this.generator.wwa.setPlayerStatus(b.ENERGY,i,!1),i;case"HPMAX":return this.generator.wwa.setPlayerEnergyMax(i),i;case"i":return this.for_id.i=this.evalWwaNode(t.value),this.for_id.i;case"j":return this.for_id.j=this.evalWwaNode(t.value),this.for_id.j;case"k":return this.for_id.k=this.evalWwaNode(t.value),this.for_id.k;case"LOOPLIMIT":{const e=this.evalWwaNode(t.value);return this.generator.updateLoopLimit(e),e}default:return void console.error("未実装の要素です: "+t.kind)}}evalSetUserVariable(t){const e=this.evalWwaNode(t.value);if(!this.generator.wwa)return e;const s=this.evalWwaNode(t.index);return this.generator.wwa.setUserVar(s,e,t.operator),e}evalUnaryOperation(t){switch(t.operator){case"+":return this.evalWwaNode(t.argument);case"-":return-this.evalWwaNode(t.argument);case"!":return!this.evalWwaNode(t.argument);default:throw new Error("存在しない単項演算子です")}}evalBinaryOperation(t){const e=this.evalWwaNode(t.left),s=this.evalWwaNode(t.right);switch(t.operator){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return 0===s?0:Math.floor(e/s);case"%":return 0===s?0:e%s;case">":return e>s;case">=":return e>=s;case"<":return e<s;case"<=":return e<=s;case"==":return e==s;case"!=":return e!=s;default:throw new Error("存在しない単項演算子です")}}evalSymbol(t){var e,s,i,a,r,n,o,h,c,_,l,u,d,p,m,E,g,w,f,v,y,S,A,T,I,C,D,P;const N=this.generator.wwa.getGameStatus(),O=this.generator.wwa.getEnemyStatus();switch(t.name){case"X":case"Y":return 0;case"PX":return N.playerCoord.x;case"PY":return N.playerCoord.y;case"AT":return N.bareStatus.strength;case"AT_TOTAL":return null!==(i=null===(s=null===(e=this.generator.state.battleDamageCalculation)||void 0===e?void 0:e.estimatingParams)||void 0===s?void 0:s.playerStatus.strength)&&void 0!==i?i:N.totalStatus.strength;case"DF":return N.bareStatus.defence;case"DF_TOTAL":return null!==(n=null===(r=null===(a=this.generator.state.battleDamageCalculation)||void 0===a?void 0:a.estimatingParams)||void 0===r?void 0:r.playerStatus.defence)&&void 0!==n?n:N.totalStatus.defence;case"GD":return null!==(c=null===(h=null===(o=this.generator.state.battleDamageCalculation)||void 0===o?void 0:o.estimatingParams)||void 0===h?void 0:h.playerStatus.gold)&&void 0!==c?c:N.totalStatus.gold;case"HP":return null!==(u=null===(l=null===(_=this.generator.state.battleDamageCalculation)||void 0===_?void 0:_.estimatingParams)||void 0===l?void 0:l.playerStatus.energy)&&void 0!==u?u:N.totalStatus.energy;case"HPMAX":return N.energyMax;case"STEP":return N.moveCount;case"TIME":return N.playTime;case"PDIR":return N.playerDirection;case"i":return this.for_id.i;case"j":return this.for_id.j;case"k":return this.for_id.k;case"LOOPLIMIT":return this.generator.loop_limit;case"ITEM_ID":return null!==(p=null===(d=this.generator.state.earnedItem)||void 0===d?void 0:d.partsId)&&void 0!==p?p:-1;case"ITEM_POS":return null!==(E=null===(m=this.generator.state.earnedItem)||void 0===m?void 0:m.itemPos)&&void 0!==E?E:-1;case"ENEMY_HP":return null!==(f=null===(w=null===(g=this.generator.state.battleDamageCalculation)||void 0===g?void 0:g.estimatingParams)||void 0===w?void 0:w.enemyStatus.energy)&&void 0!==f?f:"number"==typeof O?-1:O.energy;case"ENEMY_AT":return null!==(S=null===(y=null===(v=this.generator.state.battleDamageCalculation)||void 0===v?void 0:v.estimatingParams)||void 0===y?void 0:y.enemyStatus.strength)&&void 0!==S?S:"number"==typeof O?-1:O.strength;case"ENEMY_DF":return null!==(I=null===(T=null===(A=this.generator.state.battleDamageCalculation)||void 0===A?void 0:A.estimatingParams)||void 0===T?void 0:T.enemyStatus.defence)&&void 0!==I?I:"number"==typeof O?-1:O.defence;case"ENEMY_GD":return null!==(P=null===(D=null===(C=this.generator.state.battleDamageCalculation)||void 0===C?void 0:C.estimatingParams)||void 0===D?void 0:D.enemyStatus.gold)&&void 0!==P?P:"number"==typeof O?-1:O.gold;default:throw new Error("このシンボルは取得できません")}}evalArray1D(t){const e=this.evalWwaNode(t.index0);if("number"!=typeof e){if("v"===t.name)return this.generator.wwa.getUserNameVar(e);throw new Error("このシンボルは取得できません")}const s=this.generator.wwa.getGameStatus();switch(t.name){case"v":return this.generator.wwa.getUserVar(e);case"ITEM":if(void 0===s.itemBox[e])throw new Error("ITEMの添字に想定外の値が入っています。: "+e);return s.itemBox[e];default:throw new Error("このシンボルは取得できません")}}evalArray2D(t){switch(t.name){case"m":case"o":const e=this.evalWwaNode(t.index0),s=this.evalWwaNode(t.index1),i="o"===t.name?v.OBJECT:v.MAP;return this.generator.wwa.getPartsID(new c(e,s),i);default:throw new Error("このシンボルは取得できません")}}evalNumber(t){return t.value}}class ua{constructor(t){this.value=t}}class da{constructor(t,e){this.reason=t,this.value=e}}const pa="user-variable-label";const ma="-",Ea="user-variable-card";function ga({index:t,value:e}){const s=document.createElement("div");return s.classList.add(Ea),s.dataset.varIndex=String(t),s.appendChild(function(t){const e=document.createElement("div");e.classList.add("index"),e.textContent=String(t),"string"==typeof t&&e.setAttribute("title",t);return e.appendChild(function(){const t=document.createElement("div");return t.textContent="-",t.setAttribute("aria-hidden","true"),t.classList.add(pa),t}()),e}(t)),s.appendChild(function(t){const e=document.createElement("div");e.classList.add("value"),"string"==typeof t&&e.setAttribute("title",At(t));return wa(e,t),e}(e)),s}function wa(t,e){t.textContent=void 0===e?ma:At(e)}const fa="user-variable-list";function va({index:t,value:e}){const s=document.createElement("li");return s.appendChild(ga({index:t,value:e})),s}function ya(t,{index:e,value:s}){t.appendChild(va({index:e,value:s}))}const Sa="information";function Aa(t,e,s=!1){t.textContent=`${s?"【エラー】":""}${e}`}function Ta({heading:t,contentVisibilityToggleButton:e,information:s}){const i=document.createElement("header");return i.appendChild(function({heading:t,contentVisibilityToggleButton:e}){const s=document.createElement("div");s.classList.add("heading-area");const i=document.createElement("h2");i.textContent=t.text,s.appendChild(i);const a=document.createElement("button");a.classList.add("content-visibility-toggle-button"),Ia(a,!0),e.onClick&&a.addEventListener("click",e.onClick.bind(a));return s.appendChild(a),s}({heading:t,contentVisibilityToggleButton:e})),s&&i.appendChild(function(){const t=document.createElement("p");return t.classList.add(Sa),Aa(t,"強調されている番号にカーソルを乗せると説明が表示されます。"),t}()),i}function Ia(t,e){t.textContent=e?"▲隠す":"▼表示"}const Ca="user-variable-list-section";function Da({kind:t}){const e=document.createElement("section");e.classList.add(Ca),e.dataset.kind=t;const s=function({kind:t}){const e=document.createElement("ul");return e.classList.add(fa),"numbered"===t&&Array.from({length:V.USER_VAR_NUM}).map(((t,e)=>va({index:e}))).forEach((t=>e.appendChild(t))),e}({kind:t}),i=Ta({heading:{text:"named"===t?"名前つき変数一覧":"変数一覧"},information:"numbered"===t?{}:void 0,contentVisibilityToggleButton:{onClick:t=>{const e=i.querySelector(`.${Sa}`);"true"===s.getAttribute("aria-hidden")?function(t,e,s){t.removeAttribute("aria-hidden"),e instanceof HTMLElement&&e.removeAttribute("aria-hidden");s instanceof HTMLElement&&Ia(s,!0)}(s,e,t.target):function(t,e,s){t.setAttribute("aria-hidden","true"),e instanceof HTMLElement&&e.setAttribute("aria-hidden","true");s instanceof HTMLElement&&Ia(s,!1)}(s,e,t.target)}}});return e.appendChild(i),e.appendChild(s),e}function Pa(t,e){t instanceof HTMLElement&&Array.from({length:V.USER_VAR_NUM}).map(((s,i)=>{const a=function(t,e){return t.querySelector(`${xa(e)} > .value`)}(t,i);a instanceof HTMLElement&&wa(a,e[i])}))}function Na(t,e){t&&Array.from({length:V.USER_VAR_NUM}).map(((s,i)=>{const a=e[i];if(!a)return;const r=function(t,e){return t.querySelector(`${xa(e)} > .index`)}(t,i);if(!(r instanceof HTMLElement))return;const n=r.querySelector(`.${pa}`);n instanceof HTMLElement&&(function(t,e){t.textContent=e}(n,a),function(t,e){t.dataset.labelledVarIndex="true",t.addEventListener("mouseover",(()=>e.removeAttribute("aria-hidden"))),t.addEventListener("mouseleave",(()=>e.setAttribute("aria-hidden","true")))}(r,n))}))}function Oa(t,e,s=!1){if(!t)return;const i=function(t){return t.querySelector(`.${Ma} > header > .${Sa}`)}(t);i instanceof HTMLElement&&Aa(i,e,s)}const Ma=`.${Ca}[data-kind="numbered"]`;function xa(t){return`${Ma} > .${fa} > li > .${Ea}[data-var-index="${CSS.escape(String(t))}"]`}function ba(t,e){if(!(t instanceof HTMLElement))return;const s=function(t){return new Set([...t.querySelectorAll(Ra)].map((t=>t instanceof HTMLElement?t.dataset.varIndex:void 0)).filter(Boolean))}(t),i=Ua(t);if(i instanceof HTMLElement){for(const[a,r]of e){const e=Wa(t,a);s.delete(a),e instanceof HTMLElement?wa(e,r):ya(i,{index:a,value:r})}for(const e of s){const s=ka(t,e).parentElement;s instanceof HTMLLIElement&&Ua(t).removeChild(s)}}}const La=`.${Ca}[data-kind="named"]`,Ra=`${La} > .${fa} > li > .${Ea}`;function Ba(t){return`${Ra}[data-var-index="${CSS.escape(t)}"]`}function Ua(t){return t.querySelector(`${La} > .${fa}`)}function ka(t,e){return t.querySelector(Ba(e))}function Wa(t,e){return t.querySelector(`${Ba(e)} > .value`)}const Va="wwa-vardump-wrapper";let Fa;function Ya(t,e,s){var i=new G;return i.current=t,i.total=e,i.stage=s,i}class Ga{constructor(t,e=!1,s,a,r,n,o="",l=!1,u=null,m,E,w=!1,f=null,v){var C;this._useSuspend=!1,this._useLookingAround=!0,this._isDisallowLoadOldSave=!1,this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0,this._windowCloseWaitingMessageDisplayRequests=[],this._playerAndObjectsStopWaitingMessageDisplayRequests=[],this._windowCloseWaitingJumpGateRequest=void 0,this._debugConsoleElement=void 0,this.audioExtension="",this.soundLoadedCheckTimer=void 0,this._playTimeCalculator=void 0,this.userDefinedFunctions={},this.convertWwaNodes=t=>function(t){if("Program"===t.type)return t.body.map((t=>ca(t)));return[ca(t)]}(oa(t)),this.mainCaller=()=>this._main(),this.soundCheckCaller=()=>this.checkAllSoundLoaded(),this._checkTurnKeyPressed=()=>this._keyStore.checkHitKey(q.KEY_ESC)||this._keyStore.checkHitKey(q.KEY_SHIFT)||this._keyStore.checkHitKey(q.KEY_N),this._saveDataList=[],this.wwaCustomEventEmitter=new Ns(dt("wwa-wrapper")),window.addEventListener("click",(t=>{this._isActive=!1})),dt("wwa-wrapper").addEventListener("click",(t=>{t.stopPropagation(),this._isActive=!0})),this._isActive=!0,null===s?(this._hasTitleImg=!1,this._cvsCover=dt("progress-panel"),(C=this._cvsCover.getContext("2d")).fillStyle="rgb(0, 0, 0)"):this._hasTitleImg=!0;try{this._hasTitleImg?(dt("unstable-version-warning").textContent="この WWA Wing は [不安定版] です。",dt("version").textContent="WWA Wing Ver.4.1.0-unstable.based-on.3.12.11.p.2"):this._setLoadingMessage(C,0)}catch(t){}this._dumpElement=u;const D=window.AudioContext||window.webkitAudioContext;D&&(this.audioContext=new D,this.audioGain=this.audioContext.createGain(),this.audioGain.gain.setValueAtTime(1,this.audioContext.currentTime));var P=new Audio;"no"!==P.canPlayType("audio/mpeg")&&""!==P.canPlayType("audio/mpeg")?this.audioExtension="mp3":this.audioExtension="m4a",this.userDevice=new O,this._isURLGateEnable=e,this._isClassicModeEnable=a,this._mainCallCounter=0,this._animationCounter=0,this._statusPressCounter=new h(0,0,0,0),o?"/"!==o[o.length-1]&&(o+="/"):o="./audio/",this._audioDirectory=o,this._bottomButtonType=n?d.GOTO_WWA:d.BATTLE_REPORT;var N=(new Date).getTime();if(!!location.href.match(/^file/))if(this.userDevice.device===S.GAME){if(this.userDevice.os===y.NINTENDO)V.BATTLE_INTERVAL_FRAME_NUM=5;this._bottomButtonType=d.GAME_END}else alert("【警告】直接HTMLファイルを開いているようです。\nこのプログラムは正常に動作しない可能性があります。\nマップデータの確認を行う場合には同梱の「wwa-server.exe」をご利用ください。\n"+(this.userDevice.browser===A.FIREFOX?"Firefoxの場合も、バージョン68以降はローカルのHTMLファイルを直接開いた場合、通常起動できないことを確認しております。":""));switch(this.userDevice.device){case S.VR:case S.GAME:this._usePassword=!1;break;default:this._usePassword=!0}switch(dt("cell-save").textContent=Y.QUICK_SAVE,this._usePassword?dt("cell-load").textContent=Y.PASSWORD:dt("cell-load").textContent=Y.EMPTY_LOAD,this._bottomButtonType){case d.GOTO_WWA:dt("cell-gotowwa").textContent=Y.GOTO_WWA;break;case d.BATTLE_REPORT:dt("cell-gotowwa").textContent=Y.BATTLE_REPORT;break;case d.GAME_END:dt("cell-gotowwa").textContent=Y.GAME_END}this._loadHandler=t=>{var e;this._wwaData=t,this._wwaData.isItemEffectEnabled=r;try{this._hasTitleImg?dt("version").textContent+=" (Map data Ver. "+Math.floor(this._wwaData.version/10)+"."+ +this._wwaData.version%10+")":this._setLoadingMessage(C,1)}catch(t){}var s=dt("wwa-wrapper").getAttribute("data-wwa-mapdata").split("/");s.pop(),s.push(this._wwaData.mapCGName),this._wwaData.mapCGName=s.join("/"),this._playTimeCalculator=new ot,this._restartData=JSON.parse(JSON.stringify(this._wwaData)),this.checkOriginalMapString=this._generateMapDataHash(this._restartData),this.initCSSRule(),this._setProgressBar(Ya(0,4,H.GAME_INIT)),this._setLoadingMessage(C,2);var a=new Image;a.src=this._wwaData.mapCGName,a.addEventListener("error",(()=>{this._setErrorMessage("画像ファイル「"+this._wwaData.mapCGName+"」が見つかりませんでした。\n管理者の方へ: データがアップロードされているか、\nパーミッションを確かめてください。",C)}));var n=this._wwaData.mapCGName.replace("(","\\(").replace(")","\\)");const o=t=>{t.style.backgroundImage="url("+n+")"};Array.prototype.forEach.call(gt("div.item-cell"),(t=>{t.style.backgroundPosition=`-${this._wwaData.imgItemboxX*V.CHIP_SIZE}px -${this._wwaData.imgItemboxY*V.CHIP_SIZE}px`,t.style.backgroundImage="url("+n+")"})),Array.prototype.forEach.call(gt("div.wide-cell-row"),(t=>{t.style.backgroundPosition="-160px -120px",t.style.backgroundImage="url("+n+")"})),Array.prototype.forEach.call(gt(".item-cell>.item-click-border"),(t=>{t.style.backgroundImage="url('"+V.ITEM_BORDER_IMG_DATA_URL+"')",t.style.backgroundPosition="0 0",t.style.display="none",t.style.cursor="pointer"})),Array.prototype.forEach.call(gt(".item-cell>.item-disp"),o),Array.prototype.forEach.call(gt("div.wide-cell-row>.status-icon"),o),this.setStatusIconCoord(L.ENERGY,new c(this._wwaData.imgStatusEnergyX,this._wwaData.imgStatusEnergyY)),this.setStatusIconCoord(L.STRENGTH,new c(this._wwaData.imgStatusStrengthX,this._wwaData.imgStatusStrengthY)),this.setStatusIconCoord(L.DEFENCE,new c(this._wwaData.imgStatusDefenceX,this._wwaData.imgStatusDefenceY)),this.setStatusIconCoord(L.GOLD,new c(this._wwaData.imgStatusGoldX,this._wwaData.imgStatusGoldY)),this._setProgressBar(Ya(1,4,H.GAME_INIT)),this._setLoadingMessage(C,3),this._mapIDTableCreate(),this._replaceAllRandomObjects();var u=(new Date).getTime();console.log("Loading Complete!"+(u-N)+"ms"),this._cvs=dt("wwa-map");var d=this._cvs.getContext("2d",{alpha:!1});d.fillStyle="rgba( 255, 255, 255, 0.5)",d.fillRect(0,0,440,440);var m=new _(this,this._wwaData.playerX,this._wwaData.playerY);this._camera=new Ae(m),this._itemMenu=new Ze;var A=new h(this._wwaData.statusEnergy,this._wwaData.statusStrength,this._wwaData.statusDefence,this._wwaData.statusGold);this._player=new De(this,m,this._camera,A,this._wwaData.statusEnergyMax,this._wwaData.moves,this._wwaData.gameSpeedIndex),this._userVar={numbered:Array.from({length:V.USER_VAR_NUM}).map((()=>0)),named:new Map},this._objectMovingDataManager=new Oe(this,this._player),this._camera.setPlayer(this._player),this._keyStore=new at,this._mouseStore=new rt,w?(this._virtualPadButtonElements={BUTTON_ENTER:dt("wwa-enter-button"),BUTTON_ESC:dt("wwa-esc-button"),BUTTON_FAST:dt("wwa-fast-button"),BUTTON_SLOW:dt("wwa-slow-button"),BUTTON_LEFT:dt("wwa-left-button"),BUTTON_UP:dt("wwa-up-button"),BUTTON_RIGHT:dt("wwa-right-button"),BUTTON_DOWN:dt("wwa-down-button")},this._virtualPadStore=new lt(this._virtualPadButtonElements,Je(),dt("wwa-virtualpad-right"),dt("wwa-virtualpad-left"),this._setVirtualPadTouch.bind(this),this._setVirtualPadLeave.bind(this)),function(t,e){if(null===t)return;const s=document.createElement("button");s.classList.add("wwa-virtualpad-toggle-button"),s.textContent="仮想パッド表示切り替え",s.addEventListener("click",e),t.appendChild(s)}(f,(()=>{this._virtualPadStore.toggleVisible()}))):(this._virtualPadButtonElements=null,this._virtualPadStore=new lt({})),this._debugConsoleElement=function(t){if(null===t)return;const e=document.createElement("section");e.setAttribute("id","wwa-debug-console");const s=document.createElement("textarea");s.setAttribute("rows","10"),s.setAttribute("cols","60"),s.textContent='v["money"] = 100;\nv["name"] = "ヤツロウ";\nMSG(v["name"]+"「俺の所持金は"+v["money"]+"ゴールドだ」");\nSHOW_USER_DEF_VAR();';const i=t=>t.stopPropagation();s.addEventListener("keydown",i),s.addEventListener("keypress",i),s.addEventListener("keyup",i),s.classList.add("console-text-area"),e.appendChild(s);const a=document.createElement("button");return a.classList.add("script-running-button"),a.textContent="実行(X)",e.appendChild(a),t.appendChild(e),e}(dt("wwa-debug-console-area")),null===(e=this._debugConsoleElement)||void 0===e||e.querySelector(".script-running-button").addEventListener("click",(()=>{this._debugEvalString()})),this._gamePadStore=new nt,this._pages=[],this._yesNoJudge=g.UNSELECTED,this._yesNoJudgeInNextFrame=g.UNSELECTED,this._yesNoChoiceCallInfo=T.NONE,this._prevFrameEventExected=!1,this._isLastPage=!1,this._reservedPartsAppearances=[],this._reservedJumpDestination=void 0,this._shouldSetNextPage=!1,this._passwordLoadExecInNextFrame=!1,this._messageWindow=new Ge(this,50,180,340,0,this._wwaData.mapCGName,!1,!0,!1,dt("wwa-wrapper")),this._scoreWindow=new Ve(this,new c(50,50),!1,dt("wwa-wrapper")),this._wwaSave=new ms(Fa,Fa._wwaData.worldName,Fa._wwaData.worldPassNumber,this._checkSaveDataCompatibility.bind(this),(t=>{if(t.length>0){let e="これまでに保存されていたセーブデータは、下記の理由により消えたものがあります。";t.forEach((t=>{switch(t){case _s.UNMATCHED_WORLD_NAME:e+="\n・制作者によるマップデータのワールド名の変更";break;case _s.UNMATCHED_WORLD_PASS_NUMBER:e+="\n・制作者によるマップデータの暗証番号の変更";break;case _s.DISALLOW_OLD_REVISION_WORLD_SAVE_DATA:e+="\n・制作者によるマップデータの内容変更 (マップデータ制作者の設定により、内容が変更されるとセーブデータが消去されます)"}})),alert(e)}})),this._isDisallowLoadOldSave=l,this._messageWindow.setWWASave(this._wwaSave),is.setRestartData(this._restartData,this._wwaData),this.clearFaces();const D=dt("wwa-wrapper").getAttribute("data-wwa-resume-savedata");if("string"==typeof D&&(this._useSuspend=!0,D)){var P=is.getStartWWAData(D);this._restartData!==P&&(this._applyQuickLoad(P),this._wwaSave.resumeStart())}const O=dt("wwa-wrapper").getAttribute("data-wwa-autosave");null!==O&&this._wwaSave.setAutoSaveInterval(0|Number(O));const M=dt("wwa-wrapper").getAttribute("data-wwa-looking-around");if(this._useLookingAround=!(M&&M.match(/false/i)),this._setProgressBar(Ya(2,4,H.GAME_INIT)),this._setLoadingMessage(C,4),window.addEventListener("keydown",(t=>{if(this._isActive){if(this.userDevice.os===y.NINTENDO)return t.preventDefault(),void t.stopPropagation();this._keyStore.setPressInfo(t.keyCode),t.keyCode!==q.KEY_F5?this._player.isWaitingMessage()?t.keyCode!==q.KEY_DOWN&&t.keyCode!==q.KEY_LEFT&&t.keyCode!==q.KEY_RIGHT&&t.keyCode!==q.KEY_UP&&t.keyCode!==q.KEY_SHIFT&&t.keyCode!==q.KEY_ENTER&&t.keyCode!==q.KEY_ESC&&t.keyCode!==q.KEY_SPACE||t.preventDefault():this._player.isWaitingPasswordWindow()||t.keyCode!==q.KEY_DOWN&&t.keyCode!==q.KEY_LEFT&&t.keyCode!==q.KEY_RIGHT&&t.keyCode!==q.KEY_UP&&t.keyCode!==q.KEY_SHIFT&&t.keyCode!==q.KEY_ENTER&&t.keyCode!==q.KEY_1&&t.keyCode!==q.KEY_2&&t.keyCode!==q.KEY_3&&t.keyCode!==q.KEY_A&&t.keyCode!==q.KEY_C&&t.keyCode!==q.KEY_D&&t.keyCode!==q.KEY_E&&t.keyCode!==q.KEY_M&&t.keyCode!==q.KEY_N&&t.keyCode!==q.KEY_Q&&t.keyCode!==q.KEY_S&&t.keyCode!==q.KEY_W&&t.keyCode!==q.KEY_X&&t.keyCode!==q.KEY_Y&&t.keyCode!==q.KEY_Z&&t.keyCode!==q.KEY_ESC&&t.keyCode!==q.KEY_F1&&t.keyCode!==q.KEY_F2&&t.keyCode!==q.KEY_F3&&t.keyCode!==q.KEY_F4&&t.keyCode!==q.KEY_F6&&t.keyCode!==q.KEY_F7&&t.keyCode!==q.KEY_F8&&t.keyCode!==q.KEY_F12&&t.keyCode!==q.KEY_SPACE||t.preventDefault():t.preventDefault()}})),window.addEventListener("keyup",(t=>{if(this._isActive){if(this.userDevice.os===y.NINTENDO)return t.preventDefault(),void t.stopPropagation();this._keyStore.setReleaseInfo(t.keyCode),t.keyCode===q.KEY_F5?t.preventDefault():t.keyCode!==q.KEY_DOWN&&t.keyCode!==q.KEY_LEFT&&t.keyCode!==q.KEY_RIGHT&&t.keyCode!==q.KEY_UP&&t.keyCode!==q.KEY_SHIFT&&t.keyCode!==q.KEY_ENTER&&t.keyCode!==q.KEY_1&&t.keyCode!==q.KEY_2&&t.keyCode!==q.KEY_3&&t.keyCode!==q.KEY_A&&t.keyCode!==q.KEY_C&&t.keyCode!==q.KEY_D&&t.keyCode!==q.KEY_E&&t.keyCode!==q.KEY_M&&t.keyCode!==q.KEY_N&&t.keyCode!==q.KEY_Q&&t.keyCode!==q.KEY_S&&t.keyCode!==q.KEY_W&&t.keyCode!==q.KEY_X&&t.keyCode!==q.KEY_Y&&t.keyCode!==q.KEY_Z&&t.keyCode!==q.KEY_ESC&&t.keyCode!==q.KEY_F1&&t.keyCode!==q.KEY_F3&&t.keyCode!==q.KEY_F4&&t.keyCode!==q.KEY_F6&&t.keyCode!==q.KEY_F7&&t.keyCode!==q.KEY_F8&&t.keyCode!==q.KEY_F9&&t.keyCode!==q.KEY_F12&&t.keyCode!==q.KEY_SPACE||this._player.isWaitingMessage()||this._player.isWaitingPasswordWindow()||t.preventDefault()}})),window.addEventListener("blur",(t=>{this._keyStore.allClear(),this._mouseStore.clear(),this._virtualPadStore.allClear()})),window.addEventListener("contextmenu",(t=>{this._keyStore.allClear(),this._mouseStore.clear(),this._virtualPadStore.allClear()})),window.addEventListener("help",(t=>{this._isActive&&t.preventDefault()})),this._mouseControllerElement=dt("wwa-controller"),this._mouseControllerElement.addEventListener("mousedown",(t=>{if(this._isActive&&1===t.which){if(this._mouseStore.getMouseState()!==z.NONE)return void t.preventDefault();const e=wt(t.clientX,t.clientY),s=this._player.getDrawingCenterPosition(),i=e.substract(s),a=Math.abs(i.x),r=Math.abs(i.y);let n,o=!1;if(a<V.CHIP_SIZE&&r<V.CHIP_SIZE){switch(s.x/V.CHIP_SIZE|0){case 0:o=!0,n=p.LEFT;break;case V.H_PARTS_NUM_IN_WINDOW-1:o=!0,n=p.RIGHT}switch(s.y/V.CHIP_SIZE|0){case 0:o=!0,n=p.UP;break;case V.V_PARTS_NUM_IN_WINDOW-1:o=!0,n=p.DOWN}}o||(i.y>0&&r>a?n=p.DOWN:i.y<0&&r>a?n=p.UP:i.x>0&&r<a?n=p.RIGHT:i.x<0&&r<a&&(n=p.LEFT)),this._mouseStore.setPressInfo(n,0)}})),this._mouseControllerElement.addEventListener("mouseleave",(t=>{this._mouseStore.clear()})),this._mouseControllerElement.addEventListener("mouseup",(t=>{this._isActive&&1===t.which&&(this._mouseStore.setReleaseInfo(),t.preventDefault())})),window.TouchEvent){if(this.audioContext){let t=()=>{this.audioContext.createBufferSource().start(0),this._mouseControllerElement.removeEventListener("touchstart",t),t=null};this._mouseControllerElement.addEventListener("touchstart",t)}this._mouseControllerElement.addEventListener("touchstart",(t=>{if(!this._isActive)return;if(this._mouseStore.getMouseState()!==z.NONE)return void t.preventDefault();const e=t.changedTouches,s=e.length;for(let t=0;t<s;t++){const s=e[t],i=wt(s.clientX,s.clientY),a=this._player.getDrawingCenterPosition(),r=i.substract(a),n=Math.abs(r.x),o=Math.abs(r.y);let h,c=!1;if(n<V.CHIP_SIZE&&o<V.CHIP_SIZE){switch(a.x/V.CHIP_SIZE|0){case 0:c=!0,h=p.LEFT;break;case V.H_PARTS_NUM_IN_WINDOW-1:c=!0,h=p.RIGHT}switch(a.y/V.CHIP_SIZE|0){case 0:c=!0,h=p.UP;break;case V.V_PARTS_NUM_IN_WINDOW-1:c=!0,h=p.DOWN}}c||(r.y>0&&o>n?h=p.DOWN:r.y<0&&o>n?h=p.UP:r.x>0&&o<n?h=p.RIGHT:r.x<0&&o<n&&(h=p.LEFT)),this._mouseStore.setPressInfo(h,s.identifier)}t.cancelable&&t.preventDefault()}));const t=t=>{if(this._isActive)for(let e=0;e<t.changedTouches.length;e++)if(this._mouseStore.getTouchID()===t.changedTouches[e].identifier){this._mouseStore.setReleaseInfo(),t.preventDefault();break}};this._mouseControllerElement.addEventListener("touchend",t),this._mouseControllerElement.addEventListener("touchcancel",t)}dt("button-load").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(I.QUICK_LOAD)})),dt("button-save").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(I.QUICK_SAVE)})),dt("button-restart").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(I.RESTART_GAME)})),dt("button-gotowwa").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(I.GOTO_WWA,!1,!1)})),Array.prototype.forEach.call(gt(".wide-cell-row"),(t=>{t.addEventListener("click",(()=>{this._displayHelp()}))})),this._frameCoord=new c(V.IMGPOS_DEFAULT_FRAME_X,V.IMGPOS_DEFAULT_YESNO_Y),this._battleEffectCoord=new c(V.IMGPOS_DEFAULT_BATTLE_EFFECT_X,V.IMGPOS_DEFAULT_BATTLE_EFFECT_Y),this._battleEstimateWindow=new Ke(this,this._wwaData.mapCGName,dt("wwa-wrapper")),this._passwordWindow=new Xe(this,dt("wwa-wrapper"),l),this._monsterWindow=new We(this,new c(50,180),340,60,!1,dt("wwa-wrapper"),this._wwaData.mapCGName),this._setProgressBar(Ya(3,4,H.GAME_INIT)),this._isLoadedSound=!1,this._temporaryInputDisable=!1,this._paintSkipByDoorOpen=!1,this._clearFacesInNextFrame=!1,this._useConsole=!1,this.wwaCustomEvent("wwa_startup"),this._cgManager=new Se(d,this._wwaData.mapCGName,this._frameCoord,this,v,(()=>{this._isSkippedSoundMessage=!0;const t=()=>{switch(this.userDevice.device){case S.PC:this.generatePageAndReserveExecution("ゲームを開始します。\n画面をクリックしてください。",!1,!0);break;case S.SP:this.generatePageAndReserveExecution("ゲームを開始します。\n画面にふれてください。",!1,!0)}},e=this.resolveSystemMessage(i.CONFIRM_LOAD_SOUND);if("ON"===e)return this._isLoadedSound=!0,t(),this._setLoadingMessage(C,H.AUDIO),this.loadSound(),void window.requestAnimationFrame(this.soundCheckCaller);if("OFF"===e)return this._isLoadedSound=!1,t(),void this.openGameWindow();if(this._isSkippedSoundMessage=!1,this._hasTitleImg||C.clearRect(0,0,V.SCREEN_WIDTH,V.SCREEN_HEIGHT),this._usePassword){let t=e;E&&(t+='\n\n※変数表示が有効になっています。\n公開前に必ずHTMLファイル内の\n data-wwa-display-user-vars="true" \nを消してください。'),this._messageWindow.setMessage(t),this._messageWindow.show(),this._setProgressBar(Ya(4,4,H.GAME_INIT));var s=setInterval((()=>{this._keyStore.update(),this._gamePadStore.update(),this._virtualPadStore.update(),this._yesNoJudgeInNextFrame===g.UNSELECTED&&(this._keyStore.getKeyState(q.KEY_ENTER)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_Y)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this._yesNoJudgeInNextFrame=g.YES:(this._keyStore.getKeyState(q.KEY_N)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_ESC)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&(this._yesNoJudgeInNextFrame=g.NO)),this._yesNoJudgeInNextFrame===g.YES?(clearInterval(s),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout((()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=g.UNSELECTED,this._yesNoJudgeInNextFrame=g.UNSELECTED,this._isLoadedSound=!0,this._setLoadingMessage(C,H.AUDIO),this.loadSound(),window.requestAnimationFrame(this.soundCheckCaller)}),V.YESNO_PRESS_DISP_FRAME_NUM*V.DEFAULT_FRAME_INTERVAL)):this._yesNoJudgeInNextFrame===g.NO&&(clearInterval(s),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout((()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=g.UNSELECTED,this._yesNoJudgeInNextFrame=g.UNSELECTED,this._isLoadedSound=!1,this.openGameWindow()}),V.YESNO_PRESS_DISP_FRAME_NUM*V.DEFAULT_FRAME_INTERVAL))}),V.DEFAULT_FRAME_INTERVAL)}else clearInterval(s),this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=g.UNSELECTED,this._yesNoJudgeInNextFrame=g.UNSELECTED,this._isLoadedSound=!0,this.loadSound(),window.requestAnimationFrame(this.soundCheckCaller)})),this.wwaCustomEvent("wwa_start")};const M=new Ns;M.addListener("mapData",(t=>this._loadHandler(t))),M.addListener("progress",(t=>this._setProgressBar(t))),M.addListener("error",(t=>this._setErrorMessage("下記のエラーが発生しました。: \n"+t.message,C)));new Ps(t,M).requestAndLoadMapData().then((async()=>{if(this._canDisplayUserVars=E,this._userVarNameList=[],this._canDisplayUserVars){this._inlineUserVarViewer={topUserVarIndex:{named:0,numbered:0},isVisible:!1,kind:"numbered"};const t=await(m?fe(m):{kind:"noFileSpecified",errorMessage:"data-wwa-user-var-names-file 属性に、変数の説明を記したファイル名を書くことで、その説明を表示できます。詳しくはマニュアルをご覧ください。"});this.setUserVarStatus(t,m)}})),(async()=>{const t=await fe("./script/script_file_list.json");let e=[];console.log(t),"data"===(null==t?void 0:t.kind)&&Array.isArray(t.data)&&t.data.map((t=>{e.push((async t=>{try{const e=await fetch(t);return 200===e.status||304===e.status?{kind:"data",data:await new Response(e.body).text()}:{kind:"httpError",errorMessage:`ファイル ${t} が読み込めませんでした。ステータスコード: ${e.status}`}}catch(t){return{kind:"otherError",errorMessage:t.message}}})(t))}));(await Promise.all(e)).forEach((t=>{try{this.setUsertScript(t)}catch(t){console.error(t.message)}}));const s=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_WWA_START;s&&this.evalCalcWwaNodeGenerator.evalWwaNode(s)})(),this.evalCalcWwaNodeGenerator=new _a(this)}setEvalCalcWwaNodeEarnedItem(t,e){this.evalCalcWwaNodeGenerator.setEarnedItem(t,e)}clearEvalCalcWwaNodeEarnedItem(){this.evalCalcWwaNodeGenerator.clearEarnedItem()}callGetItemUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GET_ITEM;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}callGetItemFullUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GET_ITEM_FULL;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}callUseItemUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_USE_ITEM;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}callJumpGateUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_JUMPGATE;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}callUserDefinedBattleDamageFunction(t,e){const s=this.getUserDefinedDamageFunctionNode(t);if(s){this.evalCalcWwaNodeGenerator.setBattleDamageCalculationMode(e);try{const e=this.evalCalcWwaNodeGenerator.evalWwaNode(s),i=this.evalCalcWwaNodeGenerator.state.battleDamageCalculation.aborted;return this.evalCalcWwaNodeGenerator.clearBattleDamageCalculationMode(),"number"==typeof e?{damage:this.toAssignableValue(e),aborted:i}:(console.warn(`${t} のダメージ計算結果が数値になりませんでした。(結果: ${e})。このターンのダメージは無効になります。`),{damage:0,aborted:i})}catch(e){return console.warn(`${t} のダメージ計算中にエラーが発生しました。このターンのダメージは無効になります。`),console.warn(e),{damage:0,hasError:!0}}}}getUserDefinedDamageFunctionNode(t){var e;return null===(e=this.userDefinedFunctions)||void 0===e?void 0:e[{playerToEnemy:"CALC_PLAYER_TO_ENEMY_DAMAGE",enemyToPlayer:"CALC_ENEMY_TO_PLAYER_DAMAGE"}[t]]}callMoveUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_MOVE;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}getUserScript(t){return this.userDefinedFunctions&&this.userDefinedFunctions[t]||null}setUsertScript(t){if("data"!==t.kind)return void console.error(t);const e=this.convertWwaNodes(t.data);console.log(e),e.forEach((t=>{if("DefinedFunction"===t.type&&this.userDefinedFunctions){const e=t.functionName;this.userDefinedFunctions[e]=t.body}}))}callUserScript(t){const e=this.getUserScript(t);e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}setUserVarStatus(t,e){if(t)if("noFileSpecified"!==t.kind){if("data"!==t.kind)return this._userVarNameListRequestError=t,void Oa(this._dumpElement,this._userVarNameListRequestError.errorMessage,!0);if(!t.data||"object"!=typeof t.data)return this._userVarNameListRequestError={kind:"notObject",errorMessage:`ユーザ変数一覧 ${e} が正しい形式で書かれていません。`},void Oa(this._dumpElement,this._userVarNameListRequestError.errorMessage,!0);this._userVarNameList=this.convertUserVariableNameListToArray(t.data),Na(this._dumpElement,this._userVarNameList)}else Oa(this._dumpElement,t.errorMessage,!1)}convertUserVariableNameListToArray(t){const e=new Array(V.USER_VAR_NUM);for(let t=0;t<V.USER_VAR_NUM;t++)e[t]=void 0;return Object.keys(t).forEach((s=>{const i=parseInt(s,10);"string"!=typeof t[s]||"string"!=typeof s||isNaN(i)||i<0||i>=V.USER_VAR_NUM||(e[i]=t[s])})),e}_setProgressBar(t){this._hasTitleImg&&(t.stage<=V.LOAD_STAGE_MAX_EXCEPT_AUDIO?(dt("progress-message-container").textContent=t.stage===V.LOAD_STAGE_MAX_EXCEPT_AUDIO?"World Name: "+this._wwaData.worldName:st[t.stage],dt("progress-bar").style.width=(1*t.stage+t.current/t.total*1)/(V.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*V.MAP_WINDOW_WIDTH+"px",dt("progress-disp").textContent=((1*t.stage+t.current/t.total*1)/(V.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*100).toFixed(2)+"%"):(this._usePassword?dt("progress-message-container").textContent="効果音/BGMを読み込んでいます。(スペースキーでスキップ)":dt("progress-message-container").textContent="ゲームデータを読み込んでいます。",dt("progress-bar-audio").style.width=t.current*V.MAP_WINDOW_WIDTH/t.total+"px",dt("progress-disp").textContent=(t.current/t.total*100).toFixed(2)+"%"))}_setLoadingMessage(t,e){if(!this._hasTitleImg)if(e<=0)t.font=j.TITLE+"px "+V.LOADING_FONT,t.fillText(it[0],K.TITLE_X,K.TITLE_Y),t.font=j.FOOTER+"px "+V.LOADING_FONT,t.fillText("WWA Wing Ver.4.1.0-unstable.based-on.3.12.11.p.2",K.FOOTER_X,K.COPYRIGHT_Y);else if(e<=it.length)t.font=j.LOADING+"px "+V.LOADING_FONT,e>=2&&(t.clearRect(K.LOADING_X,K.LOADING_Y+K.LINE*(e-3),V.SCREEN_WIDTH-K.LOADING_X,K.LINE),t.fillText(it[e-1]+" Complete!",K.LOADING_X,K.LOADING_Y+K.LINE*(e-2))),e<it.length&&t.fillText(it[e],K.LOADING_X,K.LOADING_Y+K.LINE*(e-1)),1==e&&(t.font=j.FOOTER+"px "+V.LOADING_FONT,t.fillText("World Name "+this._wwaData.worldName,K.FOOTER_X,K.WORLD_Y),t.fillText(" (Map data Ver. "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10+")",K.FOOTER_X,K.WORLD_Y+K.LINE));else{var s;s=this._isSkippedSoundMessage?K.LOADING_Y+K.LINE*(it.length-1):K.FOOTER_Y,e<=H.AUDIO?t.fillText("Now Sound data Loading .....",K.LOADING_X,s):(t.clearRect(K.LOADING_X,s-K.LINE,V.SCREEN_WIDTH-K.LOADING_X,K.LINE),t.fillText("Now Sound data Loading ..... Complete!",K.LOADING_X,s))}}_setErrorMessage(t,e){this._hasTitleImg?alert(t):(e.clearRect(0,0,V.SCREEN_WIDTH,V.SCREEN_HEIGHT),e.font=j.ERRROR+"px "+V.LOADING_FONT,t.split("\n").forEach((function(t,s){e.fillText(t,K.ERROR_X,K.ERROR_Y+K.LINE*s)})))}createSoundInstance(t){if(0===t||t===R.NO_SOUND||this.sounds[t])return;const e=`${this._audioDirectory}${t}.${this.audioExtension}`;this.sounds[t]=new Es(t,e,this.audioContext,this.audioGain)}loadSound(){this.sounds=new Array(V.SOUND_MAX+1),this.createSoundInstance(R.DECISION),this.createSoundInstance(R.ATTACK);for(let t=1;t<this._wwaData.mapPartsMax;t++){const e=this._wwaData.mapAttribute[t][V.ATR_SOUND];this.createSoundInstance(e)}for(let t=1;t<this._wwaData.objPartsMax;t++){if(this._wwaData.objectAttribute[t][V.ATR_TYPE]===V.OBJECT_RANDOM)continue;const e=this._wwaData.objectAttribute[t][V.ATR_SOUND];this.createSoundInstance(e)}this._wwaData.message.forEach((t=>t.split("\n").forEach((t=>{const e=t.match(/^\$sound=(\d+)/);if(!e||e.length<2)return;const s=parseInt(e[1],10);!isNaN(s)&&0<s&&s<R.NO_SOUND&&this.createSoundInstance(s)})))),this._wwaData.bgm=0,this._soundLoadSkipFlag=!1}checkAllSoundLoaded(){let t=0,e=0;if(!this._hasTitleImg)var s=this._cvsCover.getContext("2d");this._keyStore.update(),this._keyStore.getKeyState(q.KEY_SPACE)===Z.KEYDOWN&&(this._soundLoadSkipFlag=!0);for(let s=1;s<=V.SOUND_MAX;s++){const i=this.sounds[s];void 0===i||i.isError()||(e++,i.hasData()&&t++)}if(t<e&&!this._soundLoadSkipFlag)return this._setProgressBar(Ya(t,e,H.AUDIO)),void window.requestAnimationFrame(this.soundCheckCaller);this._setProgressBar(Ya(V.SOUND_MAX,V.SOUND_MAX,H.AUDIO)),this._setLoadingMessage(s,H.FINISH),this.openGameWindow()}_setSoundLoadedCheckTimer(t){const e=this.sounds[t];e.isError()||(this.soundLoadedCheckTimer=window.setInterval((()=>{this._wwaData.bgm===t?e.hasData()?(e.play(this._wwaData.bgmDelayDurationMs),this._wwaData.bgm=t,this._clearSoundLoadedCheckTimer()):e.isError()&&this._clearSoundLoadedCheckTimer():this._clearSoundLoadedCheckTimer()}),100))}_clearSoundLoadedCheckTimer(){this.soundLoadedCheckTimer&&(clearInterval(this.soundLoadedCheckTimer),this.soundLoadedCheckTimer=void 0)}playSound(t,e){if(!this._isLoadedSound)return void(t===R.NO_SOUND?this._wwaData.bgm=0:t>=R.BGM_LB&&(this._wwaData.bgm=t));if(t<0||t>=V.SOUND_MAX)return void console.warn("サウンド番号が範囲外です。");if(t>=R.BGM_LB&&this._wwaData.bgm===t)return;if((t===R.NO_SOUND||t>=R.BGM_LB)&&0!==this._wwaData.bgm&&(this.sounds[this._wwaData.bgm].isPlaying()&&this.sounds[this._wwaData.bgm].pause(),this._wwaData.bgm=0),0===t||t===R.NO_SOUND)return;this.sounds[t].hasData()?t>=R.BGM_LB?(this.sounds[t].play(null!=e?e:this._wwaData.bgmDelayDurationMs),this._wwaData.bgm=t):this.sounds[t].play():t>=R.BGM_LB&&(this._wwaData.bgm=t,this._setSoundLoadedCheckTimer(t))}openGameWindow(){var t=this._player.getPosition();dt("wwa-cover").style.opacity="0",0!==this.getObjectIdByPosition(t)&&this._player.setPartsAppearedFlag();var e=dt("wwa-wrapper").getAttribute("data-wwa-resume-savedata");if("string"==typeof e&&(this._useSuspend=!0,e)){var s=is.getStartWWAData(e);this._restartData!==s&&(this._applyQuickLoad(s),this._wwaSave.resumeStart())}setTimeout((()=>{dt("wwa-wrapper").removeChild(dt("wwa-cover")),this._main()}),V.SPLASH_SCREEN_DISP_MILLS)}onselectitem(t){if(this._player.canUseItem(t)){dt("item"+(t-1)).classList.add("onpress"),this.playSound(R.DECISION);const a=this.resolveSystemMessage(i.CONFIRM_USE_ITEM);if("BLANK"===a){this._player.readyToUseItem(t);var e=this._player.useItem(),s=this.getObjectAttributeById(e,V.ATR_STRING);this.generatePageAndReserveExecution(this.getMessageById(s),!1,!1,e,v.OBJECT,this._player.getPosition().getPartsCoord())}else this.generatePageAndReserveExecution(a,!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_ITEM_USE,this._yesNoUseItemPos=t;return!0}return!1}onselectbutton(t,e=!1,s=!1){var i=dt(x[t]);if(this.playSound(R.DECISION),this._itemMenu.close(),i.classList.add("onpress"),t===I.QUICK_LOAD)switch(this._yesNoChoiceCallInfo=this._wwaSave.getFirstSaveChoiceCallInfo(e),this._yesNoChoiceCallInfo){case T.CALL_BY_QUICK_LOAD:case T.CALL_BY_LOG_QUICK_LOAD:var a,r="";switch(this._yesNoChoiceCallInfo){case T.CALL_BY_QUICK_LOAD:r="読み込むデータを選んでください。",this._wwaSave.selectDBSaveDataList();break;case T.CALL_BY_LOG_QUICK_LOAD:r="読み込むオートセーブを選んでください。",this._wwaSave.selectLogSaveDataList()}switch(a=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._messageWindow.createSaveDom(),a){case T.CALL_BY_LOG_QUICK_LOAD:this.generatePageAndReserveExecution(r+"\n→Noでオートセーブ復帰画面に移ります。",!0,!0);break;case T.CALL_BY_PASSWORD_LOAD:this.generatePageAndReserveExecution(r+"\n→Noでデータ復帰用パスワードの\n 入力選択ができます。",!0,!0);break;case T.NONE:this.generatePageAndReserveExecution(r,!0,!0)}break;case T.CALL_BY_PASSWORD_LOAD:this.onpasswordloadcalled()}else if(t===I.QUICK_SAVE)this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):(this._wwaSave.selectDBSaveDataList(),this._messageWindow.createSaveDom(),this._usePassword?(this.generatePageAndReserveExecution("データの一時保存先を選んでください。\n→Noでデータ復帰用パスワードの\n 表示選択ができます。",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_QUICK_SAVE):(this.generatePageAndReserveExecution("データの一時保存先を選んでください。",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_QUICK_SAVE));else if(t===I.RESTART_GAME)this.generatePageAndReserveExecution("初めからスタートしなおしますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_RESTART_GAME;else if(t===I.GOTO_WWA)if(s)this._bottomButtonType!==d.GOTO_WWA&&dt(x[I.GOTO_WWA]).classList.remove("onpress"),this.generatePageAndReserveExecution("WWAの公式サイトを開きますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_GOTO_WWA;else switch(this._bottomButtonType){case d.GOTO_WWA:this._yesNoChoiceCallInfo=T.CALL_BY_GOTO_WWA,this.generatePageAndReserveExecution("WWAの公式サイトを開きますか?",!0,!0);break;case d.GAME_END:this._yesNoChoiceCallInfo=T.CALL_BY_END_GAME,this.generatePageAndReserveExecution("WWAゲームを終了しますか?",!0,!0);break;case d.BATTLE_REPORT:this.launchBattleEstimateWindow()}}onpasswordloadcalled(){this._usePassword?(dt(x[I.QUICK_LOAD]).classList.add("onpress"),this.generatePageAndReserveExecution("データ復帰用のパスワードを入力しますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_PASSWORD_LOAD):this.generatePageAndReserveExecution("セーブデータがありません。",!1,!0)}onpasswordsavecalled(){dt(x[I.QUICK_SAVE]).classList.add("onpress"),this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):this._useSuspend?(this.generatePageAndReserveExecution("ゲームを中断しますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_SUSPEND):this._usePassword&&(this.generatePageAndReserveExecution("データ復帰用のパスワードを表示しますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_PASSWORD_SAVE)}onpasssuspendsavecalled(){dt(x[I.QUICK_SAVE]).classList.add("onpress"),this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):(this.generatePageAndReserveExecution("ゲームを中断しますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_SUSPEND)}onitemmenucalled(){this.generatePageAndReserveExecution("右のメニューを選択してください。",!1,!0),this._messageWindow.setItemMenuChoice(!0),this.playSound(R.DECISION),this._itemMenu.openView()}onchangespeed(t){if(!this._wwaData.permitChangeGameSpeed){const t=this.resolveSystemMessage(i.GAME_SPEED_CHANGE_DISABLED);return void("BLANK"!==t&&this.generatePageAndReserveExecution(t,!1,!0))}switch(t){case C.UP:this._player.speedUp();break;case C.DOWN:this._player.speedDown()}const e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_CHANGE_SPEED;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e);const s=this.resolveSystemMessage(i.GAME_SPEED_CHANGED);"BLANK"!==s&&this.generatePageAndReserveExecution(s,!1,!0)}isBattleSpeedIndexForQuickBattle(t){return V.QUICK_BATTLE_SPEED_INDECIES.some((e=>e===t))}_executeNode(t,e){var s;if(t instanceof Le)return null===(s=t.macro)||void 0===s||s.forEach((t=>{const{isGameOver:e}=t.execute();if(e)throw new Error("ゲームオーバーのため、メッセージ・マクロの実行を打ち切ります。")})),[t,...this._executeNode(t.next,e)];if(t instanceof be){if(!e)throw new Error("パーツ起因ページによる実行ではないため、Junctionノードの利用を想定していません。");const s=t.evaluateAndGetNextNode((()=>this.generateTokenValues(e)));return s?this._executeNode(s,e):[]}return[]}_executeNodes(t,e){try{return{isError:!1,messages:this._executeNode(t,e)}}catch(t){return{isError:!0}}}_main(){var t;this._temporaryInputDisable=!1,this._stopUpdateByLoadFlag=!1,this._keyStore.update(),this._mouseStore.update(),this._virtualPadStore.update(),this._gamePadStore.update();const e=this._reservedPartsAppearances.length>0;if(this._reservedPartsAppearances.forEach((t=>this.appearParts(t))),this._reservedPartsAppearances=[],this._waitFrame-- >0)return e&&this._drawAll(),void window.requestAnimationFrame(this.mainCaller);if(this._waitFrame=0,void 0!==this._yesNoJudgeInNextFrame&&(this._yesNoJudge=this._yesNoJudgeInNextFrame,this._yesNoJudgeInNextFrame=void 0),this._clearFacesInNextFrame&&(this.clearFaces(),this._clearFacesInNextFrame=!1),this._pages.length>0&&this._shouldSetNextPage)for(this._shouldSetNextPage=!1;this._pages.length>0;){const t=this._pages.shift(),e=this._executeNodes(t.firstNode,t.extraInfo?{position:t.extraInfo.partsPosition,type:t.extraInfo.partsType,id:t.extraInfo.partsId}:void 0);if(!0===e.isError){this._isLastPage=!1;break}void 0!==this._reservedMoveMacroTurn&&(this._player.setMoveMacroWaiting(this._reservedMoveMacroTurn),this._reservedMoveMacroTurn=void 0);const s=e.messages.filter((t=>!t.isEmpty())),i=Boolean(t.scoreOptions);i&&0===s.length&&s.push(new Le("スコアを表示します。"));if(s.length>0){const e=s.map((t=>t.generatePrintableMessage())).join("\n");this._messageWindow.setMessage(e),this._messageWindow.setYesNoChoice(t.showChoice),this._messageWindow.setPositionByPlayerPosition(0!==this._faces.length,i,t.isSystemMessage,this._player.getPosition(),this._camera.getPosition()),i&&(this._lastScoreOptions=t.scoreOptions,this.updateScore(t.scoreOptions),this._scoreWindow.show()),this._player.setMessageWaiting(),this._isLastPage=t.isLastPage;break}if(0===this._pages.length){const{newPageGenerated:t}=this._hideMessageWindow();t||this._dispatchWindowClosedTimeRequests();break}}if(this._reservedJumpDestination&&(this._player.jumpTo(this._reservedJumpDestination),this._reservedJumpDestination=void 0),this._player.mainFrameCount(),this._player.isControllable()){if(this._wwaData.disableSaveFlag||this._wwaSave.isAutoSaveFrame(this._player)&&this._quickSave(T.CALL_BY_LOG_QUICK_SAVE),this._player.isDelayFrame())this._player.updateDelayFrame();else{const t=this._player.getDir(),e=[NaN,NaN,q.KEY_DOWN,NaN,q.KEY_LEFT,NaN,q.KEY_RIGHT,NaN,q.KEY_UP,NaN][t];this._actionGamePadButtonItemMacro()||(this._keyStore.getKeyStateForControllPlayer(q.KEY_LEFT)===Z.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer(q.KEY_UP)===Z.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer(q.KEY_RIGHT)===Z.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer(q.KEY_DOWN)===Z.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(p.LEFT)===z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(p.UP)===z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(p.RIGHT)===z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(p.DOWN)===z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(e)?this._checkTurnKeyPressed()?this._player.setDir(t):(this._player.controll(t),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(q.KEY_LEFT)?this._checkTurnKeyPressed()?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(q.KEY_UP)?this._checkTurnKeyPressed()?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(q.KEY_RIGHT)?this._checkTurnKeyPressed()?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(q.KEY_DOWN)?this._checkTurnKeyPressed()?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(p.LEFT)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(p.UP)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(p.RIGHT)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(p.DOWN)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_LEFT)?this._gamePadStore.buttonPressed(tt.BUTTON_INDEX_B)?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_UP)?this._gamePadStore.buttonPressed(tt.BUTTON_INDEX_B)?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_RIGHT)?this._gamePadStore.buttonPressed(tt.BUTTON_INDEX_B)?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_DOWN)?this._gamePadStore.buttonPressed(tt.BUTTON_INDEX_B)?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_LEFT")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_UP")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_RIGHT")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_DOWN")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._keyStore.getKeyState(q.KEY_1)===Z.KEYDOWN?this.onselectitem(1):this._keyStore.getKeyState(q.KEY_2)===Z.KEYDOWN?this.onselectitem(2):this._keyStore.getKeyState(q.KEY_3)===Z.KEYDOWN?this.onselectitem(3):this._keyStore.getKeyState(q.KEY_Q)===Z.KEYDOWN?this.onselectitem(4):this._keyStore.getKeyState(q.KEY_W)===Z.KEYDOWN?this.onselectitem(5):this._keyStore.getKeyState(q.KEY_E)===Z.KEYDOWN?this.onselectitem(6):this._keyStore.getKeyState(q.KEY_A)===Z.KEYDOWN?this.onselectitem(7):this._keyStore.getKeyState(q.KEY_S)===Z.KEYDOWN?this.onselectitem(8):this._keyStore.getKeyState(q.KEY_D)===Z.KEYDOWN?this.onselectitem(9):this._keyStore.getKeyState(q.KEY_Z)===Z.KEYDOWN?this.onselectitem(10):this._keyStore.getKeyState(q.KEY_X)===Z.KEYDOWN?this.onselectitem(11):this._keyStore.getKeyState(q.KEY_C)===Z.KEYDOWN?this.onselectitem(12):this._keyStore.getKeyState(q.KEY_I)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_MINUS)||this._virtualPadStore.checkTouchButton("BUTTON_SLOW")?this.onchangespeed(C.DOWN):this._keyStore.getKeyState(q.KEY_P)===Z.KEYDOWN||this._keyStore.checkHitKey(q.KEY_F2)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_PLUS)||this._virtualPadStore.checkTouchButton("BUTTON_FAST")?this.onchangespeed(C.UP):this._keyStore.getKeyState(q.KEY_F1)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_M)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this.launchBattleEstimateWindow():this._keyStore.checkHitKey(q.KEY_F3)?(this.playSound(R.DECISION),this.onselectbutton(I.QUICK_LOAD,!0)):this._keyStore.checkHitKey(q.KEY_F4)?(this.playSound(R.DECISION),this._useSuspend?this.onpasssuspendsavecalled():this._usePassword&&this.onpasswordsavecalled()):this._keyStore.checkHitKey(q.KEY_F5)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_ZR)?this.onselectbutton(I.QUICK_LOAD):this._keyStore.checkHitKey(q.KEY_F6)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_ZL)?this.onselectbutton(I.QUICK_SAVE):this._keyStore.checkHitKey(q.KEY_F7)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_R)?this.onselectbutton(I.RESTART_GAME):this._keyStore.checkHitKey(q.KEY_F8)?this.onselectbutton(I.GOTO_WWA,!1,!0):this._keyStore.checkHitKey(q.KEY_F9)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_X)||this._virtualPadStore.checkTouchButton("BUTTON_ESC")?(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onitemmenucalled():this._keyStore.checkHitKey(q.KEY_V)?this._displayUserVars():this._keyStore.checkHitKey(q.KEY_X)?this._debugConsoleElement&&this._debugEvalString():(this._keyStore.checkHitKey(q.KEY_F12)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_Y))&&this._displayHelp());[{key:q.KEY_A,func:"CALL_PUSH_A"},{key:q.KEY_B,func:"CALL_PUSH_B"},{key:q.KEY_C,func:"CALL_PUSH_C"},{key:q.KEY_D,func:"CALL_PUSH_D"},{key:q.KEY_E,func:"CALL_PUSH_E"},{key:q.KEY_F,func:"CALL_PUSH_F"},{key:q.KEY_G,func:"CALL_PUSH_G"},{key:q.KEY_H,func:"CALL_PUSH_H"},{key:q.KEY_I,func:"CALL_PUSH_I"},{key:q.KEY_J,func:"CALL_PUSH_J"},{key:q.KEY_K,func:"CALL_PUSH_K"},{key:q.KEY_L,func:"CALL_PUSH_L"},{key:q.KEY_M,func:"CALL_PUSH_M"},{key:q.KEY_N,func:"CALL_PUSH_N"},{key:q.KEY_O,func:"CALL_PUSH_O"},{key:q.KEY_P,func:"CALL_PUSH_P"},{key:q.KEY_Q,func:"CALL_PUSH_Q"},{key:q.KEY_R,func:"CALL_PUSH_R"},{key:q.KEY_S,func:"CALL_PUSH_S"},{key:q.KEY_T,func:"CALL_PUSH_T"},{key:q.KEY_U,func:"CALL_PUSH_U"},{key:q.KEY_V,func:"CALL_PUSH_V"},{key:q.KEY_W,func:"CALL_PUSH_W"},{key:q.KEY_X,func:"CALL_PUSH_X"},{key:q.KEY_Y,func:"CALL_PUSH_Y"},{key:q.KEY_Z,func:"CALL_PUSH_Z"},{key:q.KEY_ENTER,func:"CALL_PUSH_ENTER"},{key:q.KEY_ESC,func:"CALL_PUSH_ESC"},{key:q.KEY_SPACE,func:"CALL_PUSH_SPACE"},{key:q.KEY_LEFT,func:"CALL_PUSH_LEFT"},{key:q.KEY_RIGHT,func:"CALL_PUSH_RIGHT"},{key:q.KEY_UP,func:"CALL_PUSH_UP"},{key:q.KEY_DOWN,func:"CALL_PUSH_DOWN"}].forEach((t=>{if(this._keyStore.checkHitKey(t.key)){const e=this.userDefinedFunctions&&this.userDefinedFunctions[t.func];e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}}))}this._keyStore.memorizeKeyStateOnControllableFrame(),this._mouseStore.memorizeMouseStateOnControllableFrame(),this._cgManager.picture.decrementPictureDisplayTimeStock()}else if(this._player.isJumped())this._camera.isResetting()||this._player.processAfterJump();else if(this._player.isMoving())this._player.move(),this._objectMovingDataManager.update(),this._player.getPosition().isJustPosition()&&this._dispatchPlayerAndObjectsStopTimeRequests();else if(this._player.isWaitingMessage()){if(this._messageWindow.isVisible()||this._messageWindow.show(),this._messageWindow.isYesNoChoice())this._messageWindow.isSaveChoice()&&(this._messageWindow.saveUpdate(),this._messageWindow.isSaveClose()||(this._keyStore.checkHitKey(q.KEY_LEFT)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_LEFT)||this._virtualPadStore.checkTouchButton("BUTTON_LEFT")?this._messageWindow.saveControll(p.LEFT):this._keyStore.checkHitKey(q.KEY_UP)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_UP)||this._virtualPadStore.checkTouchButton("BUTTON_UP")?this._messageWindow.saveControll(p.UP):this._keyStore.checkHitKey(q.KEY_RIGHT)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_RIGHT)||this._virtualPadStore.checkTouchButton("BUTTON_RIGHT")?this._messageWindow.saveControll(p.RIGHT):(this._keyStore.checkHitKey(q.KEY_DOWN)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_DOWN)||this._virtualPadStore.checkTouchButton("BUTTON_DOWN"))&&this._messageWindow.saveControll(p.DOWN))),this._messageWindow.isInputDisable()||(this._yesNoJudge===g.UNSELECTED&&(this._keyStore.getKeyState(q.KEY_ENTER)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_Y)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this._yesNoJudge=g.YES:(this._keyStore.getKeyState(q.KEY_N)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_ESC)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&(this._yesNoJudge=g.NO)),(this._yesNoJudge===g.YES||this._yesNoJudge===g.NO)&&(this.playSound(R.DECISION),this._yesNoDispCounter=V.YESNO_PRESS_DISP_FRAME_NUM,this._messageWindow.setInputDisable(),this._messageWindow.update()));else if(this._messageWindow.isItemMenuChoice()){if(this._itemMenu.update(),this._keyStore.checkHitKey(q.KEY_LEFT)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_LEFT)||this._virtualPadStore.checkTouchingButton("BUTTON_LEFT")?this._itemMenu.controll(p.LEFT):this._keyStore.checkHitKey(q.KEY_UP)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_UP)||this._virtualPadStore.checkTouchingButton("BUTTON_UP")?this._itemMenu.controll(p.UP):this._keyStore.checkHitKey(q.KEY_RIGHT)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_RIGHT)||this._virtualPadStore.checkTouchingButton("BUTTON_RIGHT")?this._itemMenu.controll(p.RIGHT):(this._keyStore.checkHitKey(q.KEY_DOWN)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_DOWN)||this._virtualPadStore.checkTouchingButton("BUTTON_DOWN"))&&this._itemMenu.controll(p.DOWN),this._keyStore.getKeyState(q.KEY_ENTER)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_Y)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER"))this._setNextPage(),this._messageWindow.setItemMenuChoice(!1),this._itemMenu.ok();else if(this._mouseStore.checkClickMouse(p.LEFT)||this._mouseStore.checkClickMouse(p.UP)||this._mouseStore.checkClickMouse(p.RIGHT)||this._mouseStore.checkClickMouse(p.DOWN)||this._keyStore.getKeyState(q.KEY_N)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_ESC)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC")){for(var s=0;s<x.length;s++){(n=dt(x[s])).classList.contains("onpress")&&n.classList.remove("onpress")}this._itemMenu.ng(),this._setNextPage(),this.playSound(R.DECISION),this._messageWindow.setItemMenuChoice(!1)}}else{var i=this._keyStore.getKeyStateForMessageCheck(q.KEY_ENTER),a=this._keyStore.getKeyStateForMessageCheck(q.KEY_SPACE),r=this._keyStore.getKeyStateForMessageCheck(q.KEY_ESC);if(i===Z.KEYDOWN||i===Z.KEYPRESS_MESSAGECHANGE||a===Z.KEYDOWN||a===Z.KEYPRESS_MESSAGECHANGE||r===Z.KEYDOWN||r===Z.KEYPRESS_MESSAGECHANGE||this._mouseStore.getMouseState()===z.MOUSEDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")||this._virtualPadStore.checkTouchButton("BUTTON_ESC")){for(s=0;s<x.length;s++){var n;(n=dt(x[s])).classList.contains("onpress")&&n.classList.remove("onpress")}this._setNextPage()}}if(null===(t=this._inlineUserVarViewer)||void 0===t?void 0:t.isVisible){const t=this._inlineUserVarViewer.kind;let e=!1;const s="named"===t?this._userVar.named.size:V.USER_VAR_NUM;this._keyStore.getKeyState(q.KEY_DOWN)===Z.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex[t]++,e=!0),this._keyStore.getKeyState(q.KEY_UP)===Z.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex[t]--,e=!0),this._keyStore.getKeyState(q.KEY_RIGHT)===Z.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex[t]+=V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM,e=!0),this._keyStore.getKeyState(q.KEY_LEFT)===Z.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex[t]-=V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM,e=!0),this._keyStore.getKeyState(q.KEY_V)===Z.KEYDOWN&&("named"===this._inlineUserVarViewer.kind?this._inlineUserVarViewer.kind="numbered":"numbered"===this._inlineUserVarViewer.kind&&(this._inlineUserVarViewer.kind="named"),e=!0),this._inlineUserVarViewer.topUserVarIndex[t]<0&&(this._inlineUserVarViewer.topUserVarIndex[t]+=s),this._inlineUserVarViewer.topUserVarIndex[t]>s&&(this._inlineUserVarViewer.topUserVarIndex[t]-=s),e&&(this._setNextPage(),this._inlineUserVarViewer.isVisible=!0,this._displayUserVars())}}else this._player.isWaitingEstimateWindow()?(this._keyStore.getKeyState(q.KEY_ENTER)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_SPACE)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&this.hideBattleEstimateWindow():this._player.isFighting()?(this._player.fight(),this._monsterWindow.update(this._monster)):this._player.isWaitingMoveMacro()&&(this._player.isMoveObjectAutoExecTime()&&(this.moveObjects(!1),this._player.resetMoveObjectAutoExecTimer()),this._objectMovingDataManager.update());if(this._cgManager.picture.updateFrameTimerValue(),this._prevFrameEventExected=!1,this._player.getPosition().isJustPosition()&&this._camera.getPosition().isScreenTopPosition()){if(!(this._shouldTreatWillMessageDisplay(this._pages)||this._player.isJumped()||this._player.isWaitingMessage()||this._player.isWaitingEstimateWindow()||this._player.isWaitingMoveMacro()||this._player.isFighting())){this._player.isPartsAppearedTime()&&this._player.clearPartsAppearedFlag(),this._replaceRandomObjectsInScreen();var o=this.checkMap();o||this.checkObject(),this._prevFrameEventExected=o}this._player.isWaitingMessage()&&this._messageWindow.isYesNoChoice()&&this._yesNoJudge!==g.UNSELECTED&&!this._player.isWaitingMoveMacro()&&!this._player.isFighting()&&this._execChoiceWindowRunningEvent()}this._passwordLoadExecInNextFrame&&(this._stopUpdateByLoadFlag=!0,this._loadType=D.PASSWORD,this._player.clearPasswordWindowWaiting(),this._passwordLoadExecInNextFrame=!1),this._drawAll(),this._mainCallCounter++,this._mainCallCounter%=1e9,this._player.isWaitingMessage()&&this._isClassicModeEnable||(this._animationCounter=(this._animationCounter+1)%(2*V.ANIMATION_REP_HALF_FRAME),0!==this._animationCounter&&this._animationCounter!==V.ANIMATION_REP_HALF_FRAME+1||this.updatePicturesCache()),this._camera.isResetting()&&this._camera.advanceTransitionStepNum(),this._player.isWaitingMessage()||(this._player.decrementLookingAroundTimer(),this._statusPressCounter.energy>0&&0==--this._statusPressCounter.energy&&dt("disp-energy").classList.remove("onpress"),this._statusPressCounter.strength>0&&0==--this._statusPressCounter.strength&&dt("disp-strength").classList.remove("onpress"),this._statusPressCounter.defence>0&&0==--this._statusPressCounter.defence&&dt("disp-defence").classList.remove("onpress"),this._statusPressCounter.gold>0&&0==--this._statusPressCounter.gold&&dt("disp-gold").classList.remove("onpress")),this._player.isWaitingMoveMacro()&&(this._player.decrementMoveObjectAutoExecTimer(),this._player.isWaitingMoveMacro()||this._dispatchPlayerAndObjectsStopTimeRequests()),this._stopUpdateByLoadFlag?this._fadeout((()=>{if(this._loadType===D.QUICK_LOAD){this._quickLoad(),this.wwaCustomEvent("wwa_quickload");const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_QUICKLOAD;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}else if(this._loadType===D.RESTART_GAME){this.restartGame(),this.wwaCustomEvent("wwa_restert");const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_RESTART;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}else if(this._loadType===D.PASSWORD){this._applyQuickLoad(this._passwordSaveExtractData),this._passwordSaveExtractData=void 0,this.wwaCustomEvent("wwa_passwordload");const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_PASSWORDLOAD;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}setTimeout(this.mainCaller,V.DEFAULT_FRAME_INTERVAL,this)})):window.requestAnimationFrame(this.mainCaller),function({dumpElement:t,namedUserVar:e,userVar:s}){e&&ba(t,e),s&&Pa(t,s)}({dumpElement:this._dumpElement,userVar:this._userVar.numbered,namedUserVar:this._userVar.named});const h=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_FRAME;h&&this.evalCalcWwaNodeGenerator.evalWwaNode(h)}vibration(t){this._gamePadStore.vibration(t)}_isMainAnimation(){return this._animationCounter>V.ANIMATION_REP_HALF_FRAME}_drawAll(){var t,e,s=this._camera.getPosition().getPartsCoord(),i=this._camera.getPosition().getOffsetCoord(),a=V.MAP_WINDOW_HEIGHT,r=this._player.getPosition().getPartsCoord();if(this._paintSkipByDoorOpen)this._paintSkipByDoorOpen=!1;else{if(this._cgManager.clearCanvas(0,0,V.MAP_WINDOW_WIDTH,V.MAP_WINDOW_HEIGHT),this._cgManager.drawBase(0,0,V.MAP_WINDOW_WIDTH,V.MAP_WINDOW_HEIGHT),this._camera.isResetting()){if(null!==this._camera.getPreviousPosition())var n=this._camera.getPreviousPosition().getPartsCoord(),o=this._camera.getPreviousPosition().getOffsetCoord();a=this._camera.getTransitionStepNum()*V.CHIP_SIZE}var h=!1;if(a!==this._cgManager.mapCacheYLimit&&(this._cgManager.mapCacheYLimit=a,h=!0),s.x===this._cgManager.cpPartsLog.x&&s.y===this._cgManager.cpPartsLog.y||(this._cgManager.cpPartsLog.x=s.x,this._cgManager.cpPartsLog.y=s.y,h=!0),h&&(this._cgManager.clearBackCanvas(),this._cgManager.clearObjectCanvases()),this._camera.isResetting()&&(this._drawMap(n,o,a,!0),this._drawPlayer(n,o,a,!0),this._drawObjects(n,o,a,!0),this._camera.isFinalStep()))var c=255,_=setInterval((()=>{var t=dt("wwa-fader");if((c-=3*V.FADEOUT_SPEED)<=0)return clearInterval(_),t.style.backgroundColor="transparent",t.removeAttribute("style"),void(t.style.display="none");t.style.opacity=c/255+""}),20);this._drawMap(s,i,a,!1,h),this._drawPlayer(s,i,a),this._drawObjects(s,i,a,!1,h),this._player.isFighting()&&!this._player.isBattleStartFrame()&&(t=this._player.isTurn()?this._monster.position.x:r.x,e=this._player.isTurn()?this._monster.position.y:r.y,this._cgManager.drawCanvas(this._battleEffectCoord.x,this._battleEffectCoord.y,V.CHIP_SIZE*(t-s.x)-i.x,V.CHIP_SIZE*(e-s.y)-i.y)),this._drawEffect(),this._drawPictures(),this._drawFaces(),this._drawFrame()}}_drawMap(t,e,s,i=!1,a=!1){if(void 0!==t){var r,n=Math.max(0,t.x-1),o=Math.min(this._wwaData.mapWidth-1,t.x+V.H_PARTS_NUM_IN_WINDOW),h=Math.max(0,t.y-1),c=Math.min(this._wwaData.mapWidth-1,t.y+V.V_PARTS_NUM_IN_WINDOW);if(r=0,i)for(var _=n;_<=o;_++)for(var l=h;l<=c;l++){var u=this._wwaData.map[l][_],d=this._wwaData.mapAttribute[u][V.ATR_X]/V.CHIP_SIZE,p=this._wwaData.mapAttribute[u][V.ATR_Y]/V.CHIP_SIZE,m=V.CHIP_SIZE*(_-t.x)-e.x,E=V.CHIP_SIZE*(l-t.y)-e.y;this._cgManager.copyBackCanvasWithLowerYLimit(d,p,m,E,s)}else{for(_=n;_<=o;_++)for(l=h;l<=c;l++){u=this._wwaData.map[l][_];this._cgManager.mapCache[r]!==u&&(this._cgManager.mapCache[r]=u,a=!0),r++}if(a){this._cgManager.clearBackCanvasWithLowerYLimit(s);for(_=n;_<=o;_++)for(l=h;l<=c;l++){u=this._wwaData.map[l][_],d=this._wwaData.mapAttribute[u][V.ATR_X]/V.CHIP_SIZE,p=this._wwaData.mapAttribute[u][V.ATR_Y]/V.CHIP_SIZE,m=V.CHIP_SIZE*(_-t.x)-e.x,E=V.CHIP_SIZE*(l-t.y)-e.y;this._cgManager.copyBackCanvasWithUpperYLimit(d,p,m,E,s)}}this._cgManager.drawBackCanvas()}}}_drawPlayer(t,e,s,i=!1){if(void 0===t||this._wwaData.delPlayerFlag)return;const a=this._player.getPosition().getPartsCoord(),r=this._player.getPosition().getOffsetCoord(),n=[NaN,NaN,2,NaN,4,NaN,6,NaN,0,NaN][this._player.getDir()],o=(a.x-t.x)*V.CHIP_SIZE+r.x-e.x,h=(a.y-t.y)*V.CHIP_SIZE+r.y-e.y;let c;if(this._useLookingAround&&this._player.isLookingAround()&&!this._player.isWaitingMessage()){const t=[2,3,4,5,0,1,6,7];c=this._wwaData.playerImgPosX+t[Math.floor(this._mainCallCounter%64/8)]}else c=this._player.isMovingImage()?this._wwaData.playerImgPosX+n+1:this._wwaData.playerImgPosX+n;i?this._cgManager.drawCanvasWithLowerYLimit(c,this._wwaData.playerImgPosY,o,h,s):this._cgManager.drawCanvasWithUpperYLimit(c,this._wwaData.playerImgPosY,o,h,s)}_drawObjects(t,e,s,i=!1,a=!1){if(void 0!==t){var r,n,o,h,_,l,d,p,m,E,g,w,f,v,y=Math.max(0,t.x-1),S=Math.min(this._wwaData.mapWidth-1,t.x+V.H_PARTS_NUM_IN_WINDOW),A=Math.max(0,t.y-1),T=Math.min(this._wwaData.mapWidth-1,t.y+V.V_PARTS_NUM_IN_WINDOW),I=0,C=this._isMainAnimation(),D=this._player.isFighting()&&this._player.isTurn()&&this._player.getPosition().getPartsCoord().equals(this._monster.position);if(i)for(E=y;E<=S;E++)for(g=A;g<=T;g++)D&&new c(E,g).equals(this._monster.position)||(w=this._wwaData.mapObject[g][E],r=new c(0,0),this._wwaData.objectAttribute[w][V.ATR_MOVE]!==P.STATIC&&null!==(m=this._objectMovingDataManager.getOffsetByBeforePartsCoord(new c(E,g)))&&(r=m),_=V.CHIP_SIZE*(E-t.x)+r.x-e.x,l=V.CHIP_SIZE*(g-t.y)+r.y-e.y,n=C||0===this._wwaData.objectAttribute[w][V.ATR_X2]&&0===this._wwaData.objectAttribute[w][V.ATR_Y2],o=this._wwaData.objectAttribute[w][n?V.ATR_X:V.ATR_X2]/V.CHIP_SIZE,h=this._wwaData.objectAttribute[w][n?V.ATR_Y:V.ATR_Y2]/V.CHIP_SIZE,d=this._wwaData.objectAttribute[w][V.ATR_TYPE],p=this._wwaData.objectAttribute[w][V.ATR_NUMBER],0===w||this._checkNoDrawObject(new c(E,g),d,p)||this._cgManager.copyObjectCanvasWithLowerYLimit(C?1:0,o,h,_,l,s));else{var N,O,M,x,b,L=[],R=[];for(E=y;E<=S;E++)for(g=A;g<=T;g++)f=w=this._wwaData.mapObject[g][E],d=this._wwaData.objectAttribute[w][V.ATR_TYPE],p=this._wwaData.objectAttribute[w][V.ATR_NUMBER],this._checkNoDrawObject(new c(E,g),d,p)&&(f=0),O=this._wwaData.objectAttribute[w][V.ATR_MOVE]===P.STATIC,0!==f&&(M=!(!D||!new c(E,g).equals(this._monster.position)),O?R.push(new u(w,E,g,O,M)):(L.push(new u(w,E,g,O,M)),f=0),M&&(f=0)),this._cgManager.mapObjectCache[I]!==f&&(this._cgManager.mapObjectCache[I]=f,a=!0),I++;for(a&&(this._cgManager.clearObjectCanvasesWithLowerYLimit(s),Array.prototype.push.apply(L,R)),b=L.length,x=0;x<b;x++)if(E=(N=L[x]).x,g=N.y,w=N.partsIDObj,O=N.isStatic,M=N.isFighting,_=V.CHIP_SIZE*(E-t.x)-e.x,l=V.CHIP_SIZE*(g-t.y)-e.y,O){if(M)continue;for(v=0;v<2;v++)n=!!v||0===this._wwaData.objectAttribute[w][V.ATR_X2]&&0===this._wwaData.objectAttribute[w][V.ATR_Y2],o=this._wwaData.objectAttribute[w][n?V.ATR_X:V.ATR_X2]/V.CHIP_SIZE,h=this._wwaData.objectAttribute[w][n?V.ATR_Y:V.ATR_Y2]/V.CHIP_SIZE,this._cgManager.copyObjectCanvasWithUpperYLimit(v,o,h,_,l,s)}else null!==(m=this._objectMovingDataManager.getOffsetByBeforePartsCoord(new c(E,g)))&&(_+=m.x,l+=m.y),n=C||0===this._wwaData.objectAttribute[w][V.ATR_X2]&&0===this._wwaData.objectAttribute[w][V.ATR_Y2],o=this._wwaData.objectAttribute[w][n?V.ATR_X:V.ATR_X2]/V.CHIP_SIZE,h=this._wwaData.objectAttribute[w][n?V.ATR_Y:V.ATR_Y2]/V.CHIP_SIZE,this._cgManager.drawCanvasWithUpperYLimit(o,h,_,l,s);this._cgManager.drawObjectCanvas(C?1:0)}}}_drawEffect(){if(0!==this._wwaData.effectCoords.length&&0!==this._wwaData.effectWaits){var t=Math.floor(this._mainCallCounter%(this._wwaData.effectCoords.length*this._wwaData.effectWaits)/this._wwaData.effectWaits);this._cgManager.drawEffect(t)}}_drawFaces(){for(var t=0;t<this._faces.length;t++)this._cgManager.drawCanvasWithSize(this._faces[t].srcPos.x,this._faces[t].srcPos.y,this._faces[t].srcSize.x,this._faces[t].srcSize.y,this._faces[t].destPos.x,this._faces[t].destPos.y)}_drawFrame(){this._cgManager.drawFrame()}_drawPictures(){this._cgManager.drawPictures()}_checkNoDrawObject(t,e,s){var i=this._player.getPosition(),a=i.getPartsCoord();return!(!i.isJustPosition()||a.x!==t.x||a.y!==t.y||this._wwaData.objectNoCollapseDefaultFlag)&&(e===V.OBJECT_DOOR&&0===s||(e===V.OBJECT_STATUS||e===V.OBJECT_MESSAGE||e===V.OBJECT_ITEM||e===V.OBJECT_SELL||e===V.OBJECT_BUY||e===V.OBJECT_SELL||e===V.OBJECT_LOCALGATE))}getMapWidth(){if(void 0===this._wwaData)throw new Error("マップデータがロードされていません");return this._wwaData.mapWidth}getMapIdByPosition(t){var e=t.getPartsCoord();return this._wwaData.map[e.y][e.x]}getObjectIdByPosition(t){var e=t.getPartsCoord();return this._wwaData.mapObject[e.y][e.x]}getMapTypeByPosition(t){var e=t.getPartsCoord(),s=this._wwaData.map[e.y][e.x];return this._wwaData.mapAttribute[s][V.ATR_TYPE]}getObjectTypeByPosition(t){var e=t.getPartsCoord(),s=this._wwaData.mapObject[e.y][e.x];return this._wwaData.objectAttribute[s][V.ATR_TYPE]}getMapAttributeByPosition(t,e){var s=t.getPartsCoord(),i=this._wwaData.map[s.y][s.x];return this._wwaData.mapAttribute[i][e]}isCurrentPosMapPartsIncludingMessage(t){return 0!==this.getMapAttributeByPosition(t,V.ATR_STRING)}getObjectAttributeByPosition(t,e){var s=t.getPartsCoord(),i=this._wwaData.mapObject[s.y][s.x];return this._wwaData.objectAttribute[i][e]}getMapAttributeById(t,e){return this._wwaData.mapAttribute[t][e]}getObjectAttributeById(t,e){return this._wwaData.objectAttribute[t][e]}getObjectCropXById(t){return this._wwaData.objectAttribute[t][V.ATR_X]}getObjectCropYById(t){return this._wwaData.objectAttribute[t][V.ATR_Y]}getMessageById(t){return this._wwaData.message[t]}getSystemMessageById(t){return this._wwaData.systemMessage[t]}checkMap(t){var e=this._player.getPosition().getPartsCoord();t=null!=t?t:e;var s=this._wwaData.map[t.y][t.x],i=this._wwaData.mapAttribute[s][V.ATR_TYPE],a=t.x===e.x&&t.y===e.y,r=!1;return(!a||this._player.getLastExecPartsIDOnSamePosition(v.MAP)!==s)&&(i===V.MAP_STREET?r=this._execMapStreetEvent(t,s,i):i===V.MAP_WALL?r=this._execMapWallEvent(t,s,i):i===V.MAP_LOCALGATE?r=this._execMapLocalGateEvent(t,s,i):i===V.MAP_URLGATE&&(r=this._execMapUrlGateEvent(t,s,i)),a&&!this._player.isJumped()&&this._player.setLastExecInfoOnSamePosition(v.MAP,s),r)}checkObject(t){var e=this._player.getPosition().getPartsCoord();t=null!=t?t:e;var s=this._wwaData.mapObject[t.y][t.x],i=this._wwaData.objectAttribute[s][V.ATR_TYPE],a=t.x===e.x&&t.y===e.y;a&&this._player.getLastExecPartsIDOnSamePosition(v.OBJECT)===s||(i===V.OBJECT_NORMAL?this._execObjectNormalEvent(t,s,i):i===V.OBJECT_MESSAGE?this._execObjectMessageEvent(t,s,i):i===V.OBJECT_MONSTER?this._execObjectMonsterEvent(t,s,i):i===V.OBJECT_ITEM?this._execObjectItemEvent(t,s,i):i===V.OBJECT_DOOR?this._execObjectDoorEvent(t,s,i):i===V.OBJECT_STATUS?this._execObjectStatusEvent(t,s,i):i===V.OBJECT_BUY?this._execObjectBuyEvent(t,s,i):i===V.OBJECT_SELL?this._execObjectSellEvent(t,s,i):i===V.OBJECT_URLGATE?this._execObjectUrlGateEvent(t,s,i):i===V.OBJECT_SCORE?this._execObjectScoreEvent(t,s,i):i===V.OBJECT_SELECT?this._execObjectYesNoChoiceEvent(t,s,i):i===V.OBJECT_LOCALGATE&&this._execObjectLocalGateEvent(t,s,i),a&&!this._player.isJumped()&&this._player.setLastExecInfoOnSamePosition(v.OBJECT,s))}_execMapStreetEvent(t,e,s){var i=this._wwaData.mapAttribute[e][V.ATR_ITEM];if(0!==i&&!this._player.hasItem(i))return!1;this.reserveAppearPartsInNextFrame(t,w.MAP,e);const a=this._wwaData.mapAttribute[e][V.ATR_STRING],r=this._wwaData.message[a],n=this._wwaData.mapAttribute[e][V.ATR_NUMBER];return this._waitFrame+=n*V.WAIT_TIME_FRAME_NUM,this._temporaryInputDisable=!0,this.generatePageAndReserveExecution(r,!1,!1,e,v.MAP,t.clone()),this.playSound(this._wwaData.mapAttribute[e][V.ATR_SOUND]),0!==a&&this._shouldTreatWillMessageDisplay(this._pages)||0!==n}_shouldTreatWillMessageDisplay(t){return t.reduce(((t,e)=>t||!Re(e.firstNode)),!1)}_execMapWallEvent(t,e,s){var i=this.getObjectIdByPosition(t.convertIntoPosition(this)),a=this.getObjectAttributeById(i,V.ATR_TYPE);if(0===i||a===V.OBJECT_NORMAL||a===V.OBJECT_DOOR&&(!this._player.hasItem(this.getObjectAttributeById(i,V.ATR_ITEM))||this.getObjectAttributeById(a,V.ATR_MODE)===V.PASSABLE_OBJECT)){this.reserveAppearPartsInNextFrame(t,w.MAP,e);var r=this._wwaData.mapAttribute[e][V.ATR_STRING],n=this._wwaData.message[r];return this.generatePageAndReserveExecution(n,!1,!1,e,v.MAP,t.clone()),this.playSound(this._wwaData.mapAttribute[e][V.ATR_SOUND]),!1}return!1}_execMapLocalGateEvent(t,e,s){var i=this._player.getPosition().getPartsCoord(),a=this._wwaData.mapAttribute[e][V.ATR_JUMP_X],r=this._wwaData.mapAttribute[e][V.ATR_JUMP_Y];return a>V.RELATIVE_COORD_LOWER&&(a=t.x+a-V.RELATIVE_COORD_BIAS),r>V.RELATIVE_COORD_LOWER&&(r=t.y+r-V.RELATIVE_COORD_BIAS),this.reserveAppearPartsInNextFrame(t,w.MAP,e),0<=a&&0<=r&&a<this._wwaData.mapWidth&&r<this._wwaData.mapWidth&&(a!==i.x||r!==i.y)&&(this.reserveJumpInNextFrame(new _(this,a,r,0,0)),this.playSound(this._wwaData.mapAttribute[e][V.ATR_SOUND]),!0)}_execMapUrlGateEvent(t,e,s){var a=this._wwaData.mapAttribute[e][V.ATR_STRING];if(!this._isURLGateEnable)return!0;const r=this.resolveSystemMessage(i.CONFIRM_ENTER_URL_GATE);if("BLANK"!==r)return this.generatePageAndReserveExecution(r,!0,!0),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_MAP_PARTS,this._yesNoURL=this._wwaData.message[a].split(/\s/g)[0],!0;location.href=ft(this._wwaData.message[a].split(/\s/g)[0])}_execObjectNormalEvent(t,e,s){}_execObjectMessageEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_STRING],a=this._wwaData.message[i],r=this._player.getPosition().getPartsCoord(),n=this._wwaData.objectAttribute[e][V.ATR_SOUND];t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t),this.generatePageAndReserveExecution(a,!1,!1,e,v.OBJECT,t),this._waitFrame+=this._wwaData.objectAttribute[e][V.ATR_NUMBER]*V.WAIT_TIME_FRAME_NUM,this._temporaryInputDisable=!0,this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this.playSound(n)}_execObjectStatusEvent(t,e,s){var i=new h(this._wwaData.objectAttribute[e][V.ATR_ENERGY],this._wwaData.objectAttribute[e][V.ATR_STRENGTH],this._wwaData.objectAttribute[e][V.ATR_DEFENCE],this._wwaData.objectAttribute[e][V.ATR_GOLD]),a=this._wwaData.objectAttribute[e][V.ATR_STRING],r=this._wwaData.message[a],n=this._player.getStatusWithoutEquipments();if(i.strength>V.STATUS_MINUS_BORDER&&n.strength<i.strength-V.STATUS_MINUS_BORDER||i.defence>V.STATUS_MINUS_BORDER&&n.defence<i.defence-V.STATUS_MINUS_BORDER||i.gold>V.STATUS_MINUS_BORDER&&n.gold<i.gold-V.STATUS_MINUS_BORDER)return this.setPartsOnPosition(v.OBJECT,0,t),this._keyStore.allClear(),void this._mouseStore.clear();i.energy=i.energy>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-i.energy:i.energy,i.strength=i.strength>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-i.strength:i.strength,i.defence=i.defence>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-i.defence:i.defence,i.gold=i.gold>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-i.gold:i.gold,this._player.addStatusAll(i),this.setStatusChangedEffect(i),this._player.isDead()&&0!==this._wwaData.objectAttribute[e][V.ATR_ENERGY]&&this.shouldApplyGameOver({isCalledByMacro:!1})?this.gameover():(this.generatePageAndReserveExecution(r,!1,!1,e,v.OBJECT,t.clone()),this.setPartsOnPosition(v.OBJECT,0,t),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND]))}_execObjectMonsterEvent(t,e,s){this._monster=this._createMonster(e,t,(()=>{this._monster=void 0,this._monsterWindow.hide(),this._dispatchWindowClosedTimeRequests()})),this._player.startBattleWith(this._monster)}_execObjectBuyEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_STRING],a=this._wwaData.message[i],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t),this.generatePageAndReserveExecution(a,!0,!1,e,v.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}_execObjectSellEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_STRING],a=this._wwaData.message[i],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t),this.generatePageAndReserveExecution(a,!0,!1,e,v.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}_execObjectItemEvent(t,e,s){var a=this._wwaData.objectAttribute[e][V.ATR_STRING],r=this._wwaData.message[a];try{var n=this._camera.getPosition().getScreenTopPosition().getPartsCoord(),o=(t.x-n.x)*V.CHIP_SIZE,h=(t.y-n.y)*V.CHIP_SIZE;this._player.addItem(e,this._wwaData.objectAttribute[e][V.ATR_NUMBER],!1,this._wwaData.isItemEffectEnabled?{screenPixelCoord:new c(o,h),itemBoxBackgroundImageCoord:new c(this._wwaData.imgItemboxX*V.CHIP_SIZE,this._wwaData.imgItemboxY*V.CHIP_SIZE)}:void 0),this.setPartsOnPosition(v.OBJECT,0,t),0!==this._wwaData.objectAttribute[e][V.ATR_MODE]||(this.generatePageAndReserveExecution(r,!1,!1,e,v.OBJECT,t.clone()),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e))}catch(t){const e=this.resolveSystemMessage(i.ITEM_BOX_FULL);"BLANK"!==e&&this.generatePageAndReserveExecution(e,!1,!0)}this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}_execObjectDoorEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_ITEM],a=this._wwaData.objectAttribute[e][V.ATR_STRING],r=this._wwaData.message[a];this._player.hasItem(i)&&(0===this._wwaData.objectAttribute[e][V.ATR_MODE]&&this._player.removeItemByPartsID(i),this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND]),this.generatePageAndReserveExecution(r,!1,!1,e,v.OBJECT,t.clone()),this.setPartsOnPosition(v.OBJECT,0,t),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this._paintSkipByDoorOpen=!0)}_execObjectYesNoChoiceEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_STRING],a=this._wwaData.message[i],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t),this.generatePageAndReserveExecution(a,!0,!1,e,v.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}_execObjectLocalGateEvent(t,e,s){var i=this._player.getPosition().getPartsCoord();t.x!==i.x||t.y!==i.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t);var a=this._wwaData.objectAttribute[e][V.ATR_JUMP_X],r=this._wwaData.objectAttribute[e][V.ATR_JUMP_Y];a>V.RELATIVE_COORD_LOWER&&(a=i.x+a-V.RELATIVE_COORD_BIAS),r>V.RELATIVE_COORD_LOWER&&(r=i.y+r-V.RELATIVE_COORD_BIAS),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),0<=a&&0<=r&&a<this._wwaData.mapWidth&&r<this._wwaData.mapWidth&&(a!==i.x||r!==i.y)&&(this.reserveJumpInNextFrame(new _(this,a,r,0,0)),this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND]))}_execObjectUrlGateEvent(t,e,s){var a=this._wwaData.objectAttribute[e][V.ATR_STRING];if(!this._isURLGateEnable)return;const r=this.resolveSystemMessage(i.CONFIRM_ENTER_URL_GATE);"BLANK"!==r?(this.generatePageAndReserveExecution(r,!0,!0),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_OBJECT_PARTS,this._yesNoURL=this._wwaData.message[a].split(/\s/g)[0]):location.href=ft(this._wwaData.message[a].split(/\s/g)[0])}_execObjectScoreEvent(t,e,s){const i=this._wwaData.objectAttribute[e][V.ATR_STRING];this.generatePageAndReserveExecution(this._wwaData.message[i],!1,!1,e,v.OBJECT,t,{rates:{energy:this._wwaData.objectAttribute[e][V.ATR_ENERGY],strength:this._wwaData.objectAttribute[e][V.ATR_STRENGTH],defence:this._wwaData.objectAttribute[e][V.ATR_DEFENCE],gold:this._wwaData.objectAttribute[e][V.ATR_GOLD]}}),this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}updateScore(t){const e=t||this._lastScoreOptions;if(!e)return;const s=this._player.getStatus().calculateScore(e);this._scoreWindow.update(s)}_execChoiceWindowObjectSellEvent(){if(!this._player.hasGold(this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_GOLD])){const t=this.resolveSystemMessage(i.NO_MONEY);return"BLANK"!==t&&this._pages.push(new Me(new Le(t),!0,!1,!0)),{}}if(0!==this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ITEM]){const t=this._yesNoChoicePartsCoord,e=this._camera.getPosition().getScreenTopPosition().getPartsCoord(),s=(t.x-e.x)*V.CHIP_SIZE,a=(t.y-e.y)*V.CHIP_SIZE,r=this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ITEM],n=this._wwaData.objectAttribute[r][V.ATR_NUMBER];try{this._player.addItem(r,n,!1,this._wwaData.isItemEffectEnabled?{screenPixelCoord:new c(s,a),itemBoxBackgroundImageCoord:new c(this._wwaData.imgItemboxX*V.CHIP_SIZE,this._wwaData.imgItemboxY*V.CHIP_SIZE)}:void 0)}catch(t){const e=this.resolveSystemMessage(i.ITEM_BOX_FULL);return"BLANK"!==e&&this._pages.push(new Me(new Le(e),!0,!1,!0)),{}}}const t=new h(this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ENERGY],this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_STRENGTH],this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_DEFENCE],-this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_GOLD]);return t.energy=t.energy>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-t.energy:t.energy,this.setStatusChangedEffect(t),this._player.addStatusAll(t),this._player.isDead()&&0!==this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ENERGY]&&this.shouldApplyGameOver({isCalledByMacro:!1})?(this.gameover(),{isGameOver:!0}):(this.appearParts({pos:this._yesNoChoicePartsCoord,triggerType:w.OBJECT,triggerPartsId:this._yesNoChoicePartsID}),{})}_execChoiceWindowRunningEvent(){var t,e;if(0==--this._yesNoDispCounter)if(this._yesNoJudge===g.YES){if(this._yesNoChoiceCallInfo===T.CALL_BY_MAP_PARTS)(t=this._wwaData.mapAttribute[this._yesNoChoicePartsID][V.ATR_TYPE])===V.MAP_URLGATE&&(location.href=ft(this._yesNoURL));else if(this._yesNoChoiceCallInfo===T.CALL_BY_OBJECT_PARTS)if((t=this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_TYPE])===V.OBJECT_BUY)if(this._player.hasItem(this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ITEM]))this._player.removeItemByPartsID(this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ITEM]),e=this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_GOLD],this._player.earnGold(e),this.setStatusChangedEffect(new h(0,0,0,e)),this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.OBJECT,this._yesNoChoicePartsID);else{const t=this.resolveSystemMessage(i.NO_ITEM);"BLANK"!==t&&this._pages.push(new Me(new Le(t),!0,!1,!0))}else if(t===V.OBJECT_SELL){const{isGameOver:t}=this._execChoiceWindowObjectSellEvent();if(t)return}else t===V.OBJECT_SELECT?this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.CHOICE_YES,this._yesNoChoicePartsID):t===V.OBJECT_URLGATE&&(location.href=ft(this._yesNoURL));else this._yesNoChoiceCallInfo===T.CALL_BY_ITEM_USE?this._player.readyToUseItem(this._yesNoUseItemPos):this._yesNoChoiceCallInfo===T.CALL_BY_QUICK_LOAD||this._yesNoChoiceCallInfo===T.CALL_BY_LOG_QUICK_LOAD?(this._messageWindow.deleteSaveDom(),dt(x[I.QUICK_LOAD]).classList.remove("onpress"),this._messageWindow.load()&&(this._stopUpdateByLoadFlag=!0,this._loadType=D.QUICK_LOAD)):this._yesNoChoiceCallInfo===T.CALL_BY_QUICK_SAVE?(this._messageWindow.deleteSaveDom(),dt(x[I.QUICK_SAVE]).classList.remove("onpress"),this._quickSave(T.CALL_BY_QUICK_SAVE)):this._yesNoChoiceCallInfo===T.CALL_BY_RESTART_GAME?(dt(x[I.RESTART_GAME]).classList.remove("onpress"),this._stopUpdateByLoadFlag=!0,this._loadType=D.RESTART_GAME):this._yesNoChoiceCallInfo===T.CALL_BY_END_GAME?(window.history.back(-1),dt(x[I.GOTO_WWA]).classList.remove("onpress")):this._yesNoChoiceCallInfo===T.CALL_BY_GOTO_WWA?(location.href=ft(V.WWA_HOME),dt(x[I.GOTO_WWA]).classList.remove("onpress")):this._yesNoChoiceCallInfo===T.CALL_BY_PASSWORD_LOAD?(dt(x[I.QUICK_LOAD]).classList.remove("onpress"),this._player.setPasswordWindowWating(),this._passwordWindow.show(Ye.LOAD)):this._yesNoChoiceCallInfo===T.CALL_BY_PASSWORD_SAVE?(dt(x[I.QUICK_SAVE]).classList.remove("onpress"),this._player.setPasswordWindowWating(),this._passwordWindow.password=this._quickSave(T.CALL_BY_PASSWORD_SAVE),this._passwordWindow.show(Ye.SAVE)):this._yesNoChoiceCallInfo===T.CALL_BY_SUSPEND&&(dt(x[I.QUICK_SAVE]).classList.remove("onpress"),this._quickSave(T.CALL_BY_SUSPEND));this._yesNoJudge=g.UNSELECTED,this._setNextPage(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=T.NONE,this._messageWindow.setYesNoChoice(!1)}else if(this._yesNoJudge===g.NO){if(this._yesNoChoiceCallInfo===T.CALL_BY_MAP_PARTS)t=this._wwaData.mapAttribute[this._yesNoChoicePartsID][V.ATR_TYPE],V.MAP_URLGATE;else if(this._yesNoChoiceCallInfo===T.CALL_BY_OBJECT_PARTS)(t=this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_TYPE])===V.OBJECT_BUY||t===V.OBJECT_SELL||(t===V.OBJECT_SELECT?this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.CHOICE_NO,this._yesNoChoicePartsID):V.OBJECT_URLGATE);else if(this._yesNoChoiceCallInfo===T.CALL_BY_ITEM_USE){dt("item"+(this._yesNoUseItemPos-1)).classList.remove("onpress")}else if(this._yesNoChoiceCallInfo===T.CALL_BY_QUICK_LOAD||this._yesNoChoiceCallInfo===T.CALL_BY_LOG_QUICK_LOAD)switch(this._messageWindow.deleteSaveDom(),this._yesNoChoiceCallInfo=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._yesNoChoiceCallInfo){case T.NONE:dt(x[I.QUICK_LOAD]).classList.remove("onpress");break;case T.CALL_BY_PASSWORD_LOAD:return this._yesNoJudge=g.UNSELECTED,void this.onpasswordloadcalled();case T.CALL_BY_LOG_QUICK_LOAD:this._wwaSave.selectLogSaveDataList(),this._messageWindow.createSaveDom();var s=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword);switch(this._yesNoJudge=g.UNSELECTED,s){case T.CALL_BY_PASSWORD_LOAD:this.generatePageAndReserveExecution("読み込むオートセーブを選んでください。\n→Noでデータ復帰用パスワードの\n 入力選択ができます。",!0,!0);break;case T.NONE:this.generatePageAndReserveExecution("読み込むオートセーブを選んでください。",!0,!0)}return}else if(this._yesNoChoiceCallInfo===T.CALL_BY_QUICK_SAVE){if(this._messageWindow.deleteSaveDom(),this._usePassword||this._useSuspend)return this._yesNoJudge=g.UNSELECTED,void(this._useSuspend?this.onpasssuspendsavecalled():this._usePassword&&this.onpasswordsavecalled());dt(x[I.QUICK_SAVE]).classList.remove("onpress")}else if(this._yesNoChoiceCallInfo===T.CALL_BY_RESTART_GAME)dt(x[I.RESTART_GAME]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_END_GAME)dt(x[I.GOTO_WWA]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_GOTO_WWA)dt(x[I.GOTO_WWA]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_PASSWORD_LOAD)dt(x[I.QUICK_LOAD]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_PASSWORD_SAVE)dt(x[I.QUICK_SAVE]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_SUSPEND){if(this._usePassword)return this._yesNoJudge=g.UNSELECTED,void this.onpasswordsavecalled();dt(x[I.QUICK_SAVE]).classList.remove("onpress")}this._yesNoJudge=g.UNSELECTED,this._setNextPage(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=T.NONE,this._messageWindow.setYesNoChoice(!1)}}_dispatchWindowClosedTimeRequests(){if(this._windowCloseWaitingJumpGateRequest&&this.forcedJumpGate(this._windowCloseWaitingJumpGateRequest.x,this._windowCloseWaitingJumpGateRequest.y),this._windowCloseWaitingMessageDisplayRequests.length>0){const t=this._windowCloseWaitingMessageDisplayRequests.shift();this.generatePageAndReserveExecution(t,!1,!1)}}_dispatchPlayerAndObjectsStopTimeRequests(){this._playerAndObjectsStopWaitingGameSpeedChangeRequest&&(this.setPlayerSpeedIndex(this._playerAndObjectsStopWaitingGameSpeedChangeRequest.speedIndex),this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0),this._playerAndObjectsStopWaitingMessageDisplayRequests.length>0&&(this.generatePageAndReserveExecution(this._playerAndObjectsStopWaitingMessageDisplayRequests.join("<p>"),!1,!1),this._playerAndObjectsStopWaitingMessageDisplayRequests=[])}_clearAllRequests(){this._playerAndObjectsStopWaitingMessageDisplayRequests=[],this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0,this._windowCloseWaitingJumpGateRequest=void 0,this._windowCloseWaitingMessageDisplayRequests=[]}reserveMessageDisplayWhenShouldOpen(t){this._player.isWaitingMessage()||this._player.isFighting()||this._player.isWaitingPasswordWindow()||this._player.isWaitingEstimateWindow()?this._windowCloseWaitingMessageDisplayRequests.push(t):this._player.isMoving()||this._player.isWaitingMoveMacro()?this._playerAndObjectsStopWaitingMessageDisplayRequests.push(t):this.generatePageAndReserveExecution(t,!1,!1)}generatePageAndReserveExecution(t,e,s,i=0,a=v.OBJECT,r=new c(0,0),n=void 0){const o=this.generatePagesByRawMessage(t,i,a,r,s,e,n);this._pages=this._pages.concat(o),this._shouldSetNextPage=!0}generatePagesByRawMessage(t,e,s,i,a,r,n){const o=t.split(/\n\<c\>/i)[0].split(/\<c\>/i)[0].replace(/\n\<p\>\n/gi,"<P>").replace(/\n\<p\>/gi,"<P>").replace(/\<p\>\n/gi,"<P>").replace(/\<p\>/gi,"<P>").split("\n").map((t=>{if(!t.startsWith("//"))return t.match(/\/\//)?yt(yt(t).replace(/^.*\/\/(?!:s?ptth)/gi,"")):t})).filter((t=>void 0!==t)).join("\n").replace(/\\\/\\\//gi,"//").split("<script>"),h=o[0];if(o.length>1){const t=o[1];this._execEvalString(t)}if(""===h)return n?[new Me(void 0,!0,!1,!1,n,{partsId:e,partsType:s,partsPosition:i})]:[];const c=h.split(/\<p\>/gi);return c.map(((t,o)=>{let h,_,l;const u={id:e,type:s,position:i},d=this.parseMessageLines(t,e,s,i),p=[];return d.forEach(((t,e)=>{try{const s=0===e?void 0:d[e-1].type,i=p[p.length-1],a=this.createNewNode(t,!h||!Be(s),{triggerParts:u}),r=this.processConditionalExecuteMacroLine(a,t,i,p);r&&(l=r),s?this.connectOrMergeToPreviousNode(t,s,_,a,i,l,{triggerParts:u}):h=a,a&&(_=a)}catch(t){console.error(`$if-$else_if-$else-$endif マクロの解析中にエラーが発生しました。ページ ${e}`),console.error(t)}})),new Me(h,o===c.length-1,0===o&&r,a,0===o&&n,{partsId:e,partsType:s,partsPosition:i})}))}parseMessageLines(t,e,s,i){return t.split("\n").map((t=>{const a=t.match(/(\$(?:[a-zA-Z_][a-zA-Z0-9_]*)(?:.*))/);if(!a||a.length<2)return t.startsWith("$")?void 0:{type:"text",text:t};const r=function(t,e,s,i,a){var r;let n=a.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)\=(.*)$/);if((null===n||3!==n.length)&&(n=a.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)/),null===n||2!==n.length))throw new Error("マクロではありません");const o=`$${n[1].toLowerCase()}`,h="$if"===o&&a.match(/,/)?M.LEGACY_IF:B[o],c=Boolean(h!==M.SHOW_STR&&h!==M.SHOW_STR2),_=(null!==(r=n[2])&&void 0!==r?r:"").split(",").map((t=>c?t.trim():t));return new Ue(t,e,s,i,void 0===h?M.UNDEFINED:h,_)}(this,e,s,i,a[1]);switch(r.macroType){case M.IF:case M.ELSE_IF:case M.ELSE:case M.END_IF:case M.SHOW_STR:case M.SHOW_STR2:return{type:r.macroType,text:t,macro:r};default:return{type:"normalMacro",text:t,macro:r}}})).filter(Boolean)}createNewNode(t,e,s){switch(t.type){case M.IF:return new be([{descriminant:ue(t.macro.macroArgs[0])}]);case M.SHOW_STR:case M.SHOW_STR2:return e?new Le(this._generateShowStrString(t.macro.macroArgs,{triggerParts:s.triggerParts,version:t.type===M.SHOW_STR2?2:1})):void 0;case"text":return e?new Le(t.text):void 0;case"normalMacro":return e?new Le("",[t.macro]):void 0;default:return}}processConditionalExecuteMacroLine(t,e,s,i){const a=0===i.length;switch(e.type){case M.IF:return void i.push(t);case M.ELSE_IF:if(a)throw new Error("構文エラー: $if を呼ぶ前に $else_if は呼べません");return void s.appendBranch({descriminant:ue(e.macro.macroArgs[0])});case M.ELSE:if(a)throw new Error("構文エラー: $if を呼ぶ前に $else は呼べません");return void s.appendBranch({descriminant:!0,elseBranch:{type:"real"}});case M.END_IF:if(a)throw new Error("構文エラー: $if を呼ぶ前に $endif は呼べません");return i.pop()}}connectOrMergeToPreviousNode(t,e,s,i,a,r,n){const o=Be(e);switch(e){case M.IF:case M.ELSE_IF:case M.ELSE:if(!i||!a)return;const e=a.getLastUnconnectedBranch();if(!e)throw new Error("lastUnconnectedBranchが見つかりませんでした。");return void(e.next=i);case M.END_IF:if(!(i&&r instanceof be))return;for(let t=0;t<r.branches.length;t++){let e=r.branches[t].next;e?this.connectToFinalNode(e,i):r.branches[t]=i}return void(r.hasElseBranch()||r.branches.push({next:i,descriminant:!0,elseBranch:{type:"pesudo-else"}}));default:if(!(o&&s instanceof Le))return;const h=!s.isEmpty();t.type===M.SHOW_STR||t.type===M.SHOW_STR2?s.appendMessage(this._generateShowStrString(t.macro.macroArgs,{triggerParts:n.triggerParts,version:t.type===M.SHOW_STR2?2:1}),h):"text"===t.type?s.appendMessage(t.text,h):"normalMacro"===t.type?s.macro.push(t.macro):s.next=i}}connectToFinalNode(t,e){let s=t;for(;;)if(s instanceof be&&(s=s.branches[0].next),s instanceof Le){if(!s.next)return void(s.next=e);s=s.next}}appearParts({pos:t,triggerType:e,triggerPartsId:s}){var i,a,r,n,o,h,l=e===w.CHOICE_NO?V.APPERANCE_PARTS_MIN_INDEX_NO:V.APPERANCE_PARTS_MIN_INDEX,u=e===w.CHOICE_YES?V.APPERANCE_PARTS_MAX_INDEX_YES:V.APPERANCE_PARTS_MAX_INDEX;for(e===w.MAP?(s=0===s?this._wwaData.map[t.y][t.x]:s,i=v.MAP):(s=0===s?this._wwaData.mapObject[t.y][t.x]:s,i=v.OBJECT),h=l;h<=u;h++){var d=V.ATR_APPERANCE_BASE+h*V.REL_ATR_APPERANCE_UNIT_LENGTH,p=d+V.REL_ATR_APPERANCE_ID,m=d+V.REL_ATR_APPERANCE_X,E=d+V.REL_ATR_APPERANCE_Y,g=d+V.REL_ATR_APPERANCE_TYPE;if(a=i===v.MAP?this._wwaData.mapAttribute[s][p]:this._wwaData.objectAttribute[s][p],r=i===v.MAP?this._wwaData.mapAttribute[s][g]:this._wwaData.objectAttribute[s][g],n=i===v.MAP?this._wwaData.mapAttribute[s][m]:this._wwaData.objectAttribute[s][m],o=i===v.MAP?this._wwaData.mapAttribute[s][E]:this._wwaData.objectAttribute[s][E],n===V.PLAYER_COORD?(n=this._player.getPosition().getPartsCoord().x,this._player.resetEventExecutionInfo()):n>V.RELATIVE_COORD_LOWER&&(n=t.x+n-V.RELATIVE_COORD_BIAS),o===V.PLAYER_COORD?(o=this._player.getPosition().getPartsCoord().y,this._player.resetEventExecutionInfo()):o>V.RELATIVE_COORD_LOWER&&(o=t.y+o-V.RELATIVE_COORD_BIAS),0!==n||0!==o)try{if(new _(this,n,o,0,0),r===v.MAP){if(a>=this._wwaData.mapPartsMax)throw new Error("背景パーツの範囲外IDが指定されました");var f=new c(n,o);this.setPartsOnPosition(v.MAP,a,f)}else{if(a>=this._wwaData.objPartsMax)throw new Error("物体パーツの範囲外IDが指定されました");f=new c(n,o);this.setPartsOnPosition(v.OBJECT,a,f),this._replaceRandomObject(new c(n,o)),n===this._player.getPosition().getPartsCoord().x&&o===this._player.getPosition().getPartsCoord().y&&this._player.setPartsAppearedFlag()}}catch(t){}}}reserveAppearPartsInNextFrame(t,e,s=0){this._reservedPartsAppearances.push({pos:t,triggerType:e,triggerPartsId:s})}reserveJumpInNextFrame(t){this._reservedJumpDestination=t}appearPartsByDirection(t,e,s){var i=this._player.getPosition().getPartsCoord(),a=this._player.getDir(),r=m[a],n=E[a];this.appearPartsEval(i,(r>=0?"+":"-")+Math.abs(r)*t,(n>=0?"+":"-")+Math.abs(n)*t,e,s)}appearPartsEval(t,e,s,i,a){var r,n,o=this._player.getPosition().getPartsCoord();if("P"===e||"p"===e)r=o.x;else if("+"===e[0])r=t.x+parseInt(e.substr(1));else if("-"===e[0])r=t.x-parseInt(e.substr(1));else if(r=parseInt(e),isNaN(r))throw new Error("座標として解釈できない文字が含まれています。");if("P"===s||"p"===s)n=o.y;else if("+"===s[0])n=t.y+parseInt(s.substr(1));else if("-"===s[0])n=t.y-parseInt(s.substr(1));else if(n=parseInt(s),isNaN(n))throw new Error("座標として解釈できない文字が含まれています。");try{new _(this,r,n,0,0);if(a===v.MAP){if(i>=this._wwaData.mapPartsMax)throw new Error("背景パーツの範囲外IDが指定されました");var h=new c(r,n);this.setPartsOnPosition(v.MAP,i,h)}else{if(i>=this._wwaData.objPartsMax)throw new Error("物体パーツの範囲外IDが指定されました");h=new c(r,n);this.setPartsOnPosition(v.OBJECT,i,h),this._replaceRandomObject(new c(r,n)),r===this._player.getPosition().getPartsCoord().x&&n===this._player.getPosition().getPartsCoord().y&&this._player.setPartsAppearedFlag()}}catch(t){}}getPartsID(t,e){if(t.x<0||t.y<0)throw new Error("想定外の座標が指定されました");return e===v.MAP?this._wwaData.map[t.y][t.x]:this._wwaData.mapObject[t.y][t.x]}_replaceRandomObject(t){var e,s,i=this._wwaData.mapObject[t.y][t.x];if(this._wwaData.objectAttribute[i][V.ATR_TYPE]===V.OBJECT_RANDOM){for(var a=0;a<V.RANDOM_ITERATION_MAX;a++){if(s=Math.floor(10*Math.random()),(e=this._wwaData.objectAttribute[i][V.ATR_RANDOM_BASE+s])>=this._wwaData.objPartsMax){e=0;break}if(this._wwaData.objectAttribute[e][V.ATR_TYPE]!==V.OBJECT_RANDOM)break;i=e}this.setPartsOnPosition(v.OBJECT,e,t)}}_replaceRandomObjectsInScreen(){for(var t=this._camera.getPosition().getPartsCoord(),e=Math.max(0,t.x-1),s=Math.min(this._wwaData.mapWidth-1,t.x+V.H_PARTS_NUM_IN_WINDOW),i=Math.max(0,t.y-1),a=Math.min(this._wwaData.mapWidth-1,t.y+V.V_PARTS_NUM_IN_WINDOW),r=e;r<=s;r++)for(var n=i;n<=a;n++)this._replaceRandomObject(new c(r,n))}_replaceAllRandomObjects(){for(var t=0;t<this._wwaData.mapWidth;t++)for(var e=0;e<this._wwaData.mapWidth;e++)this._replaceRandomObject(new c(t,e))}gameover(){var t=this._wwaData.gameoverX,e=this._wwaData.gameoverY;this._yesNoJudge=g.UNSELECTED,this._pages=[],this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=T.NONE,this._player.clearMessageWaiting(),this._messageWindow.clear(),this._messageWindow.setYesNoChoice(!1),this._waitFrame=0,this._temporaryInputDisable=!0,this._shouldSetNextPage=!1,this._reservedPartsAppearances=[],this._reservedJumpDestination=void 0,this._clearAllRequests(),this._player.jumpTo(new _(this,t,e,0,0));const s=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GAMEOVER;s&&this.evalCalcWwaNodeGenerator.evalWwaNode(s)}setYesNoInput(t){this._yesNoJudgeInNextFrame=t}getYesNoState(){return void 0!==this._yesNoJudgeInNextFrame?this._yesNoJudgeInNextFrame:this._yesNoJudge}setStatusChangedEffect(t){this._wwaData.isItemEffectEnabled&&(0!==t.strength&&(dt("disp-strength").classList.add("onpress"),this._statusPressCounter.strength=V.STATUS_CHANGED_EFFECT_FRAME_NUM),0!==t.defence&&(dt("disp-defence").classList.add("onpress"),this._statusPressCounter.defence=V.STATUS_CHANGED_EFFECT_FRAME_NUM),t instanceof h&&(0!==t.energy&&(dt("disp-energy").classList.add("onpress"),this._statusPressCounter.energy=V.STATUS_CHANGED_EFFECT_FRAME_NUM),0!==t.gold&&(dt("disp-gold").classList.add("onpress"),this._statusPressCounter.gold=V.STATUS_CHANGED_EFFECT_FRAME_NUM)))}setPartsOnPosition(t,e,s){var i,a,r=s.y<<$.BITSHIFT|s.x;t===v.MAP?(i=this._wwaData.map[s.y][s.x],e=this.loadMapPartsID(e),i=this.loadMapPartsID(i),this._wwaData.map[s.y][s.x]=e,-1!==(a=this._mapIDTable[i].indexOf(r))&&this._mapIDTable[i].splice(a,1),-1===(a=this._mapIDTable[e].indexOf(r))&&this._mapIDTable[e].push(r)):(i=this._wwaData.mapObject[s.y][s.x],e=this.loadMapPartsObjectID(e),i=this.loadMapPartsObjectID(i),this._wwaData.mapObject[s.y][s.x]=e,-1!==(a=this._mapObjectIDTable[i].indexOf(r))&&this._mapObjectIDTable[i].splice(a,1),-1===(a=this._mapObjectIDTable[e].indexOf(r))&&this._mapObjectIDTable[e].push(r))}_countSamePartsLength(t,e){var s;for(s=e+1;s<t.length&&t[s]===t[s-1];s++);return s-e}_compressMap(t){for(var e=[],s=0;s<t.length;s++){e[s]=[];for(var i=0;i<t[s].length;){var a=this._countSamePartsLength(t[s],i);e[s].push([t[s][i],a]),i+=a}}return e}_decompressMap(t){for(var e=[],s=0;s<t.length;s++){e[s]=[],0;for(var i=0;i<t[s].length;i++)for(var a=t[s][i][1],r=0;r<a;r++)e[s].push(t[s][i][0])}return e}_generateMapDataHash(t){var e="A",s=0,i=0,a=0;for(a=0;a<t.map.length;a++){for(i=0;i<t.map[a].length;)s=this._countSamePartsLength(t.map[a],i),e+=t.map[a][i]+"|"+s+"/",i+=s;for(i=0;i<t.mapObject[a].length;)s=this._countSamePartsLength(t.mapObject[a],i),e+=t.mapObject[a][i]+"|"+s+"/",i+=s}for(var r=0;r<t.mapAttribute.length;r++)for(var n=0;n<t.mapAttribute[r].length;n++)e+=t.mapAttribute[r][n]+"/";for(var o=0;o<t.objectAttribute.length;o++)for(var h=0;h<t.objectAttribute[o].length;h++)e+=t.objectAttribute[o][h]+"/";return Qe(e+="Z")}_generateSaveDataHash(t){var e=this._generateMapDataHash(t),s=[];for(var i in t)"map"!==i&&"mapObject"!==i&&"mapCompressed"!==i&&"mapObjectCompressed"!==i&&"mapAttribute"!==i&&"objectAttribute"!==i&&"checkString"!==i&&s.push(i);s.sort();for(var a=0;a<s.length;a++)e+=vt(t[s[a]]);return Qe(e)}compressSystem(){return is}_quickSave(t){var e,s;const i=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_SAVE;i&&this.evalCalcWwaNodeGenerator.evalWwaNode(i);var a,r,n=JSON.parse(JSON.stringify(this._wwaData)),o=this._player.getPosition().getPartsCoord(),h=this._player.getStatusWithoutEquipments();switch(n.itemBox=this._player.getCopyOfItemBox(),n.playerX=o.x,n.playerY=o.y,n.statusEnergyMax=this._player.getEnergyMax(),n.statusEnergy=h.energy,n.statusStrength=h.strength,n.statusDefence=h.defence,n.statusGold=h.gold,n.moves=this._player.getMoveCount(),n.frameCount=this._player.getFrameCount(),n.gameSpeedIndex=this._player.getSpeedIndex(),n.playTime=null!==(s=null===(e=this._playTimeCalculator)||void 0===e?void 0:e.calculateTimeMs())&&void 0!==s?s:0,n.userVar=this._userVar.numbered.slice(),n.userNamedVar=[...this._userVar.named],t){case T.CALL_BY_LOG_QUICK_SAVE:case T.CALL_BY_QUICK_SAVE:case T.CALL_BY_SUSPEND:break;case T.CALL_BY_PASSWORD_SAVE:n.checkOriginalMapString=this.checkOriginalMapString,n.checkString=this._generateSaveDataHash(n)}switch(n.message=void 0,n.mapAttribute=void 0,n.objectAttribute=void 0,t){case T.CALL_BY_QUICK_SAVE:return this._messageWindow.save(this._cvs,n),this.wwaCustomEvent("wwa_quicksave",{data:n}),"";case T.CALL_BY_PASSWORD_SAVE:const t=is.compress(n);t.isCompress=1;const e=JSON.stringify(t);return this.wwaCustomEvent("wwa_passwordsave",{data:n,compress:t}),a=e,r=this._wwaData.worldPassNumber,console.warn(qe.enc.Utf8.parse(a)),qe.AES.encrypt(qe.enc.Utf8.parse(a),ze(r)).toString();case T.CALL_BY_SUSPEND:this.wwaCustomEvent("wwa_suspend",{data:n,compress:is.compress(n)});break;case T.CALL_BY_LOG_QUICK_SAVE:this.wwaCustomEvent("wwa_autosave",{data:n}),this._wwaSave.autoSave(this._cvs,n)}}wwaCustomEvent(t,e={}){this.wwaCustomEventEmitter.dispatch(t,e)}_decodePassword(t){let e,s="";try{i=t,a=this._wwaData.worldPassNumber,s=qe.AES.decrypt(i,ze(a)).toString(qe.enc.Utf8)}catch(t){e=t}var i,a,r;if(!s){console.warn("新方式でのパスワード暗号化解除失敗:",e);try{s=function(t,e,s){return qe.AES.decrypt(t,function(t,e){return`^ /${231*t+8310+e}P+>A[]`}(e,s)).toString(qe.enc.Utf8)}(t,this._wwaData.worldPassNumber,this.checkOriginalMapString)}catch(t){e=t}}if(!s){console.warn("旧方式でのパスワード暗号化解除失敗:",e);const t=e&&e.message?e.message:"";throw new Error("パスワード取得時からワールド制作者によってマップの暗証番号が変更されたか、\nパスワードが壊れているために正常にセーブデータが復元できませんでした。\n"+t)}try{r=JSON.parse(s)}catch(t){throw new Error("マップデータ以外のものが暗号化されたか、マップデータに何かが不足しているようです。\nJSON PARSE FAILED")}if(r.isCompress){delete r.isCompress;const[t,e]=is.decompress(r);return[hs(t),e]}return[r,{isWorldNameEmpty:!1}]}_quickLoad(t=!1,e=null,s=!0){if(!t&&void 0===this._wwaSave.hasSaveData()&&null===e)throw new Error("セーブデータがありません。");let i,a=!1;if(null!==e){const t=this._decodePassword(e);i=t[0],a=t[1].isWorldNameEmpty}else i=JSON.parse(JSON.stringify(t?this._restartData:this._messageWindow.load()));if(i.message=JSON.parse(JSON.stringify(this._restartData.message)),i.mapAttribute=JSON.parse(JSON.stringify(this._restartData.mapAttribute)),i.objectAttribute=JSON.parse(JSON.stringify(this._restartData.objectAttribute)),void 0===i.map&&(i.map=this._decompressMap(i.mapCompressed)),void 0===i.mapObject&&(i.mapObject=this._decompressMap(i.mapObjectCompressed)),delete i.mapCompressed,delete i.mapObjectCompressed,null!==e){if(!a&&i.worldName!==this._wwaData.worldName)throw console.error("Invalid title",`(password)=${i.worldName} (current map)=${this._wwaData.worldName}`),new Error("前回パスワード取得時から、制作者によってワールド名が変更されたためロードできませんでした。\n予めご了承ください。");const t=this.checkOriginalMapString;if(this._isDisallowLoadOldSave&&i.checkOriginalMapString!==t)throw console.error("Invalid hash",`(password)=${i.checkOriginalMapString} (current map)=${t}`),new Error("前回パスワード取得時から、制作者によってマップが変更されたためロードできませんでした。\n(マップデータ制作者の設定により、内容が変更されると以前のパスワードは利用できなくなります。)\n予めご了承ください。");console.log("Valid Password!")}return s&&this._applyQuickLoad(i),i}_applyQuickLoad(t){this._userVar.named=new Map(t.userNamedVar),this._userVar.numbered=t.userVar,this._player.setEnergyMax(t.statusEnergyMax),this._player.setEnergy(t.statusEnergy),this._player.setStrength(t.statusStrength),this._player.setDefence(t.statusDefence),this._player.setGold(t.statusGold),this._player.setMoveCount(t.moves),this._player.setFrameCount(t.frameCount),this._player.clearItemBox();for(var e=0;e<t.itemBox.length;e++)this._player.addItem(t.itemBox[e],e+1,!0);this._player.systemJumpTo(new _(this,t.playerX,t.playerY,0,0)),0===t.bgm?this.playSound(R.NO_SOUND):this.playSound(t.bgm,t.bgmDelayDurationMs),this.setImgClick(new c(t.imgClickX,t.imgClickY)),0!==this.getObjectIdByPosition(this._player.getPosition())&&this._player.setPartsAppearedFlag(),this._clearAllRequests(),this._playTimeCalculator=new ot(t.playTime),this._wwaData=t,this._mapIDTableCreate(),this._replaceAllRandomObjects(),this.setStatusIconCoord(L.ENERGY,new c(t.imgStatusEnergyX,t.imgStatusEnergyY)),this.setStatusIconCoord(L.STRENGTH,new c(t.imgStatusStrengthX,t.imgStatusStrengthY)),this.setStatusIconCoord(L.DEFENCE,new c(t.imgStatusDefenceX,t.imgStatusDefenceY)),this.setStatusIconCoord(L.GOLD,new c(t.imgStatusGoldX,t.imgStatusGoldY)),this.setWideCellCoord(new c(t.imgWideCellX,t.imgWideCellY)),this.setItemboxBackgroundPosition({x:t.imgItemboxX,y:t.imgItemboxY}),this.setFrameCoord(new c(t.imgFrameX,t.imgFrameY)),this.setPlayerSpeedIndex(t.gameSpeedIndex),this.updateCSSRule(),this.updateEffect(),this._cgManager.updatePictures(this._wwaData.pictureRegistry),this.updatePicturesCache(),this._player.updateStatusValueBox(),this._wwaSave.quickSaveButtonUpdate(this._wwaData)}_mapIDTableCreate(){var t;for(this._mapIDTable=[],this._mapObjectIDTable=[],t=0;t<this._wwaData.mapPartsMax;t++)this._mapIDTable[t]=[];for(t=0;t<this._wwaData.objPartsMax;t++)this._mapObjectIDTable[t]=[];for(var e=0;e<this._wwaData.mapWidth;e++)for(var s=0;s<this._wwaData.mapWidth;s++){var i=s<<$.BITSHIFT|e;t=this._wwaData.map[s][e],this._mapIDTable[t]instanceof Array||(this._mapIDTable[t]=[]),this._mapIDTable[t].push(i),t=this._wwaData.mapObject[s][e],this._mapObjectIDTable[t]instanceof Array||(this._mapObjectIDTable[t]=[]),this._mapObjectIDTable[t].push(i)}}restartGame(){this._quickLoad(!0)}_fadeout(t){var e=0,s=V.MAP_WINDOW_WIDTH,i=V.FADEOUT_SPEED,a=dt("wwa-fader");a.style.display="block";var r=setInterval((()=>{if(e+=i,(s-=2*i)<=0||2*e>V.MAP_WINDOW_WIDTH)return a.removeAttribute("style"),a.style.display="block",a.style.borderWidth="0",a.style.width=V.MAP_WINDOW_WIDTH+"px",a.style.height=V.MAP_WINDOW_HEIGHT+"px",a.style.backgroundColor="#808080",clearInterval(r),void t();a.style.width=s+"px",a.style.height=s+"px",a.style.borderWidth=e+"px"}),20)}moveObjects(t){var e,s,i,a=this._camera.getPosition(),r=(this._player.getPosition(),a.getPartsCoord(),a.getPartsCoord().x),n=a.getPartsCoord().y;if(this.getMapAttributeByPosition(this._player.getPosition(),V.ATR_TYPE)!==V.MAP_LOCALGATE&&this.getObjectAttributeByPosition(this._player.getPosition(),V.ATR_TYPE)!==V.OBJECT_LOCALGATE){for(e=new Array(V.V_PARTS_NUM_IN_WINDOW+2),this.hoge=new Array(V.V_PARTS_NUM_IN_WINDOW+2),i=-1;i<=V.V_PARTS_NUM_IN_WINDOW;i++)for(e[i+1]=new Array(V.H_PARTS_NUM_IN_WINDOW+2),this.hoge[i+1]=new Array(V.H_PARTS_NUM_IN_WINDOW+2),s=-1;s<=V.H_PARTS_NUM_IN_WINDOW;s++)if(n+i<0||n+i>=this._wwaData.mapWidth||r+s<0||r+s>=this._wwaData.mapWidth)e[i+1][s+1]=0,this.hoge[i+1][s+1]=0;else{try{var o=(h=new _(this,r+s,n+i,0,0)).getPartsCoord()}catch(t){e[i+1][s+1]=0,this.hoge[i+1][s+1]=0;continue}this._wwaData.mapObject[o.y][o.x];e[i+1][s+1]=this._wwaData.mapObject[o.y][o.x],this.hoge[i+1][s+1]=-this._wwaData.mapObject[o.y][o.x]}for(s=-1;s<=V.H_PARTS_NUM_IN_WINDOW;s++)if(!(r+s<0||r+s>=this._wwaData.mapWidth))for(i=-1;i<=V.V_PARTS_NUM_IN_WINDOW;i++)if(!(n+i<0||n+i>=this._wwaData.mapWidth)){try{var h;o=(h=new _(this,r+s,n+i,0,0)).getPartsCoord()}catch(t){continue}var l=this._wwaData.mapObject[o.y][o.x];if(0!==l&&this._wwaData.objectAttribute[l][V.ATR_MOVE]!==P.STATIC&&this._wwaData.objectAttribute[l][V.ATR_TYPE]!==V.OBJECT_LOCALGATE&&this._wwaData.objectAttribute[l][V.ATR_TYPE]!==V.OBJECT_RANDOM&&(this._wwaData.objectAttribute[l][V.ATR_MOVE]===P.CHASE_PLAYER||this._wwaData.objectAttribute[l][V.ATR_MOVE]===P.RUN_OUT||this._wwaData.objectAttribute[l][V.ATR_MOVE]===P.HANG_AROUND)){var u=this._wwaData.objectAttribute[l][V.ATR_MOVE];if(u!==P.HANG_AROUND){var d,p=this._getCandidateCoord(t,h,u),m=new c(p.x,o.y),E=new c(o.x,p.y),g=null;if(this._objectCanMoveTo(t,p,e))this._setObjectsInNextFrame(o,p,r,n,e,l);else{var w=this._getSecondCandidateMoveMode(t,o,p,m,E,this._wwaData.objectAttribute[l][V.ATR_TYPE]===V.OBJECT_MONSTER,e);w===N.MODE_X?this._setObjectsInNextFrame(o,m,r,n,e,l):w===N.MODE_Y?this._setObjectsInNextFrame(o,E,r,n,e,l):null===(g=this._getThirdCandidate(t,h,p,u,e))||this._wwaData.isOldMove?(d=this._getRandomMoveCoord(t,h,e),this._setObjectsInNextFrame(o,d,r,n,e,l)):this._setObjectsInNextFrame(o,g,r,n,e,l)}}else d=this._getRandomMoveCoord(t,h,e),this._setObjectsInNextFrame(o,d,r,n,e,l)}}}}_getCandidateCoord(t,e,s){var i=e.getPartsCoord();this._player.getPosition().getOffsetCoord(),this._player.getPosition().getPartsCoord();try{var a=t?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord()}catch(t){throw new Error("予期せぬ方向への移動のようです。")}var r=i.clone(),n=0,o=0;return s===P.CHASE_PLAYER?(n=i.x>a.x?-1:i.x<a.x?1:0,o=i.y>a.y?-1:i.y<a.y?1:0):s===P.RUN_OUT&&(n=i.x>a.x?1:i.x<a.x?-1:0,o=i.y>a.y?1:i.y<a.y?-1:0),r.x+=n,r.y+=o,r.x=Math.min(this._wwaData.mapWidth-1,Math.max(0,r.x)),r.y=Math.min(this._wwaData.mapWidth-1,Math.max(0,r.y)),r}_getSecondCandidateMoveMode(t,e,s,i,a,r,n){return!t||(this._player.getDir()!==p.UP&&this._player.getDir()!==p.DOWN||!r)&&(this._player.getDir()!==p.LEFT&&this._player.getDir()!==p.RIGHT||r)?this._objectCanMoveTo(t,i,n)?N.MODE_X:this._objectCanMoveTo(t,a,n)?N.MODE_Y:N.UNDECIDED:this._objectCanMoveTo(t,a,n)?N.MODE_Y:this._objectCanMoveTo(t,i,n)?N.MODE_X:N.UNDECIDED}_getThirdCandidate(t,e,s,i,a){var r,n=i===P.CHASE_PLAYER?1:i===P.RUN_OUT?-1:0,o=t?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord(),h=e.getPartsCoord();if(o.x!==h.x){if(r=new c(s.x,h.y+1*n),this._objectCanMoveTo(t,r,a))return r;if(r=new c(s.x,h.y-1*n),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x,h.y+1*n),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x,h.y-1*n),this._objectCanMoveTo(t,r,a))return r}if(o.y!==h.y){if(r=new c(h.x+1*n,s.y),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x-1*n,s.y),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x+1*n,h.y),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x-1*n,h.y),this._objectCanMoveTo(t,r,a))return r}return null}_getRandomMoveCoord(t,e,s){const i=e.getPartsCoord(),a=i.clone(),r=this._wwaData.isOldMove?V.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31:V.RANDOM_MOVE_ITERATION_NUM;for(let e=0;e<r;e++){const e=[-1,1,0,0,-1,-1,1,1],r=[0,0,1,-1,1,-1,1,-1],n=Math.floor(Math.random()*e.length);if(a.x=i.x+e[n],a.y=i.y+r[n],this._objectCanMoveTo(t,a,s))return a}return i}isPrevFrameEventExecuted(){return this._prevFrameEventExected}_objectCanMoveTo(t,e,s){if(e.x<0||e.y<0||this._wwaData.mapWidth<=e.x||this._wwaData.mapWidth<=e.y)return!1;var i=this._wwaData.map[e.y][e.x],a=this._wwaData.mapObject[e.y][e.x],r=this._wwaData.mapAttribute[i][V.ATR_TYPE],n=this._camera.getPosition(),o=n.getPartsCoord().x,h=n.getPartsCoord().y;if(0===i&&!this.isOldMap()||r===V.MAP_WALL)return!1;var c=e.x-o+1,_=e.y-h+1;if(0<=c&&0<=_&&c<s.length&&_<s.length){if(0!==s[_][c])return!1}else if(0!==a)return!1;if(t){if(this._player.getPosition().getNextJustPosition().getPartsCoord().equals(e))return!1}else if(this._player.getPosition().getPartsCoord().equals(e))return!1;return!0}_setObjectsInNextFrame(t,e,s,i,a,r){var n=e.x-s+1,o=e.y-i+1;0<=e.x&&e.x<=this._wwaData.mapWidth&&0<=e.y&&e.y<=this._wwaData.mapWidth&&(0<=n&&n<a.length&&0<=o&&o<a.length&&(a[t.y-i+1][t.x-s+1]=0,a[e.y-i+1][e.x-s+1]=r,this.hoge[e.y-i+1][e.x-s+1]=r),this._objectMovingDataManager.add(r,t.convertIntoPosition(this),e.convertIntoPosition(this),t.getDirectionTo(e)))}launchBattleEstimateWindow(){const t=this._camera.getPosition().getPartsCoord(),e=Math.max(0,t.x),s=Math.min(this._wwaData.mapWidth-1,t.x+V.H_PARTS_NUM_IN_WINDOW-1),i=Math.max(0,t.y),a=Math.min(this._wwaData.mapWidth-1,t.y+V.V_PARTS_NUM_IN_WINDOW-1),r=[];this.playSound(R.DECISION);for(let t=e;t<=s;t++)for(let e=i;e<=a;e++){const s=this._wwaData.mapObject[e][t];this._wwaData.objectAttribute[s][V.ATR_TYPE]!==V.OBJECT_MONSTER||r.find((t=>t.partsID===s))||r.push(this._createMonster(s,new c(t,e)))}if(this._bottomButtonType===d.BATTLE_REPORT&&dt(x[I.GOTO_WWA]).classList.add("onpress"),0===r.length)return dt(x[I.GOTO_WWA]).classList.remove("onpress"),this.hideBattleEstimateWindow(),!1;this._battleEstimateWindow.update(this._player.getStatus(),r,((t,e)=>this._player.calcBattleResultForPlayerTurn(t,e.status,!0)),((t,e)=>this._player.calcBattleResultForEnemyTurn(t.status,e,!0)),this.isUsingDefaultDamageCalcFunction()),this._battleEstimateWindow.show(),this._player.setEstimateWindowWating();const n=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_BATTLE_REPORT;return n&&this.evalCalcWwaNodeGenerator.evalWwaNode(n),!0}isUsingDefaultDamageCalcFunction(){return void 0===this.getUserDefinedDamageFunctionNode("enemyToPlayer")&&void 0===this.getUserDefinedDamageFunctionNode("playerToEnemy")}_createMonster(t,e,s){return new Pe(t,e,new c(this._wwaData.objectAttribute[t][V.ATR_X],this._wwaData.objectAttribute[t][V.ATR_Y]),new h(this._wwaData.objectAttribute[t][V.ATR_ENERGY],this._wwaData.objectAttribute[t][V.ATR_STRENGTH],this._wwaData.objectAttribute[t][V.ATR_DEFENCE],this._wwaData.objectAttribute[t][V.ATR_GOLD]),this._wwaData.message[this._wwaData.objectAttribute[t][V.ATR_STRING]],this._wwaData.objectAttribute[t][V.ATR_ITEM],s)}hideBattleEstimateWindow(){this._battleEstimateWindow.hide(),this._player.clearEstimateWindowWaiting(),dt(x[I.GOTO_WWA]).classList.remove("onpress"),this._dispatchWindowClosedTimeRequests()}hidePasswordWindow(t=!1){if(this._passwordWindow.hide(),t||this._passwordWindow.mode===Ye.SAVE)return this._player.clearPasswordWindowWaiting(),void this._dispatchWindowClosedTimeRequests();try{var e=this._quickLoad(!1,this._passwordWindow.password,!1)}catch(t){return this._player.clearPasswordWindowWaiting(),this._dispatchWindowClosedTimeRequests(),void alert("セーブデータの復元に失敗しました。\nエラー詳細:\n"+t.message)}this._passwordLoadExecInNextFrame=!0,this._passwordSaveExtractData=e}_displayUserVars(){if(!this._canDisplayUserVars||!this._inlineUserVarViewer)return;let t="";if(this._inlineUserVarViewer.isVisible=!0,this._player.isControllable()){const e=[...this._userVar.named];if("named"===this._inlineUserVarViewer.kind)if(t="名前つき変数一覧\n",0===e.length)t+="名前つき変数はありません\n";else if(e.length<=V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM)t+=e.map((([t,e])=>`${t}: ${At(e)}`)).join("\n"),t+="\n";else for(let s=0;s<V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM;s++){let i=(this._inlineUserVarViewer.topUserVarIndex[this._inlineUserVarViewer.kind]+s)%e.length;t+=`${e[i][0]}: ${At(e[i][1],!0)}\n`}else if("numbered"===this._inlineUserVarViewer.kind){t="変数一覧\n",this._userVarNameListRequestError&&("noFileSpecified"===this._userVarNameListRequestError.kind?t+=this._userVarNameListRequestError.errorMessage+"\n":(t+="【変数名取得失敗】\n",t+=" すべての変数を名無しとしています。\n",t+=` エラー詳細: ${this._userVarNameListRequestError.errorMessage}\n`));for(let e=0;e<V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM;e++){let s=(this._inlineUserVarViewer.topUserVarIndex[this._inlineUserVarViewer.kind]+e)%V.USER_VAR_NUM;t+=`${`変数 ${s}: ${this._userVarNameList&&this._userVarNameList[s]?this._userVarNameList[s]:"名無し"}`}: ${At(this._userVar.numbered[s],!0)}\n`}}t+="\n操作方法\n",t+="上キー:1つ戻す 下キー:1つ進める\n",t+="左キー:10個戻す 右キー:10個進める\n",t+="Vキー: 名前付き変数/通常変数の切り替え",this.generatePageAndReserveExecution(t,!1,!0)}}_displayHelp(){var t;if(this._player.isControllable()){const s=null===(t=this._playTimeCalculator)||void 0===t?void 0:t.calculatePlayTimeFormat();var e="";switch(this.userDevice.device){case S.GAME:switch(this.userDevice.os){case y.NINTENDO:e=" 【操作方法】\nA:Yes,戦闘結果予測の表示\nB:No\nX:メニュー\nY:このリストの表示\nR:初めからスタート\nZL:データの一時保存\nZR:一時保存データの読み込み\n+: 移動速度を上げる\n-: 移動速度を落とす\n WWA Wing バージョン:4.1.0-unstable.based-on.3.12.11.p.2\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;case y.PLAY_STATION:e=" 【操作方法】\n〇:Yes,戦闘結果予測の表示\n×:No\n△:メニュー\n□:このリストの表示\nR1:初めからスタート\nL2:データの一時保存\nR2:一時保存データの読み込み\nOPTIONS: 移動速度を上げる\nSHARE: 移動速度を落とす\n  現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?"  プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:4.1.0-unstable.based-on.3.12.11.p.2\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;case y.XBOX:e=" 【操作方法】\nB:Yes,戦闘結果予測の表示\nA:No\nY:メニュー\nX:このリストの表示\nRB:初めからスタート\nLT:データの一時保存\nRT:一時保存データの読み込み\nMENU: 移動速度を上げる\nWINDOW: 移動速度を落とす\n  現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?"  プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:4.1.0-unstable.based-on.3.12.11.p.2\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;default:return}break;case S.SP:case S.VR:return;case S.PC:e=" 【操作方法】\nF1、M:戦闘結果予測の表示\nF3:復帰用パスワード入力\nF4:復帰用パスワード表示\nF5:一時保存データの読み込み\nF6:データの一時保存\nF7:初めからスタート\nF8:WWA公式ページにリンク\nF12:このリストの表示\nキーボードの「123、QWE、ASD、ZXC」は右のアイテムボックスに対応。\n「Enter、Y」はYes,\n「Esc、N」はNoに対応。\n   I: 移動速度を落とす/\nF2、P: 移動速度を上げる\n  現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?"  プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:4.1.0-unstable.based-on.3.12.11.p.2\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;default:return}e&&this.generatePageAndReserveExecution(e,!1,!0)}}_setNextPage(){if(this._clearFacesInNextFrame=!0,this._scoreWindow.isVisible()&&this._scoreWindow.hide(),this._isLastPage&&void 0!==this._reservedMoveMacroTurn&&(this._player.setMoveMacroWaiting(this._reservedMoveMacroTurn),this._reservedMoveMacroTurn=void 0),0===this._pages.length){const{newPageGenerated:t}=this._hideMessageWindow();t||this._dispatchWindowClosedTimeRequests()}else this._shouldSetNextPage=!0;this._inlineUserVarViewer&&(this._inlineUserVarViewer.isVisible=!1)}_hideMessageWindow(){const t=this._player.isReadyToUseItem()?this._player.useItem():0,e=this.getObjectAttributeById(t,V.ATR_STRING);return this.clearFaces(),0===e?(this._messageWindow.isVisible()&&(this._player.setDelayFrame(),this._messageWindow.hide(),this._keyStore.allClear(),this._mouseStore.clear()),this._player.clearMessageWaiting(),{newPageGenerated:!1}):(this.generatePageAndReserveExecution(this.getMessageById(e),!1,!1,t,v.OBJECT,this._player.getPosition().getPartsCoord()),{newPageGenerated:0!==this._pages.length})}getPlayerPositon(){return this._player.getPosition()}loadMapPartsObjectID(t){return(t|=0)<0||t>=this._wwaData.objPartsMax?0:t}loadMapPartsID(t){return(t|=0)<0||t>=this._wwaData.mapPartsMax?0:t}replaceParts(t,e,s=v.OBJECT,i=!1){var a,r,n,o,h,c,_,l,u=this._camera.getPosition().getPartsCoord(),d=i?Math.max(0,u.x):0,p=i?Math.min(this._wwaData.mapWidth-1,u.x+V.H_PARTS_NUM_IN_WINDOW-1):this._wwaData.mapWidth-1,m=i?Math.max(0,u.y):0,E=i?Math.min(this._wwaData.mapWidth-1,u.y+V.V_PARTS_NUM_IN_WINDOW)-1:this._wwaData.mapWidth-1;if(i=0!==d||p!==this._wwaData.mapWidth-1||0!==m||E!==this._wwaData.mapWidth-1,s===v.OBJECT)if(t=this.loadMapPartsObjectID(t),e=this.loadMapPartsObjectID(e),o=this._mapObjectIDTable[t].concat(),(_=this._mapObjectIDTable[t]).length=0,l=this._mapObjectIDTable[e],r=o.length,i)for(n=0;n<r;n++)h=(a=o[n])&$.BITMASK,c=a>>>$.BITSHIFT&$.BITMASK,d<=h&&h<=p&&m<=c&&c<=E?(this._wwaData.mapObject[c][h]=e,l.push(a)):_.push(a);else{for(n=0;n<r;n++)h=(a=o[n])&$.BITMASK,c=a>>>$.BITSHIFT&$.BITMASK,this._wwaData.mapObject[c][h]=e;Array.prototype.push.apply(l,o)}else if(t=this.loadMapPartsID(t),e=this.loadMapPartsID(e),o=this._mapIDTable[t].concat(),(_=this._mapIDTable[t]).length=0,l=this._mapIDTable[e],r=o.length,i)for(n=0;n<r;n++)h=(a=o[n])&$.BITMASK,c=a>>>$.BITSHIFT&$.BITMASK,d<=h&&h<=p&&m<=c&&c<=E?(this._wwaData.map[c][h]=e,l.push(a)):_.push(a);else{for(n=0;n<r;n++)h=(a=o[n])&$.BITMASK,c=a>>>$.BITSHIFT&$.BITMASK,this._wwaData.map[c][h]=e;Array.prototype.push.apply(l,o)}}getYesNoImgCoord(){return new c(this._wwaData.yesnoImgPosX,this._wwaData.yesnoImgPosY)}setYesNoImgCoord(t){return this._wwaData.yesnoImgPosX=t.x,this._wwaData.yesnoImgPosY=t.y,t}getPlayerImgCoord(){return new c(this._wwaData.playerImgPosX,this._wwaData.playerImgPosY)}setPlayerImgCoord(t){return this._wwaData.playerImgPosX=t.x,this._wwaData.playerImgPosY=t.y,t}setPlayerEnergyMax(t){return this._player.setEnergyMax(this.toValidStatusValue(t))}getMapPartsNum(){return this._wwaData.mapPartsMax}getObjectPartsNum(){return this._wwaData.objPartsMax}setMoveMacroWaitingToPlayer(t){this._reservedMoveMacroTurn=t}disableSave(t){return this._wwaData.disableSaveFlag=t,this._wwaSave.quickSaveButtonUpdate(this._wwaData),t}isOldMap(){return this._wwaData.isOldMap}setOldMap(t){return this._wwaData.isOldMap=t}setObjectNotCollapseOnPartsOnPlayer(t){return this._wwaData.objectNoCollapseDefaultFlag=t}setGameOverPosition(t){if(t.x<0||t.x>=this.getMapWidth()||t.y<0||t.y>=this.getMapWidth())throw new Error("マップの範囲外が指定されています!");return this._wwaData.gameoverX=t.x,this._wwaData.gameoverY=t.y,t}getGemeOverPosition(){return new c(this._wwaData.gameoverX,this._wwaData.gameoverY)}toValidStatusValue(t){return this.isNotNumberTypeOrNaN(t)||t<0?0:Math.floor(t)}setPlayerStatus(t,e,s){if(t===b.ENERGY){if(this._player.setEnergy(this.toValidStatusValue(e)),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:s}))return this.gameover(),{isGameOver:!0}}else if(t===b.STRENGTH)this._player.setStrength(this.toValidStatusValue(e));else if(t===b.DEFENCE)this._player.setDefence(this.toValidStatusValue(e));else if(t===b.GOLD)this._player.setGold(this.toValidStatusValue(e));else{if(t!==b.MOVES)throw new Error("未定義のステータスタイプです");this._player.setMoveCount(this.toValidStatusValue(e))}return{}}setDelPlayer(t){return this._wwaData.delPlayerFlag=t}setPlayerGetItem(t,e){try{this._player.addItem(e,t,!0)}catch(t){}}setStatusIconCoord(t,e){const s=e.x*V.CHIP_SIZE,i=e.y*V.CHIP_SIZE,a=t=>{Et(`${t}>.status-icon`).style.backgroundPosition=`-${s}px -${i}px`};switch(t){case L.ENERGY:this._wwaData.imgStatusEnergyX=e.x,this._wwaData.imgStatusEnergyY=e.y,a("#disp-energy");break;case L.STRENGTH:this._wwaData.imgStatusStrengthX=e.x,this._wwaData.imgStatusStrengthY=e.y,a("#disp-strength");break;case L.DEFENCE:this._wwaData.imgStatusDefenceX=e.x,this._wwaData.imgStatusDefenceY=e.y,a("#disp-defence");break;case L.GOLD:this._wwaData.imgStatusGoldX=e.x,this._wwaData.imgStatusGoldY=e.y,a("#disp-gold");break;default:throw new Error("種別が不正です。")}return e.clone()}setWideCellCoord(t){this._wwaData.imgWideCellX=t.x,this._wwaData.imgWideCellY=t.y;const e=t.x*V.CHIP_SIZE,s=t.y*V.CHIP_SIZE;return Array.prototype.forEach.call(gt("div.wide-cell-row"),(t=>{t.style.backgroundPosition="-"+e+"px -"+s+"px"})),t.clone()}setFrameCoord(t){return this._wwaData.imgFrameX=t.x,this._wwaData.imgFrameY=t.y,this._cgManager.setFrameImage(t),t.clone()}setBattleEffectCoord(t){return this._battleEffectCoord=t.clone()}canInput(){return!this._temporaryInputDisable}setEffect(t,e){this._wwaData.effectWaits=t,this._wwaData.effectCoords=e,this.updateEffect()}stopEffect(){this._wwaData.effectCoords=[],this.updateEffect()}updateEffect(){this._cgManager.updateEffects(this._wwaData.effectCoords)}updatePicturesCache(){this._cgManager.updatePicturesCache(this._isMainAnimation())}setImgClick(t){if(this._wwaData.imgClickX=t.x,this._wwaData.imgClickY=t.y,t.equals(new c(0,0)))Array.prototype.forEach.call(gt(".item-cell>.item-click-border"),(t=>{t.style.backgroundImage="url('"+V.ITEM_BORDER_IMG_DATA_URL+"')",t.style.backgroundPosition="0 0"}));else{var e=this._wwaData.mapCGName.replace("(","\\(").replace(")","\\)");Array.prototype.forEach.call(gt(".item-cell>.item-click-border"),(s=>{s.style.backgroundImage="url('"+e+"')",s.style.backgroundPosition="-"+t.x*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px"}))}}addFace(t){this._faces.push(t),this._messageWindow.setPositionByPlayerPosition(0!==this._faces.length,this._scoreWindow.isVisible(),!1,this._player.getPosition(),this._camera.getPosition())}clearFaces(){this._faces=[]}updateItemEffectEnabled(t){this._wwaData.isItemEffectEnabled=t}setOldMove(t){this._wwaData.isOldMove=t}setGameOverPolicy(t){switch(t){case 0:return void(this._wwaData.gameOverPolicy="default");case 1:return void(this._wwaData.gameOverPolicy="never");case 2:return void(this._wwaData.gameOverPolicy="except-macro");default:return}}setBgmDelay(t){this._wwaData.bgmDelayDurationMs=t}setPictureRegistry(t,e,s,i){var a,r,n,o;const h=s===v.OBJECT?this._wwaData.objectAttribute[e]:s===v.MAP?this._wwaData.mapAttribute[e]:null;if(null===h)throw new Error("対応していないパーツ番号です。");const c=this.getMessageById(h[V.ATR_STRING]),_=this._cgManager.picture.registerPictureFromText({layerNumber:t,imgPosX:(null!==(a=h[V.ATR_X])&&void 0!==a?a:0)/V.CHIP_SIZE,imgPosX2:(null!==(r=h[V.ATR_X2])&&void 0!==r?r:0)/V.CHIP_SIZE,imgPosY:(null!==(n=h[V.ATR_Y])&&void 0!==n?n:0)/V.CHIP_SIZE,imgPosY2:(null!==(o=h[V.ATR_Y2])&&void 0!==o?o:0)/V.CHIP_SIZE,triggerPartsX:i.x,triggerPartsY:i.y,propertiesText:c},e,s);this._wwaData.pictureRegistry=_,this.updatePicturesCache()}setPictureRegistryFromRawText(t,e){const s=this._cgManager.picture.registerPictureFromRawText(t,e);this._wwaData.pictureRegistry=s,this.updatePicturesCache()}deletePictureRegistry(t){const e=this._cgManager.picture.deletePicture(t);this._wwaData.pictureRegistry=e}initCSSRule(){this._styleElm=dt(V.WWA_STYLE_TAG_ID),this._sheet=this._styleElm.sheet,this.updateCSSRule()}updateCSSRule(){if(void 0===this._stylePos)this._stylePos=new Array(2);else if(void 0!==this._sheet.addRule)for(var t=0;t<this._stylePos.length;t++)this._sheet.removeRule(this._stylePos[this._styleElm[t]]);else for(t=0;t<this._stylePos.length;t++)this._sheet.deleteRule(this._stylePos[this._styleElm[t]]);const e="div.wwa-message-window, div#wwa-text-message-window, div#wwa-battle-estimate, div#wwa-password-window",s=this._isClassicModeEnable?1:.9,i=`\nbackground-color: rgba(${this._wwaData.frameColorR}, ${this._wwaData.frameColorG}, ${this._wwaData.frameColorB}, ${s});\nborder-color: rgba(${this._wwaData.frameOutColorR}, ${this._wwaData.frameOutColorG}, ${this._wwaData.frameOutColorB}, 1);\ncolor: rgba(${this._wwaData.fontColorR}, ${this._wwaData.fontColorG}, ${this._wwaData.fontColorB}, 1);\nwhite-space: pre-wrap;\n`,a="div#wwa-sidebar",r=`\ncolor: rgba(${this._wwaData.statusColorR}, ${this._wwaData.statusColorG}, ${this._wwaData.statusColorB},1);\nfont-weight: bold;\n`;void 0!==this._sheet.addRule?(this._stylePos[J.MESSAGE_WINDOW]=this._sheet.addRule(e,i),this._stylePos[J.SIDEBAR]=this._sheet.addRule(a,r)):(this._stylePos[J.MESSAGE_WINDOW]=this._sheet.insertRule(`${e} { ${i} }`,0),this._stylePos[J.SIDEBAR]=this._sheet.insertRule(`${a} { ${r} }`,1))}changeStyleRule(t,e,s,i){t===X.COLOR_FRAME?(this._wwaData.frameColorR=e,this._wwaData.frameColorG=s,this._wwaData.frameColorB=i):t===X.COLOR_FRAMEOUT?(this._wwaData.frameOutColorR=e,this._wwaData.frameOutColorG=s,this._wwaData.frameOutColorB=i):t===X.COLOR_STR?(this._wwaData.fontColorR=e,this._wwaData.fontColorG=s,this._wwaData.fontColorB=i):t===X.COLOR_STATUS_STR&&(this._wwaData.statusColorR=e,this._wwaData.statusColorG=s,this._wwaData.statusColorB=i),this.updateCSSRule()}showMonsterWindow(){this._monsterWindow.show()}isClassicMode(){return this._isClassicModeEnable}isConsoleOutputMode(){return this._useConsole}forcedJumpGate(t,e){this._player.isWaitingMessage()?this._windowCloseWaitingJumpGateRequest={x:t,y:e}:(this._windowCloseWaitingJumpGateRequest=void 0,this._player.jumpTo(new _(this,t,e,0,0)))}setUserVar(t,e,s){const i=(t,e)=>{if("number"==typeof t){if("number"!=typeof e)throw new TypeError("数字index変数への数値以外の代入は今のところできません。あらかじめご了承ください。");this._userVar.numbered[t]="number"==typeof e?this.toAssignableValue(e):e}else this._userVar.named.set(t,e)},a=(t=>"number"==typeof t?this._userVar.numbered[t]:this._userVar.named.get(t))(t);if("number"==typeof e)switch(s){case"+=":if("number"==typeof a)i(t,a+e);else{if("string"!=typeof a)throw new TypeError("boolean に number は足せません");i(t,String(a)+e)}break;case"-=":if("number"!=typeof a)throw new TypeError("string/boolean から number は引けません");i(t,a-e);break;case"*=":if("number"!=typeof a)throw new TypeError("string/boolean に number はかけられません");i(t,a*e);break;case"/=":if("number"!=typeof a)throw new TypeError("string/boolean は number で割れません");i(t,a/e);break;default:i(t,e)}else if("string"==typeof e)switch(s){case"+=":i(t,a+e);break;case"=":i(t,e);break;default:throw new TypeError("文字列を -=, *=, /= で複合代入することはできません")}else switch(s){case"+=":if("string"!=typeof a)throw new TypeError("number/boolean に boolean を足せません");i(t,a+e);break;case"=":i(t,e);break;default:throw new TypeError("booleanを -=, *=, /= で複合代入することはできません")}this._messageWindow.update()}toAssignableValue(t){const e=t>0?Math.floor(t):Math.ceil(t),s=Math.max(Math.min(e,V.USER_VAR_NUM_MAX_VALUE),V.USET_VAR_NUM_MIN_VALUE);return this.isNotNumberTypeOrNaN(s)?0:s}isValidUserVarIndex(t){return"number"==typeof t&&t>=0&&t<V.USER_VAR_NUM&&(0|t)===t}isNotNumberTypeOrNaN(t){return"number"!=typeof t||t!=t}getUserVar(t){return this._userVar.numbered[t]}getUserNameVar(t){return this._userVar.named.get(t.toString())}getAllUserNameVar(){return Array.from(this._userVar.named)}recUserPosition(t,e){var s=this._player.getPosition().getPartsCoord();this.setUserVar(t,s.x),this.setUserVar(e,s.y)}jumpRecUserPosition(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.forcedJumpGate(s,i)}jumpSpecifiedXPos(t){const e=this._player.getPosition().getPartsCoord();this.forcedJumpGate(t,e.y)}jumpSpecifiedYPos(t){const e=this._player.getPosition().getPartsCoord();this.forcedJumpGate(e.x,t)}outputUserVar(t){console.log("Var["+t+"] = "+this._userVar.numbered[t])}setUserVarHP(t){this.setUserVar(t,this._player.getStatus().energy)}setUserVarHPMAX(t){this.setUserVar(t,this._player.getEnergyMax())}setUserVarAT(t,e){switch(e){case"bare":return void this.setUserVar(t,this._player.getStatusWithoutEquipments().strength);case"equipment":return void this.setUserVar(t,this._player.getStatusOfEquipments().strength);default:return void this.setUserVar(t,this._player.getStatus().strength)}}setUserVarDF(t,e){switch(e){case"bare":return void this.setUserVar(t,this._player.getStatusWithoutEquipments().defence);case"equipment":return void this.setUserVar(t,this._player.getStatusOfEquipments().defence);default:return void this.setUserVar(t,this._player.getStatus().defence)}}setUserVarMONEY(t){this.setUserVar(t,this._player.getStatus().gold)}setHPUserVar(t,e){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const s=this._userVar.numbered[t];if(St(s,`v[${t}]`))return this._player.setEnergy(this.toValidStatusValue(s)),this._player.updateStatusValueBox(),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:e})?(this.gameover(),{isGameOver:!0}):{}}setHPMAXUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const e=this._userVar.numbered[t];St(e,`v[${t}]`)&&(this._player.setEnergyMax(this.toValidStatusValue(e)),this._player.updateStatusValueBox())}setATUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const e=this._userVar.numbered[t];St(e,`v[${t}]`)&&(this._player.setStrength(this.toValidStatusValue(e)),this._player.updateStatusValueBox())}setDFUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const e=this._userVar.numbered[t];St(e,`v[${t}]`)&&(this._player.setDefence(this.toValidStatusValue(e)),this._player.updateStatusValueBox())}setMONEYUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const e=this._userVar.numbered[t];St(e,`v[${t}]`)&&(this._player.setGold(this.toValidStatusValue(e)),this._player.updateStatusValueBox())}setUserVarStep(t){this.setUserVar(t,this._player.getMoveCount())}setUserVarVal(t,e){this.setUserVar(t,e)}setUserValOtherUserVal(t,e){this.setUserVar(t,this._userVar.numbered[e])}setUserValAdd(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];"boolean"!=typeof s&&"boolean"!=typeof i&&this.setUserVar(t,s+i)}setUserValSub(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.setUserVar(t,s-i)}setUserValMul(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.setUserVar(t,s*i)}setUserValDiv(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.setUserVar(t,0===i?0:s/i)}setUserValMod(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.setUserVar(t,0===i?0:s%i)}setUserValRandNum(t,e,s){this.setUserVar(t,Math.floor(Math.random()*this.toAssignableValue(e))+s)}_generateShowStrString(t,e){return t.map((t=>{const s=Number(t);if(!isNaN(s))return()=>1===e.version?this._userVar.numbered[s]:s;return null!==ce(t).match(zt)?()=>le(t,this.generateTokenValues(e.triggerParts)):t.replace(/\\n/g,"\n")}))}speedChangeJudge(t){this._wwaData.permitChangeGameSpeed=t}execSetMacro(t="",e){const s=function(t,e){const s=ce(t),i=s.match(Zt);if(null!==i){const t=_e(i[2],e),s=_e(i[4],e);return he(oe(i[3],t,s),i[1])}const a=s.match(qt);if(null!==a){const t=_e(a[1],e),s=_e(a[3],e);return he(oe(a[2],t,s),a[1])}throw new Error("setMacroのフォーマットを満たしていません: "+t)}(t,this.generateTokenValues(e.triggerParts)),{assignee:i,rawValue:a}=s;switch(i){case"energy":if(this._player.setEnergy(this.toValidStatusValue(a)),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:!0}))return this._player.updateStatusValueBox(),this.gameover(),{isGameOver:!0};break;case"energyMax":this._player.setEnergyMax(this.toValidStatusValue(a));break;case"strength":this._player.setStrength(this.toValidStatusValue(a));break;case"defence":this._player.setDefence(this.toValidStatusValue(a));break;case"gold":this._player.setGold(this.toValidStatusValue(a));break;case"moveCount":this._player.setMoveCount(this.toValidStatusValue(a));break;case"variable":if(isNaN(s.index)||!this.isValidUserVarIndex(s.index))throw new Error("ユーザ変数の添字が範囲外です。");this.setUserVar(s.index,this.toAssignableValue(a));break;case"map":this.appearPartsEval(e.triggerParts.position,`${s.x}`,`${s.y}`,s.rawValue,v.MAP);break;case"mapObject":this.appearPartsEval(e.triggerParts.position,`${s.x}`,`${s.y}`,s.rawValue,v.OBJECT);break;case"item":this.setPlayerGetItem(s.boxIndex1to12,a);break;case"playerDirection":this._player.setDir(a)}return this._player.updateStatusValueBox(),{}}generateTokenValues(t){var e,s;return{totalStatus:this._player.getStatus(),bareStatus:this._player.getStatusWithoutEquipments(),itemStatus:this._player.getStatusOfEquipments(),energyMax:this._player.getEnergyMax(),moveCount:this._player.getMoveCount(),playTime:null!==(s=null===(e=this._playTimeCalculator)||void 0===e?void 0:e.calculateTimeMs())&&void 0!==s?s:0,userVars:this._userVar.numbered,playerCoord:this._player.getPosition().getPartsCoord(),playerDirection:this._player.getDir(),itemBox:this._player.getCopyOfItemBox(),partsId:t.id,partsType:t.type,partsPosition:t.position,map:this._wwaData.map,mapObject:this._wwaData.mapObject}}userVarUserIf(t,e){if(void 0===e[5])throw new Error("$if の引数不足 str="+e);const s=parseInt(e[0],10),i=parseInt(e[2],10);if(!this.isValidUserVarIndex(s)||!this.isValidUserVarIndex(i))throw new Error("判定対象のユーザ変数の添字が範囲外です!");const a=this._userVar.numbered[s],r=e[1],n=this._userVar.numbered[i];if(!St(a,`v[${s}]`)||!St(n,`v[${i}]`))return;const o=t=>parseInt(t,10)?v.MAP:v.OBJECT;if(this.compareUserVar(a,r,n)){const s=parseInt(e[3],10),i=e[4],a=e[5],r=o(e[6]);return void this.appearPartsEval(t,i,a,s,r)}if(void 0===e[9])return;const h=parseInt(e[7],10),c=e[8],_=e[9],l=o(e[10]);this.appearPartsEval(t,c,_,h,l)}compareUserVar(t,e,s){switch(e){case"==":return t===s;case"!=":return t!==s;case">=":return t>=s;case">":return t>s;case"<=":return t<=s;case"<":return t<s;default:throw new Error(`未定義の演算子です: ${e}`)}}setPlayerSpeedIndex(t){if(t<V.MIN_SPEED_INDEX||V.MAX_SPEED_INDEX<t)throw new Error("#set_speed の引数が異常です:"+t);this._player.isMoving()?this._playerAndObjectsStopWaitingGameSpeedChangeRequest={speedIndex:t}:(this._wwaData.gameSpeedIndex=this._player.setSpeedIndex(t),this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0)}setUserVarPlayTime(t){var e,s;this.setUserVar(t,null!==(s=null===(e=this._playTimeCalculator)||void 0===e?void 0:e.calculateTimeMs())&&void 0!==s?s:0)}hideStatus(t,e){if(t<0||t>W.length)throw new Error("隠すパラメータは0から3の間で指定してください。");this._changeStatusVisibility(W[t],!e),this._player.updateStatusValueBox()}varMap(t,e,s,i,a){if(!this.isValidUserVarIndex(i))throw new Error("対象のユーザ変数の添字が範囲外です");const r=this._userVar.numbered[i];if("number"!=typeof r)throw new Error("数値でないパーツ番号は指定できません");if(r<0)throw new Error("負のパーツ番号は指定できません");if(a===v.OBJECT&&r>=this.getObjectPartsNum())throw new Error("物体パーツ番号の最大値を超えるパーツ番号が指定されました");if(a===v.MAP&&r>=this.getMapPartsNum())throw new Error("背景パーツ番号の最大値を超えるパーツ番号が指定されました");this.appearPartsEval(t,e,s,r,a)}setItemboxBackgroundPosition(t){this._wwaData.imgItemboxX=t.x,this._wwaData.imgItemboxY=t.y,Array.prototype.forEach.call(gt("div.item-cell"),(e=>{e.style.backgroundPosition=`-${t.x*V.CHIP_SIZE}px -${t.y*V.CHIP_SIZE}px`}))}_getVirtualPadButton(t){if(!ht.includes(t))throw new ReferenceError(`WWAの仮想パッド ${t} は存在しません。`);return this._virtualPadButtonElements[t]}_setVirtualPadTouch(t){this._getVirtualPadButton(t).classList.add("wwa-virtualpad__button--pressed")}_setVirtualPadLeave(t){this._getVirtualPadButton(t).classList.remove("wwa-virtualpad__button--pressed")}_actionGamePadButtonItemMacro(){if(!this._wwaData.gamePadButtonItemTable)return!1;var t,e,s,i;for(t=this._wwaData.gamePadButtonItemTable.length,e=0;e<t;e++)if(s=this._wwaData.gamePadButtonItemTable[e]){switch(i=!1,e){case tt.BUTTON_CROSS_KEY_LEFT:this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_LEFT)&&(i=!0);break;case tt.BUTTON_CROSS_KEY_RIGHT:this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_RIGHT)&&(i=!0);break;case tt.BUTTON_CROSS_KEY_UP:this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_UP)&&(i=!0);break;case tt.BUTTON_CROSS_KEY_DOWN:this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_DOWN)&&(i=!0)}if(this._gamePadStore.buttonTrigger(e)&&(i=!0),i&&this.onselectitem(s))return!0}return!1}setGamePadButtonItemTable(t,e){var s,i;if(!this._wwaData.gamePadButtonItemTable)for(i in this._wwaData.gamePadButtonItemTable=[],tt)s=i,this._wwaData.gamePadButtonItemTable[s]=0;this._wwaData.gamePadButtonItemTable.length>t&&(this._wwaData.gamePadButtonItemTable[t]=e)}_checkSaveDataCompatibility(t,e,s){return void 0!==t&&t!==this._wwaData.worldName?_s.UNMATCHED_WORLD_NAME:s&&s!==ps(this._wwaData.worldName,this._wwaData.worldPassNumber)?_s.UNMATCHED_WORLD_PASS_NUMBER:this._isDisallowLoadOldSave&&e!==this.checkOriginalMapString?_s.DISALLOW_OLD_REVISION_WORLD_SAVE_DATA:null}isVisibleStatus(t){switch(t){case"energy":return this._wwaData.isVisibleStatusEnergy;case"strength":return this._wwaData.isVisibleStatusStrength;case"defence":return this._wwaData.isVisibleStatusDefence;case"gold":return this._wwaData.isVisibleStatusGold;default:throw new Error("存在しないステータスが与えられました")}}_changeStatusVisibility(t,e){switch(t){case"energy":return void(this._wwaData.isVisibleStatusEnergy=e);case"strength":return void(this._wwaData.isVisibleStatusStrength=e);case"defence":return void(this._wwaData.isVisibleStatusDefence=e);case"gold":return void(this._wwaData.isVisibleStatusGold=e);default:throw new Error("存在しないステータスが与えられました")}}shouldApplyGameOver({isCalledByMacro:t}){return t?"default"===this._wwaData.gameOverPolicy:"default"===this._wwaData.gameOverPolicy||"except-macro"===this._wwaData.gameOverPolicy}getEnemyStatus(){return this._monster?this._monster.status:-1}setEnemyStatus(t){if(!this._monster)throw new Error("敵が存在しません");this._monster.setStatus(t)}getGameStatus(){var t,e;return{totalStatus:this._player.getStatus(),bareStatus:this._player.getStatusWithoutEquipments(),itemStatus:this._player.getStatusOfEquipments(),energyMax:this._player.getEnergyMax(),moveCount:this._player.getMoveCount(),playTime:null!==(e=null===(t=this._playTimeCalculator)||void 0===t?void 0:t.calculateTimeMs())&&void 0!==e?e:0,userVars:this._userVar.numbered,playerCoord:this._player.getPosition().getPartsCoord(),playerDirection:this._player.getDir(),itemBox:this._player.getCopyOfItemBox()}}_debugEvalString(){if(this._player.isControllable())try{const t=this._debugConsoleElement.querySelector(".console-text-area");if(!(t instanceof HTMLTextAreaElement))throw new Error("要素 #wwa-debug-console > .console-text-area が textarea 要素でありません");this._execEvalString(t.value)}catch(t){console.error(t),this.generatePageAndReserveExecution("解析中にエラーが発生しました :\n"+t.message,!1,!0)}}_execEvalString(t){try{const e=this.convertWwaNodes(t);this.evalCalcWwaNodeGenerator.evalWwaNodes(e)}catch(t){console.error(t),this.generatePageAndReserveExecution("解析中にエラーが発生しました :\n"+t.message,!1,!0)}}movePlayer(t){this._player.controll(t)}isPlayerWaitingMessage(){return this._player.isWaitingMessage()}_loadSystemMessage(t){if(this._wwaData.customSystemMessages[t])return this._wwaData.customSystemMessages[t];const e=a[t];if(e.mapdataParams)switch(e.mapdataParams.messageArea){case"message":{const t=this._wwaData.message[e.mapdataParams.index];return""===t?e.defaultText:t}case"systemMessage":{const t=this._wwaData.systemMessage[e.mapdataParams.index];return""===t?e.defaultText:t}default:throw new Error("システムエラー: システムメッセージの設定がおかしいようです")}return e.defaultText}resolveSystemMessage(t){const e=this._loadSystemMessage(t);switch(t){case i.ITEM_SELECT_TUTORIAL:return e.replaceAll("%HOW_TO_USE_ITEM%",(()=>{switch(this.userDevice.device){case S.PC:return"右のボックスを選択する";case S.VR:return"右のボックスをクリックする";case S.SP:return"右のボックスをタップする";case S.GAME:switch(this.userDevice.os){case y.NINTENDO:return"Xボタンを押すか、右のボックスをタップする";case y.PLAY_STATION:return"△ボタンを押す";case y.XBOX:return"Yボタンを押す";default:return"右のボックスを選択する"}default:return"右のボックスを選択する"}})());case i.GAME_SPEED_CHANGED:{const t=this._player.getSpeedIndex();return e.replaceAll("%GAME_SPEED_NAME%",k[t]).replaceAll("%HIGH_SPEED_MESSAGE%",this.isBattleSpeedIndexForQuickBattle(t)?"戦闘も速くなります。\n":"").replaceAll("%MAX_SPEED_INDEX%",String(V.MAX_SPEED_INDEX+1)).replaceAll("%GAME_SPEED_INDEX%",String(t+1)).replaceAll("%SPEED_UP_BUTTON%",this.userDevice.os===y.NINTENDO?"+ボタン":"Pキー").replaceAll("%SPEED_DOWN_BUTTON%",this.userDevice.os===y.NINTENDO?"-ボタン":"Iキー")}default:return e}}overwriteSystemMessage(t,e){this._wwaData.customSystemMessages[t]=e}}var Ha=!1;function Ka(){if(navigator.userAgent.match(/(?:msie|trident)/i)||navigator.userAgent.match(/edge/i))return void alert("このゲームをプレイするには、Google Chrome や Mozilla Firefox などの最新のブラウザでこのページを開いてください。\nご利用の環境のサポートは、既に終了しています。");Array.prototype.forEach.call(gt("a.wwa-copyright"),(t=>{t.addEventListener("click",(()=>{Ha=!0}))})),window.addEventListener("beforeunload",(t=>{var e="このページを離れますか?";if(Ha)return Ha=!1,t.returnValue=e,e}));var t=dt("wwa-wrapper").getAttribute("data-wwa-title-img");const e=dt("wwa-wrapper").getAttribute("data-wwa-virtualpad-enable"),s=null!==e&&null!==e.match(/^true$/i);$e(dt("wwa-wrapper"),t,s);var i=dt("wwa-wrapper").getAttribute("data-wwa-mapdata"),a=dt("wwa-wrapper").getAttribute("data-wwa-audio-dir"),r=dt("wwa-wrapper").getAttribute("data-wwa-var-dump-elm"),n=null,o="true"===dt("wwa-wrapper").getAttribute("data-wwa-display-user-vars"),h=dt("wwa-wrapper").getAttribute("data-wwa-user-var-names-file");dt("wwa-wrapper").hasAttribute("data-wwa-var-dump-elm")&&o&&(n=function(t){const e=mt(t);return e instanceof HTMLElement?(e.classList.add(Va),e.appendChild(Da({kind:"named"})),e.appendChild(Da({kind:"numbered"})),e):null}(r));var c=!0;dt("wwa-wrapper").getAttribute("data-wwa-urlgate-enable").match(/^false$/i)&&(c=!1);var _=dt("wwa-wrapper").getAttribute("data-wwa-classic-mode-enable"),l=!1;null!==_&&_.match(/^true$/i)&&(l=!0);var u=!0,d=dt("wwa-wrapper").getAttribute("data-wwa-item-effect-enable");null!==d&&d.match(/^false$/i)&&(u=!1);let p=!1;const m=dt("wwa-wrapper").getAttribute("data-wwa-use-go-to-wwa");null!==m&&m.match(/^true$/i)&&(p=!0);const E=dt("wwa-wrapper").getAttribute("data-wwa-virtualpad-viewport-fit-enable");Je()&&null!==E&&E.match(/^true$/i)&&(!function(){const t=document.getElementsByTagName("head")[0];let e=document.createElement("meta");e.setAttribute("name","viewport"),t.appendChild(e),ut()}(),window.addEventListener("resize",ut));const g=dt("wwa-wrapper").getAttribute("data-wwa-virtualpad-controller-elm"),w=s&&g?Et(g):null,f=dt("wwa-wrapper").getAttribute("data-wwa-picture-image-names-file"),v=(()=>{const t=dt("wwa-wrapper").getAttribute("data-wwa-disallow-load-old-save");return!(null===t||!t.match(/^true$/i))})();Fa=new Ga(i,c,t,l,u,p,a,v,n,h,o,s,w,f)}"complete"===document.readyState?setTimeout(Ka):window.addEventListener("load",(function(){setTimeout(Ka)}))}()}();
21
+ function(t){var e=i,s=e.lib,a=s.WordArray,r=s.Hasher,n=e.algo,o=a.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),h=a.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),c=a.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),_=a.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),l=a.create([0,1518500249,1859775393,2400959708,2840853838]),u=a.create([1352829926,1548603684,1836072691,2053994217,0]),d=n.RIPEMD160=r.extend({_doReset:function(){this._hash=a.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var s=0;s<16;s++){var i=e+s,a=t[i];t[i]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}var r,n,d,v,y,S,A,T,I,C,P,D=this._hash.words,N=l.words,O=u.words,b=o.words,M=h.words,x=c.words,L=_.words;for(S=r=D[0],A=n=D[1],T=d=D[2],I=v=D[3],C=y=D[4],s=0;s<80;s+=1)P=r+t[e+b[s]]|0,P+=s<16?p(n,d,v)+N[0]:s<32?m(n,d,v)+N[1]:s<48?E(n,d,v)+N[2]:s<64?g(n,d,v)+N[3]:w(n,d,v)+N[4],P=(P=f(P|=0,x[s]))+y|0,r=y,y=v,v=f(d,10),d=n,n=P,P=S+t[e+M[s]]|0,P+=s<16?w(A,T,I)+O[0]:s<32?g(A,T,I)+O[1]:s<48?E(A,T,I)+O[2]:s<64?m(A,T,I)+O[3]:p(A,T,I)+O[4],P=(P=f(P|=0,L[s]))+C|0,S=C,C=I,I=f(T,10),T=A,A=P;P=D[1]+d+I|0,D[1]=D[2]+v+C|0,D[2]=D[3]+y+S|0,D[3]=D[4]+r+A|0,D[4]=D[0]+n+T|0,D[0]=P},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(e.length+1),this._process();for(var a=this._hash,r=a.words,n=0;n<5;n++){var o=r[n];r[n]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}return a},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});function p(t,e,s){return t^e^s}function m(t,e,s){return t&e|~t&s}function E(t,e,s){return(t|~e)^s}function g(t,e,s){return t&s|e&~s}function w(t,e,s){return t^(e|~s)}function f(t,e){return t<<e|t>>>32-e}e.RIPEMD160=r._createHelper(d),e.HmacRIPEMD160=r._createHmacHelper(d)}(Math),i.RIPEMD160)},637:function(t,e,s){var i,a,r,n,o,h,c,_;t.exports=(_=s(359),a=(i=_).lib,r=a.WordArray,n=a.Hasher,o=i.algo,h=[],c=o.SHA1=n.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var s=this._hash.words,i=s[0],a=s[1],r=s[2],n=s[3],o=s[4],c=0;c<80;c++){if(c<16)h[c]=0|t[e+c];else{var _=h[c-3]^h[c-8]^h[c-14]^h[c-16];h[c]=_<<1|_>>>31}var l=(i<<5|i>>>27)+o+h[c];l+=c<20?1518500249+(a&r|~a&n):c<40?1859775393+(a^r^n):c<60?(a&r|a&n|r&n)-1894007588:(a^r^n)-899497514,o=n,n=r,r=a<<30|a>>>2,a=i,i=l}s[0]=s[0]+i|0,s[1]=s[1]+a|0,s[2]=s[2]+r|0,s[3]=s[3]+n|0,s[4]=s[4]+o|0},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[14+(i+64>>>9<<4)]=Math.floor(s/4294967296),e[15+(i+64>>>9<<4)]=s,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),i.SHA1=n._createHelper(c),i.HmacSHA1=n._createHmacHelper(c),_.SHA1)},640:function(t,e,s){var i,a,r,n,o,h;t.exports=(h=s(359),s(93),a=(i=h).lib.WordArray,r=i.algo,n=r.SHA256,o=r.SHA224=n.extend({_doReset:function(){this._hash=new a.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}}),i.SHA224=n._createHelper(o),i.HmacSHA224=n._createHmacHelper(o),h.SHA224)},93:function(t,e,s){var i;t.exports=(i=s(359),function(t){var e=i,s=e.lib,a=s.WordArray,r=s.Hasher,n=e.algo,o=[],h=[];!function(){function e(e){for(var s=t.sqrt(e),i=2;i<=s;i++)if(!(e%i))return!1;return!0}function s(t){return 4294967296*(t-(0|t))|0}for(var i=2,a=0;a<64;)e(i)&&(a<8&&(o[a]=s(t.pow(i,.5))),h[a]=s(t.pow(i,1/3)),a++),i++}();var c=[],_=n.SHA256=r.extend({_doReset:function(){this._hash=new a.init(o.slice(0))},_doProcessBlock:function(t,e){for(var s=this._hash.words,i=s[0],a=s[1],r=s[2],n=s[3],o=s[4],_=s[5],l=s[6],u=s[7],d=0;d<64;d++){if(d<16)c[d]=0|t[e+d];else{var p=c[d-15],m=(p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3,E=c[d-2],g=(E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10;c[d]=m+c[d-7]+g+c[d-16]}var w=i&a^i&r^a&r,f=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),v=u+((o<<26|o>>>6)^(o<<21|o>>>11)^(o<<7|o>>>25))+(o&_^~o&l)+h[d]+c[d];u=l,l=_,_=o,o=n+v|0,n=r,r=a,a=i,i=v+(f+w)|0}s[0]=s[0]+i|0,s[1]=s[1]+a|0,s[2]=s[2]+r|0,s[3]=s[3]+n|0,s[4]=s[4]+o|0,s[5]=s[5]+_|0,s[6]=s[6]+l|0,s[7]=s[7]+u|0},_doFinalize:function(){var e=this._data,s=e.words,i=8*this._nDataBytes,a=8*e.sigBytes;return s[a>>>5]|=128<<24-a%32,s[14+(a+64>>>9<<4)]=t.floor(i/4294967296),s[15+(a+64>>>9<<4)]=i,e.sigBytes=4*s.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=r._createHelper(_),e.HmacSHA256=r._createHmacHelper(_)}(Math),i.SHA256)},140:function(t,e,s){var i;t.exports=(i=s(359),s(467),function(t){var e=i,s=e.lib,a=s.WordArray,r=s.Hasher,n=e.x64.Word,o=e.algo,h=[],c=[],_=[];!function(){for(var t=1,e=0,s=0;s<24;s++){h[t+5*e]=(s+1)*(s+2)/2%64;var i=(2*t+3*e)%5;t=e%5,e=i}for(t=0;t<5;t++)for(e=0;e<5;e++)c[t+5*e]=e+(2*t+3*e)%5*5;for(var a=1,r=0;r<24;r++){for(var o=0,l=0,u=0;u<7;u++){if(1&a){var d=(1<<u)-1;d<32?l^=1<<d:o^=1<<d-32}128&a?a=a<<1^113:a<<=1}_[r]=n.create(o,l)}}();var l=[];!function(){for(var t=0;t<25;t++)l[t]=n.create()}();var u=o.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new n.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var s=this._state,i=this.blockSize/2,a=0;a<i;a++){var r=t[e+2*a],n=t[e+2*a+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),n=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),(D=s[a]).high^=n,D.low^=r}for(var o=0;o<24;o++){for(var u=0;u<5;u++){for(var d=0,p=0,m=0;m<5;m++)d^=(D=s[u+5*m]).high,p^=D.low;var E=l[u];E.high=d,E.low=p}for(u=0;u<5;u++){var g=l[(u+4)%5],w=l[(u+1)%5],f=w.high,v=w.low;for(d=g.high^(f<<1|v>>>31),p=g.low^(v<<1|f>>>31),m=0;m<5;m++)(D=s[u+5*m]).high^=d,D.low^=p}for(var y=1;y<25;y++){var S=(D=s[y]).high,A=D.low,T=h[y];T<32?(d=S<<T|A>>>32-T,p=A<<T|S>>>32-T):(d=A<<T-32|S>>>64-T,p=S<<T-32|A>>>64-T);var I=l[c[y]];I.high=d,I.low=p}var C=l[0],P=s[0];for(C.high=P.high,C.low=P.low,u=0;u<5;u++)for(m=0;m<5;m++){var D=s[y=u+5*m],N=l[y],O=l[(u+1)%5+5*m],b=l[(u+2)%5+5*m];D.high=N.high^~O.high&b.high,D.low=N.low^~O.low&b.low}D=s[0];var M=_[o];D.high^=M.high,D.low^=M.low}},_doFinalize:function(){var e=this._data,s=e.words,i=(this._nDataBytes,8*e.sigBytes),r=32*this.blockSize;s[i>>>5]|=1<<24-i%32,s[(t.ceil((i+1)/r)*r>>>5)-1]|=128,e.sigBytes=4*s.length,this._process();for(var n=this._state,o=this.cfg.outputLength/8,h=o/8,c=[],_=0;_<h;_++){var l=n[_],u=l.high,d=l.low;u=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8),d=16711935&(d<<8|d>>>24)|4278255360&(d<<24|d>>>8),c.push(d),c.push(u)}return new a.init(c,o)},clone:function(){for(var t=r.clone.call(this),e=t._state=this._state.slice(0),s=0;s<25;s++)e[s]=e[s].clone();return t}});e.SHA3=r._createHelper(u),e.HmacSHA3=r._createHmacHelper(u)}(Math),i.SHA3)},716:function(t,e,s){var i,a,r,n,o,h,c,_;t.exports=(_=s(359),s(467),s(834),a=(i=_).x64,r=a.Word,n=a.WordArray,o=i.algo,h=o.SHA512,c=o.SHA384=h.extend({_doReset:function(){this._hash=new n.init([new r.init(3418070365,3238371032),new r.init(1654270250,914150663),new r.init(2438529370,812702999),new r.init(355462360,4144912697),new r.init(1731405415,4290775857),new r.init(2394180231,1750603025),new r.init(3675008525,1694076839),new r.init(1203062813,3204075428)])},_doFinalize:function(){var t=h._doFinalize.call(this);return t.sigBytes-=16,t}}),i.SHA384=h._createHelper(c),i.HmacSHA384=h._createHmacHelper(c),_.SHA384)},834:function(t,e,s){var i;t.exports=(i=s(359),s(467),function(){var t=i,e=t.lib.Hasher,s=t.x64,a=s.Word,r=s.WordArray,n=t.algo;function o(){return a.create.apply(a,arguments)}var h=[o(1116352408,3609767458),o(1899447441,602891725),o(3049323471,3964484399),o(3921009573,2173295548),o(961987163,4081628472),o(1508970993,3053834265),o(2453635748,2937671579),o(2870763221,3664609560),o(3624381080,2734883394),o(310598401,1164996542),o(607225278,1323610764),o(1426881987,3590304994),o(1925078388,4068182383),o(2162078206,991336113),o(2614888103,633803317),o(3248222580,3479774868),o(3835390401,2666613458),o(4022224774,944711139),o(264347078,2341262773),o(604807628,2007800933),o(770255983,1495990901),o(1249150122,1856431235),o(1555081692,3175218132),o(1996064986,2198950837),o(2554220882,3999719339),o(2821834349,766784016),o(2952996808,2566594879),o(3210313671,3203337956),o(3336571891,1034457026),o(3584528711,2466948901),o(113926993,3758326383),o(338241895,168717936),o(666307205,1188179964),o(773529912,1546045734),o(1294757372,1522805485),o(1396182291,2643833823),o(1695183700,2343527390),o(1986661051,1014477480),o(2177026350,1206759142),o(2456956037,344077627),o(2730485921,1290863460),o(2820302411,3158454273),o(3259730800,3505952657),o(3345764771,106217008),o(3516065817,3606008344),o(3600352804,1432725776),o(4094571909,1467031594),o(275423344,851169720),o(430227734,3100823752),o(506948616,1363258195),o(659060556,3750685593),o(883997877,3785050280),o(958139571,3318307427),o(1322822218,3812723403),o(1537002063,2003034995),o(1747873779,3602036899),o(1955562222,1575990012),o(2024104815,1125592928),o(2227730452,2716904306),o(2361852424,442776044),o(2428436474,593698344),o(2756734187,3733110249),o(3204031479,2999351573),o(3329325298,3815920427),o(3391569614,3928383900),o(3515267271,566280711),o(3940187606,3454069534),o(4118630271,4000239992),o(116418474,1914138554),o(174292421,2731055270),o(289380356,3203993006),o(460393269,320620315),o(685471733,587496836),o(852142971,1086792851),o(1017036298,365543100),o(1126000580,2618297676),o(1288033470,3409855158),o(1501505948,4234509866),o(1607167915,987167468),o(1816402316,1246189591)],c=[];!function(){for(var t=0;t<80;t++)c[t]=o()}();var _=n.SHA512=e.extend({_doReset:function(){this._hash=new r.init([new a.init(1779033703,4089235720),new a.init(3144134277,2227873595),new a.init(1013904242,4271175723),new a.init(2773480762,1595750129),new a.init(1359893119,2917565137),new a.init(2600822924,725511199),new a.init(528734635,4215389547),new a.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var s=this._hash.words,i=s[0],a=s[1],r=s[2],n=s[3],o=s[4],_=s[5],l=s[6],u=s[7],d=i.high,p=i.low,m=a.high,E=a.low,g=r.high,w=r.low,f=n.high,v=n.low,y=o.high,S=o.low,A=_.high,T=_.low,I=l.high,C=l.low,P=u.high,D=u.low,N=d,O=p,b=m,M=E,x=g,L=w,R=f,B=v,U=y,k=S,W=A,V=T,F=I,Y=C,G=P,H=D,K=0;K<80;K++){var j,X,J=c[K];if(K<16)X=J.high=0|t[e+2*K],j=J.low=0|t[e+2*K+1];else{var $=c[K-15],Z=$.high,q=$.low,z=(Z>>>1|q<<31)^(Z>>>8|q<<24)^Z>>>7,Q=(q>>>1|Z<<31)^(q>>>8|Z<<24)^(q>>>7|Z<<25),tt=c[K-2],et=tt.high,st=tt.low,it=(et>>>19|st<<13)^(et<<3|st>>>29)^et>>>6,at=(st>>>19|et<<13)^(st<<3|et>>>29)^(st>>>6|et<<26),rt=c[K-7],nt=rt.high,ot=rt.low,ht=c[K-16],ct=ht.high,_t=ht.low;X=(X=(X=z+nt+((j=Q+ot)>>>0<Q>>>0?1:0))+it+((j+=at)>>>0<at>>>0?1:0))+ct+((j+=_t)>>>0<_t>>>0?1:0),J.high=X,J.low=j}var lt,ut=U&W^~U&F,dt=k&V^~k&Y,pt=N&b^N&x^b&x,mt=O&M^O&L^M&L,Et=(N>>>28|O<<4)^(N<<30|O>>>2)^(N<<25|O>>>7),gt=(O>>>28|N<<4)^(O<<30|N>>>2)^(O<<25|N>>>7),wt=(U>>>14|k<<18)^(U>>>18|k<<14)^(U<<23|k>>>9),ft=(k>>>14|U<<18)^(k>>>18|U<<14)^(k<<23|U>>>9),vt=h[K],yt=vt.high,St=vt.low,At=G+wt+((lt=H+ft)>>>0<H>>>0?1:0),Tt=gt+mt;G=F,H=Y,F=W,Y=V,W=U,V=k,U=R+(At=(At=(At=At+ut+((lt+=dt)>>>0<dt>>>0?1:0))+yt+((lt+=St)>>>0<St>>>0?1:0))+X+((lt+=j)>>>0<j>>>0?1:0))+((k=B+lt|0)>>>0<B>>>0?1:0)|0,R=x,B=L,x=b,L=M,b=N,M=O,N=At+(Et+pt+(Tt>>>0<gt>>>0?1:0))+((O=lt+Tt|0)>>>0<lt>>>0?1:0)|0}p=i.low=p+O,i.high=d+N+(p>>>0<O>>>0?1:0),E=a.low=E+M,a.high=m+b+(E>>>0<M>>>0?1:0),w=r.low=w+L,r.high=g+x+(w>>>0<L>>>0?1:0),v=n.low=v+B,n.high=f+R+(v>>>0<B>>>0?1:0),S=o.low=S+k,o.high=y+U+(S>>>0<k>>>0?1:0),T=_.low=T+V,_.high=A+W+(T>>>0<V>>>0?1:0),C=l.low=C+Y,l.high=I+F+(C>>>0<Y>>>0?1:0),D=u.low=D+H,u.high=P+G+(D>>>0<H>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,i=8*t.sigBytes;return e[i>>>5]|=128<<24-i%32,e[30+(i+128>>>10<<5)]=Math.floor(s/4294967296),e[31+(i+128>>>10<<5)]=s,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=e.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32});t.SHA512=e._createHelper(_),t.HmacSHA512=e._createHmacHelper(_)}(),i.SHA512)},567:function(t,e,s){var i;t.exports=(i=s(359),s(139),s(174),s(844),s(951),function(){var t=i,e=t.lib,s=e.WordArray,a=e.BlockCipher,r=t.algo,n=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],h=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],_=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=r.DES=a.extend({_doReset:function(){for(var t=this._key.words,e=[],s=0;s<56;s++){var i=n[s]-1;e[s]=t[i>>>5]>>>31-i%32&1}for(var a=this._subKeys=[],r=0;r<16;r++){var c=a[r]=[],_=h[r];for(s=0;s<24;s++)c[s/6|0]|=e[(o[s]-1+_)%28]<<31-s%6,c[4+(s/6|0)]|=e[28+(o[s+24]-1+_)%28]<<31-s%6;for(c[0]=c[0]<<1|c[0]>>>31,s=1;s<7;s++)c[s]=c[s]>>>4*(s-1)+3;c[7]=c[7]<<5|c[7]>>>27}var l=this._invSubKeys=[];for(s=0;s<16;s++)l[s]=a[15-s]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(t,e,s){this._lBlock=t[e],this._rBlock=t[e+1],u.call(this,4,252645135),u.call(this,16,65535),d.call(this,2,858993459),d.call(this,8,16711935),u.call(this,1,1431655765);for(var i=0;i<16;i++){for(var a=s[i],r=this._lBlock,n=this._rBlock,o=0,h=0;h<8;h++)o|=c[h][((n^a[h])&_[h])>>>0];this._lBlock=n,this._rBlock=r^o}var l=this._lBlock;this._lBlock=this._rBlock,this._rBlock=l,u.call(this,1,1431655765),d.call(this,8,16711935),d.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),t[e]=this._lBlock,t[e+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});function u(t,e){var s=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=s,this._lBlock^=s<<t}function d(t,e){var s=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=s,this._rBlock^=s<<t}t.DES=a._createHelper(l);var p=r.TripleDES=a.extend({_doReset:function(){var t=this._key.words;if(2!==t.length&&4!==t.length&&t.length<6)throw new Error("Invalid key length - 3DES requires the key length to be 64, 128, 192 or >192.");var e=t.slice(0,2),i=t.length<4?t.slice(0,2):t.slice(2,4),a=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=l.createEncryptor(s.create(e)),this._des2=l.createEncryptor(s.create(i)),this._des3=l.createEncryptor(s.create(a))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2});t.TripleDES=a._createHelper(p)}(),i.TripleDES)},467:function(t,e,s){var i;t.exports=(i=s(359),function(t){var e=i,s=e.lib,a=s.Base,r=s.WordArray,n=e.x64={};n.Word=a.extend({init:function(t,e){this.high=t,this.low=e}}),n.WordArray=a.extend({init:function(e,s){e=this.words=e||[],this.sigBytes=s!=t?s:8*e.length},toX32:function(){for(var t=this.words,e=t.length,s=[],i=0;i<e;i++){var a=t[i];s.push(a.high),s.push(a.low)}return r.create(s,this.sigBytes)},clone:function(){for(var t=a.clone.call(this),e=t.words=this.words.slice(0),s=e.length,i=0;i<s;i++)e[i]=e[i].clone();return t}})}(),i)},633:function(){},106:function(){}},e={};function s(i){var a=e[i];if(void 0!==a)return a.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,s),r.exports}s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,{a:e}),e},s.d=function(t,e){for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},function(){"use strict";const t=Object.freeze({CONFIRM_LOAD_SOUND:{code:1,defaultText:"効果音・BGMデータをロードしますか?",mapdataParams:{messageArea:"systemMessage",index:2}},NO_MONEY:{code:101,defaultText:"所持金がたりない。",mapdataParams:{messageArea:"message",index:6}},NO_ITEM:{code:201,mapdataParams:{messageArea:"message",index:7},defaultText:"アイテムを持っていない。"},ITEM_BOX_FULL:{code:202,defaultText:"これ以上、アイテムを持てません。",mapdataParams:{messageArea:"systemMessage",index:1}},ITEM_SELECT_TUTORIAL:{code:203,defaultText:"このアイテムは%HOW_TO_USE_ITEM%ことで使用できます。\n使用できるアイテムは色枠で囲まれます。",mapdataParams:{messageArea:"systemMessage",index:0}},CONFIRM_USE_ITEM:{code:204,defaultText:"このアイテムを使用します。\nよろしいですか?",mapdataParams:{messageArea:"message",index:8}},CANNOT_DAMAGE_MONSTER:{code:301,defaultText:"相手の防御能力が高すぎる!"},BATTLE_NOT_SETTLED:{code:302,defaultText:"勝負がつかない!"},CONFIRM_ENTER_URL_GATE:{code:401,defaultText:"他のページにリンクします。\nよろしいですか?",mapdataParams:{messageArea:"message",index:5}},GAME_SPEED_CHANGED:{code:501,defaultText:"移動速度を【%GAME_SPEED_NAME%】に切り替えました。\n%HIGH_SPEED_MESSAGE%(%MAX_SPEED_INDEX%段階中%GAME_SPEED_INDEX%)\n速度を落とすには%SPEED_DOWN_BUTTON%, 速度を上げるには%SPEED_UP_BUTTON%を押してください。"},GAME_SPEED_CHANGE_DISABLED:{code:502,defaultText:"ここでは移動速度を\n変更できません。"}}),e=Object.keys(t),i=e.reduce(((t,e)=>({...t,[e]:e})),{}),a=t;function r(t){return e.some((e=>e===t))}function n(t){for(let s of e)if(a[s].code===t)return s}class o{add(t){return this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return new o(this.strength+t.strength,this.defence+t.defence)}minus(t){return new o(this.strength-t.strength,this.defence-t.defence)}equals(t){return this.strength===t.strength&&this.defence===t.defence}constructor(t,e){this.strength=t,this.defence=e}}class h extends o{add(t){return t instanceof h&&(this.energy+=t.energy,this.gold+=t.gold),this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return t instanceof h?new h(this.energy+t.energy,this.strength+t.strength,this.defence+t.defence,this.gold+t.gold):new h(this.energy,this.strength+t.strength,this.defence+t.defence,this.gold)}minus(t){return t instanceof h?new h(this.energy-t.energy,this.strength-t.strength,this.defence-t.defence,this.gold-t.gold):new h(this.energy,this.strength-t.strength,this.defence-t.defence,this.gold)}equals(t){return this.energy===t.energy&&this.strength===t.strength&&this.defence===t.defence&&this.gold===t.gold}calculateScore(t){return Object.keys(t.rates).reduce(((e,s)=>e+t.rates[s]*this[s]),0)}clone(){return new h(this.energy,this.strength,this.defence,this.gold)}constructor(t,e,s,i){super(e,s),this.energy=t,this.gold=i}}class c{equals(t){return this.x===t.x&&this.y===t.y}substract(t){return new c(this.x-t.x,this.y-t.y)}clone(){return new c(this.x,this.y)}convertIntoPosition(t){return new _(t,this.x,this.y,0,0)}getDirectionTo(t){return this.x<t.x?this.y>t.y?p.RIGHT_UP:this.y===t.y?p.RIGHT:p.RIGHT_DOWN:this.x===t.x?this.y>t.y?p.UP:this.y===t.y?p.NO_DIRECTION:p.DOWN:this.y>t.y?p.LEFT_UP:this.y===t.y?p.LEFT:p.LEFT_DOWN}toString(){return"("+this.x+", "+this.y+")"}constructor(t=0,e=0){this.x=t,this.y=e}}class _{getPartsCoord(){return this._partsCoord}getOffsetCoord(){return this._offsetCoord}getScreenTopPosition(){var t=Math.floor(this._partsCoord.x/(V.H_PARTS_NUM_IN_WINDOW-1))*(V.H_PARTS_NUM_IN_WINDOW-1),e=Math.floor(this._partsCoord.y/(V.V_PARTS_NUM_IN_WINDOW-1))*(V.V_PARTS_NUM_IN_WINDOW-1);return new _(this._wwa,t,e,0,0)}getDefaultCameraPosition(){var t=this.getScreenTopPosition(),e=t.getPartsCoord(),s=this._wwa.getMapWidth(),i=t.getPartsCoord().clone();return e.x===s-1&&i.x--,e.y===s-1&&i.y--,i.convertIntoPosition(this._wwa).getScreenTopPosition()}getNextJustPosition(t){if(void 0!==t){var e=this._partsCoord;return new _(this._wwa,e.x+m[t],e.y+E[t],0,0)}var s=this._partsCoord.x,i=this._partsCoord.y;return this._offsetCoord.x<0?s--:this._offsetCoord.x>0&&s++,this._offsetCoord.y<0?i--:this._offsetCoord.y>0&&i++,new _(this._wwa,s,i,0,0)}getNextFramePosition(t,e,s){var i=this._partsCoord.x,a=this._partsCoord.y,r=this._offsetCoord.x+m[t]*e,n=this._offsetCoord.y+E[t]*s;if(r<0){var o=Math.floor(Math.abs(r)/V.CHIP_SIZE);i-=o,r=(r+o*V.CHIP_SIZE)%V.CHIP_SIZE}if(n<0){var h=Math.floor(Math.abs(n)/V.CHIP_SIZE);a-=h,n=(n+h*V.CHIP_SIZE)%V.CHIP_SIZE}return r>=V.CHIP_SIZE&&(i+=Math.floor(r/V.CHIP_SIZE),r=(r+V.CHIP_SIZE)%V.CHIP_SIZE),n>=V.CHIP_SIZE&&(a+=Math.floor(n/V.CHIP_SIZE),n=(n+V.CHIP_SIZE)%V.CHIP_SIZE),new _(this._wwa,i,a,r,n)}isJustPosition(){return 0==this._offsetCoord.x&&0==this._offsetCoord.y}isScreenTopPosition(){var t=this.getScreenTopPosition();return this.equals(t)}equals(t){return this._partsCoord.equals(t.getPartsCoord())&&this._offsetCoord.equals(t.getOffsetCoord())}isInCameraRange(t,e=!1){var s=t.getPosition()._partsCoord,i=this._partsCoord.x,a=this._partsCoord.y,r=e?1:0;return s.x<=i&&i<s.x+V.H_PARTS_NUM_IN_WINDOW-r&&s.y<=a&&a<s.y+V.V_PARTS_NUM_IN_WINDOW-r}hasLocalGate(){return this._wwa.getMapTypeByPosition(this)===V.MAP_LOCALGATE||this._wwa.getObjectTypeByPosition(this)===V.OBJECT_LOCALGATE}clone(){return new _(this._wwa,this._partsCoord.x,this._partsCoord.y,this._offsetCoord.x,this._offsetCoord.y)}constructor(t,e,s,i=0,a=0){if(this._wwa=t,void 0===this._wwa)throw new Error("WWAのインスタンスが存在しません. ");var r=this._wwa.getMapWidth();if(e<0||e>=r||e>=r-1&&i>0||s<0||s>=r||s>=r-1&&a>0)throw new Error("範囲外の座標です!! parts:("+e+", "+s+"), offset:("+i+", "+a+"), mapWidth = "+r);this._partsCoord=new c(e,s),this._offsetCoord=new c(i,a)}}class l{constructor(t,e,s){this.destPos=t.clone(),this.srcPos=e.clone(),this.srcSize=s.clone()}}class u{constructor(t,e,s,i,a){this.partsIDObj=t,this.x=e,this.y=s,this.isStatic=i,this.isFighting=a}}var d,p;!function(t){t[t.GOTO_WWA=0]="GOTO_WWA",t[t.BATTLE_REPORT=1]="BATTLE_REPORT",t[t.GAME_END=2]="GAME_END"}(d||(d={})),function(t){t[t.UNUSED=0]="UNUSED",t[t.LEFT=4]="LEFT",t[t.RIGHT=6]="RIGHT",t[t.DOWN=2]="DOWN",t[t.UP=8]="UP",t[t.LEFT_DOWN=1]="LEFT_DOWN",t[t.LEFT_UP=7]="LEFT_UP",t[t.RIGHT_DOWN=3]="RIGHT_DOWN",t[t.RIGHT_UP=9]="RIGHT_UP",t[t.NO_DIRECTION=5]="NO_DIRECTION"}(p||(p={}));const m=[0,-1,0,1,-1,0,1,-1,0,1],E=[0,1,1,1,0,0,0,-1,-1,-1];var g,w,f,v,y,S,A,T,I,C,P,D,N;!function(t){t[t.YES=0]="YES",t[t.NO=1]="NO",t[t.UNSELECTED=2]="UNSELECTED"}(g||(g={})),function(t){t[t.MAP=0]="MAP",t[t.OBJECT=1]="OBJECT",t[t.CHOICE_YES=2]="CHOICE_YES",t[t.CHOICE_NO=3]="CHOICE_NO"}(w||(w={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.CAN_USE=1]="CAN_USE",t[t.NOT_DISAPPEAR=2]="NOT_DISAPPEAR"}(f||(f={})),function(t){t[t.MAP=1]="MAP",t[t.OBJECT=0]="OBJECT"}(v||(v={}));class O{constructor(){var t=window.navigator.userAgent;this.os=this._getOS(t),this.browser=this.getBrowser(t),this.device=this.getDevice()}_getOS(t){return t.match(/xbox/i)?y.XBOX:t.match(/windows/i)?y.WINDOWS:t.match(/macintosh/i)?"ontouchstart"in document?y.IOS:y.MACINTOSH:t.match(/iphone|ipad|ipod/i)?y.IOS:t.match(/oculus/i)?y.OCULUS:t.match(/android/i)?y.ANDROID:t.match(/nintendo/i)?y.NINTENDO:t.match(/playstation/i)?y.PLAY_STATION:t.match(/linux/i)?y.LINUX:y.OTHERS}getBrowser(t){return t.match(/chrome/i)?A.CHROME:t.match(/firefox/i)?A.FIREFOX:t.match(/safari/i)?A.SAFARI:A.OTHERS}getDevice(){switch(this.os){case y.WINDOWS:case y.MACINTOSH:case y.LINUX:return S.PC;case y.IOS:case y.ANDROID:return S.SP;case y.OCULUS:return S.VR;case y.NINTENDO:case y.PLAY_STATION:case y.XBOX:return S.GAME}return S.OTHERS}}!function(t){t[t.WINDOWS=1]="WINDOWS",t[t.MACINTOSH=2]="MACINTOSH",t[t.LINUX=3]="LINUX",t[t.ANDROID=4]="ANDROID",t[t.IOS=5]="IOS",t[t.NINTENDO=6]="NINTENDO",t[t.PLAY_STATION=7]="PLAY_STATION",t[t.OCULUS=8]="OCULUS",t[t.XBOX=9]="XBOX",t[t.OTHERS=9999]="OTHERS"}(y||(y={})),function(t){t[t.PC=1]="PC",t[t.SP=2]="SP",t[t.VR=3]="VR",t[t.GAME=4]="GAME",t[t.OTHERS=9999]="OTHERS"}(S||(S={})),function(t){t[t.CHROME=1]="CHROME",t[t.FIREFOX=2]="FIREFOX",t[t.SAFARI=3]="SAFARI",t[t.OTHERS=9999]="OTHERS"}(A||(A={})),function(t){t[t.NONE=0]="NONE",t[t.CALL_BY_MAP_PARTS=1]="CALL_BY_MAP_PARTS",t[t.CALL_BY_OBJECT_PARTS=2]="CALL_BY_OBJECT_PARTS",t[t.CALL_BY_ITEM_USE=3]="CALL_BY_ITEM_USE",t[t.CALL_BY_QUICK_SAVE=4]="CALL_BY_QUICK_SAVE",t[t.CALL_BY_QUICK_LOAD=5]="CALL_BY_QUICK_LOAD",t[t.CALL_BY_RESTART_GAME=6]="CALL_BY_RESTART_GAME",t[t.CALL_BY_GOTO_WWA=7]="CALL_BY_GOTO_WWA",t[t.CALL_BY_PASSWORD_SAVE=8]="CALL_BY_PASSWORD_SAVE",t[t.CALL_BY_PASSWORD_LOAD=9]="CALL_BY_PASSWORD_LOAD",t[t.CALL_BY_END_GAME=10]="CALL_BY_END_GAME",t[t.CALL_BY_SUSPEND=11]="CALL_BY_SUSPEND",t[t.CALL_BY_LOG_QUICK_SAVE=12]="CALL_BY_LOG_QUICK_SAVE",t[t.CALL_BY_LOG_QUICK_LOAD=13]="CALL_BY_LOG_QUICK_LOAD"}(T||(T={})),function(t){t[t.QUICK_LOAD=0]="QUICK_LOAD",t[t.QUICK_SAVE=1]="QUICK_SAVE",t[t.RESTART_GAME=2]="RESTART_GAME",t[t.GOTO_WWA=3]="GOTO_WWA"}(I||(I={})),function(t){t[t.UP=0]="UP",t[t.DOWN=1]="DOWN"}(C||(C={})),function(t){t[t.QUICK_LOAD=0]="QUICK_LOAD",t[t.RESTART_GAME=1]="RESTART_GAME",t[t.PASSWORD=2]="PASSWORD"}(P||(P={})),function(t){t[t.STATIC=0]="STATIC",t[t.CHASE_PLAYER=1]="CHASE_PLAYER",t[t.RUN_OUT=2]="RUN_OUT",t[t.HANG_AROUND=3]="HANG_AROUND"}(D||(D={})),function(t){t[t.MODE_X=0]="MODE_X",t[t.MODE_Y=1]="MODE_Y",t[t.UNDECIDED=2]="UNDECIDED"}(N||(N={}));var b,M=["cell-load","cell-save","cell-restart","cell-gotowwa"];!function(t){t[t.UNDEFINED=0]="UNDEFINED",t[t.IMGPLAYER=1]="IMGPLAYER",t[t.IMGYESNO=2]="IMGYESNO",t[t.HPMAX=3]="HPMAX",t[t.SAVE=4]="SAVE",t[t.ITEM=5]="ITEM",t[t.DEFAULT=6]="DEFAULT",t[t.OLDMAP=7]="OLDMAP",t[t.PARTS=8]="PARTS",t[t.MOVE=9]="MOVE",t[t.MAP=10]="MAP",t[t.DIRMAP=11]="DIRMAP",t[t.IMGFRAME=12]="IMGFRAME",t[t.IMGBOM=13]="IMGBOM",t[t.DELPLAYER=14]="DELPLAYER",t[t.FACE=15]="FACE",t[t.EFFECT=16]="EFFECT",t[t.GAMEOVER=17]="GAMEOVER",t[t.IMGCLICK=18]="IMGCLICK",t[t.STATUS=19]="STATUS",t[t.EFFITEM=20]="EFFITEM",t[t.COLOR=21]="COLOR",t[t.WAIT=22]="WAIT",t[t.SOUND=23]="SOUND",t[t.JUMPGATE=24]="JUMPGATE",t[t.RECPOSITION=25]="RECPOSITION",t[t.JUMPRECPOSITION=26]="JUMPRECPOSITION",t[t.CONSOLE_LOG=27]="CONSOLE_LOG",t[t.COPY_HP_TO=28]="COPY_HP_TO",t[t.SET_HP=29]="SET_HP",t[t.COPY_HPMAX_TO=30]="COPY_HPMAX_TO",t[t.SET_HPMAX=31]="SET_HPMAX",t[t.COPY_AT_TO=32]="COPY_AT_TO",t[t.SET_AT=33]="SET_AT",t[t.COPY_DF_TO=34]="COPY_DF_TO",t[t.SET_DF=35]="SET_DF",t[t.COPY_MONEY_TO=36]="COPY_MONEY_TO",t[t.SET_MONEY=37]="SET_MONEY",t[t.COPY_STEP_COUNT_TO=38]="COPY_STEP_COUNT_TO",t[t.VAR_SET_VAL=39]="VAR_SET_VAL",t[t.VAR_SET=40]="VAR_SET",t[t.VAR_ADD=41]="VAR_ADD",t[t.VAR_SUB=42]="VAR_SUB",t[t.VAR_MUL=43]="VAR_MUL",t[t.VAR_DIV=44]="VAR_DIV",t[t.VAR_SET_RAND=45]="VAR_SET_RAND",t[t.SHOW_STR=46]="SHOW_STR",t[t.GAME_SPEED=47]="GAME_SPEED",t[t.IF=50]="IF",t[t.SET_SPEED=51]="SET_SPEED",t[t.COPY_TIME_TO=52]="COPY_TIME_TO",t[t.HIDE_STATUS=53]="HIDE_STATUS",t[t.VAR_MAP=54]="VAR_MAP",t[t.VAR_MOD=55]="VAR_MOD",t[t.NO_GAMEOVER=56]="NO_GAMEOVER",t[t.ELSE_IF=57]="ELSE_IF",t[t.ELSE=58]="ELSE",t[t.END_IF=59]="END_IF",t[t.SET=60]="SET",t[t.MAP2=61]="MAP2",t[t.SHOW_STR2=62]="SHOW_STR2",t[t.CONSOLE_LOG2=63]="CONSOLE_LOG2",t[t.DELAYBGM=64]="DELAYBGM",t[t.SYSMSG=65]="SYSMSG",t[t.PICTURE=66]="PICTURE",t[t.GAMEPAD_BUTTON=100]="GAMEPAD_BUTTON",t[t.OLDMOVE=101]="OLDMOVE",t[t.LEGACY_IF=10050]="LEGACY_IF"}(b||(b={}));var x,L,R,B={"":0,$imgplayer:1,$imgyesno:2,$hpmax:3,$save:4,$item:5,$default:6,$oldmap:7,$parts:8,$move:9,$map:10,$dirmap:11,$imgframe:12,$imgbom:13,$delplayer:14,$face:15,$effect:16,$gameover:17,$imgclick:18,$status:19,$effitem:20,$color:21,$wait:22,$sound:23,$jumpgate:24,$rec_pos:25,$jump_rec_pos:26,$console_log:27,$copy_hp_to:28,$set_hp:29,$copy_hpmax_to:30,$set_hpmax:31,$copy_at_to:32,$set_at:33,$copy_df_to:34,$set_df:35,$copy_money_to:36,$set_money:37,$copy_step_count_to:38,$var_set_val:39,$var_set:40,$var_add:41,$var_sub:42,$var_mul:43,$var_div:44,$var_set_rand:45,$show_str:46,$game_speed:47,$if:50,$set_speed:51,$copy_time_to:52,$hide_status:53,$var_map:54,$var_mod:55,$no_gameover:56,$else_if:57,$else:58,$endif:59,$set:60,$map2:61,$show_str2:62,$console_log2:63,$delaybgm:64,$sysmsg:65,$picture:66,$gamepad_button:100,$oldmove:101};!function(t){t[t.ENERGY=0]="ENERGY",t[t.STRENGTH=1]="STRENGTH",t[t.DEFENCE=2]="DEFENCE",t[t.GOLD=3]="GOLD",t[t.MOVES=4]="MOVES"}(x||(x={})),function(t){t[t.ENERGY=0]="ENERGY",t[t.STRENGTH=1]="STRENGTH",t[t.DEFENCE=2]="DEFENCE",t[t.GOLD=3]="GOLD",t[t.WIDE_CELL_ROW=4]="WIDE_CELL_ROW",t[t.ITEM_BG=5]="ITEM_BG",t[t.MAIN_FRAME=6]="MAIN_FRAME"}(L||(L={})),function(t){t[t.DECISION=1]="DECISION",t[t.ATTACK=3]="ATTACK",t[t.BGM_LB=70]="BGM_LB",t[t.NO_SOUND=99]="NO_SOUND"}(R||(R={}));const U=[1,2,5,8,10,20],k=["超低速","低速","準低速","中速","高速","超高速"],W=["energy","strength","defence","gold"];class V{}V.WWA_HOME="http://wwajp.com",V.ITEMBOX_SIZE=12,V.MAP_ATR_MAX=60,V.OBJ_ATR_MAX=60,V.OLD_MAP_ATR_MAX=40,V.OLD_OBJ_ATR_MAX=40,V.ATR_TYPE=3,V.ATR_MODE=4,V.ATR_STRING=5,V.ATR_X=6,V.ATR_Y=7,V.ATR_X2=8,V.ATR_Y2=9,V.ATR_ENERGY=10,V.ATR_STRENGTH=11,V.ATR_DEFENCE=12,V.ATR_GOLD=13,V.ATR_ITEM=14,V.ATR_NUMBER=15,V.ATR_JUMP_X=16,V.ATR_MOVE=16,V.ATR_JUMP_Y=17,V.ATR_SOUND=19,V.ATR_APPERANCE_BASE=20,V.REL_ATR_APPERANCE_ID=0,V.REL_ATR_APPERANCE_X=1,V.REL_ATR_APPERANCE_Y=2,V.REL_ATR_APPERANCE_TYPE=3,V.REL_ATR_APPERANCE_UNIT_LENGTH=4,V.ATR_RANDOM_BASE=10,V.RANDOM_ATR_NUM=10,V.RANDOM_ITERATION_MAX=10,V.MAP_STREET=0,V.MAP_WALL=1,V.MAP_LOCALGATE=2,V.MAP_URLGATE=4,V.OBJECT_NORMAL=0,V.OBJECT_MESSAGE=1,V.OBJECT_URLGATE=2,V.OBJECT_STATUS=3,V.OBJECT_ITEM=4,V.OBJECT_DOOR=5,V.OBJECT_MONSTER=6,V.OBJECT_SCORE=11,V.OBJECT_SELL=14,V.OBJECT_BUY=15,V.OBJECT_RANDOM=16,V.OBJECT_SELECT=17,V.OBJECT_LOCALGATE=18,V.SYSTEM_MESSAGE_NUM=20,V.IMGPOS_DEFAULT_YESNO_X=3,V.IMGPOS_DEFAULT_YESNO_Y=1,V.IMGRELPOS_YESNO_YES_X=0,V.IMGRELPOS_YESNO_NO_X=1,V.IMGRELPOS_YESNO_YESP_X=2,V.IMGRELPOS_YESNO_NOP_X=3,V.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0,V.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0,V.IMGPOS_DEFAULT_FRAME_X=0,V.IMGPOS_DEFAULT_FRAME_Y=1,V.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3,V.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3,V.DEFAULT_DISABLE_SAVE=!1,V.DEFAULT_OLDMAP=!1,V.DEFAULT_OBJECT_NO_COLLAPSE=!1,V.SPLASH_SCREEN_DISP_MILLS=100,V.DEFAULT_FRAME_INTERVAL=20,V.GAMEOVER_FRAME_INTERVAL=50,V.YESNO_PRESS_DISP_FRAME_NUM=20,V.WAIT_TIME_FRAME_NUM=6,V.CHIP_SIZE=40,V.MAP_WINDOW_WIDTH=440,V.MAP_WINDOW_HEIGHT=440,V.H_PARTS_NUM_IN_WINDOW=V.MAP_WINDOW_WIDTH/V.CHIP_SIZE,V.V_PARTS_NUM_IN_WINDOW=V.MAP_WINDOW_HEIGHT/V.CHIP_SIZE,V.MIN_SPEED_INDEX=0,V.MAX_SPEED_INDEX=U.length-1,V.QUICK_BATTLE_SPEED_INDECIES=[U.length-2,U.length-1],V.ANIMATION_REP_HALF_FRAME=22,V.PLAYER_LOOKING_AROUND_START_FRAME=4*V.ANIMATION_REP_HALF_FRAME,V.RELATIVE_COORD_BIAS=1e4,V.RELATIVE_COORD_LOWER=V.RELATIVE_COORD_BIAS-1e3,V.PLAYER_COORD=V.RELATIVE_COORD_BIAS-1e3,V.LOCALGATE_PLAYER_WAIT_FRAME=5,V.STATUS_CHANGED_EFFECT_FRAME_NUM=20,V.PASSABLE_OBJECT=1,V.APPERANCE_PARTS_MIN_INDEX=0,V.APPERANCE_PARTS_MAX_INDEX=9,V.APPERANCE_PARTS_MIN_INDEX_NO=5,V.APPERANCE_PARTS_MAX_INDEX_YES=4,V.FADEOUT_SPEED=8,V.STATUS_MINUS_BORDER=3e4,V.ITEMBOX_IS_FULL=-1,V.BATTLE_INTERVAL_FRAME_NUM=10,V.BATTLE_SPEED_CHANGE_TURN_NUM=40,V.RANDOM_MOVE_ITERATION_NUM=50,V.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31=8,V.BATTLE_ESTIMATE_MONSTER_TYPE_MAX=8,V.SOUND_MAX=100,V.ITEM_BORDER_IMG_DATA_URL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAArklEQVRYR+2Y0QqAIAxFt///aENJHwxxuJUSxzeh3S7HXaNpEkly4FIRzba0GEyHeVTN7jqDWvb7V4Y1NLibZIY0NbiL5G3MZLCe / 1fn3XJgJYjB7mgg6O1VCEKwXo79JeklY62nB62kRs9BEIKkeNIDhISQEBJC4k0BBCF4D7D4cV9shf99ixdB + MrM0y3fa3zV05D45GOqhwPMGPkYlccIOEY2VKUN0UNVXxC7ADj7mDi9aFZZAAAAAElFTkSuQmCC",V.LOAD_STAGE_MAX_EXCEPT_AUDIO=7,V.WWA_STYLE_TAG_ID="wwa-additional-style",V.DEFAULT_FRAME_COLOR_R=255,V.DEFAULT_FRAME_COLOR_G=255,V.DEFAULT_FRAME_COLOR_B=255,V.DEFAULT_FRAMEOUT_COLOR_R=96,V.DEFAULT_FRAMEOUT_COLOR_G=96,V.DEFAULT_FRAMEOUT_COLOR_B=96,V.DEFAULT_STRBACK_COLOR_R=0,V.DEFAULT_STRBACK_COLOR_G=0,V.DEFAULT_STRBACK_COLOR_B=0,V.DEFAULT_STATUS_COLOR_R=0,V.DEFAULT_STATUS_COLOR_G=0,V.DEFAULT_STATUS_COLOR_B=0,V.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM=20,V.WWAP_SERVER_OLD="http://wwawing.com/wwap",V.WWAP_SERVER="https://wwaphoenix.github.io",V.WWAP_SERVER_AUDIO_DIR="audio",V.WWAP_SERVER_TITLE_IMG="cover_p.gif",V.WWAP_SERVER_LOADER_NO_WORKER="wwaload.noworker.js",V.SCREEN_WIDTH=560,V.SCREEN_HEIGHT=440,V.LOADING_FONT="Times New Roman",V.MSG_STR_WIDTH=16,V.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME=20,V.ITEMBOX_TOP_Y=140,V.USER_VAR_NUM=256,V.USER_VAR_NUM_MAX_VALUE=9007199254740991,V.USET_VAR_NUM_MIN_VALUE=-9007199254740991,V.CONTROLL_WAIT_FRAME=6,V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM=10,V.FIGHT_DRAW_TURN=40;class F{}F.QUICK_SAVE_MAX=4,F.QUICK_SAVE_THUMNAIL_WIDTH=99,F.QUICK_SAVE_THUMNAIL_HEIGHT=99,F.SAVE_INTERVAL_MOVE=200,F.INDEXEDDB_DB_NAME="WWA_WING_DB",F.INDEXEDDB_TABLE_NAME="SAVE_TABLE",F.DATE_LAST_SAVE_TEXT_COLOR="rgba(255,255,0,1)";class Y{}Y.EMPTY_LOAD="",Y.EMPTY_SAVE="",Y.PASSWORD="Password",Y.QUICK_SAVE="Quick Save",Y.QUICK_LOAD="Quick Load",Y.BATTLE_REPORT="Battle Report",Y.GAME_END="Game End",Y.GOTO_WWA="Goto WWA",Y.RESTART_GAME="Restart Game";class G{}var H;!function(t){t[t.INIT=0]="INIT",t[t.MAP_LOAD=1]="MAP_LOAD",t[t.OBJ_LOAD=2]="OBJ_LOAD",t[t.MAP_ATTR=3]="MAP_ATTR",t[t.OBJ_ATTR=4]="OBJ_ATTR",t[t.RAND_PARTS=5]="RAND_PARTS",t[t.MESSAGE=6]="MESSAGE",t[t.GAME_INIT=7]="GAME_INIT",t[t.AUDIO=8]="AUDIO",t[t.FINISH=9]="FINISH"}(H||(H={}));var K,j,X,J,$,Z,q,z,Q,tt,et,st=["ロードの準備をしています。","背景パーツを読み込んでいます。","物体パーツを読み込んでます。","背景パーツの属性を読み込んでます。","物体パーツの属性を読み込んでます。","ランダムパーツを置換しています。","メッセージを読み込んでます。","Welcome to WWA Wing!"],it=["Welcome to WWA Wing!","Now Map Data Loading .....","Now CG Data Loading .....","Now Making chara CG ....."];!function(t){t[t.LINE=30]="LINE",t[t.TITLE_X=100]="TITLE_X",t[t.TITLE_Y=70]="TITLE_Y",t[t.LOADING_X=50]="LOADING_X",t[t.LOADING_Y=140]="LOADING_Y",t[t.ERROR_X=10]="ERROR_X",t[t.ERROR_Y=180]="ERROR_Y",t[t.FOOTER_X=160]="FOOTER_X",t[t.FOOTER_Y=360]="FOOTER_Y",t[t.WORLD_Y=330]="WORLD_Y",t[t.COPYRIGHT_Y=390]="COPYRIGHT_Y"}(K||(K={})),function(t){t[t.TITLE=32]="TITLE",t[t.LOADING=22]="LOADING",t[t.FOOTER=18]="FOOTER",t[t.ERRROR=16]="ERRROR"}(j||(j={})),function(t){t[t.COLOR_FRAME=0]="COLOR_FRAME",t[t.COLOR_FRAMEOUT=1]="COLOR_FRAMEOUT",t[t.COLOR_STR=2]="COLOR_STR",t[t.COLOR_STATUS_STR=4]="COLOR_STATUS_STR"}(X||(X={})),function(t){t[t.MESSAGE_WINDOW=0]="MESSAGE_WINDOW",t[t.SIDEBAR=1]="SIDEBAR"}(J||(J={})),function(t){t[t.BITSHIFT=16]="BITSHIFT",t[t.BITMASK=65535]="BITMASK"}($||($={})),function(t){t[t.NONE=0]="NONE",t[t.KEYDOWN=1]="KEYDOWN",t[t.KEYPRESS=2]="KEYPRESS",t[t.KEYUP=3]="KEYUP",t[t.KEYPRESS_MESSAGECHANGE=4]="KEYPRESS_MESSAGECHANGE"}(Z||(Z={})),function(t){t[t.KEY_ENTER=13]="KEY_ENTER",t[t.KEY_SHIFT=16]="KEY_SHIFT",t[t.KEY_ESC=27]="KEY_ESC",t[t.KEY_SPACE=32]="KEY_SPACE",t[t.KEY_LEFT=37]="KEY_LEFT",t[t.KEY_UP=38]="KEY_UP",t[t.KEY_RIGHT=39]="KEY_RIGHT",t[t.KEY_DOWN=40]="KEY_DOWN",t[t.KEY_1=49]="KEY_1",t[t.KEY_2=50]="KEY_2",t[t.KEY_3=51]="KEY_3",t[t.KEY_A=65]="KEY_A",t[t.KEY_B=66]="KEY_B",t[t.KEY_C=67]="KEY_C",t[t.KEY_D=68]="KEY_D",t[t.KEY_E=69]="KEY_E",t[t.KEY_F=70]="KEY_F",t[t.KEY_G=71]="KEY_G",t[t.KEY_H=72]="KEY_H",t[t.KEY_I=73]="KEY_I",t[t.KEY_J=74]="KEY_J",t[t.KEY_K=75]="KEY_K",t[t.KEY_L=76]="KEY_L",t[t.KEY_M=77]="KEY_M",t[t.KEY_N=78]="KEY_N",t[t.KEY_O=79]="KEY_O",t[t.KEY_P=80]="KEY_P",t[t.KEY_Q=81]="KEY_Q",t[t.KEY_R=82]="KEY_R",t[t.KEY_S=83]="KEY_S",t[t.KEY_T=84]="KEY_T",t[t.KEY_U=85]="KEY_U",t[t.KEY_V=86]="KEY_V",t[t.KEY_W=87]="KEY_W",t[t.KEY_X=88]="KEY_X",t[t.KEY_Y=89]="KEY_Y",t[t.KEY_Z=90]="KEY_Z",t[t.KEY_F1=112]="KEY_F1",t[t.KEY_F2=113]="KEY_F2",t[t.KEY_F3=114]="KEY_F3",t[t.KEY_F4=115]="KEY_F4",t[t.KEY_F5=116]="KEY_F5",t[t.KEY_F6=117]="KEY_F6",t[t.KEY_F7=118]="KEY_F7",t[t.KEY_F8=119]="KEY_F8",t[t.KEY_F9=120]="KEY_F9",t[t.KEY_F10=121]="KEY_F10",t[t.KEY_F12=123]="KEY_F12"}(q||(q={}));class at{checkHitKey(t){var e=this.getKeyState(t);return e===Z.KEYDOWN||e===Z.KEYPRESS}getKeyState(t){return this._prevKeyState[t]?this._keyState[t]?Z.KEYPRESS:Z.KEYUP:this._keyState[t]?Z.KEYDOWN:Z.NONE}getKeyStateForControllPlayer(t){return this._prevKeyStateOnControllable[t]?this._keyState[t]?Z.KEYPRESS:Z.KEYUP:this._keyState[t]?Z.KEYDOWN:Z.NONE}getKeyStateForMessageCheck(t){return this._prevKeyState[t]?this._keyState[t]?this._keyInputContinueFrameNum[t]>=V.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM?Z.KEYPRESS_MESSAGECHANGE:Z.KEYPRESS:Z.KEYUP:this._keyState[t]?Z.KEYDOWN:Z.NONE}setPressInfo(t){this._nextKeyState[t]=!0,this._keyInputContinueFrameNum[t]=-1}setReleaseInfo(t){this._nextKeyState[t]=!1,this._keyInputContinueFrameNum[t]=-1}update(){var t;for(this._prevKeyState=this._keyState.slice(),this._keyState=this._nextKeyState.slice(),t=0;t<at.KEY_BUFFER_MAX;t++)this._keyState[t]&&this._keyInputContinueFrameNum[t]++}memorizeKeyStateOnControllableFrame(){this._prevKeyStateOnControllable=this._keyState.slice()}allClear(){var t;for(this._nextKeyState=new Array(at.KEY_BUFFER_MAX),t=0;t<at.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1}constructor(){var t;for(this._nextKeyState=new Array(at.KEY_BUFFER_MAX),this._keyState=new Array(at.KEY_BUFFER_MAX),this._prevKeyState=new Array(at.KEY_BUFFER_MAX),this._prevKeyStateOnControllable=new Array(at.KEY_BUFFER_MAX),this._keyInputContinueFrameNum=new Array(at.KEY_BUFFER_MAX),t=0;t<at.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1,this._keyState[t]=!1,this._prevKeyState[t]=!1,this._prevKeyStateOnControllable[t]=!1,this._keyInputContinueFrameNum[t]=0}}at.KEY_BUFFER_MAX=256,function(t){t[t.NONE=0]="NONE",t[t.MOUSEDOWN=1]="MOUSEDOWN",t[t.MOUSEPRESS=2]="MOUSEPRESS",t[t.MOUSEUP=3]="MOUSEUP"}(z||(z={})),function(t){t[t.DIR_KEY=1]="DIR_KEY"}(Q||(Q={}));class rt{checkClickMouse(t){var e;return(e=void 0!==t?this.getMouseState(t):this.getMouseState())===z.MOUSEDOWN||e===z.MOUSEPRESS}getMouseState(t){return void 0!==t&&this._inputDir!==t?z.NONE:this._prevMouseState?this._mouseState?z.MOUSEPRESS:z.MOUSEUP:this._mouseState?z.MOUSEDOWN:z.NONE}getMouseStateForControllPlayer(t){return void 0!==t&&this._inputDir!==t?z.NONE:this._prevMouseStateOnControllable?this._mouseState?z.MOUSEPRESS:z.MOUSEUP:this._mouseState?z.MOUSEDOWN:z.NONE}setPressInfo(t,e){this._nextMouseState=!0,this._inputDir=t,this._touchID=e}setReleaseInfo(){this._touchID=0,this._nextMouseState=!1}touchIDIsSetDir(){return this._touchID===Q.DIR_KEY}memorizeMouseStateOnControllableFrame(){this._prevMouseStateOnControllable=this._mouseState}update(){this._prevMouseState=this._mouseState,this._mouseState=this._nextMouseState}clear(){this._nextMouseState=!1}getTouchID(){return this._touchID}constructor(){this._prevMouseState=!1,this._mouseState=!1,this._nextMouseState=!1}}!function(t){t[t.BUTTON_INDEX_B=0]="BUTTON_INDEX_B",t[t.BUTTON_INDEX_A=1]="BUTTON_INDEX_A",t[t.BUTTON_INDEX_Y=2]="BUTTON_INDEX_Y",t[t.BUTTON_INDEX_X=3]="BUTTON_INDEX_X",t[t.BUTTON_INDEX_L=4]="BUTTON_INDEX_L",t[t.BUTTON_INDEX_R=5]="BUTTON_INDEX_R",t[t.BUTTON_INDEX_ZL=6]="BUTTON_INDEX_ZL",t[t.BUTTON_INDEX_ZR=7]="BUTTON_INDEX_ZR",t[t.BUTTON_INDEX_MINUS=8]="BUTTON_INDEX_MINUS",t[t.BUTTON_INDEX_PLUS=9]="BUTTON_INDEX_PLUS",t[t.BUTTON_INDEX_LEFT_STICK=10]="BUTTON_INDEX_LEFT_STICK",t[t.BUTTON_INDEX_RIGHT_STICK=11]="BUTTON_INDEX_RIGHT_STICK",t[t.BUTTON_CROSS_KEY_UP=12]="BUTTON_CROSS_KEY_UP",t[t.BUTTON_CROSS_KEY_DOWN=13]="BUTTON_CROSS_KEY_DOWN",t[t.BUTTON_CROSS_KEY_LEFT=14]="BUTTON_CROSS_KEY_LEFT",t[t.BUTTON_CROSS_KEY_RIGHT=15]="BUTTON_CROSS_KEY_RIGHT"}(tt||(tt={})),function(t){t[t.AXES_L_HORIZONTAL_INDEX=0]="AXES_L_HORIZONTAL_INDEX",t[t.AXES_L_VERTICAL_INDEX=1]="AXES_L_VERTICAL_INDEX",t[t.AXES_R_HORIZONTAL_INDEX=2]="AXES_R_HORIZONTAL_INDEX",t[t.AXES_R_VERTICAL_INDEX=3]="AXES_R_VERTICAL_INDEX",t[t.AXES_CROSS_KEY=9]="AXES_CROSS_KEY"}(et||(et={}));class nt{constructor(){var t;for(this.gamepad=null,this.triggers=[],t=0;t<16;t++)this.triggers[t]=!1}update(){this.gamepad=null;var t=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads:[];if(t&&t.length>0&&t[0]){var e=t[0];this.gamepad=e}}buttonTrigger(...t){if(!this.gamepad)return!1;var e,s,i,a,r;for(s=t.length,e=0;e<s;e++){i=t[e];var n=this.gamepad.buttons[i];if(!n)return!1;if(a="object"==typeof n?!0===n.pressed:1===n,r=this.triggers[i],this.triggers[i]=a,a&&!r)return!0}return!1}buttonPressed(...t){if(!this.gamepad)return!1;var e,s,i;for(s=t.length,e=0;e<s;e++){i=t[e];var a=this.gamepad.buttons[i];if(!a)return!1;if("object"==typeof a?!0===a.pressed:1===a)return!0}return!1}crossPressed(...t){if(!this.gamepad)return!1;var e,s;for(s=t.length,e=0;e<s;e++)switch(t[e]){case tt.BUTTON_CROSS_KEY_UP:if(this.gamepad.axes[et.AXES_L_VERTICAL_INDEX]<=-.6||this.gamepad.axes[et.AXES_R_VERTICAL_INDEX]<=-.6||-1===this.stickFloor(et.AXES_CROSS_KEY)||this.buttonPressed(tt.BUTTON_CROSS_KEY_UP))return!0;break;case tt.BUTTON_CROSS_KEY_DOWN:if(this.gamepad.axes[et.AXES_L_VERTICAL_INDEX]>=.7||this.gamepad.axes[et.AXES_R_VERTICAL_INDEX]>=.7||.1===this.stickFloor(et.AXES_CROSS_KEY)||this.buttonPressed(tt.BUTTON_CROSS_KEY_DOWN))return!0;break;case tt.BUTTON_CROSS_KEY_LEFT:if(this.gamepad.axes[et.AXES_L_HORIZONTAL_INDEX]<=-.7||this.gamepad.axes[et.AXES_R_HORIZONTAL_INDEX]<=-.7||.7===this.stickFloor(et.AXES_CROSS_KEY)||this.buttonPressed(tt.BUTTON_CROSS_KEY_LEFT))return!0;break;case tt.BUTTON_CROSS_KEY_RIGHT:if(this.gamepad.axes[et.AXES_L_HORIZONTAL_INDEX]>.6||this.gamepad.axes[et.AXES_R_HORIZONTAL_INDEX]>.6||-.5===this.stickFloor(et.AXES_CROSS_KEY)||this.buttonPressed(tt.BUTTON_CROSS_KEY_RIGHT))return!0}return!1}vibration(t){return!!this.gamepad&&(!!this.gamepad.vibrationActuator&&void(t?this.gamepad.vibrationActuator.playEffect("dual-rumble",{startDelay:0,duration:100,weakMagnitude:1,strongMagnitude:.5}):this.gamepad.vibrationActuator.playEffect("dual-rumble",{startDelay:0,duration:100,weakMagnitude:.5,strongMagnitude:1})))}stickFloor(...t){if(!this.gamepad)return 0;var e,s,i;for(s=t.length,e=0;e<s;e++){i=t[e];var a=this.gamepad.axes[i];return"number"!=typeof a?0:Math.floor(10*a)/10}return 0}}class ot{constructor(t=0){this.lastCalculatedTimeUnixMs=Date.now(),this.lastCalculatedPlayTimeMs=t}calculateTimeMs(){const t=Date.now(),e=t-this.lastCalculatedTimeUnixMs+this.lastCalculatedPlayTimeMs;return this.lastCalculatedTimeUnixMs=t,this.lastCalculatedPlayTimeMs=e,e}calculatePlayTimeFormat(){return ot.formatPlayTimeText(this.calculateTimeMs()/1e3)}static formatPlayTimeText(t){const e=Math.floor(t);return e>=36e6?"9999:99:99":("000"+(e/60/60|0)).slice(-4)+":"+("0"+(e/60|0)%60).slice(-2)+":"+("0"+e%60).slice(-2)}}const ht=["BUTTON_ENTER","BUTTON_ESC","BUTTON_SIDEBAR","BUTTON_FAST","BUTTON_SLOW","BUTTON_LEFT","BUTTON_UP","BUTTON_RIGHT","BUTTON_DOWN"],ct=["BUTTON_LEFT","BUTTON_UP","BUTTON_RIGHT","BUTTON_DOWN"],_t=new Set(ct);class lt{constructor(t,e=!1,s=null,i=null,a=null,r=null){if(this._enabled=null!==t,this._visible=e,this._onTouchStart=a||null,this._onTouchEnd=r||null,this._availableButtons=[],this._isTouchingButtons={},this._moveButtonsElement=i,this._buttonWrapperElement=s,this._setVisible(e),this._moveButtonsElement&&(this._moveButtonsElement.style.visibility="visible"),this._buttonWrapperElement&&(this._buttonWrapperElement.style.visibility="visible"),null!==t){for(const e in t){const s=t[e];if(!s)continue;const i=e;this._availableButtons.push(i),s.setAttribute("type",e),this._isTouchingButtons[i]={prev:!1,current:!1,next:!1};const a=t=>{t.cancelable&&t.preventDefault()},r=t=>{a(t),this.allClear()};s.addEventListener("touchstart",(t=>{a(t),this.setTouchInfo(i)})),s.addEventListener("touchcancel",r),lt.isMoveButton(i)?(s.addEventListener("touchmove",this._detectMovingMoveButton.bind(this)),s.addEventListener("touchend",this.allMoveClear.bind(this))):s.addEventListener("touchend",(t=>{a(t),this.clearTouchInfo(i)}))}null!==i&&i.addEventListener("touchmove",this._detectMovingMoveButton.bind(this))}}_detectMovingMoveButton(t){t.preventDefault(),this.allMoveClear();const e=t.targetTouches.item(0);if(!this._moveButtonsElement||null===e)return;const s=this._moveButtonsElement.getBoundingClientRect(),i=document.body.getBoundingClientRect(),a=s.left-i.left+s.width/2,r=s.top-i.top+s.height/2,n=e.pageX-a,o=e.pageY-r;n>=o?n<=-o?this.setTouchInfo("BUTTON_UP"):this.setTouchInfo("BUTTON_RIGHT"):n>=-o?this.setTouchInfo("BUTTON_DOWN"):this.setTouchInfo("BUTTON_LEFT")}_setVisible(t){null!==this._moveButtonsElement&&(this._moveButtonsElement.style.display=t?"grid":"none"),null!==this._buttonWrapperElement&&(this._buttonWrapperElement.style.display=t?"grid":"none"),this._visible=t}checkTouchButton(t){if(!this._enabled)return!1;return"TOUCH"===this.getButtonState(t)}checkTouchingButton(t){if(!this._enabled)return!1;const e=this.getButtonState(t);return"TOUCH"===e||"TOUCHING"===e}getButtonState(t){const e=this._isTouchingButtons[t];if(!this._enabled||void 0===e)return"NONE";const s=e.prev,i=e.current;return s&&i?"TOUCHING":i?"TOUCH":s?"LEAVE":"NONE"}setTouchInfo(t){const e=this._isTouchingButtons[t];this._enabled&&void 0!==e&&(e.next=!0)}clearTouchInfo(t){const e=this._isTouchingButtons[t];this._enabled&&void 0!==e&&(e.next=!1)}allMoveClear(){ct.forEach((t=>{this._availableButtons.includes(t)&&this.clearTouchInfo(t)}))}allClear(){this._availableButtons.forEach((t=>{if(void 0!==t){const e=this._isTouchingButtons[t];void 0!==e&&(e.next=!1)}}))}static isMoveButton(t){return _t.has(t)}update(){this._availableButtons.forEach((t=>{var e,s;if(void 0===t)return;const i=this._isTouchingButtons[t];if(void 0!==i)switch(this._isTouchingButtons[t].prev=i.current,this._isTouchingButtons[t].current=i.next,this.getButtonState(t)){case"TOUCH":null===(e=this._onTouchStart)||void 0===e||e.call(this,t);break;case"LEAVE":null===(s=this._onTouchEnd)||void 0===s||s.call(this,t)}}))}toggleVisible(){this._setVisible(!this._visible)}}function ut(){const t=document.querySelector("meta[name='viewport']"),e=window.innerWidth,s=window.innerHeight;let i="user-scalable=no";if(e>s){i=`width=${Math.floor(e/s*456)},${i}`}else e<=s&&(i=`width=576,${i}`);null==t||t.setAttribute("content",`${i}`)}var dt=t=>document.getElementById(t),pt=t=>document.getElementsByTagName(t),mt=t=>document.querySelector(t),Et=t=>document.querySelector(t),gt=t=>document.querySelectorAll(t),wt=(t,e)=>{var s,i,a=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,r=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;return s=t-dt("wwa-wrapper").offsetLeft+a,i=e-dt("wwa-wrapper").offsetTop+r,new c(s,i)},ft=t=>t.match(/^https?:\/\//)||t.match(/^\.\.\//)?t:location.href="./"+t,vt=t=>{var e="";if(t instanceof Array){for(var s=0;s<t.length;s++)e+=vt(t[s])+"/";return e}return t+""};const yt=t=>t.split("").reverse().join("");function St(t,e){if("number"!=typeof t)throw new TypeError(`${e} が数値ではありません。`);return!0}function At(t,e){if("string"==typeof t){const s=[...t];return e&&s.length>10?`"${s.slice(0,10).join("")}…`:`"${t}"`}return String(t)}const Tt=[{name:"pos",type:"numberArray"},{name:"time",type:"number"},{name:"size",type:"numberArray"},{name:"repeat",type:"numberArray"},{name:"img",type:"numberArray"},{name:"imgFile",type:"string"},{name:"crop",type:"numberArray"},{name:"text",type:"string"},{name:"font",type:"string"},{name:"color",type:"numberArray"},{name:"textAlign",type:"string"},{name:"lineHeight",type:"number"},{name:"opacity",type:"number"},{name:"next",type:"numberArray"},{name:"map",type:"numberArray"},{name:"script",type:"string"}],It="-?\\d+",Ct=`v\\[(${It})\\]`,Pt=`m\\[${It}\\]\\[${It}\\]`,Dt=`m\\[(${It})\\]\\[(${It})\\]`,Nt=`o\\[${It}\\]\\[${It}\\]`,Ot=`o\\[(${It})\\]\\[(${It})\\]`,bt=`ITEM\\[${It}\\]`,Mt=`ITEM\\[(${It})\\]`,xt=`${`v\\[${It}\\]`}|${Pt}|${Nt}|${bt}`,Lt="HP|HPMAX|AT|DF|GD|STEP|PDIR",Rt=`${xt}|${Pt}|${Nt}|${bt}|${Lt}`,Bt=`${It}|${xt}|AT_TOTAL|AT_ITEMS|DF_TOTAL|DF_ITEMS|TIME|X|Y|PX|PY|ID|TYPE|ITEM_COUNT_ALL|${Lt}`,Ut=`RAND\\((${Bt})\\)`,kt=`ITEM_COUNT\\((${Bt})\\)`,Wt=`${Bt}|${`${`RAND\\((?:${Bt})\\)`}|${`ITEM_COUNT\\((?:${Bt})\\)`}`}`,Vt="\\+|\\-|\\*|\\/|%",Ft="^\\(",Yt="\\)$",Gt=new RegExp(`^${It}$`),Ht=new RegExp(`^${Ct}$`),Kt=new RegExp(`^${Dt}$`),jt=new RegExp(`^${Ot}$`),Xt=new RegExp(`^${Mt}$`),Jt=new RegExp(`^${Ut}$`),$t=new RegExp(`${kt}$`),Zt=new RegExp(`${Ft}(${Rt})=(${Wt})(${Vt})(${Wt})${Yt}`),qt=new RegExp(`${Ft}(${Rt})(=|\\+=|\\-=|\\*=|\\/=|%=)(${Wt})${Yt}`),zt=new RegExp(`^(${Wt})(?:(${Vt})(${Wt}))?$`),Qt=new RegExp(`${Ft}(${Wt})(>|<|<=|>=|==|!=)(${Wt})${Yt}`),te=new RegExp(`{{(${Wt})}}`,"g");function ee(t){return"RAND"!==t.type&&"ITEM_COUNT"!==t.type}function se(t){switch(t){case"HP":case"HPMAX":case"AT":case"AT_TOTAL":case"AT_ITEMS":case"DF":case"DF_TOTAL":case"DF_ITEMS":case"GD":case"STEP":case"TIME":case"X":case"Y":case"PX":case"PY":case"PDIR":case"ID":case"TYPE":case"ITEM_COUNT_ALL":return{type:t};default:const e=t.match(Ht);if(e){const t=ie(e);return null===t?null:{type:"VARIABLE",index:t}}const s=t.match(Kt);if(s){const t=ae(s);return null===t?null:{type:"MAP",x:t[0],y:t[1]}}const i=t.match(jt);if(i){const t=ae(i);return null===t?null:{type:"OBJECT",x:t[0],y:t[1]}}const a=t.match(Xt);if(a){const t=ie(a);return null===t?null:{type:"ITEM",boxIndex1To12:t}}if(t.match(Gt)){const e=parseInt(t,10);return null===e||isNaN(e)?null:{type:"NUMBER",rawValue:e}}const r=t.match(Jt);if(r){const t=r.length>=2?se(r[1]):null;return null!==t&&ee(t)?{type:"RAND",argument:t}:null}const n=t.match($t);if(n){const t=n.length>=2?se(n[1]):null;return null!==t&&ee(t)?{type:"ITEM_COUNT",argument:t}:null}return null}}function ie(t){const e=t.length>=2?Number(t[1]):null;return null===e||isNaN(e)?null:e}function ae(t){if(t.length<3)return null;const e=Number(t[1]),s=Number(t[2]);return isNaN(e)||isNaN(s)?null:[e,s]}function re(t,e,s=0){if("boolean"==typeof t)return t;const i=ne(t.left,e,s),a=ne(t.right,e,s);return function(t,e,s){switch(t){case">":return e>s;case"<":return e<s;case">=":return e>=s;case"<=":return e<=s;case"==":return e===s;case"!=":return e!==s;default:return!1}}(t.operator,i,a)}function ne(t,e,s=0){switch(t.type){case"HP":return e.totalStatus.energy;case"HPMAX":return e.energyMax;case"AT":return e.bareStatus.strength;case"AT_TOTAL":return e.totalStatus.strength;case"AT_ITEMS":return e.itemStatus.strength;case"DF":return e.bareStatus.defence;case"DF_TOTAL":return e.totalStatus.defence;case"DF_ITEMS":return e.itemStatus.defence;case"GD":return e.totalStatus.gold;case"STEP":return e.moveCount;case"VARIABLE":{const s=e.userVars[t.index];return St(s,`v${t.index}`)?s:0}case"MAP":return t.y<0||t.y>=e.map.length||t.x<0||t.x>=e.map[t.y].length?0:e.map[t.y][t.x];case"OBJECT":return t.y<0||t.y>=e.mapObject.length||t.x<0||t.x>=e.mapObject[t.y].length?0:e.mapObject[t.y][t.x];case"ITEM":return t.boxIndex1To12<1||t.boxIndex1To12>12?0:e.itemBox[t.boxIndex1To12-1];case"ITEM_COUNT_ALL":return e.itemBox.filter((t=>0!==t)).length;case"NUMBER":return t.rawValue;case"TIME":return e.playTime;case"X":return e.partsPosition.x;case"Y":return e.partsPosition.y;case"PX":return e.playerCoord.x;case"PY":return e.playerCoord.y;case"PDIR":return e.playerDirection;case"ID":return e.partsId;case"TYPE":return e.partsType;case"RAND":return Math.floor(Math.random()*ne(t.argument,e));case"ITEM_COUNT":return e.itemBox.filter((s=>s===ne(t.argument,e))).length;default:return s}}function oe(t,e,s){switch(t){case"=":return s;case"+":case"+=":return e+s;case"-":case"-=":return e-s;case"*":case"*=":return e*s;case"/":case"/=":return 0===s?0:e/s;case"%":case"%=":return 0===s?0:e%s;default:throw new Error("未定義の演算子です")}}function he(t,e){var s;switch(null===(s=se(e))||void 0===s?void 0:s.type){case"VARIABLE":{const s=e.match(/^v\[(\d+)\]$/),i=Number(s[1]);if(null===i||isNaN(i))throw new Error("ユーザ変数の添字のパースに失敗しました");return{assignee:"variable",index:i,rawValue:t}}case"MAP":{const s=e.match(/^m\[(\d+)\]\[(\d+)\]$/),i=Number(s[1]),a=Number(s[2]);if(null===i||null===a||isNaN(i)||isNaN(a))throw new Error("背景パーツの添字のパースに失敗しました");return{assignee:"map",x:i,y:a,rawValue:t}}case"OBJECT":{const s=e.match(/^o\[(\d+)\]\[(\d+)\]$/),i=Number(s[1]),a=Number(s[2]);if(null===i||null===a||isNaN(i)||isNaN(a))throw new Error("物体パーツの添字のパースに失敗しました");return{assignee:"mapObject",x:i,y:a,rawValue:t}}case"ITEM":{const s=e.match(/^ITEM\[(\d+)\]$/),i=Number(s[1]);if(null===i||isNaN(i))throw new Error("アイテムの添字のパースに失敗しました");return{assignee:"item",boxIndex1to12:i,rawValue:t}}case"ITEM_COUNT_ALL":case"ITEM_COUNT":throw new Error("左辺値に所持アイテム数は入れられません");case"NUMBER":throw new Error("左辺値に定数は入れられません");case"HP":return{assignee:"energy",rawValue:t};case"HPMAX":return{assignee:"energyMax",rawValue:t};case"AT":return{assignee:"strength",rawValue:t};case"AT_TOTAL":throw new Error("左辺値に合計攻撃力は入れられません");case"AT_ITEMS":throw new Error("左辺値にアイテム攻撃力は入れられません");case"DF":return{assignee:"defence",rawValue:t};case"DF_TOTAL":throw new Error("左辺値に合計防御力は入れられません");case"DF_ITEMS":throw new Error("左辺値にアイテム防御力は入れられません");case"GD":return{assignee:"gold",rawValue:t};case"STEP":return{assignee:"moveCount",rawValue:t};case"TIME":throw new Error("左辺値にプレイ時間は入れられません");case"PX":throw new Error("左辺値にプレイヤーX座標は入れられません");case"PY":throw new Error("左辺値にプレイヤーY座標は入れられません");case"X":throw new Error("左辺値にパーツX座標は入れられません");case"Y":throw new Error("左辺値にパーツY座標は入れられません");case"ID":throw new Error("左辺値にパーツ番号座標は入れられません");case"TYPE":throw new Error("左辺値にパーツ種別は入れられません");case"PDIR":return{assignee:"playerDirection",rawValue:t};case"RAND":throw new Error("左辺値に乱数は入れられません");default:throw new Error("この文字列から代入操作オブジェクトは生成できません")}}function ce(t){return t.replace(/\s/g,"")}function _e(t,e,s=0){return ne(se(t),e,s)}function le(t,e,s=0){const i=ce(t).match(zt);if(null!==i){const t=_e(i[1],e,s),a=i[3]?_e(i[3],e,s):void 0,r=i[2];return r&&a?oe(r,t,a):t}throw new Error("マクロ引数のフォーマットを満たしていません: "+t)}function ue(t){const e=ce(t).match(Qt);if(null===e||e.length<=3)return void console.error(`判定式が異常です: ${t}`);const s=se(e[1]),i=se(e[3]);if(s&&i)return{left:s,right:i,operator:e[2]};console.error(`判定式が異常です: ${t}`)}const de=(t,e)=>{const s=Tt.find((({name:e})=>e===t));if(!s)return console.warn(`定義外のプロパティ ${t} を見つけました。`),!1;if("string"===s.type)if("string"!=typeof e)return"number"!=typeof e&&console.warn(`プロパティ ${t} では文字列形式である必要があります。実際に入った値は ${e} です。`),!1;return!0},pe=t=>{const e=Object.entries(t.properties).map((([t,e])=>(de(t,e),[t,e])));return{...t,properties:Object.fromEntries(e)}};class me{}me.ITEMBOX_SIZE=12,me.MAP_ATR_MAX=60,me.OBJ_ATR_MAX=60,me.OLD_MAP_ATR_MAX=40,me.OLD_OBJ_ATR_MAX=40,me.ATR_CROP1=1,me.ATR_CROP2=2,me.ATR_TYPE=3,me.ATR_JUMP_X=16,me.ATR_JUMP_Y=17,me.MAP_LOCALGATE=2,me.OBJECT_LOCALGATE=18,me.SYSTEM_MESSAGE_NUM=20,me.IMGPOS_DEFAULT_YESNO_X=3,me.IMGPOS_DEFAULT_YESNO_Y=1,me.IMGPOS_DEFAULT_PLAYER_X=2,me.IMGPOS_DEFAULT_PLAYER_Y=0,me.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0,me.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0,me.IMGPOS_DEFAULT_STATUS_X=3,me.IMGPOS_DEFAULT_STATUS_Y=2,me.IMGRELPOS_ENERGY_ICON_X=0,me.IMGRELPOS_STRENGTH_ICON_X=1,me.IMGRELPOS_DEFENCE_ICON_X=2,me.IMGRELPOS_GOLD_ICON_X=3,me.IMGPOS_DEFAULT_WIDE_CELL_X=4,me.IMGPOS_DEFAULT_WIDE_CELL_Y=3,me.IMGPOS_DEFAULT_ITEMBOX_X=1,me.IMGPOS_DEFAULT_ITEMBOX_Y=2,me.IMGPOS_DEFAULT_FRAME_X=0,me.IMGPOS_DEFAULT_FRAME_Y=1,me.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3,me.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3,me.DEFAULT_DISABLE_SAVE=!1,me.DEFAULT_OLDMAP=!1,me.DEFAULT_OBJECT_NO_COLLAPSE=!1,me.DEFAULT_FRAME_COLOR_R=255,me.DEFAULT_FRAME_COLOR_G=255,me.DEFAULT_FRAME_COLOR_B=255,me.DEFAULT_FRAMEOUT_COLOR_R=96,me.DEFAULT_FRAMEOUT_COLOR_G=96,me.DEFAULT_FRAMEOUT_COLOR_B=96,me.DEFAULT_STR_COLOR_R=0,me.DEFAULT_STR_COLOR_G=0,me.DEFAULT_STR_COLOR_B=0,me.DEFAULT_STATUS_COLOR_R=0,me.DEFAULT_STATUS_COLOR_G=0,me.DEFAULT_STATUS_COLOR_B=0,me.DEFAULT_MOVES=0,me.DEFAULT_SPEED_INDEX=3,me.USER_VAR_NUM=256;var Ee,ge;!function(t){t[t.MAP=1]="MAP",t[t.OBJECT=0]="OBJECT"}(Ee||(Ee={})),function(t){t[t.INIT=0]="INIT",t[t.MAP_LOAD=1]="MAP_LOAD",t[t.OBJ_LOAD=2]="OBJ_LOAD",t[t.MAP_ATTR=3]="MAP_ATTR",t[t.OBJ_ATTR=4]="OBJ_ATTR",t[t.RAND_PARTS=5]="RAND_PARTS",t[t.MESSAGE=6]="MESSAGE"}(ge||(ge={}));class we{constructor(t,e,s){var i,a,r,n,o,h,c,_,l,u,d,p,m,E,g,w,f,v,y,S,A,T,I;this._registry=t,this._canvas=e;const{properties:C}=t;this._posX=null!==(a=null===(i=C.pos)||void 0===i?void 0:i[0])&&void 0!==a?a:0,this._posY=null!==(n=null===(r=C.pos)||void 0===r?void 0:r[1])&&void 0!==n?n:0,[this._imgMainX,this._imgMainY]=we._getImgPosByPicture(this._registry,!0),[this._imgSubX,this._imgSubY]=we._getImgPosByPicture(this._registry,!1),this._drawChip=0!==this._imgMainX||0!==this._imgMainY||0!==this._imgSubX||0!==this._imgSubY,this._repeatX=null!==(h=null===(o=C.repeat)||void 0===o?void 0:o[0])&&void 0!==h?h:1,this._repeatY=null!==(_=null===(c=C.repeat)||void 0===c?void 0:c[1])&&void 0!==_?_:1,this._imgFile=s,this._cropX=this._imgFile?1:null!==(u=null===(l=C.crop)||void 0===l?void 0:l[0])&&void 0!==u?u:1,this._cropY=this._imgFile?1:null!==(p=null===(d=C.crop)||void 0===d?void 0:d[1])&&void 0!==p?p:1,this._totalWidth=(null!==(E=null===(m=C.size)||void 0===m?void 0:m[0])&&void 0!==E?E:this._imgFile?this._imgFile.width:V.CHIP_SIZE)*this._cropX,this._totalHeight=(null!==(w=null===(g=C.size)||void 0===g?void 0:g[1])&&void 0!==w?w:this._imgFile?this._imgFile.height:V.CHIP_SIZE)*this._cropY,this._chipWidth=Math.floor(this._totalWidth/this._cropX),this._chipHeight=Math.floor(this._totalHeight/this._cropY),this._displayStockTime=C.time,this._canvas.ctx.globalAlpha=C.opacity?we._roundPercentage(C.opacity)/100:1,this._canvas.ctx.font=null!==(f=C.font)&&void 0!==f?f:getComputedStyle(dt("wwa-wrapper")).font,C.textAlign&&(this._canvas.ctx.textAlign=we._convertTextAlign(C.textAlign));const P=null!==(y=null===(v=C.color)||void 0===v?void 0:v[0])&&void 0!==y?y:0,D=null!==(A=null===(S=C.color)||void 0===S?void 0:S[1])&&void 0!==A?A:0,N=null!==(I=null===(T=C.color)||void 0===T?void 0:T[2])&&void 0!==I?I:0;this._canvas.ctx.fillStyle=`rgb(${P}, ${D}, ${N})`}get layerNumber(){return this._registry.layerNumber}get cvs(){return this._canvas.cvs}get nextPictureParts(){var t;if(this._registry.properties.next&&void 0!==this._registry.properties.next[0])return{partsNumber:this._registry.properties.next[0],partsType:null!==(t=this._registry.properties.next[1])&&void 0!==t?t:Ee.OBJECT}}get appearParts(){var t;if(this._registry.properties.map&&!(this._registry.properties.map.length<3))return{partsNumber:this._registry.properties.map[0],x:this._registry.properties.map[1],y:this._registry.properties.map[2],partsType:null!==(t=this._registry.properties.map[3])&&void 0!==t?t:Ee.OBJECT}}get executeScriptFunctionName(){return this._registry.properties.script}draw(t,e){const s=e?this._imgMainX:this._imgSubX,i=e?this._imgMainY:this._imgSubY;for(let e=0;e<this._repeatY;e++)for(let a=0;a<this._repeatX;a++){const r=this._posX+this._totalWidth*a,n=this._posY+this._totalHeight*e;if(this._registry.properties.text&&this._canvas.drawFont(this._registry.properties.text,r,n,this._registry.properties.lineHeight),this._imgFile)this._canvas.drawCanvasFree(this._imgFile,r,n,this._totalWidth,this._totalHeight);else if(this._drawChip)for(let e=0;e<this._cropY;e++)for(let a=0;a<this._cropX;a++)this._canvas.drawCanvas(t,s+a,i+e,r+this._chipWidth*a,n+this._chipHeight*e,this._chipWidth,this._chipHeight)}}hasDisplayTimeStock(){return void 0!==this._displayStockTime}decrementDisplayTimeStock(t){return this._displayStockTime-=t}isDeadlineOver(){return this._displayStockTime<=0}clearCanvas(){this._canvas.clear()}getRegistryData(){return this._registry}getTriggerPartsCoord(){return new c(this._registry.triggerPartsX,this._registry.triggerPartsY)}static _getImgPosByPicture(t,e){var s,i;const{properties:a}=t;return void 0!==(null===(s=a.img)||void 0===s?void 0:s[0])&&void 0!==(null===(i=a.img)||void 0===i?void 0:i[1])?e?[a.img[0],a.img[1]]:void 0!==a.img[2]&&void 0!==a.img[3]?[a.img[2],a.img[3]]:[a.img[0],a.img[1]]:e||0===t.imgPosX2&&0===t.imgPosY2?[t.imgPosX,t.imgPosY]:[t.imgPosX2,t.imgPosY2]}static _convertTextAlign(t){if(["center","end","left","right","start"].includes(t))return t;console.warn(`textAlign プロパティで不正な値が検出されました。: ${t}`)}static _roundPercentage(t){return t<0?0:t>100?100:t}}const fe=async t=>fetch(t).then((e=>200===e.status||304===e.status?{kind:"data",data:e}:{kind:"httpError",errorMessage:`ファイル ${t} が読み込めませんでした。ステータスコード: ${e.status}`})).catch((e=>({kind:"connectionError",errorMessage:`ファイル ${t} が読み込めませんでした。通信状態がいい場所で再度お試しください。`}))).then((async t=>"data"===t.kind?{kind:"data",data:await t.data.json()}:t)).catch((e=>({kind:"brokenJson",errorMessage:`ファイル ${t} が壊れています。`})));class ve{constructor(t,e){this._wwa=t,this._pictures=new Map,this._externalImageFiles=new Map,this._frameTimerValue=ve._getNowFrameValue(),this._setupExternalImageFiles(e)}async _setupExternalImageFiles(t){if(!t)return;const e=await fe(t);if(e)if("data"===e.kind)if(e.data&&"object"==typeof e.data){if("files"in e.data){const{files:s}=e.data;"object"==typeof s?Object.entries(e.data.files).forEach((([t,e])=>{this._externalImageFiles.set(t,{status:"loading"});const s=new Image;s.src=e,s.onerror=s=>{"string"==typeof s?alert(`ピクチャ画像ファイル ${e} が見つかりませんでした。エラーメッセージ: ${s}`):alert(`ピクチャ画像ファイル ${e} が見つかりませんでした。`),this._externalImageFiles.set(t,{status:"failed"})},s.onload=()=>{this._externalImageFiles.set(t,{status:"success",element:s})}})):alert(`ピクチャ画像の定義ファイル ${t} の files が正しい形式で書かれていません。`)}}else alert(`ピクチャ画像の定義ファイル ${t} が正しい形式で書かれていません。`);else alert(`ピクチャ画像の定義ファイル ${t} が見つかりませんでした。エラーメッセージ: ${e.errorMessage}`)}static _getNowFrameValue(){return performance.now()}registerPicture(t){const e=new ye(V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,!0),s=Object.keys(t.properties).filter((t=>!Tt.some((({name:e})=>e===t))));if(s.length>0)throw new Error(`不明なプロパティ名 ${s.map((t=>`"${t}"`)).join(", ")} が検出されました。`);let i;if(t.properties.imgFile){const e=this._externalImageFiles.get(t.properties.imgFile);e?"loading"===e.status?console.warn(`ピクチャ画像ファイル ${t.properties.imgFile} はまだ読み込みを完了していません。`):"failed"===e.status?console.warn(`ピクチャ画像ファイル ${t.properties.imgFile} を表示することができません。画像ファイルの Path が間違っていないかご確認ください。`):i=e.element:console.warn(`ピクチャ画像ファイル ${t.properties.imgFile} が定義に含まれていません。定義ファイルがあるかご確認ください。`)}this._pictures.set(t.layerNumber,new we(t,e,i))}registerPictureFromRawRegistry(t,e,s){return this.registerPicture(((t,e)=>{const s=t=>"number"==typeof t?t:le(t,e),i=Object.entries(t.properties).map((([t,e])=>{if(!de(t,e))return[t,e];switch(Tt.find((({name:e})=>e===t)).type){case"number":return[t,s(e)];case"numberArray":return[t,e.map(s)];case"string":if("string"!=typeof e)return[t,e];let i=String(e);return Array.from(e.matchAll(te)).forEach((t=>{t.length<2&&console.warn(`テンプレート文字列で合致した文字列の中の値を取り出すことができませんでした。文字列そのものの値は ${e} です。`);const a=t[0],r=t[1],n=s(r);i=i.replace(a,"number"==typeof n?n.toString():n)})),[t,i];default:return[t,e]}}));return{...t,properties:Object.fromEntries(i)}})(t,this._wwa.generateTokenValues({id:e,type:s,position:new c(t.triggerPartsX,t.triggerPartsY)}))),this.getPictureRegistryData()}registerPictureFromRawText(t,e){const s=(t=>{try{const e=JSON.parse(t.propertiesText);if(Array.isArray(e))throw new Error("配列形式ではなくオブジェクト形式で記述してください。");if("object"!=typeof e)throw new Error("オブジェクト形式で記述してください。");return{...t,properties:e}}catch(t){console.error(`JSON パースエラーが発生しました!: ${t.message}`)}})({imgPosX:0,imgPosY:0,imgPosX2:0,imgPosY2:0,layerNumber:t,triggerPartsX:0,triggerPartsY:0,propertiesText:e});return this.registerPicture(pe(s)),this.getPictureRegistryData()}registerPictureFromObject(t,e){return this.registerPicture(pe({imgPosX:0,imgPosY:0,imgPosX2:0,imgPosY2:0,layerNumber:t,triggerPartsX:0,triggerPartsY:0,properties:e})),this.getPictureRegistryData()}deletePicture(t){if(this._pictures.has(t))return this._pictures.get(t).clearCanvas(),this._pictures.delete(t),this.getPictureRegistryData();console.warn(`${t} 番のピクチャが見つかりませんでした。`)}clearAllPictures(){this._pictures.forEach((t=>{t.clearCanvas()})),this._pictures.clear()}forEachPictures(t){this._pictures.forEach(t)}updatePicturesCache(t,e){this.forEachPictures((s=>{0!==s.layerNumber&&s.clearCanvas(),s.draw(t,e)}))}updateFrameTimerValue(){this._frameTimerValue=ve._getNowFrameValue()}decrementPictureDisplayTimeStock(){const t=ve._getNowFrameValue()-this._frameTimerValue;this.forEachPictures((e=>{if(e.hasDisplayTimeStock()&&(e.decrementDisplayTimeStock(t),e.isDeadlineOver())){const t=e.layerNumber,s=e.nextPictureParts,i=e.appearParts,a=e.executeScriptFunctionName,r=e.getTriggerPartsCoord();this.deletePicture(t),void 0!==s&&this._wwa.setPictureRegistry(t,s.partsNumber,s.partsType,r),void 0!==i&&this._wwa.setPartsOnPosition(i.partsType,i.partsNumber,new c(i.x,i.y)),a&&this._wwa.callUserScript(a)}}))}getPictureRegistryData(){return Array.from(this._pictures.values()).map((t=>t.getRegistryData()))}}class ye{constructor(t,e,s){this.cvs=document.createElement("canvas"),this.cvs.width=t,this.cvs.height=e,this.ctx=this.cvs.getContext("2d",{alpha:s}),this.ctx.imageSmoothingEnabled=!1,this._isTransparent=s}drawCanvas(t,e,s,i,a,r=V.CHIP_SIZE,n=V.CHIP_SIZE){this.ctx.drawImage(t,V.CHIP_SIZE*e,V.CHIP_SIZE*s,V.CHIP_SIZE,V.CHIP_SIZE,i,a,r,n)}drawCanvasFree(t,e,s,i,a){this.ctx.drawImage(t,e,s,i,a)}drawFont(t,e,s,i){if(void 0!==i){t.split("\n").forEach(((t,a)=>{this.ctx.fillText(t,e,s+a*i)}))}else this.ctx.fillText(t,e,s)}clear(){this.clearRect(0,0,this.cvs.width,this.cvs.height)}clearRectWithLowerYLimit(t){this.clearRect(0,0,this.cvs.width,t)}clearRect(t,e,s,i){this._isTransparent?this.ctx.clearRect(t,e,s,i):(this.ctx.fillStyle="#9E9E9E",this.ctx.fillRect(t,e,s,i))}}class Se{_load(){this._frameCoord,this._isLoaded||(this.mapCache=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],this.mapObjectCache=[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],this._image=new Image,this._image.addEventListener("load",(()=>{this.createFrame(),this._loadCompleteCallBack()})),this._image.addEventListener("error",(()=>{throw new Error("Image Load Failed!!\nfile name:"+this._fileName)})),this._image.src=this._fileName,this._isLoaded=!0)}createFrame(){this._frameCanvas.clear(),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y,0,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y,V.MAP_WINDOW_WIDTH-V.CHIP_SIZE,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+2,0,V.MAP_WINDOW_HEIGHT-V.CHIP_SIZE),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+2,V.MAP_WINDOW_WIDTH-V.CHIP_SIZE,V.MAP_WINDOW_HEIGHT-V.CHIP_SIZE);for(var t=1;t<V.H_PARTS_NUM_IN_WINDOW-1;t++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y,V.CHIP_SIZE*t,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y+2,V.CHIP_SIZE*t,V.MAP_WINDOW_HEIGHT-V.CHIP_SIZE);for(t=1;t<V.V_PARTS_NUM_IN_WINDOW-1;t++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+1,0,V.CHIP_SIZE*t),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+1,V.MAP_WINDOW_WIDTH-V.CHIP_SIZE,V.CHIP_SIZE*t)}updateEffects(t){var e;if(t){var s,i=t.length;for(e=0;e<i;e++){var a=t[e];(s=this._effectCanvases[e])?s.clear():s=this._effectCanvases[e]=new ye(V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,!0);for(var r=0;r<V.V_PARTS_NUM_IN_WINDOW;r++)for(var n=0;n<V.H_PARTS_NUM_IN_WINDOW;n++)s.drawCanvas(this._image,a.x,a.y,n*V.CHIP_SIZE,r*V.CHIP_SIZE)}}}updatePictures(t){this.picture.clearAllPictures(),t.forEach((t=>{this.picture.registerPicture(t)}))}updatePicturesCache(t=!0){this.picture.updatePicturesCache(this._image,t)}drawFrame(){this._ctx.drawImage(this._frameCanvas.cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-1),V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE,0,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-1),V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,V.CHIP_SIZE,V.CHIP_SIZE,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-2),0,V.CHIP_SIZE,V.CHIP_SIZE,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-2)),this._ctx.drawImage(this._frameCanvas.cvs,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-1),V.CHIP_SIZE,V.CHIP_SIZE,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-2),V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-1),V.CHIP_SIZE,V.CHIP_SIZE,V.CHIP_SIZE*(V.H_PARTS_NUM_IN_WINDOW-2))}drawEffect(t){var e=this._effectCanvases[t];e&&this._ctx.drawImage(e.cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW)}drawPictures(){this.picture.forEachPictures((t=>{this._ctx.drawImage(t.cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW)}))}drawCanvas(t,e,s,i){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._image,V.CHIP_SIZE*t,V.CHIP_SIZE*e,V.CHIP_SIZE,V.CHIP_SIZE,s,i,V.CHIP_SIZE,V.CHIP_SIZE)}drawCanvasWithSize(t,e,s,i,a,r){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._image,V.CHIP_SIZE*t,V.CHIP_SIZE*e,V.CHIP_SIZE*s,V.CHIP_SIZE*i,a,r,V.CHIP_SIZE*s,V.CHIP_SIZE*i)}drawCanvasWithUpperYLimit(t,e,s,i,a){if(!this._isLoaded)throw new Error("No image was loaded.");var r=Math.max(0,i+V.CHIP_SIZE-a);r>=V.CHIP_SIZE||this._ctx.drawImage(this._image,V.CHIP_SIZE*t,V.CHIP_SIZE*e,V.CHIP_SIZE,V.CHIP_SIZE-r,s,i,V.CHIP_SIZE,V.CHIP_SIZE)}copyCanvas(t,e){return(s,i,a,r,n)=>{if(!this._isLoaded)throw new Error("No image was loaded.");const o=Math.max(0,e(r,n));o>=V.CHIP_SIZE||t.ctx.drawImage(this._image,V.CHIP_SIZE*s,V.CHIP_SIZE*i+o,V.CHIP_SIZE,V.CHIP_SIZE-o,a,r+o,V.CHIP_SIZE,V.CHIP_SIZE)}}copyBackCanvasWithUpperYLimit(t,e,s,i,a){this.copyCanvas(this._backCanvas,((t,e)=>t+V.CHIP_SIZE-e))(t,e,s,i,a)}copyBackCanvasWithLowerYLimit(t,e,s,i,a){this.copyCanvas(this._backCanvas,((t,e)=>e-t))(t,e,s,i,a)}copyObjectCanvasWithUpperYLimit(t,e,s,i,a,r){this.copyCanvas(this._objectCanvases[t],((t,e)=>t+V.CHIP_SIZE-e))(e,s,i,a,r)}copyObjectCanvasWithLowerYLimit(t,e,s,i,a,r){this.copyCanvas(this._objectCanvases[t],((t,e)=>e-t))(e,s,i,a,r)}drawBackCanvas(){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._backCanvas.cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW)}drawObjectCanvas(t){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._objectCanvases[t].cvs,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,0,0,V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW)}clearBackCanvas(){this._backCanvas.clear()}clearBackCanvasWithLowerYLimit(t){this._backCanvas.clearRectWithLowerYLimit(t)}clearObjectCanvases(){var t;for(t=0;t<2;t++)this._objectCanvases[t].clear()}clearObjectCanvasesWithLowerYLimit(t){var e;for(e=0;e<2;e++)this._objectCanvases[e].clearRectWithLowerYLimit(t)}drawCanvasWithLowerYLimit(t,e,s,i,a){if(!this._isLoaded)throw new Error("No image was loaded.");var r=Math.max(0,a-i);r>=V.CHIP_SIZE||this._ctx.drawImage(this._image,V.CHIP_SIZE*t,V.CHIP_SIZE*e+r,V.CHIP_SIZE,V.CHIP_SIZE-r,s,i+r,V.CHIP_SIZE,V.CHIP_SIZE)}clearCanvas(t,e,s,i){this._ctx.clearRect(t,e,s,i)}drawBase(t,e,s,i){this._ctx.fillStyle="#9E9E9E",this._ctx.fillRect(t,e,s,i)}setFrameImage(t){this._frameCoord=t,this.createFrame()}constructor(t,e,s,i,a,r){var n;for(this._isLoaded=!1,this.mapCache=void 0,this.mapObjectCache=void 0,this.mapCacheYLimit=0,this._frameCanvas=new ye(V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,!0),this._backCanvas=new ye(V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,!1),this._objectCanvases=[],this._effectCanvases=[],this.picture=new ve(i,a),n=0;n<2;n++)this._objectCanvases[n]=new ye(V.CHIP_SIZE*V.V_PARTS_NUM_IN_WINDOW,V.CHIP_SIZE*V.H_PARTS_NUM_IN_WINDOW,!0);this._ctx=t,this._fileName=e,this._loadCompleteCallBack=r,this._load(),this._frameCoord=s.clone(),this.cpPartsLog=new c(0,0)}}class Ae{constructor(t){this._position=null,this.reset(t)}setPlayer(t){this._player=t}isResetting(){return this._isResetting}getPosition(){return this._position}getPreviousPosition(){return this._positionPrev}resetPreviousPosition(){this._positionPrev=null}move(t){var e=U[this._player.getSpeedIndex()];this._position=this._position.getNextFramePosition(t,e*(V.H_PARTS_NUM_IN_WINDOW-1),e*(V.V_PARTS_NUM_IN_WINDOW-1))}getTransitionStepNum(){return this._transitionStep}advanceTransitionStepNum(){return++this._transitionStep,this._transitionStep===V.V_PARTS_NUM_IN_WINDOW&&(this._isResetting=!1,this._transitionStep=0),this._transitionStep}isFinalStep(){if(!1===this._isResetting)throw new Error("リセット中ではありません。");return this._transitionStep===V.V_PARTS_NUM_IN_WINDOW-1}reset(t){this._positionPrev=this._position,this._position=t.getDefaultCameraPosition(),this._transitionStep=0,this._isResetting=!0}}class Te{getPosition(){return this._position}constructor(t){this._position=t}}class Ie extends Te{constructor(t){super(t)}}var Ce;!function(t){t[t.CONTROLLABLE=0]="CONTROLLABLE",t[t.MOVING=1]="MOVING",t[t.CAMERA_MOVING=2]="CAMERA_MOVING",t[t.MESSAGE_WAITING=3]="MESSAGE_WAITING",t[t.LOCALGATE_JUMPED=4]="LOCALGATE_JUMPED",t[t.BATTLE=5]="BATTLE",t[t.ESTIMATE_WINDOW_WAITING=6]="ESTIMATE_WINDOW_WAITING",t[t.PASSWORD_WINDOW_WAITING=7]="PASSWORD_WINDOW_WAITING",t[t.LOCALGATE_JUMPED_WITH_MESSAGE=8]="LOCALGATE_JUMPED_WITH_MESSAGE"}(Ce||(Ce={}));class Pe extends Ie{move(){if(this.isControllable())this.controll(this._dir);else if(this._state===Ce.CAMERA_MOVING){try{this._camera.move(this._dir)}catch(t){}this._isOnCameraStopPosition()&&(this._state=Ce.CONTROLLABLE)}else if(this._state===Ce.MOVING){try{var t=this._position.getNextFramePosition(this._dir,U[this._speedIndex],U[this._speedIndex])}catch(t){}t.isJustPosition()&&(this._state=Ce.CONTROLLABLE,this.toggleMovingImage(),this._moves++,this._isPartsEventExecuted=!1,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,this._wwa.callMoveUserDefineFunction()),this._position=t}}controll(t){var e,s;if(this.isControllable()){this._isPreparedForLookingAround=!1,this._dir=t;try{e=this._position.getNextFramePosition(this._dir,U[this._speedIndex],U[this._speedIndex]),s=this._position.getNextJustPosition(t)}catch(t){return}if(this._isOnCameraMovingPosition()){if(0!==this._wwa.getMapIdByPosition(s)||this._wwa.isOldMap()||this._wwa.debug)try{this._camera.move(this._dir),this._state=Ce.CAMERA_MOVING}catch(t){this._state=Ce.CONTROLLABLE}return}if(!this.canMoveTo(s))return this._wwa.getMapTypeByPosition(s)===V.MAP_WALL&&this._wwa.checkMap(s.getPartsCoord()),void this._wwa.checkObject(s.getPartsCoord());this._position=e,this._state=Ce.MOVING,this._wwa.getMapAttributeByPosition(this._position.getNextJustPosition(t),V.ATR_TYPE)!==V.MAP_LOCALGATE&&this._wwa.moveObjects(!0)}}setDir(t){this._isPreparedForLookingAround=!1,this._dir=t}canMoveTo(t){if(null===t)return!1;if(this._wwa.debug)return!0;this._wwa.getMapWidth(),t.getPartsCoord(),t.getOffsetCoord();return!(0===this._wwa.getMapIdByPosition(t)&&!this._wwa.isOldMap())&&(this._wwa.getMapTypeByPosition(t)!==V.MAP_WALL&&(0===this._wwa.getObjectIdByPosition(t)||(this._wwa.getObjectTypeByPosition(t)===V.OBJECT_NORMAL&&this._wwa.getObjectAttributeByPosition(t,V.ATR_MODE)===V.PASSABLE_OBJECT||this._wwa.getObjectTypeByPosition(t)===V.OBJECT_DOOR&&this._wwa.getObjectAttributeByPosition(t,V.ATR_NUMBER)===V.PASSABLE_OBJECT&&!this.hasItem(this._wwa.getObjectAttributeByPosition(t,V.ATR_ITEM)))))}isMoving(){return this._state==Ce.MOVING||this._state==Ce.CAMERA_MOVING}_isOnCameraMovingPosition(){var t=this._camera.getPosition().getPartsCoord(),e=this.getPosition().getPartsCoord();return e.x-t.x==V.H_PARTS_NUM_IN_WINDOW-1&&this._dir===p.RIGHT||e.x===t.x&&this._dir===p.LEFT||e.y-t.y==V.V_PARTS_NUM_IN_WINDOW-1&&this._dir===p.DOWN||e.y===t.y&&this._dir===p.UP}_isOnCameraStopPosition(){var t=this._camera.getPosition().getPartsCoord(),e=this.getPosition().getPartsCoord();return e.x-t.x==V.H_PARTS_NUM_IN_WINDOW-1&&this._dir===p.LEFT||e.x===t.x&&this._dir===p.RIGHT||e.y-t.y==V.V_PARTS_NUM_IN_WINDOW-1&&this._dir===p.UP||e.y===t.y&&this._dir===p.DOWN}isControllable(){var t=this._afterMoveMacroFlag;return this._afterMoveMacroFlag=!1,this._state===Ce.CONTROLLABLE&&!this._partsAppeared&&(this._wwa.getMapTypeByPosition(this._position)!==V.MAP_LOCALGATE&&this._wwa.getMapTypeByPosition(this._position)!==V.MAP_URLGATE||!this._wwa.isPrevFrameEventExecuted())&&0===this._moveMacroWaitingRemainMoves&&0===this._moveObjectAutoExecTimer&&!t&&this._wwa.canInput()}getCopyOfItemBox(){return this._itemBox.slice()}getDir(){return this._dir}isMovingImage(){return this._isMovingImage}toggleMovingImage(){this._isMovingImage?this._isMovingImage=!1:this._isMovingImage=!0}getEnergyMax(){return this._energyMax}isJumped(){return this._state===Ce.LOCALGATE_JUMPED||this._state===Ce.LOCALGATE_JUMPED_WITH_MESSAGE}setMessageWaiting(){this._state=Ce.MESSAGE_WAITING}isWaitingMessage(){return this._state===Ce.MESSAGE_WAITING}isDelayFrame(){return this._messageDelayFrameCount>0}updateDelayFrame(){this._messageDelayFrameCount--}setDelayFrame(){this._messageDelayFrameCount=1}clearMessageWaiting(){this._state!==Ce.MESSAGE_WAITING&&this._state!==Ce.LOCALGATE_JUMPED_WITH_MESSAGE||(this._state===Ce.MESSAGE_WAITING?this._state=Ce.CONTROLLABLE:this._state===Ce.LOCALGATE_JUMPED_WITH_MESSAGE&&(this._state=Ce.LOCALGATE_JUMPED),this._isPartsEventExecuted=!0,this._isPreparedForLookingAround&&(this._lookingAroundTimer=V.PLAYER_LOOKING_AROUND_START_FRAME))}setEstimateWindowWating(){this._state=Ce.ESTIMATE_WINDOW_WAITING}isWaitingEstimateWindow(){return this._state===Ce.ESTIMATE_WINDOW_WAITING}clearEstimateWindowWaiting(){this._state===Ce.ESTIMATE_WINDOW_WAITING&&(this._state=Ce.CONTROLLABLE)}setPasswordWindowWating(){this._state=Ce.PASSWORD_WINDOW_WAITING}isWaitingPasswordWindow(){return this._state===Ce.PASSWORD_WINDOW_WAITING}clearPasswordWindowWaiting(){this._state===Ce.PASSWORD_WINDOW_WAITING&&(this._state=Ce.CONTROLLABLE)}isPartsEventExecuted(){return this._isPartsEventExecuted}resetEventExecutionInfo(){this._isPartsEventExecuted=!1}getLastExecPartsIDOnSamePosition(t){return t===v.MAP?this._samePosLastExecutedMapID:this._samePosLastExecutedObjID}setLastExecInfoOnSamePosition(t,e){t===v.MAP?this._samePosLastExecutedMapID=e:this._samePosLastExecutedObjID=e}processAfterJump(){this._state!==Ce.LOCALGATE_JUMPED&&this._state!==Ce.LOCALGATE_JUMPED_WITH_MESSAGE||0==--this._jumpWaitFramesRemain&&(this._state=this._state===Ce.LOCALGATE_JUMPED?Ce.CONTROLLABLE:Ce.MESSAGE_WAITING)}jumpTo(t){var e=this._camera.getPosition();this.getPosition();return!this._position.equals(t)&&(this._position=t,t.isInCameraRange(this._camera,!0)||this._camera.reset(t),this._state=this._state===Ce.MESSAGE_WAITING?Ce.LOCALGATE_JUMPED_WITH_MESSAGE:Ce.LOCALGATE_JUMPED,this._jumpWaitFramesRemain=V.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,t.hasLocalGate()?this._dir=p.DOWN:t.getPartsCoord().y<=this._wwa.getMapWidth()-2&&t.getNextJustPosition(p.DOWN).hasLocalGate()?this._dir=p.UP:t.getPartsCoord().y>=1&&t.getNextJustPosition(p.UP).hasLocalGate()?this._dir=p.DOWN:t.getPartsCoord().x<=this._wwa.getMapWidth()-2&&t.getNextJustPosition(p.RIGHT).hasLocalGate()?this._dir=p.LEFT:t.getPartsCoord().x>=1&&t.getNextJustPosition(p.LEFT).hasLocalGate()?this._dir=p.RIGHT:this._dir=p.DOWN,this._camera.getPosition().equals(e)||(this._isPreparedForLookingAround=!0,this._lookingAroundTimer=V.PLAYER_LOOKING_AROUND_START_FRAME),this._wwa.callJumpGateUserDefineFunction(),!0)}systemJumpTo(t){this._position=t,this._camera.reset(t),this._camera.resetPreviousPosition(),this._state=Ce.LOCALGATE_JUMPED,this._jumpWaitFramesRemain=V.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,this._dir=p.DOWN,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=V.PLAYER_LOOKING_AROUND_START_FRAME}addStatusAll(t){return this._status.add(t),this.isDead()&&(this._status.energy=0),0!==this._energyMax&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),this._status}setEnergyMax(t){return this._energyMax=t,0!==t&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),t}setEnergy(t){return this._status.energy=t,this.isDead()&&(this._status.energy=0),0!==this._energyMax&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox(),t}damage(t){this._status.energy=Math.max(0,this._status.energy-t),this.isDead()&&(this._status.energy=0),0!==this._energyMax&&(this._status.energy=Math.min(this._status.energy,this._energyMax)),this.updateStatusValueBox()}setStrength(t){return this._status.strength=t,this.updateStatusValueBox(),t}setDefence(t){return this._status.defence=t,this.updateStatusValueBox(),t}setGold(t){return this._status.gold=t,this.updateStatusValueBox(),t}getStatus(){return this._status.plus(this._equipStatus)}getStatusWithoutEquipments(){return this._status.plus(new o(0,0))}getStatusOfEquipments(){return this._equipStatus.plus(new o(0,0))}updateStatusValueBox(){var t;const e=this._status.plus(this._equipStatus);this._energyValueElement.textContent=this._wwa.isVisibleStatus("energy")?String(e.energy):"",this._strengthValueElement.textContent=this._wwa.isVisibleStatus("strength")?String(e.strength):"",this._defenceValueElement.textContent=this._wwa.isVisibleStatus("defence")?String(e.defence):"",this._goldValueElement.textContent=this._wwa.isVisibleStatus("gold")?String(e.gold):"",null===(t=this._wwa._messageWindow)||void 0===t||t.update(),this._wwa.updateScore()}updateItemBox(t){for(let e=0;e<this._itemBoxElement.length;e++){const s=this._itemBoxElement[e],i=mt("#item"+e);if(0===this._itemBox[e]){s.style.backgroundPosition="-40px 0px",this.disposeItemEffect(e,this._itemBoxElement[e],i);continue}const a=this._wwa.getObjectCropXById(this._itemBox[e]),r=this._wwa.getObjectCropYById(this._itemBox[e]);if(!t||e!==t.insertPos-1){s.style.backgroundPosition="-"+a+"px -"+r+"px",this.disposeItemEffect(e,this._itemBoxElement[e],i);continue}const n=t.itemScreenPixelCoord.x-t.itemBoxScreenPixelCoord.x,o=t.itemScreenPixelCoord.y-t.itemBoxScreenPixelCoord.y,h=-n*V.DEFAULT_FRAME_INTERVAL/V.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME,c=0===t.overwrittenObjectId||void 0===t.overwrittenObjectId,_=c?t.itemBoxBackgroundImageCoord.x:this._wwa.getObjectCropXById(t.overwrittenObjectId),l=c?t.itemBoxBackgroundImageCoord.y:this._wwa.getObjectCropYById(t.overwrittenObjectId);s.style.left=n+"px",s.style.top=o+"px","number"==typeof this.itemEffectStartTimers[e]&&clearInterval(this.itemEffectStartTimers[e]),this.itemEffectStartTimers[e]=window.setTimeout((()=>{this.itemEffectStartTimers[e]=void 0,this.startItemEffect(e,s,i,{target:{x:a,y:r},overwritten:{x:_,y:l}},h)}),V.DEFAULT_FRAME_INTERVAL)}}startItemEffect(t,e,s,i,a){const r=s.querySelector(this.overwittenItemSelector);r&&s.removeChild(r);const n=document.createElement("div");n.classList.add(this.overwittenItemClassName),n.style.backgroundPosition="-"+i.overwritten.x+"px -"+i.overwritten.y+"px",n.style.backgroundImage=s.style.backgroundImage,s.appendChild(n),e.style.backgroundPosition="-"+i.target.x+"px -"+i.target.y+"px",e.style.transitionDuration=a+"ms",e.style.transitionProperty="left,top",e.style.transitionTimingFunction="linear",e.style.left="0",e.style.top="0",s.classList.add(this.itemTransitioningClassName),e.addEventListener("transitionend",(()=>{this.disposeItemEffect(t,e,s)}),{once:!0})}disposeItemEffect(t,e,s){"number"==typeof this.itemEffectStartTimers[t]&&(clearInterval(this.itemEffectStartTimers[t]),this.itemEffectStartTimers[t]=void 0),e.style.transitionDuration="0s",e.style.transitionProperty="",e.style.left="0",e.style.top="0",s.classList.contains(this.itemTransitioningClassName)&&s.classList.remove(this.itemTransitioningClassName);const i=s.querySelector(this.overwittenItemSelector);i&&s.removeChild(i)}isDead(){return this._status.energy<=0}addItem(t,e=0,s=!1,i){var a,r,n,o=this._wwa.getObjectAttributeById(t,V.ATR_NUMBER),h=0;if(0===e&&0!==o&&(e=o),0===e){if(0===t)return;if((a=this._getBlankItemPos())===V.ITEMBOX_IS_FULL)throw this._wwa.setEvalCalcWwaNodeEarnedItem(t,-1),this._wwa.callGetItemFullUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),new Error("これ以上、アイテムを持てません。");h=this._itemBox[a-1],this._forceSetItemBox(a,t)}else if(!1===s)if(a=e,n=this._itemBox[a-1],this._wwa.getObjectAttributeById(n,V.ATR_NUMBER)!==this._wwa.getObjectAttributeById(t,V.ATR_NUMBER)){if((r=this._getBlankItemPos())===V.ITEMBOX_IS_FULL)throw this._wwa.setEvalCalcWwaNodeEarnedItem(t,-1),this._wwa.callGetItemFullUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),new Error("これ以上、アイテムを持てません。");this._forceSetItemBox(r,n),this._forceSetItemBox(a,t)}else h=this._itemBox[a-1],this._forceSetItemBox(a,t);else a=e,h=this._itemBox[a-1],this._forceSetItemBox(a,t);this._updateEquipmentStatus(),this.updateItemBox(i?{insertPos:a,itemScreenPixelCoord:i.screenPixelCoord,itemBoxBackgroundImageCoord:i.itemBoxBackgroundImageCoord,itemBoxScreenPixelCoord:new c(V.MAP_WINDOW_WIDTH+(a-1)%3*V.CHIP_SIZE,V.ITEMBOX_TOP_Y+Math.floor((a-1)/3)*V.CHIP_SIZE),overwrittenObjectId:h}:void 0)}_forceSetItemBox(t,e){var s=this,a=Et("#item"+(t-1)+">.item-click-border"),r=this._wwa.getObjectAttributeById(e,V.ATR_MODE);if(this.removeItemByItemPosition(t),this._itemBox[t-1]=e,this._wwa.setEvalCalcWwaNodeEarnedItem(e,t),this._wwa.callGetItemUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),0!==e&&r!==f.NORMAL){const e=this._wwa.resolveSystemMessage(i.ITEM_SELECT_TUTORIAL);this._isClickableItemGot||("BLANK"!==e&&this._wwa.generatePageAndReserveExecution(e,!1,!0),this._isClickableItemGot=!0),a.style.display="block",(t=>{s._itemUsingEvent[t-1]=()=>{(s.isControllable()||s._wwa._messageWindow.isItemMenuChoice())&&(s._wwa._itemMenu.close(),s._wwa._setNextPage(),s._wwa.onselectitem(t))}})(t),a.addEventListener("click",this._itemUsingEvent[t-1])}}_getBlankItemPos(){var t;for(t=1;t<this._itemBox.length+1;t++)if(0===this._itemBox[t-1])return t;return V.ITEMBOX_IS_FULL}_updateEquipmentStatus(){var t,e=new o(0,0);for(t=0;t<V.ITEMBOX_SIZE;t++)0!==this._itemBox[t]&&(e.strength+=this._wwa.getObjectAttributeById(this._itemBox[t],V.ATR_STRENGTH),e.defence+=this._wwa.getObjectAttributeById(this._itemBox[t],V.ATR_DEFENCE));var s=e.minus(this._equipStatus);this._wwa.setStatusChangedEffect(s),this._equipStatus=e,this.updateStatusValueBox()}hasItem(t){for(var e=0;e<V.ITEMBOX_SIZE;e++)if(this._itemBox[e]===t)return!0;return!1}canUseItem(t){var e=this._itemBox[t-1];return 0!==e&&this._wwa.getObjectAttributeById(e,V.ATR_MODE)!==f.NORMAL}useItem(){var t;t=this._itemBox[this._readyToUseItemPos-1],this._wwa.getObjectAttributeById(t,V.ATR_MODE)!==f.NOT_DISAPPEAR&&this.removeItemByItemPosition(this._readyToUseItemPos);var e=dt("item"+(this._readyToUseItemPos-1));return setTimeout((()=>{e.classList.contains("onpress")&&e.classList.remove("onpress")}),V.DEFAULT_FRAME_INTERVAL),this._wwa.setEvalCalcWwaNodeEarnedItem(t,this._readyToUseItemPos-1),this._wwa.callUseItemUserDefineFunction(),this._wwa.clearEvalCalcWwaNodeEarnedItem(),this._isReadyToUseItem=!1,this._readyToUseItemPos=void 0,t}canHaveMoreItems(){return this._getBlankItemPos()!==V.ITEMBOX_IS_FULL}removeItemByItemPosition(t){var e;0!==this._itemBox[t-1]&&(this._wwa.getObjectAttributeById(this._itemBox[t-1],V.ATR_MODE)!==f.NORMAL&&((e=Et("#item"+(t-1)+">.item-click-border")).removeEventListener("click",this._itemUsingEvent[t-1]),e.style.display="none"),this._itemBox[t-1]=0,this._updateEquipmentStatus(),this.updateItemBox())}removeItemByPartsID(t){var e;if(!this.hasItem(t))throw new Error("アイテムを持っていない");for(var s=0;s<V.ITEMBOX_SIZE;s++)if(this._itemBox[s]===t)return this._wwa.getObjectAttributeById(this._itemBox[s],V.ATR_MODE)!==f.NORMAL&&((e=Et("#item"+s+">.item-click-border")).removeEventListener("click",this._itemUsingEvent[s]),e.style.display="none"),this._itemBox[s]=0,this._updateEquipmentStatus(),void this.updateItemBox()}clearItemBox(){for(var t=1;t<=V.ITEMBOX_SIZE;t++)this.removeItemByItemPosition(t);this._updateEquipmentStatus(),this.updateItemBox()}hasGold(t){return this._status.gold>=t}payGold(t){if(!this.hasGold(t))throw new Error("お金が足りない");this.setGold(this._status.gold-t)}earnGold(t){this.setGold(this._status.gold+t)}setPartsAppearedFlag(){this._partsAppeared=!0}clearPartsAppearedFlag(){this._partsAppeared=!1}isPartsAppearedTime(){return!0===this._partsAppeared}startBattleWith(t){this._isPlayerTurn=!0,this._battleFrameCounter=V.BATTLE_INTERVAL_FRAME_NUM,this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=t,this._state=Ce.BATTLE}isFighting(){return this._state===Ce.BATTLE}isTurn(){return this._isPlayerTurn}getTurnNum(){return this._battleTurnLength}isBattleStartFrame(){return this._battleFrameCounter===V.BATTLE_INTERVAL_FRAME_NUM&&0===this._battleTurnLength}calcBattleResultForPlayerTurn(t,e,s=!1){const i=this._wwa.callUserDefinedBattleDamageFunction("playerToEnemy",s?{playerStatus:t,enemyStatus:e}:void 0);return i||{damage:this._calcDamageDefault(t,e)}}calcBattleResultForEnemyTurn(t,e,s=!1){const i=this._wwa.callUserDefinedBattleDamageFunction("enemyToPlayer",s?{playerStatus:e,enemyStatus:t}:void 0);return i||{damage:this._calcDamageDefault(t,e)}}_calcDamageDefault(t,e){const s=t.strength-e.defence;return s>0?s:0}fight(){if(!this.isFighting())throw new Error("バトルが開始されていません。");if(0===this._battleTurnLength&&this._battleFrameCounter===V.BATTLE_INTERVAL_FRAME_NUM&&this._wwa.showMonsterWindow(),--this._battleFrameCounter>0)return;this._battleTurnLength++,this._wwa.isBattleSpeedIndexForQuickBattle(this._speedIndex)||this._battleTurnLength>V.BATTLE_SPEED_CHANGE_TURN_NUM?(1===this._battleTurnLength&&(this._wwa.playSound(R.ATTACK),this._wwa.vibration(!1)),this._battleFrameCounter=1):(this._battleFrameCounter=V.BATTLE_INTERVAL_FRAME_NUM,this._wwa.playSound(R.ATTACK),this._wwa.vibration(!0));var t=this.getStatus(),e=this._enemy.status;let s=!1;if(this._isPlayerTurn){if(1===this._battleTurnLength&&this._wwa.isUsingDefaultDamageCalcFunction()&&t.strength<=e.defence&&t.defence>=e.strength){this._enemy.battleEndProcess();const t=this._wwa.resolveSystemMessage(i.CANNOT_DAMAGE_MONSTER);return"BLANK"!==t&&this._wwa.generatePageAndReserveExecution(t,!1,!0),this._battleTurnLength=0,this._enemy=null,void(this._state=Ce.CONTROLLABLE)}const{damage:a,aborted:r}=this.calcBattleResultForPlayerTurn(t,e);this._enemy.damage(a),s=Boolean(r),this._enemy.status.energy<=0&&(this._wwa.playSound(this._wwa.getObjectAttributeById(this._enemy.partsID,V.ATR_SOUND)),this.earnGold(e.gold),this._wwa.setStatusChangedEffect(new h(0,0,0,e.gold)),0!==this._enemy.item?this._wwa.setPartsOnPosition(v.OBJECT,this._enemy.item,this._enemy.position):this._wwa.setPartsOnPosition(v.OBJECT,0,this._enemy.position),this._wwa.reserveAppearPartsInNextFrame(this._enemy.position,w.OBJECT,this._enemy.partsID),this._state=Ce.CONTROLLABLE,this._wwa.generatePageAndReserveExecution(this._enemy.message,!1,!1,this._enemy.partsID,v.OBJECT,this._enemy.position),this._enemy.battleEndProcess(),this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null),null!==this._enemy&&(0===a?this._battleNoDamageTurnLength++:this._battleNoDamageTurnLength=0),this._isPlayerTurn=!1}else{const{damage:i,aborted:a}=this.calcBattleResultForEnemyTurn(e,t);this.damage(i),s=Boolean(a),this._status.energy<=0&&(this.setEnergy(0),this._enemy.battleEndProcess(),this._state=Ce.CONTROLLABLE,this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null,this._wwa.shouldApplyGameOver({isCalledByMacro:!1})&&this._wwa.gameover()),0===i?this._battleNoDamageTurnLength++:this._battleNoDamageTurnLength=0,this._isPlayerTurn=!0}if(this._battleNoDamageTurnLength>V.FIGHT_DRAW_TURN||s){this._enemy.battleEndProcess();const t=this._wwa.resolveSystemMessage(i.BATTLE_NOT_SETTLED);"BLANK"!==t&&this._wwa.generatePageAndReserveExecution(t,!1,!0),this._battleTurnLength=0,this._battleNoDamageTurnLength=0,this._enemy=null}}readyToUseItem(t){var e;if(!this.canUseItem(t))throw new Error("アイテムがないか、アイテムが使えません。");e=this._itemBox[t-1],this._wwa.getObjectAttributeById(e,V.ATR_STRING),this._wwa.reserveAppearPartsInNextFrame(this._position.getPartsCoord(),w.OBJECT,e),this._readyToUseItemPos=t,this._isReadyToUseItem=!0}isReadyToUseItem(){return this._isReadyToUseItem}getDrawingCenterPosition(){var t=this._position.getPartsCoord(),e=this._position.getOffsetCoord(),s=this._camera.getPosition(),i=s.getPartsCoord(),a=s.getOffsetCoord(),r=(t.x-i.x)*V.CHIP_SIZE+e.x-a.x+V.CHIP_SIZE/2,n=(t.y-i.y)*V.CHIP_SIZE+e.y-a.y+V.CHIP_SIZE/2;return new c(r,n)}mainFrameCount(){this._frameCount++}getFrameCount(){return this._frameCount}setFrameCount(t){return"number"!=typeof t&&(t=0),this._frameCount=t}getMoveCount(){return this._moves}setMoveCount(t){return this._moves=t}isMoveObjectAutoExecTime(){return 0===this._moveObjectAutoExecTimer}setMoveMacroWaiting(t){t<0||(this._moveMacroWaitingRemainMoves=t,this._moveObjectAutoExecTimer=0)}resetMoveObjectAutoExecTimer(){this._moveObjectAutoExecTimer=V.CHIP_SIZE/U[this._speedIndex],this._moveMacroWaitingRemainMoves--}decrementMoveObjectAutoExecTimer(){return this._moveMacroWaitingRemainMoves>=0&&this._moveObjectAutoExecTimer>0&&(this._moveObjectAutoExecTimer--,0===this._moveMacroWaitingRemainMoves&&0===this._moveObjectAutoExecTimer&&(this._afterMoveMacroFlag=!0)),0}isWaitingMoveMacro(){return 0!==this._moveMacroWaitingRemainMoves||0!==this._moveObjectAutoExecTimer}decrementLookingAroundTimer(){return this._isPreparedForLookingAround&&this._lookingAroundTimer>0?--this._lookingAroundTimer:0}isLookingAround(){return this._isPreparedForLookingAround&&0===this._lookingAroundTimer}getSpeedIndex(){return this._speedIndex}speedUp(){return this._speedIndex=Math.min(V.MAX_SPEED_INDEX,this._speedIndex+1)}speedDown(){return this._speedIndex=Math.max(V.MIN_SPEED_INDEX,this._speedIndex-1)}setSpeedIndex(t){if(t<V.MIN_SPEED_INDEX||V.MAX_SPEED_INDEX<t)throw new Error("#set_speed の引数が異常です:"+t);return this._speedIndex=t,this._speedIndex}constructor(t,e,s,i,a,r,n){super(e),this.itemTransitioningClassName="item-transitioning",this.overwittenItemClassName="item-overwritten",this.overwittenItemSelector=`.${this.overwittenItemClassName}`,this.itemEffectStartTimers=new Array(V.ITEMBOX_SIZE),this._status=i,this._equipStatus=new o(0,0),this._itemBox=new Array(V.ITEMBOX_SIZE),this._itemBoxElement=new Array(V.ITEMBOX_SIZE),this._itemUsingEvent=new Array(V.ITEMBOX_SIZE);for(var h=0;h<this._itemBox.length;h++)this._itemBox[h]=0,this._itemBoxElement[h]=Et("#item"+h+">.item-disp");this.updateItemBox(),this._energyMax=a,this._dir=p.DOWN,this._isMovingImage=!1,this._wwa=t,this._state=Ce.CONTROLLABLE,this._camera=s,this._isPartsEventExecuted=!1,this._energyValueElement=Et("#disp-energy>.status-value-box"),this._strengthValueElement=Et("#disp-strength>.status-value-box"),this._defenceValueElement=Et("#disp-defence>.status-value-box"),this._goldValueElement=Et("#disp-gold>.status-value-box"),this._isReadyToUseItem=!1,this._isClickableItemGot=!1,this._moves=r,this._moveMacroWaitingRemainMoves=0,this._moveObjectAutoExecTimer=0,this.updateStatusValueBox(),this._partsAppeared=!1,this._afterMoveMacroFlag=!1,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=V.PLAYER_LOOKING_AROUND_START_FRAME,this._speedIndex=n,this._messageDelayFrameCount=0,this._battleNoDamageTurnLength=0}}class De{constructor(t,e,s,i,a,r,n){this._partsID=t,this._position=e,this._imgCoord=s,this._status=i,this._message=a,this._item=r,this._battleEndCallback=n}get partsID(){return this._partsID}get position(){return this._position}get imgCoord(){return this._imgCoord}get status(){return this._status}get message(){return this._message}get item(){return this._item}damage(t){this._status.energy=Math.max(0,this._status.energy-t)}battleEndProcess(){var t;null===(t=this._battleEndCallback)||void 0===t||t.call(this)}setStatus(t){null!==t.energy&&(this._status.energy=t.energy),null!==t.strength&&(this._status.strength=t.strength),null!==t.defence&&(this._status.defence=t.defence)}clone(){return new De(this._partsID,this._position.clone(),this._imgCoord.clone(),this._status.clone(),this._message,this._item,this._battleEndCallback)}}class Ne{constructor(t,e,s,i,a){this._player=t,this._objectID=e,this._srcPos=s,this._destPos=i,this._dir=a,this._currentPos=this._srcPos.clone()}update(){var t=this._player.getSpeedIndex();return this._currentPos=this._currentPos.getNextFramePosition(this._dir,U[t],U[t]),this._currentPos}get isAchievedDestination(){return this._currentPos.equals(this._destPos)}get currentPosition(){return this._currentPos}get beforePosition(){return this._srcPos}get destination(){return this._destPos}get objID(){return this._objectID}}class Oe{constructor(t,e){this._wwa=t,this._player=e,this.clear()}add(t,e,s,i){this._queue.push(new Ne(this._player,t,e,s,i))}update(){for(var t=[],e=[],s=0;s<this._queue.length;s++)this._queue[s].update(),this._queue[s].isAchievedDestination?(t.push(this._queue[s]),this._wwa.setPartsOnPosition(v.OBJECT,0,this._queue[s].beforePosition.getPartsCoord()),this._wwa.setPartsOnPosition(v.OBJECT,this._queue[s].objID,this._queue[s].destination.getPartsCoord())):e.push(this._queue[s]);return this._queue=e,t}clear(){this._queue=[]}get objectMovingData(){return this.objectMovingData}getOffsetByBeforePartsCoord(t){var e=this._queue.filter((e=>e.beforePosition.getPartsCoord().equals(t)));return 0===e.length?null:e[0].currentPosition.getOffsetCoord()}}class be{constructor(t,e,s,i,a,r){this.firstNode=t,this.isLastPage=e,this.showChoice=s,this.isSystemMessage=i,this.scoreOptions=a,this.extraInfo=r}}class Me{constructor(){}}class xe extends Me{constructor(t=[]){super(),this.branches=t}appendBranch(t){this.branches.push(t)}getLastUnconnectedBranch(){for(let t of this.branches)if(!t.next)return t}evaluateAndGetNextNode(t){for(let e of this.branches)if(!e.descriminant||re(e.descriminant,t()))return e.next}hasElseBranch(){return this.branches.filter((t=>Boolean(t.elseBranch))).length>=1}}class Le extends Me{constructor(t,e,s){super(),this.macro=e,this.next=s,this.messageSegments=this.parseMessage(t),void 0===this.macro&&(this.macro=[])}isEmpty(){return this.messageSegments.reduce(((t,e)=>t&&""===e),!0)}generatePrintableMessage(){return this.messageSegments.reduce(((t,e)=>`${t}${"string"==typeof e?e:e()}`),"")}appendMessage(t,e=!1){this.messageSegments=this.messageSegments.concat(e?["\n"]:[],this.parseMessage(t))}parseMessage(t){return"string"==typeof t?[t]:t}}function Re(t){return void 0===t||(t instanceof xe?t.branches.reduce(((t,e)=>t&&Re(e.next)),!0):t instanceof Le?t.isEmpty()&&Re(t.next):void 0)}const Be=t=>t===b.SHOW_STR||t===b.SHOW_STR2||"text"===t||"normalMacro"===t;class Ue{constructor(t,e,s,i,a,r){this._wwa=t,this._triggerPartsID=e,this._triggerPartsType=s,this._triggerPartsPosition=i,this.macroType=a,this.macroArgs=r}isJunction(){return[b.IF,b.ELSE_IF,b.ELSE,b.END_IF].includes(this.macroType)}execute(){try{switch(this.macroType){case b.IMGPLAYER:return this._executeImgPlayerMacro(),{};case b.IMGYESNO:return this._executeImgYesNoMacro(),{};case b.HPMAX:return this._executeHPMaxMacro(),{};case b.SAVE:return this._executeSaveMacro(),{};case b.ITEM:return this._executeItemMacro(),{};case b.DEFAULT:return this._executeDefaultMacro(),{};case b.OLDMAP:return this._executeOldMapMacro(),{};case b.PARTS:return this._executePartsMacro(),{};case b.MOVE:return this._executeMoveMacro(),{};case b.MAP:return this._executeMapMacro(1),{};case b.DIRMAP:return this._executeDirMapMacro(),{};case b.IMGFRAME:return this._executeImgFrameMacro(),{};case b.IMGBOM:return this._executeImgBomMacro(),{};case b.DELPLAYER:return this._executeDelPlayerMacro(),{};case b.FACE:return this._executeFaceMacro(),{};case b.EFFECT:return this._executeEffectMacro(),{};case b.GAMEOVER:return this._executeGameOverMacro(),{};case b.IMGCLICK:return this._executeImgClickMacro(),{};case b.STATUS:{const{isGameOver:t}=this._executeStatusMacro();return{isGameOver:t}}case b.EFFITEM:return this._executeEffItemMacro(),{};case b.COLOR:return this._executeColorMacro(),{};case b.WAIT:return this._executeWaitMacro(),{};case b.SOUND:return this._executeSoundMacro(),{};case b.GAMEPAD_BUTTON:return this._executeGamePadButtonMacro(),{};case b.OLDMOVE:return this._executeOldMoveMacro(),{};case b.JUMPGATE:return this._executeJumpGateMacro(),{};case b.RECPOSITION:return this._executeRecPositionMacro(),{};case b.JUMPRECPOSITION:return this._executeJumpRecPositionMacro(),{};case b.CONSOLE_LOG:return this._executeConsoleLogMacro(1),{};case b.COPY_HP_TO:return this._executeCopyHpToMacro(),{};case b.SET_HP:{const{isGameOver:t}=this._executeSetHPMacro();return{isGameOver:t}}case b.COPY_HPMAX_TO:return this._executeCopyHpMaxToMacro(),{};case b.SET_HPMAX:return this._executeSetHpMaxMacro(),{};case b.COPY_AT_TO:return this._executeCopyAtToMacro(),{};case b.SET_AT:return this._executeSetAtMacro(),{};case b.COPY_DF_TO:return this._executeCopyDfToMacro(),{};case b.SET_DF:return this._executeSetDfMacro(),{};case b.COPY_MONEY_TO:return this._executeCopyMoneyToMacro(),{};case b.SET_MONEY:return this._executeSetMoneyMacro(),{};case b.COPY_STEP_COUNT_TO:return this._executeSetStepCountMacro(),{};case b.VAR_SET_VAL:return this._executeVarSetValMacro(),{};case b.VAR_SET:return this._executeVarSetMacro(),{};case b.VAR_ADD:return this._executeVarAddMacro(),{};case b.VAR_SUB:return this._executeVarSubMacro(),{};case b.VAR_MUL:return this._executeVarMulMacro(),{};case b.VAR_DIV:return this._executeVarDivMacro(),{};case b.VAR_MOD:return this._executeVarModMacro(),{};case b.VAR_SET_RAND:return this._executeVarSetRandMacro(),{};case b.GAME_SPEED:return this._executeGameSpeedMacro(),{};case b.SHOW_STR:case b.SHOW_STR2:case b.IF:return{};case b.LEGACY_IF:return this._executeLegacyIfMacro(),{};case b.ELSE_IF:case b.ELSE:case b.END_IF:return{};case b.SET_SPEED:return this._executeSetSpeedMacro(),{};case b.COPY_TIME_TO:return this._executeCopyTimeToMacro(),{};case b.HIDE_STATUS:return this._executeHideStatusMacro(),{};case b.VAR_MAP:return this._executeVarMapMacro(),{};case b.NO_GAMEOVER:return this._executeNoGameOverMacro(),{};case b.SET:{const{isGameOver:t}=this._executeSetMacro();return{isGameOver:t}}case b.MAP2:return this._executeMapMacro(2),{};case b.CONSOLE_LOG2:return this._executeConsoleLogMacro(2),{};case b.DELAYBGM:return this._executeDelayBgmMacro(),{};case b.SYSMSG:return this._executeSysMsgMacro(),{};case b.PICTURE:return this._executePictureMacro(),{};default:return console.log("不明なマクロIDが実行されました:"+this.macroType),{}}}catch(t){}}_concatEmptyArgs(t){if(this.macroArgs.length<t){for(var e=new Array(t-this.macroArgs.length),s=0;s<e.length;s++)e[s]="";this.macroArgs=this.macroArgs.concat(e)}}_evaluateIntValue(t,e=0){const s=this.macroArgs[t];if(""===s)return e;const i=Number(s),a=i>=0?Math.floor(i):Math.ceil(i);return isNaN(a)?le(s,this._wwa.generateTokenValues({id:this._triggerPartsID,type:this._triggerPartsType,position:this._triggerPartsPosition}),e):a}_executeJumpGateMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.forcedJumpGate(t,e)}_executeRecPositionMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.recUserPosition(t,e)}_executeJumpRecPositionMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.jumpRecUserPosition(t,e)}_executeConsoleLogMacro(t){this._concatEmptyArgs(1);const e=this._evaluateIntValue(0);switch(t){case 1:return void this._wwa.outputUserVar(e);case 2:return void console.log(`${this.macroArgs[0]} = ${e}`)}}_executeCopyHpToMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarHP(t)}_executeCopyHpMaxToMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarHPMAX(t)}_executeCopyAtToMacro(){this._concatEmptyArgs(2);const t=this._evaluateIntValue(0),e=this._parseStatusKind(this._evaluateIntValue(1));this._wwa.setUserVarAT(t,e)}_executeCopyDfToMacro(){this._concatEmptyArgs(2);const t=this._evaluateIntValue(0),e=this._parseStatusKind(this._evaluateIntValue(1));this._wwa.setUserVarDF(t,e)}_parseStatusKind(t){switch(t){case 0:default:return"all";case 1:return"bare";case 2:return"equipment"}}_executeCopyMoneyToMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarMONEY(t)}_executeSetHPMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);return this._wwa.setHPUserVar(t,!0)}_executeSetHpMaxMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setHPMAXUserVar(t)}_executeSetAtMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setATUserVar(t)}_executeSetDfMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setDFUserVar(t)}_executeSetMoneyMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setMONEYUserVar(t)}_executeSetStepCountMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarStep(t)}_executeVarSetValMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserVarVal(t,e)}_executeVarSetMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValOtherUserVal(t,e)}_executeVarAddMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValAdd(t,e)}_executeVarSubMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValSub(t,e)}_executeVarMulMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValMul(t,e)}_executeVarDivMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValDiv(t,e)}_executeVarModMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setUserValMod(t,e)}_executeVarSetRandMacro(){this._concatEmptyArgs(3);const t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2,0);this._wwa.setUserValRandNum(t,e,s)}_executeGameSpeedMacro(){this._concatEmptyArgs(1);var t=!!this._evaluateIntValue(0);this._wwa.speedChangeJudge(t)}_executeLegacyIfMacro(){for(var t=new Array(11),e=0;e<10;e++)t[e]=this.macroArgs[e];this._wwa.userVarUserIf(this._triggerPartsPosition,t)}_executeSetSpeedMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setPlayerSpeedIndex(t-1)}_executeCopyTimeToMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setUserVarPlayTime(t)}_executeHideStatusMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=0!==this._evaluateIntValue(1);this._wwa.hideStatus(t,e)}_executeVarMapMacro(){this._concatEmptyArgs(4);var t=this._evaluateIntValue(0),e=this.macroArgs[1],s=this.macroArgs[2],i=this._evaluateIntValue(3,v.OBJECT);if(t<0)throw new Error("入力変数が不正です");this._wwa.varMap(this._triggerPartsPosition,e,s,t,i)}_executeImgPlayerMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setPlayerImgCoord(new c(t,e))}_executeImgYesNoMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setYesNoImgCoord(new c(t,e))}_executeHPMaxMacro(){this._concatEmptyArgs(1);var t=Math.max(0,this._evaluateIntValue(0));this._wwa.setPlayerEnergyMax(t)}_executeSaveMacro(){this._concatEmptyArgs(1);var t=!!this._evaluateIntValue(0);this._wwa.disableSave(t)}_executeItemMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setPlayerGetItem(t,e)}_executeDefaultMacro(){this._concatEmptyArgs(1);var t=!!this._evaluateIntValue(0);this._wwa.setObjectNotCollapseOnPartsOnPlayer(t)}_executeOldMapMacro(){this._concatEmptyArgs(1);var t=!!this._evaluateIntValue(0);this._wwa.setOldMap(t)}_executePartsMacro(){this._concatEmptyArgs(4);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2,v.OBJECT),i=this._evaluateIntValue(3);if(s!==v.OBJECT&&s!==v.MAP)throw new Error("パーツ種別が不明です");if(0!==i&&1!==i&&(i=1),t<0||e<0)throw new Error("パーツ番号が不正です");if(s===v.OBJECT){if(t>=this._wwa.getObjectPartsNum()||e>=this._wwa.getObjectPartsNum())throw new Error("パーツ番号が不正です")}else if(t>=this._wwa.getMapPartsNum()||e>=this._wwa.getMapPartsNum())throw new Error("パーツ番号が不正です");this._wwa.replaceParts(t,e,s,!!i)}_executeMoveMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);this._wwa.setMoveMacroWaitingToPlayer(t)}_executeMapMacro(t){this._concatEmptyArgs(4);const e=this._evaluateIntValue(0);var s=this._evaluateIntValue(3,v.OBJECT);if(e<0)throw new Error("パーツ番号が不正です");if(s===v.OBJECT){if(e>=this._wwa.getObjectPartsNum())throw new Error("パーツ番号が不正です")}else if(e>=this._wwa.getMapPartsNum())throw new Error("パーツ番号が不正です");if(1===t){const t=this.macroArgs[1],i=this.macroArgs[2];this._wwa.appearPartsEval(this._triggerPartsPosition,t,i,e,s)}else if(2===t){const t=this._evaluateIntValue(1),i=this._evaluateIntValue(2);if(isNaN(t)||isNaN(i))throw new Error("出現先座標が不正です");this._wwa.appearPartsEval(this._triggerPartsPosition,`${t}`,`${i}`,e,s)}}_executeDirMapMacro(){this._concatEmptyArgs(3);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2,v.OBJECT);if(isNaN(t)||isNaN(e)||isNaN(s))throw new Error("引数が整数ではありません");if(t<0)throw new Error("パーツ番号が不正です");if(s===v.OBJECT){if(t>=this._wwa.getObjectPartsNum())throw new Error("パーツ番号が不正です")}else if(t>=this._wwa.getMapPartsNum())throw new Error("パーツ番号が不正です");this._wwa.appearPartsByDirection(e,t,s)}_executeImgFrameMacro(){this._concatEmptyArgs(3);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2);if(e<0||s<0)throw new Error("座標は正でなければなりません。");if(t===L.ENERGY||t===L.STRENGTH||t===L.DEFENCE||t===L.GOLD)this._wwa.setStatusIconCoord(t,new c(e,s));else if(t===L.WIDE_CELL_ROW)this._wwa.setWideCellCoord(new c(e,s));else if(t===L.ITEM_BG)this._wwa.setItemboxBackgroundPosition({x:e,y:s});else{if(t!==L.MAIN_FRAME)throw new Error("種別が不正です。");this._wwa.setFrameCoord(new c(e,s))}}_executeImgBomMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||e<0)throw new Error("座標は正でなければなりません。");this._wwa.setBattleEffectCoord(new c(t,e))}_executeDelPlayerMacro(){this._concatEmptyArgs(1);const t=this._evaluateIntValue(0);this._wwa.setDelPlayer(!!t)}_executeFaceMacro(){this._concatEmptyArgs(6);var t,e=this._evaluateIntValue(0),s=this._evaluateIntValue(1),i=this._evaluateIntValue(2),a=this._evaluateIntValue(3),r=this._evaluateIntValue(4),n=this._evaluateIntValue(5);if(e<0||s<0||i<0||a<0||r<0||n<0)throw new Error("各引数は0以上の整数でなければなりません。");t=new l(new c(e,s),new c(i,a),new c(r,n)),this._wwa.addFace(t)}_executeEffectMacro(){this._concatEmptyArgs(1);var t=this._evaluateIntValue(0);if(t<0)throw new Error("待ち時間は0以上の整数でなければなりません。");if(0!==t){for(var e=[],s=1;s<this.macroArgs.length;s+=2){var i,a=this._evaluateIntValue(s);if(a<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");if(s+1===this.macroArgs.length)throw new Error("画像のパーツ座標指定で、Y座標が指定されていません。");if((i=this._evaluateIntValue(s+1))<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");e.push(new c(a,i))}this._wwa.setEffect(t,e)}else this._wwa.stopEffect()}_executeGameOverMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||t>=this._wwa.getMapWidth()||e<0||e>=this._wwa.getMapWidth())throw new Error("マップの範囲外が指定されています!");this._wwa.setGameOverPosition(new c(t,e))}_executeImgClickMacro(){if(this._concatEmptyArgs(2),this.macroArgs.length<1)throw new Error("引数が少なすぎます");var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||e<0)throw new Error("引数が0以上の整数ではありません");this._wwa.setImgClick(new c(t,e))}_executeEffItemMacro(){if(this.macroArgs.length<1)throw new Error("引数が少なすぎます");var t=this._evaluateIntValue(0);this._wwa.updateItemEffectEnabled(!!t)}_executeStatusMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||4<t)throw new Error("ステータス種別が範囲外です。");return this._wwa.setPlayerStatus(t,e,!0)}_executeColorMacro(){this._concatEmptyArgs(4);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2),i=this._evaluateIntValue(3);if(t<0||t>5)throw new Error("種別は0から5までです");if(e<0||e>255||s<0||s>255||i<0||i>255)throw new Error("色が範囲外です");this._wwa.changeStyleRule(t,e,s,i)}_executeWaitMacro(){throw new Error("Not implemented!")}_executeSoundMacro(){this._concatEmptyArgs(2);const t=parseInt(this.macroArgs[0]),e=parseInt(this.macroArgs[1]);this._wwa.playSound(t,e)}_executeGamePadButtonMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);if(t<0||e<0)throw new Error("各引数は0以上の整数でなければなりません。");if(e>V.ITEMBOX_SIZE)throw new Error("アイテムボックス上限を超えた数値が指定されました。");this._wwa.setGamePadButtonItemTable(t,e)}_executeOldMoveMacro(){this._concatEmptyArgs(1);const t=!!this._evaluateIntValue(0);this._wwa.setOldMove(t)}_executeNoGameOverMacro(){this._concatEmptyArgs(1);const t=this._evaluateIntValue(0);this._wwa.setGameOverPolicy(t)}_executeSetMacro(){return this._wwa.execSetMacro(this.macroArgs[0],{triggerParts:{position:this._triggerPartsPosition,id:this._triggerPartsID,type:this._triggerPartsType}})}_executePictureMacro(){if(this._concatEmptyArgs(3),this.macroArgs.length<1)throw new Error("引数が少なすぎます");const t=this._evaluateIntValue(0),e=this.macroArgs[1].length>0?this.macroArgs[1]:"+0";if("0"===e)return void this._wwa.deletePictureRegistry(t);const s=((t,e)=>{if("+"===t[0]){const s=parseInt(t.substring(1,10));if(Number.isNaN(s))throw new Error("+ 以降の文字列は数値形式で記載してください。");return e+s}if("-"===t[0]){const s=parseInt(t.substring(1,10));if(Number.isNaN(s))throw new Error("- 以降の文字列は数値形式で記載してください。");return e-s}const s=parseInt(t,10);if(Number.isNaN(s))throw new Error("数値形式ではないため、解析できません。");return s})(e,this._triggerPartsID);if(0===s)throw new Error("パーツ番号の相対値算出で0が検出されました。ピクチャを消去する場合は0のまま指定してください。");if(s<0)throw new Error("パーツ番号は0以上の整数でなければなりません。");const i=this._evaluateIntValue(2,v.OBJECT);this._wwa.setPictureRegistry(t,s,i,this._triggerPartsPosition)}_executeDelayBgmMacro(){this._concatEmptyArgs(1);const t=this._evaluateIntValue(0);this._wwa.setBgmDelay(t)}_executeSysMsgMacro(){this._concatEmptyArgs(2);const t=this.resolveSystemMessageKeyFromMacroArg(this.macroArgs[0]);if(!t)throw new Error("該当するシステムメッセージの定義がありません");const e=""===this.macroArgs[1]?void 0:this.macroArgs[1].replaceAll("\\n","\n");this._wwa.overwriteSystemMessage(t,e)}resolveSystemMessageKeyFromMacroArg(t){if(r(t))return t;return n(this._evaluateIntValue(0))}}class ke{constructor(t,e,s,i,a,r,n){this._wwa=t,this._coord=e,this._width=s,this._height=i,this._isVisible=a,this._parentElement=r,this._element=document.createElement("div"),this._element.style.position="absolute",this._element.style.borderWidth="2px",this._element.style.borderStyle="solid",t.isClassicMode()?this._element.style.borderRadius="15px":this._element.style.borderRadius="10px",this._element.classList.add("wwa-message-window"),this._element.style.zIndex=n+"",this._element.style.left=this._coord.x+"px",this._element.style.top=this._coord.y+"px",this._element.style.width=this._width+"px",this._element.style.height=this._height+"px",this._parentElement.appendChild(this._element)}update(t){}show(){this._isVisible=!0,this._element.style.display="block",this.update(),this._wwa.wwaCustomEvent("wwa_window_show",{name:this.windowName,element:this._element,text:this._element.textContent})}hide(){this._isVisible=!1,this._element.style.display="none",this.update(),this._wwa.wwaCustomEvent("wwa_window_hide",{name:this.windowName})}isVisible(){return this._isVisible}get windowName(){return"TextWindow"}}class We extends ke{constructor(t,e,s,i,a,r,n){super(t,new c(e.x,e.y),s,i,a,r,201),this._cgFileName=n,this._monsterBox=document.createElement("div"),this._monsterBox.style.width=V.CHIP_SIZE+"px",this._monsterBox.style.height=V.CHIP_SIZE+"px",this._monsterBox.style.position="absolute",this._monsterBox.style.left="10px",this._monsterBox.style.top="10px",this._monsterBox.style.backgroundImage="url("+this._cgFileName.replace("(","\\(").replace(")","\\)")+")",this._monsterBox.style.backgroundPosition="0 0",this._element.appendChild(this._monsterBox),this._energyBox=document.createElement("div"),this._energyBox.style.position="absolute",this._energyBox.style.left="80px",this._energyBox.style.top="10px",this._energyBox.textContent="生命力 0",this._element.appendChild(this._energyBox),this._strengthBox=document.createElement("div"),this._strengthBox.style.position="absolute",this._strengthBox.style.left="80px",this._strengthBox.style.top="30px",this._strengthBox.textContent="攻撃力 0",this._element.appendChild(this._strengthBox),this._defenceBox=document.createElement("div"),this._defenceBox.style.position="absolute",this._defenceBox.style.left="180px",this._defenceBox.style.top="30px",this._defenceBox.textContent="防御力 0",this._element.appendChild(this._defenceBox),this._isVisible?this._element.style.display="block":this._element.style.display="none"}update(t){void 0!==t&&(this._monsterBox.style.backgroundPosition="-"+t.imgCoord.x+"px -"+t.imgCoord.y+"px",this._energyBox.textContent="生命力 "+t.status.energy,this._strengthBox.textContent="攻撃力 "+t.status.strength,this._defenceBox.textContent="防御力 "+t.status.defence)}get windowName(){return"MonsterWindow"}}class Ve extends ke{constructor(t,e,s,i){t.isClassicMode()?(super(t,new c(2*V.CHIP_SIZE,30),7*V.CHIP_SIZE,40,s,i,202),this._element.style.borderWidth="0",this._element.style.borderRadius="4px",this._element.style.fontSize="20px",this._element.style.lineHeight="40px"):super(t,new c(e.x,e.y),340,30,s,i,202),this._element.style.textAlign="center",this._isVisible?this._element.style.display="block":this._element.style.display="none",this.update(0)}update(t){void 0!==t&&(this._element.textContent="Score: "+t)}get windowName(){return"ScoreWindow"}}var Fe,Ye;Ve.WINDOW_NAME="ScoreWindow",function(t){t[t.TOP=0]="TOP",t[t.CENTER=1]="CENTER",t[t.BOTTOM=2]="BOTTOM",t[t.SCORE=3]="SCORE"}(Fe||(Fe={}));class Ge{constructor(t,e,s,i,a,r,n,o,h,c){this._wwaSave=void 0,this._save_select_id=0,this._save_counter=0,this._save_close=!1;var _=this,l=r.replace("(","\\(").replace(")","\\)");switch(this._wwa=t,this._cgFileName=r,this._x=e,this._y=s,this._width=i,this._height=a,this._message="",this._isVisible=n,this._isYesno=o,this._isItemMenu=h,this._element=document.createElement("div"),this._element.id="wwa-text-message-window",this._element.classList.add("wwa-message-window"),this._msgWrapperElement=document.createElement("div"),this._msgWrapperElement.style.textAlign="left",this._msgWrapperElement.style.wordWrap="break-word",this._msgWrapperElement.style.margin=t.isClassicMode()?"8px 0 8px 16px":"0",this._msgWrapperElement.style.padding=t.isClassicMode()?"0":"7px",this._element.appendChild(this._msgWrapperElement),this._saveElement=document.createElement("div"),this._saveElement.style.padding="0",this._saveElement.style.margin="0",this._element.appendChild(this._saveElement),this._dummyElement=document.createElement("div"),this._dummyElement.style.display="none",this._dummyElement.style.padding="0",this._dummyElement.style.margin="0",this._dummyElement.style.height="55px",this._element.appendChild(this._dummyElement),this._ynWrapperElement=document.createElement("div"),this._ynWrapperElement.classList.add("wwa-yesno-wrapper"),this._element.appendChild(this._ynWrapperElement),this._parentElement=c,this._parentElement.appendChild(this._element),this._divYesElement=document.createElement("div"),this._divYesElement.classList.add("wwa-yes-button"),this._divYesElement.style.background="url("+l+")",this._divYesElement.onclick=function(){_._isInputDisable||(t.setYesNoInput(g.YES),_.update())},this._divYesElement.style.cursor="pointer",this._divNoElement=document.createElement("div"),this._divNoElement.classList.add("wwa-no-button"),this._divNoElement.style.background="url("+l+")",this._divNoElement.onclick=function(){_._isInputDisable||(t.setYesNoInput(g.NO),_.update())},this._ynWrapperElement.appendChild(this._divYesElement),this._ynWrapperElement.appendChild(this._divNoElement),_._isInputDisable=!1,t.userDevice.device){case S.SP:case S.VR:this._parentElement.classList.add("useScaleUp")}this.update()}setPosition(t,e,s,i){this._x=t,this._y=e,this._width=s,this._height=i,this.update()}setPositionByPlayerPosition(t,e,s,i,a){var r,n=i.getPartsCoord().substract(a.getPartsCoord()).y;r=t?Fe.BOTTOM:e?Fe.SCORE:s?Fe.CENTER:n>=Math.ceil(V.V_PARTS_NUM_IN_WINDOW/2)?Fe.TOP:Fe.BOTTOM,this.setPositionEasy(r)}setPositionEasy(t){var e=Math.floor(this._element.clientHeight/2);return t===Fe.CENTER?(this._y=V.MAP_WINDOW_HEIGHT/2-e,void this.update()):t===Fe.TOP?(this._y=Math.max(20,V.MAP_WINDOW_HEIGHT/4-e)+10,void this.update()):t===Fe.BOTTOM?(this._y=Math.min(V.MAP_WINDOW_HEIGHT-20-this._element.clientHeight,3*V.MAP_WINDOW_HEIGHT/4-e),void this.update()):t===Fe.SCORE?(this._y=80,void this.update()):void 0}setMessage(t){this._message=t,this.update()}clear(){this._message="",this.update()}setYesNoChoice(t){return this._isInputDisable=!1,this._isYesno=t,this.update(),this._isYesno}isYesNoChoice(){return this._isYesno}isSaveChoice(){return this._isSave}setItemMenuChoice(t){return this._isInputDisable=!1,this._isItemMenu=t,this.update(),this._isItemMenu}isItemMenuChoice(){return this._isItemMenu}setInputDisable(){this._isInputDisable=!0}isInputDisable(){return this._isInputDisable}show(){this._isVisible=!0,this.update()}hide(){this._isVisible=!1,this.update()}isVisible(){return this._isVisible}isWideChar(t){return null!==t.match(/^[^\x01-\x7E\xA1-\xDF]+$/)}createClassicTextElement(t){var e=document.createElement("span");let s=0,i="";for(let r=0;r<t.length||0!=s;r++)if(this.isWideChar(t.charAt(r))?s+=2:s+=1,i+=t.charAt(r),s+1>2*V.MSG_STR_WIDTH){"。"!==t.charAt(r+1)&&"、"!==t.charAt(r+1)||(i+=t.charAt(r+1),r++);var a=document.createElement("span");a.style.display="inline-block",a.style.width="100%",a.textContent=i,e.appendChild(a),s=0,i=""}return e}update(){var t=this._wwa.getYesNoImgCoord();this._isYesno?(this._wwa.getYesNoState()===g.YES?(this._divYesElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_YESP_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_NO_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px"):this._wwa.getYesNoState()===g.NO?(this._divYesElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_YES_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_NOP_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px"):(this._divYesElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_YES_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+V.IMGRELPOS_YESNO_NO_X)*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px"),this._ynWrapperElement.style.display="block"):this._ynWrapperElement.style.display="none",this._msgWrapperElement.textContent="";var e=this._message.split("\n");e.forEach(((t,s)=>{let i;this._wwa.isClassicMode()?i=this.createClassicTextElement(t):(i=document.createElement("span"),i.textContent=e[s]),this._msgWrapperElement.appendChild(i),this._msgWrapperElement.appendChild(document.createElement("br"))})),this._isVisible?(this._element.style.left=this._x+"px",this._element.style.top=this._y+"px"):(this._element.style.left="-999999px",this._element.style.top="-999999px"),this._isSave?this._saveElement.style.display="block":this._saveElement.style.display="none",this._element.style.width=this._width+"px",this._element.style.minHeight=this._height+"px"}setWWASave(t){this._wwaSave=t}createSaveDom(){var t,e,s,i,a,r,n,o,h,c,_;e=document.createElement("div"),c=(o=document.getElementById("disp-energy")).style.backgroundPosition,_=o.style.backgroundImage;for(var l=this._wwaSave.list.length,u=0;u<l;u++)t=this._wwaSave.list[u],(s=document.createElement("div")).classList.add("savedata"),s.setAttribute("save_id",u),s.addEventListener("click",(t=>{this.setSaveID(0|t.currentTarget.getAttribute("save_id")),this._save_close=!0,t.preventDefault()})),(i=document.createElement("div")).classList.add("ss"),s.appendChild(i),(a=document.createElement("div")).classList.add("wide-cell-row"),a.style.backgroundPosition=c,a.style.backgroundImage=_,s.appendChild(a),e.appendChild(s),t.flag&&(i.appendChild(t.cvs),(r=document.createElement("span")).textContent=t.getDateText(),t.isLastSaveData()&&(r.style.color=F.DATE_LAST_SAVE_TEXT_COLOR),i.appendChild(r),(n=document.createElement("div")).classList.add("status-icon"),n.style.backgroundImage=_,n.style.backgroundPosition="-120px -80px",a.appendChild(n),(h=document.createElement("div")).classList.add("status-value-box"),h.textContent=t.getStatusEnergy(),a.appendChild(h));this._saveElement.textContent="",this._saveElement.appendChild(e),this.setSaveID(this._save_select_id),this._isSave=!0,this._save_counter=0,this._save_close=!1}deleteSaveDom(){this._saveElement.textContent="",this._isSave=!1}setSaveID(t){this._save_select_id=t;for(var e,s=document.querySelectorAll(".savedata"),i=s.length,a=0;a<i;a++)e=s[a],t===a?e.classList.add("select"):e.classList.remove("select")}save(t,e){return this._wwaSave.save(t,e,this._save_select_id)}load(){return this._wwaSave.load(this._save_select_id)}saveUpdate(){this._save_counter>0&&this._save_counter--}isSaveClose(){return this._save_close}cursor_wait(){this._save_counter=V.CONTROLL_WAIT_FRAME}saveControll(t){if(!(this._save_counter>0||this._isInputDisable)){switch(t){case p.DOWN:this._save_select_id-=2,this.cursor_wait();break;case p.UP:this._save_select_id+=2,this.cursor_wait();break;case p.LEFT:this._save_select_id--,this.cursor_wait();break;case p.RIGHT:this._save_select_id++,this.cursor_wait()}this.setSaveID((this._save_select_id+F.QUICK_SAVE_MAX)%F.QUICK_SAVE_MAX)}}get windowName(){return"MessageWindow"}}class He{constructor(t,e,s){this.id=t,this.imgFileName=e,this.parent=s,this.elem=document.createElement("div"),this.elem.classList.add("est"),this.elem.setAttribute("id","wwa-est-"+t),this.imgElem=document.createElement("div"),this.imgElem.classList.add("est-img-wrapper"),this.imgElem.style.backgroundImage="url("+this.imgFileName.replace("(","\\(").replace(")","\\)")+")",this.statusElem=document.createElement("div"),this.statusElem.classList.add("est-status-wrapper"),this.energyElem=document.createElement("div"),this.energyElem.classList.add("est-energy"),this.energyDispElem=document.createElement("span"),this.energyDispElem.classList.add("est-energy-disp"),this.energyElem.appendChild(this.energyDispElem),this.statusElem.appendChild(this.energyElem),this.strengthElem=document.createElement("div"),this.strengthElem.classList.add("est-strength"),this.strengthDispElem=document.createElement("span"),this.strengthDispElem.classList.add("est-strength-disp"),this.strengthElem.appendChild(this.strengthDispElem),this.statusElem.appendChild(this.strengthElem),this.defenceElem=document.createElement("div"),this.defenceElem.classList.add("est-defence"),this.defenceDispElem=document.createElement("span"),this.defenceDispElem.classList.add("est-defence-disp"),this.defenceElem.appendChild(this.defenceDispElem),this.statusElem.appendChild(this.defenceElem),this.damageElem=document.createElement("div"),this.damageElem.classList.add("est-damage"),this.damageDispElem=document.createElement("span"),this.damageDispElem.classList.add("est-damage-disp"),this.damageElem.appendChild(this.damageDispElem),this.statusElem.appendChild(this.damageElem),this.elem.appendChild(this.imgElem),this.elem.appendChild(this.statusElem)}hide(){this.elem.style.display="none"}show(){this.elem.style.display="block"}setResult(t,e,s){this.imgElem.style.backgroundPosition="-"+t.x+"px -"+t.y+"px",this.energyDispElem.textContent="生命力 "+e.energy,this.strengthDispElem.textContent="攻撃力 "+e.strength,this.defenceDispElem.textContent="防御力 "+e.defence,s.cannotDamageMonster?this.damageDispElem.textContent="攻撃無効":s.noSettled?this.damageDispElem.textContent="勝負がつきません":s.isOverMaxTurn?this.damageDispElem.textContent="長期戦が予想されます":this.damageDispElem.textContent="予測ダメージ "+s.estimatedDamage}}class Ke{constructor(t,e,s){var i;this._wwa=t,this._imgFileName=e,this._parent=s,this._element=document.createElement("div"),this._element.setAttribute("id","wwa-battle-estimate"),this._element.style.display="none",this._edes=[];for(var a=0;a<V.BATTLE_ESTIMATE_MONSTER_TYPE_MAX;a++)i=new He(a,this._imgFileName,this._element),this._edes.push(i),this._element.appendChild(i.elem);this._element.addEventListener("click",(()=>{this._wwa.hideBattleEstimateWindow()})),this._parent.appendChild(this._element)}update(t,e,s,i,a){for(let r=0;r<V.BATTLE_ESTIMATE_MONSTER_TYPE_MAX;r++){if(r>=e.length){this._edes[r].hide();continue}const n=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_X),o=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_Y),_=new c(n,o),l=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_ENERGY),u=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_STRENGTH),d=this._wwa.getObjectAttributeById(e[r].partsID,V.ATR_DEFENCE),p=new h(l,u,d,0),m=je(t,e[r],s,i,a);this._edes[r].setResult(_,p,m),this._edes[r].show()}}show(){this._element.style.display="block"}hide(){this._element.style.display="none"}}function je(t,e,s,i,a){const r=e.clone(),n=t.clone();let o=0,h=0,c=0;const _=t.energy;if(a&&n.strength<=r.status.defence&&n.defence>=r.status.strength)return{cannotDamageMonster:!0,estimatedDamage:0};for(;;){h++;const t=s(n,r);if(r.status.energy-=t.damage,0===t.damage?c++:c=0,r.status.energy<=0)return{estimatedDamage:o};if(c>V.FIGHT_DRAW_TURN||t.aborted)return{noSettled:(_<=0||n.energy>0)&&r.status.energy>0,estimatedDamage:o};if(h>2e4)return{isOverMaxTurn:!0,estimatedDamage:0};h++;const e=i(r,n),a=Math.max(e.damage,0);if(0===a?c++:c=0,o+=a,n.energy=Math.max(n.energy-a,0),c>V.FIGHT_DRAW_TURN||e.aborted)return{noSettled:(_<=0||n.energy>0)&&r.status.energy>0,estimatedDamage:o};if(h>2e4)return{isOverMaxTurn:!0,estimatedDamage:0}}}!function(t){t[t.SAVE=0]="SAVE",t[t.LOAD=1]="LOAD"}(Ye||(Ye={}));class Xe{constructor(t,e,s){this._wwa=t,this._parent=e,this._isDisallowLoadOldSave=s,this.COPIED_MESSAGE_DISPLAY_MS=1e3,this._element=document.createElement("div"),this._element.setAttribute("id","wwa-password-window"),this._element.style.display="none",this._descriptionElement=document.createElement("div"),this._descriptionElement.classList.add("wwa-password-description"),this._passwordBoxElement=document.createElement("textarea"),this._passwordBoxElement.setAttribute("cols","50"),this._passwordBoxElement.setAttribute("rows","16"),this._passwordBoxElement.addEventListener("focus",(t=>{this._passwordBoxElement.select()})),this._buttonWrapperElement=document.createElement("div"),this._buttonWrapperElement.classList.add("wwa-password-submit"),this._okButtonElement=document.createElement("button"),this._okButtonElement.textContent="OK",this._okButtonElement.addEventListener("click",(()=>{this._wwa.hidePasswordWindow()})),this._cancelButtonElement=document.createElement("button"),this._cancelButtonElement.textContent="キャンセル",this._cancelButtonElement.addEventListener("click",(()=>{this._wwa.hidePasswordWindow(!0)})),this._copyButtonElement=document.createElement("button"),this._copyButtonElement.textContent="コピー",this._copyButtonElement.addEventListener("click",(async()=>{await navigator.clipboard.writeText(this.password),this._copyButtonElement.textContent="コピーしました",this._copyButtonElement.disabled=!0,setTimeout((()=>{this._copyButtonElement&&(this._copyButtonElement.textContent="コピー",this._copyButtonElement.disabled=!1)}),this.COPIED_MESSAGE_DISPLAY_MS)})),this._buttonWrapperElement.appendChild(this._okButtonElement),this._buttonWrapperElement.appendChild(this._cancelButtonElement),this._buttonWrapperElement.appendChild(this._copyButtonElement),this._mode=Ye.LOAD,this._element.appendChild(this._descriptionElement),this._element.appendChild(this._passwordBoxElement),this._element.appendChild(this._buttonWrapperElement),this._parent.appendChild(this._element),this.update()}get mode(){return this._mode}set mode(t){this._mode=t,t===Ye.LOAD&&(this.password="")}get password(){return this._passwordBoxElement.value}set password(t){this._passwordBoxElement.value=t}show(t){void 0!==t&&(this.mode=t),this._isVisible=!0,this.update()}hide(){this._isVisible=!1,this.update()}update(){var t="";if(this._mode===Ye.LOAD){t=`下のボックスに前回のプレイで取得した\n復帰用パスワードを貼り付けてください。\nJava 版 WWA で取得したパスワードはご利用になれません。\n作成者が ${this._isDisallowLoadOldSave?"マップの内容":"ワールド名 か マップの暗証番号"} を変更した場合は\nそれ以前に取得したパスワードは使えなくなります。`;try{this._passwordBoxElement.removeAttribute("readonly")}catch(t){}this._cancelButtonElement.style.display="inline",this._copyButtonElement.style.display="none"}else t="下記テキストがデータ復帰用のパスワードになっています。\nコピーしてメモ帳などのテキストエディタに貼り付けて\n保存してください。",this._passwordBoxElement.setAttribute("readonly","readonly"),this._cancelButtonElement.style.display="none",this._copyButtonElement.style.display="inline";var e=t.split("\n");this._descriptionElement.textContent="";for(var s=0;s<e.length;s++){var i=document.createElement("span");i.textContent=e[s],this._descriptionElement.appendChild(i),this._descriptionElement.appendChild(document.createElement("br"))}this._isVisible?this._element.style.display="block":this._element.style.display="none"}}function Je(){return"ontouchstart"in window&&"ontouchend"in window&&"ontouchmove"in window}function $e(t,e,s){var i=document.createElement("style");i.type="text/css",i.setAttribute("id",V.WWA_STYLE_TAG_ID),pt("head")[0].appendChild(i),t.innerHTML=function(t,e){return`\n <canvas id="wwa-map" class="wwa-canvas" width="440" height="440">\n このブラウザは、Canvas要素をサポートしていません。\n </canvas>\n <canvas id="wwa-map-sub" class="wwa-canvas" width="440" height="440"></canvas>\n <div id="wwa-sidebar">\n <div class="wide-cell-row" id="disp-energy"><div class="status-icon"></div><div class="status-value-box">0</div></div>\n <div class="wide-cell-row" id="disp-strength"><div class="status-icon"></div><div class="status-value-box"> 0 </div></div>\n <div class="wide-cell-row" id="disp-defence"><div class="status-icon"></div><div class="status-value-box">0</div></div>\n <div class="wide-cell-row" id="disp-gold"><div class="status-icon"></div><div class="status-value-box">0</div></div>\n <div class="item-cell" id="item0"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item1"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item2"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item3"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item4"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item5"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item6"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item7"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item8"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item9"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item10"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="item-cell" id="item11"><div class="item-click-border"></div><div class="item-disp"></div></div>\n <div class="wide-cell-row" id="cell-load">Password</div><div class="wide-button" id="button-load"></div>\n <div class="wide-cell-row" id="cell-save">Quick Save</div><div class="wide-button" id="button-save"></div>\n <div class="wide-cell-row" id="cell-restart">Restart Game</div><div class="wide-button" id="button-restart"></div>\n <div class="wide-cell-row" id="cell-gotowwa">Goto WWA</div><div class="wide-button" id="button-gotowwa"></div>\n </div>\n <div id="wwa-controller"></div>\n <div id="wwa-fader"></div>\n${t?'\n <div id="wwa-cover">\n <div id="unstable-version-warning"></div>\n <div id="version"></div>\n <div id="progress-message-container">開始しています...</div>\n <div id="progress-bar-bg"></div>\n <div id="progress-bar" class="progress-bar"></div>\n <div id="progress-bar-audio" class="progress-bar"></div>\n <div id="progress-disp">---</div>\n </div>\n ':`\n <div id="wwa-cover">\n <canvas id="progress-panel" width="${V.SCREEN_WIDTH}" height="${V.SCREEN_HEIGHT}"></canvas>\n </div>`}\n${e?'\n <div id="wwa-virtualpad-left">\n <button class="wwa-virtualpad__button" id="wwa-up-button"></button>\n <button class="wwa-virtualpad__button" id="wwa-left-button"></button>\n <button class="wwa-virtualpad__button" id="wwa-right-button"></button>\n <button class="wwa-virtualpad__button" id="wwa-down-button"></button>\n <div class="wwa-virtualpad__hole"></div>\n </div>\n <div id="wwa-virtualpad-right">\n <button class="wwa-virtualpad__button" id="wwa-slow-button">I</button>\n <button class="wwa-virtualpad__button" id="wwa-fast-button">P</button>\n <button class="wwa-virtualpad__button" id="wwa-enter-button">Y</button>\n <button class="wwa-virtualpad__button" id="wwa-esc-button">N</button>\n </div>':""}\n`}(null!==e,s),null!==e&&(dt("wwa-cover").style.backgroundImage=`url(${e})`,dt("wwa-cover").style.backgroundRepeat="no-repeat",dt("wwa-cover").style.backgroundPosition="0 0")}class Ze{update(){this.counter>0&&this.counter--}cursor_wait(){this.counter=V.CONTROLL_WAIT_FRAME}allClear(){this.col=0,this.row=0,this.counter=0}controll(t){if(!(this.counter>0))switch(t){case p.DOWN:this.row<Ze.ROW_MAX-1&&(this.row++,this.openView(),this.cursor_wait());break;case p.UP:this.row>0&&(this.row--,this.openView(),this.cursor_wait());break;case p.LEFT:this.col>0&&(this.col--,this.openView(),this.cursor_wait());break;case p.RIGHT:this.col<Ze.COL_MAX-1&&(this.col++,this.openView(),this.cursor_wait())}}ok(){this.close();var t=null;(t=Et(Ze.CLICK_DOM_QUERY_TABLE[this.row][this.col])).classList.contains("item-click-border")||this.allClear();var e=new MouseEvent("click",{view:window,bubbles:!0,cancelable:!0});return t.dispatchEvent(e)}ng(){this.close()}close(){var t,e,s=null;for(t=0;t<Ze.COL_MAX;t++)for(e=0;e<Ze.ROW_MAX;e++)(s=dt(Ze.DOM_ID_TABLE[e][t])).classList.contains("onpress")&&s.classList.remove("onpress")}openView(){this.close();dt(Ze.DOM_ID_TABLE[this.row][this.col]).classList.add("onpress")}init(){this.allClear(),this.openView()}constructor(){this.allClear()}}Ze.ROW_MAX=8,Ze.COL_MAX=3,Ze.DOM_ID_TABLE=[["item0","item1","item2"],["item3","item4","item5"],["item6","item7","item8"],["item9","item10","item11"],["cell-load","cell-load","cell-load"],["cell-save","cell-save","cell-save"],["cell-restart","cell-restart","cell-restart"],["cell-gotowwa","cell-gotowwa","cell-gotowwa"]],Ze.CLICK_DOM_QUERY_TABLE=[["#item0 .item-click-border","#item1 .item-click-border","#item2 .item-click-border"],["#item3 .item-click-border","#item4 .item-click-border","#item5 .item-click-border"],["#item6 .item-click-border","#item7 .item-click-border","#item8 .item-click-border"],["#item9 .item-click-border","#item10 .item-click-border","#item11 .item-click-border"],["#button-load","#button-load","#button-load"],["#button-save","#button-save","#button-save"],["#button-restart","#button-restart","#button-restart"],["#button-gotowwa"," #button-gotowwa","#button-gotowwa"]];var qe=s(23);function ze(t){return`^ /${231*t+8310}P+>A[]`}function Qe(t){return(0,qe.MD5)(t).toString()}const ts=Object.freeze({MAP:"map",MAP_OBJECT:"mapObject",SYSTEM_MESSAGE:"systemMessage",USER_VAR:"userVar"}),es=Object.freeze({mapAttribute:!0,objectAttribute:!0,message:!0});class ss{static compress(t){var e,s,i={};for(e in t)if(!es[e]){switch(typeof(s=t[e])){case"number":case"string":case"boolean":if(this._restartData[e]===s&&"worldName"!==e)continue;break;case"object":if(null===s){if(this._restartData[e]===s)continue}else if(void 0===(s=this.compressObject(e,s,this._restartData[e])))continue;break;case"undefined":break;case"function":continue}i[e]=s}return i}static compressObject(t,e,s){var i,a,r,n;switch(t){case ts.MAP:case ts.MAP_OBJECT:var o,h,c,_,l,u,d,p,m,E,g,w,f,v;for(l in i={},m={},p={},e)for(_ in a=e[l],r=s[l],n={},h=-1,a)(d=a[_])!==r[_]&&(n[_]=d,void 0===m[d]&&(m[d]={}),void 0===(g=m[d])[l]&&(g[l]=[]),(f=g[l]).push(Number(_)));for(w in m)for(l in g=m[w],void 0===p[w]&&(p[w]={}),E=p[w],void 0===i[w]&&(i[w]=[]),h=-1,g)1===(f=g[l]).length?(void 0===E[u=f[0]]&&(E[u]=[]),(v=E[u]).push(Number(l))):(c=(o=Number(l))-h-1,h=o,i[w].push(this.getCompressArray(f),c));for(w in p)for(_ in d=Number(w),h=-1,E=p[w])v=E[_],c=(o=Number(_))-h-1,h=o,1===v.length?i[w].push(c,v[0]):i[w].push(c,this.getCompressArray(v));var y=[];for(w in h=-1,i)c=(o=Number(w))-h-1,h=o,y.push(c,i[w]);return this._usingByteFlag&&JSON.stringify(y).length>=this._mapByteLength?this.compressMapAllObject(e,s,this._firstRandomMapObjectUtf8Table[t]):y;case ts.SYSTEM_MESSAGE:var S;for(t in i={},e)S=e[t],s[t]!==S&&(i[t]=S);break;case ts.USER_VAR:return this.compressUserVars(e);default:return e}if(0!==Object.keys(i).length)return i}static compressUserVars(t){return t.map(((t,e)=>[e,t])).filter((([t,e])=>0!==e))}static compressMapAllObject(t,e,s){var i,a,r,n,o,h,c,_,l,u,d,p,m,E,g,w,f=this._restartData.mapWidth,v=new Uint8Array(this._mapByteLength),y=-1;for(r=0,n=0,h=0,c=0,g=0,d=[],E={},l=[],u=[],a=0;a<f;a++)for(i=0;i<f;i++)(_=t[a][i])!==e[a][i]&&(-1===y&&(y=n),v[n]=v[n]|1<<r,h=n,void 0===E[_]&&(E[_]=new as(_,g++)),E[_].count++),8===++r&&(r=0,n++);for(o in E)d[E[o].index]=E[o];for(p in d.sort(this.idSort),m={},d)m[_=d[p].id]=Number(p),l[p]=_;for(a=0;a<f;a++)for(i=0;i<f;i++)(_=t[a][i])!==e[a][i]&&(u[c++]=m[_]);if(s){for(w=v.length,y=-1,h=0,n=0;n<w;n++)v[n]=v[n]&~s[n],0!==v[n]&&(-1===y&&(y=n),h=n);-1===y&&(y=0,h=0)}return[y,v.subarray(y,h+1),l,this.indexListCompress(u,l.length)]}static indexListCompress(t,e){var s,i,a,r,n,o,h=[];for(r=t.length,i=0,s=0;s<r;s++){for(n=t[s],o=0,a=s+1;a<r&&n===t[a];a++)o++,s=a;switch(o){case 0:h[i++]=n;break;case 1:h[i++]=n,h[i++]=n;break;default:h[i++]=n,h[i++]=e+o}}return h}static idSort(t,e){return e.count-t.count}static getCompressArray(t){var e,s,i,a,r,n,o,h,c=[];for(e=-1,r=t.length,n=0,a=0;a<r;a++){for(s=(i=t[a])-e,o=0,h=a;h<r-1&&t[h]+1===t[h+1];)h++,o++;o<this.MIN_LOOP_COUNT?c[n++]=s:(a=h,i+=o,c[n++]=0,c[n++]=s,c[n++]=o-this.MIN_LOOP_COUNT),e=i}return c}static getDecompressArray(t){var e,s,i,a,r,n,o,h=[];for(e=-1,r=t.length,a=0,o=0;a<r;a++)if(0===(s=t[a])){for(n=(i=e+(s=t[++a]))+t[++a]+this.MIN_LOOP_COUNT;i<=n;i++)h[o++]=i;e=n}else i=e+s,h[o++]=i,e=i;return h}static decompress(t){var e,s,i;for(s in e=JSON.parse(JSON.stringify(this._restartData)),t){switch(typeof(i=t[s])){case"number":case"string":case"boolean":case"undefined":break;case"object":null!==i&&(i=this.decompressObject(s,i,e[s]));break;case"function":continue}e[s]=i}return[e,{isWorldNameEmpty:void 0===t.worldName}]}static decompressObject(t,e,s){var i;switch(t){case ts.MAP:case ts.MAP_OBJECT:var a,r,n,o,h,c,_,l;i={},r=-1;var u,d,p=e;if(4===(l=p.length)&&"number"==typeof p[0]&&(p[1]instanceof Uint8Array||p[1]instanceof Array)&&p[2]instanceof Array&&p[3]instanceof Array)return this.decompressAllMapObject(p,s,this._firstRandomMapObjectUtf8Table[t]),s;for(_=0;_<l;_+=2)r=a=r+Number(p[_])+1,h=a,i[a]=p[_+1];for(c in i){for(h=Number(c),l=(p=i[c]).length,u=[],d=[],_=0;_<l;_+=2){var m=p[_],E=p[_+1];m instanceof Array&&(m=this.getDecompressArray(m)),E instanceof Array&&(E=this.getDecompressArray(E)),"object"==typeof m?u.push({x:m,y:E}):d.push({x:m,y:E})}var g;for(g in r=-1,u)if(r=a=r+Number(u[g].y)+1,m=u[g].x,o=String(a),m instanceof Array)for(l=(p=m).length,_=0;_<l;_++)n=String(p[_]),s[o][n]=h;else n=String(m),s[o][n]=h;for(g in r=-1,d)if(r=a=r+Number(d[g].x)+1,E=d[g].y,n=String(a),E instanceof Array)for(l=(p=E).length,_=0;_<l;_++)s[o=String(p[_])][n]=h;else s[o=String(E)][n]=h}return s;case ts.USER_VAR:return this.decompressUserVars(e);case ts.SYSTEM_MESSAGE:default:if(s);else{if(!e)return;s=s instanceof Array?[]:{}}for(t in e)s[t]=e[t];return s}}static decompressUserVars(t){return t.reduce(((t,[e,s])=>(t[e]=s,t)),this.generateEmptyUserVars())}static generateEmptyUserVars(){const t=new Array(V.USER_VAR_NUM);for(let e=0;e<V.USER_VAR_NUM;e++)t[e]=0;return t}static decompressAllMapObject(t,e,s){var i,a,r,n,o,h,c,_,l,u,d,p=this._restartData.mapWidth,m=new Uint8Array(this._mapByteLength);d=t[0],n=t[2],a=t[3];var E=t[1];if(m.set(E,d),s)for(g=m.length,l=0;l<g;l++)m[l]=m[l]|s[l];r=[];var g,w,f,v,y,S,A=n.length;for(g=a.length,w=0,f=0;w<g;w++){if((o=a[w])>=A)for(v=o-A,y=0;y<v;y++)r[f++]=S;else r[f++]=o;S=o}for(_=0,l=0,u=0,h=0,g=m.length,l=0;l<g;l++)for(_=0;_<8;_++){if(0!=(m[l]&1<<_)){if(void 0===(o=r[h++]))return!1;i=n[o],c=u%p,e[u/p|0][c]=i}u++}return!0}static setRestartData(t,e){this._restartData=t,this._mapByteLength=Math.ceil(t.mapWidth*t.mapWidth/8),this._firstRandomMapObjectUtf8Table[ts.MAP_OBJECT]=this.getChangedUint8Array(e[ts.MAP_OBJECT],t[ts.MAP_OBJECT])}static getChangedUint8Array(t,e){var s,i,a,r,n=this._restartData.mapWidth,o=new Uint8Array(this._mapByteLength),h=-1;for(a=0,r=0,i=0;i<n;i++)for(s=0;s<n;s++)t[i][s]!==e[i][s]&&(-1===h&&(h=r),o[r]=o[r]|1<<a),8===++a&&(a=0,r++);return o}static getStartWWAData(t){if(!t)return this._restartData;try{var e=JSON.parse(t)}catch(t){return this._restartData}var s;if(e)try{if([s]=this.decompress(e),s)return s}catch(t){}return this._restartData}static usingByte(t){this._usingByteFlag=t}}ss._usingByteFlag=!1,ss.MIN_LOOP_COUNT=3,ss._restartData=void 0,ss._mapByteLength=0,ss._firstRandomMapObjectUtf8Table=new class{};var is=ss;class as{constructor(t,e){this.id=0,this.index=0,this.count=0,this.id=t,this.index=e}}class rs{constructor(t,e){this._id=0,this.flag=!1,this.date=void 0,this.cvs=void 0,this.ctx=void 0,this.quickSaveData=void 0,this._id=t,this._parent=e,this.cvs=document.createElement("canvas"),this.cvs.width=F.QUICK_SAVE_THUMNAIL_WIDTH,this.cvs.height=F.QUICK_SAVE_THUMNAIL_HEIGHT,this.ctx=this.cvs.getContext("2d",{alpha:!1})}showQickLoad(){dt("cell-load").textContent=Y.QUICK_LOAD}save(t,e){return this._statusEnergy=e.statusEnergy,this.ctx.clearRect(0,0,this.cvs.width,this.cvs.height),this.ctx.drawImage(t,0,0,t.width,t.height,0,0,this.cvs.width,this.cvs.height),this.quickSaveData=e,this.flag=!0,this.date=new Date,this.showQickLoad(),!0}getStatusEnergy(){return this.flag?this._statusEnergy:-1}load(){return this.quickSaveData}saveDataSet(t,e,s){try{this.quickSaveData=e,this._statusEnergy=e.statusEnergy,this.date=s,this.flag=!0;var i=document.createElement("img");i.src=t,i.addEventListener("load",(()=>{this.flag=!0,this.ctx.drawImage(i,0,0,i.width,i.height,0,0,this.cvs.width,this.cvs.height)})),this.showQickLoad()}catch(t){}}getDateText(){let t,e,s,i,a,r;return this.date?(t=this.date.getFullYear(),e=this.date.getMonth()+1,s=this.date.getDate(),i=this.date.getHours(),a=this.date.getMinutes(),r=this.date.getSeconds(),t=("000"+t).slice(-4),e=("0"+e).slice(-2),s=("0"+s).slice(-2),i=("0"+i).slice(-2),a=("0"+a).slice(-2),r=("0"+r).slice(-2),t+"/"+e+"/"+s+" "+i+":"+a+":"+r):""}isLastSaveData(){return this===this._parent.getLastSaveData()}}class ns extends rs{save(t,e){var s=super.save.apply(this,arguments);return this._parent.dbUpdateSaveData(this._id,t,e,this.date),s}}class os extends Array{constructor(){super(),Object.setPrototypeOf(this,Object.create(os.prototype))}hasSaveData(){for(var t=0;t<F.QUICK_SAVE_MAX;t++)if(this[t].flag)return!0;return!1}getLastSaveData(){for(var t,e,s=0;s<F.QUICK_SAVE_MAX;s++)(e=this[s]).flag&&(t?e.date&&t.date&&e.date.getTime()>t.date.getTime()&&(t=e):t=e);return t}}const hs=t=>{return"boolean"!=typeof(e=t).isGameOverDisabled?e:!0===e.isGameOverDisabled?{...e,isGameOverDisabled:void 0,gameOverPolicy:"never"}:!1===e.isGameOverDisabled?{...e,isGameOverDisabled:void 0,gameOverPolicy:"default"}:e;var e};class cs extends os{constructor(t,e,s=cs.prototype){super(),this.IDBTransaction={READ_ONLY:"readonly",READ_WRITE:"readwrite",VERSION_CHANGE:"versionchangetransaction"},this.keyPath=["id","url"],Object.setPrototypeOf(this,Object.create(s));for(var i=0;i<F.QUICK_SAVE_MAX;i++)this[i]=new ns(i,this);this.onCheckLoadingSaveData=t,this.onCompleteLoadingSaveData=e,this.createDataBase(),this.selectSaveData()}indexDBOpen(){return indexedDB.open(F.INDEXEDDB_DB_NAME,201205201)}createDataBase(){try{var t=this.indexDBOpen();t.onupgradeneeded=e=>{var s=t.result,i={keyPath:this.keyPath};s.objectStoreNames.contains(F.INDEXEDDB_TABLE_NAME)||s.createObjectStore(F.INDEXEDDB_TABLE_NAME,i).createIndex("url","url",{unique:!1})},t.onsuccess=cs.doNotAnything,t.onerror=cs.doNotAnything,t.onblocked=cs.doNotAnything}catch(t){}}getObjectStore(t){const e=t;try{var s=e.transaction(F.INDEXEDDB_TABLE_NAME,this.IDBTransaction.READ_WRITE).objectStore(F.INDEXEDDB_TABLE_NAME)}catch(t){return}return s}makeSaveDataItem(t,e,s,i){return{url:location.href,id:t,hash:ms.checkOriginalMapString,image:e.toDataURL(),data:s,date:i,worldName:ms.worldName,mapDataRevisionKey:ms.mapDataRevisionKey}}getSaveDataResult(t,e){const s=t.index("url"),i=IDBKeyRange.only(location.href),a=s.getAll(i);a.onsuccess=()=>{e(a.result)}}dbUpdateSaveData(t,e,s,i){const a=this.indexDBOpen();a.onupgradeneeded=cs.doNotAnything,a.onsuccess=()=>{const r=this.getObjectStore(a.result),n=is.compress(s),o=this.makeSaveDataItem(t,e,n,i);this.selectDatas[t]=o;const h=r.put(o);h.onsuccess=cs.doNotAnything,h.onerror=cs.doNotAnything},a.onerror=cs.doNotAnything,a.onblocked=cs.doNotAnything}dbDeleteSaveData(t){const e=this.indexDBOpen();e.onupgradeneeded=cs.doNotAnything,e.onsuccess=()=>{const s=this.getObjectStore(e.result);t.forEach((t=>{s.delete([t,location.href])}))},e.onerror=cs.doNotAnything,e.onblocked=cs.doNotAnything}selectSaveData(){const t=this.indexDBOpen();t.onupgradeneeded=cs.doNotAnything,t.onsuccess=()=>{const e=this.getObjectStore(t.result);this.selectDatas=[];this.getSaveDataResult(e,(t=>{var e,s,i;let a=[];for(s=t.length,e=0;e<s;e++){var r=t[e];try{i={id:r.id,hash:r.hash,data:r.data,date:r.date,image:r.image,worldName:r.worldName,mapDataRevisionKey:r.mapDataRevisionKey}}catch(t){continue}const s=this.onCheckLoadingSaveData(i.worldName,i.hash,i.mapDataRevisionKey);if(null!==s){a.push({id:i.id,cause:s});continue}if(!this[i.id])continue;const n=hs(is.decompress(i.data)[0]);this[i.id].saveDataSet(i.image,n,i.date)}a.length>0&&this.dbDeleteSaveData(a.map((t=>t.id)));const n=a.map((t=>t.cause)).filter(((t,e,s)=>s.indexOf(t)===e));this.onCompleteLoadingSaveData(n)}))},t.onerror=cs.doNotAnything,t.onblocked=cs.doNotAnything}}cs.doNotAnything=()=>{};var _s,ls=cs;class us extends rs{}class ds extends os{constructor(){super(),this._saveNo=0,this._lastAutoSaveMove=0,this._autoInterval=F.SAVE_INTERVAL_MOVE,Object.setPrototypeOf(this,Object.create(ds.prototype));for(var t=0;t<F.QUICK_SAVE_MAX;t++)this[t]=new us(t,this);this._saveNo=0,this._lastAutoSaveMove=0}resumeStart(){this._lastAutoSaveMove=-1}setPlayer(t){this._lastAutoSaveMove=t.getMoveCount()}isAutoSaveFrame(t){if(0===this._autoInterval)return!1;var e=t.getMoveCount();return!(this._lastAutoSaveMove>=e)&&(e%this._autoInterval==0&&(this._lastAutoSaveMove=e,!0))}autoSave(t,e){this[this._saveNo].save(t,e),this._saveNo++,this._saveNo=this._saveNo%F.QUICK_SAVE_MAX}setAutoSaveInterval(t){t<0?console.warn(`オートセーブの歩数 (${t}) に負の値が設定されています。`):this._autoInterval=0|t}}function ps(t,e){return(0,qe.MD5)(t+e).toString()}class ms{constructor(t,e,s,i,a){ms.checkOriginalMapString=t.checkOriginalMapString,ms.worldName=e,ms.mapDataRevisionKey=ps(e,s),this._wwaDBSaveList=new ls(i,a),this._wwaLogSaveList=new ds,this.selectDBSaveDataList()}resumeStart(){this._wwaLogSaveList.resumeStart()}isAutoSaveFrame(t){return this._wwaLogSaveList.isAutoSaveFrame(t)}autoSave(t,e){this._wwaLogSaveList.autoSave(t,e)}selectDBSaveDataList(){this.list=this._wwaDBSaveList}selectLogSaveDataList(){this.list=this._wwaLogSaveList}save(t,e,s){var i=this.list[s];return!!i&&i.save(t,e)}load(t){var e=this.list[t];return e?e.load():null}hasSaveData(){return this.list.hasSaveData()}setAutoSaveInterval(t){return this._wwaLogSaveList.setAutoSaveInterval(t)}getFirstSaveChoiceCallInfo(t){return t?T.CALL_BY_PASSWORD_LOAD:this._wwaDBSaveList.hasSaveData()?T.CALL_BY_QUICK_LOAD:this._wwaLogSaveList.hasSaveData()?T.CALL_BY_LOG_QUICK_LOAD:T.CALL_BY_PASSWORD_LOAD}getSecondSaveChoiceCallInfo(t){return this.list===this._wwaDBSaveList&&this._wwaLogSaveList.hasSaveData()?T.CALL_BY_LOG_QUICK_LOAD:t?T.CALL_BY_PASSWORD_LOAD:T.NONE}gameStart(t,e){this._wwaLogSaveList.setPlayer(e),this.quickSaveButtonUpdate(t)}quickSaveButtonUpdate(t){t.disableSaveFlag?dt("cell-save").textContent=Y.EMPTY_SAVE:dt("cell-save").textContent=Y.QUICK_SAVE}}!function(t){t.UNMATCHED_WORLD_NAME="UNMATCHED_WORLD_NAME",t.UNMATCHED_WORLD_PASS_NUMBER="UNMATCHED_WORLD_PASS_NUMBER",t.DISALLOW_OLD_REVISION_WORLD_SAVE_DATA="DISALLOW_OLD_REVISION_WORLD_SAVE_DATA"}(_s||(_s={}));class Es{constructor(t,e,s,i){this.id=t,this.fileName=e,this.audioContext=s,this.audioGain=i,this.disposeBufferSource=t=>{try{t.stop(),t.disconnect(this.audioGain),t.buffer=null}catch(t){}t.onended=null},this.audioContext=s,this.audioGain=i,this.audioBuffer=null,this.bufferSources=[],this.isLoaded=!1,this.delayBgmTimeoutId=null,this.load()}async fetchSoundFile(){try{return await fetch(this.fileName)}catch(t){return void console.warn(`サウンド ${this.id} 番の音声ファイルの取得失敗 (fetch)`)}}async getArrayBuffer(t){try{return await t.arrayBuffer()}catch(t){return void console.warn(`サウンド ${this.id} 番の音声ファイルの取得失敗 (arrayBuffer)`)}}async load(t=0){if(t>=10)return console.log(`サウンド ${this.id} 番の音声ファイルの取得失敗 (最大リトライ回数超過)`),void(this.isExceededMaxRetryCount=!0);const e=await this.fetchSoundFile();if(!e)return void this.retry(t);if(0!==e.status&&200!==e.status)return console.warn(`サウンド ${this.id} 番の音声ファイルが見つかりません! HTTPエラー番号: ${e.status}`),void this.cancelLoad();const s=await this.getArrayBuffer(e);s?this.audioContext.decodeAudioData(s,(e=>{if(0===e.length)return console.log(`サウンド ${this.id} 番の音声ファイルのバッファサイズが 0 です `),void this.retry(t);this.setData(e)})):this.retry(t)}retry(t){window.setTimeout((async()=>{await this.load(t+1)}),100)}setData(t){this.audioBuffer=t,this.isLoaded=!0}cancelLoad(){this.audioBuffer=null,this.isLoaded=!0}play(t=0){const e=this.audioContext.createBufferSource();this.bufferSources.push(e),e.buffer=this.audioBuffer,this.isBgm()&&(e.loop=!0),e.connect(this.audioGain);let s=e.duration;(!isFinite(s)||s<0||"number"!=typeof s)&&(s=0),e.onended=()=>{const t=this.bufferSources.indexOf(e);-1!==t&&this.bufferSources.splice(t,1),this.disposeBufferSource(e)},this.delayBgmTimeoutId=window.setTimeout((()=>{this.delayBgmTimeoutId=null,e.start()}),t),this.audioGain.connect(this.audioContext.destination)}pause(){null!==this.delayBgmTimeoutId&&(window.clearTimeout(this.delayBgmTimeoutId),this.delayBgmTimeoutId=null),this.bufferSources.forEach(this.disposeBufferSource),this.bufferSources.length=0}isBgm(){return this.id>=R.BGM_LB}hasData(){return null!==this.audioBuffer}isPlaying(){return this.hasData()||null!==this.delayBgmTimeoutId}isLoading(){return!this.isLoaded}isError(){return this.isExceededMaxRetryCount||this.isLoaded&&null===this.audioBuffer}}const gs=(t,e)=>{const s=new Array(t);for(let t=0;t<s.length;t++)s[t]=new Array(e);return s},ws=t=>(t%=256)>=128?t-256:t;var fs;function vs(t,e){const s=function(t){return t[fs.CHECK]+256*t[fs.CHECK+1]}(t),i=function(t,e){let s=0;if(t[fs.VERSION]>=29){for(let i=2;i<e;i++)s+=ws(t[i])*(i%8+1);s=s%65536&65535}return s}(t,e);if(s!==i)throw new Error("マップデータが壊れているようです。\n チェックサムの値は"+s+"ですが、実際の和は"+i+"でした。")}!function(t){t[t.CHECK=0]="CHECK",t[t.VERSION=2]="VERSION",t[t.OLD_MAP_COUNT=3]="OLD_MAP_COUNT",t[t.OLD_OBJ_COUNT=4]="OLD_OBJ_COUNT",t[t.OLD_PLAYER_X=5]="OLD_PLAYER_X",t[t.OLD_PLAYER_Y=6]="OLD_PLAYER_Y",t[t.STATUS_ENERGY=10]="STATUS_ENERGY",t[t.STATUS_STRENGTH=12]="STATUS_STRENGTH",t[t.STATUS_DEFENCE=14]="STATUS_DEFENCE",t[t.STATUS_GOLD=16]="STATUS_GOLD",t[t.OLD_GAMEOVER_X=18]="OLD_GAMEOVER_X",t[t.OLD_GAMEOVER_Y=19]="OLD_GAMEOVER_Y",t[t.OLD_ITEMBOX_TOP=20]="OLD_ITEMBOX_TOP",t[t.STATUS_ENERGY_MAX=32]="STATUS_ENERGY_MAX",t[t.MAP_COUNT=34]="MAP_COUNT",t[t.OBJ_COUNT=36]="OBJ_COUNT",t[t.PLAYER_X=38]="PLAYER_X",t[t.PLAYER_Y=40]="PLAYER_Y",t[t.GAMEOVER_X=42]="GAMEOVER_X",t[t.GAMEOVER_Y=44]="GAMEOVER_Y",t[t.MAP_SIZE=46]="MAP_SIZE",t[t.MESSAGE_NUM=48]="MESSAGE_NUM",t[t.ITEMBOX_TOP=60]="ITEMBOX_TOP",t[t.MAPDATA_TOP=90]="MAPDATA_TOP",t[t.OLD_MAPDATA_TOP=100]="OLD_MAPDATA_TOP"}(fs||(fs={}));class ys{constructor(t,e,s){this.byteMapData=t,this.eventEmitter=s,vs(t,e),this.wwaData={version:void 0,gameoverX:void 0,gameoverY:void 0,playerX:void 0,playerY:void 0,mapPartsMax:void 0,objPartsMax:void 0,isOldMap:void 0,isOldMove:void 0,statusEnergyMax:void 0,statusEnergy:void 0,statusStrength:void 0,statusDefence:void 0,statusGold:void 0,itemBox:void 0,mapWidth:void 0,messageNum:void 0,map:void 0,mapObject:void 0,mapCompressed:void 0,mapObjectCompressed:void 0,mapAttribute:void 0,objectAttribute:void 0,worldPassword:void 0,message:void 0,worldName:void 0,worldPassNumber:void 0,charCGName:void 0,mapCGName:void 0,systemMessage:void 0,moves:void 0,yesnoImgPosX:void 0,yesnoImgPosY:void 0,playerImgPosX:void 0,playerImgPosY:void 0,clickableItemSignImgPosX:void 0,clickableItemSignImgPosY:void 0,disableSaveFlag:void 0,compatibleForOldMapFlag:void 0,objectNoCollapseDefaultFlag:void 0,delPlayerFlag:void 0,bgm:void 0,effectCoords:void 0,effectWaits:void 0,imgStatusEnergyX:void 0,imgStatusEnergyY:void 0,imgStatusStrengthX:void 0,imgStatusStrengthY:void 0,imgStatusDefenceX:void 0,imgStatusDefenceY:void 0,imgStatusGoldX:void 0,imgStatusGoldY:void 0,imgWideCellX:void 0,imgWideCellY:void 0,imgItemboxX:void 0,imgItemboxY:void 0,imgFrameX:void 0,imgFrameY:void 0,imgBattleEffectX:void 0,imgBattleEffectY:void 0,imgClickX:void 0,imgClickY:void 0,frameColorR:void 0,frameColorG:void 0,frameColorB:void 0,frameOutColorR:void 0,frameOutColorG:void 0,frameOutColorB:void 0,fontColorR:void 0,fontColorG:void 0,fontColorB:void 0,statusColorR:void 0,statusColorG:void 0,statusColorB:void 0,checkOriginalMapString:void 0,checkString:void 0,isItemEffectEnabled:void 0,frameCount:void 0,gamePadButtonItemTable:void 0,userVar:void 0,userNamedVar:void 0,permitChangeGameSpeed:void 0,gameSpeedIndex:void 0,playTime:void 0,isVisibleStatusEnergy:void 0,isVisibleStatusStrength:void 0,isVisibleStatusDefence:void 0,isVisibleStatusGold:void 0,isGameOverDisabled:void 0,gameOverPolicy:"default",bgmDelayDurationMs:void 0,customSystemMessages:{},pictureRegistry:[]}}extractAllData(){var t,e;return this.wwaData.version=this.byteMapData[fs.VERSION],this._extractInitialParameters(),this.wwaData.version>=29?this.currentPosition=fs.MAPDATA_TOP:this.currentPosition=fs.OLD_MAPDATA_TOP,this.wwaData.map=this._getFieldDataFromBits(Ee.MAP,this.wwaData.mapPartsMax).concat(),this.wwaData.mapObject=this._getFieldDataFromBits(Ee.OBJECT,this.wwaData.objPartsMax).concat(),t=this.wwaData.version>29?me.MAP_ATR_MAX:me.OLD_MAP_ATR_MAX,e=this.wwaData.version>29?me.OBJ_ATR_MAX:me.OLD_OBJ_ATR_MAX,this.wwaData.mapAttribute=this._getPartsDataFromBits(Ee.MAP,this.wwaData.mapPartsMax,t).concat(),this.wwaData.objectAttribute=this._getPartsDataFromBits(Ee.OBJECT,this.wwaData.objPartsMax,e).concat(),this.wwaData.version<=29&&(this._convertAttributeV2toV3(Ee.MAP),this._convertAttributeV2toV3(Ee.OBJECT)),this._replaceAllRandomObjects(),this.wwaData}_convertAttributeV2toV3(t){var e,s,i;if(t==Ee.MAP)e=this.wwaData.mapPartsMax,s=this.wwaData.mapAttribute,i=me.MAP_LOCALGATE;else{if(t!=Ee.OBJECT)throw new Error("謎のパーツ種別が指定されました");e=this.wwaData.objPartsMax,s=this.wwaData.objectAttribute,i=me.OBJECT_LOCALGATE}for(var a=0;a<e;a++){for(var r=9;r>=0;r--){var n=255&s[a][20+2*r],o=s[a][20+2*r]>>8,h=255&s[a][20+2*r+1],c=s[a][20+2*r+1]>>8;250===h?h=9e3:h>100&&(h+=9840),250===c?c=9e3:c>100&&(c+=9840),s[a][20+4*r]=n,s[a][20+4*r+3]=o,s[a][20+4*r+1]=h,s[a][20+4*r+2]=c}s[a][me.ATR_TYPE]===i&&(s[a][me.ATR_JUMP_X]>100&&(s[a][me.ATR_JUMP_X]+=9840),s[a][me.ATR_JUMP_Y]>100&&(s[a][me.ATR_JUMP_Y]+=9840))}}_get1ByteNumber(t){return this.byteMapData[t]}_get2BytesNumber(t){return this.byteMapData[t]+256*this.byteMapData[t+1]}_extractInitialParameters(){this.wwaData.version>29?(this.wwaData.gameoverX=this._get2BytesNumber(fs.GAMEOVER_X),this.wwaData.gameoverY=this._get2BytesNumber(fs.GAMEOVER_Y),this.wwaData.playerX=this._get2BytesNumber(fs.PLAYER_X),this.wwaData.playerY=this._get2BytesNumber(fs.PLAYER_Y),this.wwaData.mapPartsMax=this._get2BytesNumber(fs.MAP_COUNT),this.wwaData.objPartsMax=this._get2BytesNumber(fs.OBJ_COUNT),this.wwaData.isOldMap=!1):(this.wwaData.gameoverX=this._get1ByteNumber(fs.OLD_GAMEOVER_X),this.wwaData.gameoverY=this._get1ByteNumber(fs.OLD_GAMEOVER_Y),this.wwaData.playerX=this._get1ByteNumber(fs.OLD_PLAYER_X),this.wwaData.playerY=this._get1ByteNumber(fs.OLD_PLAYER_Y),this.wwaData.mapPartsMax=this._get1ByteNumber(fs.OLD_MAP_COUNT),this.wwaData.objPartsMax=this._get1ByteNumber(fs.OLD_OBJ_COUNT),this.wwaData.isOldMap=!0),this.wwaData.statusEnergyMax=this._get2BytesNumber(fs.STATUS_ENERGY_MAX),this.wwaData.statusEnergy=this._get2BytesNumber(fs.STATUS_ENERGY),this.wwaData.statusStrength=this._get2BytesNumber(fs.STATUS_STRENGTH),this.wwaData.statusDefence=this._get2BytesNumber(fs.STATUS_DEFENCE),this.wwaData.statusGold=this._get2BytesNumber(fs.STATUS_GOLD),this._extractInitialItemData(),this.wwaData.mapWidth=this._get2BytesNumber(fs.MAP_SIZE),this.wwaData.messageNum=this._get2BytesNumber(fs.MESSAGE_NUM),this.wwaData.version<28?this.wwaData.mapWidth=71:this.wwaData.version<=29&&(this.wwaData.mapWidth=101)}_extractInitialItemData(){const t=this.wwaData.version>29?fs.ITEMBOX_TOP:fs.OLD_ITEMBOX_TOP;this.wwaData.itemBox=new Array(me.ITEMBOX_SIZE);for(let e=0;e<me.ITEMBOX_SIZE;e++)this.wwaData.itemBox[e]=this._get1ByteNumber(t+e)}_getFieldDataFromBits(t,e){var s,i,a;for(a=gs(this.wwaData.mapWidth,this.wwaData.mapWidth),s=0;s<this.wwaData.mapWidth;s++)for(i=0;i<this.wwaData.mapWidth;i++)this.wwaData.version>29?(a[s][i]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(a[s][i]=this._get1ByteNumber(this.currentPosition),this.currentPosition+=1),(s*this.wwaData.mapWidth+i)%200==0&&this.emitProgress(s*this.wwaData.mapWidth+i,this.wwaData.mapWidth*this.wwaData.mapWidth,t===Ee.MAP?ge.MAP_LOAD:ge.OBJ_LOAD),a[s][i]>=e&&(a[s][i]=0);return this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,t===Ee.MAP?ge.MAP_LOAD:ge.OBJ_LOAD),a}_getPartsDataFromBits(t,e,s){var i,a,r;for(r=gs(e,s),i=0;i<e;i++)for(a=0;a<s;a++)(i*this.wwaData.mapWidth+a)%200==0&&this.emitProgress(i*s+a,e*s,t===Ee.MAP?ge.MAP_ATTR:ge.OBJ_ATTR),a!==me.ATR_CROP1&&a!==me.ATR_CROP2?(r[i][a]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(r[i][a]=0,this.currentPosition+=2);return this.emitProgress(e*s,e*s,t===Ee.MAP?ge.MAP_ATTR:ge.OBJ_ATTR),r}_replaceAllRandomObjects(){this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,ge.RAND_PARTS)}emitProgress(t,e,s){this.eventEmitter.dispatch("progress",{current:t,total:e,stage:s})}}class Ss{constructor(t,e,s,i){this.wwaData=t,this.compressedMapData=e,this.startPosition=s,this.eventEmitter=i,this.OLDVER_MESSAGE_MAX=400}load(){const t=this.wwaData;this.currentPos=this.startPosition,t.version>=30&&(t.worldPassword=this.getMessageFromData()),t.version<=29&&(t.messageNum=this.OLDVER_MESSAGE_MAX),t.message=new Array(t.messageNum);for(let e=0;e<t.message.length;e++)t.message[e]=this.getMessageFromData(),e%200==0&&this.eventEmitter.dispatch("progress",{current:e,total:t.message.length,stage:ge.MESSAGE});for(;t.messageNum<10;)t.message.push(""),t.messageNum++;this.eventEmitter.dispatch("progress",{current:t.message.length,total:t.message.length,stage:ge.MESSAGE}),t.worldName=this.getMessageFromData(),t.version<=29?t.worldPassword=this.getMessageFromData():this.getMessageFromData(),""===t.worldPassword?t.worldPassNumber=0:t.version>=29?t.worldPassNumber=(parseInt(t.worldPassword)/10-1197)/17-2357:t.worldPassNumber=parseInt(t.worldPassword),t.charCGName=this.getMessageFromData(),t.mapCGName=this.getMessageFromData(),t.systemMessage=new Array(me.SYSTEM_MESSAGE_NUM);for(let e=0;e<me.SYSTEM_MESSAGE_NUM;e++)t.version>=30?t.systemMessage[e]=this.getMessageFromData():t.systemMessage[e]="";return t.yesnoImgPosX=me.IMGPOS_DEFAULT_YESNO_X,t.yesnoImgPosY=me.IMGPOS_DEFAULT_YESNO_Y,t.playerImgPosX=me.IMGPOS_DEFAULT_PLAYER_X,t.playerImgPosY=me.IMGPOS_DEFAULT_PLAYER_Y,t.clickableItemSignImgPosX=me.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X,t.clickableItemSignImgPosY=me.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y,t.disableSaveFlag=me.DEFAULT_DISABLE_SAVE,t.isOldMap=me.DEFAULT_OLDMAP,t.isOldMove=t.version<31,t.objectNoCollapseDefaultFlag=me.DEFAULT_OBJECT_NO_COLLAPSE,t.delPlayerFlag=!1,t.bgm=0,t.effectCoords=[],t.effectWaits=0,t.imgStatusEnergyX=me.IMGPOS_DEFAULT_STATUS_X+me.IMGRELPOS_ENERGY_ICON_X,t.imgStatusEnergyY=me.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusStrengthX=me.IMGPOS_DEFAULT_STATUS_X+me.IMGRELPOS_STRENGTH_ICON_X,t.imgStatusStrengthY=me.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusDefenceX=me.IMGPOS_DEFAULT_STATUS_X+me.IMGRELPOS_DEFENCE_ICON_X,t.imgStatusDefenceY=me.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusGoldX=me.IMGPOS_DEFAULT_STATUS_X+me.IMGRELPOS_GOLD_ICON_X,t.imgStatusGoldY=me.IMGPOS_DEFAULT_STATUS_Y,t.imgWideCellX=me.IMGPOS_DEFAULT_WIDE_CELL_X,t.imgWideCellY=me.IMGPOS_DEFAULT_WIDE_CELL_Y,t.imgItemboxX=me.IMGPOS_DEFAULT_ITEMBOX_X,t.imgItemboxY=me.IMGPOS_DEFAULT_ITEMBOX_Y,t.imgFrameX=me.IMGPOS_DEFAULT_FRAME_X,t.imgFrameY=me.IMGPOS_DEFAULT_FRAME_Y,t.imgBattleEffectX=me.IMGPOS_DEFAULT_BATTLE_EFFECT_X,t.imgBattleEffectY=me.IMGPOS_DEFAULT_BATTLE_EFFECT_Y,t.imgClickX=0,t.imgClickY=0,t.frameColorR=me.DEFAULT_FRAME_COLOR_R,t.frameColorG=me.DEFAULT_FRAME_COLOR_G,t.frameColorB=me.DEFAULT_FRAME_COLOR_B,t.frameOutColorR=me.DEFAULT_FRAMEOUT_COLOR_R,t.frameOutColorG=me.DEFAULT_FRAMEOUT_COLOR_G,t.frameOutColorB=me.DEFAULT_FRAMEOUT_COLOR_B,t.fontColorR=me.DEFAULT_STR_COLOR_R,t.fontColorG=me.DEFAULT_STR_COLOR_G,t.fontColorB=me.DEFAULT_STR_COLOR_B,t.statusColorR=me.DEFAULT_STATUS_COLOR_R,t.statusColorG=me.DEFAULT_STATUS_COLOR_G,t.statusColorB=me.DEFAULT_STATUS_COLOR_B,t.moves=me.DEFAULT_MOVES,t.gameSpeedIndex=me.DEFAULT_SPEED_INDEX,t.permitChangeGameSpeed=!0,t.userVar=Array.from({length:me.USER_VAR_NUM}).map((()=>0)),t.userNamedVar=[],t.playTime=0,t.isVisibleStatusEnergy=!0,t.isVisibleStatusStrength=!0,t.isVisibleStatusDefence=!0,t.isVisibleStatusGold=!0,t.gameOverPolicy="default",t.bgmDelayDurationMs=0,t.pictureRegistry=[],t}getMessageFromData(){let t="",e=0;for(e=0;e<1500&&(0!=this.compressedMapData[this.currentPos+2*e]||0!=this.compressedMapData[this.currentPos+2*e+1]);e++)t+=String.fromCharCode((this.compressedMapData[this.currentPos+2*e+1]<<8)+this.compressedMapData[this.currentPos+2*e]);return this.currentPos+=2*e+2,t}}class As{constructor(){}}class Ts extends As{constructor(t){super(),this.uri=t}static async fetch(t){try{return await fetch(t)}catch(e){throw new Error(`マップデータ 「${t}」の読み込みに失敗しました。\n 通信環境の良いところで再度お試しください。\n ローカルテストの場合は、ブラウザが対応していない可能性があります。`)}}static handleError(t,e){const s=`HTTPステータスコードは ${e.status} です。`;switch(e.status){case 200:case 304:return;case 403:throw new Error(`マップデータ「${t}」を読み取る権限がないようです。\n 管理者の方へ: マップデータのパーミッションを確認してください。\n ${s}`);case 404:throw new Error(`マップデータ「${t}」が見つかりませんでした。\n ${s}`);default:throw new Error(`マップデータ「${t}」の読み込みに失敗しました。\n ${s}`)}}async request(){const t=await Ts.fetch(this.uri);Ts.handleError(this.uri,t);return await t.arrayBuffer()}}var Is=s(106),Cs=s.n(Is);class Ps extends As{constructor(t){super(),this.fileName=t}async request(){return new Promise(((t,e)=>{Cs().readFile(this.fileName,((s,i)=>{s&&e(s),t(i.buffer)}))}))}}class Ds{constructor(t,e){this.fileName=t,this.eventEmitter=e}async requestAndLoadMapData(){const t=(e=this.fileName,"undefined"!=typeof window?new Ts(e):new Ps(e));var e;try{const e=await t.request();if(!e)return void this.eventEmitter.dispatch("error",{name:"マップデータ取得に失敗しました",message:"mapdata is empty"});const s=this.loadMapData(e);this.eventEmitter.dispatch("mapData",s)}catch(t){const e=t.name||"",s=t.message||"";this.eventEmitter.dispatch("error",{name:e,message:s})}}loadMapData(t){try{const e=new Uint8Array(t),{byteMapData:s,byteMapLength:i,compressedEndPosition:a}=function(t){let e,s,i=new Uint8Array(t.length);for(e=0,s=0;e<t.length&&(0!==t[e]||0!==t[e+1]||0!==t[e+2]);e++){if(i[s++]=t[e],t[e]===t[e+1]){const a=t[e+2];for(let r=0;r<a;r++)i[s++]=t[e];e+=2}if(s+255>=i.length){var a=new Uint8Array(i.length+65e3);a.set(i),i=a}}return console.log("EXTRACT DATA = "+s+" "+e),{byteMapData:i,byteMapLength:s,compressedEndPosition:e+3}}(e),r=new ys(s,i,this.eventEmitter).extractAllData();return new Ss(r,e,a,this.eventEmitter).load()}catch(t){throw t}}}class Ns{constructor(t){this.target=null!=t?t:document.createElement("div")}dispatch(t,e){const s=new CustomEvent(t,{detail:e});this.target.dispatchEvent(s)}addListener(t,e){const s=t=>e(t.detail);return this.target.addEventListener(t,s),s}removeListener(t,e){this.target.removeEventListener(t,e)}}var Os={3:"abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile",5:"class enum extends super const export import",6:"enum",strict:"implements interface let package private protected public static yield",strictBind:"eval arguments"},bs="break case catch continue debugger default do else finally for function if return switch throw try var while with null true false instanceof typeof void delete new in this",Ms={5:bs,"5module":bs+" export import",6:bs+" const class extends export import super"},xs=/^in(stanceof)?$/,Ls="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԯԱ-Ֆՙՠ-ֈא-תׯ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࡠ-ࡪࢠ-ࢴࢶ-ࣇऄ-हऽॐक़-ॡॱ-ঀঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱৼਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡૹଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-హఽౘ-ౚౠౡಀಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഄ-ഌഎ-ഐഒ-ഺഽൎൔ-ൖൟ-ൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄຆ-ຊຌ-ຣລວ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏽᏸ-ᏽᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡸᢀ-ᢨᢪᢰ-ᣵᤀ-ᤞᥐ-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᲀ-ᲈᲐ-ᲺᲽ-Ჿᳩ-ᳬᳮ-ᳳᳵᳶᳺᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕ℘-ℝℤΩℨK-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞ々-〇〡-〩〱-〵〸-〼ぁ-ゖ゛-ゟァ-ヺー-ヿㄅ-ㄯㄱ-ㆎㆠ-ㆿㇰ-ㇿ㐀-䶿一-鿼ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚝꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞿꟂ-ꟊꟵ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꣽꣾꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꧠ-ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꩾ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ꭚꭜ-ꭩꭰ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ",Rs="‌‍·̀-ͯ·҃-֑҇-ׇֽֿׁׂׅׄؐ-ًؚ-٩ٰۖ-ۜ۟-۪ۤۧۨ-ۭ۰-۹ܑܰ-݊ަ-ް߀-߉߫-߽߳ࠖ-࠙ࠛ-ࠣࠥ-ࠧࠩ-࡙࠭-࡛࣓-ࣣ࣡-ःऺ-़ा-ॏ॑-ॗॢॣ०-९ঁ-ঃ়া-ৄেৈো-্ৗৢৣ০-৯৾ਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢૣ૦-૯ૺ-૿ଁ-ଃ଼ା-ୄେୈୋ-୍୕-ୗୢୣ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఀ-ఄా-ౄె-ైొ-్ౕౖౢౣ౦-౯ಁ-ಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢೣ೦-೯ഀ-ഃ഻഼ാ-ൄെ-ൈൊ-്ൗൢൣ൦-൯ඁ-ඃ්ා-ුූෘ-ෟ෦-෯ෲෳัิ-ฺ็-๎๐-๙ັິ-ຼ່-ໍ໐-໙༘༙༠-༩༹༵༷༾༿ཱ-྄྆྇ྍ-ྗྙ-ྼ࿆ါ-ှ၀-၉ၖ-ၙၞ-ၠၢ-ၤၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟፩-፱ᜒ-᜔ᜲ-᜴ᝒᝓᝲᝳ឴-៓៝០-៩᠋-᠍᠐-᠙ᢩᤠ-ᤫᤰ-᤻᥆-᥏᧐-᧚ᨗ-ᨛᩕ-ᩞ᩠-᩿᩼-᪉᪐-᪙᪰-᪽ᪿᫀᬀ-ᬄ᬴-᭄᭐-᭙᭫-᭳ᮀ-ᮂᮡ-ᮭ᮰-᮹᯦-᯳ᰤ-᰷᱀-᱉᱐-᱙᳐-᳔᳒-᳨᳭᳴᳷-᳹᷀-᷹᷻-᷿‿⁀⁔⃐-⃥⃜⃡-⃰⳯-⵿⳱ⷠ-〪ⷿ-゙゚〯꘠-꘩꙯ꙴ-꙽ꚞꚟ꛰꛱ꠂ꠆ꠋꠣ-ꠧ꠬ꢀꢁꢴ-ꣅ꣐-꣙꣠-꣱ꣿ-꤉ꤦ-꤭ꥇ-꥓ꦀ-ꦃ꦳-꧀꧐-꧙ꧥ꧰-꧹ꨩ-ꨶꩃꩌꩍ꩐-꩙ꩻ-ꩽꪰꪲ-ꪴꪷꪸꪾ꪿꫁ꫫ-ꫯꫵ꫶ꯣ-ꯪ꯬꯭꯰-꯹ﬞ︀-️︠-︯︳︴﹍-﹏0-9_",Bs=new RegExp("["+Ls+"]"),Us=new RegExp("["+Ls+Rs+"]");Ls=Rs=null;var ks=[0,11,2,25,2,18,2,1,2,14,3,13,35,122,70,52,268,28,4,48,48,31,14,29,6,37,11,29,3,35,5,7,2,4,43,157,19,35,5,35,5,39,9,51,157,310,10,21,11,7,153,5,3,0,2,43,2,1,4,0,3,22,11,22,10,30,66,18,2,1,11,21,11,25,71,55,7,1,65,0,16,3,2,2,2,28,43,28,4,28,36,7,2,27,28,53,11,21,11,18,14,17,111,72,56,50,14,50,14,35,349,41,7,1,79,28,11,0,9,21,107,20,28,22,13,52,76,44,33,24,27,35,30,0,3,0,9,34,4,0,13,47,15,3,22,0,2,0,36,17,2,24,85,6,2,0,2,3,2,14,2,9,8,46,39,7,3,1,3,21,2,6,2,1,2,4,4,0,19,0,13,4,159,52,19,3,21,2,31,47,21,1,2,0,185,46,42,3,37,47,21,0,60,42,14,0,72,26,230,43,117,63,32,7,3,0,3,7,2,1,2,23,16,0,2,0,95,7,3,38,17,0,2,0,29,0,11,39,8,0,22,0,12,45,20,0,35,56,264,8,2,36,18,0,50,29,113,6,2,1,2,37,22,0,26,5,2,1,2,31,15,0,328,18,190,0,80,921,103,110,18,195,2749,1070,4050,582,8634,568,8,30,114,29,19,47,17,3,32,20,6,18,689,63,129,74,6,0,67,12,65,1,2,0,29,6135,9,1237,43,8,8952,286,50,2,18,3,9,395,2309,106,6,12,4,8,8,9,5991,84,2,70,2,1,3,0,3,1,3,3,2,11,2,0,2,6,2,64,2,3,3,7,2,6,2,27,2,3,2,4,2,0,4,6,2,339,3,24,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,30,2,24,2,7,2357,44,11,6,17,0,370,43,1301,196,60,67,8,0,1205,3,2,26,2,1,2,0,3,0,2,9,2,3,2,0,2,0,7,0,5,0,2,0,2,0,2,2,2,1,2,0,3,0,2,0,2,0,2,0,2,0,2,1,2,0,3,3,2,6,2,3,2,3,2,0,2,9,2,16,6,2,2,4,2,16,4421,42717,35,4148,12,221,3,5761,15,7472,3104,541,1507,4938],Ws=[509,0,227,0,150,4,294,9,1368,2,2,1,6,3,41,2,5,0,166,1,574,3,9,9,370,1,154,10,176,2,54,14,32,9,16,3,46,10,54,9,7,2,37,13,2,9,6,1,45,0,13,2,49,13,9,3,2,11,83,11,7,0,161,11,6,9,7,3,56,1,2,6,3,1,3,2,10,0,11,1,3,6,4,4,193,17,10,9,5,0,82,19,13,9,214,6,3,8,28,1,83,16,16,9,82,12,9,9,84,14,5,9,243,14,166,9,71,5,2,1,3,3,2,0,2,1,13,9,120,6,3,6,4,0,29,9,41,6,2,3,9,0,10,10,47,15,406,7,2,7,17,9,57,21,2,13,123,5,4,0,2,1,2,6,2,0,9,9,49,4,2,1,2,4,9,9,330,3,19306,9,135,4,60,6,26,9,1014,0,2,54,8,3,82,0,12,1,19628,1,5319,4,4,5,9,7,3,6,31,3,149,2,1418,49,513,54,5,49,9,0,15,0,23,4,2,14,1361,6,2,16,3,6,2,1,2,4,262,6,10,9,419,13,1495,6,110,6,6,9,4759,9,787719,239];function Vs(t,e){for(var s=65536,i=0;i<e.length;i+=2){if((s+=e[i])>t)return!1;if((s+=e[i+1])>=t)return!0}}function Fs(t,e){return t<65?36===t:t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&Bs.test(String.fromCharCode(t)):!1!==e&&Vs(t,ks)))}function Ys(t,e){return t<48?36===t:t<58||!(t<65)&&(t<91||(t<97?95===t:t<123||(t<=65535?t>=170&&Us.test(String.fromCharCode(t)):!1!==e&&(Vs(t,ks)||Vs(t,Ws)))))}var Gs=function(t,e){void 0===e&&(e={}),this.label=t,this.keyword=e.keyword,this.beforeExpr=!!e.beforeExpr,this.startsExpr=!!e.startsExpr,this.isLoop=!!e.isLoop,this.isAssign=!!e.isAssign,this.prefix=!!e.prefix,this.postfix=!!e.postfix,this.binop=e.binop||null,this.updateContext=null};function Hs(t,e){return new Gs(t,{beforeExpr:!0,binop:e})}var Ks={beforeExpr:!0},js={startsExpr:!0},Xs={};function Js(t,e){return void 0===e&&(e={}),e.keyword=t,Xs[t]=new Gs(t,e)}var $s={num:new Gs("num",js),regexp:new Gs("regexp",js),string:new Gs("string",js),name:new Gs("name",js),eof:new Gs("eof"),bracketL:new Gs("[",{beforeExpr:!0,startsExpr:!0}),bracketR:new Gs("]"),braceL:new Gs("{",{beforeExpr:!0,startsExpr:!0}),braceR:new Gs("}"),parenL:new Gs("(",{beforeExpr:!0,startsExpr:!0}),parenR:new Gs(")"),comma:new Gs(",",Ks),semi:new Gs(";",Ks),colon:new Gs(":",Ks),dot:new Gs("."),question:new Gs("?",Ks),questionDot:new Gs("?."),arrow:new Gs("=>",Ks),template:new Gs("template"),invalidTemplate:new Gs("invalidTemplate"),ellipsis:new Gs("...",Ks),backQuote:new Gs("`",js),dollarBraceL:new Gs("${",{beforeExpr:!0,startsExpr:!0}),eq:new Gs("=",{beforeExpr:!0,isAssign:!0}),assign:new Gs("_=",{beforeExpr:!0,isAssign:!0}),incDec:new Gs("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new Gs("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:Hs("||",1),logicalAND:Hs("&&",2),bitwiseOR:Hs("|",3),bitwiseXOR:Hs("^",4),bitwiseAND:Hs("&",5),equality:Hs("==/!=/===/!==",6),relational:Hs("</>/<=/>=",7),bitShift:Hs("<</>>/>>>",8),plusMin:new Gs("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:Hs("%",10),star:Hs("*",10),slash:Hs("/",10),starstar:new Gs("**",{beforeExpr:!0}),coalesce:Hs("??",1),_break:Js("break"),_case:Js("case",Ks),_catch:Js("catch"),_continue:Js("continue"),_debugger:Js("debugger"),_default:Js("default",Ks),_do:Js("do",{isLoop:!0,beforeExpr:!0}),_else:Js("else",Ks),_finally:Js("finally"),_for:Js("for",{isLoop:!0}),_function:Js("function",js),_if:Js("if"),_return:Js("return",Ks),_switch:Js("switch"),_throw:Js("throw",Ks),_try:Js("try"),_var:Js("var"),_const:Js("const"),_while:Js("while",{isLoop:!0}),_with:Js("with"),_new:Js("new",{beforeExpr:!0,startsExpr:!0}),_this:Js("this",js),_super:Js("super",js),_class:Js("class",js),_extends:Js("extends",Ks),_export:Js("export"),_import:Js("import",js),_null:Js("null",js),_true:Js("true",js),_false:Js("false",js),_in:Js("in",{beforeExpr:!0,binop:7}),_instanceof:Js("instanceof",{beforeExpr:!0,binop:7}),_typeof:Js("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:Js("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:Js("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},Zs=/\r\n?|\n|\u2028|\u2029/,qs=new RegExp(Zs.source,"g");function zs(t,e){return 10===t||13===t||!e&&(8232===t||8233===t)}var Qs=/[\u1680\u2000-\u200a\u202f\u205f\u3000\ufeff]/,ti=/(?:\s|\/\/.*|\/\*[^]*?\*\/)*/g,ei=Object.prototype,si=ei.hasOwnProperty,ii=ei.toString;function ai(t,e){return si.call(t,e)}var ri=Array.isArray||function(t){return"[object Array]"===ii.call(t)};function ni(t){return new RegExp("^(?:"+t.replace(/ /g,"|")+")$")}var oi=function(t,e){this.line=t,this.column=e};oi.prototype.offset=function(t){return new oi(this.line,this.column+t)};var hi=function(t,e,s){this.start=e,this.end=s,null!==t.sourceFile&&(this.source=t.sourceFile)};function ci(t,e){for(var s=1,i=0;;){qs.lastIndex=i;var a=qs.exec(t);if(!(a&&a.index<e))return new oi(s,e-i);++s,i=a.index+a[0].length}}var _i={ecmaVersion:10,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!1,allowImportExportEverywhere:!1,allowAwaitOutsideFunction:!1,allowHashBang:!1,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1};function li(t){var e={};for(var s in _i)e[s]=t&&ai(t,s)?t[s]:_i[s];if(e.ecmaVersion>=2015&&(e.ecmaVersion-=2009),null==e.allowReserved&&(e.allowReserved=e.ecmaVersion<5),ri(e.onToken)){var i=e.onToken;e.onToken=function(t){return i.push(t)}}return ri(e.onComment)&&(e.onComment=function(t,e){return function(s,i,a,r,n,o){var h={type:s?"Block":"Line",value:i,start:a,end:r};t.locations&&(h.loc=new hi(this,n,o)),t.ranges&&(h.range=[a,r]),e.push(h)}}(e,e.onComment)),e}function ui(t,e){return 2|(t?4:0)|(e?8:0)}var di=function(t,e,s){this.options=t=li(t),this.sourceFile=t.sourceFile,this.keywords=ni(Ms[t.ecmaVersion>=6?6:"module"===t.sourceType?"5module":5]);var i="";if(!0!==t.allowReserved){for(var a=t.ecmaVersion;!(i=Os[a]);a--);"module"===t.sourceType&&(i+=" await")}this.reservedWords=ni(i);var r=(i?i+" ":"")+Os.strict;this.reservedWordsStrict=ni(r),this.reservedWordsStrictBind=ni(r+" "+Os.strictBind),this.input=String(e),this.containsEsc=!1,s?(this.pos=s,this.lineStart=this.input.lastIndexOf("\n",s-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(Zs).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=$s.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===t.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports={},0===this.pos&&t.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null},pi={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0}};di.prototype.parse=function(){var t=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(t)},pi.inFunction.get=function(){return(2&this.currentVarScope().flags)>0},pi.inGenerator.get=function(){return(8&this.currentVarScope().flags)>0},pi.inAsync.get=function(){return(4&this.currentVarScope().flags)>0},pi.allowSuper.get=function(){return(64&this.currentThisScope().flags)>0},pi.allowDirectSuper.get=function(){return(128&this.currentThisScope().flags)>0},pi.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},di.prototype.inNonArrowFunction=function(){return(2&this.currentThisScope().flags)>0},di.extend=function(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];for(var s=this,i=0;i<t.length;i++)s=t[i](s);return s},di.parse=function(t,e){return new this(e,t).parse()},di.parseExpressionAt=function(t,e,s){var i=new this(s,t,e);return i.nextToken(),i.parseExpression()},di.tokenizer=function(t,e){return new this(e,t)},Object.defineProperties(di.prototype,pi);var mi=di.prototype,Ei=/^(?:'((?:\\.|[^'\\])*?)'|"((?:\\.|[^"\\])*?)")/;function gi(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}mi.strictDirective=function(t){for(;;){ti.lastIndex=t,t+=ti.exec(this.input)[0].length;var e=Ei.exec(this.input.slice(t));if(!e)return!1;if("use strict"===(e[1]||e[2])){ti.lastIndex=t+e[0].length;var s=ti.exec(this.input),i=s.index+s[0].length,a=this.input.charAt(i);return";"===a||"}"===a||Zs.test(s[0])&&!(/[(`.[+\-/*%<>=,?^&]/.test(a)||"!"===a&&"="===this.input.charAt(i+1))}t+=e[0].length,ti.lastIndex=t,t+=ti.exec(this.input)[0].length,";"===this.input[t]&&t++}},mi.eat=function(t){return this.type===t&&(this.next(),!0)},mi.isContextual=function(t){return this.type===$s.name&&this.value===t&&!this.containsEsc},mi.eatContextual=function(t){return!!this.isContextual(t)&&(this.next(),!0)},mi.expectContextual=function(t){this.eatContextual(t)||this.unexpected()},mi.canInsertSemicolon=function(){return this.type===$s.eof||this.type===$s.braceR||Zs.test(this.input.slice(this.lastTokEnd,this.start))},mi.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},mi.semicolon=function(){this.eat($s.semi)||this.insertSemicolon()||this.unexpected()},mi.afterTrailingComma=function(t,e){if(this.type===t)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),e||this.next(),!0},mi.expect=function(t){this.eat(t)||this.unexpected()},mi.unexpected=function(t){this.raise(null!=t?t:this.start,"Unexpected token")},mi.checkPatternErrors=function(t,e){if(t){t.trailingComma>-1&&this.raiseRecoverable(t.trailingComma,"Comma is not permitted after the rest element");var s=e?t.parenthesizedAssign:t.parenthesizedBind;s>-1&&this.raiseRecoverable(s,"Parenthesized pattern")}},mi.checkExpressionErrors=function(t,e){if(!t)return!1;var s=t.shorthandAssign,i=t.doubleProto;if(!e)return s>=0||i>=0;s>=0&&this.raise(s,"Shorthand property assignments are valid only in destructuring patterns"),i>=0&&this.raiseRecoverable(i,"Redefinition of __proto__ property")},mi.checkYieldAwaitInDefaultParams=function(){this.yieldPos&&(!this.awaitPos||this.yieldPos<this.awaitPos)&&this.raise(this.yieldPos,"Yield expression cannot be a default value"),this.awaitPos&&this.raise(this.awaitPos,"Await expression cannot be a default value")},mi.isSimpleAssignTarget=function(t){return"ParenthesizedExpression"===t.type?this.isSimpleAssignTarget(t.expression):"Identifier"===t.type||"MemberExpression"===t.type};var wi=di.prototype;wi.parseTopLevel=function(t){var e={};for(t.body||(t.body=[]);this.type!==$s.eof;){var s=this.parseStatement(null,!0,e);t.body.push(s)}if(this.inModule)for(var i=0,a=Object.keys(this.undefinedExports);i<a.length;i+=1){var r=a[i];this.raiseRecoverable(this.undefinedExports[r].start,"Export '"+r+"' is not defined")}return this.adaptDirectivePrologue(t.body),this.next(),t.sourceType=this.options.sourceType,this.finishNode(t,"Program")};var fi={kind:"loop"},vi={kind:"switch"};wi.isLet=function(t){if(this.options.ecmaVersion<6||!this.isContextual("let"))return!1;ti.lastIndex=this.pos;var e=ti.exec(this.input),s=this.pos+e[0].length,i=this.input.charCodeAt(s);if(91===i)return!0;if(t)return!1;if(123===i)return!0;if(Fs(i,!0)){for(var a=s+1;Ys(this.input.charCodeAt(a),!0);)++a;var r=this.input.slice(s,a);if(!xs.test(r))return!0}return!1},wi.isAsyncFunction=function(){if(this.options.ecmaVersion<8||!this.isContextual("async"))return!1;ti.lastIndex=this.pos;var t=ti.exec(this.input),e=this.pos+t[0].length;return!(Zs.test(this.input.slice(this.pos,e))||"function"!==this.input.slice(e,e+8)||e+8!==this.input.length&&Ys(this.input.charAt(e+8)))},wi.parseStatement=function(t,e,s){var i,a=this.type,r=this.startNode();switch(this.isLet(t)&&(a=$s._var,i="let"),a){case $s._break:case $s._continue:return this.parseBreakContinueStatement(r,a.keyword);case $s._debugger:return this.parseDebuggerStatement(r);case $s._do:return this.parseDoStatement(r);case $s._for:return this.parseForStatement(r);case $s._function:return t&&(this.strict||"if"!==t&&"label"!==t)&&this.options.ecmaVersion>=6&&this.unexpected(),this.parseFunctionStatement(r,!1,!t);case $s._class:return t&&this.unexpected(),this.parseClass(r,!0);case $s._if:return this.parseIfStatement(r);case $s._return:return this.parseReturnStatement(r);case $s._switch:return this.parseSwitchStatement(r);case $s._throw:return this.parseThrowStatement(r);case $s._try:return this.parseTryStatement(r);case $s._const:case $s._var:return i=i||this.value,t&&"var"!==i&&this.unexpected(),this.parseVarStatement(r,i);case $s._while:return this.parseWhileStatement(r);case $s._with:return this.parseWithStatement(r);case $s.braceL:return this.parseBlock(!0,r);case $s.semi:return this.parseEmptyStatement(r);case $s._export:case $s._import:if(this.options.ecmaVersion>10&&a===$s._import){ti.lastIndex=this.pos;var n=ti.exec(this.input),o=this.pos+n[0].length,h=this.input.charCodeAt(o);if(40===h||46===h)return this.parseExpressionStatement(r,this.parseExpression())}return this.options.allowImportExportEverywhere||(e||this.raise(this.start,"'import' and 'export' may only appear at the top level"),this.inModule||this.raise(this.start,"'import' and 'export' may appear only with 'sourceType: module'")),a===$s._import?this.parseImport(r):this.parseExport(r,s);default:if(this.isAsyncFunction())return t&&this.unexpected(),this.next(),this.parseFunctionStatement(r,!0,!t);var c=this.value,_=this.parseExpression();return a===$s.name&&"Identifier"===_.type&&this.eat($s.colon)?this.parseLabeledStatement(r,c,_,t):this.parseExpressionStatement(r,_)}},wi.parseBreakContinueStatement=function(t,e){var s="break"===e;this.next(),this.eat($s.semi)||this.insertSemicolon()?t.label=null:this.type!==$s.name?this.unexpected():(t.label=this.parseIdent(),this.semicolon());for(var i=0;i<this.labels.length;++i){var a=this.labels[i];if(null==t.label||a.name===t.label.name){if(null!=a.kind&&(s||"loop"===a.kind))break;if(t.label&&s)break}}return i===this.labels.length&&this.raise(t.start,"Unsyntactic "+e),this.finishNode(t,s?"BreakStatement":"ContinueStatement")},wi.parseDebuggerStatement=function(t){return this.next(),this.semicolon(),this.finishNode(t,"DebuggerStatement")},wi.parseDoStatement=function(t){return this.next(),this.labels.push(fi),t.body=this.parseStatement("do"),this.labels.pop(),this.expect($s._while),t.test=this.parseParenExpression(),this.options.ecmaVersion>=6?this.eat($s.semi):this.semicolon(),this.finishNode(t,"DoWhileStatement")},wi.parseForStatement=function(t){this.next();var e=this.options.ecmaVersion>=9&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction)&&this.eatContextual("await")?this.lastTokStart:-1;if(this.labels.push(fi),this.enterScope(0),this.expect($s.parenL),this.type===$s.semi)return e>-1&&this.unexpected(e),this.parseFor(t,null);var s=this.isLet();if(this.type===$s._var||this.type===$s._const||s){var i=this.startNode(),a=s?"let":this.value;return this.next(),this.parseVar(i,!0,a),this.finishNode(i,"VariableDeclaration"),(this.type===$s._in||this.options.ecmaVersion>=6&&this.isContextual("of"))&&1===i.declarations.length?(this.options.ecmaVersion>=9&&(this.type===$s._in?e>-1&&this.unexpected(e):t.await=e>-1),this.parseForIn(t,i)):(e>-1&&this.unexpected(e),this.parseFor(t,i))}var r=new gi,n=this.parseExpression(!0,r);return this.type===$s._in||this.options.ecmaVersion>=6&&this.isContextual("of")?(this.options.ecmaVersion>=9&&(this.type===$s._in?e>-1&&this.unexpected(e):t.await=e>-1),this.toAssignable(n,!1,r),this.checkLVal(n),this.parseForIn(t,n)):(this.checkExpressionErrors(r,!0),e>-1&&this.unexpected(e),this.parseFor(t,n))},wi.parseFunctionStatement=function(t,e,s){return this.next(),this.parseFunction(t,Si|(s?0:Ai),!1,e)},wi.parseIfStatement=function(t){return this.next(),t.test=this.parseParenExpression(),t.consequent=this.parseStatement("if"),t.alternate=this.eat($s._else)?this.parseStatement("if"):null,this.finishNode(t,"IfStatement")},wi.parseReturnStatement=function(t){return this.inFunction||this.options.allowReturnOutsideFunction||this.raise(this.start,"'return' outside of function"),this.next(),this.eat($s.semi)||this.insertSemicolon()?t.argument=null:(t.argument=this.parseExpression(),this.semicolon()),this.finishNode(t,"ReturnStatement")},wi.parseSwitchStatement=function(t){var e;this.next(),t.discriminant=this.parseParenExpression(),t.cases=[],this.expect($s.braceL),this.labels.push(vi),this.enterScope(0);for(var s=!1;this.type!==$s.braceR;)if(this.type===$s._case||this.type===$s._default){var i=this.type===$s._case;e&&this.finishNode(e,"SwitchCase"),t.cases.push(e=this.startNode()),e.consequent=[],this.next(),i?e.test=this.parseExpression():(s&&this.raiseRecoverable(this.lastTokStart,"Multiple default clauses"),s=!0,e.test=null),this.expect($s.colon)}else e||this.unexpected(),e.consequent.push(this.parseStatement(null));return this.exitScope(),e&&this.finishNode(e,"SwitchCase"),this.next(),this.labels.pop(),this.finishNode(t,"SwitchStatement")},wi.parseThrowStatement=function(t){return this.next(),Zs.test(this.input.slice(this.lastTokEnd,this.start))&&this.raise(this.lastTokEnd,"Illegal newline after throw"),t.argument=this.parseExpression(),this.semicolon(),this.finishNode(t,"ThrowStatement")};var yi=[];wi.parseTryStatement=function(t){if(this.next(),t.block=this.parseBlock(),t.handler=null,this.type===$s._catch){var e=this.startNode();if(this.next(),this.eat($s.parenL)){e.param=this.parseBindingAtom();var s="Identifier"===e.param.type;this.enterScope(s?32:0),this.checkLVal(e.param,s?4:2),this.expect($s.parenR)}else this.options.ecmaVersion<10&&this.unexpected(),e.param=null,this.enterScope(0);e.body=this.parseBlock(!1),this.exitScope(),t.handler=this.finishNode(e,"CatchClause")}return t.finalizer=this.eat($s._finally)?this.parseBlock():null,t.handler||t.finalizer||this.raise(t.start,"Missing catch or finally clause"),this.finishNode(t,"TryStatement")},wi.parseVarStatement=function(t,e){return this.next(),this.parseVar(t,!1,e),this.semicolon(),this.finishNode(t,"VariableDeclaration")},wi.parseWhileStatement=function(t){return this.next(),t.test=this.parseParenExpression(),this.labels.push(fi),t.body=this.parseStatement("while"),this.labels.pop(),this.finishNode(t,"WhileStatement")},wi.parseWithStatement=function(t){return this.strict&&this.raise(this.start,"'with' in strict mode"),this.next(),t.object=this.parseParenExpression(),t.body=this.parseStatement("with"),this.finishNode(t,"WithStatement")},wi.parseEmptyStatement=function(t){return this.next(),this.finishNode(t,"EmptyStatement")},wi.parseLabeledStatement=function(t,e,s,i){for(var a=0,r=this.labels;a<r.length;a+=1){r[a].name===e&&this.raise(s.start,"Label '"+e+"' is already declared")}for(var n=this.type.isLoop?"loop":this.type===$s._switch?"switch":null,o=this.labels.length-1;o>=0;o--){var h=this.labels[o];if(h.statementStart!==t.start)break;h.statementStart=this.start,h.kind=n}return this.labels.push({name:e,kind:n,statementStart:this.start}),t.body=this.parseStatement(i?-1===i.indexOf("label")?i+"label":i:"label"),this.labels.pop(),t.label=s,this.finishNode(t,"LabeledStatement")},wi.parseExpressionStatement=function(t,e){return t.expression=e,this.semicolon(),this.finishNode(t,"ExpressionStatement")},wi.parseBlock=function(t,e,s){for(void 0===t&&(t=!0),void 0===e&&(e=this.startNode()),e.body=[],this.expect($s.braceL),t&&this.enterScope(0);this.type!==$s.braceR;){var i=this.parseStatement(null);e.body.push(i)}return s&&(this.strict=!1),this.next(),t&&this.exitScope(),this.finishNode(e,"BlockStatement")},wi.parseFor=function(t,e){return t.init=e,this.expect($s.semi),t.test=this.type===$s.semi?null:this.parseExpression(),this.expect($s.semi),t.update=this.type===$s.parenR?null:this.parseExpression(),this.expect($s.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,"ForStatement")},wi.parseForIn=function(t,e){var s=this.type===$s._in;return this.next(),"VariableDeclaration"===e.type&&null!=e.declarations[0].init&&(!s||this.options.ecmaVersion<8||this.strict||"var"!==e.kind||"Identifier"!==e.declarations[0].id.type)?this.raise(e.start,(s?"for-in":"for-of")+" loop variable declaration may not have an initializer"):"AssignmentPattern"===e.type&&this.raise(e.start,"Invalid left-hand side in for-loop"),t.left=e,t.right=s?this.parseExpression():this.parseMaybeAssign(),this.expect($s.parenR),t.body=this.parseStatement("for"),this.exitScope(),this.labels.pop(),this.finishNode(t,s?"ForInStatement":"ForOfStatement")},wi.parseVar=function(t,e,s){for(t.declarations=[],t.kind=s;;){var i=this.startNode();if(this.parseVarId(i,s),this.eat($s.eq)?i.init=this.parseMaybeAssign(e):"const"!==s||this.type===$s._in||this.options.ecmaVersion>=6&&this.isContextual("of")?"Identifier"===i.id.type||e&&(this.type===$s._in||this.isContextual("of"))?i.init=null:this.raise(this.lastTokEnd,"Complex binding patterns require an initialization value"):this.unexpected(),t.declarations.push(this.finishNode(i,"VariableDeclarator")),!this.eat($s.comma))break}return t},wi.parseVarId=function(t,e){t.id=this.parseBindingAtom(),this.checkLVal(t.id,"var"===e?1:2,!1)};var Si=1,Ai=2;wi.parseFunction=function(t,e,s,i){this.initFunction(t),(this.options.ecmaVersion>=9||this.options.ecmaVersion>=6&&!i)&&(this.type===$s.star&&e&Ai&&this.unexpected(),t.generator=this.eat($s.star)),this.options.ecmaVersion>=8&&(t.async=!!i),e&Si&&(t.id=4&e&&this.type!==$s.name?null:this.parseIdent(),!t.id||e&Ai||this.checkLVal(t.id,this.strict||t.generator||t.async?this.treatFunctionsAsVar?1:2:3));var a=this.yieldPos,r=this.awaitPos,n=this.awaitIdentPos;return this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(ui(t.async,t.generator)),e&Si||(t.id=this.type===$s.name?this.parseIdent():null),this.parseFunctionParams(t),this.parseFunctionBody(t,s,!1),this.yieldPos=a,this.awaitPos=r,this.awaitIdentPos=n,this.finishNode(t,e&Si?"FunctionDeclaration":"FunctionExpression")},wi.parseFunctionParams=function(t){this.expect($s.parenL),t.params=this.parseBindingList($s.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams()},wi.parseClass=function(t,e){this.next();var s=this.strict;this.strict=!0,this.parseClassId(t,e),this.parseClassSuper(t);var i=this.startNode(),a=!1;for(i.body=[],this.expect($s.braceL);this.type!==$s.braceR;){var r=this.parseClassElement(null!==t.superClass);r&&(i.body.push(r),"MethodDefinition"===r.type&&"constructor"===r.kind&&(a&&this.raise(r.start,"Duplicate constructor in the same class"),a=!0))}return this.strict=s,this.next(),t.body=this.finishNode(i,"ClassBody"),this.finishNode(t,e?"ClassDeclaration":"ClassExpression")},wi.parseClassElement=function(t){var e=this;if(this.eat($s.semi))return null;var s=this.startNode(),i=function(t,i){void 0===i&&(i=!1);var a=e.start,r=e.startLoc;return!!e.eatContextual(t)&&(!(e.type===$s.parenL||i&&e.canInsertSemicolon())||(s.key&&e.unexpected(),s.computed=!1,s.key=e.startNodeAt(a,r),s.key.name=t,e.finishNode(s.key,"Identifier"),!1))};s.kind="method",s.static=i("static");var a=this.eat($s.star),r=!1;a||(this.options.ecmaVersion>=8&&i("async",!0)?(r=!0,a=this.options.ecmaVersion>=9&&this.eat($s.star)):i("get")?s.kind="get":i("set")&&(s.kind="set")),s.key||this.parsePropertyName(s);var n=s.key,o=!1;return s.computed||s.static||!("Identifier"===n.type&&"constructor"===n.name||"Literal"===n.type&&"constructor"===n.value)?s.static&&"Identifier"===n.type&&"prototype"===n.name&&this.raise(n.start,"Classes may not have a static property named prototype"):("method"!==s.kind&&this.raise(n.start,"Constructor can't have get/set modifier"),a&&this.raise(n.start,"Constructor can't be a generator"),r&&this.raise(n.start,"Constructor can't be an async method"),s.kind="constructor",o=t),this.parseClassMethod(s,a,r,o),"get"===s.kind&&0!==s.value.params.length&&this.raiseRecoverable(s.value.start,"getter should have no params"),"set"===s.kind&&1!==s.value.params.length&&this.raiseRecoverable(s.value.start,"setter should have exactly one param"),"set"===s.kind&&"RestElement"===s.value.params[0].type&&this.raiseRecoverable(s.value.params[0].start,"Setter cannot use rest params"),s},wi.parseClassMethod=function(t,e,s,i){return t.value=this.parseMethod(e,s,i),this.finishNode(t,"MethodDefinition")},wi.parseClassId=function(t,e){this.type===$s.name?(t.id=this.parseIdent(),e&&this.checkLVal(t.id,2,!1)):(!0===e&&this.unexpected(),t.id=null)},wi.parseClassSuper=function(t){t.superClass=this.eat($s._extends)?this.parseExprSubscripts():null},wi.parseExport=function(t,e){if(this.next(),this.eat($s.star))return this.options.ecmaVersion>=11&&(this.eatContextual("as")?(t.exported=this.parseIdent(!0),this.checkExport(e,t.exported.name,this.lastTokStart)):t.exported=null),this.expectContextual("from"),this.type!==$s.string&&this.unexpected(),t.source=this.parseExprAtom(),this.semicolon(),this.finishNode(t,"ExportAllDeclaration");if(this.eat($s._default)){var s;if(this.checkExport(e,"default",this.lastTokStart),this.type===$s._function||(s=this.isAsyncFunction())){var i=this.startNode();this.next(),s&&this.next(),t.declaration=this.parseFunction(i,4|Si,!1,s)}else if(this.type===$s._class){var a=this.startNode();t.declaration=this.parseClass(a,"nullableID")}else t.declaration=this.parseMaybeAssign(),this.semicolon();return this.finishNode(t,"ExportDefaultDeclaration")}if(this.shouldParseExportStatement())t.declaration=this.parseStatement(null),"VariableDeclaration"===t.declaration.type?this.checkVariableExport(e,t.declaration.declarations):this.checkExport(e,t.declaration.id.name,t.declaration.id.start),t.specifiers=[],t.source=null;else{if(t.declaration=null,t.specifiers=this.parseExportSpecifiers(e),this.eatContextual("from"))this.type!==$s.string&&this.unexpected(),t.source=this.parseExprAtom();else{for(var r=0,n=t.specifiers;r<n.length;r+=1){var o=n[r];this.checkUnreserved(o.local),this.checkLocalExport(o.local)}t.source=null}this.semicolon()}return this.finishNode(t,"ExportNamedDeclaration")},wi.checkExport=function(t,e,s){t&&(ai(t,e)&&this.raiseRecoverable(s,"Duplicate export '"+e+"'"),t[e]=!0)},wi.checkPatternExport=function(t,e){var s=e.type;if("Identifier"===s)this.checkExport(t,e.name,e.start);else if("ObjectPattern"===s)for(var i=0,a=e.properties;i<a.length;i+=1){var r=a[i];this.checkPatternExport(t,r)}else if("ArrayPattern"===s)for(var n=0,o=e.elements;n<o.length;n+=1){var h=o[n];h&&this.checkPatternExport(t,h)}else"Property"===s?this.checkPatternExport(t,e.value):"AssignmentPattern"===s?this.checkPatternExport(t,e.left):"RestElement"===s?this.checkPatternExport(t,e.argument):"ParenthesizedExpression"===s&&this.checkPatternExport(t,e.expression)},wi.checkVariableExport=function(t,e){if(t)for(var s=0,i=e;s<i.length;s+=1){var a=i[s];this.checkPatternExport(t,a.id)}},wi.shouldParseExportStatement=function(){return"var"===this.type.keyword||"const"===this.type.keyword||"class"===this.type.keyword||"function"===this.type.keyword||this.isLet()||this.isAsyncFunction()},wi.parseExportSpecifiers=function(t){var e=[],s=!0;for(this.expect($s.braceL);!this.eat($s.braceR);){if(s)s=!1;else if(this.expect($s.comma),this.afterTrailingComma($s.braceR))break;var i=this.startNode();i.local=this.parseIdent(!0),i.exported=this.eatContextual("as")?this.parseIdent(!0):i.local,this.checkExport(t,i.exported.name,i.exported.start),e.push(this.finishNode(i,"ExportSpecifier"))}return e},wi.parseImport=function(t){return this.next(),this.type===$s.string?(t.specifiers=yi,t.source=this.parseExprAtom()):(t.specifiers=this.parseImportSpecifiers(),this.expectContextual("from"),t.source=this.type===$s.string?this.parseExprAtom():this.unexpected()),this.semicolon(),this.finishNode(t,"ImportDeclaration")},wi.parseImportSpecifiers=function(){var t=[],e=!0;if(this.type===$s.name){var s=this.startNode();if(s.local=this.parseIdent(),this.checkLVal(s.local,2),t.push(this.finishNode(s,"ImportDefaultSpecifier")),!this.eat($s.comma))return t}if(this.type===$s.star){var i=this.startNode();return this.next(),this.expectContextual("as"),i.local=this.parseIdent(),this.checkLVal(i.local,2),t.push(this.finishNode(i,"ImportNamespaceSpecifier")),t}for(this.expect($s.braceL);!this.eat($s.braceR);){if(e)e=!1;else if(this.expect($s.comma),this.afterTrailingComma($s.braceR))break;var a=this.startNode();a.imported=this.parseIdent(!0),this.eatContextual("as")?a.local=this.parseIdent():(this.checkUnreserved(a.imported),a.local=a.imported),this.checkLVal(a.local,2),t.push(this.finishNode(a,"ImportSpecifier"))}return t},wi.adaptDirectivePrologue=function(t){for(var e=0;e<t.length&&this.isDirectiveCandidate(t[e]);++e)t[e].directive=t[e].expression.raw.slice(1,-1)},wi.isDirectiveCandidate=function(t){return"ExpressionStatement"===t.type&&"Literal"===t.expression.type&&"string"==typeof t.expression.value&&('"'===this.input[t.start]||"'"===this.input[t.start])};var Ti=di.prototype;Ti.toAssignable=function(t,e,s){if(this.options.ecmaVersion>=6&&t)switch(t.type){case"Identifier":this.inAsync&&"await"===t.name&&this.raise(t.start,"Cannot use 'await' as identifier inside an async function");break;case"ObjectPattern":case"ArrayPattern":case"RestElement":break;case"ObjectExpression":t.type="ObjectPattern",s&&this.checkPatternErrors(s,!0);for(var i=0,a=t.properties;i<a.length;i+=1){var r=a[i];this.toAssignable(r,e),"RestElement"!==r.type||"ArrayPattern"!==r.argument.type&&"ObjectPattern"!==r.argument.type||this.raise(r.argument.start,"Unexpected token")}break;case"Property":"init"!==t.kind&&this.raise(t.key.start,"Object pattern can't contain getter or setter"),this.toAssignable(t.value,e);break;case"ArrayExpression":t.type="ArrayPattern",s&&this.checkPatternErrors(s,!0),this.toAssignableList(t.elements,e);break;case"SpreadElement":t.type="RestElement",this.toAssignable(t.argument,e),"AssignmentPattern"===t.argument.type&&this.raise(t.argument.start,"Rest elements cannot have a default value");break;case"AssignmentExpression":"="!==t.operator&&this.raise(t.left.end,"Only '=' operator can be used for specifying default value."),t.type="AssignmentPattern",delete t.operator,this.toAssignable(t.left,e);case"AssignmentPattern":break;case"ParenthesizedExpression":this.toAssignable(t.expression,e,s);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":if(!e)break;default:this.raise(t.start,"Assigning to rvalue")}else s&&this.checkPatternErrors(s,!0);return t},Ti.toAssignableList=function(t,e){for(var s=t.length,i=0;i<s;i++){var a=t[i];a&&this.toAssignable(a,e)}if(s){var r=t[s-1];6===this.options.ecmaVersion&&e&&r&&"RestElement"===r.type&&"Identifier"!==r.argument.type&&this.unexpected(r.argument.start)}return t},Ti.parseSpread=function(t){var e=this.startNode();return this.next(),e.argument=this.parseMaybeAssign(!1,t),this.finishNode(e,"SpreadElement")},Ti.parseRestBinding=function(){var t=this.startNode();return this.next(),6===this.options.ecmaVersion&&this.type!==$s.name&&this.unexpected(),t.argument=this.parseBindingAtom(),this.finishNode(t,"RestElement")},Ti.parseBindingAtom=function(){if(this.options.ecmaVersion>=6)switch(this.type){case $s.bracketL:var t=this.startNode();return this.next(),t.elements=this.parseBindingList($s.bracketR,!0,!0),this.finishNode(t,"ArrayPattern");case $s.braceL:return this.parseObj(!0)}return this.parseIdent()},Ti.parseBindingList=function(t,e,s){for(var i=[],a=!0;!this.eat(t);)if(a?a=!1:this.expect($s.comma),e&&this.type===$s.comma)i.push(null);else{if(s&&this.afterTrailingComma(t))break;if(this.type===$s.ellipsis){var r=this.parseRestBinding();this.parseBindingListItem(r),i.push(r),this.type===$s.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.expect(t);break}var n=this.parseMaybeDefault(this.start,this.startLoc);this.parseBindingListItem(n),i.push(n)}return i},Ti.parseBindingListItem=function(t){return t},Ti.parseMaybeDefault=function(t,e,s){if(s=s||this.parseBindingAtom(),this.options.ecmaVersion<6||!this.eat($s.eq))return s;var i=this.startNodeAt(t,e);return i.left=s,i.right=this.parseMaybeAssign(),this.finishNode(i,"AssignmentPattern")},Ti.checkLVal=function(t,e,s){switch(void 0===e&&(e=0),t.type){case"Identifier":2===e&&"let"===t.name&&this.raiseRecoverable(t.start,"let is disallowed as a lexically bound name"),this.strict&&this.reservedWordsStrictBind.test(t.name)&&this.raiseRecoverable(t.start,(e?"Binding ":"Assigning to ")+t.name+" in strict mode"),s&&(ai(s,t.name)&&this.raiseRecoverable(t.start,"Argument name clash"),s[t.name]=!0),0!==e&&5!==e&&this.declareName(t.name,e,t.start);break;case"ChainExpression":this.raiseRecoverable(t.start,"Optional chaining cannot appear in left-hand side");break;case"MemberExpression":e&&this.raiseRecoverable(t.start,"Binding member expression");break;case"ObjectPattern":for(var i=0,a=t.properties;i<a.length;i+=1){var r=a[i];this.checkLVal(r,e,s)}break;case"Property":this.checkLVal(t.value,e,s);break;case"ArrayPattern":for(var n=0,o=t.elements;n<o.length;n+=1){var h=o[n];h&&this.checkLVal(h,e,s)}break;case"AssignmentPattern":this.checkLVal(t.left,e,s);break;case"RestElement":this.checkLVal(t.argument,e,s);break;case"ParenthesizedExpression":this.checkLVal(t.expression,e,s);break;default:this.raise(t.start,(e?"Binding":"Assigning to")+" rvalue")}};var Ii=di.prototype;Ii.checkPropClash=function(t,e,s){if(!(this.options.ecmaVersion>=9&&"SpreadElement"===t.type||this.options.ecmaVersion>=6&&(t.computed||t.method||t.shorthand))){var i,a=t.key;switch(a.type){case"Identifier":i=a.name;break;case"Literal":i=String(a.value);break;default:return}var r=t.kind;if(this.options.ecmaVersion>=6)"__proto__"===i&&"init"===r&&(e.proto&&(s?s.doubleProto<0&&(s.doubleProto=a.start):this.raiseRecoverable(a.start,"Redefinition of __proto__ property")),e.proto=!0);else{var n=e[i="$"+i];if(n)("init"===r?this.strict&&n.init||n.get||n.set:n.init||n[r])&&this.raiseRecoverable(a.start,"Redefinition of property");else n=e[i]={init:!1,get:!1,set:!1};n[r]=!0}}},Ii.parseExpression=function(t,e){var s=this.start,i=this.startLoc,a=this.parseMaybeAssign(t,e);if(this.type===$s.comma){var r=this.startNodeAt(s,i);for(r.expressions=[a];this.eat($s.comma);)r.expressions.push(this.parseMaybeAssign(t,e));return this.finishNode(r,"SequenceExpression")}return a},Ii.parseMaybeAssign=function(t,e,s){if(this.isContextual("yield")){if(this.inGenerator)return this.parseYield(t);this.exprAllowed=!1}var i=!1,a=-1,r=-1;e?(a=e.parenthesizedAssign,r=e.trailingComma,e.parenthesizedAssign=e.trailingComma=-1):(e=new gi,i=!0);var n=this.start,o=this.startLoc;this.type!==$s.parenL&&this.type!==$s.name||(this.potentialArrowAt=this.start);var h=this.parseMaybeConditional(t,e);if(s&&(h=s.call(this,h,n,o)),this.type.isAssign){var c=this.startNodeAt(n,o);return c.operator=this.value,c.left=this.type===$s.eq?this.toAssignable(h,!1,e):h,i||(e.parenthesizedAssign=e.trailingComma=e.doubleProto=-1),e.shorthandAssign>=c.left.start&&(e.shorthandAssign=-1),this.checkLVal(h),this.next(),c.right=this.parseMaybeAssign(t),this.finishNode(c,"AssignmentExpression")}return i&&this.checkExpressionErrors(e,!0),a>-1&&(e.parenthesizedAssign=a),r>-1&&(e.trailingComma=r),h},Ii.parseMaybeConditional=function(t,e){var s=this.start,i=this.startLoc,a=this.parseExprOps(t,e);if(this.checkExpressionErrors(e))return a;if(this.eat($s.question)){var r=this.startNodeAt(s,i);return r.test=a,r.consequent=this.parseMaybeAssign(),this.expect($s.colon),r.alternate=this.parseMaybeAssign(t),this.finishNode(r,"ConditionalExpression")}return a},Ii.parseExprOps=function(t,e){var s=this.start,i=this.startLoc,a=this.parseMaybeUnary(e,!1);return this.checkExpressionErrors(e)||a.start===s&&"ArrowFunctionExpression"===a.type?a:this.parseExprOp(a,s,i,-1,t)},Ii.parseExprOp=function(t,e,s,i,a){var r=this.type.binop;if(null!=r&&(!a||this.type!==$s._in)&&r>i){var n=this.type===$s.logicalOR||this.type===$s.logicalAND,o=this.type===$s.coalesce;o&&(r=$s.logicalAND.binop);var h=this.value;this.next();var c=this.start,_=this.startLoc,l=this.parseExprOp(this.parseMaybeUnary(null,!1),c,_,r,a),u=this.buildBinary(e,s,t,l,h,n||o);return(n&&this.type===$s.coalesce||o&&(this.type===$s.logicalOR||this.type===$s.logicalAND))&&this.raiseRecoverable(this.start,"Logical expressions and coalesce expressions cannot be mixed. Wrap either by parentheses"),this.parseExprOp(u,e,s,i,a)}return t},Ii.buildBinary=function(t,e,s,i,a,r){var n=this.startNodeAt(t,e);return n.left=s,n.operator=a,n.right=i,this.finishNode(n,r?"LogicalExpression":"BinaryExpression")},Ii.parseMaybeUnary=function(t,e){var s,i=this.start,a=this.startLoc;if(this.isContextual("await")&&(this.inAsync||!this.inFunction&&this.options.allowAwaitOutsideFunction))s=this.parseAwait(),e=!0;else if(this.type.prefix){var r=this.startNode(),n=this.type===$s.incDec;r.operator=this.value,r.prefix=!0,this.next(),r.argument=this.parseMaybeUnary(null,!0),this.checkExpressionErrors(t,!0),n?this.checkLVal(r.argument):this.strict&&"delete"===r.operator&&"Identifier"===r.argument.type?this.raiseRecoverable(r.start,"Deleting local variable in strict mode"):e=!0,s=this.finishNode(r,n?"UpdateExpression":"UnaryExpression")}else{if(s=this.parseExprSubscripts(t),this.checkExpressionErrors(t))return s;for(;this.type.postfix&&!this.canInsertSemicolon();){var o=this.startNodeAt(i,a);o.operator=this.value,o.prefix=!1,o.argument=s,this.checkLVal(s),this.next(),s=this.finishNode(o,"UpdateExpression")}}return!e&&this.eat($s.starstar)?this.buildBinary(i,a,s,this.parseMaybeUnary(null,!1),"**",!1):s},Ii.parseExprSubscripts=function(t){var e=this.start,s=this.startLoc,i=this.parseExprAtom(t);if("ArrowFunctionExpression"===i.type&&")"!==this.input.slice(this.lastTokStart,this.lastTokEnd))return i;var a=this.parseSubscripts(i,e,s);return t&&"MemberExpression"===a.type&&(t.parenthesizedAssign>=a.start&&(t.parenthesizedAssign=-1),t.parenthesizedBind>=a.start&&(t.parenthesizedBind=-1)),a},Ii.parseSubscripts=function(t,e,s,i){for(var a=this.options.ecmaVersion>=8&&"Identifier"===t.type&&"async"===t.name&&this.lastTokEnd===t.end&&!this.canInsertSemicolon()&&t.end-t.start==5&&this.potentialArrowAt===t.start,r=!1;;){var n=this.parseSubscript(t,e,s,i,a,r);if(n.optional&&(r=!0),n===t||"ArrowFunctionExpression"===n.type){if(r){var o=this.startNodeAt(e,s);o.expression=n,n=this.finishNode(o,"ChainExpression")}return n}t=n}},Ii.parseSubscript=function(t,e,s,i,a,r){var n=this.options.ecmaVersion>=11,o=n&&this.eat($s.questionDot);i&&o&&this.raise(this.lastTokStart,"Optional chaining cannot appear in the callee of new expressions");var h=this.eat($s.bracketL);if(h||o&&this.type!==$s.parenL&&this.type!==$s.backQuote||this.eat($s.dot)){var c=this.startNodeAt(e,s);c.object=t,c.property=h?this.parseExpression():this.parseIdent("never"!==this.options.allowReserved),c.computed=!!h,h&&this.expect($s.bracketR),n&&(c.optional=o),t=this.finishNode(c,"MemberExpression")}else if(!i&&this.eat($s.parenL)){var _=new gi,l=this.yieldPos,u=this.awaitPos,d=this.awaitIdentPos;this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0;var p=this.parseExprList($s.parenR,this.options.ecmaVersion>=8,!1,_);if(a&&!o&&!this.canInsertSemicolon()&&this.eat($s.arrow))return this.checkPatternErrors(_,!1),this.checkYieldAwaitInDefaultParams(),this.awaitIdentPos>0&&this.raise(this.awaitIdentPos,"Cannot use 'await' as identifier inside an async function"),this.yieldPos=l,this.awaitPos=u,this.awaitIdentPos=d,this.parseArrowExpression(this.startNodeAt(e,s),p,!0);this.checkExpressionErrors(_,!0),this.yieldPos=l||this.yieldPos,this.awaitPos=u||this.awaitPos,this.awaitIdentPos=d||this.awaitIdentPos;var m=this.startNodeAt(e,s);m.callee=t,m.arguments=p,n&&(m.optional=o),t=this.finishNode(m,"CallExpression")}else if(this.type===$s.backQuote){(o||r)&&this.raise(this.start,"Optional chaining cannot appear in the tag of tagged template expressions");var E=this.startNodeAt(e,s);E.tag=t,E.quasi=this.parseTemplate({isTagged:!0}),t=this.finishNode(E,"TaggedTemplateExpression")}return t},Ii.parseExprAtom=function(t){this.type===$s.slash&&this.readRegexp();var e,s=this.potentialArrowAt===this.start;switch(this.type){case $s._super:return this.allowSuper||this.raise(this.start,"'super' keyword outside a method"),e=this.startNode(),this.next(),this.type!==$s.parenL||this.allowDirectSuper||this.raise(e.start,"super() call outside constructor of a subclass"),this.type!==$s.dot&&this.type!==$s.bracketL&&this.type!==$s.parenL&&this.unexpected(),this.finishNode(e,"Super");case $s._this:return e=this.startNode(),this.next(),this.finishNode(e,"ThisExpression");case $s.name:var i=this.start,a=this.startLoc,r=this.containsEsc,n=this.parseIdent(!1);if(this.options.ecmaVersion>=8&&!r&&"async"===n.name&&!this.canInsertSemicolon()&&this.eat($s._function))return this.parseFunction(this.startNodeAt(i,a),0,!1,!0);if(s&&!this.canInsertSemicolon()){if(this.eat($s.arrow))return this.parseArrowExpression(this.startNodeAt(i,a),[n],!1);if(this.options.ecmaVersion>=8&&"async"===n.name&&this.type===$s.name&&!r)return n=this.parseIdent(!1),!this.canInsertSemicolon()&&this.eat($s.arrow)||this.unexpected(),this.parseArrowExpression(this.startNodeAt(i,a),[n],!0)}return n;case $s.regexp:var o=this.value;return(e=this.parseLiteral(o.value)).regex={pattern:o.pattern,flags:o.flags},e;case $s.num:case $s.string:return this.parseLiteral(this.value);case $s._null:case $s._true:case $s._false:return(e=this.startNode()).value=this.type===$s._null?null:this.type===$s._true,e.raw=this.type.keyword,this.next(),this.finishNode(e,"Literal");case $s.parenL:var h=this.start,c=this.parseParenAndDistinguishExpression(s);return t&&(t.parenthesizedAssign<0&&!this.isSimpleAssignTarget(c)&&(t.parenthesizedAssign=h),t.parenthesizedBind<0&&(t.parenthesizedBind=h)),c;case $s.bracketL:return e=this.startNode(),this.next(),e.elements=this.parseExprList($s.bracketR,!0,!0,t),this.finishNode(e,"ArrayExpression");case $s.braceL:return this.parseObj(!1,t);case $s._function:return e=this.startNode(),this.next(),this.parseFunction(e,0);case $s._class:return this.parseClass(this.startNode(),!1);case $s._new:return this.parseNew();case $s.backQuote:return this.parseTemplate();case $s._import:return this.options.ecmaVersion>=11?this.parseExprImport():this.unexpected();default:this.unexpected()}},Ii.parseExprImport=function(){var t=this.startNode();this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword import");var e=this.parseIdent(!0);switch(this.type){case $s.parenL:return this.parseDynamicImport(t);case $s.dot:return t.meta=e,this.parseImportMeta(t);default:this.unexpected()}},Ii.parseDynamicImport=function(t){if(this.next(),t.source=this.parseMaybeAssign(),!this.eat($s.parenR)){var e=this.start;this.eat($s.comma)&&this.eat($s.parenR)?this.raiseRecoverable(e,"Trailing comma is not allowed in import()"):this.unexpected(e)}return this.finishNode(t,"ImportExpression")},Ii.parseImportMeta=function(t){this.next();var e=this.containsEsc;return t.property=this.parseIdent(!0),"meta"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for import is 'import.meta'"),e&&this.raiseRecoverable(t.start,"'import.meta' must not contain escaped characters"),"module"!==this.options.sourceType&&this.raiseRecoverable(t.start,"Cannot use 'import.meta' outside a module"),this.finishNode(t,"MetaProperty")},Ii.parseLiteral=function(t){var e=this.startNode();return e.value=t,e.raw=this.input.slice(this.start,this.end),110===e.raw.charCodeAt(e.raw.length-1)&&(e.bigint=e.raw.slice(0,-1).replace(/_/g,"")),this.next(),this.finishNode(e,"Literal")},Ii.parseParenExpression=function(){this.expect($s.parenL);var t=this.parseExpression();return this.expect($s.parenR),t},Ii.parseParenAndDistinguishExpression=function(t){var e,s=this.start,i=this.startLoc,a=this.options.ecmaVersion>=8;if(this.options.ecmaVersion>=6){this.next();var r,n=this.start,o=this.startLoc,h=[],c=!0,_=!1,l=new gi,u=this.yieldPos,d=this.awaitPos;for(this.yieldPos=0,this.awaitPos=0;this.type!==$s.parenR;){if(c?c=!1:this.expect($s.comma),a&&this.afterTrailingComma($s.parenR,!0)){_=!0;break}if(this.type===$s.ellipsis){r=this.start,h.push(this.parseParenItem(this.parseRestBinding())),this.type===$s.comma&&this.raise(this.start,"Comma is not permitted after the rest element");break}h.push(this.parseMaybeAssign(!1,l,this.parseParenItem))}var p=this.start,m=this.startLoc;if(this.expect($s.parenR),t&&!this.canInsertSemicolon()&&this.eat($s.arrow))return this.checkPatternErrors(l,!1),this.checkYieldAwaitInDefaultParams(),this.yieldPos=u,this.awaitPos=d,this.parseParenArrowList(s,i,h);h.length&&!_||this.unexpected(this.lastTokStart),r&&this.unexpected(r),this.checkExpressionErrors(l,!0),this.yieldPos=u||this.yieldPos,this.awaitPos=d||this.awaitPos,h.length>1?((e=this.startNodeAt(n,o)).expressions=h,this.finishNodeAt(e,"SequenceExpression",p,m)):e=h[0]}else e=this.parseParenExpression();if(this.options.preserveParens){var E=this.startNodeAt(s,i);return E.expression=e,this.finishNode(E,"ParenthesizedExpression")}return e},Ii.parseParenItem=function(t){return t},Ii.parseParenArrowList=function(t,e,s){return this.parseArrowExpression(this.startNodeAt(t,e),s)};var Ci=[];Ii.parseNew=function(){this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword new");var t=this.startNode(),e=this.parseIdent(!0);if(this.options.ecmaVersion>=6&&this.eat($s.dot)){t.meta=e;var s=this.containsEsc;return t.property=this.parseIdent(!0),"target"!==t.property.name&&this.raiseRecoverable(t.property.start,"The only valid meta property for new is 'new.target'"),s&&this.raiseRecoverable(t.start,"'new.target' must not contain escaped characters"),this.inNonArrowFunction()||this.raiseRecoverable(t.start,"'new.target' can only be used in functions"),this.finishNode(t,"MetaProperty")}var i=this.start,a=this.startLoc,r=this.type===$s._import;return t.callee=this.parseSubscripts(this.parseExprAtom(),i,a,!0),r&&"ImportExpression"===t.callee.type&&this.raise(i,"Cannot use new with import()"),this.eat($s.parenL)?t.arguments=this.parseExprList($s.parenR,this.options.ecmaVersion>=8,!1):t.arguments=Ci,this.finishNode(t,"NewExpression")},Ii.parseTemplateElement=function(t){var e=t.isTagged,s=this.startNode();return this.type===$s.invalidTemplate?(e||this.raiseRecoverable(this.start,"Bad escape sequence in untagged template literal"),s.value={raw:this.value,cooked:null}):s.value={raw:this.input.slice(this.start,this.end).replace(/\r\n?/g,"\n"),cooked:this.value},this.next(),s.tail=this.type===$s.backQuote,this.finishNode(s,"TemplateElement")},Ii.parseTemplate=function(t){void 0===t&&(t={});var e=t.isTagged;void 0===e&&(e=!1);var s=this.startNode();this.next(),s.expressions=[];var i=this.parseTemplateElement({isTagged:e});for(s.quasis=[i];!i.tail;)this.type===$s.eof&&this.raise(this.pos,"Unterminated template literal"),this.expect($s.dollarBraceL),s.expressions.push(this.parseExpression()),this.expect($s.braceR),s.quasis.push(i=this.parseTemplateElement({isTagged:e}));return this.next(),this.finishNode(s,"TemplateLiteral")},Ii.isAsyncProp=function(t){return!t.computed&&"Identifier"===t.key.type&&"async"===t.key.name&&(this.type===$s.name||this.type===$s.num||this.type===$s.string||this.type===$s.bracketL||this.type.keyword||this.options.ecmaVersion>=9&&this.type===$s.star)&&!Zs.test(this.input.slice(this.lastTokEnd,this.start))},Ii.parseObj=function(t,e){var s=this.startNode(),i=!0,a={};for(s.properties=[],this.next();!this.eat($s.braceR);){if(i)i=!1;else if(this.expect($s.comma),this.options.ecmaVersion>=5&&this.afterTrailingComma($s.braceR))break;var r=this.parseProperty(t,e);t||this.checkPropClash(r,a,e),s.properties.push(r)}return this.finishNode(s,t?"ObjectPattern":"ObjectExpression")},Ii.parseProperty=function(t,e){var s,i,a,r,n=this.startNode();if(this.options.ecmaVersion>=9&&this.eat($s.ellipsis))return t?(n.argument=this.parseIdent(!1),this.type===$s.comma&&this.raise(this.start,"Comma is not permitted after the rest element"),this.finishNode(n,"RestElement")):(this.type===$s.parenL&&e&&(e.parenthesizedAssign<0&&(e.parenthesizedAssign=this.start),e.parenthesizedBind<0&&(e.parenthesizedBind=this.start)),n.argument=this.parseMaybeAssign(!1,e),this.type===$s.comma&&e&&e.trailingComma<0&&(e.trailingComma=this.start),this.finishNode(n,"SpreadElement"));this.options.ecmaVersion>=6&&(n.method=!1,n.shorthand=!1,(t||e)&&(a=this.start,r=this.startLoc),t||(s=this.eat($s.star)));var o=this.containsEsc;return this.parsePropertyName(n),!t&&!o&&this.options.ecmaVersion>=8&&!s&&this.isAsyncProp(n)?(i=!0,s=this.options.ecmaVersion>=9&&this.eat($s.star),this.parsePropertyName(n,e)):i=!1,this.parsePropertyValue(n,t,s,i,a,r,e,o),this.finishNode(n,"Property")},Ii.parsePropertyValue=function(t,e,s,i,a,r,n,o){if((s||i)&&this.type===$s.colon&&this.unexpected(),this.eat($s.colon))t.value=e?this.parseMaybeDefault(this.start,this.startLoc):this.parseMaybeAssign(!1,n),t.kind="init";else if(this.options.ecmaVersion>=6&&this.type===$s.parenL)e&&this.unexpected(),t.kind="init",t.method=!0,t.value=this.parseMethod(s,i);else if(e||o||!(this.options.ecmaVersion>=5)||t.computed||"Identifier"!==t.key.type||"get"!==t.key.name&&"set"!==t.key.name||this.type===$s.comma||this.type===$s.braceR||this.type===$s.eq)this.options.ecmaVersion>=6&&!t.computed&&"Identifier"===t.key.type?((s||i)&&this.unexpected(),this.checkUnreserved(t.key),"await"!==t.key.name||this.awaitIdentPos||(this.awaitIdentPos=a),t.kind="init",e?t.value=this.parseMaybeDefault(a,r,t.key):this.type===$s.eq&&n?(n.shorthandAssign<0&&(n.shorthandAssign=this.start),t.value=this.parseMaybeDefault(a,r,t.key)):t.value=t.key,t.shorthand=!0):this.unexpected();else{(s||i)&&this.unexpected(),t.kind=t.key.name,this.parsePropertyName(t),t.value=this.parseMethod(!1);var h="get"===t.kind?0:1;if(t.value.params.length!==h){var c=t.value.start;"get"===t.kind?this.raiseRecoverable(c,"getter should have no params"):this.raiseRecoverable(c,"setter should have exactly one param")}else"set"===t.kind&&"RestElement"===t.value.params[0].type&&this.raiseRecoverable(t.value.params[0].start,"Setter cannot use rest params")}},Ii.parsePropertyName=function(t){if(this.options.ecmaVersion>=6){if(this.eat($s.bracketL))return t.computed=!0,t.key=this.parseMaybeAssign(),this.expect($s.bracketR),t.key;t.computed=!1}return t.key=this.type===$s.num||this.type===$s.string?this.parseExprAtom():this.parseIdent("never"!==this.options.allowReserved)},Ii.initFunction=function(t){t.id=null,this.options.ecmaVersion>=6&&(t.generator=t.expression=!1),this.options.ecmaVersion>=8&&(t.async=!1)},Ii.parseMethod=function(t,e,s){var i=this.startNode(),a=this.yieldPos,r=this.awaitPos,n=this.awaitIdentPos;return this.initFunction(i),this.options.ecmaVersion>=6&&(i.generator=t),this.options.ecmaVersion>=8&&(i.async=!!e),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,this.enterScope(64|ui(e,i.generator)|(s?128:0)),this.expect($s.parenL),i.params=this.parseBindingList($s.parenR,!1,this.options.ecmaVersion>=8),this.checkYieldAwaitInDefaultParams(),this.parseFunctionBody(i,!1,!0),this.yieldPos=a,this.awaitPos=r,this.awaitIdentPos=n,this.finishNode(i,"FunctionExpression")},Ii.parseArrowExpression=function(t,e,s){var i=this.yieldPos,a=this.awaitPos,r=this.awaitIdentPos;return this.enterScope(16|ui(s,!1)),this.initFunction(t),this.options.ecmaVersion>=8&&(t.async=!!s),this.yieldPos=0,this.awaitPos=0,this.awaitIdentPos=0,t.params=this.toAssignableList(e,!0),this.parseFunctionBody(t,!0,!1),this.yieldPos=i,this.awaitPos=a,this.awaitIdentPos=r,this.finishNode(t,"ArrowFunctionExpression")},Ii.parseFunctionBody=function(t,e,s){var i=e&&this.type!==$s.braceL,a=this.strict,r=!1;if(i)t.body=this.parseMaybeAssign(),t.expression=!0,this.checkParams(t,!1);else{var n=this.options.ecmaVersion>=7&&!this.isSimpleParamList(t.params);a&&!n||(r=this.strictDirective(this.end))&&n&&this.raiseRecoverable(t.start,"Illegal 'use strict' directive in function with non-simple parameter list");var o=this.labels;this.labels=[],r&&(this.strict=!0),this.checkParams(t,!a&&!r&&!e&&!s&&this.isSimpleParamList(t.params)),this.strict&&t.id&&this.checkLVal(t.id,5),t.body=this.parseBlock(!1,void 0,r&&!a),t.expression=!1,this.adaptDirectivePrologue(t.body.body),this.labels=o}this.exitScope()},Ii.isSimpleParamList=function(t){for(var e=0,s=t;e<s.length;e+=1){if("Identifier"!==s[e].type)return!1}return!0},Ii.checkParams=function(t,e){for(var s={},i=0,a=t.params;i<a.length;i+=1){var r=a[i];this.checkLVal(r,1,e?null:s)}},Ii.parseExprList=function(t,e,s,i){for(var a=[],r=!0;!this.eat(t);){if(r)r=!1;else if(this.expect($s.comma),e&&this.afterTrailingComma(t))break;var n=void 0;s&&this.type===$s.comma?n=null:this.type===$s.ellipsis?(n=this.parseSpread(i),i&&this.type===$s.comma&&i.trailingComma<0&&(i.trailingComma=this.start)):n=this.parseMaybeAssign(!1,i),a.push(n)}return a},Ii.checkUnreserved=function(t){var e=t.start,s=t.end,i=t.name;(this.inGenerator&&"yield"===i&&this.raiseRecoverable(e,"Cannot use 'yield' as identifier inside a generator"),this.inAsync&&"await"===i&&this.raiseRecoverable(e,"Cannot use 'await' as identifier inside an async function"),this.keywords.test(i)&&this.raise(e,"Unexpected keyword '"+i+"'"),this.options.ecmaVersion<6&&-1!==this.input.slice(e,s).indexOf("\\"))||(this.strict?this.reservedWordsStrict:this.reservedWords).test(i)&&(this.inAsync||"await"!==i||this.raiseRecoverable(e,"Cannot use keyword 'await' outside an async function"),this.raiseRecoverable(e,"The keyword '"+i+"' is reserved"))},Ii.parseIdent=function(t,e){var s=this.startNode();return this.type===$s.name?s.name=this.value:this.type.keyword?(s.name=this.type.keyword,"class"!==s.name&&"function"!==s.name||this.lastTokEnd===this.lastTokStart+1&&46===this.input.charCodeAt(this.lastTokStart)||this.context.pop()):this.unexpected(),this.next(!!t),this.finishNode(s,"Identifier"),t||(this.checkUnreserved(s),"await"!==s.name||this.awaitIdentPos||(this.awaitIdentPos=s.start)),s},Ii.parseYield=function(t){this.yieldPos||(this.yieldPos=this.start);var e=this.startNode();return this.next(),this.type===$s.semi||this.canInsertSemicolon()||this.type!==$s.star&&!this.type.startsExpr?(e.delegate=!1,e.argument=null):(e.delegate=this.eat($s.star),e.argument=this.parseMaybeAssign(t)),this.finishNode(e,"YieldExpression")},Ii.parseAwait=function(){this.awaitPos||(this.awaitPos=this.start);var t=this.startNode();return this.next(),t.argument=this.parseMaybeUnary(null,!1),this.finishNode(t,"AwaitExpression")};var Pi=di.prototype;Pi.raise=function(t,e){var s=ci(this.input,t);e+=" ("+s.line+":"+s.column+")";var i=new SyntaxError(e);throw i.pos=t,i.loc=s,i.raisedAt=this.pos,i},Pi.raiseRecoverable=Pi.raise,Pi.curPosition=function(){if(this.options.locations)return new oi(this.curLine,this.pos-this.lineStart)};var Di=di.prototype,Ni=function(t){this.flags=t,this.var=[],this.lexical=[],this.functions=[]};Di.enterScope=function(t){this.scopeStack.push(new Ni(t))},Di.exitScope=function(){this.scopeStack.pop()},Di.treatFunctionsAsVarInScope=function(t){return 2&t.flags||!this.inModule&&1&t.flags},Di.declareName=function(t,e,s){var i=!1;if(2===e){var a=this.currentScope();i=a.lexical.indexOf(t)>-1||a.functions.indexOf(t)>-1||a.var.indexOf(t)>-1,a.lexical.push(t),this.inModule&&1&a.flags&&delete this.undefinedExports[t]}else if(4===e){this.currentScope().lexical.push(t)}else if(3===e){var r=this.currentScope();i=this.treatFunctionsAsVar?r.lexical.indexOf(t)>-1:r.lexical.indexOf(t)>-1||r.var.indexOf(t)>-1,r.functions.push(t)}else for(var n=this.scopeStack.length-1;n>=0;--n){var o=this.scopeStack[n];if(o.lexical.indexOf(t)>-1&&!(32&o.flags&&o.lexical[0]===t)||!this.treatFunctionsAsVarInScope(o)&&o.functions.indexOf(t)>-1){i=!0;break}if(o.var.push(t),this.inModule&&1&o.flags&&delete this.undefinedExports[t],3&o.flags)break}i&&this.raiseRecoverable(s,"Identifier '"+t+"' has already been declared")},Di.checkLocalExport=function(t){-1===this.scopeStack[0].lexical.indexOf(t.name)&&-1===this.scopeStack[0].var.indexOf(t.name)&&(this.undefinedExports[t.name]=t)},Di.currentScope=function(){return this.scopeStack[this.scopeStack.length-1]},Di.currentVarScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(3&e.flags)return e}},Di.currentThisScope=function(){for(var t=this.scopeStack.length-1;;t--){var e=this.scopeStack[t];if(3&e.flags&&!(16&e.flags))return e}};var Oi=function(t,e,s){this.type="",this.start=e,this.end=0,t.options.locations&&(this.loc=new hi(t,s)),t.options.directSourceFile&&(this.sourceFile=t.options.directSourceFile),t.options.ranges&&(this.range=[e,0])},bi=di.prototype;function Mi(t,e,s,i){return t.type=e,t.end=s,this.options.locations&&(t.loc.end=i),this.options.ranges&&(t.range[1]=s),t}bi.startNode=function(){return new Oi(this,this.start,this.startLoc)},bi.startNodeAt=function(t,e){return new Oi(this,t,e)},bi.finishNode=function(t,e){return Mi.call(this,t,e,this.lastTokEnd,this.lastTokEndLoc)},bi.finishNodeAt=function(t,e,s,i){return Mi.call(this,t,e,s,i)};var xi=function(t,e,s,i,a){this.token=t,this.isExpr=!!e,this.preserveSpace=!!s,this.override=i,this.generator=!!a},Li={b_stat:new xi("{",!1),b_expr:new xi("{",!0),b_tmpl:new xi("${",!1),p_stat:new xi("(",!1),p_expr:new xi("(",!0),q_tmpl:new xi("`",!0,!0,(function(t){return t.tryReadTemplateToken()})),f_stat:new xi("function",!1),f_expr:new xi("function",!0),f_expr_gen:new xi("function",!0,!1,null,!0),f_gen:new xi("function",!1,!1,null,!0)},Ri=di.prototype;Ri.initialContext=function(){return[Li.b_stat]},Ri.braceIsBlock=function(t){var e=this.curContext();return e===Li.f_expr||e===Li.f_stat||(t!==$s.colon||e!==Li.b_stat&&e!==Li.b_expr?t===$s._return||t===$s.name&&this.exprAllowed?Zs.test(this.input.slice(this.lastTokEnd,this.start)):t===$s._else||t===$s.semi||t===$s.eof||t===$s.parenR||t===$s.arrow||(t===$s.braceL?e===Li.b_stat:t!==$s._var&&t!==$s._const&&t!==$s.name&&!this.exprAllowed):!e.isExpr)},Ri.inGeneratorContext=function(){for(var t=this.context.length-1;t>=1;t--){var e=this.context[t];if("function"===e.token)return e.generator}return!1},Ri.updateContext=function(t){var e,s=this.type;s.keyword&&t===$s.dot?this.exprAllowed=!1:(e=s.updateContext)?e.call(this,t):this.exprAllowed=s.beforeExpr},$s.parenR.updateContext=$s.braceR.updateContext=function(){if(1!==this.context.length){var t=this.context.pop();t===Li.b_stat&&"function"===this.curContext().token&&(t=this.context.pop()),this.exprAllowed=!t.isExpr}else this.exprAllowed=!0},$s.braceL.updateContext=function(t){this.context.push(this.braceIsBlock(t)?Li.b_stat:Li.b_expr),this.exprAllowed=!0},$s.dollarBraceL.updateContext=function(){this.context.push(Li.b_tmpl),this.exprAllowed=!0},$s.parenL.updateContext=function(t){var e=t===$s._if||t===$s._for||t===$s._with||t===$s._while;this.context.push(e?Li.p_stat:Li.p_expr),this.exprAllowed=!0},$s.incDec.updateContext=function(){},$s._function.updateContext=$s._class.updateContext=function(t){!t.beforeExpr||t===$s.semi||t===$s._else||t===$s._return&&Zs.test(this.input.slice(this.lastTokEnd,this.start))||(t===$s.colon||t===$s.braceL)&&this.curContext()===Li.b_stat?this.context.push(Li.f_stat):this.context.push(Li.f_expr),this.exprAllowed=!1},$s.backQuote.updateContext=function(){this.curContext()===Li.q_tmpl?this.context.pop():this.context.push(Li.q_tmpl),this.exprAllowed=!1},$s.star.updateContext=function(t){if(t===$s._function){var e=this.context.length-1;this.context[e]===Li.f_expr?this.context[e]=Li.f_expr_gen:this.context[e]=Li.f_gen}this.exprAllowed=!0},$s.name.updateContext=function(t){var e=!1;this.options.ecmaVersion>=6&&t!==$s.dot&&("of"===this.value&&!this.exprAllowed||"yield"===this.value&&this.inGeneratorContext())&&(e=!0),this.exprAllowed=e};var Bi="ASCII ASCII_Hex_Digit AHex Alphabetic Alpha Any Assigned Bidi_Control Bidi_C Bidi_Mirrored Bidi_M Case_Ignorable CI Cased Changes_When_Casefolded CWCF Changes_When_Casemapped CWCM Changes_When_Lowercased CWL Changes_When_NFKC_Casefolded CWKCF Changes_When_Titlecased CWT Changes_When_Uppercased CWU Dash Default_Ignorable_Code_Point DI Deprecated Dep Diacritic Dia Emoji Emoji_Component Emoji_Modifier Emoji_Modifier_Base Emoji_Presentation Extender Ext Grapheme_Base Gr_Base Grapheme_Extend Gr_Ext Hex_Digit Hex IDS_Binary_Operator IDSB IDS_Trinary_Operator IDST ID_Continue IDC ID_Start IDS Ideographic Ideo Join_Control Join_C Logical_Order_Exception LOE Lowercase Lower Math Noncharacter_Code_Point NChar Pattern_Syntax Pat_Syn Pattern_White_Space Pat_WS Quotation_Mark QMark Radical Regional_Indicator RI Sentence_Terminal STerm Soft_Dotted SD Terminal_Punctuation Term Unified_Ideograph UIdeo Uppercase Upper Variation_Selector VS White_Space space XID_Continue XIDC XID_Start XIDS",Ui=Bi+" Extended_Pictographic",ki={9:Bi,10:Ui,11:Ui},Wi="Cased_Letter LC Close_Punctuation Pe Connector_Punctuation Pc Control Cc cntrl Currency_Symbol Sc Dash_Punctuation Pd Decimal_Number Nd digit Enclosing_Mark Me Final_Punctuation Pf Format Cf Initial_Punctuation Pi Letter L Letter_Number Nl Line_Separator Zl Lowercase_Letter Ll Mark M Combining_Mark Math_Symbol Sm Modifier_Letter Lm Modifier_Symbol Sk Nonspacing_Mark Mn Number N Open_Punctuation Ps Other C Other_Letter Lo Other_Number No Other_Punctuation Po Other_Symbol So Paragraph_Separator Zp Private_Use Co Punctuation P punct Separator Z Space_Separator Zs Spacing_Mark Mc Surrogate Cs Symbol S Titlecase_Letter Lt Unassigned Cn Uppercase_Letter Lu",Vi="Adlam Adlm Ahom Ahom Anatolian_Hieroglyphs Hluw Arabic Arab Armenian Armn Avestan Avst Balinese Bali Bamum Bamu Bassa_Vah Bass Batak Batk Bengali Beng Bhaiksuki Bhks Bopomofo Bopo Brahmi Brah Braille Brai Buginese Bugi Buhid Buhd Canadian_Aboriginal Cans Carian Cari Caucasian_Albanian Aghb Chakma Cakm Cham Cham Cherokee Cher Common Zyyy Coptic Copt Qaac Cuneiform Xsux Cypriot Cprt Cyrillic Cyrl Deseret Dsrt Devanagari Deva Duployan Dupl Egyptian_Hieroglyphs Egyp Elbasan Elba Ethiopic Ethi Georgian Geor Glagolitic Glag Gothic Goth Grantha Gran Greek Grek Gujarati Gujr Gurmukhi Guru Han Hani Hangul Hang Hanunoo Hano Hatran Hatr Hebrew Hebr Hiragana Hira Imperial_Aramaic Armi Inherited Zinh Qaai Inscriptional_Pahlavi Phli Inscriptional_Parthian Prti Javanese Java Kaithi Kthi Kannada Knda Katakana Kana Kayah_Li Kali Kharoshthi Khar Khmer Khmr Khojki Khoj Khudawadi Sind Lao Laoo Latin Latn Lepcha Lepc Limbu Limb Linear_A Lina Linear_B Linb Lisu Lisu Lycian Lyci Lydian Lydi Mahajani Mahj Malayalam Mlym Mandaic Mand Manichaean Mani Marchen Marc Masaram_Gondi Gonm Meetei_Mayek Mtei Mende_Kikakui Mend Meroitic_Cursive Merc Meroitic_Hieroglyphs Mero Miao Plrd Modi Modi Mongolian Mong Mro Mroo Multani Mult Myanmar Mymr Nabataean Nbat New_Tai_Lue Talu Newa Newa Nko Nkoo Nushu Nshu Ogham Ogam Ol_Chiki Olck Old_Hungarian Hung Old_Italic Ital Old_North_Arabian Narb Old_Permic Perm Old_Persian Xpeo Old_South_Arabian Sarb Old_Turkic Orkh Oriya Orya Osage Osge Osmanya Osma Pahawh_Hmong Hmng Palmyrene Palm Pau_Cin_Hau Pauc Phags_Pa Phag Phoenician Phnx Psalter_Pahlavi Phlp Rejang Rjng Runic Runr Samaritan Samr Saurashtra Saur Sharada Shrd Shavian Shaw Siddham Sidd SignWriting Sgnw Sinhala Sinh Sora_Sompeng Sora Soyombo Soyo Sundanese Sund Syloti_Nagri Sylo Syriac Syrc Tagalog Tglg Tagbanwa Tagb Tai_Le Tale Tai_Tham Lana Tai_Viet Tavt Takri Takr Tamil Taml Tangut Tang Telugu Telu Thaana Thaa Thai Thai Tibetan Tibt Tifinagh Tfng Tirhuta Tirh Ugaritic Ugar Vai Vaii Warang_Citi Wara Yi Yiii Zanabazar_Square Zanb",Fi=Vi+" Dogra Dogr Gunjala_Gondi Gong Hanifi_Rohingya Rohg Makasar Maka Medefaidrin Medf Old_Sogdian Sogo Sogdian Sogd",Yi={9:Vi,10:Fi,11:Fi+" Elymaic Elym Nandinagari Nand Nyiakeng_Puachue_Hmong Hmnp Wancho Wcho"},Gi={};function Hi(t){var e=Gi[t]={binary:ni(ki[t]+" "+Wi),nonBinary:{General_Category:ni(Wi),Script:ni(Yi[t])}};e.nonBinary.Script_Extensions=e.nonBinary.Script,e.nonBinary.gc=e.nonBinary.General_Category,e.nonBinary.sc=e.nonBinary.Script,e.nonBinary.scx=e.nonBinary.Script_Extensions}Hi(9),Hi(10),Hi(11);var Ki=di.prototype,ji=function(t){this.parser=t,this.validFlags="gim"+(t.options.ecmaVersion>=6?"uy":"")+(t.options.ecmaVersion>=9?"s":""),this.unicodeProperties=Gi[t.options.ecmaVersion>=11?11:t.options.ecmaVersion],this.source="",this.flags="",this.start=0,this.switchU=!1,this.switchN=!1,this.pos=0,this.lastIntValue=0,this.lastStringValue="",this.lastAssertionIsQuantifiable=!1,this.numCapturingParens=0,this.maxBackReference=0,this.groupNames=[],this.backReferenceNames=[]};function Xi(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}function Ji(t){return 36===t||t>=40&&t<=43||46===t||63===t||t>=91&&t<=94||t>=123&&t<=125}function $i(t){return t>=65&&t<=90||t>=97&&t<=122}function Zi(t){return $i(t)||95===t}function qi(t){return Zi(t)||zi(t)}function zi(t){return t>=48&&t<=57}function Qi(t){return t>=48&&t<=57||t>=65&&t<=70||t>=97&&t<=102}function ta(t){return t>=65&&t<=70?t-65+10:t>=97&&t<=102?t-97+10:t-48}function ea(t){return t>=48&&t<=55}ji.prototype.reset=function(t,e,s){var i=-1!==s.indexOf("u");this.start=0|t,this.source=e+"",this.flags=s,this.switchU=i&&this.parser.options.ecmaVersion>=6,this.switchN=i&&this.parser.options.ecmaVersion>=9},ji.prototype.raise=function(t){this.parser.raiseRecoverable(this.start,"Invalid regular expression: /"+this.source+"/: "+t)},ji.prototype.at=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return-1;var a=s.charCodeAt(t);if(!e&&!this.switchU||a<=55295||a>=57344||t+1>=i)return a;var r=s.charCodeAt(t+1);return r>=56320&&r<=57343?(a<<10)+r-56613888:a},ji.prototype.nextIndex=function(t,e){void 0===e&&(e=!1);var s=this.source,i=s.length;if(t>=i)return i;var a,r=s.charCodeAt(t);return!e&&!this.switchU||r<=55295||r>=57344||t+1>=i||(a=s.charCodeAt(t+1))<56320||a>57343?t+1:t+2},ji.prototype.current=function(t){return void 0===t&&(t=!1),this.at(this.pos,t)},ji.prototype.lookahead=function(t){return void 0===t&&(t=!1),this.at(this.nextIndex(this.pos,t),t)},ji.prototype.advance=function(t){void 0===t&&(t=!1),this.pos=this.nextIndex(this.pos,t)},ji.prototype.eat=function(t,e){return void 0===e&&(e=!1),this.current(e)===t&&(this.advance(e),!0)},Ki.validateRegExpFlags=function(t){for(var e=t.validFlags,s=t.flags,i=0;i<s.length;i++){var a=s.charAt(i);-1===e.indexOf(a)&&this.raise(t.start,"Invalid regular expression flag"),s.indexOf(a,i+1)>-1&&this.raise(t.start,"Duplicate regular expression flag")}},Ki.validateRegExpPattern=function(t){this.regexp_pattern(t),!t.switchN&&this.options.ecmaVersion>=9&&t.groupNames.length>0&&(t.switchN=!0,this.regexp_pattern(t))},Ki.regexp_pattern=function(t){t.pos=0,t.lastIntValue=0,t.lastStringValue="",t.lastAssertionIsQuantifiable=!1,t.numCapturingParens=0,t.maxBackReference=0,t.groupNames.length=0,t.backReferenceNames.length=0,this.regexp_disjunction(t),t.pos!==t.source.length&&(t.eat(41)&&t.raise("Unmatched ')'"),(t.eat(93)||t.eat(125))&&t.raise("Lone quantifier brackets")),t.maxBackReference>t.numCapturingParens&&t.raise("Invalid escape");for(var e=0,s=t.backReferenceNames;e<s.length;e+=1){var i=s[e];-1===t.groupNames.indexOf(i)&&t.raise("Invalid named capture referenced")}},Ki.regexp_disjunction=function(t){for(this.regexp_alternative(t);t.eat(124);)this.regexp_alternative(t);this.regexp_eatQuantifier(t,!0)&&t.raise("Nothing to repeat"),t.eat(123)&&t.raise("Lone quantifier brackets")},Ki.regexp_alternative=function(t){for(;t.pos<t.source.length&&this.regexp_eatTerm(t););},Ki.regexp_eatTerm=function(t){return this.regexp_eatAssertion(t)?(t.lastAssertionIsQuantifiable&&this.regexp_eatQuantifier(t)&&t.switchU&&t.raise("Invalid quantifier"),!0):!!(t.switchU?this.regexp_eatAtom(t):this.regexp_eatExtendedAtom(t))&&(this.regexp_eatQuantifier(t),!0)},Ki.regexp_eatAssertion=function(t){var e=t.pos;if(t.lastAssertionIsQuantifiable=!1,t.eat(94)||t.eat(36))return!0;if(t.eat(92)){if(t.eat(66)||t.eat(98))return!0;t.pos=e}if(t.eat(40)&&t.eat(63)){var s=!1;if(this.options.ecmaVersion>=9&&(s=t.eat(60)),t.eat(61)||t.eat(33))return this.regexp_disjunction(t),t.eat(41)||t.raise("Unterminated group"),t.lastAssertionIsQuantifiable=!s,!0}return t.pos=e,!1},Ki.regexp_eatQuantifier=function(t,e){return void 0===e&&(e=!1),!!this.regexp_eatQuantifierPrefix(t,e)&&(t.eat(63),!0)},Ki.regexp_eatQuantifierPrefix=function(t,e){return t.eat(42)||t.eat(43)||t.eat(63)||this.regexp_eatBracedQuantifier(t,e)},Ki.regexp_eatBracedQuantifier=function(t,e){var s=t.pos;if(t.eat(123)){var i=0,a=-1;if(this.regexp_eatDecimalDigits(t)&&(i=t.lastIntValue,t.eat(44)&&this.regexp_eatDecimalDigits(t)&&(a=t.lastIntValue),t.eat(125)))return-1!==a&&a<i&&!e&&t.raise("numbers out of order in {} quantifier"),!0;t.switchU&&!e&&t.raise("Incomplete quantifier"),t.pos=s}return!1},Ki.regexp_eatAtom=function(t){return this.regexp_eatPatternCharacters(t)||t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)},Ki.regexp_eatReverseSolidusAtomEscape=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatAtomEscape(t))return!0;t.pos=e}return!1},Ki.regexp_eatUncapturingGroup=function(t){var e=t.pos;if(t.eat(40)){if(t.eat(63)&&t.eat(58)){if(this.regexp_disjunction(t),t.eat(41))return!0;t.raise("Unterminated group")}t.pos=e}return!1},Ki.regexp_eatCapturingGroup=function(t){if(t.eat(40)){if(this.options.ecmaVersion>=9?this.regexp_groupSpecifier(t):63===t.current()&&t.raise("Invalid group"),this.regexp_disjunction(t),t.eat(41))return t.numCapturingParens+=1,!0;t.raise("Unterminated group")}return!1},Ki.regexp_eatExtendedAtom=function(t){return t.eat(46)||this.regexp_eatReverseSolidusAtomEscape(t)||this.regexp_eatCharacterClass(t)||this.regexp_eatUncapturingGroup(t)||this.regexp_eatCapturingGroup(t)||this.regexp_eatInvalidBracedQuantifier(t)||this.regexp_eatExtendedPatternCharacter(t)},Ki.regexp_eatInvalidBracedQuantifier=function(t){return this.regexp_eatBracedQuantifier(t,!0)&&t.raise("Nothing to repeat"),!1},Ki.regexp_eatSyntaxCharacter=function(t){var e=t.current();return!!Ji(e)&&(t.lastIntValue=e,t.advance(),!0)},Ki.regexp_eatPatternCharacters=function(t){for(var e=t.pos,s=0;-1!==(s=t.current())&&!Ji(s);)t.advance();return t.pos!==e},Ki.regexp_eatExtendedPatternCharacter=function(t){var e=t.current();return!(-1===e||36===e||e>=40&&e<=43||46===e||63===e||91===e||94===e||124===e)&&(t.advance(),!0)},Ki.regexp_groupSpecifier=function(t){if(t.eat(63)){if(this.regexp_eatGroupName(t))return-1!==t.groupNames.indexOf(t.lastStringValue)&&t.raise("Duplicate capture group name"),void t.groupNames.push(t.lastStringValue);t.raise("Invalid group")}},Ki.regexp_eatGroupName=function(t){if(t.lastStringValue="",t.eat(60)){if(this.regexp_eatRegExpIdentifierName(t)&&t.eat(62))return!0;t.raise("Invalid capture group name")}return!1},Ki.regexp_eatRegExpIdentifierName=function(t){if(t.lastStringValue="",this.regexp_eatRegExpIdentifierStart(t)){for(t.lastStringValue+=Xi(t.lastIntValue);this.regexp_eatRegExpIdentifierPart(t);)t.lastStringValue+=Xi(t.lastIntValue);return!0}return!1},Ki.regexp_eatRegExpIdentifierStart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),function(t){return Fs(t,!0)||36===t||95===t}(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},Ki.regexp_eatRegExpIdentifierPart=function(t){var e=t.pos,s=this.options.ecmaVersion>=11,i=t.current(s);return t.advance(s),92===i&&this.regexp_eatRegExpUnicodeEscapeSequence(t,s)&&(i=t.lastIntValue),function(t){return Ys(t,!0)||36===t||95===t||8204===t||8205===t}(i)?(t.lastIntValue=i,!0):(t.pos=e,!1)},Ki.regexp_eatAtomEscape=function(t){return!!(this.regexp_eatBackReference(t)||this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)||t.switchN&&this.regexp_eatKGroupName(t))||(t.switchU&&(99===t.current()&&t.raise("Invalid unicode escape"),t.raise("Invalid escape")),!1)},Ki.regexp_eatBackReference=function(t){var e=t.pos;if(this.regexp_eatDecimalEscape(t)){var s=t.lastIntValue;if(t.switchU)return s>t.maxBackReference&&(t.maxBackReference=s),!0;if(s<=t.numCapturingParens)return!0;t.pos=e}return!1},Ki.regexp_eatKGroupName=function(t){if(t.eat(107)){if(this.regexp_eatGroupName(t))return t.backReferenceNames.push(t.lastStringValue),!0;t.raise("Invalid named reference")}return!1},Ki.regexp_eatCharacterEscape=function(t){return this.regexp_eatControlEscape(t)||this.regexp_eatCControlLetter(t)||this.regexp_eatZero(t)||this.regexp_eatHexEscapeSequence(t)||this.regexp_eatRegExpUnicodeEscapeSequence(t,!1)||!t.switchU&&this.regexp_eatLegacyOctalEscapeSequence(t)||this.regexp_eatIdentityEscape(t)},Ki.regexp_eatCControlLetter=function(t){var e=t.pos;if(t.eat(99)){if(this.regexp_eatControlLetter(t))return!0;t.pos=e}return!1},Ki.regexp_eatZero=function(t){return 48===t.current()&&!zi(t.lookahead())&&(t.lastIntValue=0,t.advance(),!0)},Ki.regexp_eatControlEscape=function(t){var e=t.current();return 116===e?(t.lastIntValue=9,t.advance(),!0):110===e?(t.lastIntValue=10,t.advance(),!0):118===e?(t.lastIntValue=11,t.advance(),!0):102===e?(t.lastIntValue=12,t.advance(),!0):114===e&&(t.lastIntValue=13,t.advance(),!0)},Ki.regexp_eatControlLetter=function(t){var e=t.current();return!!$i(e)&&(t.lastIntValue=e%32,t.advance(),!0)},Ki.regexp_eatRegExpUnicodeEscapeSequence=function(t,e){void 0===e&&(e=!1);var s,i=t.pos,a=e||t.switchU;if(t.eat(117)){if(this.regexp_eatFixedHexDigits(t,4)){var r=t.lastIntValue;if(a&&r>=55296&&r<=56319){var n=t.pos;if(t.eat(92)&&t.eat(117)&&this.regexp_eatFixedHexDigits(t,4)){var o=t.lastIntValue;if(o>=56320&&o<=57343)return t.lastIntValue=1024*(r-55296)+(o-56320)+65536,!0}t.pos=n,t.lastIntValue=r}return!0}if(a&&t.eat(123)&&this.regexp_eatHexDigits(t)&&t.eat(125)&&((s=t.lastIntValue)>=0&&s<=1114111))return!0;a&&t.raise("Invalid unicode escape"),t.pos=i}return!1},Ki.regexp_eatIdentityEscape=function(t){if(t.switchU)return!!this.regexp_eatSyntaxCharacter(t)||!!t.eat(47)&&(t.lastIntValue=47,!0);var e=t.current();return!(99===e||t.switchN&&107===e)&&(t.lastIntValue=e,t.advance(),!0)},Ki.regexp_eatDecimalEscape=function(t){t.lastIntValue=0;var e=t.current();if(e>=49&&e<=57){do{t.lastIntValue=10*t.lastIntValue+(e-48),t.advance()}while((e=t.current())>=48&&e<=57);return!0}return!1},Ki.regexp_eatCharacterClassEscape=function(t){var e=t.current();if(function(t){return 100===t||68===t||115===t||83===t||119===t||87===t}(e))return t.lastIntValue=-1,t.advance(),!0;if(t.switchU&&this.options.ecmaVersion>=9&&(80===e||112===e)){if(t.lastIntValue=-1,t.advance(),t.eat(123)&&this.regexp_eatUnicodePropertyValueExpression(t)&&t.eat(125))return!0;t.raise("Invalid property name")}return!1},Ki.regexp_eatUnicodePropertyValueExpression=function(t){var e=t.pos;if(this.regexp_eatUnicodePropertyName(t)&&t.eat(61)){var s=t.lastStringValue;if(this.regexp_eatUnicodePropertyValue(t)){var i=t.lastStringValue;return this.regexp_validateUnicodePropertyNameAndValue(t,s,i),!0}}if(t.pos=e,this.regexp_eatLoneUnicodePropertyNameOrValue(t)){var a=t.lastStringValue;return this.regexp_validateUnicodePropertyNameOrValue(t,a),!0}return!1},Ki.regexp_validateUnicodePropertyNameAndValue=function(t,e,s){ai(t.unicodeProperties.nonBinary,e)||t.raise("Invalid property name"),t.unicodeProperties.nonBinary[e].test(s)||t.raise("Invalid property value")},Ki.regexp_validateUnicodePropertyNameOrValue=function(t,e){t.unicodeProperties.binary.test(e)||t.raise("Invalid property name")},Ki.regexp_eatUnicodePropertyName=function(t){var e=0;for(t.lastStringValue="";Zi(e=t.current());)t.lastStringValue+=Xi(e),t.advance();return""!==t.lastStringValue},Ki.regexp_eatUnicodePropertyValue=function(t){var e=0;for(t.lastStringValue="";qi(e=t.current());)t.lastStringValue+=Xi(e),t.advance();return""!==t.lastStringValue},Ki.regexp_eatLoneUnicodePropertyNameOrValue=function(t){return this.regexp_eatUnicodePropertyValue(t)},Ki.regexp_eatCharacterClass=function(t){if(t.eat(91)){if(t.eat(94),this.regexp_classRanges(t),t.eat(93))return!0;t.raise("Unterminated character class")}return!1},Ki.regexp_classRanges=function(t){for(;this.regexp_eatClassAtom(t);){var e=t.lastIntValue;if(t.eat(45)&&this.regexp_eatClassAtom(t)){var s=t.lastIntValue;!t.switchU||-1!==e&&-1!==s||t.raise("Invalid character class"),-1!==e&&-1!==s&&e>s&&t.raise("Range out of order in character class")}}},Ki.regexp_eatClassAtom=function(t){var e=t.pos;if(t.eat(92)){if(this.regexp_eatClassEscape(t))return!0;if(t.switchU){var s=t.current();(99===s||ea(s))&&t.raise("Invalid class escape"),t.raise("Invalid escape")}t.pos=e}var i=t.current();return 93!==i&&(t.lastIntValue=i,t.advance(),!0)},Ki.regexp_eatClassEscape=function(t){var e=t.pos;if(t.eat(98))return t.lastIntValue=8,!0;if(t.switchU&&t.eat(45))return t.lastIntValue=45,!0;if(!t.switchU&&t.eat(99)){if(this.regexp_eatClassControlLetter(t))return!0;t.pos=e}return this.regexp_eatCharacterClassEscape(t)||this.regexp_eatCharacterEscape(t)},Ki.regexp_eatClassControlLetter=function(t){var e=t.current();return!(!zi(e)&&95!==e)&&(t.lastIntValue=e%32,t.advance(),!0)},Ki.regexp_eatHexEscapeSequence=function(t){var e=t.pos;if(t.eat(120)){if(this.regexp_eatFixedHexDigits(t,2))return!0;t.switchU&&t.raise("Invalid escape"),t.pos=e}return!1},Ki.regexp_eatDecimalDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;zi(s=t.current());)t.lastIntValue=10*t.lastIntValue+(s-48),t.advance();return t.pos!==e},Ki.regexp_eatHexDigits=function(t){var e=t.pos,s=0;for(t.lastIntValue=0;Qi(s=t.current());)t.lastIntValue=16*t.lastIntValue+ta(s),t.advance();return t.pos!==e},Ki.regexp_eatLegacyOctalEscapeSequence=function(t){if(this.regexp_eatOctalDigit(t)){var e=t.lastIntValue;if(this.regexp_eatOctalDigit(t)){var s=t.lastIntValue;e<=3&&this.regexp_eatOctalDigit(t)?t.lastIntValue=64*e+8*s+t.lastIntValue:t.lastIntValue=8*e+s}else t.lastIntValue=e;return!0}return!1},Ki.regexp_eatOctalDigit=function(t){var e=t.current();return ea(e)?(t.lastIntValue=e-48,t.advance(),!0):(t.lastIntValue=0,!1)},Ki.regexp_eatFixedHexDigits=function(t,e){var s=t.pos;t.lastIntValue=0;for(var i=0;i<e;++i){var a=t.current();if(!Qi(a))return t.pos=s,!1;t.lastIntValue=16*t.lastIntValue+ta(a),t.advance()}return!0};var sa=function(t){this.type=t.type,this.value=t.value,this.start=t.start,this.end=t.end,t.options.locations&&(this.loc=new hi(t,t.startLoc,t.endLoc)),t.options.ranges&&(this.range=[t.start,t.end])},ia=di.prototype;function aa(t){return"function"!=typeof BigInt?null:BigInt(t.replace(/_/g,""))}function ra(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode(55296+(t>>10),56320+(1023&t)))}ia.next=function(t){!t&&this.type.keyword&&this.containsEsc&&this.raiseRecoverable(this.start,"Escape sequence in keyword "+this.type.keyword),this.options.onToken&&this.options.onToken(new sa(this)),this.lastTokEnd=this.end,this.lastTokStart=this.start,this.lastTokEndLoc=this.endLoc,this.lastTokStartLoc=this.startLoc,this.nextToken()},ia.getToken=function(){return this.next(),new sa(this)},"undefined"!=typeof Symbol&&(ia[Symbol.iterator]=function(){var t=this;return{next:function(){var e=t.getToken();return{done:e.type===$s.eof,value:e}}}}),ia.curContext=function(){return this.context[this.context.length-1]},ia.nextToken=function(){var t=this.curContext();return t&&t.preserveSpace||this.skipSpace(),this.start=this.pos,this.options.locations&&(this.startLoc=this.curPosition()),this.pos>=this.input.length?this.finishToken($s.eof):t.override?t.override(this):void this.readToken(this.fullCharCodeAtPos())},ia.readToken=function(t){return Fs(t,this.options.ecmaVersion>=6)||92===t?this.readWord():this.getTokenFromCode(t)},ia.fullCharCodeAtPos=function(){var t=this.input.charCodeAt(this.pos);return t<=55295||t>=57344?t:(t<<10)+this.input.charCodeAt(this.pos+1)-56613888},ia.skipBlockComment=function(){var t,e=this.options.onComment&&this.curPosition(),s=this.pos,i=this.input.indexOf("*/",this.pos+=2);if(-1===i&&this.raise(this.pos-2,"Unterminated comment"),this.pos=i+2,this.options.locations)for(qs.lastIndex=s;(t=qs.exec(this.input))&&t.index<this.pos;)++this.curLine,this.lineStart=t.index+t[0].length;this.options.onComment&&this.options.onComment(!0,this.input.slice(s+2,i),s,this.pos,e,this.curPosition())},ia.skipLineComment=function(t){for(var e=this.pos,s=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=t);this.pos<this.input.length&&!zs(i);)i=this.input.charCodeAt(++this.pos);this.options.onComment&&this.options.onComment(!1,this.input.slice(e+t,this.pos),e,this.pos,s,this.curPosition())},ia.skipSpace=function(){t:for(;this.pos<this.input.length;){var t=this.input.charCodeAt(this.pos);switch(t){case 32:case 160:++this.pos;break;case 13:10===this.input.charCodeAt(this.pos+1)&&++this.pos;case 10:case 8232:case 8233:++this.pos,this.options.locations&&(++this.curLine,this.lineStart=this.pos);break;case 47:switch(this.input.charCodeAt(this.pos+1)){case 42:this.skipBlockComment();break;case 47:this.skipLineComment(2);break;default:break t}break;default:if(!(t>8&&t<14||t>=5760&&Qs.test(String.fromCharCode(t))))break t;++this.pos}}},ia.finishToken=function(t,e){this.end=this.pos,this.options.locations&&(this.endLoc=this.curPosition());var s=this.type;this.type=t,this.value=e,this.updateContext(s)},ia.readToken_dot=function(){var t=this.input.charCodeAt(this.pos+1);if(t>=48&&t<=57)return this.readNumber(!0);var e=this.input.charCodeAt(this.pos+2);return this.options.ecmaVersion>=6&&46===t&&46===e?(this.pos+=3,this.finishToken($s.ellipsis)):(++this.pos,this.finishToken($s.dot))},ia.readToken_slash=function(){var t=this.input.charCodeAt(this.pos+1);return this.exprAllowed?(++this.pos,this.readRegexp()):61===t?this.finishOp($s.assign,2):this.finishOp($s.slash,1)},ia.readToken_mult_modulo_exp=function(t){var e=this.input.charCodeAt(this.pos+1),s=1,i=42===t?$s.star:$s.modulo;return this.options.ecmaVersion>=7&&42===t&&42===e&&(++s,i=$s.starstar,e=this.input.charCodeAt(this.pos+2)),61===e?this.finishOp($s.assign,s+1):this.finishOp(i,s)},ia.readToken_pipe_amp=function(t){var e=this.input.charCodeAt(this.pos+1);if(e===t){if(this.options.ecmaVersion>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp($s.assign,3);return this.finishOp(124===t?$s.logicalOR:$s.logicalAND,2)}return 61===e?this.finishOp($s.assign,2):this.finishOp(124===t?$s.bitwiseOR:$s.bitwiseAND,1)},ia.readToken_caret=function(){return 61===this.input.charCodeAt(this.pos+1)?this.finishOp($s.assign,2):this.finishOp($s.bitwiseXOR,1)},ia.readToken_plus_min=function(t){var e=this.input.charCodeAt(this.pos+1);return e===t?45!==e||this.inModule||62!==this.input.charCodeAt(this.pos+2)||0!==this.lastTokEnd&&!Zs.test(this.input.slice(this.lastTokEnd,this.pos))?this.finishOp($s.incDec,2):(this.skipLineComment(3),this.skipSpace(),this.nextToken()):61===e?this.finishOp($s.assign,2):this.finishOp($s.plusMin,1)},ia.readToken_lt_gt=function(t){var e=this.input.charCodeAt(this.pos+1),s=1;return e===t?(s=62===t&&62===this.input.charCodeAt(this.pos+2)?3:2,61===this.input.charCodeAt(this.pos+s)?this.finishOp($s.assign,s+1):this.finishOp($s.bitShift,s)):33!==e||60!==t||this.inModule||45!==this.input.charCodeAt(this.pos+2)||45!==this.input.charCodeAt(this.pos+3)?(61===e&&(s=2),this.finishOp($s.relational,s)):(this.skipLineComment(4),this.skipSpace(),this.nextToken())},ia.readToken_eq_excl=function(t){var e=this.input.charCodeAt(this.pos+1);return 61===e?this.finishOp($s.equality,61===this.input.charCodeAt(this.pos+2)?3:2):61===t&&62===e&&this.options.ecmaVersion>=6?(this.pos+=2,this.finishToken($s.arrow)):this.finishOp(61===t?$s.eq:$s.prefix,1)},ia.readToken_question=function(){var t=this.options.ecmaVersion;if(t>=11){var e=this.input.charCodeAt(this.pos+1);if(46===e){var s=this.input.charCodeAt(this.pos+2);if(s<48||s>57)return this.finishOp($s.questionDot,2)}if(63===e){if(t>=12)if(61===this.input.charCodeAt(this.pos+2))return this.finishOp($s.assign,3);return this.finishOp($s.coalesce,2)}}return this.finishOp($s.question,1)},ia.getTokenFromCode=function(t){switch(t){case 46:return this.readToken_dot();case 40:return++this.pos,this.finishToken($s.parenL);case 41:return++this.pos,this.finishToken($s.parenR);case 59:return++this.pos,this.finishToken($s.semi);case 44:return++this.pos,this.finishToken($s.comma);case 91:return++this.pos,this.finishToken($s.bracketL);case 93:return++this.pos,this.finishToken($s.bracketR);case 123:return++this.pos,this.finishToken($s.braceL);case 125:return++this.pos,this.finishToken($s.braceR);case 58:return++this.pos,this.finishToken($s.colon);case 96:if(this.options.ecmaVersion<6)break;return++this.pos,this.finishToken($s.backQuote);case 48:var e=this.input.charCodeAt(this.pos+1);if(120===e||88===e)return this.readRadixNumber(16);if(this.options.ecmaVersion>=6){if(111===e||79===e)return this.readRadixNumber(8);if(98===e||66===e)return this.readRadixNumber(2)}case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return this.readNumber(!1);case 34:case 39:return this.readString(t);case 47:return this.readToken_slash();case 37:case 42:return this.readToken_mult_modulo_exp(t);case 124:case 38:return this.readToken_pipe_amp(t);case 94:return this.readToken_caret();case 43:case 45:return this.readToken_plus_min(t);case 60:case 62:return this.readToken_lt_gt(t);case 61:case 33:return this.readToken_eq_excl(t);case 63:return this.readToken_question();case 126:return this.finishOp($s.prefix,1)}this.raise(this.pos,"Unexpected character '"+ra(t)+"'")},ia.finishOp=function(t,e){var s=this.input.slice(this.pos,this.pos+e);return this.pos+=e,this.finishToken(t,s)},ia.readRegexp=function(){for(var t,e,s=this.pos;;){this.pos>=this.input.length&&this.raise(s,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(Zs.test(i)&&this.raise(s,"Unterminated regular expression"),t)t=!1;else{if("["===i)e=!0;else if("]"===i&&e)e=!1;else if("/"===i&&!e)break;t="\\"===i}++this.pos}var a=this.input.slice(s,this.pos);++this.pos;var r=this.pos,n=this.readWord1();this.containsEsc&&this.unexpected(r);var o=this.regexpState||(this.regexpState=new ji(this));o.reset(s,a,n),this.validateRegExpFlags(o),this.validateRegExpPattern(o);var h=null;try{h=new RegExp(a,n)}catch(t){}return this.finishToken($s.regexp,{pattern:a,flags:n,value:h})},ia.readInt=function(t,e,s){for(var i=this.options.ecmaVersion>=12&&void 0===e,a=s&&48===this.input.charCodeAt(this.pos),r=this.pos,n=0,o=0,h=0,c=null==e?1/0:e;h<c;++h,++this.pos){var _=this.input.charCodeAt(this.pos),l=void 0;if(i&&95===_)a&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed in legacy octal numeric literals"),95===o&&this.raiseRecoverable(this.pos,"Numeric separator must be exactly one underscore"),0===h&&this.raiseRecoverable(this.pos,"Numeric separator is not allowed at the first of digits"),o=_;else{if((l=_>=97?_-97+10:_>=65?_-65+10:_>=48&&_<=57?_-48:1/0)>=t)break;o=_,n=n*t+l}}return i&&95===o&&this.raiseRecoverable(this.pos-1,"Numeric separator is not allowed at the last of digits"),this.pos===r||null!=e&&this.pos-r!==e?null:n},ia.readRadixNumber=function(t){var e=this.pos;this.pos+=2;var s=this.readInt(t);return null==s&&this.raise(this.start+2,"Expected number in radix "+t),this.options.ecmaVersion>=11&&110===this.input.charCodeAt(this.pos)?(s=aa(this.input.slice(e,this.pos)),++this.pos):Fs(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken($s.num,s)},ia.readNumber=function(t){var e=this.pos;t||null!==this.readInt(10,void 0,!0)||this.raise(e,"Invalid number");var s=this.pos-e>=2&&48===this.input.charCodeAt(e);s&&this.strict&&this.raise(e,"Invalid number");var i=this.input.charCodeAt(this.pos);if(!s&&!t&&this.options.ecmaVersion>=11&&110===i){var a=aa(this.input.slice(e,this.pos));return++this.pos,Fs(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number"),this.finishToken($s.num,a)}s&&/[89]/.test(this.input.slice(e,this.pos))&&(s=!1),46!==i||s||(++this.pos,this.readInt(10),i=this.input.charCodeAt(this.pos)),69!==i&&101!==i||s||(43!==(i=this.input.charCodeAt(++this.pos))&&45!==i||++this.pos,null===this.readInt(10)&&this.raise(e,"Invalid number")),Fs(this.fullCharCodeAtPos())&&this.raise(this.pos,"Identifier directly after number");var r,n=(r=this.input.slice(e,this.pos),s?parseInt(r,8):parseFloat(r.replace(/_/g,"")));return this.finishToken($s.num,n)},ia.readCodePoint=function(){var t;if(123===this.input.charCodeAt(this.pos)){this.options.ecmaVersion<6&&this.unexpected();var e=++this.pos;t=this.readHexChar(this.input.indexOf("}",this.pos)-this.pos),++this.pos,t>1114111&&this.invalidStringToken(e,"Code point out of bounds")}else t=this.readHexChar(4);return t},ia.readString=function(t){for(var e="",s=++this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===t)break;92===i?(e+=this.input.slice(s,this.pos),e+=this.readEscapedChar(!1),s=this.pos):(zs(i,this.options.ecmaVersion>=10)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return e+=this.input.slice(s,this.pos++),this.finishToken($s.string,e)};var na={};ia.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(t){if(t!==na)throw t;this.readInvalidTemplateToken()}this.inTemplateElement=!1},ia.invalidStringToken=function(t,e){if(this.inTemplateElement&&this.options.ecmaVersion>=9)throw na;this.raise(t,e)},ia.readTmplToken=function(){for(var t="",e=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var s=this.input.charCodeAt(this.pos);if(96===s||36===s&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==$s.template&&this.type!==$s.invalidTemplate?(t+=this.input.slice(e,this.pos),this.finishToken($s.template,t)):36===s?(this.pos+=2,this.finishToken($s.dollarBraceL)):(++this.pos,this.finishToken($s.backQuote));if(92===s)t+=this.input.slice(e,this.pos),t+=this.readEscapedChar(!0),e=this.pos;else if(zs(s)){switch(t+=this.input.slice(e,this.pos),++this.pos,s){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:t+="\n";break;default:t+=String.fromCharCode(s)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),e=this.pos}else++this.pos}},ia.readInvalidTemplateToken=function(){for(;this.pos<this.input.length;this.pos++)switch(this.input[this.pos]){case"\\":++this.pos;break;case"$":if("{"!==this.input[this.pos+1])break;case"`":return this.finishToken($s.invalidTemplate,this.input.slice(this.start,this.pos))}this.raise(this.start,"Unterminated template")},ia.readEscapedChar=function(t){var e=this.input.charCodeAt(++this.pos);switch(++this.pos,e){case 110:return"\n";case 114:return"\r";case 120:return String.fromCharCode(this.readHexChar(2));case 117:return ra(this.readCodePoint());case 116:return"\t";case 98:return"\b";case 118:return"\v";case 102:return"\f";case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:return this.options.locations&&(this.lineStart=this.pos,++this.curLine),"";case 56:case 57:if(t){var s=this.pos-1;return this.invalidStringToken(s,"Invalid escape sequence in template string"),null}default:if(e>=48&&e<=55){var i=this.input.substr(this.pos-1,3).match(/^[0-7]+/)[0],a=parseInt(i,8);return a>255&&(i=i.slice(0,-1),a=parseInt(i,8)),this.pos+=i.length-1,e=this.input.charCodeAt(this.pos),"0"===i&&56!==e&&57!==e||!this.strict&&!t||this.invalidStringToken(this.pos-1-i.length,t?"Octal literal in template string":"Octal literal in strict mode"),String.fromCharCode(a)}return zs(e)?"":String.fromCharCode(e)}},ia.readHexChar=function(t){var e=this.pos,s=this.readInt(16,t);return null===s&&this.invalidStringToken(e,"Bad character escape sequence"),s},ia.readWord1=function(){this.containsEsc=!1;for(var t="",e=!0,s=this.pos,i=this.options.ecmaVersion>=6;this.pos<this.input.length;){var a=this.fullCharCodeAtPos();if(Ys(a,i))this.pos+=a<=65535?1:2;else{if(92!==a)break;this.containsEsc=!0,t+=this.input.slice(s,this.pos);var r=this.pos;117!==this.input.charCodeAt(++this.pos)&&this.invalidStringToken(this.pos,"Expecting Unicode escape sequence \\uXXXX"),++this.pos;var n=this.readCodePoint();(e?Fs:Ys)(n,i)||this.invalidStringToken(r,"Invalid Unicode escape"),t+=ra(n),s=this.pos}e=!1}return t+this.input.slice(s,this.pos)},ia.readWord=function(){var t=this.readWord1(),e=$s.name;return this.keywords.test(t)&&(e=Xs[t]),this.finishToken(e,t)};function oa(t){return e=t,s={ecmaVersion:2020},di.parse(e,s);var e,s}function ha(t){return["Array1D","Array2D","Literal","Symbol","UnaryOperation","BinaryOperation","Random","CallDefinedFunction","AnyFunction","ConditionalExpression"].includes(t.type)}function ca(t){switch(t.type){case"Program":return function(t){if(1!==t.body.length)throw new Error("bodyが1以外の場合評価できません。");return ca(t.body[0])}(t);case"ExpressionStatement":return function(t){return ca(t.expression)}(t);case"AssignmentExpression":return function(t){const e=ca(t.left),s=ca(t.right);if(!ha(s))throw new Error("値以外を代入式の右辺に設定できません");switch(t.operator){case"=":case"+=":case"-=":case"*=":case"/=":if("Array2D"===e.type){if("m"===e.name||"o"===e.name)return{type:"PartsAssignment",partsKind:"m"===e.name?"map":"object",destinationX:e.index0,destinationY:e.index1,value:s,operator:t.operator};throw new Error("想定していない記号が2次元配列ででてきました")}if("Array1D"===e.type){if("ITEM"===e.name)return{type:"ItemAssignment",itemBoxPosition1to12:e.index0,value:s,operator:t.operator};if("v"===e.name)return{type:"UserVariableAssignment",index:e.index0,value:s,operator:t.operator};throw new Error("")}if("Symbol"===e.type){if("m"===e.name||"o"===e.name||"v"===e.name||"ITEM"===e.name)throw new Error("このシンボルには代入できません");if("AT_TOTAL"===e.name)throw new Error('"装備品込みの攻撃力(AT_TOTAL)への代入はできません。"');if("DF_TOTAL"===e.name)throw new Error('"装備品込みの防御力(DF_TOTAL)への代入はできません。"');if("ENEMY_HP"===e.name||"ENEMY_AT"===e.name||"ENEMY_DF"===e.name||"ENEMY_GD"===e.name)throw new Error("敵ステータス (ENEMY_HP, ENEMY_AT, ENEMY_DF, ENEMY_GD) への代入はできません。");return{type:"SpecialParameterAssignment",kind:e.name,value:s,operator:t.operator}}throw"Literal"===e.type?new Error("数値には代入できません"):new Error("代入できません");default:throw new Error("想定していないオペレーターです")}}(t);case"MemberExpression":return function(t){const e=ca(t.object),s=ca(t.property);if("Symbol"===e.type){if("v"!==e.name&&"m"!==e.name&&"o"!==e.name&&"ITEM"!==e.name)throw new Error("このシンボルは配列にできません");if("Literal"===s.type||"Symbol"===s.type||"BinaryOperation"===s.type||"Array1D"===s.type)return{type:"Array1D",name:e.name,index0:s};throw new Error("WWAでは存在しない構文です")}if("Array1D"===e.type){if("ITEM"===e.name||"v"===e.name)throw new Error("この配列は2次元以上にはできません。");if("Literal"===s.type||"Symbol"===s.type||"BinaryOperation"===s.type||"Array1D"===s.type)return{type:"Array2D",name:e.name,index0:e.index0,index1:s};throw new Error("WWAでは存在しない構文です")}}(t);case"UnaryExpression":return function(t){const e=ca(t.argument);if(!["+","-","!"].includes(t.operator))throw new Error("未定義の演算子です :"+t.operator);if(!ha(e))throw new Error("単項演算子が適用できません");return{type:"UnaryOperation",operator:t.operator,argument:e}}(t);case"BinaryExpression":return function(t){const e=ca(t.left),s=ca(t.right);if(!ha(e)||!ha(s))throw new Error("左辺または右辺が評価不能です");switch(t.operator){case"+":case"-":case"*":case"/":case"%":case">":case"<":case">=":case"<=":case"==":case"!=":return{type:"BinaryOperation",operator:t.operator,left:e,right:s};default:throw new Error("未定義の演算子です :"+t.operator)}}(t);case"Identifier":return function(t){switch(t.name){case"m":case"o":case"ITEM":case"X":case"Y":case"PX":case"PY":case"v":case"HP":case"HPMAX":case"AT":case"AT_TOTAL":case"DF":case"DF_TOTAL":case"GD":case"STEP":case"TIME":case"PDIR":case"i":case"j":case"k":case"LOOPLIMIT":case"ITEM_ID":case"ITEM_POS":case"ENEMY_HP":case"ENEMY_AT":case"ENEMY_DF":return{type:"Symbol",name:t.name};default:return{type:"Literal",value:t.name}}}(t);case"Literal":return function(t){return{type:"Literal",value:t.value}}(t);case"CallExpression":return function(t){const e=t.callee.name;switch(e){case"RAND":return function(t){if(t.length<1)throw new Error("RAND関数には引数が必要です。");return{type:"Random",value:ca(t[0])}}(t.arguments);case"JUMPGATE":return function(t){if(t.length<2)throw new Error("RAND関数には引数が2つ必要です。");const e={x:t[0],y:t[1]};return{type:"Jumpgate",x:ca(e.x),y:ca(e.y)}}(t.arguments);case"MSG":case"MESSAGE":return{type:"Msg",value:ca(t.arguments[0])};case"SOUND":case"SAVE":case"LOG":case"ABLE_CHANGE_SPEED":case"SET_SPEED":case"CHANGE_GAMEOVER_POS":case"DEL_PLAYER":case"RESTART_GAME":case"URL_JUMPGATE":case"HIDE_STATUS":case"PARTS":case"FACE":case"EFFECT":case"CHANGE_PLAYER_IMAGE":case"HAS_ITEM":case"REMOVE_ITEM":case"MOVE":case"IS_PLAYER_WAITING_MESSAGE":case"GET_UNIXTIME":case"GET_DATE_YEAR":case"GET_DATE_MONTH":case"GET_DATE_DAY":case"GET_DATE_HOUR":case"GET_DATE_MINUTES":case"GET_DATE_SECONDS":case"GET_DATE_MILLISECONDS":case"GET_DATE_WEEKDAY":case"CHANGE_SYSMSG":case"PICTURE":case"PICTURE_FROM_PARTS":case"SHOW_USER_DEF_VAR":case"ABS":case"GET_GAMEOVER_POS_X":case"GET_GAMEOVER_POS_Y":case"ABORT_BATTLE":case"EXIT":return function(t,e){return{type:"AnyFunction",functionName:e,value:t.map((t=>ca(t)))}}(t.arguments,e);default:return{type:"CallDefinedFunction",functionName:e}}}(t);case"IfStatement":return function(t){const e=ca(t.consequent),s=ca(t.test);return{type:"IfStatement",consequent:e,test:s,alternate:t.alternate?ca(t.alternate):void 0}}(t);case"BlockStatement":return function(t){return{type:"BlockStatement",value:t.body.map((t=>ca(t)))}}(t);case"FunctionDeclaration":return function(t){return{type:"DefinedFunction",functionName:t.id.name,body:ca(t.body)}}(t);case"ForStatement":return function(t){const e=t.body.body.map((t=>ca(t)));return{type:"ForStatement",body:e,init:ca(t.init),test:ca(t.test),update:ca(t.update)}}(t);case"BreakStatement":return function(t){return{type:"Break",label:t.label}}(t);case"ReturnStatement":return function(t){return{type:"Return",argument:ca(t.argument)}}(t);case"ContinueStatement":return function(t){return{type:"Continue",label:t.label}}(t);case"UpdateExpression":return function(t){return{type:"UpdateExpression",operator:t.operator,argument:ca(t.argument)}}(t);case"LogicalExpression":return function(t){return{type:"LogicalExpression",operator:t.operator,left:ca(t.left),right:ca(t.right)}}(t);case"TemplateLiteral":return function(t){return{type:"TemplateLiteral",expressions:t.expressions.map((t=>ca(t))),quasis:t.quasis.map((t=>ca(t)))}}(t);case"TemplateElement":return function(t){return{type:"TemplateElement",value:t.value}}(t);case"ConditionalExpression":return function(t){const e=ca(t.consequent),s=ca(t.alternate),i=ca(t.test);return{type:"ConditionalExpression",consequent:e,test:i,alternate:s}}(t);case"Property":return _a(t);case"ObjectExpression":return function(t){return{type:"ObjectExpression",properties:t.properties.map(_a)}}(t);case"ArrayExpression":return function(t){return{type:"ArrayExpression",elements:t.elements.map(ca)}}(t);default:throw console.log(t),new Error("未定義の AST ノードです :"+t.type)}}function _a(t){const e=ca(t.key);if("Symbol"===e.type)throw new Error(`Object のキー ${e.name} は予約されているため、使用できません。`);if("Literal"!==e.type)throw new Error(`Object のキーが不正です。 Literal を期待していましたが、実際は ${e.type} でした。`);return{type:"Property",key:e,value:ca(t.value)}}di.acorn={Parser:di,version:"7.4.1",defaultOptions:_i,Position:oi,SourceLocation:hi,getLineInfo:ci,Node:Oi,TokenType:Gs,tokTypes:$s,keywordTypes:Xs,TokContext:xi,tokContexts:Li,isIdentifierChar:Ys,isIdentifierStart:Fs,Token:sa,isNewLine:zs,lineBreak:Zs,lineBreakG:qs,nonASCIIwhitespace:Qs};const la=[v.OBJECT,v.MAP];class ua{constructor(t){this.wwa=t,this.loop_limit=1e5,this.state={}}setEarnedItem(t,e){this.state={...this.state,earnedItem:{partsId:t,itemPos:e}}}clearEarnedItem(){this.state={...this.state,earnedItem:void 0}}setBattleDamageCalculationMode(t){this.state={...this.state,battleDamageCalculation:{estimatingParams:t}}}clearBattleDamageCalculationMode(){this.state={...this.state,battleDamageCalculation:void 0}}evalWwaNodes(t){return this.evalWwaNode({type:"BlockStatement",value:t})}evalWwaNode(t){if("BlockStatement"!==t.type||!Array.isArray(t.value)||0!==t.value.length)try{return new da(this).evalWwaNode(t)}catch(t){if(t instanceof pa||t instanceof ma)return t.value;throw t}}updateLoopLimit(t){this.loop_limit=t}}class da{constructor(t){this.generator=t,this.for_id={i:null,j:null,k:null,loopCount:0,break_flag:!1,continue_flag:!1}}evalWwaNodes(t){let e;return t.forEach((t=>{e=this.evalWwaNode(t)})),e}evalWwaNode(t){if(!this.for_id.break_flag&&!this.for_id.continue_flag)switch(t.type){case"UnaryOperation":return this.evalUnaryOperation(t);case"BinaryOperation":return this.evalBinaryOperation(t);case"Symbol":return this.evalSymbol(t);case"Array1D":return this.evalArray1D(t);case"Array2D":return this.evalArray2D(t);case"Literal":return this.evalNumber(t);case"UserVariableAssignment":return this.evalSetUserVariable(t);case"SpecialParameterAssignment":return this.evalSetSpecialParameter(t);case"Random":return this.evalRandom(t);case"Jumpgate":return this.evalJumpgate(t);case"Msg":return this.evalMessage(t);case"ItemAssignment":return this.itemAssignment(t);case"IfStatement":return this.ifStatement(t);case"BlockStatement":return this.blockStatement(t);case"PartsAssignment":return this.partsAssignment(t);case"ForStatement":return this.forStateMent(t);case"AnyFunction":return this.wrapCallFunction(t,(t=>this.evalAnyFunction(t)));case"CallDefinedFunction":return this.wrapCallFunction(t,(t=>this.callDefinedFunction(t)));case"Break":return this.breakStatement(t);case"Return":throw new pa(this.returnStatement(t));case"Continue":return this.contunueStatment(t);case"UpdateExpression":return this.updateExpression(t);case"LogicalExpression":return this.logicalExpression(t);case"TemplateLiteral":return this.convertTemplateLiteral(t);case"ConditionalExpression":return this.convertConditionalExpression(t);case"Property":return this.property(t);case"ObjectExpression":return this.objectExpression(t);case"ArrayExpression":return this.arrayExpression(t);default:throw console.log(t),new Error("未定義または未実装のノードです")}}wrapCallFunction(t,e){try{return e(t)}catch(t){if(t instanceof pa)return t.value;throw t}}callDefinedFunction(t){const e=this.generator.wwa.getUserScript(t.functionName);if(null===e)throw new Error(`未定義の関数が呼び出されました: ${t.functionName}`);return this.evalWwaNode(e)}updateExpression(t){if("Symbol"!==t.argument.type)throw console.log(t),new Error("node.argument.typeがSymbolではありません。:"+t.argument.type);{const e=this.evalSymbol(t.argument),s=(()=>{switch(t.operator){case"++":return e+1;case"--":return e-1;default:throw new Error("想定外のOperatorが渡されました :"+t.operator)}})(),i={type:"SpecialParameterAssignment",kind:t.argument.name,value:{type:"Literal",value:s}};this.evalSetSpecialParameter(i)}}logicalExpression(t){const e=this.evalWwaNode(t.left),s=this.evalWwaNode(t.right);switch(t.operator){case"||":return e||s;case"&&":return e&&s;default:throw new Error("存在しない論理式です!: "+t.operator)}}convertTemplateLiteral(t){const e=t.expressions.map((t=>this.evalWwaNode(t))),s=t.quasis.map((t=>t.value.cooked));let i="";return s.forEach(((t,s)=>{i+=t,e[s]&&(i+=e[s])})),i}contunueStatment(t){this.for_id.continue_flag=!0}breakStatement(t){this.for_id.break_flag=!0}returnStatement(t){return this.evalWwaNode(t.argument)}forStateMent(t){const e=t.init;for((()=>{switch(e.kind){case"i":if(null!==this.for_id.i)throw new Error("iの値が既に外側のforループで使われています。");break;case"j":if(null!==this.for_id.j)throw new Error("jの値が既に外側のforループで使われています。");break;case"k":if(null!==this.for_id.k)throw new Error("kの値が既に外側のforループで使われています。");break;default:throw new Error("予想外の変数がfor文内で使用されました :"+e.kind)}this.evalWwaNode(t.init)})();this.evalWwaNode(t.test);this.evalWwaNode(t.update)){if(this.for_id.loopCount++,this.for_id.loopCount>this.generator.loop_limit)throw new Error("処理回数が多すぎます!\n上限値は LOOPLIMIT で変えられます。");if(this.for_id.break_flag)break;if(!this.evalWwaNode(t.test))break;this.evalWwaNodes(t.body),this.for_id.continue_flag=!1}switch(this.for_id.break_flag=!1,e.kind){case"i":this.for_id.i=null;break;case"j":this.for_id.j=null;break;case"k":this.for_id.k=null}}_checkArgsLength(t,e){if(e.value.length<t)throw new Error(`関数 ${e.functionName} の引数が不足しています!`)}evalAnyFunction(t){const e=this.generator.wwa.getGameStatus();switch(t.functionName){case"SOUND":{this._checkArgsLength(1,t);const e=this.evalWwaNode(t.value[0]);return this.generator.wwa.playSound(e),e}case"SAVE":{this._checkArgsLength(1,t);const e=Boolean(this.evalWwaNode(t.value[0]));return this.generator.wwa.disableSave(e),e}case"LOG":{this._checkArgsLength(1,t);const e=this.evalWwaNode(t.value[0]);return void console.log(e)}case"ABLE_CHANGE_SPEED":{this._checkArgsLength(1,t);const e=Boolean(this.evalWwaNode(t.value[0]));return this.generator.wwa.speedChangeJudge(e),e}case"SET_SPEED":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0]));return void this.generator.wwa.setPlayerSpeedIndex(e)}case"CHANGE_GAMEOVER_POS":{this._checkArgsLength(2,t);const e={x:Number(this.evalWwaNode(t.value[0])),y:Number(this.evalWwaNode(t.value[1]))};if(e.x<0||e.x>=this.generator.wwa.getMapWidth()||e.y<0||e.y>this.generator.wwa.getMapWidth())throw new Error("マップの範囲外が指定されています!");return void this.generator.wwa.setGameOverPosition(new c(e.x,e.y))}case"DEL_PLAYER":{this._checkArgsLength(1,t);const e=Boolean(this.evalWwaNode(t.value[0]));return void this.generator.wwa.setDelPlayer(e)}case"RESTART_GAME":return void this.generator.wwa.restartGame();case"URL_JUMPGATE":throw new Error("URL_JUMPGATE 関数は調整中のためご利用になれません");case"HIDE_STATUS":{this._checkArgsLength(2,t);const e=Number(this.evalWwaNode(t.value[0])),s=Boolean(this.evalWwaNode(t.value[1]));return void this.generator.wwa.hideStatus(e,s)}case"PARTS":{this._checkArgsLength(2,t);const e=Number(this.evalWwaNode(t.value[0])),s=Number(this.evalWwaNode(t.value[1]));let i=t.value[2]?Number(this.evalWwaNode(t.value[2])):0,a=!t.value[3]||Boolean(this.evalWwaNode(t.value[3]));if(e<0||s<0)throw new Error("パーツ番号が不正です");if(!la.includes(i))throw new Error("パーツ種別が不明です");return void this.generator.wwa.replaceParts(e,s,i,a)}case"FACE":{this._checkArgsLength(6,t);const e=Number(this.evalWwaNode(t.value[0])),s=Number(this.evalWwaNode(t.value[1])),i=Number(this.evalWwaNode(t.value[2])),a=Number(this.evalWwaNode(t.value[3])),r=Number(this.evalWwaNode(t.value[4])),n=Number(this.evalWwaNode(t.value[5]));if(e<0||s<0||i<0||a<0||r<0||n<0)throw new Error("各引数は0以上の整数でなければなりません。");return void this.generator.wwa.addFace(new l(new c(e,s),new c(i,a),new c(r,n)))}case"EFFECT":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0]));if(e<0)throw new Error("待ち時間は0以上の整数でなければなりません。");if(0===e)return void this.generator.wwa.stopEffect();const s=[];for(let e=1;e<t.value.length;e+=2){const i=Number(this.evalWwaNode(t.value[e]));if(i<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");if(e+1===t.value.length)throw new Error("画像のパーツ座標指定で、Y座標が指定されていません。");const a=Number(this.evalWwaNode(t.value[e+1]));if(a<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");s.push(new c(i,a))}return void this.generator.wwa.setEffect(e,s)}case"CHANGE_PLAYER_IMAGE":{this._checkArgsLength(2,t);const e=Number(this.evalWwaNode(t.value[0])),s=Number(this.evalWwaNode(t.value[1])),i=new c(e,s);return void this.generator.wwa.setPlayerImgCoord(i)}case"HAS_ITEM":{this._checkArgsLength(1,t);const s=Number(this.evalWwaNode(t.value[0]));return e.itemBox.includes(s)}case"REMOVE_ITEM":{this._checkArgsLength(1,t);const s=Number(this.evalWwaNode(t.value[0])),i=!!t.value[1]&&1===this.evalWwaNode(t.value[1]);let a=0;for(let t=0;t<e.itemBox.length;t++)if(s===e.itemBox[t]&&(this.generator.wwa.setPlayerGetItem(t+1,0),a++,!i))return a;return a}case"MOVE":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0]));if(e<=0||e>9)throw Error("MOVEの移動先は2/4/6/8で指定してください!");return this.generator.wwa.movePlayer(e),this.generator.wwa.movePlayer(e),0}case"IS_PLAYER_WAITING_MESSAGE":return this.generator.wwa.isPlayerWaitingMessage();case"GET_UNIXTIME":return Math.floor((new Date).getTime()/1e3);case"GET_DATE_YEAR":return(new Date).getFullYear();case"GET_DATE_MONTH":return(new Date).getMonth()+1;case"GET_DATE_DAY":return(new Date).getDate();case"GET_DATE_HOUR":return(new Date).getHours();case"GET_DATE_MINUTES":return(new Date).getMinutes();case"GET_DATE_SECONDS":return(new Date).getSeconds();case"GET_DATE_MILLISECONDS":return(new Date).getMilliseconds();case"GET_DATE_WEEKDAY":return(new Date).getDay();case"SHOW_USER_DEF_VAR":return void console.log(this.generator.wwa.getAllUserNameVar());case"CHANGE_SYSMSG":{this._checkArgsLength(1,t);const e=this.evalWwaNode(t.value[0]),s=t.value.length>=2?this.evalWwaNode(t.value[1]):void 0,i=this.resolveSystemMessageKeyFromMacroArg(e);if(!i)throw new Error("このIDのシステムメッセージは未定義です。");if("number"==typeof s||"string"==typeof s||"boolean"==typeof s)this.generator.wwa.overwriteSystemMessage(i,String(s));else{if(null!=s)throw new Error("この値は文字列に変換できないため、システムメッセージを表示できません。");this.generator.wwa.overwriteSystemMessage(i,void 0)}break}case"PICTURE":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0])),s=t.value.length>=2?this.evalWwaNode(t.value[1]):void 0;if(void 0===s)return void this.generator.wwa.deletePictureRegistry(e);if("object"==typeof s)this.generator.wwa.setPictureRegistryFromObject(e,s);else{if("string"!=typeof s)throw new Error("ピクチャのプロパティ定義は文字列あるいはオブジェクトである必要があります。");this.generator.wwa.setPictureRegistryFromRawText(e,s)}break}case"PICTURE_FROM_PARTS":{this._checkArgsLength(2,t);const e=Number(this.evalWwaNode(t.value[0])),s=Number(this.evalWwaNode(t.value[1])),i=t.value.length>=3?Number(this.evalWwaNode(t.value[2])):v.OBJECT;if(!la.includes(i))throw new Error("パーツ種別が不明です");const a=this.generator.wwa.getGameStatus();this.generator.wwa.setPictureRegistry(e,s,i,a.playerCoord);break}case"ABS":{this._checkArgsLength(1,t);const e=Number(this.evalWwaNode(t.value[0]));return Math.abs(e)}case"GET_GAMEOVER_POS_X":return this.generator.wwa.getGemeOverPosition().x;case"GET_GAMEOVER_POS_Y":return this.generator.wwa.getGemeOverPosition().y;case"ABORT_BATTLE":throw this.generator.state.battleDamageCalculation&&(this.generator.state.battleDamageCalculation.aborted=!0),new ma("ABORT_BATTLE");case"EXIT":throw new ma("EXIT",this.evalWwaNode(t.value[0]));default:throw new Error("未定義の関数が指定されました: "+t.functionName)}}resolveSystemMessageKeyFromMacroArg(t){return"string"==typeof t?r(t)?t:void 0:"number"==typeof t?n(t):void 0}partsAssignment(t){const e=this.generator.wwa.getGameStatus(),s=this.evalWwaNode(t.destinationX),i=this.evalWwaNode(t.destinationY),a=this.evalWwaNode(t.value),r="map"===t.partsKind?v.MAP:v.OBJECT;this.generator.wwa.appearPartsEval(e.playerCoord,s,i,a,r)}blockStatement(t){return this.evalWwaNodes(t.value)}ifStatement(t){return this.evalWwaNode(t.test)?this.evalWwaNode(t.consequent):t.alternate?this.evalWwaNode(t.alternate):void 0}convertConditionalExpression(t){const e=this.evalWwaNode(t.test)?t.consequent:t.alternate;return this.evalWwaNode(e)}property(t){return[this.evalWwaNode(t.key),this.evalWwaNode(t.value)]}objectExpression(t){return Object.fromEntries(t.properties.map((t=>this.evalWwaNode(t))))}arrayExpression(t){return t.elements.map((t=>this.evalWwaNode(t)))}itemAssignment(t){const e=this.evalWwaNode(t.itemBoxPosition1to12),s=this.evalWwaNode(t.value);this.generator.wwa.setPlayerGetItem(e,s)}evalMessage(t){const e=this.evalWwaNode(t.value),s=isNaN(e)?e:e.toString();this.generator.wwa.reserveMessageDisplayWhenShouldOpen(s)}evalJumpgate(t){const e=this.evalWwaNode(t.x),s=this.evalWwaNode(t.y);if(isNaN(e)||isNaN(s))throw new Error(`飛び先の値が数値になっていません。 x=${e} / y=${s}`);this.generator.wwa.forcedJumpGate(e,s)}evalRandom(t){const e=this.evalWwaNode(t.value);return Math.floor(Math.random()*e)}evalSetSpecialParameter(t){const e=this.evalWwaNode(t.value);if(!this.generator.wwa||isNaN(e))return e;const s=this.evalSymbol({type:"Symbol",name:t.kind}),i=(()=>{switch(t.operator){case"+=":return s+e;case"-=":return s-e;case"*=":return s*e;case"/=":return s/e;default:return e}})();switch(t.kind){case"PX":return this.generator.wwa.jumpSpecifiedXPos(i),i;case"PY":return this.generator.wwa.jumpSpecifiedYPos(i),i;case"AT":return this.generator.wwa.setPlayerStatus(x.STRENGTH,i,!1),i;case"DF":return this.generator.wwa.setPlayerStatus(x.DEFENCE,i,!1),i;case"GD":return this.generator.wwa.setPlayerStatus(x.GOLD,i,!1),i;case"HP":return this.generator.wwa.setPlayerStatus(x.ENERGY,i,!1),i;case"HPMAX":return this.generator.wwa.setPlayerEnergyMax(i),i;case"i":return this.for_id.i=this.evalWwaNode(t.value),this.for_id.i;case"j":return this.for_id.j=this.evalWwaNode(t.value),this.for_id.j;case"k":return this.for_id.k=this.evalWwaNode(t.value),this.for_id.k;case"LOOPLIMIT":{const e=this.evalWwaNode(t.value);return this.generator.updateLoopLimit(e),e}default:return void console.error("未実装の要素です: "+t.kind)}}evalSetUserVariable(t){const e=this.evalWwaNode(t.value);if(!this.generator.wwa)return e;const s=this.evalWwaNode(t.index);return this.generator.wwa.setUserVar(s,e,t.operator),e}evalUnaryOperation(t){switch(t.operator){case"+":return this.evalWwaNode(t.argument);case"-":return-this.evalWwaNode(t.argument);case"!":return!this.evalWwaNode(t.argument);default:throw new Error("存在しない単項演算子です")}}evalBinaryOperation(t){const e=this.evalWwaNode(t.left),s=this.evalWwaNode(t.right);switch(t.operator){case"+":return e+s;case"-":return e-s;case"*":return e*s;case"/":return 0===s?0:Math.floor(e/s);case"%":return 0===s?0:e%s;case">":return e>s;case">=":return e>=s;case"<":return e<s;case"<=":return e<=s;case"==":return e==s;case"!=":return e!=s;default:throw new Error("存在しない単項演算子です")}}evalSymbol(t){var e,s,i,a,r,n,o,h,c,_,l,u,d,p,m,E,g,w,f,v,y,S,A,T,I,C,P,D;const N=this.generator.wwa.getGameStatus(),O=this.generator.wwa.getEnemyStatus();switch(t.name){case"X":case"Y":return 0;case"PX":return N.playerCoord.x;case"PY":return N.playerCoord.y;case"AT":return N.bareStatus.strength;case"AT_TOTAL":return null!==(i=null===(s=null===(e=this.generator.state.battleDamageCalculation)||void 0===e?void 0:e.estimatingParams)||void 0===s?void 0:s.playerStatus.strength)&&void 0!==i?i:N.totalStatus.strength;case"DF":return N.bareStatus.defence;case"DF_TOTAL":return null!==(n=null===(r=null===(a=this.generator.state.battleDamageCalculation)||void 0===a?void 0:a.estimatingParams)||void 0===r?void 0:r.playerStatus.defence)&&void 0!==n?n:N.totalStatus.defence;case"GD":return null!==(c=null===(h=null===(o=this.generator.state.battleDamageCalculation)||void 0===o?void 0:o.estimatingParams)||void 0===h?void 0:h.playerStatus.gold)&&void 0!==c?c:N.totalStatus.gold;case"HP":return null!==(u=null===(l=null===(_=this.generator.state.battleDamageCalculation)||void 0===_?void 0:_.estimatingParams)||void 0===l?void 0:l.playerStatus.energy)&&void 0!==u?u:N.totalStatus.energy;case"HPMAX":return N.energyMax;case"STEP":return N.moveCount;case"TIME":return N.playTime;case"PDIR":return N.playerDirection;case"i":return this.for_id.i;case"j":return this.for_id.j;case"k":return this.for_id.k;case"LOOPLIMIT":return this.generator.loop_limit;case"ITEM_ID":return null!==(p=null===(d=this.generator.state.earnedItem)||void 0===d?void 0:d.partsId)&&void 0!==p?p:-1;case"ITEM_POS":return null!==(E=null===(m=this.generator.state.earnedItem)||void 0===m?void 0:m.itemPos)&&void 0!==E?E:-1;case"ENEMY_HP":return null!==(f=null===(w=null===(g=this.generator.state.battleDamageCalculation)||void 0===g?void 0:g.estimatingParams)||void 0===w?void 0:w.enemyStatus.energy)&&void 0!==f?f:"number"==typeof O?-1:O.energy;case"ENEMY_AT":return null!==(S=null===(y=null===(v=this.generator.state.battleDamageCalculation)||void 0===v?void 0:v.estimatingParams)||void 0===y?void 0:y.enemyStatus.strength)&&void 0!==S?S:"number"==typeof O?-1:O.strength;case"ENEMY_DF":return null!==(I=null===(T=null===(A=this.generator.state.battleDamageCalculation)||void 0===A?void 0:A.estimatingParams)||void 0===T?void 0:T.enemyStatus.defence)&&void 0!==I?I:"number"==typeof O?-1:O.defence;case"ENEMY_GD":return null!==(D=null===(P=null===(C=this.generator.state.battleDamageCalculation)||void 0===C?void 0:C.estimatingParams)||void 0===P?void 0:P.enemyStatus.gold)&&void 0!==D?D:"number"==typeof O?-1:O.gold;default:throw new Error("このシンボルは取得できません")}}evalArray1D(t){const e=this.evalWwaNode(t.index0);if("number"!=typeof e){if("v"===t.name)return this.generator.wwa.getUserNameVar(e);throw new Error("このシンボルは取得できません")}const s=this.generator.wwa.getGameStatus();switch(t.name){case"v":return this.generator.wwa.getUserVar(e);case"ITEM":if(void 0===s.itemBox[e])throw new Error("ITEMの添字に想定外の値が入っています。: "+e);return s.itemBox[e];default:throw new Error("このシンボルは取得できません")}}evalArray2D(t){switch(t.name){case"m":case"o":const e=this.evalWwaNode(t.index0),s=this.evalWwaNode(t.index1),i="o"===t.name?v.OBJECT:v.MAP;return this.generator.wwa.getPartsID(new c(e,s),i);default:throw new Error("このシンボルは取得できません")}}evalNumber(t){return t.value}}class pa{constructor(t){this.value=t}}class ma{constructor(t,e){this.reason=t,this.value=e}}const Ea="user-variable-label";const ga="-",wa="user-variable-card";function fa({index:t,value:e}){const s=document.createElement("div");return s.classList.add(wa),s.dataset.varIndex=String(t),s.appendChild(function(t){const e=document.createElement("div");e.classList.add("index"),e.textContent=String(t),"string"==typeof t&&e.setAttribute("title",t);return e.appendChild(function(){const t=document.createElement("div");return t.textContent="-",t.setAttribute("aria-hidden","true"),t.classList.add(Ea),t}()),e}(t)),s.appendChild(function(t){const e=document.createElement("div");e.classList.add("value"),"string"==typeof t&&e.setAttribute("title",At(t));return va(e,t),e}(e)),s}function va(t,e){t.textContent=void 0===e?ga:At(e)}const ya="user-variable-list";function Sa({index:t,value:e}){const s=document.createElement("li");return s.appendChild(fa({index:t,value:e})),s}function Aa(t,{index:e,value:s}){t.appendChild(Sa({index:e,value:s}))}const Ta="information";function Ia(t,e,s=!1){t.textContent=`${s?"【エラー】":""}${e}`}function Ca({heading:t,contentVisibilityToggleButton:e,information:s}){const i=document.createElement("header");return i.appendChild(function({heading:t,contentVisibilityToggleButton:e}){const s=document.createElement("div");s.classList.add("heading-area");const i=document.createElement("h2");i.textContent=t.text,s.appendChild(i);const a=document.createElement("button");a.classList.add("content-visibility-toggle-button"),Pa(a,!0),e.onClick&&a.addEventListener("click",e.onClick.bind(a));return s.appendChild(a),s}({heading:t,contentVisibilityToggleButton:e})),s&&i.appendChild(function(){const t=document.createElement("p");return t.classList.add(Ta),Ia(t,"強調されている番号にカーソルを乗せると説明が表示されます。"),t}()),i}function Pa(t,e){t.textContent=e?"▲隠す":"▼表示"}const Da="user-variable-list-section";function Na({kind:t}){const e=document.createElement("section");e.classList.add(Da),e.dataset.kind=t;const s=function({kind:t}){const e=document.createElement("ul");return e.classList.add(ya),"numbered"===t&&Array.from({length:V.USER_VAR_NUM}).map(((t,e)=>Sa({index:e}))).forEach((t=>e.appendChild(t))),e}({kind:t}),i=Ca({heading:{text:"named"===t?"名前つき変数一覧":"変数一覧"},information:"numbered"===t?{}:void 0,contentVisibilityToggleButton:{onClick:t=>{const e=i.querySelector(`.${Ta}`);"true"===s.getAttribute("aria-hidden")?function(t,e,s){t.removeAttribute("aria-hidden"),e instanceof HTMLElement&&e.removeAttribute("aria-hidden");s instanceof HTMLElement&&Pa(s,!0)}(s,e,t.target):function(t,e,s){t.setAttribute("aria-hidden","true"),e instanceof HTMLElement&&e.setAttribute("aria-hidden","true");s instanceof HTMLElement&&Pa(s,!1)}(s,e,t.target)}}});return e.appendChild(i),e.appendChild(s),e}function Oa(t,e){t instanceof HTMLElement&&Array.from({length:V.USER_VAR_NUM}).map(((s,i)=>{const a=function(t,e){return t.querySelector(`${La(e)} > .value`)}(t,i);a instanceof HTMLElement&&va(a,e[i])}))}function ba(t,e){t&&Array.from({length:V.USER_VAR_NUM}).map(((s,i)=>{const a=e[i];if(!a)return;const r=function(t,e){return t.querySelector(`${La(e)} > .index`)}(t,i);if(!(r instanceof HTMLElement))return;const n=r.querySelector(`.${Ea}`);n instanceof HTMLElement&&(function(t,e){t.textContent=e}(n,a),function(t,e){t.dataset.labelledVarIndex="true",t.addEventListener("mouseover",(()=>e.removeAttribute("aria-hidden"))),t.addEventListener("mouseleave",(()=>e.setAttribute("aria-hidden","true")))}(r,n))}))}function Ma(t,e,s=!1){if(!t)return;const i=function(t){return t.querySelector(`.${xa} > header > .${Ta}`)}(t);i instanceof HTMLElement&&Ia(i,e,s)}const xa=`.${Da}[data-kind="numbered"]`;function La(t){return`${xa} > .${ya} > li > .${wa}[data-var-index="${CSS.escape(String(t))}"]`}function Ra(t,e){if(!(t instanceof HTMLElement))return;const s=function(t){return new Set([...t.querySelectorAll(Ua)].map((t=>t instanceof HTMLElement?t.dataset.varIndex:void 0)).filter(Boolean))}(t),i=Wa(t);if(i instanceof HTMLElement){for(const[a,r]of e){const e=Fa(t,a);s.delete(a),e instanceof HTMLElement?va(e,r):Aa(i,{index:a,value:r})}for(const e of s){const s=Va(t,e).parentElement;s instanceof HTMLLIElement&&Wa(t).removeChild(s)}}}const Ba=`.${Da}[data-kind="named"]`,Ua=`${Ba} > .${ya} > li > .${wa}`;function ka(t){return`${Ua}[data-var-index="${CSS.escape(t)}"]`}function Wa(t){return t.querySelector(`${Ba} > .${ya}`)}function Va(t,e){return t.querySelector(ka(e))}function Fa(t,e){return t.querySelector(`${ka(e)} > .value`)}const Ya="wwa-vardump-wrapper";let Ga;function Ha(t,e,s){var i=new G;return i.current=t,i.total=e,i.stage=s,i}class Ka{constructor(t,e=!1,s,a,r,n,o="",l=!1,u=null,m,E,w=!1,f=null,v){var C;this._useSuspend=!1,this._useLookingAround=!0,this._isDisallowLoadOldSave=!1,this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0,this._windowCloseWaitingMessageDisplayRequests=[],this._playerAndObjectsStopWaitingMessageDisplayRequests=[],this._windowCloseWaitingJumpGateRequest=void 0,this._debugConsoleElement=void 0,this.audioExtension="",this.soundLoadedCheckTimer=void 0,this._playTimeCalculator=void 0,this.userDefinedFunctions={},this.convertWwaNodes=t=>function(t){if("Program"===t.type)return t.body.map((t=>ca(t)));return[ca(t)]}(oa(t)),this.mainCaller=()=>this._main(),this.soundCheckCaller=()=>this.checkAllSoundLoaded(),this._checkTurnKeyPressed=()=>this._keyStore.checkHitKey(q.KEY_ESC)||this._keyStore.checkHitKey(q.KEY_SHIFT)||this._keyStore.checkHitKey(q.KEY_N),this._saveDataList=[],this.wwaCustomEventEmitter=new Ns(dt("wwa-wrapper")),window.addEventListener("click",(t=>{this._isActive=!1})),dt("wwa-wrapper").addEventListener("click",(t=>{t.stopPropagation(),this._isActive=!0})),this._isActive=!0,null===s?(this._hasTitleImg=!1,this._cvsCover=dt("progress-panel"),(C=this._cvsCover.getContext("2d")).fillStyle="rgb(0, 0, 0)"):this._hasTitleImg=!0;try{this._hasTitleImg?(dt("unstable-version-warning").textContent="この WWA Wing は [不安定版] です。",dt("version").textContent="WWA Wing Ver.4.1.0-unstable.based-on.3.12.11.p.4"):this._setLoadingMessage(C,0)}catch(t){}this._dumpElement=u;const P=window.AudioContext||window.webkitAudioContext;P&&(this.audioContext=new P,this.audioGain=this.audioContext.createGain(),this.audioGain.gain.setValueAtTime(1,this.audioContext.currentTime));var D=new Audio;"no"!==D.canPlayType("audio/mpeg")&&""!==D.canPlayType("audio/mpeg")?this.audioExtension="mp3":this.audioExtension="m4a",this.userDevice=new O,this._isURLGateEnable=e,this._isClassicModeEnable=a,this._mainCallCounter=0,this._animationCounter=0,this._statusPressCounter=new h(0,0,0,0),o?"/"!==o[o.length-1]&&(o+="/"):o="./audio/",this._audioDirectory=o,this._bottomButtonType=n?d.GOTO_WWA:d.BATTLE_REPORT;var N=(new Date).getTime();if(!!location.href.match(/^file/))if(this.userDevice.device===S.GAME){if(this.userDevice.os===y.NINTENDO)V.BATTLE_INTERVAL_FRAME_NUM=5;this._bottomButtonType=d.GAME_END}else alert("【警告】直接HTMLファイルを開いているようです。\nこのプログラムは正常に動作しない可能性があります。\nマップデータの確認を行う場合には同梱の「wwa-server.exe」をご利用ください。\n"+(this.userDevice.browser===A.FIREFOX?"Firefoxの場合も、バージョン68以降はローカルのHTMLファイルを直接開いた場合、通常起動できないことを確認しております。":""));switch(this.userDevice.device){case S.VR:case S.GAME:this._usePassword=!1;break;default:this._usePassword=!0}switch(dt("cell-save").textContent=Y.QUICK_SAVE,this._usePassword?dt("cell-load").textContent=Y.PASSWORD:dt("cell-load").textContent=Y.EMPTY_LOAD,this._bottomButtonType){case d.GOTO_WWA:dt("cell-gotowwa").textContent=Y.GOTO_WWA;break;case d.BATTLE_REPORT:dt("cell-gotowwa").textContent=Y.BATTLE_REPORT;break;case d.GAME_END:dt("cell-gotowwa").textContent=Y.GAME_END}this._loadHandler=t=>{var e;this._wwaData=t,this._wwaData.isItemEffectEnabled=r;try{this._hasTitleImg?dt("version").textContent+=" (Map data Ver. "+Math.floor(this._wwaData.version/10)+"."+ +this._wwaData.version%10+")":this._setLoadingMessage(C,1)}catch(t){}var s=dt("wwa-wrapper").getAttribute("data-wwa-mapdata").split("/");s.pop(),s.push(this._wwaData.mapCGName),this._wwaData.mapCGName=s.join("/"),this._playTimeCalculator=new ot,this._restartData=JSON.parse(JSON.stringify(this._wwaData)),this.checkOriginalMapString=this._generateMapDataHash(this._restartData),this.initCSSRule(),this._setProgressBar(Ha(0,4,H.GAME_INIT)),this._setLoadingMessage(C,2);var a=new Image;a.src=this._wwaData.mapCGName,a.addEventListener("error",(()=>{this._setErrorMessage("画像ファイル「"+this._wwaData.mapCGName+"」が見つかりませんでした。\n管理者の方へ: データがアップロードされているか、\nパーミッションを確かめてください。",C)}));var n=this._wwaData.mapCGName.replace("(","\\(").replace(")","\\)");const o=t=>{t.style.backgroundImage="url("+n+")"};Array.prototype.forEach.call(gt("div.item-cell"),(t=>{t.style.backgroundPosition=`-${this._wwaData.imgItemboxX*V.CHIP_SIZE}px -${this._wwaData.imgItemboxY*V.CHIP_SIZE}px`,t.style.backgroundImage="url("+n+")"})),Array.prototype.forEach.call(gt("div.wide-cell-row"),(t=>{t.style.backgroundPosition="-160px -120px",t.style.backgroundImage="url("+n+")"})),Array.prototype.forEach.call(gt(".item-cell>.item-click-border"),(t=>{t.style.backgroundImage="url('"+V.ITEM_BORDER_IMG_DATA_URL+"')",t.style.backgroundPosition="0 0",t.style.display="none",t.style.cursor="pointer"})),Array.prototype.forEach.call(gt(".item-cell>.item-disp"),o),Array.prototype.forEach.call(gt("div.wide-cell-row>.status-icon"),o),this.setStatusIconCoord(L.ENERGY,new c(this._wwaData.imgStatusEnergyX,this._wwaData.imgStatusEnergyY)),this.setStatusIconCoord(L.STRENGTH,new c(this._wwaData.imgStatusStrengthX,this._wwaData.imgStatusStrengthY)),this.setStatusIconCoord(L.DEFENCE,new c(this._wwaData.imgStatusDefenceX,this._wwaData.imgStatusDefenceY)),this.setStatusIconCoord(L.GOLD,new c(this._wwaData.imgStatusGoldX,this._wwaData.imgStatusGoldY)),this._setProgressBar(Ha(1,4,H.GAME_INIT)),this._setLoadingMessage(C,3),this._mapIDTableCreate(),this._replaceAllRandomObjects();var u=(new Date).getTime();console.log("Loading Complete!"+(u-N)+"ms"),this._cvs=dt("wwa-map");var d=this._cvs.getContext("2d",{alpha:!1});d.fillStyle="rgba( 255, 255, 255, 0.5)",d.fillRect(0,0,440,440);var m=new _(this,this._wwaData.playerX,this._wwaData.playerY);this._camera=new Ae(m),this._itemMenu=new Ze;var A=new h(this._wwaData.statusEnergy,this._wwaData.statusStrength,this._wwaData.statusDefence,this._wwaData.statusGold);this._player=new Pe(this,m,this._camera,A,this._wwaData.statusEnergyMax,this._wwaData.moves,this._wwaData.gameSpeedIndex),this._userVar={numbered:Array.from({length:V.USER_VAR_NUM}).map((()=>0)),named:new Map},this._objectMovingDataManager=new Oe(this,this._player),this._camera.setPlayer(this._player),this._keyStore=new at,this._mouseStore=new rt,w?(this._virtualPadButtonElements={BUTTON_ENTER:dt("wwa-enter-button"),BUTTON_ESC:dt("wwa-esc-button"),BUTTON_FAST:dt("wwa-fast-button"),BUTTON_SLOW:dt("wwa-slow-button"),BUTTON_LEFT:dt("wwa-left-button"),BUTTON_UP:dt("wwa-up-button"),BUTTON_RIGHT:dt("wwa-right-button"),BUTTON_DOWN:dt("wwa-down-button")},this._virtualPadStore=new lt(this._virtualPadButtonElements,Je(),dt("wwa-virtualpad-right"),dt("wwa-virtualpad-left"),this._setVirtualPadTouch.bind(this),this._setVirtualPadLeave.bind(this)),function(t,e){if(null===t)return;const s=document.createElement("button");s.classList.add("wwa-virtualpad-toggle-button"),s.textContent="仮想パッド表示切り替え",s.addEventListener("click",e),t.appendChild(s)}(f,(()=>{this._virtualPadStore.toggleVisible()}))):(this._virtualPadButtonElements=null,this._virtualPadStore=new lt({})),this._debugConsoleElement=function(t){if(null===t)return;const e=document.createElement("section");e.setAttribute("id","wwa-debug-console");const s=document.createElement("textarea");s.setAttribute("rows","10"),s.setAttribute("cols","60"),s.textContent='v["money"] = 100;\nv["name"] = "ヤツロウ";\nMSG(v["name"]+"「俺の所持金は"+v["money"]+"ゴールドだ」");\nSHOW_USER_DEF_VAR();';const i=t=>t.stopPropagation();s.addEventListener("keydown",i),s.addEventListener("keypress",i),s.addEventListener("keyup",i),s.classList.add("console-text-area"),e.appendChild(s);const a=document.createElement("button");return a.classList.add("script-running-button"),a.textContent="実行(X)",e.appendChild(a),t.appendChild(e),e}(dt("wwa-debug-console-area")),null===(e=this._debugConsoleElement)||void 0===e||e.querySelector(".script-running-button").addEventListener("click",(()=>{this._debugEvalString()})),this._gamePadStore=new nt,this._pages=[],this._yesNoJudge=g.UNSELECTED,this._yesNoJudgeInNextFrame=g.UNSELECTED,this._yesNoChoiceCallInfo=T.NONE,this._prevFrameEventExected=!1,this._isLastPage=!1,this._reservedPartsAppearances=[],this._reservedJumpDestination=void 0,this._shouldSetNextPage=!1,this._passwordLoadExecInNextFrame=!1,this._messageWindow=new Ge(this,50,180,340,0,this._wwaData.mapCGName,!1,!0,!1,dt("wwa-wrapper")),this._scoreWindow=new Ve(this,new c(50,50),!1,dt("wwa-wrapper")),this._wwaSave=new ms(Ga,Ga._wwaData.worldName,Ga._wwaData.worldPassNumber,this._checkSaveDataCompatibility.bind(this),(t=>{if(t.length>0){let e="これまでに保存されていたセーブデータは、下記の理由により消えたものがあります。";t.forEach((t=>{switch(t){case _s.UNMATCHED_WORLD_NAME:e+="\n・制作者によるマップデータのワールド名の変更";break;case _s.UNMATCHED_WORLD_PASS_NUMBER:e+="\n・制作者によるマップデータの暗証番号の変更";break;case _s.DISALLOW_OLD_REVISION_WORLD_SAVE_DATA:e+="\n・制作者によるマップデータの内容変更 (マップデータ制作者の設定により、内容が変更されるとセーブデータが消去されます)"}})),alert(e)}})),this._isDisallowLoadOldSave=l,this._messageWindow.setWWASave(this._wwaSave),is.setRestartData(this._restartData,this._wwaData),this.clearFaces();const P=dt("wwa-wrapper").getAttribute("data-wwa-resume-savedata");if("string"==typeof P&&(this._useSuspend=!0,P)){var D=is.getStartWWAData(P);this._restartData!==D&&(this._applyQuickLoad(D),this._wwaSave.resumeStart())}const O=dt("wwa-wrapper").getAttribute("data-wwa-autosave");null!==O&&this._wwaSave.setAutoSaveInterval(0|Number(O));const b=dt("wwa-wrapper").getAttribute("data-wwa-looking-around");if(this._useLookingAround=!(b&&b.match(/false/i)),this._setProgressBar(Ha(2,4,H.GAME_INIT)),this._setLoadingMessage(C,4),window.addEventListener("keydown",(t=>{if(this._isActive){if(this.userDevice.os===y.NINTENDO)return t.preventDefault(),void t.stopPropagation();this._keyStore.setPressInfo(t.keyCode),t.keyCode!==q.KEY_F5?this._player.isWaitingMessage()?t.keyCode!==q.KEY_DOWN&&t.keyCode!==q.KEY_LEFT&&t.keyCode!==q.KEY_RIGHT&&t.keyCode!==q.KEY_UP&&t.keyCode!==q.KEY_SHIFT&&t.keyCode!==q.KEY_ENTER&&t.keyCode!==q.KEY_ESC&&t.keyCode!==q.KEY_SPACE||t.preventDefault():this._player.isWaitingPasswordWindow()||t.keyCode!==q.KEY_DOWN&&t.keyCode!==q.KEY_LEFT&&t.keyCode!==q.KEY_RIGHT&&t.keyCode!==q.KEY_UP&&t.keyCode!==q.KEY_SHIFT&&t.keyCode!==q.KEY_ENTER&&t.keyCode!==q.KEY_1&&t.keyCode!==q.KEY_2&&t.keyCode!==q.KEY_3&&t.keyCode!==q.KEY_A&&t.keyCode!==q.KEY_C&&t.keyCode!==q.KEY_D&&t.keyCode!==q.KEY_E&&t.keyCode!==q.KEY_M&&t.keyCode!==q.KEY_N&&t.keyCode!==q.KEY_Q&&t.keyCode!==q.KEY_S&&t.keyCode!==q.KEY_W&&t.keyCode!==q.KEY_X&&t.keyCode!==q.KEY_Y&&t.keyCode!==q.KEY_Z&&t.keyCode!==q.KEY_ESC&&t.keyCode!==q.KEY_F1&&t.keyCode!==q.KEY_F2&&t.keyCode!==q.KEY_F3&&t.keyCode!==q.KEY_F4&&t.keyCode!==q.KEY_F6&&t.keyCode!==q.KEY_F7&&t.keyCode!==q.KEY_F8&&t.keyCode!==q.KEY_F12&&t.keyCode!==q.KEY_SPACE||t.preventDefault():t.preventDefault()}})),window.addEventListener("keyup",(t=>{if(this._isActive){if(this.userDevice.os===y.NINTENDO)return t.preventDefault(),void t.stopPropagation();this._keyStore.setReleaseInfo(t.keyCode),t.keyCode===q.KEY_F5?t.preventDefault():t.keyCode!==q.KEY_DOWN&&t.keyCode!==q.KEY_LEFT&&t.keyCode!==q.KEY_RIGHT&&t.keyCode!==q.KEY_UP&&t.keyCode!==q.KEY_SHIFT&&t.keyCode!==q.KEY_ENTER&&t.keyCode!==q.KEY_1&&t.keyCode!==q.KEY_2&&t.keyCode!==q.KEY_3&&t.keyCode!==q.KEY_A&&t.keyCode!==q.KEY_C&&t.keyCode!==q.KEY_D&&t.keyCode!==q.KEY_E&&t.keyCode!==q.KEY_M&&t.keyCode!==q.KEY_N&&t.keyCode!==q.KEY_Q&&t.keyCode!==q.KEY_S&&t.keyCode!==q.KEY_W&&t.keyCode!==q.KEY_X&&t.keyCode!==q.KEY_Y&&t.keyCode!==q.KEY_Z&&t.keyCode!==q.KEY_ESC&&t.keyCode!==q.KEY_F1&&t.keyCode!==q.KEY_F3&&t.keyCode!==q.KEY_F4&&t.keyCode!==q.KEY_F6&&t.keyCode!==q.KEY_F7&&t.keyCode!==q.KEY_F8&&t.keyCode!==q.KEY_F9&&t.keyCode!==q.KEY_F12&&t.keyCode!==q.KEY_SPACE||this._player.isWaitingMessage()||this._player.isWaitingPasswordWindow()||t.preventDefault()}})),window.addEventListener("blur",(t=>{this._keyStore.allClear(),this._mouseStore.clear(),this._virtualPadStore.allClear()})),window.addEventListener("contextmenu",(t=>{this._keyStore.allClear(),this._mouseStore.clear(),this._virtualPadStore.allClear()})),window.addEventListener("help",(t=>{this._isActive&&t.preventDefault()})),this._mouseControllerElement=dt("wwa-controller"),this._mouseControllerElement.addEventListener("mousedown",(t=>{if(this._isActive&&1===t.which){if(this._mouseStore.getMouseState()!==z.NONE)return void t.preventDefault();const e=wt(t.clientX,t.clientY),s=this._player.getDrawingCenterPosition(),i=e.substract(s),a=Math.abs(i.x),r=Math.abs(i.y);let n,o=!1;if(a<V.CHIP_SIZE&&r<V.CHIP_SIZE){switch(s.x/V.CHIP_SIZE|0){case 0:o=!0,n=p.LEFT;break;case V.H_PARTS_NUM_IN_WINDOW-1:o=!0,n=p.RIGHT}switch(s.y/V.CHIP_SIZE|0){case 0:o=!0,n=p.UP;break;case V.V_PARTS_NUM_IN_WINDOW-1:o=!0,n=p.DOWN}}o||(i.y>0&&r>a?n=p.DOWN:i.y<0&&r>a?n=p.UP:i.x>0&&r<a?n=p.RIGHT:i.x<0&&r<a&&(n=p.LEFT)),this._mouseStore.setPressInfo(n,0)}})),this._mouseControllerElement.addEventListener("mouseleave",(t=>{this._mouseStore.clear()})),this._mouseControllerElement.addEventListener("mouseup",(t=>{this._isActive&&1===t.which&&(this._mouseStore.setReleaseInfo(),t.preventDefault())})),window.TouchEvent){if(this.audioContext){let t=()=>{this.audioContext.createBufferSource().start(0),this._mouseControllerElement.removeEventListener("touchstart",t),t=null};this._mouseControllerElement.addEventListener("touchstart",t)}this._mouseControllerElement.addEventListener("touchstart",(t=>{if(!this._isActive)return;if(this._mouseStore.getMouseState()!==z.NONE)return void t.preventDefault();const e=t.changedTouches,s=e.length;for(let t=0;t<s;t++){const s=e[t],i=wt(s.clientX,s.clientY),a=this._player.getDrawingCenterPosition(),r=i.substract(a),n=Math.abs(r.x),o=Math.abs(r.y);let h,c=!1;if(n<V.CHIP_SIZE&&o<V.CHIP_SIZE){switch(a.x/V.CHIP_SIZE|0){case 0:c=!0,h=p.LEFT;break;case V.H_PARTS_NUM_IN_WINDOW-1:c=!0,h=p.RIGHT}switch(a.y/V.CHIP_SIZE|0){case 0:c=!0,h=p.UP;break;case V.V_PARTS_NUM_IN_WINDOW-1:c=!0,h=p.DOWN}}c||(r.y>0&&o>n?h=p.DOWN:r.y<0&&o>n?h=p.UP:r.x>0&&o<n?h=p.RIGHT:r.x<0&&o<n&&(h=p.LEFT)),this._mouseStore.setPressInfo(h,s.identifier)}t.cancelable&&t.preventDefault()}));const t=t=>{if(this._isActive)for(let e=0;e<t.changedTouches.length;e++)if(this._mouseStore.getTouchID()===t.changedTouches[e].identifier){this._mouseStore.setReleaseInfo(),t.preventDefault();break}};this._mouseControllerElement.addEventListener("touchend",t),this._mouseControllerElement.addEventListener("touchcancel",t)}dt("button-load").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(I.QUICK_LOAD)})),dt("button-save").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(I.QUICK_SAVE)})),dt("button-restart").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(I.RESTART_GAME)})),dt("button-gotowwa").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(I.GOTO_WWA,!1,!1)})),Array.prototype.forEach.call(gt(".wide-cell-row"),(t=>{t.addEventListener("click",(()=>{this._displayHelp()}))})),this._frameCoord=new c(V.IMGPOS_DEFAULT_FRAME_X,V.IMGPOS_DEFAULT_YESNO_Y),this._battleEffectCoord=new c(V.IMGPOS_DEFAULT_BATTLE_EFFECT_X,V.IMGPOS_DEFAULT_BATTLE_EFFECT_Y),this._battleEstimateWindow=new Ke(this,this._wwaData.mapCGName,dt("wwa-wrapper")),this._passwordWindow=new Xe(this,dt("wwa-wrapper"),l),this._monsterWindow=new We(this,new c(50,180),340,60,!1,dt("wwa-wrapper"),this._wwaData.mapCGName),this._setProgressBar(Ha(3,4,H.GAME_INIT)),this._isLoadedSound=!1,this._temporaryInputDisable=!1,this._paintSkipByDoorOpen=!1,this._clearFacesInNextFrame=!1,this._useConsole=!1,this.wwaCustomEvent("wwa_startup"),this._cgManager=new Se(d,this._wwaData.mapCGName,this._frameCoord,this,v,(()=>{this._isSkippedSoundMessage=!0;const t=()=>{switch(this.userDevice.device){case S.PC:this.generatePageAndReserveExecution("ゲームを開始します。\n画面をクリックしてください。",!1,!0);break;case S.SP:this.generatePageAndReserveExecution("ゲームを開始します。\n画面にふれてください。",!1,!0)}},e=this.resolveSystemMessage(i.CONFIRM_LOAD_SOUND);if("ON"===e)return this._isLoadedSound=!0,t(),this._setLoadingMessage(C,H.AUDIO),this.loadSound(),void window.requestAnimationFrame(this.soundCheckCaller);if("OFF"===e)return this._isLoadedSound=!1,t(),void this.openGameWindow();if(this._isSkippedSoundMessage=!1,this._hasTitleImg||C.clearRect(0,0,V.SCREEN_WIDTH,V.SCREEN_HEIGHT),this._usePassword){let t=e;E&&(t+='\n\n※変数表示が有効になっています。\n公開前に必ずHTMLファイル内の\n data-wwa-display-user-vars="true" \nを消してください。'),this._messageWindow.setMessage(t),this._messageWindow.show(),this._setProgressBar(Ha(4,4,H.GAME_INIT));var s=setInterval((()=>{this._keyStore.update(),this._gamePadStore.update(),this._virtualPadStore.update(),this._yesNoJudgeInNextFrame===g.UNSELECTED&&(this._keyStore.getKeyState(q.KEY_ENTER)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_Y)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this._yesNoJudgeInNextFrame=g.YES:(this._keyStore.getKeyState(q.KEY_N)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_ESC)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&(this._yesNoJudgeInNextFrame=g.NO)),this._yesNoJudgeInNextFrame===g.YES?(clearInterval(s),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout((()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=g.UNSELECTED,this._yesNoJudgeInNextFrame=g.UNSELECTED,this._isLoadedSound=!0,this._setLoadingMessage(C,H.AUDIO),this.loadSound(),window.requestAnimationFrame(this.soundCheckCaller)}),V.YESNO_PRESS_DISP_FRAME_NUM*V.DEFAULT_FRAME_INTERVAL)):this._yesNoJudgeInNextFrame===g.NO&&(clearInterval(s),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout((()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=g.UNSELECTED,this._yesNoJudgeInNextFrame=g.UNSELECTED,this._isLoadedSound=!1,this.openGameWindow()}),V.YESNO_PRESS_DISP_FRAME_NUM*V.DEFAULT_FRAME_INTERVAL))}),V.DEFAULT_FRAME_INTERVAL)}else clearInterval(s),this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=g.UNSELECTED,this._yesNoJudgeInNextFrame=g.UNSELECTED,this._isLoadedSound=!0,this.loadSound(),window.requestAnimationFrame(this.soundCheckCaller)})),this.wwaCustomEvent("wwa_start")};const b=new Ns;b.addListener("mapData",(t=>this._loadHandler(t))),b.addListener("progress",(t=>this._setProgressBar(t))),b.addListener("error",(t=>this._setErrorMessage("下記のエラーが発生しました。: \n"+t.message,C)));new Ds(t,b).requestAndLoadMapData().then((async()=>{if(this._canDisplayUserVars=E,this._userVarNameList=[],this._canDisplayUserVars){this._inlineUserVarViewer={topUserVarIndex:{named:0,numbered:0},isVisible:!1,kind:"numbered"};const t=await(m?fe(m):{kind:"noFileSpecified",errorMessage:"data-wwa-user-var-names-file 属性に、変数の説明を記したファイル名を書くことで、その説明を表示できます。詳しくはマニュアルをご覧ください。"});this.setUserVarStatus(t,m)}})),(async()=>{const t=await fe("./script/script_file_list.json");let e=[];console.log(t),"data"===(null==t?void 0:t.kind)&&Array.isArray(t.data)&&t.data.map((t=>{e.push((async t=>{try{const e=await fetch(t);return 200===e.status||304===e.status?{kind:"data",data:await new Response(e.body).text()}:{kind:"httpError",errorMessage:`ファイル ${t} が読み込めませんでした。ステータスコード: ${e.status}`}}catch(t){return{kind:"otherError",errorMessage:t.message}}})(t))}));(await Promise.all(e)).forEach((t=>{try{this.setUsertScript(t)}catch(t){console.error(t.message)}}));const s=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_WWA_START;s&&this.evalCalcWwaNodeGenerator.evalWwaNode(s)})(),this.evalCalcWwaNodeGenerator=new ua(this)}setEvalCalcWwaNodeEarnedItem(t,e){this.evalCalcWwaNodeGenerator.setEarnedItem(t,e)}clearEvalCalcWwaNodeEarnedItem(){this.evalCalcWwaNodeGenerator.clearEarnedItem()}callGetItemUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GET_ITEM;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}callGetItemFullUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GET_ITEM_FULL;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}callUseItemUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_USE_ITEM;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}callJumpGateUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_JUMPGATE;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}callUserDefinedBattleDamageFunction(t,e){const s=this.getUserDefinedDamageFunctionNode(t);if(s){this.evalCalcWwaNodeGenerator.setBattleDamageCalculationMode(e);try{const e=this.evalCalcWwaNodeGenerator.evalWwaNode(s),i=this.evalCalcWwaNodeGenerator.state.battleDamageCalculation.aborted;return this.evalCalcWwaNodeGenerator.clearBattleDamageCalculationMode(),"number"==typeof e?{damage:this.toAssignableValue(e),aborted:i}:(console.warn(`${t} のダメージ計算結果が数値になりませんでした。(結果: ${e})。このターンのダメージは無効になります。`),{damage:0,aborted:i})}catch(e){return console.warn(`${t} のダメージ計算中にエラーが発生しました。このターンのダメージは無効になります。`),console.warn(e),{damage:0,hasError:!0}}}}getUserDefinedDamageFunctionNode(t){var e;return null===(e=this.userDefinedFunctions)||void 0===e?void 0:e[{playerToEnemy:"CALC_PLAYER_TO_ENEMY_DAMAGE",enemyToPlayer:"CALC_ENEMY_TO_PLAYER_DAMAGE"}[t]]}callMoveUserDefineFunction(){const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_MOVE;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}getUserScript(t){return this.userDefinedFunctions&&this.userDefinedFunctions[t]||null}setUsertScript(t){if("data"!==t.kind)return void console.error(t);const e=this.convertWwaNodes(t.data);console.log(e),e.forEach((t=>{if("DefinedFunction"===t.type&&this.userDefinedFunctions){const e=t.functionName;this.userDefinedFunctions[e]=t.body}}))}callUserScript(t){const e=this.getUserScript(t);e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}setUserVarStatus(t,e){if(t)if("noFileSpecified"!==t.kind){if("data"!==t.kind)return this._userVarNameListRequestError=t,void Ma(this._dumpElement,this._userVarNameListRequestError.errorMessage,!0);if(!t.data||"object"!=typeof t.data)return this._userVarNameListRequestError={kind:"notObject",errorMessage:`ユーザ変数一覧 ${e} が正しい形式で書かれていません。`},void Ma(this._dumpElement,this._userVarNameListRequestError.errorMessage,!0);this._userVarNameList=this.convertUserVariableNameListToArray(t.data),ba(this._dumpElement,this._userVarNameList)}else Ma(this._dumpElement,t.errorMessage,!1)}convertUserVariableNameListToArray(t){const e=new Array(V.USER_VAR_NUM);for(let t=0;t<V.USER_VAR_NUM;t++)e[t]=void 0;return Object.keys(t).forEach((s=>{const i=parseInt(s,10);"string"!=typeof t[s]||"string"!=typeof s||isNaN(i)||i<0||i>=V.USER_VAR_NUM||(e[i]=t[s])})),e}_setProgressBar(t){this._hasTitleImg&&(t.stage<=V.LOAD_STAGE_MAX_EXCEPT_AUDIO?(dt("progress-message-container").textContent=t.stage===V.LOAD_STAGE_MAX_EXCEPT_AUDIO?"World Name: "+this._wwaData.worldName:st[t.stage],dt("progress-bar").style.width=(1*t.stage+t.current/t.total*1)/(V.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*V.MAP_WINDOW_WIDTH+"px",dt("progress-disp").textContent=((1*t.stage+t.current/t.total*1)/(V.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*100).toFixed(2)+"%"):(this._usePassword?dt("progress-message-container").textContent="効果音/BGMを読み込んでいます。(スペースキーでスキップ)":dt("progress-message-container").textContent="ゲームデータを読み込んでいます。",dt("progress-bar-audio").style.width=t.current*V.MAP_WINDOW_WIDTH/t.total+"px",dt("progress-disp").textContent=(t.current/t.total*100).toFixed(2)+"%"))}_setLoadingMessage(t,e){if(!this._hasTitleImg)if(e<=0)t.font=j.TITLE+"px "+V.LOADING_FONT,t.fillText(it[0],K.TITLE_X,K.TITLE_Y),t.font=j.FOOTER+"px "+V.LOADING_FONT,t.fillText("WWA Wing Ver.4.1.0-unstable.based-on.3.12.11.p.4",K.FOOTER_X,K.COPYRIGHT_Y);else if(e<=it.length)t.font=j.LOADING+"px "+V.LOADING_FONT,e>=2&&(t.clearRect(K.LOADING_X,K.LOADING_Y+K.LINE*(e-3),V.SCREEN_WIDTH-K.LOADING_X,K.LINE),t.fillText(it[e-1]+" Complete!",K.LOADING_X,K.LOADING_Y+K.LINE*(e-2))),e<it.length&&t.fillText(it[e],K.LOADING_X,K.LOADING_Y+K.LINE*(e-1)),1==e&&(t.font=j.FOOTER+"px "+V.LOADING_FONT,t.fillText("World Name "+this._wwaData.worldName,K.FOOTER_X,K.WORLD_Y),t.fillText(" (Map data Ver. "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10+")",K.FOOTER_X,K.WORLD_Y+K.LINE));else{var s;s=this._isSkippedSoundMessage?K.LOADING_Y+K.LINE*(it.length-1):K.FOOTER_Y,e<=H.AUDIO?t.fillText("Now Sound data Loading .....",K.LOADING_X,s):(t.clearRect(K.LOADING_X,s-K.LINE,V.SCREEN_WIDTH-K.LOADING_X,K.LINE),t.fillText("Now Sound data Loading ..... Complete!",K.LOADING_X,s))}}_setErrorMessage(t,e){this._hasTitleImg?alert(t):(e.clearRect(0,0,V.SCREEN_WIDTH,V.SCREEN_HEIGHT),e.font=j.ERRROR+"px "+V.LOADING_FONT,t.split("\n").forEach((function(t,s){e.fillText(t,K.ERROR_X,K.ERROR_Y+K.LINE*s)})))}createSoundInstance(t){if(0===t||t===R.NO_SOUND||this.sounds[t])return;const e=`${this._audioDirectory}${t}.${this.audioExtension}`;this.sounds[t]=new Es(t,e,this.audioContext,this.audioGain)}loadSound(){this.sounds=new Array(V.SOUND_MAX+1),this.createSoundInstance(R.DECISION),this.createSoundInstance(R.ATTACK);for(let t=1;t<this._wwaData.mapPartsMax;t++){const e=this._wwaData.mapAttribute[t][V.ATR_SOUND];this.createSoundInstance(e)}for(let t=1;t<this._wwaData.objPartsMax;t++){if(this._wwaData.objectAttribute[t][V.ATR_TYPE]===V.OBJECT_RANDOM)continue;const e=this._wwaData.objectAttribute[t][V.ATR_SOUND];this.createSoundInstance(e)}this._wwaData.message.forEach((t=>t.split("\n").forEach((t=>{const e=t.match(/^\$sound=(\d+)/);if(!e||e.length<2)return;const s=parseInt(e[1],10);!isNaN(s)&&0<s&&s<R.NO_SOUND&&this.createSoundInstance(s)})))),this._wwaData.bgm=0,this._soundLoadSkipFlag=!1}checkAllSoundLoaded(){let t=0,e=0;if(!this._hasTitleImg)var s=this._cvsCover.getContext("2d");this._keyStore.update(),this._keyStore.getKeyState(q.KEY_SPACE)===Z.KEYDOWN&&(this._soundLoadSkipFlag=!0);for(let s=1;s<=V.SOUND_MAX;s++){const i=this.sounds[s];void 0===i||i.isError()||(e++,i.hasData()&&t++)}if(t<e&&!this._soundLoadSkipFlag)return this._setProgressBar(Ha(t,e,H.AUDIO)),void window.requestAnimationFrame(this.soundCheckCaller);this._setProgressBar(Ha(V.SOUND_MAX,V.SOUND_MAX,H.AUDIO)),this._setLoadingMessage(s,H.FINISH),this.openGameWindow()}_setSoundLoadedCheckTimer(t){const e=this.sounds[t];e.isError()||(this.soundLoadedCheckTimer=window.setInterval((()=>{this._wwaData.bgm===t?e.hasData()?(e.play(this._wwaData.bgmDelayDurationMs),this._wwaData.bgm=t,this._clearSoundLoadedCheckTimer()):e.isError()&&this._clearSoundLoadedCheckTimer():this._clearSoundLoadedCheckTimer()}),100))}_clearSoundLoadedCheckTimer(){this.soundLoadedCheckTimer&&(clearInterval(this.soundLoadedCheckTimer),this.soundLoadedCheckTimer=void 0)}playSound(t,e){if(!this._isLoadedSound)return void(t===R.NO_SOUND?this._wwaData.bgm=0:t>=R.BGM_LB&&(this._wwaData.bgm=t));if(t<0||t>=V.SOUND_MAX)return void console.warn("サウンド番号が範囲外です。");if(t>=R.BGM_LB&&this._wwaData.bgm===t)return;if((t===R.NO_SOUND||t>=R.BGM_LB)&&0!==this._wwaData.bgm&&(this.sounds[this._wwaData.bgm].isPlaying()&&this.sounds[this._wwaData.bgm].pause(),this._wwaData.bgm=0),0===t||t===R.NO_SOUND)return;this.sounds[t].hasData()?t>=R.BGM_LB?(this.sounds[t].play(null!=e?e:this._wwaData.bgmDelayDurationMs),this._wwaData.bgm=t):this.sounds[t].play():t>=R.BGM_LB&&(this._wwaData.bgm=t,this._setSoundLoadedCheckTimer(t))}openGameWindow(){var t=this._player.getPosition();dt("wwa-cover").style.opacity="0",0!==this.getObjectIdByPosition(t)&&this._player.setPartsAppearedFlag();var e=dt("wwa-wrapper").getAttribute("data-wwa-resume-savedata");if("string"==typeof e&&(this._useSuspend=!0,e)){var s=is.getStartWWAData(e);this._restartData!==s&&(this._applyQuickLoad(s),this._wwaSave.resumeStart())}setTimeout((()=>{dt("wwa-wrapper").removeChild(dt("wwa-cover")),this._main()}),V.SPLASH_SCREEN_DISP_MILLS)}onselectitem(t){if(this._player.canUseItem(t)){dt("item"+(t-1)).classList.add("onpress"),this.playSound(R.DECISION);const a=this.resolveSystemMessage(i.CONFIRM_USE_ITEM);if("BLANK"===a){this._player.readyToUseItem(t);var e=this._player.useItem(),s=this.getObjectAttributeById(e,V.ATR_STRING);this.generatePageAndReserveExecution(this.getMessageById(s),!1,!1,e,v.OBJECT,this._player.getPosition().getPartsCoord())}else this.generatePageAndReserveExecution(a,!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_ITEM_USE,this._yesNoUseItemPos=t;return!0}return!1}onselectbutton(t,e=!1,s=!1){var i=dt(M[t]);if(this.playSound(R.DECISION),this._itemMenu.close(),i.classList.add("onpress"),t===I.QUICK_LOAD)switch(this._yesNoChoiceCallInfo=this._wwaSave.getFirstSaveChoiceCallInfo(e),this._yesNoChoiceCallInfo){case T.CALL_BY_QUICK_LOAD:case T.CALL_BY_LOG_QUICK_LOAD:var a,r="";switch(this._yesNoChoiceCallInfo){case T.CALL_BY_QUICK_LOAD:r="読み込むデータを選んでください。",this._wwaSave.selectDBSaveDataList();break;case T.CALL_BY_LOG_QUICK_LOAD:r="読み込むオートセーブを選んでください。",this._wwaSave.selectLogSaveDataList()}switch(a=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._messageWindow.createSaveDom(),a){case T.CALL_BY_LOG_QUICK_LOAD:this.generatePageAndReserveExecution(r+"\n→Noでオートセーブ復帰画面に移ります。",!0,!0);break;case T.CALL_BY_PASSWORD_LOAD:this.generatePageAndReserveExecution(r+"\n→Noでデータ復帰用パスワードの\n 入力選択ができます。",!0,!0);break;case T.NONE:this.generatePageAndReserveExecution(r,!0,!0)}break;case T.CALL_BY_PASSWORD_LOAD:this.onpasswordloadcalled()}else if(t===I.QUICK_SAVE)this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):(this._wwaSave.selectDBSaveDataList(),this._messageWindow.createSaveDom(),this._usePassword?(this.generatePageAndReserveExecution("データの一時保存先を選んでください。\n→Noでデータ復帰用パスワードの\n 表示選択ができます。",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_QUICK_SAVE):(this.generatePageAndReserveExecution("データの一時保存先を選んでください。",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_QUICK_SAVE));else if(t===I.RESTART_GAME)this.generatePageAndReserveExecution("初めからスタートしなおしますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_RESTART_GAME;else if(t===I.GOTO_WWA)if(s)this._bottomButtonType!==d.GOTO_WWA&&dt(M[I.GOTO_WWA]).classList.remove("onpress"),this.generatePageAndReserveExecution("WWAの公式サイトを開きますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_GOTO_WWA;else switch(this._bottomButtonType){case d.GOTO_WWA:this._yesNoChoiceCallInfo=T.CALL_BY_GOTO_WWA,this.generatePageAndReserveExecution("WWAの公式サイトを開きますか?",!0,!0);break;case d.GAME_END:this._yesNoChoiceCallInfo=T.CALL_BY_END_GAME,this.generatePageAndReserveExecution("WWAゲームを終了しますか?",!0,!0);break;case d.BATTLE_REPORT:this.launchBattleEstimateWindow()}}onpasswordloadcalled(){this._usePassword?(dt(M[I.QUICK_LOAD]).classList.add("onpress"),this.generatePageAndReserveExecution("データ復帰用のパスワードを入力しますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_PASSWORD_LOAD):this.generatePageAndReserveExecution("セーブデータがありません。",!1,!0)}onpasswordsavecalled(){dt(M[I.QUICK_SAVE]).classList.add("onpress"),this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):this._useSuspend?(this.generatePageAndReserveExecution("ゲームを中断しますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_SUSPEND):this._usePassword&&(this.generatePageAndReserveExecution("データ復帰用のパスワードを表示しますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_PASSWORD_SAVE)}onpasssuspendsavecalled(){dt(M[I.QUICK_SAVE]).classList.add("onpress"),this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):(this.generatePageAndReserveExecution("ゲームを中断しますか?",!0,!0),this._yesNoChoiceCallInfo=T.CALL_BY_SUSPEND)}onitemmenucalled(){this.generatePageAndReserveExecution("右のメニューを選択してください。",!1,!0),this._messageWindow.setItemMenuChoice(!0),this.playSound(R.DECISION),this._itemMenu.openView()}onchangespeed(t){if(!this._wwaData.permitChangeGameSpeed){const t=this.resolveSystemMessage(i.GAME_SPEED_CHANGE_DISABLED);return void("BLANK"!==t&&this.generatePageAndReserveExecution(t,!1,!0))}switch(t){case C.UP:this._player.speedUp();break;case C.DOWN:this._player.speedDown()}const e=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_CHANGE_SPEED;e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e);const s=this.resolveSystemMessage(i.GAME_SPEED_CHANGED);"BLANK"!==s&&this.generatePageAndReserveExecution(s,!1,!0)}isBattleSpeedIndexForQuickBattle(t){return V.QUICK_BATTLE_SPEED_INDECIES.some((e=>e===t))}_executeNode(t,e){var s;if(t instanceof Le)return null===(s=t.macro)||void 0===s||s.forEach((t=>{const{isGameOver:e}=t.execute();if(e)throw new Error("ゲームオーバーのため、メッセージ・マクロの実行を打ち切ります。")})),[t,...this._executeNode(t.next,e)];if(t instanceof xe){if(!e)throw new Error("パーツ起因ページによる実行ではないため、Junctionノードの利用を想定していません。");const s=t.evaluateAndGetNextNode((()=>this.generateTokenValues(e)));return s?this._executeNode(s,e):[]}return[]}_executeNodes(t,e){try{return{isError:!1,messages:this._executeNode(t,e)}}catch(t){return{isError:!0}}}_main(){var t;this._temporaryInputDisable=!1,this._stopUpdateByLoadFlag=!1,this._keyStore.update(),this._mouseStore.update(),this._virtualPadStore.update(),this._gamePadStore.update();const e=this._reservedPartsAppearances.length>0;if(this._reservedPartsAppearances.forEach((t=>this.appearParts(t))),this._reservedPartsAppearances=[],this._waitFrame-- >0)return e&&this._drawAll(),void window.requestAnimationFrame(this.mainCaller);if(this._waitFrame=0,void 0!==this._yesNoJudgeInNextFrame&&(this._yesNoJudge=this._yesNoJudgeInNextFrame,this._yesNoJudgeInNextFrame=void 0),this._clearFacesInNextFrame&&(this.clearFaces(),this._clearFacesInNextFrame=!1),this._pages.length>0&&this._shouldSetNextPage)for(this._shouldSetNextPage=!1;this._pages.length>0;){const t=this._pages.shift(),e=this._executeNodes(t.firstNode,t.extraInfo?{position:t.extraInfo.partsPosition,type:t.extraInfo.partsType,id:t.extraInfo.partsId}:void 0);if(!0===e.isError){this._isLastPage=!1;break}void 0!==this._reservedMoveMacroTurn&&(this._player.setMoveMacroWaiting(this._reservedMoveMacroTurn),this._reservedMoveMacroTurn=void 0);const s=e.messages.filter((t=>!t.isEmpty())),i=Boolean(t.scoreOptions);i&&0===s.length&&s.push(new Le("スコアを表示します。"));if(s.length>0){const e=s.map((t=>t.generatePrintableMessage())).join("\n");this._messageWindow.setMessage(e),this._messageWindow.setYesNoChoice(t.showChoice),this._messageWindow.setPositionByPlayerPosition(0!==this._faces.length,i,t.isSystemMessage,this._player.getPosition(),this._camera.getPosition()),i&&(this._lastScoreOptions=t.scoreOptions,this.updateScore(t.scoreOptions),this._scoreWindow.show()),this._player.setMessageWaiting(),this._isLastPage=t.isLastPage;break}if(0===this._pages.length){const{newPageGenerated:t}=this._hideMessageWindow();t||this._dispatchWindowClosedTimeRequests();break}}if(this._reservedJumpDestination&&(this._player.jumpTo(this._reservedJumpDestination),this._reservedJumpDestination=void 0),this._player.mainFrameCount(),this._player.isControllable()){if(this._wwaData.disableSaveFlag||this._wwaSave.isAutoSaveFrame(this._player)&&this._quickSave(T.CALL_BY_LOG_QUICK_SAVE),this._player.isDelayFrame())this._player.updateDelayFrame();else{const t=this._player.getDir(),e=[NaN,NaN,q.KEY_DOWN,NaN,q.KEY_LEFT,NaN,q.KEY_RIGHT,NaN,q.KEY_UP,NaN][t];this._actionGamePadButtonItemMacro()||(this._keyStore.getKeyStateForControllPlayer(q.KEY_LEFT)===Z.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer(q.KEY_UP)===Z.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer(q.KEY_RIGHT)===Z.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer(q.KEY_DOWN)===Z.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(p.LEFT)===z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(p.UP)===z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(p.RIGHT)===z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(p.DOWN)===z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(e)?this._checkTurnKeyPressed()?this._player.setDir(t):(this._player.controll(t),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(q.KEY_LEFT)?this._checkTurnKeyPressed()?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(q.KEY_UP)?this._checkTurnKeyPressed()?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(q.KEY_RIGHT)?this._checkTurnKeyPressed()?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(q.KEY_DOWN)?this._checkTurnKeyPressed()?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(p.LEFT)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(p.UP)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(p.RIGHT)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(p.DOWN)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_LEFT)?this._gamePadStore.buttonPressed(tt.BUTTON_INDEX_B)?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_UP)?this._gamePadStore.buttonPressed(tt.BUTTON_INDEX_B)?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_RIGHT)?this._gamePadStore.buttonPressed(tt.BUTTON_INDEX_B)?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_DOWN)?this._gamePadStore.buttonPressed(tt.BUTTON_INDEX_B)?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_LEFT")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(p.LEFT):(this._player.controll(p.LEFT),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_UP")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(p.UP):(this._player.controll(p.UP),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_RIGHT")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(p.RIGHT):(this._player.controll(p.RIGHT),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_DOWN")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(p.DOWN):(this._player.controll(p.DOWN),this._objectMovingDataManager.update()):this._keyStore.getKeyState(q.KEY_1)===Z.KEYDOWN?this.onselectitem(1):this._keyStore.getKeyState(q.KEY_2)===Z.KEYDOWN?this.onselectitem(2):this._keyStore.getKeyState(q.KEY_3)===Z.KEYDOWN?this.onselectitem(3):this._keyStore.getKeyState(q.KEY_Q)===Z.KEYDOWN?this.onselectitem(4):this._keyStore.getKeyState(q.KEY_W)===Z.KEYDOWN?this.onselectitem(5):this._keyStore.getKeyState(q.KEY_E)===Z.KEYDOWN?this.onselectitem(6):this._keyStore.getKeyState(q.KEY_A)===Z.KEYDOWN?this.onselectitem(7):this._keyStore.getKeyState(q.KEY_S)===Z.KEYDOWN?this.onselectitem(8):this._keyStore.getKeyState(q.KEY_D)===Z.KEYDOWN?this.onselectitem(9):this._keyStore.getKeyState(q.KEY_Z)===Z.KEYDOWN?this.onselectitem(10):this._keyStore.getKeyState(q.KEY_X)===Z.KEYDOWN?this.onselectitem(11):this._keyStore.getKeyState(q.KEY_C)===Z.KEYDOWN?this.onselectitem(12):this._keyStore.getKeyState(q.KEY_I)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_MINUS)||this._virtualPadStore.checkTouchButton("BUTTON_SLOW")?this.onchangespeed(C.DOWN):this._keyStore.getKeyState(q.KEY_P)===Z.KEYDOWN||this._keyStore.checkHitKey(q.KEY_F2)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_PLUS)||this._virtualPadStore.checkTouchButton("BUTTON_FAST")?this.onchangespeed(C.UP):this._keyStore.getKeyState(q.KEY_F1)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_M)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this.launchBattleEstimateWindow():this._keyStore.checkHitKey(q.KEY_F3)?(this.playSound(R.DECISION),this.onselectbutton(I.QUICK_LOAD,!0)):this._keyStore.checkHitKey(q.KEY_F4)?(this.playSound(R.DECISION),this._useSuspend?this.onpasssuspendsavecalled():this._usePassword&&this.onpasswordsavecalled()):this._keyStore.checkHitKey(q.KEY_F5)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_ZR)?this.onselectbutton(I.QUICK_LOAD):this._keyStore.checkHitKey(q.KEY_F6)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_ZL)?this.onselectbutton(I.QUICK_SAVE):this._keyStore.checkHitKey(q.KEY_F7)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_R)?this.onselectbutton(I.RESTART_GAME):this._keyStore.checkHitKey(q.KEY_F8)?this.onselectbutton(I.GOTO_WWA,!1,!0):this._keyStore.checkHitKey(q.KEY_F9)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_X)||this._virtualPadStore.checkTouchButton("BUTTON_ESC")?(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onitemmenucalled():this._keyStore.checkHitKey(q.KEY_V)?this._displayUserVars():this._keyStore.checkHitKey(q.KEY_X)?this._debugConsoleElement&&this._debugEvalString():(this._keyStore.checkHitKey(q.KEY_F12)||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_Y))&&this._displayHelp());[{key:q.KEY_A,func:"CALL_PUSH_A"},{key:q.KEY_B,func:"CALL_PUSH_B"},{key:q.KEY_C,func:"CALL_PUSH_C"},{key:q.KEY_D,func:"CALL_PUSH_D"},{key:q.KEY_E,func:"CALL_PUSH_E"},{key:q.KEY_F,func:"CALL_PUSH_F"},{key:q.KEY_G,func:"CALL_PUSH_G"},{key:q.KEY_H,func:"CALL_PUSH_H"},{key:q.KEY_I,func:"CALL_PUSH_I"},{key:q.KEY_J,func:"CALL_PUSH_J"},{key:q.KEY_K,func:"CALL_PUSH_K"},{key:q.KEY_L,func:"CALL_PUSH_L"},{key:q.KEY_M,func:"CALL_PUSH_M"},{key:q.KEY_N,func:"CALL_PUSH_N"},{key:q.KEY_O,func:"CALL_PUSH_O"},{key:q.KEY_P,func:"CALL_PUSH_P"},{key:q.KEY_Q,func:"CALL_PUSH_Q"},{key:q.KEY_R,func:"CALL_PUSH_R"},{key:q.KEY_S,func:"CALL_PUSH_S"},{key:q.KEY_T,func:"CALL_PUSH_T"},{key:q.KEY_U,func:"CALL_PUSH_U"},{key:q.KEY_V,func:"CALL_PUSH_V"},{key:q.KEY_W,func:"CALL_PUSH_W"},{key:q.KEY_X,func:"CALL_PUSH_X"},{key:q.KEY_Y,func:"CALL_PUSH_Y"},{key:q.KEY_Z,func:"CALL_PUSH_Z"},{key:q.KEY_ENTER,func:"CALL_PUSH_ENTER"},{key:q.KEY_ESC,func:"CALL_PUSH_ESC"},{key:q.KEY_SPACE,func:"CALL_PUSH_SPACE"},{key:q.KEY_LEFT,func:"CALL_PUSH_LEFT"},{key:q.KEY_RIGHT,func:"CALL_PUSH_RIGHT"},{key:q.KEY_UP,func:"CALL_PUSH_UP"},{key:q.KEY_DOWN,func:"CALL_PUSH_DOWN"}].forEach((t=>{if(this._keyStore.checkHitKey(t.key)){const e=this.userDefinedFunctions&&this.userDefinedFunctions[t.func];e&&this.evalCalcWwaNodeGenerator.evalWwaNode(e)}}))}this._keyStore.memorizeKeyStateOnControllableFrame(),this._mouseStore.memorizeMouseStateOnControllableFrame(),this._cgManager.picture.decrementPictureDisplayTimeStock()}else if(this._player.isJumped())this._camera.isResetting()||this._player.processAfterJump();else if(this._player.isMoving())this._player.move(),this._objectMovingDataManager.update(),this._player.getPosition().isJustPosition()&&this._dispatchPlayerAndObjectsStopTimeRequests();else if(this._player.isWaitingMessage()){if(this._messageWindow.isVisible()||this._messageWindow.show(),this._messageWindow.isYesNoChoice())this._messageWindow.isSaveChoice()&&(this._messageWindow.saveUpdate(),this._messageWindow.isSaveClose()||(this._keyStore.checkHitKey(q.KEY_LEFT)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_LEFT)||this._virtualPadStore.checkTouchButton("BUTTON_LEFT")?this._messageWindow.saveControll(p.LEFT):this._keyStore.checkHitKey(q.KEY_UP)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_UP)||this._virtualPadStore.checkTouchButton("BUTTON_UP")?this._messageWindow.saveControll(p.UP):this._keyStore.checkHitKey(q.KEY_RIGHT)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_RIGHT)||this._virtualPadStore.checkTouchButton("BUTTON_RIGHT")?this._messageWindow.saveControll(p.RIGHT):(this._keyStore.checkHitKey(q.KEY_DOWN)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_DOWN)||this._virtualPadStore.checkTouchButton("BUTTON_DOWN"))&&this._messageWindow.saveControll(p.DOWN))),this._messageWindow.isInputDisable()||(this._yesNoJudge===g.UNSELECTED&&(this._keyStore.getKeyState(q.KEY_ENTER)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_Y)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this._yesNoJudge=g.YES:(this._keyStore.getKeyState(q.KEY_N)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_ESC)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&(this._yesNoJudge=g.NO)),(this._yesNoJudge===g.YES||this._yesNoJudge===g.NO)&&(this.playSound(R.DECISION),this._yesNoDispCounter=V.YESNO_PRESS_DISP_FRAME_NUM,this._messageWindow.setInputDisable(),this._messageWindow.update()));else if(this._messageWindow.isItemMenuChoice()){if(this._itemMenu.update(),this._keyStore.checkHitKey(q.KEY_LEFT)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_LEFT)||this._virtualPadStore.checkTouchingButton("BUTTON_LEFT")?this._itemMenu.controll(p.LEFT):this._keyStore.checkHitKey(q.KEY_UP)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_UP)||this._virtualPadStore.checkTouchingButton("BUTTON_UP")?this._itemMenu.controll(p.UP):this._keyStore.checkHitKey(q.KEY_RIGHT)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_RIGHT)||this._virtualPadStore.checkTouchingButton("BUTTON_RIGHT")?this._itemMenu.controll(p.RIGHT):(this._keyStore.checkHitKey(q.KEY_DOWN)||this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_DOWN)||this._virtualPadStore.checkTouchingButton("BUTTON_DOWN"))&&this._itemMenu.controll(p.DOWN),this._keyStore.getKeyState(q.KEY_ENTER)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_Y)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER"))this._setNextPage(),this._messageWindow.setItemMenuChoice(!1),this._itemMenu.ok();else if(this._mouseStore.checkClickMouse(p.LEFT)||this._mouseStore.checkClickMouse(p.UP)||this._mouseStore.checkClickMouse(p.RIGHT)||this._mouseStore.checkClickMouse(p.DOWN)||this._keyStore.getKeyState(q.KEY_N)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_ESC)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC")){for(var s=0;s<M.length;s++){(n=dt(M[s])).classList.contains("onpress")&&n.classList.remove("onpress")}this._itemMenu.ng(),this._setNextPage(),this.playSound(R.DECISION),this._messageWindow.setItemMenuChoice(!1)}}else{var i=this._keyStore.getKeyStateForMessageCheck(q.KEY_ENTER),a=this._keyStore.getKeyStateForMessageCheck(q.KEY_SPACE),r=this._keyStore.getKeyStateForMessageCheck(q.KEY_ESC);if(i===Z.KEYDOWN||i===Z.KEYPRESS_MESSAGECHANGE||a===Z.KEYDOWN||a===Z.KEYPRESS_MESSAGECHANGE||r===Z.KEYDOWN||r===Z.KEYPRESS_MESSAGECHANGE||this._mouseStore.getMouseState()===z.MOUSEDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")||this._virtualPadStore.checkTouchButton("BUTTON_ESC")){for(s=0;s<M.length;s++){var n;(n=dt(M[s])).classList.contains("onpress")&&n.classList.remove("onpress")}this._setNextPage()}}if(null===(t=this._inlineUserVarViewer)||void 0===t?void 0:t.isVisible){const t=this._inlineUserVarViewer.kind;let e=!1;const s="named"===t?this._userVar.named.size:V.USER_VAR_NUM;this._keyStore.getKeyState(q.KEY_DOWN)===Z.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex[t]++,e=!0),this._keyStore.getKeyState(q.KEY_UP)===Z.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex[t]--,e=!0),this._keyStore.getKeyState(q.KEY_RIGHT)===Z.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex[t]+=V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM,e=!0),this._keyStore.getKeyState(q.KEY_LEFT)===Z.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex[t]-=V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM,e=!0),this._keyStore.getKeyState(q.KEY_V)===Z.KEYDOWN&&("named"===this._inlineUserVarViewer.kind?this._inlineUserVarViewer.kind="numbered":"numbered"===this._inlineUserVarViewer.kind&&(this._inlineUserVarViewer.kind="named"),e=!0),this._inlineUserVarViewer.topUserVarIndex[t]<0&&(this._inlineUserVarViewer.topUserVarIndex[t]+=s),this._inlineUserVarViewer.topUserVarIndex[t]>s&&(this._inlineUserVarViewer.topUserVarIndex[t]-=s),e&&(this._setNextPage(),this._inlineUserVarViewer.isVisible=!0,this._displayUserVars())}}else this._player.isWaitingEstimateWindow()?(this._keyStore.getKeyState(q.KEY_ENTER)===Z.KEYDOWN||this._keyStore.getKeyState(q.KEY_SPACE)===Z.KEYDOWN||this._gamePadStore.buttonTrigger(tt.BUTTON_INDEX_A,tt.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&this.hideBattleEstimateWindow():this._player.isFighting()?(this._player.fight(),this._monsterWindow.update(this._monster)):this._player.isWaitingMoveMacro()&&(this._player.isMoveObjectAutoExecTime()&&(this.moveObjects(!1),this._player.resetMoveObjectAutoExecTimer()),this._objectMovingDataManager.update());if(this._cgManager.picture.updateFrameTimerValue(),this._prevFrameEventExected=!1,this._player.getPosition().isJustPosition()&&this._camera.getPosition().isScreenTopPosition()){if(!(this._shouldTreatWillMessageDisplay(this._pages)||this._player.isJumped()||this._player.isWaitingMessage()||this._player.isWaitingEstimateWindow()||this._player.isWaitingMoveMacro()||this._player.isFighting())){this._player.isPartsAppearedTime()&&this._player.clearPartsAppearedFlag(),this._replaceRandomObjectsInScreen();var o=this.checkMap();o||this.checkObject(),this._prevFrameEventExected=o}this._player.isWaitingMessage()&&this._messageWindow.isYesNoChoice()&&this._yesNoJudge!==g.UNSELECTED&&!this._player.isWaitingMoveMacro()&&!this._player.isFighting()&&this._execChoiceWindowRunningEvent()}this._passwordLoadExecInNextFrame&&(this._stopUpdateByLoadFlag=!0,this._loadType=P.PASSWORD,this._player.clearPasswordWindowWaiting(),this._passwordLoadExecInNextFrame=!1),this._drawAll(),this._mainCallCounter++,this._mainCallCounter%=1e9,this._player.isWaitingMessage()&&this._isClassicModeEnable||(this._animationCounter=(this._animationCounter+1)%(2*V.ANIMATION_REP_HALF_FRAME),0!==this._animationCounter&&this._animationCounter!==V.ANIMATION_REP_HALF_FRAME+1||this.updatePicturesCache()),this._camera.isResetting()&&this._camera.advanceTransitionStepNum(),this._player.isWaitingMessage()||(this._player.decrementLookingAroundTimer(),this._statusPressCounter.energy>0&&0==--this._statusPressCounter.energy&&dt("disp-energy").classList.remove("onpress"),this._statusPressCounter.strength>0&&0==--this._statusPressCounter.strength&&dt("disp-strength").classList.remove("onpress"),this._statusPressCounter.defence>0&&0==--this._statusPressCounter.defence&&dt("disp-defence").classList.remove("onpress"),this._statusPressCounter.gold>0&&0==--this._statusPressCounter.gold&&dt("disp-gold").classList.remove("onpress")),this._player.isWaitingMoveMacro()&&(this._player.decrementMoveObjectAutoExecTimer(),this._player.isWaitingMoveMacro()||this._dispatchPlayerAndObjectsStopTimeRequests()),this._stopUpdateByLoadFlag?this._fadeout((()=>{if(this._loadType===P.QUICK_LOAD){this._quickLoad(),this.wwaCustomEvent("wwa_quickload");const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_QUICKLOAD;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}else if(this._loadType===P.RESTART_GAME){this.restartGame(),this.wwaCustomEvent("wwa_restert");const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_RESTART;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}else if(this._loadType===P.PASSWORD){this._applyQuickLoad(this._passwordSaveExtractData),this._passwordSaveExtractData=void 0,this.wwaCustomEvent("wwa_passwordload");const t=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_PASSWORDLOAD;t&&this.evalCalcWwaNodeGenerator.evalWwaNode(t)}setTimeout(this.mainCaller,V.DEFAULT_FRAME_INTERVAL,this)})):window.requestAnimationFrame(this.mainCaller),function({dumpElement:t,namedUserVar:e,userVar:s}){e&&Ra(t,e),s&&Oa(t,s)}({dumpElement:this._dumpElement,userVar:this._userVar.numbered,namedUserVar:this._userVar.named});const h=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_FRAME;h&&this.evalCalcWwaNodeGenerator.evalWwaNode(h)}vibration(t){this._gamePadStore.vibration(t)}_isMainAnimation(){return this._animationCounter>V.ANIMATION_REP_HALF_FRAME}_drawAll(){var t,e,s=this._camera.getPosition().getPartsCoord(),i=this._camera.getPosition().getOffsetCoord(),a=V.MAP_WINDOW_HEIGHT,r=this._player.getPosition().getPartsCoord();if(this._paintSkipByDoorOpen)this._paintSkipByDoorOpen=!1;else{if(this._cgManager.clearCanvas(0,0,V.MAP_WINDOW_WIDTH,V.MAP_WINDOW_HEIGHT),this._cgManager.drawBase(0,0,V.MAP_WINDOW_WIDTH,V.MAP_WINDOW_HEIGHT),this._camera.isResetting()){if(null!==this._camera.getPreviousPosition())var n=this._camera.getPreviousPosition().getPartsCoord(),o=this._camera.getPreviousPosition().getOffsetCoord();a=this._camera.getTransitionStepNum()*V.CHIP_SIZE}var h=!1;if(a!==this._cgManager.mapCacheYLimit&&(this._cgManager.mapCacheYLimit=a,h=!0),s.x===this._cgManager.cpPartsLog.x&&s.y===this._cgManager.cpPartsLog.y||(this._cgManager.cpPartsLog.x=s.x,this._cgManager.cpPartsLog.y=s.y,h=!0),h&&(this._cgManager.clearBackCanvas(),this._cgManager.clearObjectCanvases()),this._camera.isResetting()&&(this._drawMap(n,o,a,!0),this._drawPlayer(n,o,a,!0),this._drawObjects(n,o,a,!0),this._camera.isFinalStep()))var c=255,_=setInterval((()=>{var t=dt("wwa-fader");if((c-=3*V.FADEOUT_SPEED)<=0)return clearInterval(_),t.style.backgroundColor="transparent",t.removeAttribute("style"),void(t.style.display="none");t.style.opacity=c/255+""}),20);this._drawMap(s,i,a,!1,h),this._drawPlayer(s,i,a),this._drawObjects(s,i,a,!1,h),this._player.isFighting()&&!this._player.isBattleStartFrame()&&(t=this._player.isTurn()?this._monster.position.x:r.x,e=this._player.isTurn()?this._monster.position.y:r.y,this._cgManager.drawCanvas(this._battleEffectCoord.x,this._battleEffectCoord.y,V.CHIP_SIZE*(t-s.x)-i.x,V.CHIP_SIZE*(e-s.y)-i.y)),this._drawEffect(),this._drawPictures(),this._drawFaces(),this._drawFrame()}}_drawMap(t,e,s,i=!1,a=!1){if(void 0!==t){var r,n=Math.max(0,t.x-1),o=Math.min(this._wwaData.mapWidth-1,t.x+V.H_PARTS_NUM_IN_WINDOW),h=Math.max(0,t.y-1),c=Math.min(this._wwaData.mapWidth-1,t.y+V.V_PARTS_NUM_IN_WINDOW);if(r=0,i)for(var _=n;_<=o;_++)for(var l=h;l<=c;l++){var u=this._wwaData.map[l][_],d=this._wwaData.mapAttribute[u][V.ATR_X]/V.CHIP_SIZE,p=this._wwaData.mapAttribute[u][V.ATR_Y]/V.CHIP_SIZE,m=V.CHIP_SIZE*(_-t.x)-e.x,E=V.CHIP_SIZE*(l-t.y)-e.y;this._cgManager.copyBackCanvasWithLowerYLimit(d,p,m,E,s)}else{for(_=n;_<=o;_++)for(l=h;l<=c;l++){u=this._wwaData.map[l][_];this._cgManager.mapCache[r]!==u&&(this._cgManager.mapCache[r]=u,a=!0),r++}if(a){this._cgManager.clearBackCanvasWithLowerYLimit(s);for(_=n;_<=o;_++)for(l=h;l<=c;l++){u=this._wwaData.map[l][_],d=this._wwaData.mapAttribute[u][V.ATR_X]/V.CHIP_SIZE,p=this._wwaData.mapAttribute[u][V.ATR_Y]/V.CHIP_SIZE,m=V.CHIP_SIZE*(_-t.x)-e.x,E=V.CHIP_SIZE*(l-t.y)-e.y;this._cgManager.copyBackCanvasWithUpperYLimit(d,p,m,E,s)}}this._cgManager.drawBackCanvas()}}}_drawPlayer(t,e,s,i=!1){if(void 0===t||this._wwaData.delPlayerFlag)return;const a=this._player.getPosition().getPartsCoord(),r=this._player.getPosition().getOffsetCoord(),n=[NaN,NaN,2,NaN,4,NaN,6,NaN,0,NaN][this._player.getDir()],o=(a.x-t.x)*V.CHIP_SIZE+r.x-e.x,h=(a.y-t.y)*V.CHIP_SIZE+r.y-e.y;let c;if(this._useLookingAround&&this._player.isLookingAround()&&!this._player.isWaitingMessage()){const t=[2,3,4,5,0,1,6,7];c=this._wwaData.playerImgPosX+t[Math.floor(this._mainCallCounter%64/8)]}else c=this._player.isMovingImage()?this._wwaData.playerImgPosX+n+1:this._wwaData.playerImgPosX+n;i?this._cgManager.drawCanvasWithLowerYLimit(c,this._wwaData.playerImgPosY,o,h,s):this._cgManager.drawCanvasWithUpperYLimit(c,this._wwaData.playerImgPosY,o,h,s)}_drawObjects(t,e,s,i=!1,a=!1){if(void 0!==t){var r,n,o,h,_,l,d,p,m,E,g,w,f,v,y=Math.max(0,t.x-1),S=Math.min(this._wwaData.mapWidth-1,t.x+V.H_PARTS_NUM_IN_WINDOW),A=Math.max(0,t.y-1),T=Math.min(this._wwaData.mapWidth-1,t.y+V.V_PARTS_NUM_IN_WINDOW),I=0,C=this._isMainAnimation(),P=this._player.isFighting()&&this._player.isTurn()&&this._player.getPosition().getPartsCoord().equals(this._monster.position);if(i)for(E=y;E<=S;E++)for(g=A;g<=T;g++)P&&new c(E,g).equals(this._monster.position)||(w=this._wwaData.mapObject[g][E],r=new c(0,0),this._wwaData.objectAttribute[w][V.ATR_MOVE]!==D.STATIC&&null!==(m=this._objectMovingDataManager.getOffsetByBeforePartsCoord(new c(E,g)))&&(r=m),_=V.CHIP_SIZE*(E-t.x)+r.x-e.x,l=V.CHIP_SIZE*(g-t.y)+r.y-e.y,n=C||0===this._wwaData.objectAttribute[w][V.ATR_X2]&&0===this._wwaData.objectAttribute[w][V.ATR_Y2],o=this._wwaData.objectAttribute[w][n?V.ATR_X:V.ATR_X2]/V.CHIP_SIZE,h=this._wwaData.objectAttribute[w][n?V.ATR_Y:V.ATR_Y2]/V.CHIP_SIZE,d=this._wwaData.objectAttribute[w][V.ATR_TYPE],p=this._wwaData.objectAttribute[w][V.ATR_NUMBER],0===w||this._checkNoDrawObject(new c(E,g),d,p)||this._cgManager.copyObjectCanvasWithLowerYLimit(C?1:0,o,h,_,l,s));else{var N,O,b,M,x,L=[],R=[];for(E=y;E<=S;E++)for(g=A;g<=T;g++)f=w=this._wwaData.mapObject[g][E],d=this._wwaData.objectAttribute[w][V.ATR_TYPE],p=this._wwaData.objectAttribute[w][V.ATR_NUMBER],this._checkNoDrawObject(new c(E,g),d,p)&&(f=0),O=this._wwaData.objectAttribute[w][V.ATR_MOVE]===D.STATIC,0!==f&&(b=!(!P||!new c(E,g).equals(this._monster.position)),O?R.push(new u(w,E,g,O,b)):(L.push(new u(w,E,g,O,b)),f=0),b&&(f=0)),this._cgManager.mapObjectCache[I]!==f&&(this._cgManager.mapObjectCache[I]=f,a=!0),I++;for(a&&(this._cgManager.clearObjectCanvasesWithLowerYLimit(s),Array.prototype.push.apply(L,R)),x=L.length,M=0;M<x;M++)if(E=(N=L[M]).x,g=N.y,w=N.partsIDObj,O=N.isStatic,b=N.isFighting,_=V.CHIP_SIZE*(E-t.x)-e.x,l=V.CHIP_SIZE*(g-t.y)-e.y,O){if(b)continue;for(v=0;v<2;v++)n=!!v||0===this._wwaData.objectAttribute[w][V.ATR_X2]&&0===this._wwaData.objectAttribute[w][V.ATR_Y2],o=this._wwaData.objectAttribute[w][n?V.ATR_X:V.ATR_X2]/V.CHIP_SIZE,h=this._wwaData.objectAttribute[w][n?V.ATR_Y:V.ATR_Y2]/V.CHIP_SIZE,this._cgManager.copyObjectCanvasWithUpperYLimit(v,o,h,_,l,s)}else null!==(m=this._objectMovingDataManager.getOffsetByBeforePartsCoord(new c(E,g)))&&(_+=m.x,l+=m.y),n=C||0===this._wwaData.objectAttribute[w][V.ATR_X2]&&0===this._wwaData.objectAttribute[w][V.ATR_Y2],o=this._wwaData.objectAttribute[w][n?V.ATR_X:V.ATR_X2]/V.CHIP_SIZE,h=this._wwaData.objectAttribute[w][n?V.ATR_Y:V.ATR_Y2]/V.CHIP_SIZE,this._cgManager.drawCanvasWithUpperYLimit(o,h,_,l,s);this._cgManager.drawObjectCanvas(C?1:0)}}}_drawEffect(){if(0!==this._wwaData.effectCoords.length&&0!==this._wwaData.effectWaits){var t=Math.floor(this._mainCallCounter%(this._wwaData.effectCoords.length*this._wwaData.effectWaits)/this._wwaData.effectWaits);this._cgManager.drawEffect(t)}}_drawFaces(){for(var t=0;t<this._faces.length;t++)this._cgManager.drawCanvasWithSize(this._faces[t].srcPos.x,this._faces[t].srcPos.y,this._faces[t].srcSize.x,this._faces[t].srcSize.y,this._faces[t].destPos.x,this._faces[t].destPos.y)}_drawFrame(){this._cgManager.drawFrame()}_drawPictures(){this._cgManager.drawPictures()}_checkNoDrawObject(t,e,s){var i=this._player.getPosition(),a=i.getPartsCoord();return!(!i.isJustPosition()||a.x!==t.x||a.y!==t.y||this._wwaData.objectNoCollapseDefaultFlag)&&(e===V.OBJECT_DOOR&&0===s||(e===V.OBJECT_STATUS||e===V.OBJECT_MESSAGE||e===V.OBJECT_ITEM||e===V.OBJECT_SELL||e===V.OBJECT_BUY||e===V.OBJECT_SELL||e===V.OBJECT_LOCALGATE))}getMapWidth(){if(void 0===this._wwaData)throw new Error("マップデータがロードされていません");return this._wwaData.mapWidth}getMapIdByPosition(t){var e=t.getPartsCoord();return this._wwaData.map[e.y][e.x]}getObjectIdByPosition(t){var e=t.getPartsCoord();return this._wwaData.mapObject[e.y][e.x]}getMapTypeByPosition(t){var e=t.getPartsCoord(),s=this._wwaData.map[e.y][e.x];return this._wwaData.mapAttribute[s][V.ATR_TYPE]}getObjectTypeByPosition(t){var e=t.getPartsCoord(),s=this._wwaData.mapObject[e.y][e.x];return this._wwaData.objectAttribute[s][V.ATR_TYPE]}getMapAttributeByPosition(t,e){var s=t.getPartsCoord(),i=this._wwaData.map[s.y][s.x];return this._wwaData.mapAttribute[i][e]}isCurrentPosMapPartsIncludingMessage(t){return 0!==this.getMapAttributeByPosition(t,V.ATR_STRING)}getObjectAttributeByPosition(t,e){var s=t.getPartsCoord(),i=this._wwaData.mapObject[s.y][s.x];return this._wwaData.objectAttribute[i][e]}getMapAttributeById(t,e){return this._wwaData.mapAttribute[t][e]}getObjectAttributeById(t,e){return this._wwaData.objectAttribute[t][e]}getObjectCropXById(t){return this._wwaData.objectAttribute[t][V.ATR_X]}getObjectCropYById(t){return this._wwaData.objectAttribute[t][V.ATR_Y]}getMessageById(t){return this._wwaData.message[t]}getSystemMessageById(t){return this._wwaData.systemMessage[t]}checkMap(t){var e=this._player.getPosition().getPartsCoord();t=null!=t?t:e;var s=this._wwaData.map[t.y][t.x],i=this._wwaData.mapAttribute[s][V.ATR_TYPE],a=t.x===e.x&&t.y===e.y,r=!1;return(!a||this._player.getLastExecPartsIDOnSamePosition(v.MAP)!==s)&&(i===V.MAP_STREET?r=this._execMapStreetEvent(t,s,i):i===V.MAP_WALL?r=this._execMapWallEvent(t,s,i):i===V.MAP_LOCALGATE?r=this._execMapLocalGateEvent(t,s,i):i===V.MAP_URLGATE&&(r=this._execMapUrlGateEvent(t,s,i)),a&&!this._player.isJumped()&&this._player.setLastExecInfoOnSamePosition(v.MAP,s),r)}checkObject(t){var e=this._player.getPosition().getPartsCoord();t=null!=t?t:e;var s=this._wwaData.mapObject[t.y][t.x],i=this._wwaData.objectAttribute[s][V.ATR_TYPE],a=t.x===e.x&&t.y===e.y;a&&this._player.getLastExecPartsIDOnSamePosition(v.OBJECT)===s||(i===V.OBJECT_NORMAL?this._execObjectNormalEvent(t,s,i):i===V.OBJECT_MESSAGE?this._execObjectMessageEvent(t,s,i):i===V.OBJECT_MONSTER?this._execObjectMonsterEvent(t,s,i):i===V.OBJECT_ITEM?this._execObjectItemEvent(t,s,i):i===V.OBJECT_DOOR?this._execObjectDoorEvent(t,s,i):i===V.OBJECT_STATUS?this._execObjectStatusEvent(t,s,i):i===V.OBJECT_BUY?this._execObjectBuyEvent(t,s,i):i===V.OBJECT_SELL?this._execObjectSellEvent(t,s,i):i===V.OBJECT_URLGATE?this._execObjectUrlGateEvent(t,s,i):i===V.OBJECT_SCORE?this._execObjectScoreEvent(t,s,i):i===V.OBJECT_SELECT?this._execObjectYesNoChoiceEvent(t,s,i):i===V.OBJECT_LOCALGATE&&this._execObjectLocalGateEvent(t,s,i),a&&!this._player.isJumped()&&this._player.setLastExecInfoOnSamePosition(v.OBJECT,s))}_execMapStreetEvent(t,e,s){var i=this._wwaData.mapAttribute[e][V.ATR_ITEM];if(0!==i&&!this._player.hasItem(i))return!1;this.reserveAppearPartsInNextFrame(t,w.MAP,e);const a=this._wwaData.mapAttribute[e][V.ATR_STRING],r=this._wwaData.message[a],n=this._wwaData.mapAttribute[e][V.ATR_NUMBER];return this._waitFrame+=n*V.WAIT_TIME_FRAME_NUM,this._temporaryInputDisable=!0,this.generatePageAndReserveExecution(r,!1,!1,e,v.MAP,t.clone()),this.playSound(this._wwaData.mapAttribute[e][V.ATR_SOUND]),0!==a&&this._shouldTreatWillMessageDisplay(this._pages)||0!==n}_shouldTreatWillMessageDisplay(t){return t.reduce(((t,e)=>t||!Re(e.firstNode)),!1)}_execMapWallEvent(t,e,s){var i=this.getObjectIdByPosition(t.convertIntoPosition(this)),a=this.getObjectAttributeById(i,V.ATR_TYPE);if(0===i||a===V.OBJECT_NORMAL||a===V.OBJECT_DOOR&&(!this._player.hasItem(this.getObjectAttributeById(i,V.ATR_ITEM))||this.getObjectAttributeById(a,V.ATR_MODE)===V.PASSABLE_OBJECT)){this.reserveAppearPartsInNextFrame(t,w.MAP,e);var r=this._wwaData.mapAttribute[e][V.ATR_STRING],n=this._wwaData.message[r];return this.generatePageAndReserveExecution(n,!1,!1,e,v.MAP,t.clone()),this.playSound(this._wwaData.mapAttribute[e][V.ATR_SOUND]),!1}return!1}_execMapLocalGateEvent(t,e,s){var i=this._player.getPosition().getPartsCoord(),a=this._wwaData.mapAttribute[e][V.ATR_JUMP_X],r=this._wwaData.mapAttribute[e][V.ATR_JUMP_Y];return a>V.RELATIVE_COORD_LOWER&&(a=t.x+a-V.RELATIVE_COORD_BIAS),r>V.RELATIVE_COORD_LOWER&&(r=t.y+r-V.RELATIVE_COORD_BIAS),this.reserveAppearPartsInNextFrame(t,w.MAP,e),0<=a&&0<=r&&a<this._wwaData.mapWidth&&r<this._wwaData.mapWidth&&(a!==i.x||r!==i.y)&&(this.reserveJumpInNextFrame(new _(this,a,r,0,0)),this.playSound(this._wwaData.mapAttribute[e][V.ATR_SOUND]),!0)}_execMapUrlGateEvent(t,e,s){var a=this._wwaData.mapAttribute[e][V.ATR_STRING];if(!this._isURLGateEnable)return!0;const r=this.resolveSystemMessage(i.CONFIRM_ENTER_URL_GATE);if("BLANK"!==r)return this.generatePageAndReserveExecution(r,!0,!0),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_MAP_PARTS,this._yesNoURL=this._wwaData.message[a].split(/\s/g)[0],!0;location.href=ft(this._wwaData.message[a].split(/\s/g)[0])}_execObjectNormalEvent(t,e,s){}_execObjectMessageEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_STRING],a=this._wwaData.message[i],r=this._player.getPosition().getPartsCoord(),n=this._wwaData.objectAttribute[e][V.ATR_SOUND];t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t),this.generatePageAndReserveExecution(a,!1,!1,e,v.OBJECT,t),this._waitFrame+=this._wwaData.objectAttribute[e][V.ATR_NUMBER]*V.WAIT_TIME_FRAME_NUM,this._temporaryInputDisable=!0,this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this.playSound(n)}_execObjectStatusEvent(t,e,s){var i=new h(this._wwaData.objectAttribute[e][V.ATR_ENERGY],this._wwaData.objectAttribute[e][V.ATR_STRENGTH],this._wwaData.objectAttribute[e][V.ATR_DEFENCE],this._wwaData.objectAttribute[e][V.ATR_GOLD]),a=this._wwaData.objectAttribute[e][V.ATR_STRING],r=this._wwaData.message[a],n=this._player.getStatusWithoutEquipments();if(i.strength>V.STATUS_MINUS_BORDER&&n.strength<i.strength-V.STATUS_MINUS_BORDER||i.defence>V.STATUS_MINUS_BORDER&&n.defence<i.defence-V.STATUS_MINUS_BORDER||i.gold>V.STATUS_MINUS_BORDER&&n.gold<i.gold-V.STATUS_MINUS_BORDER)return this.setPartsOnPosition(v.OBJECT,0,t),this._keyStore.allClear(),void this._mouseStore.clear();i.energy=i.energy>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-i.energy:i.energy,i.strength=i.strength>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-i.strength:i.strength,i.defence=i.defence>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-i.defence:i.defence,i.gold=i.gold>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-i.gold:i.gold,this._player.addStatusAll(i),this.setStatusChangedEffect(i),this._player.isDead()&&0!==this._wwaData.objectAttribute[e][V.ATR_ENERGY]&&this.shouldApplyGameOver({isCalledByMacro:!1})?this.gameover():(this.generatePageAndReserveExecution(r,!1,!1,e,v.OBJECT,t.clone()),this.setPartsOnPosition(v.OBJECT,0,t),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND]))}_execObjectMonsterEvent(t,e,s){this._monster=this._createMonster(e,t,(()=>{this._monster=void 0,this._monsterWindow.hide(),this._dispatchWindowClosedTimeRequests()})),this._player.startBattleWith(this._monster)}_execObjectBuyEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_STRING],a=this._wwaData.message[i],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t),this.generatePageAndReserveExecution(a,!0,!1,e,v.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}_execObjectSellEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_STRING],a=this._wwaData.message[i],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t),this.generatePageAndReserveExecution(a,!0,!1,e,v.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}_execObjectItemEvent(t,e,s){var a=this._wwaData.objectAttribute[e][V.ATR_STRING],r=this._wwaData.message[a];try{var n=this._camera.getPosition().getScreenTopPosition().getPartsCoord(),o=(t.x-n.x)*V.CHIP_SIZE,h=(t.y-n.y)*V.CHIP_SIZE;this._player.addItem(e,this._wwaData.objectAttribute[e][V.ATR_NUMBER],!1,this._wwaData.isItemEffectEnabled?{screenPixelCoord:new c(o,h),itemBoxBackgroundImageCoord:new c(this._wwaData.imgItemboxX*V.CHIP_SIZE,this._wwaData.imgItemboxY*V.CHIP_SIZE)}:void 0),this.setPartsOnPosition(v.OBJECT,0,t),0!==this._wwaData.objectAttribute[e][V.ATR_MODE]||(this.generatePageAndReserveExecution(r,!1,!1,e,v.OBJECT,t.clone()),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e))}catch(t){const e=this.resolveSystemMessage(i.ITEM_BOX_FULL);"BLANK"!==e&&this.generatePageAndReserveExecution(e,!1,!0)}this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}_execObjectDoorEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_ITEM],a=this._wwaData.objectAttribute[e][V.ATR_STRING],r=this._wwaData.message[a];this._player.hasItem(i)&&(0===this._wwaData.objectAttribute[e][V.ATR_MODE]&&this._player.removeItemByPartsID(i),this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND]),this.generatePageAndReserveExecution(r,!1,!1,e,v.OBJECT,t.clone()),this.setPartsOnPosition(v.OBJECT,0,t),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this._paintSkipByDoorOpen=!0)}_execObjectYesNoChoiceEvent(t,e,s){var i=this._wwaData.objectAttribute[e][V.ATR_STRING],a=this._wwaData.message[i],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t),this.generatePageAndReserveExecution(a,!0,!1,e,v.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}_execObjectLocalGateEvent(t,e,s){var i=this._player.getPosition().getPartsCoord();t.x!==i.x||t.y!==i.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(v.OBJECT,0,t);var a=this._wwaData.objectAttribute[e][V.ATR_JUMP_X],r=this._wwaData.objectAttribute[e][V.ATR_JUMP_Y];a>V.RELATIVE_COORD_LOWER&&(a=i.x+a-V.RELATIVE_COORD_BIAS),r>V.RELATIVE_COORD_LOWER&&(r=i.y+r-V.RELATIVE_COORD_BIAS),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),0<=a&&0<=r&&a<this._wwaData.mapWidth&&r<this._wwaData.mapWidth&&(a!==i.x||r!==i.y)&&(this.reserveJumpInNextFrame(new _(this,a,r,0,0)),this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND]))}_execObjectUrlGateEvent(t,e,s){var a=this._wwaData.objectAttribute[e][V.ATR_STRING];if(!this._isURLGateEnable)return;const r=this.resolveSystemMessage(i.CONFIRM_ENTER_URL_GATE);"BLANK"!==r?(this.generatePageAndReserveExecution(r,!0,!0),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=T.CALL_BY_OBJECT_PARTS,this._yesNoURL=this._wwaData.message[a].split(/\s/g)[0]):location.href=ft(this._wwaData.message[a].split(/\s/g)[0])}_execObjectScoreEvent(t,e,s){const i=this._wwaData.objectAttribute[e][V.ATR_STRING];this.generatePageAndReserveExecution(this._wwaData.message[i],!1,!1,e,v.OBJECT,t,{rates:{energy:this._wwaData.objectAttribute[e][V.ATR_ENERGY],strength:this._wwaData.objectAttribute[e][V.ATR_STRENGTH],defence:this._wwaData.objectAttribute[e][V.ATR_DEFENCE],gold:this._wwaData.objectAttribute[e][V.ATR_GOLD]}}),this.playSound(this._wwaData.objectAttribute[e][V.ATR_SOUND])}updateScore(t){const e=t||this._lastScoreOptions;if(!e)return;const s=this._player.getStatus().calculateScore(e);this._scoreWindow.update(s)}_execChoiceWindowObjectSellEvent(){if(!this._player.hasGold(this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_GOLD])){const t=this.resolveSystemMessage(i.NO_MONEY);return"BLANK"!==t&&this._pages.push(new be(new Le(t),!0,!1,!0)),{}}if(0!==this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ITEM]){const t=this._yesNoChoicePartsCoord,e=this._camera.getPosition().getScreenTopPosition().getPartsCoord(),s=(t.x-e.x)*V.CHIP_SIZE,a=(t.y-e.y)*V.CHIP_SIZE,r=this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ITEM],n=this._wwaData.objectAttribute[r][V.ATR_NUMBER];try{this._player.addItem(r,n,!1,this._wwaData.isItemEffectEnabled?{screenPixelCoord:new c(s,a),itemBoxBackgroundImageCoord:new c(this._wwaData.imgItemboxX*V.CHIP_SIZE,this._wwaData.imgItemboxY*V.CHIP_SIZE)}:void 0)}catch(t){const e=this.resolveSystemMessage(i.ITEM_BOX_FULL);return"BLANK"!==e&&this._pages.push(new be(new Le(e),!0,!1,!0)),{}}}const t=new h(this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ENERGY],this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_STRENGTH],this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_DEFENCE],-this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_GOLD]);return t.energy=t.energy>V.STATUS_MINUS_BORDER?V.STATUS_MINUS_BORDER-t.energy:t.energy,this.setStatusChangedEffect(t),this._player.addStatusAll(t),this._player.isDead()&&0!==this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ENERGY]&&this.shouldApplyGameOver({isCalledByMacro:!1})?(this.gameover(),{isGameOver:!0}):(this.appearParts({pos:this._yesNoChoicePartsCoord,triggerType:w.OBJECT,triggerPartsId:this._yesNoChoicePartsID}),{})}_execChoiceWindowRunningEvent(){var t,e;if(0==--this._yesNoDispCounter)if(this._yesNoJudge===g.YES){if(this._yesNoChoiceCallInfo===T.CALL_BY_MAP_PARTS)(t=this._wwaData.mapAttribute[this._yesNoChoicePartsID][V.ATR_TYPE])===V.MAP_URLGATE&&(location.href=ft(this._yesNoURL));else if(this._yesNoChoiceCallInfo===T.CALL_BY_OBJECT_PARTS)if((t=this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_TYPE])===V.OBJECT_BUY)if(this._player.hasItem(this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ITEM]))this._player.removeItemByPartsID(this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_ITEM]),e=this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_GOLD],this._player.earnGold(e),this.setStatusChangedEffect(new h(0,0,0,e)),this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.OBJECT,this._yesNoChoicePartsID);else{const t=this.resolveSystemMessage(i.NO_ITEM);"BLANK"!==t&&this._pages.push(new be(new Le(t),!0,!1,!0))}else if(t===V.OBJECT_SELL){const{isGameOver:t}=this._execChoiceWindowObjectSellEvent();if(t)return}else t===V.OBJECT_SELECT?this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.CHOICE_YES,this._yesNoChoicePartsID):t===V.OBJECT_URLGATE&&(location.href=ft(this._yesNoURL));else this._yesNoChoiceCallInfo===T.CALL_BY_ITEM_USE?this._player.readyToUseItem(this._yesNoUseItemPos):this._yesNoChoiceCallInfo===T.CALL_BY_QUICK_LOAD||this._yesNoChoiceCallInfo===T.CALL_BY_LOG_QUICK_LOAD?(this._messageWindow.deleteSaveDom(),dt(M[I.QUICK_LOAD]).classList.remove("onpress"),this._messageWindow.load()&&(this._stopUpdateByLoadFlag=!0,this._loadType=P.QUICK_LOAD)):this._yesNoChoiceCallInfo===T.CALL_BY_QUICK_SAVE?(this._messageWindow.deleteSaveDom(),dt(M[I.QUICK_SAVE]).classList.remove("onpress"),this._quickSave(T.CALL_BY_QUICK_SAVE)):this._yesNoChoiceCallInfo===T.CALL_BY_RESTART_GAME?(dt(M[I.RESTART_GAME]).classList.remove("onpress"),this._stopUpdateByLoadFlag=!0,this._loadType=P.RESTART_GAME):this._yesNoChoiceCallInfo===T.CALL_BY_END_GAME?(window.history.back(-1),dt(M[I.GOTO_WWA]).classList.remove("onpress")):this._yesNoChoiceCallInfo===T.CALL_BY_GOTO_WWA?(location.href=ft(V.WWA_HOME),dt(M[I.GOTO_WWA]).classList.remove("onpress")):this._yesNoChoiceCallInfo===T.CALL_BY_PASSWORD_LOAD?(dt(M[I.QUICK_LOAD]).classList.remove("onpress"),this._player.setPasswordWindowWating(),this._passwordWindow.show(Ye.LOAD)):this._yesNoChoiceCallInfo===T.CALL_BY_PASSWORD_SAVE?(dt(M[I.QUICK_SAVE]).classList.remove("onpress"),this._player.setPasswordWindowWating(),this._passwordWindow.password=this._quickSave(T.CALL_BY_PASSWORD_SAVE),this._passwordWindow.show(Ye.SAVE)):this._yesNoChoiceCallInfo===T.CALL_BY_SUSPEND&&(dt(M[I.QUICK_SAVE]).classList.remove("onpress"),this._quickSave(T.CALL_BY_SUSPEND));this._yesNoJudge=g.UNSELECTED,this._setNextPage(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=T.NONE,this._messageWindow.setYesNoChoice(!1)}else if(this._yesNoJudge===g.NO){if(this._yesNoChoiceCallInfo===T.CALL_BY_MAP_PARTS)t=this._wwaData.mapAttribute[this._yesNoChoicePartsID][V.ATR_TYPE],V.MAP_URLGATE;else if(this._yesNoChoiceCallInfo===T.CALL_BY_OBJECT_PARTS)(t=this._wwaData.objectAttribute[this._yesNoChoicePartsID][V.ATR_TYPE])===V.OBJECT_BUY||t===V.OBJECT_SELL||(t===V.OBJECT_SELECT?this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.CHOICE_NO,this._yesNoChoicePartsID):V.OBJECT_URLGATE);else if(this._yesNoChoiceCallInfo===T.CALL_BY_ITEM_USE){dt("item"+(this._yesNoUseItemPos-1)).classList.remove("onpress")}else if(this._yesNoChoiceCallInfo===T.CALL_BY_QUICK_LOAD||this._yesNoChoiceCallInfo===T.CALL_BY_LOG_QUICK_LOAD)switch(this._messageWindow.deleteSaveDom(),this._yesNoChoiceCallInfo=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._yesNoChoiceCallInfo){case T.NONE:dt(M[I.QUICK_LOAD]).classList.remove("onpress");break;case T.CALL_BY_PASSWORD_LOAD:return this._yesNoJudge=g.UNSELECTED,void this.onpasswordloadcalled();case T.CALL_BY_LOG_QUICK_LOAD:this._wwaSave.selectLogSaveDataList(),this._messageWindow.createSaveDom();var s=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword);switch(this._yesNoJudge=g.UNSELECTED,s){case T.CALL_BY_PASSWORD_LOAD:this.generatePageAndReserveExecution("読み込むオートセーブを選んでください。\n→Noでデータ復帰用パスワードの\n 入力選択ができます。",!0,!0);break;case T.NONE:this.generatePageAndReserveExecution("読み込むオートセーブを選んでください。",!0,!0)}return}else if(this._yesNoChoiceCallInfo===T.CALL_BY_QUICK_SAVE){if(this._messageWindow.deleteSaveDom(),this._usePassword||this._useSuspend)return this._yesNoJudge=g.UNSELECTED,void(this._useSuspend?this.onpasssuspendsavecalled():this._usePassword&&this.onpasswordsavecalled());dt(M[I.QUICK_SAVE]).classList.remove("onpress")}else if(this._yesNoChoiceCallInfo===T.CALL_BY_RESTART_GAME)dt(M[I.RESTART_GAME]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_END_GAME)dt(M[I.GOTO_WWA]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_GOTO_WWA)dt(M[I.GOTO_WWA]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_PASSWORD_LOAD)dt(M[I.QUICK_LOAD]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_PASSWORD_SAVE)dt(M[I.QUICK_SAVE]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===T.CALL_BY_SUSPEND){if(this._usePassword)return this._yesNoJudge=g.UNSELECTED,void this.onpasswordsavecalled();dt(M[I.QUICK_SAVE]).classList.remove("onpress")}this._yesNoJudge=g.UNSELECTED,this._setNextPage(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=T.NONE,this._messageWindow.setYesNoChoice(!1)}}_dispatchWindowClosedTimeRequests(){if(this._windowCloseWaitingJumpGateRequest&&this.forcedJumpGate(this._windowCloseWaitingJumpGateRequest.x,this._windowCloseWaitingJumpGateRequest.y),this._windowCloseWaitingMessageDisplayRequests.length>0){const t=this._windowCloseWaitingMessageDisplayRequests.shift();this.generatePageAndReserveExecution(t,!1,!1)}}_dispatchPlayerAndObjectsStopTimeRequests(){this._playerAndObjectsStopWaitingGameSpeedChangeRequest&&(this.setPlayerSpeedIndex(this._playerAndObjectsStopWaitingGameSpeedChangeRequest.speedIndex),this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0),this._playerAndObjectsStopWaitingMessageDisplayRequests.length>0&&(this.generatePageAndReserveExecution(this._playerAndObjectsStopWaitingMessageDisplayRequests.join("<p>"),!1,!1),this._playerAndObjectsStopWaitingMessageDisplayRequests=[])}_clearAllRequests(){this._playerAndObjectsStopWaitingMessageDisplayRequests=[],this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0,this._windowCloseWaitingJumpGateRequest=void 0,this._windowCloseWaitingMessageDisplayRequests=[]}reserveMessageDisplayWhenShouldOpen(t){this._player.isWaitingMessage()||this._player.isFighting()||this._player.isWaitingPasswordWindow()||this._player.isWaitingEstimateWindow()?this._windowCloseWaitingMessageDisplayRequests.push(t):this._player.isMoving()||this._player.isWaitingMoveMacro()?this._playerAndObjectsStopWaitingMessageDisplayRequests.push(t):this.generatePageAndReserveExecution(t,!1,!1)}generatePageAndReserveExecution(t,e,s,i=0,a=v.OBJECT,r=new c(0,0),n=void 0){const o=this.generatePagesByRawMessage(t,i,a,r,s,e,n);this._pages=this._pages.concat(o),this._shouldSetNextPage=!0}generatePagesByRawMessage(t,e,s,i,a,r,n){const o=t.split(/\n\<c\>/i)[0].split(/\<c\>/i)[0].replace(/\n\<p\>\n/gi,"<P>").replace(/\n\<p\>/gi,"<P>").replace(/\<p\>\n/gi,"<P>").replace(/\<p\>/gi,"<P>").split("\n").map((t=>{if(!t.startsWith("//"))return t.match(/\/\//)?yt(yt(t).replace(/^.*\/\/(?!:s?ptth)/gi,"")):t})).filter((t=>void 0!==t)).join("\n").replace(/\\\/\\\//gi,"//").split("<script>"),h=o[0];if(o.length>1){const t=o[1];this._execEvalString(t)}if(""===h)return n?[new be(void 0,!0,!1,!1,n,{partsId:e,partsType:s,partsPosition:i})]:[];const c=h.split(/\<p\>/gi);return c.map(((t,o)=>{let h,_,l;const u={id:e,type:s,position:i},d=this.parseMessageLines(t,e,s,i),p=[];return d.forEach(((t,e)=>{try{const s=0===e?void 0:d[e-1].type,i=p[p.length-1],a=this.createNewNode(t,!h||!Be(s),{triggerParts:u}),r=this.processConditionalExecuteMacroLine(a,t,i,p);r&&(l=r),s?this.connectOrMergeToPreviousNode(t,s,_,a,i,l,{triggerParts:u}):h=a,a&&(_=a)}catch(t){console.error(`$if-$else_if-$else-$endif マクロの解析中にエラーが発生しました。ページ ${e}`),console.error(t)}})),new be(h,o===c.length-1,0===o&&r,a,0===o&&n,{partsId:e,partsType:s,partsPosition:i})}))}parseMessageLines(t,e,s,i){return t.split("\n").map((t=>{const a=t.match(/(\$(?:[a-zA-Z_][a-zA-Z0-9_]*)(?:.*))/);if(!a||a.length<2)return t.startsWith("$")?void 0:{type:"text",text:t};const r=function(t,e,s,i,a){var r;let n=a.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)\=(.*)$/);if((null===n||3!==n.length)&&(n=a.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)/),null===n||2!==n.length))throw new Error("マクロではありません");const o=`$${n[1].toLowerCase()}`,h="$if"===o&&a.match(/,/)?b.LEGACY_IF:B[o],c=Boolean(h!==b.SHOW_STR&&h!==b.SHOW_STR2),_=(null!==(r=n[2])&&void 0!==r?r:"").split(",").map((t=>c?t.trim():t));return new Ue(t,e,s,i,void 0===h?b.UNDEFINED:h,_)}(this,e,s,i,a[1]);switch(r.macroType){case b.IF:case b.ELSE_IF:case b.ELSE:case b.END_IF:case b.SHOW_STR:case b.SHOW_STR2:return{type:r.macroType,text:t,macro:r};default:return{type:"normalMacro",text:t,macro:r}}})).filter(Boolean)}createNewNode(t,e,s){switch(t.type){case b.IF:return new xe([{descriminant:ue(t.macro.macroArgs[0])}]);case b.SHOW_STR:case b.SHOW_STR2:return e?new Le(this._generateShowStrString(t.macro.macroArgs,{triggerParts:s.triggerParts,version:t.type===b.SHOW_STR2?2:1})):void 0;case"text":return e?new Le(t.text):void 0;case"normalMacro":return e?new Le("",[t.macro]):void 0;default:return}}processConditionalExecuteMacroLine(t,e,s,i){const a=0===i.length;switch(e.type){case b.IF:return void i.push(t);case b.ELSE_IF:if(a)throw new Error("構文エラー: $if を呼ぶ前に $else_if は呼べません");return void s.appendBranch({descriminant:ue(e.macro.macroArgs[0])});case b.ELSE:if(a)throw new Error("構文エラー: $if を呼ぶ前に $else は呼べません");return void s.appendBranch({descriminant:!0,elseBranch:{type:"real"}});case b.END_IF:if(a)throw new Error("構文エラー: $if を呼ぶ前に $endif は呼べません");return i.pop()}}connectOrMergeToPreviousNode(t,e,s,i,a,r,n){const o=Be(e);switch(e){case b.IF:case b.ELSE_IF:case b.ELSE:if(!i||!a)return;const e=a.getLastUnconnectedBranch();if(!e)throw new Error("lastUnconnectedBranchが見つかりませんでした。");return void(e.next=i);case b.END_IF:if(!(i&&r instanceof xe))return;for(let t=0;t<r.branches.length;t++){let e=r.branches[t].next;e?this.connectToFinalNode(e,i):r.branches[t]=i}return void(r.hasElseBranch()||r.branches.push({next:i,descriminant:!0,elseBranch:{type:"pesudo-else"}}));default:if(!(o&&s instanceof Le))return;const h=!s.isEmpty();t.type===b.SHOW_STR||t.type===b.SHOW_STR2?s.appendMessage(this._generateShowStrString(t.macro.macroArgs,{triggerParts:n.triggerParts,version:t.type===b.SHOW_STR2?2:1}),h):"text"===t.type?s.appendMessage(t.text,h):"normalMacro"===t.type?s.macro.push(t.macro):s.next=i}}connectToFinalNode(t,e){let s=t;for(;;)if(s instanceof xe&&(s=s.branches[0].next),s instanceof Le){if(!s.next)return void(s.next=e);s=s.next}}appearParts({pos:t,triggerType:e,triggerPartsId:s}){var i,a,r,n,o,h,l=e===w.CHOICE_NO?V.APPERANCE_PARTS_MIN_INDEX_NO:V.APPERANCE_PARTS_MIN_INDEX,u=e===w.CHOICE_YES?V.APPERANCE_PARTS_MAX_INDEX_YES:V.APPERANCE_PARTS_MAX_INDEX;for(e===w.MAP?(s=0===s?this._wwaData.map[t.y][t.x]:s,i=v.MAP):(s=0===s?this._wwaData.mapObject[t.y][t.x]:s,i=v.OBJECT),h=l;h<=u;h++){var d=V.ATR_APPERANCE_BASE+h*V.REL_ATR_APPERANCE_UNIT_LENGTH,p=d+V.REL_ATR_APPERANCE_ID,m=d+V.REL_ATR_APPERANCE_X,E=d+V.REL_ATR_APPERANCE_Y,g=d+V.REL_ATR_APPERANCE_TYPE;if(a=i===v.MAP?this._wwaData.mapAttribute[s][p]:this._wwaData.objectAttribute[s][p],r=i===v.MAP?this._wwaData.mapAttribute[s][g]:this._wwaData.objectAttribute[s][g],n=i===v.MAP?this._wwaData.mapAttribute[s][m]:this._wwaData.objectAttribute[s][m],o=i===v.MAP?this._wwaData.mapAttribute[s][E]:this._wwaData.objectAttribute[s][E],n===V.PLAYER_COORD?(n=this._player.getPosition().getPartsCoord().x,this._player.resetEventExecutionInfo()):n>V.RELATIVE_COORD_LOWER&&(n=t.x+n-V.RELATIVE_COORD_BIAS),o===V.PLAYER_COORD?(o=this._player.getPosition().getPartsCoord().y,this._player.resetEventExecutionInfo()):o>V.RELATIVE_COORD_LOWER&&(o=t.y+o-V.RELATIVE_COORD_BIAS),0!==n||0!==o)try{if(new _(this,n,o,0,0),r===v.MAP){if(a>=this._wwaData.mapPartsMax)throw new Error("背景パーツの範囲外IDが指定されました");var f=new c(n,o);this.setPartsOnPosition(v.MAP,a,f)}else{if(a>=this._wwaData.objPartsMax)throw new Error("物体パーツの範囲外IDが指定されました");f=new c(n,o);this.setPartsOnPosition(v.OBJECT,a,f),this._replaceRandomObject(new c(n,o)),n===this._player.getPosition().getPartsCoord().x&&o===this._player.getPosition().getPartsCoord().y&&this._player.setPartsAppearedFlag()}}catch(t){}}}reserveAppearPartsInNextFrame(t,e,s=0){this._reservedPartsAppearances.push({pos:t,triggerType:e,triggerPartsId:s})}reserveJumpInNextFrame(t){this._reservedJumpDestination=t}appearPartsByDirection(t,e,s){var i=this._player.getPosition().getPartsCoord(),a=this._player.getDir(),r=m[a],n=E[a];this.appearPartsEval(i,(r>=0?"+":"-")+Math.abs(r)*t,(n>=0?"+":"-")+Math.abs(n)*t,e,s)}appearPartsEval(t,e,s,i,a){var r,n,o=this._player.getPosition().getPartsCoord();if("P"===e||"p"===e)r=o.x;else if("+"===e[0])r=t.x+parseInt(e.substr(1));else if("-"===e[0])r=t.x-parseInt(e.substr(1));else if(r=parseInt(e),isNaN(r))throw new Error("座標として解釈できない文字が含まれています。");if("P"===s||"p"===s)n=o.y;else if("+"===s[0])n=t.y+parseInt(s.substr(1));else if("-"===s[0])n=t.y-parseInt(s.substr(1));else if(n=parseInt(s),isNaN(n))throw new Error("座標として解釈できない文字が含まれています。");try{new _(this,r,n,0,0);if(a===v.MAP){if(i>=this._wwaData.mapPartsMax)throw new Error("背景パーツの範囲外IDが指定されました");var h=new c(r,n);this.setPartsOnPosition(v.MAP,i,h)}else{if(i>=this._wwaData.objPartsMax)throw new Error("物体パーツの範囲外IDが指定されました");h=new c(r,n);this.setPartsOnPosition(v.OBJECT,i,h),this._replaceRandomObject(new c(r,n)),r===this._player.getPosition().getPartsCoord().x&&n===this._player.getPosition().getPartsCoord().y&&this._player.setPartsAppearedFlag()}}catch(t){}}getPartsID(t,e){if(t.x<0||t.y<0)throw new Error("想定外の座標が指定されました");return e===v.MAP?this._wwaData.map[t.y][t.x]:this._wwaData.mapObject[t.y][t.x]}_replaceRandomObject(t){var e,s,i=this._wwaData.mapObject[t.y][t.x];if(this._wwaData.objectAttribute[i][V.ATR_TYPE]===V.OBJECT_RANDOM){for(var a=0;a<V.RANDOM_ITERATION_MAX;a++){if(s=Math.floor(10*Math.random()),(e=this._wwaData.objectAttribute[i][V.ATR_RANDOM_BASE+s])>=this._wwaData.objPartsMax){e=0;break}if(this._wwaData.objectAttribute[e][V.ATR_TYPE]!==V.OBJECT_RANDOM)break;i=e}this.setPartsOnPosition(v.OBJECT,e,t)}}_replaceRandomObjectsInScreen(){for(var t=this._camera.getPosition().getPartsCoord(),e=Math.max(0,t.x-1),s=Math.min(this._wwaData.mapWidth-1,t.x+V.H_PARTS_NUM_IN_WINDOW),i=Math.max(0,t.y-1),a=Math.min(this._wwaData.mapWidth-1,t.y+V.V_PARTS_NUM_IN_WINDOW),r=e;r<=s;r++)for(var n=i;n<=a;n++)this._replaceRandomObject(new c(r,n))}_replaceAllRandomObjects(){for(var t=0;t<this._wwaData.mapWidth;t++)for(var e=0;e<this._wwaData.mapWidth;e++)this._replaceRandomObject(new c(t,e))}gameover(){var t=this._wwaData.gameoverX,e=this._wwaData.gameoverY;this._yesNoJudge=g.UNSELECTED,this._pages=[],this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=T.NONE,this._player.clearMessageWaiting(),this._messageWindow.clear(),this._messageWindow.setYesNoChoice(!1),this._waitFrame=0,this._temporaryInputDisable=!0,this._shouldSetNextPage=!1,this._reservedPartsAppearances=[],this._reservedJumpDestination=void 0,this._clearAllRequests(),this._player.jumpTo(new _(this,t,e,0,0));const s=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_GAMEOVER;s&&this.evalCalcWwaNodeGenerator.evalWwaNode(s)}setYesNoInput(t){this._yesNoJudgeInNextFrame=t}getYesNoState(){return void 0!==this._yesNoJudgeInNextFrame?this._yesNoJudgeInNextFrame:this._yesNoJudge}setStatusChangedEffect(t){this._wwaData.isItemEffectEnabled&&(0!==t.strength&&(dt("disp-strength").classList.add("onpress"),this._statusPressCounter.strength=V.STATUS_CHANGED_EFFECT_FRAME_NUM),0!==t.defence&&(dt("disp-defence").classList.add("onpress"),this._statusPressCounter.defence=V.STATUS_CHANGED_EFFECT_FRAME_NUM),t instanceof h&&(0!==t.energy&&(dt("disp-energy").classList.add("onpress"),this._statusPressCounter.energy=V.STATUS_CHANGED_EFFECT_FRAME_NUM),0!==t.gold&&(dt("disp-gold").classList.add("onpress"),this._statusPressCounter.gold=V.STATUS_CHANGED_EFFECT_FRAME_NUM)))}setPartsOnPosition(t,e,s){var i,a,r=s.y<<$.BITSHIFT|s.x;t===v.MAP?(i=this._wwaData.map[s.y][s.x],e=this.loadMapPartsID(e),i=this.loadMapPartsID(i),this._wwaData.map[s.y][s.x]=e,-1!==(a=this._mapIDTable[i].indexOf(r))&&this._mapIDTable[i].splice(a,1),-1===(a=this._mapIDTable[e].indexOf(r))&&this._mapIDTable[e].push(r)):(i=this._wwaData.mapObject[s.y][s.x],e=this.loadMapPartsObjectID(e),i=this.loadMapPartsObjectID(i),this._wwaData.mapObject[s.y][s.x]=e,-1!==(a=this._mapObjectIDTable[i].indexOf(r))&&this._mapObjectIDTable[i].splice(a,1),-1===(a=this._mapObjectIDTable[e].indexOf(r))&&this._mapObjectIDTable[e].push(r))}_countSamePartsLength(t,e){var s;for(s=e+1;s<t.length&&t[s]===t[s-1];s++);return s-e}_compressMap(t){for(var e=[],s=0;s<t.length;s++){e[s]=[];for(var i=0;i<t[s].length;){var a=this._countSamePartsLength(t[s],i);e[s].push([t[s][i],a]),i+=a}}return e}_decompressMap(t){for(var e=[],s=0;s<t.length;s++){e[s]=[],0;for(var i=0;i<t[s].length;i++)for(var a=t[s][i][1],r=0;r<a;r++)e[s].push(t[s][i][0])}return e}_generateMapDataHash(t){var e="A",s=0,i=0,a=0;for(a=0;a<t.map.length;a++){for(i=0;i<t.map[a].length;)s=this._countSamePartsLength(t.map[a],i),e+=t.map[a][i]+"|"+s+"/",i+=s;for(i=0;i<t.mapObject[a].length;)s=this._countSamePartsLength(t.mapObject[a],i),e+=t.mapObject[a][i]+"|"+s+"/",i+=s}for(var r=0;r<t.mapAttribute.length;r++)for(var n=0;n<t.mapAttribute[r].length;n++)e+=t.mapAttribute[r][n]+"/";for(var o=0;o<t.objectAttribute.length;o++)for(var h=0;h<t.objectAttribute[o].length;h++)e+=t.objectAttribute[o][h]+"/";return Qe(e+="Z")}_generateSaveDataHash(t){var e=this._generateMapDataHash(t),s=[];for(var i in t)"map"!==i&&"mapObject"!==i&&"mapCompressed"!==i&&"mapObjectCompressed"!==i&&"mapAttribute"!==i&&"objectAttribute"!==i&&"checkString"!==i&&s.push(i);s.sort();for(var a=0;a<s.length;a++)e+=vt(t[s[a]]);return Qe(e)}compressSystem(){return is}_quickSave(t){var e,s;const i=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_SAVE;i&&this.evalCalcWwaNodeGenerator.evalWwaNode(i);var a,r,n=JSON.parse(JSON.stringify(this._wwaData)),o=this._player.getPosition().getPartsCoord(),h=this._player.getStatusWithoutEquipments();switch(n.itemBox=this._player.getCopyOfItemBox(),n.playerX=o.x,n.playerY=o.y,n.statusEnergyMax=this._player.getEnergyMax(),n.statusEnergy=h.energy,n.statusStrength=h.strength,n.statusDefence=h.defence,n.statusGold=h.gold,n.moves=this._player.getMoveCount(),n.frameCount=this._player.getFrameCount(),n.gameSpeedIndex=this._player.getSpeedIndex(),n.playTime=null!==(s=null===(e=this._playTimeCalculator)||void 0===e?void 0:e.calculateTimeMs())&&void 0!==s?s:0,n.userVar=this._userVar.numbered.slice(),n.userNamedVar=[...this._userVar.named],t){case T.CALL_BY_LOG_QUICK_SAVE:case T.CALL_BY_QUICK_SAVE:case T.CALL_BY_SUSPEND:break;case T.CALL_BY_PASSWORD_SAVE:n.checkOriginalMapString=this.checkOriginalMapString,n.checkString=this._generateSaveDataHash(n)}switch(n.message=void 0,n.mapAttribute=void 0,n.objectAttribute=void 0,t){case T.CALL_BY_QUICK_SAVE:return this._messageWindow.save(this._cvs,n),this.wwaCustomEvent("wwa_quicksave",{data:n}),"";case T.CALL_BY_PASSWORD_SAVE:const t=is.compress(n);t.isCompress=1;const e=JSON.stringify(t);return this.wwaCustomEvent("wwa_passwordsave",{data:n,compress:t}),a=e,r=this._wwaData.worldPassNumber,console.warn(qe.enc.Utf8.parse(a)),qe.AES.encrypt(qe.enc.Utf8.parse(a),ze(r)).toString();case T.CALL_BY_SUSPEND:this.wwaCustomEvent("wwa_suspend",{data:n,compress:is.compress(n)});break;case T.CALL_BY_LOG_QUICK_SAVE:this.wwaCustomEvent("wwa_autosave",{data:n}),this._wwaSave.autoSave(this._cvs,n)}}wwaCustomEvent(t,e={}){this.wwaCustomEventEmitter.dispatch(t,e)}_decodePassword(t){let e,s="";try{i=t,a=this._wwaData.worldPassNumber,s=qe.AES.decrypt(i,ze(a)).toString(qe.enc.Utf8)}catch(t){e=t}var i,a,r;if(!s){console.warn("新方式でのパスワード暗号化解除失敗:",e);try{s=function(t,e,s){return qe.AES.decrypt(t,function(t,e){return`^ /${231*t+8310+e}P+>A[]`}(e,s)).toString(qe.enc.Utf8)}(t,this._wwaData.worldPassNumber,this.checkOriginalMapString)}catch(t){e=t}}if(!s){console.warn("旧方式でのパスワード暗号化解除失敗:",e);const t=e&&e.message?e.message:"";throw new Error("パスワード取得時からワールド制作者によってマップの暗証番号が変更されたか、\nパスワードが壊れているために正常にセーブデータが復元できませんでした。\n"+t)}try{r=JSON.parse(s)}catch(t){throw new Error("マップデータ以外のものが暗号化されたか、マップデータに何かが不足しているようです。\nJSON PARSE FAILED")}if(r.isCompress){delete r.isCompress;const[t,e]=is.decompress(r);return[hs(t),e]}return[r,{isWorldNameEmpty:!1}]}_quickLoad(t=!1,e=null,s=!0){if(!t&&void 0===this._wwaSave.hasSaveData()&&null===e)throw new Error("セーブデータがありません。");let i,a=!1;if(null!==e){const t=this._decodePassword(e);i=t[0],a=t[1].isWorldNameEmpty}else i=JSON.parse(JSON.stringify(t?this._restartData:this._messageWindow.load()));if(i.message=JSON.parse(JSON.stringify(this._restartData.message)),i.mapAttribute=JSON.parse(JSON.stringify(this._restartData.mapAttribute)),i.objectAttribute=JSON.parse(JSON.stringify(this._restartData.objectAttribute)),void 0===i.map&&(i.map=this._decompressMap(i.mapCompressed)),void 0===i.mapObject&&(i.mapObject=this._decompressMap(i.mapObjectCompressed)),delete i.mapCompressed,delete i.mapObjectCompressed,null!==e){if(!a&&i.worldName!==this._wwaData.worldName)throw console.error("Invalid title",`(password)=${i.worldName} (current map)=${this._wwaData.worldName}`),new Error("前回パスワード取得時から、制作者によってワールド名が変更されたためロードできませんでした。\n予めご了承ください。");const t=this.checkOriginalMapString;if(this._isDisallowLoadOldSave&&i.checkOriginalMapString!==t)throw console.error("Invalid hash",`(password)=${i.checkOriginalMapString} (current map)=${t}`),new Error("前回パスワード取得時から、制作者によってマップが変更されたためロードできませんでした。\n(マップデータ制作者の設定により、内容が変更されると以前のパスワードは利用できなくなります。)\n予めご了承ください。");console.log("Valid Password!")}return s&&this._applyQuickLoad(i),i}_applyQuickLoad(t){this._userVar.named=new Map(t.userNamedVar),this._userVar.numbered=t.userVar,this._player.setEnergyMax(t.statusEnergyMax),this._player.setEnergy(t.statusEnergy),this._player.setStrength(t.statusStrength),this._player.setDefence(t.statusDefence),this._player.setGold(t.statusGold),this._player.setMoveCount(t.moves),this._player.setFrameCount(t.frameCount),this._player.clearItemBox();for(var e=0;e<t.itemBox.length;e++)this._player.addItem(t.itemBox[e],e+1,!0);this._player.systemJumpTo(new _(this,t.playerX,t.playerY,0,0)),0===t.bgm?this.playSound(R.NO_SOUND):this.playSound(t.bgm,t.bgmDelayDurationMs),this.setImgClick(new c(t.imgClickX,t.imgClickY)),0!==this.getObjectIdByPosition(this._player.getPosition())&&this._player.setPartsAppearedFlag(),this._clearAllRequests(),this._playTimeCalculator=new ot(t.playTime),this._wwaData=t,this._mapIDTableCreate(),this._replaceAllRandomObjects(),this.setStatusIconCoord(L.ENERGY,new c(t.imgStatusEnergyX,t.imgStatusEnergyY)),this.setStatusIconCoord(L.STRENGTH,new c(t.imgStatusStrengthX,t.imgStatusStrengthY)),this.setStatusIconCoord(L.DEFENCE,new c(t.imgStatusDefenceX,t.imgStatusDefenceY)),this.setStatusIconCoord(L.GOLD,new c(t.imgStatusGoldX,t.imgStatusGoldY)),this.setWideCellCoord(new c(t.imgWideCellX,t.imgWideCellY)),this.setItemboxBackgroundPosition({x:t.imgItemboxX,y:t.imgItemboxY}),this.setFrameCoord(new c(t.imgFrameX,t.imgFrameY)),this.setPlayerSpeedIndex(t.gameSpeedIndex),this.updateCSSRule(),this.updateEffect(),this._cgManager.updatePictures(this._wwaData.pictureRegistry),this.updatePicturesCache(),this._player.updateStatusValueBox(),this._wwaSave.quickSaveButtonUpdate(this._wwaData)}_mapIDTableCreate(){var t;for(this._mapIDTable=[],this._mapObjectIDTable=[],t=0;t<this._wwaData.mapPartsMax;t++)this._mapIDTable[t]=[];for(t=0;t<this._wwaData.objPartsMax;t++)this._mapObjectIDTable[t]=[];for(var e=0;e<this._wwaData.mapWidth;e++)for(var s=0;s<this._wwaData.mapWidth;s++){var i=s<<$.BITSHIFT|e;t=this._wwaData.map[s][e],this._mapIDTable[t]instanceof Array||(this._mapIDTable[t]=[]),this._mapIDTable[t].push(i),t=this._wwaData.mapObject[s][e],this._mapObjectIDTable[t]instanceof Array||(this._mapObjectIDTable[t]=[]),this._mapObjectIDTable[t].push(i)}}restartGame(){this._quickLoad(!0)}_fadeout(t){var e=0,s=V.MAP_WINDOW_WIDTH,i=V.FADEOUT_SPEED,a=dt("wwa-fader");a.style.display="block";var r=setInterval((()=>{if(e+=i,(s-=2*i)<=0||2*e>V.MAP_WINDOW_WIDTH)return a.removeAttribute("style"),a.style.display="block",a.style.borderWidth="0",a.style.width=V.MAP_WINDOW_WIDTH+"px",a.style.height=V.MAP_WINDOW_HEIGHT+"px",a.style.backgroundColor="#808080",clearInterval(r),void t();a.style.width=s+"px",a.style.height=s+"px",a.style.borderWidth=e+"px"}),20)}moveObjects(t){var e,s,i,a=this._camera.getPosition(),r=(this._player.getPosition(),a.getPartsCoord(),a.getPartsCoord().x),n=a.getPartsCoord().y;if(this.getMapAttributeByPosition(this._player.getPosition(),V.ATR_TYPE)!==V.MAP_LOCALGATE&&this.getObjectAttributeByPosition(this._player.getPosition(),V.ATR_TYPE)!==V.OBJECT_LOCALGATE){for(e=new Array(V.V_PARTS_NUM_IN_WINDOW+2),this.hoge=new Array(V.V_PARTS_NUM_IN_WINDOW+2),i=-1;i<=V.V_PARTS_NUM_IN_WINDOW;i++)for(e[i+1]=new Array(V.H_PARTS_NUM_IN_WINDOW+2),this.hoge[i+1]=new Array(V.H_PARTS_NUM_IN_WINDOW+2),s=-1;s<=V.H_PARTS_NUM_IN_WINDOW;s++)if(n+i<0||n+i>=this._wwaData.mapWidth||r+s<0||r+s>=this._wwaData.mapWidth)e[i+1][s+1]=0,this.hoge[i+1][s+1]=0;else{try{var o=(h=new _(this,r+s,n+i,0,0)).getPartsCoord()}catch(t){e[i+1][s+1]=0,this.hoge[i+1][s+1]=0;continue}this._wwaData.mapObject[o.y][o.x];e[i+1][s+1]=this._wwaData.mapObject[o.y][o.x],this.hoge[i+1][s+1]=-this._wwaData.mapObject[o.y][o.x]}for(s=-1;s<=V.H_PARTS_NUM_IN_WINDOW;s++)if(!(r+s<0||r+s>=this._wwaData.mapWidth))for(i=-1;i<=V.V_PARTS_NUM_IN_WINDOW;i++)if(!(n+i<0||n+i>=this._wwaData.mapWidth)){try{var h;o=(h=new _(this,r+s,n+i,0,0)).getPartsCoord()}catch(t){continue}var l=this._wwaData.mapObject[o.y][o.x];if(0!==l&&this._wwaData.objectAttribute[l][V.ATR_MOVE]!==D.STATIC&&this._wwaData.objectAttribute[l][V.ATR_TYPE]!==V.OBJECT_LOCALGATE&&this._wwaData.objectAttribute[l][V.ATR_TYPE]!==V.OBJECT_RANDOM&&(this._wwaData.objectAttribute[l][V.ATR_MOVE]===D.CHASE_PLAYER||this._wwaData.objectAttribute[l][V.ATR_MOVE]===D.RUN_OUT||this._wwaData.objectAttribute[l][V.ATR_MOVE]===D.HANG_AROUND)){var u=this._wwaData.objectAttribute[l][V.ATR_MOVE];if(u!==D.HANG_AROUND){var d,p=this._getCandidateCoord(t,h,u),m=new c(p.x,o.y),E=new c(o.x,p.y),g=null;if(this._objectCanMoveTo(t,p,e))this._setObjectsInNextFrame(o,p,r,n,e,l);else{var w=this._getSecondCandidateMoveMode(t,o,p,m,E,this._wwaData.objectAttribute[l][V.ATR_TYPE]===V.OBJECT_MONSTER,e);w===N.MODE_X?this._setObjectsInNextFrame(o,m,r,n,e,l):w===N.MODE_Y?this._setObjectsInNextFrame(o,E,r,n,e,l):null===(g=this._getThirdCandidate(t,h,p,u,e))||this._wwaData.isOldMove?(d=this._getRandomMoveCoord(t,h,e),this._setObjectsInNextFrame(o,d,r,n,e,l)):this._setObjectsInNextFrame(o,g,r,n,e,l)}}else d=this._getRandomMoveCoord(t,h,e),this._setObjectsInNextFrame(o,d,r,n,e,l)}}}}_getCandidateCoord(t,e,s){var i=e.getPartsCoord();this._player.getPosition().getOffsetCoord(),this._player.getPosition().getPartsCoord();try{var a=t?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord()}catch(t){throw new Error("予期せぬ方向への移動のようです。")}var r=i.clone(),n=0,o=0;return s===D.CHASE_PLAYER?(n=i.x>a.x?-1:i.x<a.x?1:0,o=i.y>a.y?-1:i.y<a.y?1:0):s===D.RUN_OUT&&(n=i.x>a.x?1:i.x<a.x?-1:0,o=i.y>a.y?1:i.y<a.y?-1:0),r.x+=n,r.y+=o,r.x=Math.min(this._wwaData.mapWidth-1,Math.max(0,r.x)),r.y=Math.min(this._wwaData.mapWidth-1,Math.max(0,r.y)),r}_getSecondCandidateMoveMode(t,e,s,i,a,r,n){return!t||(this._player.getDir()!==p.UP&&this._player.getDir()!==p.DOWN||!r)&&(this._player.getDir()!==p.LEFT&&this._player.getDir()!==p.RIGHT||r)?this._objectCanMoveTo(t,i,n)?N.MODE_X:this._objectCanMoveTo(t,a,n)?N.MODE_Y:N.UNDECIDED:this._objectCanMoveTo(t,a,n)?N.MODE_Y:this._objectCanMoveTo(t,i,n)?N.MODE_X:N.UNDECIDED}_getThirdCandidate(t,e,s,i,a){var r,n=i===D.CHASE_PLAYER?1:i===D.RUN_OUT?-1:0,o=t?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord(),h=e.getPartsCoord();if(o.x!==h.x){if(r=new c(s.x,h.y+1*n),this._objectCanMoveTo(t,r,a))return r;if(r=new c(s.x,h.y-1*n),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x,h.y+1*n),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x,h.y-1*n),this._objectCanMoveTo(t,r,a))return r}if(o.y!==h.y){if(r=new c(h.x+1*n,s.y),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x-1*n,s.y),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x+1*n,h.y),this._objectCanMoveTo(t,r,a))return r;if(r=new c(h.x-1*n,h.y),this._objectCanMoveTo(t,r,a))return r}return null}_getRandomMoveCoord(t,e,s){const i=e.getPartsCoord(),a=i.clone(),r=this._wwaData.isOldMove?V.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31:V.RANDOM_MOVE_ITERATION_NUM;for(let e=0;e<r;e++){const e=[-1,1,0,0,-1,-1,1,1],r=[0,0,1,-1,1,-1,1,-1],n=Math.floor(Math.random()*e.length);if(a.x=i.x+e[n],a.y=i.y+r[n],this._objectCanMoveTo(t,a,s))return a}return i}isPrevFrameEventExecuted(){return this._prevFrameEventExected}_objectCanMoveTo(t,e,s){if(e.x<0||e.y<0||this._wwaData.mapWidth<=e.x||this._wwaData.mapWidth<=e.y)return!1;var i=this._wwaData.map[e.y][e.x],a=this._wwaData.mapObject[e.y][e.x],r=this._wwaData.mapAttribute[i][V.ATR_TYPE],n=this._camera.getPosition(),o=n.getPartsCoord().x,h=n.getPartsCoord().y;if(0===i&&!this.isOldMap()||r===V.MAP_WALL)return!1;var c=e.x-o+1,_=e.y-h+1;if(0<=c&&0<=_&&c<s.length&&_<s.length){if(0!==s[_][c])return!1}else if(0!==a)return!1;if(t){if(this._player.getPosition().getNextJustPosition().getPartsCoord().equals(e))return!1}else if(this._player.getPosition().getPartsCoord().equals(e))return!1;return!0}_setObjectsInNextFrame(t,e,s,i,a,r){var n=e.x-s+1,o=e.y-i+1;0<=e.x&&e.x<=this._wwaData.mapWidth&&0<=e.y&&e.y<=this._wwaData.mapWidth&&(0<=n&&n<a.length&&0<=o&&o<a.length&&(a[t.y-i+1][t.x-s+1]=0,a[e.y-i+1][e.x-s+1]=r,this.hoge[e.y-i+1][e.x-s+1]=r),this._objectMovingDataManager.add(r,t.convertIntoPosition(this),e.convertIntoPosition(this),t.getDirectionTo(e)))}launchBattleEstimateWindow(){const t=this._camera.getPosition().getPartsCoord(),e=Math.max(0,t.x),s=Math.min(this._wwaData.mapWidth-1,t.x+V.H_PARTS_NUM_IN_WINDOW-1),i=Math.max(0,t.y),a=Math.min(this._wwaData.mapWidth-1,t.y+V.V_PARTS_NUM_IN_WINDOW-1),r=[];this.playSound(R.DECISION);for(let t=e;t<=s;t++)for(let e=i;e<=a;e++){const s=this._wwaData.mapObject[e][t];this._wwaData.objectAttribute[s][V.ATR_TYPE]!==V.OBJECT_MONSTER||r.find((t=>t.partsID===s))||r.push(this._createMonster(s,new c(t,e)))}if(this._bottomButtonType===d.BATTLE_REPORT&&dt(M[I.GOTO_WWA]).classList.add("onpress"),0===r.length)return dt(M[I.GOTO_WWA]).classList.remove("onpress"),this.hideBattleEstimateWindow(),!1;this._battleEstimateWindow.update(this._player.getStatus(),r,((t,e)=>this._player.calcBattleResultForPlayerTurn(t,e.status,!0)),((t,e)=>this._player.calcBattleResultForEnemyTurn(t.status,e,!0)),this.isUsingDefaultDamageCalcFunction()),this._battleEstimateWindow.show(),this._player.setEstimateWindowWating();const n=this.userDefinedFunctions&&this.userDefinedFunctions.CALL_BATTLE_REPORT;return n&&this.evalCalcWwaNodeGenerator.evalWwaNode(n),!0}isUsingDefaultDamageCalcFunction(){return void 0===this.getUserDefinedDamageFunctionNode("enemyToPlayer")&&void 0===this.getUserDefinedDamageFunctionNode("playerToEnemy")}_createMonster(t,e,s){return new De(t,e,new c(this._wwaData.objectAttribute[t][V.ATR_X],this._wwaData.objectAttribute[t][V.ATR_Y]),new h(this._wwaData.objectAttribute[t][V.ATR_ENERGY],this._wwaData.objectAttribute[t][V.ATR_STRENGTH],this._wwaData.objectAttribute[t][V.ATR_DEFENCE],this._wwaData.objectAttribute[t][V.ATR_GOLD]),this._wwaData.message[this._wwaData.objectAttribute[t][V.ATR_STRING]],this._wwaData.objectAttribute[t][V.ATR_ITEM],s)}hideBattleEstimateWindow(){this._battleEstimateWindow.hide(),this._player.clearEstimateWindowWaiting(),dt(M[I.GOTO_WWA]).classList.remove("onpress"),this._dispatchWindowClosedTimeRequests()}hidePasswordWindow(t=!1){if(this._passwordWindow.hide(),t||this._passwordWindow.mode===Ye.SAVE)return this._player.clearPasswordWindowWaiting(),void this._dispatchWindowClosedTimeRequests();try{var e=this._quickLoad(!1,this._passwordWindow.password,!1)}catch(t){return this._player.clearPasswordWindowWaiting(),this._dispatchWindowClosedTimeRequests(),void alert("セーブデータの復元に失敗しました。\nエラー詳細:\n"+t.message)}this._passwordLoadExecInNextFrame=!0,this._passwordSaveExtractData=e}_displayUserVars(){if(!this._canDisplayUserVars||!this._inlineUserVarViewer)return;let t="";if(this._inlineUserVarViewer.isVisible=!0,this._player.isControllable()){const e=[...this._userVar.named];if("named"===this._inlineUserVarViewer.kind)if(t="名前つき変数一覧\n",0===e.length)t+="名前つき変数はありません\n";else if(e.length<=V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM)t+=e.map((([t,e])=>`${t}: ${At(e)}`)).join("\n"),t+="\n";else for(let s=0;s<V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM;s++){let i=(this._inlineUserVarViewer.topUserVarIndex[this._inlineUserVarViewer.kind]+s)%e.length;t+=`${e[i][0]}: ${At(e[i][1],!0)}\n`}else if("numbered"===this._inlineUserVarViewer.kind){t="変数一覧\n",this._userVarNameListRequestError&&("noFileSpecified"===this._userVarNameListRequestError.kind?t+=this._userVarNameListRequestError.errorMessage+"\n":(t+="【変数名取得失敗】\n",t+=" すべての変数を名無しとしています。\n",t+=` エラー詳細: ${this._userVarNameListRequestError.errorMessage}\n`));for(let e=0;e<V.INLINE_USER_VAR_VIEWER_DISPLAY_NUM;e++){let s=(this._inlineUserVarViewer.topUserVarIndex[this._inlineUserVarViewer.kind]+e)%V.USER_VAR_NUM;t+=`${`変数 ${s}: ${this._userVarNameList&&this._userVarNameList[s]?this._userVarNameList[s]:"名無し"}`}: ${At(this._userVar.numbered[s],!0)}\n`}}t+="\n操作方法\n",t+="上キー:1つ戻す 下キー:1つ進める\n",t+="左キー:10個戻す 右キー:10個進める\n",t+="Vキー: 名前付き変数/通常変数の切り替え",this.generatePageAndReserveExecution(t,!1,!0)}}_displayHelp(){var t;if(this._player.isControllable()){const s=null===(t=this._playTimeCalculator)||void 0===t?void 0:t.calculatePlayTimeFormat();var e="";switch(this.userDevice.device){case S.GAME:switch(this.userDevice.os){case y.NINTENDO:e=" 【操作方法】\nA:Yes,戦闘結果予測の表示\nB:No\nX:メニュー\nY:このリストの表示\nR:初めからスタート\nZL:データの一時保存\nZR:一時保存データの読み込み\n+: 移動速度を上げる\n-: 移動速度を落とす\n WWA Wing バージョン:4.1.0-unstable.based-on.3.12.11.p.4\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;case y.PLAY_STATION:e=" 【操作方法】\n〇:Yes,戦闘結果予測の表示\n×:No\n△:メニュー\n□:このリストの表示\nR1:初めからスタート\nL2:データの一時保存\nR2:一時保存データの読み込み\nOPTIONS: 移動速度を上げる\nSHARE: 移動速度を落とす\n  現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?"  プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:4.1.0-unstable.based-on.3.12.11.p.4\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;case y.XBOX:e=" 【操作方法】\nB:Yes,戦闘結果予測の表示\nA:No\nY:メニュー\nX:このリストの表示\nRB:初めからスタート\nLT:データの一時保存\nRT:一時保存データの読み込み\nMENU: 移動速度を上げる\nWINDOW: 移動速度を落とす\n  現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?"  プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:4.1.0-unstable.based-on.3.12.11.p.4\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;default:return}break;case S.SP:case S.VR:return;case S.PC:e=" 【操作方法】\nF1、M:戦闘結果予測の表示\nF3:復帰用パスワード入力\nF4:復帰用パスワード表示\nF5:一時保存データの読み込み\nF6:データの一時保存\nF7:初めからスタート\nF8:WWA公式ページにリンク\nF12:このリストの表示\nキーボードの「123、QWE、ASD、ZXC」は右のアイテムボックスに対応。\n「Enter、Y」はYes,\n「Esc、N」はNoに対応。\n   I: 移動速度を落とす/\nF2、P: 移動速度を上げる\n  現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?"  プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:4.1.0-unstable.based-on.3.12.11.p.4\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;default:return}e&&this.generatePageAndReserveExecution(e,!1,!0)}}_setNextPage(){if(this._clearFacesInNextFrame=!0,this._scoreWindow.isVisible()&&this._scoreWindow.hide(),this._isLastPage&&void 0!==this._reservedMoveMacroTurn&&(this._player.setMoveMacroWaiting(this._reservedMoveMacroTurn),this._reservedMoveMacroTurn=void 0),0===this._pages.length){const{newPageGenerated:t}=this._hideMessageWindow();t||this._dispatchWindowClosedTimeRequests()}else this._shouldSetNextPage=!0;this._inlineUserVarViewer&&(this._inlineUserVarViewer.isVisible=!1)}_hideMessageWindow(){const t=this._player.isReadyToUseItem()?this._player.useItem():0,e=this.getObjectAttributeById(t,V.ATR_STRING);return this.clearFaces(),0===e?(this._messageWindow.isVisible()&&(this._player.setDelayFrame(),this._messageWindow.hide(),this._keyStore.allClear(),this._mouseStore.clear()),this._player.clearMessageWaiting(),{newPageGenerated:!1}):(this.generatePageAndReserveExecution(this.getMessageById(e),!1,!1,t,v.OBJECT,this._player.getPosition().getPartsCoord()),{newPageGenerated:0!==this._pages.length})}getPlayerPositon(){return this._player.getPosition()}loadMapPartsObjectID(t){return(t|=0)<0||t>=this._wwaData.objPartsMax?0:t}loadMapPartsID(t){return(t|=0)<0||t>=this._wwaData.mapPartsMax?0:t}replaceParts(t,e,s=v.OBJECT,i=!1){var a,r,n,o,h,c,_,l,u=this._camera.getPosition().getPartsCoord(),d=i?Math.max(0,u.x):0,p=i?Math.min(this._wwaData.mapWidth-1,u.x+V.H_PARTS_NUM_IN_WINDOW-1):this._wwaData.mapWidth-1,m=i?Math.max(0,u.y):0,E=i?Math.min(this._wwaData.mapWidth-1,u.y+V.V_PARTS_NUM_IN_WINDOW)-1:this._wwaData.mapWidth-1;if(i=0!==d||p!==this._wwaData.mapWidth-1||0!==m||E!==this._wwaData.mapWidth-1,s===v.OBJECT)if(t=this.loadMapPartsObjectID(t),e=this.loadMapPartsObjectID(e),o=this._mapObjectIDTable[t].concat(),(_=this._mapObjectIDTable[t]).length=0,l=this._mapObjectIDTable[e],r=o.length,i)for(n=0;n<r;n++)h=(a=o[n])&$.BITMASK,c=a>>>$.BITSHIFT&$.BITMASK,d<=h&&h<=p&&m<=c&&c<=E?(this._wwaData.mapObject[c][h]=e,l.push(a)):_.push(a);else{for(n=0;n<r;n++)h=(a=o[n])&$.BITMASK,c=a>>>$.BITSHIFT&$.BITMASK,this._wwaData.mapObject[c][h]=e;Array.prototype.push.apply(l,o)}else if(t=this.loadMapPartsID(t),e=this.loadMapPartsID(e),o=this._mapIDTable[t].concat(),(_=this._mapIDTable[t]).length=0,l=this._mapIDTable[e],r=o.length,i)for(n=0;n<r;n++)h=(a=o[n])&$.BITMASK,c=a>>>$.BITSHIFT&$.BITMASK,d<=h&&h<=p&&m<=c&&c<=E?(this._wwaData.map[c][h]=e,l.push(a)):_.push(a);else{for(n=0;n<r;n++)h=(a=o[n])&$.BITMASK,c=a>>>$.BITSHIFT&$.BITMASK,this._wwaData.map[c][h]=e;Array.prototype.push.apply(l,o)}}getYesNoImgCoord(){return new c(this._wwaData.yesnoImgPosX,this._wwaData.yesnoImgPosY)}setYesNoImgCoord(t){return this._wwaData.yesnoImgPosX=t.x,this._wwaData.yesnoImgPosY=t.y,t}getPlayerImgCoord(){return new c(this._wwaData.playerImgPosX,this._wwaData.playerImgPosY)}setPlayerImgCoord(t){return this._wwaData.playerImgPosX=t.x,this._wwaData.playerImgPosY=t.y,t}setPlayerEnergyMax(t){return this._player.setEnergyMax(this.toValidStatusValue(t))}getMapPartsNum(){return this._wwaData.mapPartsMax}getObjectPartsNum(){return this._wwaData.objPartsMax}setMoveMacroWaitingToPlayer(t){this._reservedMoveMacroTurn=t}disableSave(t){return this._wwaData.disableSaveFlag=t,this._wwaSave.quickSaveButtonUpdate(this._wwaData),t}isOldMap(){return this._wwaData.isOldMap}setOldMap(t){return this._wwaData.isOldMap=t}setObjectNotCollapseOnPartsOnPlayer(t){return this._wwaData.objectNoCollapseDefaultFlag=t}setGameOverPosition(t){if(t.x<0||t.x>=this.getMapWidth()||t.y<0||t.y>=this.getMapWidth())throw new Error("マップの範囲外が指定されています!");return this._wwaData.gameoverX=t.x,this._wwaData.gameoverY=t.y,t}getGemeOverPosition(){return new c(this._wwaData.gameoverX,this._wwaData.gameoverY)}toValidStatusValue(t){return this.isNotNumberTypeOrNaN(t)||t<0?0:Math.floor(t)}setPlayerStatus(t,e,s){if(t===x.ENERGY){if(this._player.setEnergy(this.toValidStatusValue(e)),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:s}))return this.gameover(),{isGameOver:!0}}else if(t===x.STRENGTH)this._player.setStrength(this.toValidStatusValue(e));else if(t===x.DEFENCE)this._player.setDefence(this.toValidStatusValue(e));else if(t===x.GOLD)this._player.setGold(this.toValidStatusValue(e));else{if(t!==x.MOVES)throw new Error("未定義のステータスタイプです");this._player.setMoveCount(this.toValidStatusValue(e))}return{}}setDelPlayer(t){return this._wwaData.delPlayerFlag=t}setPlayerGetItem(t,e){try{this._player.addItem(e,t,!0)}catch(t){}}setStatusIconCoord(t,e){const s=e.x*V.CHIP_SIZE,i=e.y*V.CHIP_SIZE,a=t=>{Et(`${t}>.status-icon`).style.backgroundPosition=`-${s}px -${i}px`};switch(t){case L.ENERGY:this._wwaData.imgStatusEnergyX=e.x,this._wwaData.imgStatusEnergyY=e.y,a("#disp-energy");break;case L.STRENGTH:this._wwaData.imgStatusStrengthX=e.x,this._wwaData.imgStatusStrengthY=e.y,a("#disp-strength");break;case L.DEFENCE:this._wwaData.imgStatusDefenceX=e.x,this._wwaData.imgStatusDefenceY=e.y,a("#disp-defence");break;case L.GOLD:this._wwaData.imgStatusGoldX=e.x,this._wwaData.imgStatusGoldY=e.y,a("#disp-gold");break;default:throw new Error("種別が不正です。")}return e.clone()}setWideCellCoord(t){this._wwaData.imgWideCellX=t.x,this._wwaData.imgWideCellY=t.y;const e=t.x*V.CHIP_SIZE,s=t.y*V.CHIP_SIZE;return Array.prototype.forEach.call(gt("div.wide-cell-row"),(t=>{t.style.backgroundPosition="-"+e+"px -"+s+"px"})),t.clone()}setFrameCoord(t){return this._wwaData.imgFrameX=t.x,this._wwaData.imgFrameY=t.y,this._cgManager.setFrameImage(t),t.clone()}setBattleEffectCoord(t){return this._battleEffectCoord=t.clone()}canInput(){return!this._temporaryInputDisable}setEffect(t,e){this._wwaData.effectWaits=t,this._wwaData.effectCoords=e,this.updateEffect()}stopEffect(){this._wwaData.effectCoords=[],this.updateEffect()}updateEffect(){this._cgManager.updateEffects(this._wwaData.effectCoords)}updatePicturesCache(){this._cgManager.updatePicturesCache(this._isMainAnimation())}setImgClick(t){if(this._wwaData.imgClickX=t.x,this._wwaData.imgClickY=t.y,t.equals(new c(0,0)))Array.prototype.forEach.call(gt(".item-cell>.item-click-border"),(t=>{t.style.backgroundImage="url('"+V.ITEM_BORDER_IMG_DATA_URL+"')",t.style.backgroundPosition="0 0"}));else{var e=this._wwaData.mapCGName.replace("(","\\(").replace(")","\\)");Array.prototype.forEach.call(gt(".item-cell>.item-click-border"),(s=>{s.style.backgroundImage="url('"+e+"')",s.style.backgroundPosition="-"+t.x*V.CHIP_SIZE+"px -"+t.y*V.CHIP_SIZE+"px"}))}}addFace(t){this._faces.push(t),this._messageWindow.setPositionByPlayerPosition(0!==this._faces.length,this._scoreWindow.isVisible(),!1,this._player.getPosition(),this._camera.getPosition())}clearFaces(){this._faces=[]}updateItemEffectEnabled(t){this._wwaData.isItemEffectEnabled=t}setOldMove(t){this._wwaData.isOldMove=t}setGameOverPolicy(t){switch(t){case 0:return void(this._wwaData.gameOverPolicy="default");case 1:return void(this._wwaData.gameOverPolicy="never");case 2:return void(this._wwaData.gameOverPolicy="except-macro");default:return}}setBgmDelay(t){this._wwaData.bgmDelayDurationMs=t}setPictureRegistry(t,e,s,i){var a,r,n,o;const h=s===v.OBJECT?this._wwaData.objectAttribute[e]:s===v.MAP?this._wwaData.mapAttribute[e]:null;if(null===h)throw new Error("対応していないパーツ番号です。");const c=this.getMessageById(h[V.ATR_STRING]);if(!c)throw s===v.OBJECT?new Error(`物体パーツ ${e} 番に対応したテキストが見つかりませんでした。`):new Error(`背景パーツ ${e} 番に対応したテキストが見つかりませんでした。`);const _=this._returnEvalString("("+c+")"),l=this._cgManager.picture.registerPictureFromRawRegistry({layerNumber:t,imgPosX:(null!==(a=h[V.ATR_X])&&void 0!==a?a:0)/V.CHIP_SIZE,imgPosX2:(null!==(r=h[V.ATR_X2])&&void 0!==r?r:0)/V.CHIP_SIZE,imgPosY:(null!==(n=h[V.ATR_Y])&&void 0!==n?n:0)/V.CHIP_SIZE,imgPosY2:(null!==(o=h[V.ATR_Y2])&&void 0!==o?o:0)/V.CHIP_SIZE,triggerPartsX:i.x,triggerPartsY:i.y,properties:_},e,s);this._wwaData.pictureRegistry=l,this.updatePicturesCache()}setPictureRegistryFromRawText(t,e){const s=this._cgManager.picture.registerPictureFromRawText(t,e);this._wwaData.pictureRegistry=s,this.updatePicturesCache()}setPictureRegistryFromObject(t,e){const s=this._cgManager.picture.registerPictureFromObject(t,e);this._wwaData.pictureRegistry=s,this.updatePicturesCache()}deletePictureRegistry(t){const e=this._cgManager.picture.deletePicture(t);this._wwaData.pictureRegistry=e}initCSSRule(){this._styleElm=dt(V.WWA_STYLE_TAG_ID),this._sheet=this._styleElm.sheet,this.updateCSSRule()}updateCSSRule(){if(void 0===this._stylePos)this._stylePos=new Array(2);else if(void 0!==this._sheet.addRule)for(var t=0;t<this._stylePos.length;t++)this._sheet.removeRule(this._stylePos[this._styleElm[t]]);else for(t=0;t<this._stylePos.length;t++)this._sheet.deleteRule(this._stylePos[this._styleElm[t]]);const e="div.wwa-message-window, div#wwa-text-message-window, div#wwa-battle-estimate, div#wwa-password-window",s=this._isClassicModeEnable?1:.9,i=`\nbackground-color: rgba(${this._wwaData.frameColorR}, ${this._wwaData.frameColorG}, ${this._wwaData.frameColorB}, ${s});\nborder-color: rgba(${this._wwaData.frameOutColorR}, ${this._wwaData.frameOutColorG}, ${this._wwaData.frameOutColorB}, 1);\ncolor: rgba(${this._wwaData.fontColorR}, ${this._wwaData.fontColorG}, ${this._wwaData.fontColorB}, 1);\nwhite-space: pre-wrap;\n`,a="div#wwa-sidebar",r=`\ncolor: rgba(${this._wwaData.statusColorR}, ${this._wwaData.statusColorG}, ${this._wwaData.statusColorB},1);\nfont-weight: bold;\n`;void 0!==this._sheet.addRule?(this._stylePos[J.MESSAGE_WINDOW]=this._sheet.addRule(e,i),this._stylePos[J.SIDEBAR]=this._sheet.addRule(a,r)):(this._stylePos[J.MESSAGE_WINDOW]=this._sheet.insertRule(`${e} { ${i} }`,0),this._stylePos[J.SIDEBAR]=this._sheet.insertRule(`${a} { ${r} }`,1))}changeStyleRule(t,e,s,i){t===X.COLOR_FRAME?(this._wwaData.frameColorR=e,this._wwaData.frameColorG=s,this._wwaData.frameColorB=i):t===X.COLOR_FRAMEOUT?(this._wwaData.frameOutColorR=e,this._wwaData.frameOutColorG=s,this._wwaData.frameOutColorB=i):t===X.COLOR_STR?(this._wwaData.fontColorR=e,this._wwaData.fontColorG=s,this._wwaData.fontColorB=i):t===X.COLOR_STATUS_STR&&(this._wwaData.statusColorR=e,this._wwaData.statusColorG=s,this._wwaData.statusColorB=i),this.updateCSSRule()}showMonsterWindow(){this._monsterWindow.show()}isClassicMode(){return this._isClassicModeEnable}isConsoleOutputMode(){return this._useConsole}forcedJumpGate(t,e){this._player.isWaitingMessage()?this._windowCloseWaitingJumpGateRequest={x:t,y:e}:(this._windowCloseWaitingJumpGateRequest=void 0,this._player.jumpTo(new _(this,t,e,0,0)))}setUserVar(t,e,s){const i=(t,e)=>{if("number"==typeof t){if("number"!=typeof e)throw new TypeError("数字index変数への数値以外の代入は今のところできません。あらかじめご了承ください。");this._userVar.numbered[t]="number"==typeof e?this.toAssignableValue(e):e}else this._userVar.named.set(t,e)},a=(t=>"number"==typeof t?this._userVar.numbered[t]:this._userVar.named.get(t))(t);if("number"==typeof e)switch(s){case"+=":if("number"==typeof a)i(t,a+e);else{if("string"!=typeof a)throw new TypeError("boolean に number は足せません");i(t,String(a)+e)}break;case"-=":if("number"!=typeof a)throw new TypeError("string/boolean から number は引けません");i(t,a-e);break;case"*=":if("number"!=typeof a)throw new TypeError("string/boolean に number はかけられません");i(t,a*e);break;case"/=":if("number"!=typeof a)throw new TypeError("string/boolean は number で割れません");i(t,a/e);break;default:i(t,e)}else if("string"==typeof e)switch(s){case"+=":i(t,a+e);break;case"=":i(t,e);break;default:throw new TypeError("文字列を -=, *=, /= で複合代入することはできません")}else switch(s){case"+=":if("string"!=typeof a)throw new TypeError("number/boolean に boolean を足せません");i(t,a+e);break;case"=":i(t,e);break;default:throw new TypeError("booleanを -=, *=, /= で複合代入することはできません")}this._messageWindow.update()}toAssignableValue(t){const e=t>0?Math.floor(t):Math.ceil(t),s=Math.max(Math.min(e,V.USER_VAR_NUM_MAX_VALUE),V.USET_VAR_NUM_MIN_VALUE);return this.isNotNumberTypeOrNaN(s)?0:s}isValidUserVarIndex(t){return"number"==typeof t&&t>=0&&t<V.USER_VAR_NUM&&(0|t)===t}isNotNumberTypeOrNaN(t){return"number"!=typeof t||t!=t}getUserVar(t){return this._userVar.numbered[t]}getUserNameVar(t){return this._userVar.named.get(t.toString())}getAllUserNameVar(){return Array.from(this._userVar.named)}recUserPosition(t,e){var s=this._player.getPosition().getPartsCoord();this.setUserVar(t,s.x),this.setUserVar(e,s.y)}jumpRecUserPosition(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.forcedJumpGate(s,i)}jumpSpecifiedXPos(t){const e=this._player.getPosition().getPartsCoord();this.forcedJumpGate(t,e.y)}jumpSpecifiedYPos(t){const e=this._player.getPosition().getPartsCoord();this.forcedJumpGate(e.x,t)}outputUserVar(t){console.log("Var["+t+"] = "+this._userVar.numbered[t])}setUserVarHP(t){this.setUserVar(t,this._player.getStatus().energy)}setUserVarHPMAX(t){this.setUserVar(t,this._player.getEnergyMax())}setUserVarAT(t,e){switch(e){case"bare":return void this.setUserVar(t,this._player.getStatusWithoutEquipments().strength);case"equipment":return void this.setUserVar(t,this._player.getStatusOfEquipments().strength);default:return void this.setUserVar(t,this._player.getStatus().strength)}}setUserVarDF(t,e){switch(e){case"bare":return void this.setUserVar(t,this._player.getStatusWithoutEquipments().defence);case"equipment":return void this.setUserVar(t,this._player.getStatusOfEquipments().defence);default:return void this.setUserVar(t,this._player.getStatus().defence)}}setUserVarMONEY(t){this.setUserVar(t,this._player.getStatus().gold)}setHPUserVar(t,e){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const s=this._userVar.numbered[t];if(St(s,`v[${t}]`))return this._player.setEnergy(this.toValidStatusValue(s)),this._player.updateStatusValueBox(),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:e})?(this.gameover(),{isGameOver:!0}):{}}setHPMAXUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const e=this._userVar.numbered[t];St(e,`v[${t}]`)&&(this._player.setEnergyMax(this.toValidStatusValue(e)),this._player.updateStatusValueBox())}setATUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const e=this._userVar.numbered[t];St(e,`v[${t}]`)&&(this._player.setStrength(this.toValidStatusValue(e)),this._player.updateStatusValueBox())}setDFUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const e=this._userVar.numbered[t];St(e,`v[${t}]`)&&(this._player.setDefence(this.toValidStatusValue(e)),this._player.updateStatusValueBox())}setMONEYUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");const e=this._userVar.numbered[t];St(e,`v[${t}]`)&&(this._player.setGold(this.toValidStatusValue(e)),this._player.updateStatusValueBox())}setUserVarStep(t){this.setUserVar(t,this._player.getMoveCount())}setUserVarVal(t,e){this.setUserVar(t,e)}setUserValOtherUserVal(t,e){this.setUserVar(t,this._userVar.numbered[e])}setUserValAdd(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];"boolean"!=typeof s&&"boolean"!=typeof i&&this.setUserVar(t,s+i)}setUserValSub(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.setUserVar(t,s-i)}setUserValMul(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.setUserVar(t,s*i)}setUserValDiv(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.setUserVar(t,0===i?0:s/i)}setUserValMod(t,e){const s=this._userVar.numbered[t],i=this._userVar.numbered[e];St(s,`v[${t}]`)&&St(i,`v[${e}]`)&&this.setUserVar(t,0===i?0:s%i)}setUserValRandNum(t,e,s){this.setUserVar(t,Math.floor(Math.random()*this.toAssignableValue(e))+s)}_generateShowStrString(t,e){return t.map((t=>{const s=Number(t);if(!isNaN(s))return()=>1===e.version?this._userVar.numbered[s]:s;return null!==ce(t).match(zt)?()=>le(t,this.generateTokenValues(e.triggerParts)):t.replace(/\\n/g,"\n")}))}speedChangeJudge(t){this._wwaData.permitChangeGameSpeed=t}execSetMacro(t="",e){const s=function(t,e){const s=ce(t),i=s.match(Zt);if(null!==i){const t=_e(i[2],e),s=_e(i[4],e);return he(oe(i[3],t,s),i[1])}const a=s.match(qt);if(null!==a){const t=_e(a[1],e),s=_e(a[3],e);return he(oe(a[2],t,s),a[1])}throw new Error("setMacroのフォーマットを満たしていません: "+t)}(t,this.generateTokenValues(e.triggerParts)),{assignee:i,rawValue:a}=s;switch(i){case"energy":if(this._player.setEnergy(this.toValidStatusValue(a)),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:!0}))return this._player.updateStatusValueBox(),this.gameover(),{isGameOver:!0};break;case"energyMax":this._player.setEnergyMax(this.toValidStatusValue(a));break;case"strength":this._player.setStrength(this.toValidStatusValue(a));break;case"defence":this._player.setDefence(this.toValidStatusValue(a));break;case"gold":this._player.setGold(this.toValidStatusValue(a));break;case"moveCount":this._player.setMoveCount(this.toValidStatusValue(a));break;case"variable":if(isNaN(s.index)||!this.isValidUserVarIndex(s.index))throw new Error("ユーザ変数の添字が範囲外です。");this.setUserVar(s.index,this.toAssignableValue(a));break;case"map":this.appearPartsEval(e.triggerParts.position,`${s.x}`,`${s.y}`,s.rawValue,v.MAP);break;case"mapObject":this.appearPartsEval(e.triggerParts.position,`${s.x}`,`${s.y}`,s.rawValue,v.OBJECT);break;case"item":this.setPlayerGetItem(s.boxIndex1to12,a);break;case"playerDirection":this._player.setDir(a)}return this._player.updateStatusValueBox(),{}}generateTokenValues(t){var e,s;return{totalStatus:this._player.getStatus(),bareStatus:this._player.getStatusWithoutEquipments(),itemStatus:this._player.getStatusOfEquipments(),energyMax:this._player.getEnergyMax(),moveCount:this._player.getMoveCount(),playTime:null!==(s=null===(e=this._playTimeCalculator)||void 0===e?void 0:e.calculateTimeMs())&&void 0!==s?s:0,userVars:this._userVar.numbered,playerCoord:this._player.getPosition().getPartsCoord(),playerDirection:this._player.getDir(),itemBox:this._player.getCopyOfItemBox(),partsId:t.id,partsType:t.type,partsPosition:t.position,map:this._wwaData.map,mapObject:this._wwaData.mapObject}}userVarUserIf(t,e){if(void 0===e[5])throw new Error("$if の引数不足 str="+e);const s=parseInt(e[0],10),i=parseInt(e[2],10);if(!this.isValidUserVarIndex(s)||!this.isValidUserVarIndex(i))throw new Error("判定対象のユーザ変数の添字が範囲外です!");const a=this._userVar.numbered[s],r=e[1],n=this._userVar.numbered[i];if(!St(a,`v[${s}]`)||!St(n,`v[${i}]`))return;const o=t=>parseInt(t,10)?v.MAP:v.OBJECT;if(this.compareUserVar(a,r,n)){const s=parseInt(e[3],10),i=e[4],a=e[5],r=o(e[6]);return void this.appearPartsEval(t,i,a,s,r)}if(void 0===e[9])return;const h=parseInt(e[7],10),c=e[8],_=e[9],l=o(e[10]);this.appearPartsEval(t,c,_,h,l)}compareUserVar(t,e,s){switch(e){case"==":return t===s;case"!=":return t!==s;case">=":return t>=s;case">":return t>s;case"<=":return t<=s;case"<":return t<s;default:throw new Error(`未定義の演算子です: ${e}`)}}setPlayerSpeedIndex(t){if(t<V.MIN_SPEED_INDEX||V.MAX_SPEED_INDEX<t)throw new Error("#set_speed の引数が異常です:"+t);this._player.isMoving()?this._playerAndObjectsStopWaitingGameSpeedChangeRequest={speedIndex:t}:(this._wwaData.gameSpeedIndex=this._player.setSpeedIndex(t),this._playerAndObjectsStopWaitingGameSpeedChangeRequest=void 0)}setUserVarPlayTime(t){var e,s;this.setUserVar(t,null!==(s=null===(e=this._playTimeCalculator)||void 0===e?void 0:e.calculateTimeMs())&&void 0!==s?s:0)}hideStatus(t,e){if(t<0||t>W.length)throw new Error("隠すパラメータは0から3の間で指定してください。");this._changeStatusVisibility(W[t],!e),this._player.updateStatusValueBox()}varMap(t,e,s,i,a){if(!this.isValidUserVarIndex(i))throw new Error("対象のユーザ変数の添字が範囲外です");const r=this._userVar.numbered[i];if("number"!=typeof r)throw new Error("数値でないパーツ番号は指定できません");if(r<0)throw new Error("負のパーツ番号は指定できません");if(a===v.OBJECT&&r>=this.getObjectPartsNum())throw new Error("物体パーツ番号の最大値を超えるパーツ番号が指定されました");if(a===v.MAP&&r>=this.getMapPartsNum())throw new Error("背景パーツ番号の最大値を超えるパーツ番号が指定されました");this.appearPartsEval(t,e,s,r,a)}setItemboxBackgroundPosition(t){this._wwaData.imgItemboxX=t.x,this._wwaData.imgItemboxY=t.y,Array.prototype.forEach.call(gt("div.item-cell"),(e=>{e.style.backgroundPosition=`-${t.x*V.CHIP_SIZE}px -${t.y*V.CHIP_SIZE}px`}))}_getVirtualPadButton(t){if(!ht.includes(t))throw new ReferenceError(`WWAの仮想パッド ${t} は存在しません。`);return this._virtualPadButtonElements[t]}_setVirtualPadTouch(t){this._getVirtualPadButton(t).classList.add("wwa-virtualpad__button--pressed")}_setVirtualPadLeave(t){this._getVirtualPadButton(t).classList.remove("wwa-virtualpad__button--pressed")}_actionGamePadButtonItemMacro(){if(!this._wwaData.gamePadButtonItemTable)return!1;var t,e,s,i;for(t=this._wwaData.gamePadButtonItemTable.length,e=0;e<t;e++)if(s=this._wwaData.gamePadButtonItemTable[e]){switch(i=!1,e){case tt.BUTTON_CROSS_KEY_LEFT:this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_LEFT)&&(i=!0);break;case tt.BUTTON_CROSS_KEY_RIGHT:this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_RIGHT)&&(i=!0);break;case tt.BUTTON_CROSS_KEY_UP:this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_UP)&&(i=!0);break;case tt.BUTTON_CROSS_KEY_DOWN:this._gamePadStore.crossPressed(tt.BUTTON_CROSS_KEY_DOWN)&&(i=!0)}if(this._gamePadStore.buttonTrigger(e)&&(i=!0),i&&this.onselectitem(s))return!0}return!1}setGamePadButtonItemTable(t,e){var s,i;if(!this._wwaData.gamePadButtonItemTable)for(i in this._wwaData.gamePadButtonItemTable=[],tt)s=i,this._wwaData.gamePadButtonItemTable[s]=0;this._wwaData.gamePadButtonItemTable.length>t&&(this._wwaData.gamePadButtonItemTable[t]=e)}_checkSaveDataCompatibility(t,e,s){return void 0!==t&&t!==this._wwaData.worldName?_s.UNMATCHED_WORLD_NAME:s&&s!==ps(this._wwaData.worldName,this._wwaData.worldPassNumber)?_s.UNMATCHED_WORLD_PASS_NUMBER:this._isDisallowLoadOldSave&&e!==this.checkOriginalMapString?_s.DISALLOW_OLD_REVISION_WORLD_SAVE_DATA:null}isVisibleStatus(t){switch(t){case"energy":return this._wwaData.isVisibleStatusEnergy;case"strength":return this._wwaData.isVisibleStatusStrength;case"defence":return this._wwaData.isVisibleStatusDefence;case"gold":return this._wwaData.isVisibleStatusGold;default:throw new Error("存在しないステータスが与えられました")}}_changeStatusVisibility(t,e){switch(t){case"energy":return void(this._wwaData.isVisibleStatusEnergy=e);case"strength":return void(this._wwaData.isVisibleStatusStrength=e);case"defence":return void(this._wwaData.isVisibleStatusDefence=e);case"gold":return void(this._wwaData.isVisibleStatusGold=e);default:throw new Error("存在しないステータスが与えられました")}}shouldApplyGameOver({isCalledByMacro:t}){return t?"default"===this._wwaData.gameOverPolicy:"default"===this._wwaData.gameOverPolicy||"except-macro"===this._wwaData.gameOverPolicy}getEnemyStatus(){return this._monster?this._monster.status:-1}setEnemyStatus(t){if(!this._monster)throw new Error("敵が存在しません");this._monster.setStatus(t)}getGameStatus(){var t,e;return{totalStatus:this._player.getStatus(),bareStatus:this._player.getStatusWithoutEquipments(),itemStatus:this._player.getStatusOfEquipments(),energyMax:this._player.getEnergyMax(),moveCount:this._player.getMoveCount(),playTime:null!==(e=null===(t=this._playTimeCalculator)||void 0===t?void 0:t.calculateTimeMs())&&void 0!==e?e:0,userVars:this._userVar.numbered,playerCoord:this._player.getPosition().getPartsCoord(),playerDirection:this._player.getDir(),itemBox:this._player.getCopyOfItemBox()}}_debugEvalString(){if(this._player.isControllable())try{const t=this._debugConsoleElement.querySelector(".console-text-area");if(!(t instanceof HTMLTextAreaElement))throw new Error("要素 #wwa-debug-console > .console-text-area が textarea 要素でありません");this._execEvalString(t.value)}catch(t){console.error(t),this.generatePageAndReserveExecution("解析中にエラーが発生しました :\n"+t.message,!1,!0)}}_execEvalString(t){try{const e=this.convertWwaNodes(t);this.evalCalcWwaNodeGenerator.evalWwaNodes(e)}catch(t){console.error(t),this.generatePageAndReserveExecution("解析中にエラーが発生しました :\n"+t.message,!1,!0)}}_returnEvalString(t){try{const e=ca(oa("("+t+")"));return this.evalCalcWwaNodeGenerator.evalWwaNode(e)}catch(t){console.error(t),this.generatePageAndReserveExecution("解析中にエラーが発生しました :\n"+t.message,!1,!0)}}movePlayer(t){this._player.controll(t)}isPlayerWaitingMessage(){return this._player.isWaitingMessage()}_loadSystemMessage(t){if(this._wwaData.customSystemMessages[t])return this._wwaData.customSystemMessages[t];const e=a[t];if(e.mapdataParams)switch(e.mapdataParams.messageArea){case"message":{const t=this._wwaData.message[e.mapdataParams.index];return""===t?e.defaultText:t}case"systemMessage":{const t=this._wwaData.systemMessage[e.mapdataParams.index];return""===t?e.defaultText:t}default:throw new Error("システムエラー: システムメッセージの設定がおかしいようです")}return e.defaultText}resolveSystemMessage(t){const e=this._loadSystemMessage(t);switch(t){case i.ITEM_SELECT_TUTORIAL:return e.replaceAll("%HOW_TO_USE_ITEM%",(()=>{switch(this.userDevice.device){case S.PC:return"右のボックスを選択する";case S.VR:return"右のボックスをクリックする";case S.SP:return"右のボックスをタップする";case S.GAME:switch(this.userDevice.os){case y.NINTENDO:return"Xボタンを押すか、右のボックスをタップする";case y.PLAY_STATION:return"△ボタンを押す";case y.XBOX:return"Yボタンを押す";default:return"右のボックスを選択する"}default:return"右のボックスを選択する"}})());case i.GAME_SPEED_CHANGED:{const t=this._player.getSpeedIndex();return e.replaceAll("%GAME_SPEED_NAME%",k[t]).replaceAll("%HIGH_SPEED_MESSAGE%",this.isBattleSpeedIndexForQuickBattle(t)?"戦闘も速くなります。\n":"").replaceAll("%MAX_SPEED_INDEX%",String(V.MAX_SPEED_INDEX+1)).replaceAll("%GAME_SPEED_INDEX%",String(t+1)).replaceAll("%SPEED_UP_BUTTON%",this.userDevice.os===y.NINTENDO?"+ボタン":"Pキー").replaceAll("%SPEED_DOWN_BUTTON%",this.userDevice.os===y.NINTENDO?"-ボタン":"Iキー")}default:return e}}overwriteSystemMessage(t,e){this._wwaData.customSystemMessages[t]=e}}var ja=!1;function Xa(){if(navigator.userAgent.match(/(?:msie|trident)/i)||navigator.userAgent.match(/edge/i))return void alert("このゲームをプレイするには、Google Chrome や Mozilla Firefox などの最新のブラウザでこのページを開いてください。\nご利用の環境のサポートは、既に終了しています。");Array.prototype.forEach.call(gt("a.wwa-copyright"),(t=>{t.addEventListener("click",(()=>{ja=!0}))})),window.addEventListener("beforeunload",(t=>{var e="このページを離れますか?";if(ja)return ja=!1,t.returnValue=e,e}));var t=dt("wwa-wrapper").getAttribute("data-wwa-title-img");const e=dt("wwa-wrapper").getAttribute("data-wwa-virtualpad-enable"),s=null!==e&&null!==e.match(/^true$/i);$e(dt("wwa-wrapper"),t,s);var i=dt("wwa-wrapper").getAttribute("data-wwa-mapdata"),a=dt("wwa-wrapper").getAttribute("data-wwa-audio-dir"),r=dt("wwa-wrapper").getAttribute("data-wwa-var-dump-elm"),n=null,o="true"===dt("wwa-wrapper").getAttribute("data-wwa-display-user-vars"),h=dt("wwa-wrapper").getAttribute("data-wwa-user-var-names-file");dt("wwa-wrapper").hasAttribute("data-wwa-var-dump-elm")&&o&&(n=function(t){const e=mt(t);return e instanceof HTMLElement?(e.classList.add(Ya),e.appendChild(Na({kind:"named"})),e.appendChild(Na({kind:"numbered"})),e):null}(r));var c=!0;dt("wwa-wrapper").getAttribute("data-wwa-urlgate-enable").match(/^false$/i)&&(c=!1);var _=dt("wwa-wrapper").getAttribute("data-wwa-classic-mode-enable"),l=!1;null!==_&&_.match(/^true$/i)&&(l=!0);var u=!0,d=dt("wwa-wrapper").getAttribute("data-wwa-item-effect-enable");null!==d&&d.match(/^false$/i)&&(u=!1);let p=!1;const m=dt("wwa-wrapper").getAttribute("data-wwa-use-go-to-wwa");null!==m&&m.match(/^true$/i)&&(p=!0);const E=dt("wwa-wrapper").getAttribute("data-wwa-virtualpad-viewport-fit-enable");Je()&&null!==E&&E.match(/^true$/i)&&(!function(){const t=document.getElementsByTagName("head")[0];let e=document.createElement("meta");e.setAttribute("name","viewport"),t.appendChild(e),ut()}(),window.addEventListener("resize",ut));const g=dt("wwa-wrapper").getAttribute("data-wwa-virtualpad-controller-elm"),w=s&&g?Et(g):null,f=dt("wwa-wrapper").getAttribute("data-wwa-picture-image-names-file"),v=(()=>{const t=dt("wwa-wrapper").getAttribute("data-wwa-disallow-load-old-save");return!(null===t||!t.match(/^true$/i))})();Ga=new Ka(i,c,t,l,u,p,a,v,n,h,o,s,w,f)}"complete"===document.readyState?setTimeout(Xa):window.addEventListener("load",(function(){setTimeout(Xa)}))}()}();