@wwawing/engine 3.12.20 → 3.12.22
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 +1 -1
- package/package.json +10 -10
package/lib/wwa.js
CHANGED
|
@@ -18,4 +18,4 @@ a.mode.CTRGladman=function(){var t=a.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(){var t=a,e=t.lib,s=e.WordArray,i=e.Hasher,r=t.algo,o=s.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]),n=s.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]),_=s.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]),h=s.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]),c=s.create([0,1518500249,1859775393,2400959708,2840853838]),l=s.create([1352829926,1548603684,1836072691,2053994217,0]),u=r.RIPEMD160=i.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var s=0;s<16;s++){var a=e+s,i=t[a];t[a]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,u,A,S,T,I,v,y,O,D,C,f=this._hash.words,N=c.words,P=l.words,M=o.words,R=n.words,L=_.words,b=h.words;for(I=r=f[0],v=u=f[1],y=A=f[2],O=S=f[3],D=T=f[4],s=0;s<80;s+=1)C=r+t[e+M[s]]|0,C+=s<16?d(u,A,S)+N[0]:s<32?E(u,A,S)+N[1]:s<48?m(u,A,S)+N[2]:s<64?w(u,A,S)+N[3]:p(u,A,S)+N[4],C=(C=g(C|=0,L[s]))+T|0,r=T,T=S,S=g(A,10),A=u,u=C,C=I+t[e+R[s]]|0,C+=s<16?p(v,y,O)+P[0]:s<32?w(v,y,O)+P[1]:s<48?m(v,y,O)+P[2]:s<64?E(v,y,O)+P[3]:d(v,y,O)+P[4],C=(C=g(C|=0,b[s]))+D|0,I=D,D=O,O=g(y,10),y=v,v=C;C=f[1]+A+O|0,f[1]=f[2]+S+D|0,f[2]=f[3]+T+I|0,f[3]=f[4]+r+v|0,f[4]=f[0]+u+y|0,f[0]=C},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,a=8*t.sigBytes;e[a>>>5]|=128<<24-a%32,e[14+(a+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var n=r[o];r[o]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}return i},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function d(t,e,s){return t^e^s}function E(t,e,s){return t&e|~t&s}function m(t,e,s){return(t|~e)^s}function w(t,e,s){return t&s|e&~s}function p(t,e,s){return t^(e|~s)}function g(t,e){return t<<e|t>>>32-e}t.RIPEMD160=i._createHelper(u),t.HmacRIPEMD160=i._createHmacHelper(u)}(Math),a.RIPEMD160)},648:function(t,e,s){var a,i,r,o,n,_,h,c;t.exports=(c=s(518),i=(a=c).lib,r=i.WordArray,o=i.Hasher,n=a.algo,_=[],h=n.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var s=this._hash.words,a=s[0],i=s[1],r=s[2],o=s[3],n=s[4],h=0;h<80;h++){if(h<16)_[h]=0|t[e+h];else{var c=_[h-3]^_[h-8]^_[h-14]^_[h-16];_[h]=c<<1|c>>>31}var l=(a<<5|a>>>27)+n+_[h];l+=h<20?1518500249+(i&r|~i&o):h<40?1859775393+(i^r^o):h<60?(i&r|i&o|r&o)-1894007588:(i^r^o)-899497514,n=o,o=r,r=i<<30|i>>>2,i=a,a=l}s[0]=s[0]+a|0,s[1]=s[1]+i|0,s[2]=s[2]+r|0,s[3]=s[3]+o|0,s[4]=s[4]+n|0},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,a=8*t.sigBytes;return e[a>>>5]|=128<<24-a%32,e[14+(a+64>>>9<<4)]=Math.floor(s/4294967296),e[15+(a+64>>>9<<4)]=s,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}}),a.SHA1=o._createHelper(h),a.HmacSHA1=o._createHmacHelper(h),c.SHA1)},623:function(t,e,s){var a,i,r,o,n,_;t.exports=(_=s(518),s(110),i=(a=_).lib.WordArray,r=a.algo,o=r.SHA256,n=r.SHA224=o.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=4,t}}),a.SHA224=o._createHelper(n),a.HmacSHA224=o._createHmacHelper(n),_.SHA224)},110:function(t,e,s){var a;t.exports=(a=s(518),function(t){var e=a,s=e.lib,i=s.WordArray,r=s.Hasher,o=e.algo,n=[],_=[];!function(){function e(e){for(var s=t.sqrt(e),a=2;a<=s;a++)if(!(e%a))return!1;return!0}function s(t){return 4294967296*(t-(0|t))|0}for(var a=2,i=0;i<64;)e(a)&&(i<8&&(n[i]=s(t.pow(a,.5))),_[i]=s(t.pow(a,1/3)),i++),a++}();var h=[],c=o.SHA256=r.extend({_doReset:function(){this._hash=new i.init(n.slice(0))},_doProcessBlock:function(t,e){for(var s=this._hash.words,a=s[0],i=s[1],r=s[2],o=s[3],n=s[4],c=s[5],l=s[6],u=s[7],d=0;d<64;d++){if(d<16)h[d]=0|t[e+d];else{var E=h[d-15],m=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,w=h[d-2],p=(w<<15|w>>>17)^(w<<13|w>>>19)^w>>>10;h[d]=m+h[d-7]+p+h[d-16]}var g=a&i^a&r^i&r,A=(a<<30|a>>>2)^(a<<19|a>>>13)^(a<<10|a>>>22),S=u+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&c^~n&l)+_[d]+h[d];u=l,l=c,c=n,n=o+S|0,o=r,r=i,i=a,a=S+(A+g)|0}s[0]=s[0]+a|0,s[1]=s[1]+i|0,s[2]=s[2]+r|0,s[3]=s[3]+o|0,s[4]=s[4]+n|0,s[5]=s[5]+c|0,s[6]=s[6]+l|0,s[7]=s[7]+u|0},_doFinalize:function(){var e=this._data,s=e.words,a=8*this._nDataBytes,i=8*e.sigBytes;return s[i>>>5]|=128<<24-i%32,s[14+(i+64>>>9<<4)]=t.floor(a/4294967296),s[15+(i+64>>>9<<4)]=a,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(c),e.HmacSHA256=r._createHmacHelper(c)}(Math),a.SHA256)},882:function(t,e,s){var a;t.exports=(a=s(518),s(703),function(t){var e=a,s=e.lib,i=s.WordArray,r=s.Hasher,o=e.x64.Word,n=e.algo,_=[],h=[],c=[];!function(){for(var t=1,e=0,s=0;s<24;s++){_[t+5*e]=(s+1)*(s+2)/2%64;var a=(2*t+3*e)%5;t=e%5,e=a}for(t=0;t<5;t++)for(e=0;e<5;e++)h[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,r=0;r<24;r++){for(var n=0,l=0,u=0;u<7;u++){if(1&i){var d=(1<<u)-1;d<32?l^=1<<d:n^=1<<d-32}128&i?i=i<<1^113:i<<=1}c[r]=o.create(n,l)}}();var l=[];!function(){for(var t=0;t<25;t++)l[t]=o.create()}();var u=n.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var s=this._state,a=this.blockSize/2,i=0;i<a;i++){var r=t[e+2*i],o=t[e+2*i+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(f=s[i]).high^=o,f.low^=r}for(var n=0;n<24;n++){for(var u=0;u<5;u++){for(var d=0,E=0,m=0;m<5;m++)d^=(f=s[u+5*m]).high,E^=f.low;var w=l[u];w.high=d,w.low=E}for(u=0;u<5;u++){var p=l[(u+4)%5],g=l[(u+1)%5],A=g.high,S=g.low;for(d=p.high^(A<<1|S>>>31),E=p.low^(S<<1|A>>>31),m=0;m<5;m++)(f=s[u+5*m]).high^=d,f.low^=E}for(var T=1;T<25;T++){var I=(f=s[T]).high,v=f.low,y=_[T];y<32?(d=I<<y|v>>>32-y,E=v<<y|I>>>32-y):(d=v<<y-32|I>>>64-y,E=I<<y-32|v>>>64-y);var O=l[h[T]];O.high=d,O.low=E}var D=l[0],C=s[0];for(D.high=C.high,D.low=C.low,u=0;u<5;u++)for(m=0;m<5;m++){var f=s[T=u+5*m],N=l[T],P=l[(u+1)%5+5*m],M=l[(u+2)%5+5*m];f.high=N.high^~P.high&M.high,f.low=N.low^~P.low&M.low}f=s[0];var R=c[n];f.high^=R.high,f.low^=R.low}},_doFinalize:function(){var e=this._data,s=e.words,a=(this._nDataBytes,8*e.sigBytes),r=32*this.blockSize;s[a>>>5]|=1<<24-a%32,s[(t.ceil((a+1)/r)*r>>>5)-1]|=128,e.sigBytes=4*s.length,this._process();for(var o=this._state,n=this.cfg.outputLength/8,_=n/8,h=[],c=0;c<_;c++){var l=o[c],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),h.push(d),h.push(u)}return new i.init(h,n)},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),a.SHA3)},78:function(t,e,s){var a,i,r,o,n,_,h,c;t.exports=(c=s(518),s(703),s(759),i=(a=c).x64,r=i.Word,o=i.WordArray,n=a.algo,_=n.SHA512,h=n.SHA384=_.extend({_doReset:function(){this._hash=new o.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=_._doFinalize.call(this);return t.sigBytes-=16,t}}),a.SHA384=_._createHelper(h),a.HmacSHA384=_._createHmacHelper(h),c.SHA384)},759:function(t,e,s){var a;t.exports=(a=s(518),s(703),function(){var t=a,e=t.lib.Hasher,s=t.x64,i=s.Word,r=s.WordArray,o=t.algo;function n(){return i.create.apply(i,arguments)}var _=[n(1116352408,3609767458),n(1899447441,602891725),n(3049323471,3964484399),n(3921009573,2173295548),n(961987163,4081628472),n(1508970993,3053834265),n(2453635748,2937671579),n(2870763221,3664609560),n(3624381080,2734883394),n(310598401,1164996542),n(607225278,1323610764),n(1426881987,3590304994),n(1925078388,4068182383),n(2162078206,991336113),n(2614888103,633803317),n(3248222580,3479774868),n(3835390401,2666613458),n(4022224774,944711139),n(264347078,2341262773),n(604807628,2007800933),n(770255983,1495990901),n(1249150122,1856431235),n(1555081692,3175218132),n(1996064986,2198950837),n(2554220882,3999719339),n(2821834349,766784016),n(2952996808,2566594879),n(3210313671,3203337956),n(3336571891,1034457026),n(3584528711,2466948901),n(113926993,3758326383),n(338241895,168717936),n(666307205,1188179964),n(773529912,1546045734),n(1294757372,1522805485),n(1396182291,2643833823),n(1695183700,2343527390),n(1986661051,1014477480),n(2177026350,1206759142),n(2456956037,344077627),n(2730485921,1290863460),n(2820302411,3158454273),n(3259730800,3505952657),n(3345764771,106217008),n(3516065817,3606008344),n(3600352804,1432725776),n(4094571909,1467031594),n(275423344,851169720),n(430227734,3100823752),n(506948616,1363258195),n(659060556,3750685593),n(883997877,3785050280),n(958139571,3318307427),n(1322822218,3812723403),n(1537002063,2003034995),n(1747873779,3602036899),n(1955562222,1575990012),n(2024104815,1125592928),n(2227730452,2716904306),n(2361852424,442776044),n(2428436474,593698344),n(2756734187,3733110249),n(3204031479,2999351573),n(3329325298,3815920427),n(3391569614,3928383900),n(3515267271,566280711),n(3940187606,3454069534),n(4118630271,4000239992),n(116418474,1914138554),n(174292421,2731055270),n(289380356,3203993006),n(460393269,320620315),n(685471733,587496836),n(852142971,1086792851),n(1017036298,365543100),n(1126000580,2618297676),n(1288033470,3409855158),n(1501505948,4234509866),n(1607167915,987167468),n(1816402316,1246189591)],h=[];!function(){for(var t=0;t<80;t++)h[t]=n()}();var c=o.SHA512=e.extend({_doReset:function(){this._hash=new r.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var s=this._hash.words,a=s[0],i=s[1],r=s[2],o=s[3],n=s[4],c=s[5],l=s[6],u=s[7],d=a.high,E=a.low,m=i.high,w=i.low,p=r.high,g=r.low,A=o.high,S=o.low,T=n.high,I=n.low,v=c.high,y=c.low,O=l.high,D=l.low,C=u.high,f=u.low,N=d,P=E,M=m,R=w,L=p,b=g,x=A,B=S,U=T,W=I,Y=v,F=y,k=O,V=D,G=C,H=f,K=0;K<80;K++){var X,j,J=h[K];if(K<16)j=J.high=0|t[e+2*K],X=J.low=0|t[e+2*K+1];else{var $=h[K-15],Z=$.high,q=$.low,Q=(Z>>>1|q<<31)^(Z>>>8|q<<24)^Z>>>7,z=(q>>>1|Z<<31)^(q>>>8|Z<<24)^(q>>>7|Z<<25),tt=h[K-2],et=tt.high,st=tt.low,at=(et>>>19|st<<13)^(et<<3|st>>>29)^et>>>6,it=(st>>>19|et<<13)^(st<<3|et>>>29)^(st>>>6|et<<26),rt=h[K-7],ot=rt.high,nt=rt.low,_t=h[K-16],ht=_t.high,ct=_t.low;j=(j=(j=Q+ot+((X=z+nt)>>>0<z>>>0?1:0))+at+((X+=it)>>>0<it>>>0?1:0))+ht+((X+=ct)>>>0<ct>>>0?1:0),J.high=j,J.low=X}var lt,ut=U&Y^~U&k,dt=W&F^~W&V,Et=N&M^N&L^M&L,mt=P&R^P&b^R&b,wt=(N>>>28|P<<4)^(N<<30|P>>>2)^(N<<25|P>>>7),pt=(P>>>28|N<<4)^(P<<30|N>>>2)^(P<<25|N>>>7),gt=(U>>>14|W<<18)^(U>>>18|W<<14)^(U<<23|W>>>9),At=(W>>>14|U<<18)^(W>>>18|U<<14)^(W<<23|U>>>9),St=_[K],Tt=St.high,It=St.low,vt=G+gt+((lt=H+At)>>>0<H>>>0?1:0),yt=pt+mt;G=k,H=V,k=Y,V=F,Y=U,F=W,U=x+(vt=(vt=(vt=vt+ut+((lt+=dt)>>>0<dt>>>0?1:0))+Tt+((lt+=It)>>>0<It>>>0?1:0))+j+((lt+=X)>>>0<X>>>0?1:0))+((W=B+lt|0)>>>0<B>>>0?1:0)|0,x=L,B=b,L=M,b=R,M=N,R=P,N=vt+(wt+Et+(yt>>>0<pt>>>0?1:0))+((P=lt+yt|0)>>>0<lt>>>0?1:0)|0}E=a.low=E+P,a.high=d+N+(E>>>0<P>>>0?1:0),w=i.low=w+R,i.high=m+M+(w>>>0<R>>>0?1:0),g=r.low=g+b,r.high=p+L+(g>>>0<b>>>0?1:0),S=o.low=S+B,o.high=A+x+(S>>>0<B>>>0?1:0),I=n.low=I+W,n.high=T+U+(I>>>0<W>>>0?1:0),y=c.low=y+F,c.high=v+Y+(y>>>0<F>>>0?1:0),D=l.low=D+V,l.high=O+k+(D>>>0<V>>>0?1:0),f=u.low=f+H,u.high=C+G+(f>>>0<H>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,a=8*t.sigBytes;return e[a>>>5]|=128<<24-a%32,e[30+(a+128>>>10<<5)]=Math.floor(s/4294967296),e[31+(a+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(c),t.HmacSHA512=e._createHmacHelper(c)}(),a.SHA512)},865:function(t,e,s){var a;t.exports=(a=s(518),s(201),s(989),s(953),s(768),function(){var t=a,e=t.lib,s=e.WordArray,i=e.BlockCipher,r=t.algo,o=[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],n=[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],_=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{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}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=r.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],s=0;s<56;s++){var a=o[s]-1;e[s]=t[a>>>5]>>>31-a%32&1}for(var i=this._subKeys=[],r=0;r<16;r++){var h=i[r]=[],c=_[r];for(s=0;s<24;s++)h[s/6|0]|=e[(n[s]-1+c)%28]<<31-s%6,h[4+(s/6|0)]|=e[28+(n[s+24]-1+c)%28]<<31-s%6;for(h[0]=h[0]<<1|h[0]>>>31,s=1;s<7;s++)h[s]=h[s]>>>4*(s-1)+3;h[7]=h[7]<<5|h[7]>>>27}var l=this._invSubKeys=[];for(s=0;s<16;s++)l[s]=i[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 a=0;a<16;a++){for(var i=s[a],r=this._lBlock,o=this._rBlock,n=0,_=0;_<8;_++)n|=h[_][((o^i[_])&c[_])>>>0];this._lBlock=o,this._rBlock=r^n}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=i._createHelper(l);var E=r.TripleDES=i.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),a=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=l.createEncryptor(s.create(e)),this._des2=l.createEncryptor(s.create(a)),this._des3=l.createEncryptor(s.create(i))},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=i._createHelper(E)}(),a.TripleDES)},703:function(t,e,s){var a;t.exports=(a=s(518),function(t){var e=a,s=e.lib,i=s.Base,r=s.WordArray,o=e.x64={};o.Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=i.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=[],a=0;a<e;a++){var i=t[a];s.push(i.high),s.push(i.low)}return r.create(s,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),s=e.length,a=0;a<s;a++)e[a]=e[a].clone();return t}})}(),a)},156:function(){},699:function(){}},e={};function s(a){var i=e[a];if(void 0!==i)return i.exports;var r=e[a]={exports:{}};return t[a].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 a in e)s.o(e,a)&&!s.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},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:"相手の防御能力が高すぎる!"},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),a=e.reduce(((t,e)=>({...t,[e]:e})),{}),i=t;class r{add(t){return this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return new r(this.strength+t.strength,this.defence+t.defence)}minus(t){return new r(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 o extends r{add(t){return t instanceof o&&(this.energy+=t.energy,this.gold+=t.gold),this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return t instanceof o?new o(this.energy+t.energy,this.strength+t.strength,this.defence+t.defence,this.gold+t.gold):new o(this.energy,this.strength+t.strength,this.defence+t.defence,this.gold)}minus(t){return t instanceof o?new o(this.energy-t.energy,this.strength-t.strength,this.defence-t.defence,this.gold-t.gold):new o(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)}constructor(t,e,s,a){super(e,s),this.energy=t,this.gold=a}}class n{equals(t){return this.x===t.x&&this.y===t.y}substract(t){return new n(this.x-t.x,this.y-t.y)}clone(){return new n(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?u.RIGHT_UP:this.y===t.y?u.RIGHT:u.RIGHT_DOWN:this.x===t.x?this.y>t.y?u.UP:this.y===t.y?u.NO_DIRECTION:u.DOWN:this.y>t.y?u.LEFT_UP:this.y===t.y?u.LEFT:u.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/(W.H_PARTS_NUM_IN_WINDOW-1))*(W.H_PARTS_NUM_IN_WINDOW-1),e=Math.floor(this._partsCoord.y/(W.V_PARTS_NUM_IN_WINDOW-1))*(W.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(),a=t.getPartsCoord().clone();return e.x===s-1&&a.x--,e.y===s-1&&a.y--,a.convertIntoPosition(this._wwa).getScreenTopPosition()}getNextJustPosition(t){if(void 0!==t){var e=this._partsCoord;return new _(this._wwa,e.x+d[t],e.y+E[t],0,0)}var s=this._partsCoord.x,a=this._partsCoord.y;return this._offsetCoord.x<0?s--:this._offsetCoord.x>0&&s++,this._offsetCoord.y<0?a--:this._offsetCoord.y>0&&a++,new _(this._wwa,s,a,0,0)}getNextFramePosition(t,e,s){var a=this._partsCoord.x,i=this._partsCoord.y,r=this._offsetCoord.x+d[t]*e,o=this._offsetCoord.y+E[t]*s;if(r<0){var n=Math.floor(Math.abs(r)/W.CHIP_SIZE);a-=n,r=(r+n*W.CHIP_SIZE)%W.CHIP_SIZE}if(o<0){var h=Math.floor(Math.abs(o)/W.CHIP_SIZE);i-=h,o=(o+h*W.CHIP_SIZE)%W.CHIP_SIZE}return r>=W.CHIP_SIZE&&(a+=Math.floor(r/W.CHIP_SIZE),r=(r+W.CHIP_SIZE)%W.CHIP_SIZE),o>=W.CHIP_SIZE&&(i+=Math.floor(o/W.CHIP_SIZE),o=(o+W.CHIP_SIZE)%W.CHIP_SIZE),new _(this._wwa,a,i,r,o)}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,a=this._partsCoord.x,i=this._partsCoord.y,r=e?1:0;return s.x<=a&&a<s.x+W.H_PARTS_NUM_IN_WINDOW-r&&s.y<=i&&i<s.y+W.V_PARTS_NUM_IN_WINDOW-r}hasLocalGate(){return this._wwa.getMapTypeByPosition(this)===W.MAP_LOCALGATE||this._wwa.getObjectTypeByPosition(this)===W.OBJECT_LOCALGATE}clone(){return new _(this._wwa,this._partsCoord.x,this._partsCoord.y,this._offsetCoord.x,this._offsetCoord.y)}constructor(t,e,s,a=0,i=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&&a>0||s<0||s>=r||s>=r-1&&i>0)throw new Error("範囲外の座標です!! parts:("+e+", "+s+"), offset:("+a+", "+i+"), mapWidth = "+r);this._partsCoord=new n(e,s),this._offsetCoord=new n(a,i)}}class h{constructor(t,e,s){this.destPos=t.clone(),this.srcPos=e.clone(),this.srcSize=s.clone()}}class c{constructor(t,e,s,a,i){this.partsIDObj=t,this.x=e,this.y=s,this.isStatic=a,this.isFighting=i}}var l,u;!function(t){t[t.GOTO_WWA=0]="GOTO_WWA",t[t.BATTLE_REPORT=1]="BATTLE_REPORT",t[t.GAME_END=2]="GAME_END"}(l||(l={})),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"}(u||(u={}));const d=[0,-1,0,1,-1,0,1,-1,0,1],E=[0,1,1,1,0,0,0,-1,-1,-1];var m,w,p,g,A,S,T,I,v,y,O,D,C;!function(t){t[t.YES=0]="YES",t[t.NO=1]="NO",t[t.UNSELECTED=2]="UNSELECTED"}(m||(m={})),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"}(p||(p={})),function(t){t[t.MAP=1]="MAP",t[t.OBJECT=0]="OBJECT"}(g||(g={}));class f{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)?A.XBOX:t.match(/windows/i)?A.WINDOWS:t.match(/macintosh/i)?"ontouchstart"in document?A.IOS:A.MACINTOSH:t.match(/iphone|ipad|ipod/i)?A.IOS:t.match(/oculus/i)?A.OCULUS:t.match(/android/i)?A.ANDROID:t.match(/nintendo/i)?A.NINTENDO:t.match(/playstation/i)?A.PLAY_STATION:t.match(/linux/i)?A.LINUX:A.OTHERS}getBrowser(t){return t.match(/chrome/i)?T.CHROME:t.match(/firefox/i)?T.FIREFOX:t.match(/safari/i)?T.SAFARI:T.OTHERS}getDevice(){switch(this.os){case A.WINDOWS:case A.MACINTOSH:case A.LINUX:return S.PC;case A.IOS:case A.ANDROID:return S.SP;case A.OCULUS:return S.VR;case A.NINTENDO:case A.PLAY_STATION:case A.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"}(A||(A={})),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"}(T||(T={})),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"}(I||(I={})),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"}(v||(v={})),function(t){t[t.UP=0]="UP",t[t.DOWN=1]="DOWN"}(y||(y={})),function(t){t[t.QUICK_LOAD=0]="QUICK_LOAD",t[t.RESTART_GAME=1]="RESTART_GAME",t[t.PASSWORD=2]="PASSWORD"}(O||(O={})),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"}(C||(C={}));var N,P=["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.GAMEPAD_BUTTON=100]="GAMEPAD_BUTTON",t[t.OLDMOVE=101]="OLDMOVE",t[t.LEGACY_IF=10050]="LEGACY_IF"}(N||(N={}));var M,R,L,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,$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"}(M||(M={})),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"}(R||(R={})),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"}(L||(L={}));const x=[1,2,5,8,10,20],B=["超低速","低速","準低速","中速","高速","超高速"],U=["energy","strength","defence","gold"];class W{}W.WWA_HOME="http://wwajp.com",W.ITEMBOX_SIZE=12,W.MAP_ATR_MAX=60,W.OBJ_ATR_MAX=60,W.OLD_MAP_ATR_MAX=40,W.OLD_OBJ_ATR_MAX=40,W.ATR_TYPE=3,W.ATR_MODE=4,W.ATR_STRING=5,W.ATR_X=6,W.ATR_Y=7,W.ATR_X2=8,W.ATR_Y2=9,W.ATR_ENERGY=10,W.ATR_STRENGTH=11,W.ATR_DEFENCE=12,W.ATR_GOLD=13,W.ATR_ITEM=14,W.ATR_NUMBER=15,W.ATR_JUMP_X=16,W.ATR_MOVE=16,W.ATR_JUMP_Y=17,W.ATR_SOUND=19,W.ATR_APPERANCE_BASE=20,W.REL_ATR_APPERANCE_ID=0,W.REL_ATR_APPERANCE_X=1,W.REL_ATR_APPERANCE_Y=2,W.REL_ATR_APPERANCE_TYPE=3,W.REL_ATR_APPERANCE_UNIT_LENGTH=4,W.ATR_RANDOM_BASE=10,W.RANDOM_ATR_NUM=10,W.RANDOM_ITERATION_MAX=10,W.MAP_STREET=0,W.MAP_WALL=1,W.MAP_LOCALGATE=2,W.MAP_URLGATE=4,W.OBJECT_NORMAL=0,W.OBJECT_MESSAGE=1,W.OBJECT_URLGATE=2,W.OBJECT_STATUS=3,W.OBJECT_ITEM=4,W.OBJECT_DOOR=5,W.OBJECT_MONSTER=6,W.OBJECT_SCORE=11,W.OBJECT_SELL=14,W.OBJECT_BUY=15,W.OBJECT_RANDOM=16,W.OBJECT_SELECT=17,W.OBJECT_LOCALGATE=18,W.SYSTEM_MESSAGE_NUM=20,W.IMGPOS_DEFAULT_YESNO_X=3,W.IMGPOS_DEFAULT_YESNO_Y=1,W.IMGRELPOS_YESNO_YES_X=0,W.IMGRELPOS_YESNO_NO_X=1,W.IMGRELPOS_YESNO_YESP_X=2,W.IMGRELPOS_YESNO_NOP_X=3,W.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0,W.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0,W.IMGPOS_DEFAULT_FRAME_X=0,W.IMGPOS_DEFAULT_FRAME_Y=1,W.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3,W.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3,W.DEFAULT_DISABLE_SAVE=!1,W.DEFAULT_OLDMAP=!1,W.DEFAULT_OBJECT_NO_COLLAPSE=!1,W.SPLASH_SCREEN_DISP_MILLS=100,W.DEFAULT_FRAME_INTERVAL=20,W.GAMEOVER_FRAME_INTERVAL=50,W.YESNO_PRESS_DISP_FRAME_NUM=20,W.WAIT_TIME_FRAME_NUM=6,W.CHIP_SIZE=40,W.MAP_WINDOW_WIDTH=440,W.MAP_WINDOW_HEIGHT=440,W.H_PARTS_NUM_IN_WINDOW=W.MAP_WINDOW_WIDTH/W.CHIP_SIZE,W.V_PARTS_NUM_IN_WINDOW=W.MAP_WINDOW_HEIGHT/W.CHIP_SIZE,W.MIN_SPEED_INDEX=0,W.MAX_SPEED_INDEX=x.length-1,W.QUICK_BATTLE_SPEED_INDECIES=[x.length-2,x.length-1],W.ANIMATION_REP_HALF_FRAME=22,W.PLAYER_LOOKING_AROUND_START_FRAME=4*W.ANIMATION_REP_HALF_FRAME,W.RELATIVE_COORD_BIAS=1e4,W.RELATIVE_COORD_LOWER=W.RELATIVE_COORD_BIAS-1e3,W.PLAYER_COORD=W.RELATIVE_COORD_BIAS-1e3,W.LOCALGATE_PLAYER_WAIT_FRAME=5,W.STATUS_CHANGED_EFFECT_FRAME_NUM=20,W.PASSABLE_OBJECT=1,W.APPERANCE_PARTS_MIN_INDEX=0,W.APPERANCE_PARTS_MAX_INDEX=9,W.APPERANCE_PARTS_MIN_INDEX_NO=5,W.APPERANCE_PARTS_MAX_INDEX_YES=4,W.FADEOUT_SPEED=8,W.STATUS_MINUS_BORDER=3e4,W.ITEMBOX_IS_FULL=-1,W.BATTLE_INTERVAL_FRAME_NUM=10,W.BATTLE_SPEED_CHANGE_TURN_NUM=40,W.RANDOM_MOVE_ITERATION_NUM=50,W.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31=8,W.BATTLE_ESTIMATE_MONSTER_TYPE_MAX=8,W.SOUND_MAX=100,W.ITEM_BORDER_IMG_DATA_URL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAArklEQVRYR+2Y0QqAIAxFt///aENJHwxxuJUSxzeh3S7HXaNpEkly4FIRzba0GEyHeVTN7jqDWvb7V4Y1NLibZIY0NbiL5G3MZLCe / 1fn3XJgJYjB7mgg6O1VCEKwXo79JeklY62nB62kRs9BEIKkeNIDhISQEBJC4k0BBCF4D7D4cV9shf99ixdB + MrM0y3fa3zV05D45GOqhwPMGPkYlccIOEY2VKUN0UNVXxC7ADj7mDi9aFZZAAAAAElFTkSuQmCC",W.LOAD_STAGE_MAX_EXCEPT_AUDIO=7,W.WWA_STYLE_TAG_ID="wwa-additional-style",W.DEFAULT_FRAME_COLOR_R=255,W.DEFAULT_FRAME_COLOR_G=255,W.DEFAULT_FRAME_COLOR_B=255,W.DEFAULT_FRAMEOUT_COLOR_R=96,W.DEFAULT_FRAMEOUT_COLOR_G=96,W.DEFAULT_FRAMEOUT_COLOR_B=96,W.DEFAULT_STRBACK_COLOR_R=0,W.DEFAULT_STRBACK_COLOR_G=0,W.DEFAULT_STRBACK_COLOR_B=0,W.DEFAULT_STATUS_COLOR_R=0,W.DEFAULT_STATUS_COLOR_G=0,W.DEFAULT_STATUS_COLOR_B=0,W.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM=20,W.WWAP_SERVER_OLD="http://wwawing.com/wwap",W.WWAP_SERVER="https://wwaphoenix.github.io",W.WWAP_SERVER_AUDIO_DIR="audio",W.WWAP_SERVER_TITLE_IMG="cover_p.gif",W.WWAP_SERVER_LOADER_NO_WORKER="wwaload.noworker.js",W.SCREEN_WIDTH=560,W.SCREEN_HEIGHT=440,W.LOADING_FONT="Times New Roman",W.MSG_STR_WIDTH=16,W.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME=20,W.ITEMBOX_TOP_Y=140,W.USER_VAR_NUM=256,W.USER_VAR_NUM_MAX_VALUE=9007199254740991,W.USET_VAR_NUM_MIN_VALUE=-9007199254740991,W.CONTROLL_WAIT_FRAME=6,W.INLINE_USER_VAR_VIEWER_DISPLAY_NUM=10;class Y{}Y.QUICK_SAVE_MAX=4,Y.QUICK_SAVE_THUMNAIL_WIDTH=99,Y.QUICK_SAVE_THUMNAIL_HEIGHT=99,Y.SAVE_INTERVAL_MOVE=200,Y.INDEXEDDB_DB_NAME="WWA_WING_DB",Y.INDEXEDDB_TABLE_NAME="SAVE_TABLE",Y.DATE_LAST_SAVE_TEXT_COLOR="rgba(255,255,0,1)";class F{}F.EMPTY_LOAD="",F.EMPTY_SAVE="",F.PASSWORD="Password",F.QUICK_SAVE="Quick Save",F.QUICK_LOAD="Quick Load",F.BATTLE_REPORT="Battle Report",F.GAME_END="Game End",F.GOTO_WWA="Goto WWA",F.RESTART_GAME="Restart Game";class k{}var V;!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"}(V||(V={}));var G,H,K,X,j,J,$,Z,q,Q,z,tt=["ロードの準備をしています。","背景パーツを読み込んでいます。","物体パーツを読み込んでます。","背景パーツの属性を読み込んでます。","物体パーツの属性を読み込んでます。","ランダムパーツを置換しています。","メッセージを読み込んでます。","Welcome to WWA Wing!"],et=["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"}(G||(G={})),function(t){t[t.TITLE=32]="TITLE",t[t.LOADING=22]="LOADING",t[t.FOOTER=18]="FOOTER",t[t.ERRROR=16]="ERRROR"}(H||(H={})),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"}(K||(K={})),function(t){t[t.MESSAGE_WINDOW=0]="MESSAGE_WINDOW",t[t.SIDEBAR=1]="SIDEBAR"}(X||(X={})),function(t){t[t.BITSHIFT=16]="BITSHIFT",t[t.BITMASK=65535]="BITMASK"}(j||(j={})),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"}(J||(J={})),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_C=67]="KEY_C",t[t.KEY_D=68]="KEY_D",t[t.KEY_E=69]="KEY_E",t[t.KEY_I=73]="KEY_I",t[t.KEY_M=77]="KEY_M",t[t.KEY_N=78]="KEY_N",t[t.KEY_P=80]="KEY_P",t[t.KEY_Q=81]="KEY_Q",t[t.KEY_S=83]="KEY_S",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"}($||($={}));class st{checkHitKey(t){var e=this.getKeyState(t);return e===J.KEYDOWN||e===J.KEYPRESS}getKeyState(t){return this._prevKeyState[t]?this._keyState[t]?J.KEYPRESS:J.KEYUP:this._keyState[t]?J.KEYDOWN:J.NONE}getKeyStateForControllPlayer(t){return this._prevKeyStateOnControllable[t]?this._keyState[t]?J.KEYPRESS:J.KEYUP:this._keyState[t]?J.KEYDOWN:J.NONE}getKeyStateForMessageCheck(t){return this._prevKeyState[t]?this._keyState[t]?this._keyInputContinueFrameNum[t]>=W.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM?J.KEYPRESS_MESSAGECHANGE:J.KEYPRESS:J.KEYUP:this._keyState[t]?J.KEYDOWN:J.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<st.KEY_BUFFER_MAX;t++)this._keyState[t]&&this._keyInputContinueFrameNum[t]++}memorizeKeyStateOnControllableFrame(){this._prevKeyStateOnControllable=this._keyState.slice()}allClear(){var t;for(this._nextKeyState=new Array(st.KEY_BUFFER_MAX),t=0;t<st.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1}constructor(){var t;for(this._nextKeyState=new Array(st.KEY_BUFFER_MAX),this._keyState=new Array(st.KEY_BUFFER_MAX),this._prevKeyState=new Array(st.KEY_BUFFER_MAX),this._prevKeyStateOnControllable=new Array(st.KEY_BUFFER_MAX),this._keyInputContinueFrameNum=new Array(st.KEY_BUFFER_MAX),t=0;t<st.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1,this._keyState[t]=!1,this._prevKeyState[t]=!1,this._prevKeyStateOnControllable[t]=!1,this._keyInputContinueFrameNum[t]=0}}st.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 at{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"}(Q||(Q={})),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"}(z||(z={}));class it{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,a,i,r;for(s=t.length,e=0;e<s;e++){a=t[e];var o=this.gamepad.buttons[a];if(!o)return!1;if(i="object"==typeof o?!0===o.pressed:1===o,r=this.triggers[a],this.triggers[a]=i,i&&!r)return!0}return!1}buttonPressed(...t){if(!this.gamepad)return!1;var e,s,a;for(s=t.length,e=0;e<s;e++){a=t[e];var i=this.gamepad.buttons[a];if(!i)return!1;if("object"==typeof i?!0===i.pressed:1===i)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 Q.BUTTON_CROSS_KEY_UP:if(this.gamepad.axes[z.AXES_L_VERTICAL_INDEX]<=-.6||this.gamepad.axes[z.AXES_R_VERTICAL_INDEX]<=-.6||-1===this.stickFloor(z.AXES_CROSS_KEY)||this.buttonPressed(Q.BUTTON_CROSS_KEY_UP))return!0;break;case Q.BUTTON_CROSS_KEY_DOWN:if(this.gamepad.axes[z.AXES_L_VERTICAL_INDEX]>=.7||this.gamepad.axes[z.AXES_R_VERTICAL_INDEX]>=.7||.1===this.stickFloor(z.AXES_CROSS_KEY)||this.buttonPressed(Q.BUTTON_CROSS_KEY_DOWN))return!0;break;case Q.BUTTON_CROSS_KEY_LEFT:if(this.gamepad.axes[z.AXES_L_HORIZONTAL_INDEX]<=-.7||this.gamepad.axes[z.AXES_R_HORIZONTAL_INDEX]<=-.7||.7===this.stickFloor(z.AXES_CROSS_KEY)||this.buttonPressed(Q.BUTTON_CROSS_KEY_LEFT))return!0;break;case Q.BUTTON_CROSS_KEY_RIGHT:if(this.gamepad.axes[z.AXES_L_HORIZONTAL_INDEX]>.6||this.gamepad.axes[z.AXES_R_HORIZONTAL_INDEX]>.6||-.5===this.stickFloor(z.AXES_CROSS_KEY)||this.buttonPressed(Q.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,a;for(s=t.length,e=0;e<s;e++){a=t[e];var i=this.gamepad.axes[a];return"number"!=typeof i?0:Math.floor(10*i)/10}return 0}}class rt{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 rt.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 ot=["BUTTON_ENTER","BUTTON_ESC","BUTTON_SIDEBAR","BUTTON_FAST","BUTTON_SLOW","BUTTON_LEFT","BUTTON_UP","BUTTON_RIGHT","BUTTON_DOWN"],nt=["BUTTON_LEFT","BUTTON_UP","BUTTON_RIGHT","BUTTON_DOWN"],_t=new Set(nt);class ht{constructor(t,e=!1,s=null,a=null,i=null,r=null){if(this._enabled=null!==t,this._visible=e,this._onTouchStart=i||null,this._onTouchEnd=r||null,this._availableButtons=[],this._isTouchingButtons={},this._moveButtonsElement=a,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 a=e;this._availableButtons.push(a),s.setAttribute("type",e),this._isTouchingButtons[a]={prev:!1,current:!1,next:!1};const i=t=>{t.cancelable&&t.preventDefault()},r=t=>{i(t),this.allClear()};s.addEventListener("touchstart",(t=>{i(t),this.setTouchInfo(a)})),s.addEventListener("touchcancel",r),ht.isMoveButton(a)?(s.addEventListener("touchmove",this._detectMovingMoveButton.bind(this)),s.addEventListener("touchend",this.allMoveClear.bind(this))):s.addEventListener("touchend",(t=>{i(t),this.clearTouchInfo(a)}))}null!==a&&a.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(),a=document.body.getBoundingClientRect(),i=s.left-a.left+s.width/2,r=s.top-a.top+s.height/2,o=e.pageX-i,n=e.pageY-r;o>=n?o<=-n?this.setTouchInfo("BUTTON_UP"):this.setTouchInfo("BUTTON_RIGHT"):o>=-n?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,a=e.current;return s&&a?"TOUCHING":a?"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(){nt.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 a=this._isTouchingButtons[t];if(void 0!==a)switch(this._isTouchingButtons[t].prev=a.current,this._isTouchingButtons[t].current=a.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 ct(){const t=document.querySelector("meta[name='viewport']"),e=window.innerWidth,s=window.innerHeight;let a="user-scalable=no";if(e>s){a=`width=${Math.floor(e/s*456)},${a}`}else e<=s&&(a=`width=576,${a}`);null==t||t.setAttribute("content",`${a}`)}var lt=t=>document.getElementById(t),ut=t=>document.querySelector(t),dt=t=>document.querySelector(t),Et=t=>document.querySelectorAll(t),mt=(t,e)=>{var s,a,i=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,r=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;return s=t-lt("wwa-wrapper").offsetLeft+i,a=e-lt("wwa-wrapper").offsetTop+r,new n(s,a)},wt=t=>t.match(/^https?:\/\//)||t.match(/^\.\.\//)?t:location.href="./"+t,pt=t=>{var e="";if(t instanceof Array){for(var s=0;s<t.length;s++)e+=pt(t[s])+"/";return e}return t+""};const gt=t=>t.split("").reverse().join("");class At{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._isTransparent=s}drawCanvas(t,e,s,a,i){this.ctx.drawImage(t,W.CHIP_SIZE*e,W.CHIP_SIZE*s,W.CHIP_SIZE,W.CHIP_SIZE,a,i,W.CHIP_SIZE,W.CHIP_SIZE)}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,a){this._isTransparent?this.ctx.clearRect(t,e,s,a):(this.ctx.fillStyle="#9E9E9E",this.ctx.fillRect(t,e,s,a))}}class St{_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,W.MAP_WINDOW_WIDTH-W.CHIP_SIZE,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+2,0,W.MAP_WINDOW_HEIGHT-W.CHIP_SIZE),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+2,W.MAP_WINDOW_WIDTH-W.CHIP_SIZE,W.MAP_WINDOW_HEIGHT-W.CHIP_SIZE);for(var t=1;t<W.H_PARTS_NUM_IN_WINDOW-1;t++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y,W.CHIP_SIZE*t,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y+2,W.CHIP_SIZE*t,W.MAP_WINDOW_HEIGHT-W.CHIP_SIZE);for(t=1;t<W.V_PARTS_NUM_IN_WINDOW-1;t++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+1,0,W.CHIP_SIZE*t),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+1,W.MAP_WINDOW_WIDTH-W.CHIP_SIZE,W.CHIP_SIZE*t)}updateEffects(t){var e;if(t){var s,a=t.length;for(e=0;e<a;e++){var i=t[e];(s=this._effectCanvases[e])?s.clear():s=this._effectCanvases[e]=new At(W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,!0);for(var r=0;r<W.V_PARTS_NUM_IN_WINDOW;r++)for(var o=0;o<W.H_PARTS_NUM_IN_WINDOW;o++)s.drawCanvas(this._image,i.x,i.y,o*W.CHIP_SIZE,r*W.CHIP_SIZE)}}}drawFrame(){this._ctx.drawImage(this._frameCanvas.cvs,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-1),W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE,0,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-1),W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,W.CHIP_SIZE,W.CHIP_SIZE,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-2),0,W.CHIP_SIZE,W.CHIP_SIZE,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-2)),this._ctx.drawImage(this._frameCanvas.cvs,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-1),W.CHIP_SIZE,W.CHIP_SIZE,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-2),W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-1),W.CHIP_SIZE,W.CHIP_SIZE,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-2))}drawEffect(t){var e=this._effectCanvases[t];e&&this._ctx.drawImage(e.cvs,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW)}drawCanvas(t,e,s,a){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._image,W.CHIP_SIZE*t,W.CHIP_SIZE*e,W.CHIP_SIZE,W.CHIP_SIZE,s,a,W.CHIP_SIZE,W.CHIP_SIZE)}drawCanvasWithSize(t,e,s,a,i,r){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._image,W.CHIP_SIZE*t,W.CHIP_SIZE*e,W.CHIP_SIZE*s,W.CHIP_SIZE*a,i,r,W.CHIP_SIZE*s,W.CHIP_SIZE*a)}drawCanvasWithUpperYLimit(t,e,s,a,i){if(!this._isLoaded)throw new Error("No image was loaded.");var r=Math.max(0,a+W.CHIP_SIZE-i);r>=W.CHIP_SIZE||this._ctx.drawImage(this._image,W.CHIP_SIZE*t,W.CHIP_SIZE*e,W.CHIP_SIZE,W.CHIP_SIZE-r,s,a,W.CHIP_SIZE,W.CHIP_SIZE)}copyCanvas(t,e){return(s,a,i,r,o)=>{if(!this._isLoaded)throw new Error("No image was loaded.");const n=Math.max(0,e(r,o));n>=W.CHIP_SIZE||t.ctx.drawImage(this._image,W.CHIP_SIZE*s,W.CHIP_SIZE*a+n,W.CHIP_SIZE,W.CHIP_SIZE-n,i,r+n,W.CHIP_SIZE,W.CHIP_SIZE)}}copyBackCanvasWithUpperYLimit(t,e,s,a,i){this.copyCanvas(this._backCanvas,((t,e)=>t+W.CHIP_SIZE-e))(t,e,s,a,i)}copyBackCanvasWithLowerYLimit(t,e,s,a,i){this.copyCanvas(this._backCanvas,((t,e)=>e-t))(t,e,s,a,i)}copyObjectCanvasWithUpperYLimit(t,e,s,a,i,r){this.copyCanvas(this._objectCanvases[t],((t,e)=>t+W.CHIP_SIZE-e))(e,s,a,i,r)}copyObjectCanvasWithLowerYLimit(t,e,s,a,i,r){this.copyCanvas(this._objectCanvases[t],((t,e)=>e-t))(e,s,a,i,r)}drawBackCanvas(){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._backCanvas.cvs,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.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,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.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,a,i){if(!this._isLoaded)throw new Error("No image was loaded.");var r=Math.max(0,i-a);r>=W.CHIP_SIZE||this._ctx.drawImage(this._image,W.CHIP_SIZE*t,W.CHIP_SIZE*e+r,W.CHIP_SIZE,W.CHIP_SIZE-r,s,a+r,W.CHIP_SIZE,W.CHIP_SIZE)}clearCanvas(t,e,s,a){this._ctx.clearRect(t,e,s,a)}drawBase(t,e,s,a){this._ctx.fillStyle="#9E9E9E",this._ctx.fillRect(t,e,s,a)}setFrameImage(t){this._frameCoord=t,this.createFrame()}constructor(t,e,s,a){var i;for(this._isLoaded=!1,this.mapCache=void 0,this.mapObjectCache=void 0,this.mapCacheYLimit=0,this._frameCanvas=new At(W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,!0),this._backCanvas=new At(W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,!1),this._objectCanvases=[],this._effectCanvases=[],i=0;i<2;i++)this._objectCanvases[i]=new At(W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,!0);this._ctx=t,this._fileName=e,this._loadCompleteCallBack=a,this._load(),this._frameCoord=s.clone(),this.cpPartsLog=new n(0,0)}}class Tt{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=x[this._player.getSpeedIndex()];this._position=this._position.getNextFramePosition(t,e*(W.H_PARTS_NUM_IN_WINDOW-1),e*(W.V_PARTS_NUM_IN_WINDOW-1))}getTransitionStepNum(){return this._transitionStep}advanceTransitionStepNum(){return++this._transitionStep,this._transitionStep===W.V_PARTS_NUM_IN_WINDOW&&(this._isResetting=!1,this._transitionStep=0),this._transitionStep}isFinalStep(){if(!1===this._isResetting)throw new Error("リセット中ではありません。");return this._transitionStep===W.V_PARTS_NUM_IN_WINDOW-1}reset(t){this._positionPrev=this._position,this._position=t.getDefaultCameraPosition(),this._transitionStep=0,this._isResetting=!0}}class It{getPosition(){return this._position}constructor(t){this._position=t}}class vt extends It{constructor(t){super(t)}}var yt;!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"}(yt||(yt={}));class Ot extends vt{move(){if(this.isControllable())this.controll(this._dir);else if(this._state===yt.CAMERA_MOVING){try{this._camera.move(this._dir)}catch(t){}this._isOnCameraStopPosition()&&(this._state=yt.CONTROLLABLE)}else if(this._state===yt.MOVING){try{var t=this._position.getNextFramePosition(this._dir,x[this._speedIndex],x[this._speedIndex])}catch(t){}t.isJustPosition()&&(this._state=yt.CONTROLLABLE,this.toggleMovingImage(),this._moves++,this._isPartsEventExecuted=!1,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0),this._position=t}}controll(t){var e,s;if(this.isControllable()){this._isPreparedForLookingAround=!1,this._dir=t;try{e=this._position.getNextFramePosition(this._dir,x[this._speedIndex],x[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=yt.CAMERA_MOVING}catch(t){this._state=yt.CONTROLLABLE}return}if(!this.canMoveTo(s))return this._wwa.getMapTypeByPosition(s)===W.MAP_WALL&&this._wwa.checkMap(s.getPartsCoord()),void this._wwa.checkObject(s.getPartsCoord());this._position=e,this._state=yt.MOVING,this._wwa.getMapAttributeByPosition(this._position.getNextJustPosition(t),W.ATR_TYPE)!==W.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)!==W.MAP_WALL&&(0===this._wwa.getObjectIdByPosition(t)||(this._wwa.getObjectTypeByPosition(t)===W.OBJECT_NORMAL&&this._wwa.getObjectAttributeByPosition(t,W.ATR_MODE)===W.PASSABLE_OBJECT||this._wwa.getObjectTypeByPosition(t)===W.OBJECT_DOOR&&this._wwa.getObjectAttributeByPosition(t,W.ATR_NUMBER)===W.PASSABLE_OBJECT&&!this.hasItem(this._wwa.getObjectAttributeByPosition(t,W.ATR_ITEM)))))}isMoving(){return this._state==yt.MOVING||this._state==yt.CAMERA_MOVING}_isOnCameraMovingPosition(){var t=this._camera.getPosition().getPartsCoord(),e=this.getPosition().getPartsCoord();return e.x-t.x==W.H_PARTS_NUM_IN_WINDOW-1&&this._dir===u.RIGHT||e.x===t.x&&this._dir===u.LEFT||e.y-t.y==W.V_PARTS_NUM_IN_WINDOW-1&&this._dir===u.DOWN||e.y===t.y&&this._dir===u.UP}_isOnCameraStopPosition(){var t=this._camera.getPosition().getPartsCoord(),e=this.getPosition().getPartsCoord();return e.x-t.x==W.H_PARTS_NUM_IN_WINDOW-1&&this._dir===u.LEFT||e.x===t.x&&this._dir===u.RIGHT||e.y-t.y==W.V_PARTS_NUM_IN_WINDOW-1&&this._dir===u.UP||e.y===t.y&&this._dir===u.DOWN}isControllable(){var t=this._afterMoveMacroFlag;return this._afterMoveMacroFlag=!1,this._state===yt.CONTROLLABLE&&!this._partsAppeared&&(this._wwa.getMapTypeByPosition(this._position)!==W.MAP_LOCALGATE&&this._wwa.getMapTypeByPosition(this._position)!==W.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===yt.LOCALGATE_JUMPED||this._state===yt.LOCALGATE_JUMPED_WITH_MESSAGE}setMessageWaiting(){this._state=yt.MESSAGE_WAITING}isWaitingMessage(){return this._state===yt.MESSAGE_WAITING}isDelayFrame(){return this._messageDelayFrameCount>0}updateDelayFrame(){this._messageDelayFrameCount--}setDelayFrame(){this._messageDelayFrameCount=1}clearMessageWaiting(){this._state!==yt.MESSAGE_WAITING&&this._state!==yt.LOCALGATE_JUMPED_WITH_MESSAGE||(this._state===yt.MESSAGE_WAITING?this._state=yt.CONTROLLABLE:this._state===yt.LOCALGATE_JUMPED_WITH_MESSAGE&&(this._state=yt.LOCALGATE_JUMPED),this._isPartsEventExecuted=!0,this._isPreparedForLookingAround&&(this._lookingAroundTimer=W.PLAYER_LOOKING_AROUND_START_FRAME))}setEstimateWindowWating(){this._state=yt.ESTIMATE_WINDOW_WAITING}isWatingEstimateWindow(){return this._state===yt.ESTIMATE_WINDOW_WAITING}clearEstimateWindowWaiting(){this._state===yt.ESTIMATE_WINDOW_WAITING&&(this._state=yt.CONTROLLABLE)}setPasswordWindowWating(){this._state=yt.PASSWORD_WINDOW_WAITING}isWaitingPasswordWindow(){return this._state===yt.PASSWORD_WINDOW_WAITING}clearPasswordWindowWaiting(){this._state===yt.PASSWORD_WINDOW_WAITING&&(this._state=yt.CONTROLLABLE)}isPartsEventExecuted(){return this._isPartsEventExecuted}resetEventExecutionInfo(){this._isPartsEventExecuted=!1}getLastExecPartsIDOnSamePosition(t){return t===g.MAP?this._samePosLastExecutedMapID:this._samePosLastExecutedObjID}setLastExecInfoOnSamePosition(t,e){t===g.MAP?this._samePosLastExecutedMapID=e:this._samePosLastExecutedObjID=e}processAfterJump(){this._state!==yt.LOCALGATE_JUMPED&&this._state!==yt.LOCALGATE_JUMPED_WITH_MESSAGE||0==--this._jumpWaitFramesRemain&&(this._state=this._state===yt.LOCALGATE_JUMPED?yt.CONTROLLABLE:yt.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===yt.MESSAGE_WAITING?yt.LOCALGATE_JUMPED_WITH_MESSAGE:yt.LOCALGATE_JUMPED,this._jumpWaitFramesRemain=W.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,t.hasLocalGate()?this._dir=u.DOWN:t.getPartsCoord().y<=this._wwa.getMapWidth()-2&&t.getNextJustPosition(u.DOWN).hasLocalGate()?this._dir=u.UP:t.getPartsCoord().y>=1&&t.getNextJustPosition(u.UP).hasLocalGate()?this._dir=u.DOWN:t.getPartsCoord().x<=this._wwa.getMapWidth()-2&&t.getNextJustPosition(u.RIGHT).hasLocalGate()?this._dir=u.LEFT:t.getPartsCoord().x>=1&&t.getNextJustPosition(u.LEFT).hasLocalGate()?this._dir=u.RIGHT:this._dir=u.DOWN,this._camera.getPosition().equals(e)||(this._isPreparedForLookingAround=!0,this._lookingAroundTimer=W.PLAYER_LOOKING_AROUND_START_FRAME),!0)}systemJumpTo(t){this._position=t,this._camera.reset(t),this._camera.resetPreviousPosition(),this._state=yt.LOCALGATE_JUMPED,this._jumpWaitFramesRemain=W.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,this._dir=u.DOWN,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=W.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 r(0,0))}getStatusOfEquipments(){return this._equipStatus.plus(new r(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],a=ut("#item"+e);if(0===this._itemBox[e]){s.style.backgroundPosition="-40px 0px",this.disposeItemEffect(e,this._itemBoxElement[e],a);continue}const i=this._wwa.getObjectCropXById(this._itemBox[e]),r=this._wwa.getObjectCropYById(this._itemBox[e]);if(!t||e!==t.insertPos-1){s.style.backgroundPosition="-"+i+"px -"+r+"px",this.disposeItemEffect(e,this._itemBoxElement[e],a);continue}const o=t.itemScreenPixelCoord.x-t.itemBoxScreenPixelCoord.x,n=t.itemScreenPixelCoord.y-t.itemBoxScreenPixelCoord.y,_=-o*W.DEFAULT_FRAME_INTERVAL/W.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME,h=0===t.overwrittenObjectId||void 0===t.overwrittenObjectId,c=h?t.itemBoxBackgroundImageCoord.x:this._wwa.getObjectCropXById(t.overwrittenObjectId),l=h?t.itemBoxBackgroundImageCoord.y:this._wwa.getObjectCropYById(t.overwrittenObjectId);s.style.left=o+"px",s.style.top=n+"px","number"==typeof this.itemEffectStartTimers[e]&&clearInterval(this.itemEffectStartTimers[e]),this.itemEffectStartTimers[e]=window.setTimeout((()=>{this.itemEffectStartTimers[e]=void 0,this.startItemEffect(e,s,a,{target:{x:i,y:r},overwritten:{x:c,y:l}},_)}),W.DEFAULT_FRAME_INTERVAL)}}startItemEffect(t,e,s,a,i){const r=s.querySelector(this.overwittenItemSelector);r&&s.removeChild(r);const o=document.createElement("div");o.classList.add(this.overwittenItemClassName),o.style.backgroundPosition="-"+a.overwritten.x+"px -"+a.overwritten.y+"px",o.style.backgroundImage=s.style.backgroundImage,s.appendChild(o),e.style.backgroundPosition="-"+a.target.x+"px -"+a.target.y+"px",e.style.transitionDuration=i+"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 a=s.querySelector(this.overwittenItemSelector);a&&s.removeChild(a)}isDead(){return this._status.energy<=0}addItem(t,e=0,s=!1,a){var i,r,o,_=this._wwa.getObjectAttributeById(t,W.ATR_NUMBER),h=0;if(0===e&&0!==_&&(e=_),0===e){if(0===t)return;if((i=this._getBlankItemPos())===W.ITEMBOX_IS_FULL)throw new Error("これ以上、アイテムを持てません。");h=this._itemBox[i-1],this._forceSetItemBox(i,t)}else if(!1===s)if(i=e,o=this._itemBox[i-1],this._wwa.getObjectAttributeById(o,W.ATR_NUMBER)!==this._wwa.getObjectAttributeById(t,W.ATR_NUMBER)){if((r=this._getBlankItemPos())===W.ITEMBOX_IS_FULL)throw new Error("これ以上、アイテムを持てません。");this._forceSetItemBox(r,o),this._forceSetItemBox(i,t)}else h=this._itemBox[i-1],this._forceSetItemBox(i,t);else i=e,h=this._itemBox[i-1],this._forceSetItemBox(i,t);this._updateEquipmentStatus(),this.updateItemBox(a?{insertPos:i,itemScreenPixelCoord:a.screenPixelCoord,itemBoxBackgroundImageCoord:a.itemBoxBackgroundImageCoord,itemBoxScreenPixelCoord:new n(W.MAP_WINDOW_WIDTH+(i-1)%3*W.CHIP_SIZE,W.ITEMBOX_TOP_Y+Math.floor((i-1)/3)*W.CHIP_SIZE),overwrittenObjectId:h}:void 0)}_forceSetItemBox(t,e){var s=this,i=dt("#item"+(t-1)+">.item-click-border"),r=this._wwa.getObjectAttributeById(e,W.ATR_MODE);if(this.removeItemByItemPosition(t),this._itemBox[t-1]=e,0!==e&&r!==p.NORMAL){const e=this._wwa.resolveSystemMessage(a.ITEM_SELECT_TUTORIAL);this._isClickableItemGot||("BLANK"!==e&&this._wwa.generatePageAndReserveExecution(e,!1,!0),this._isClickableItemGot=!0),i.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),i.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 W.ITEMBOX_IS_FULL}_updateEquipmentStatus(){var t,e=new r(0,0);for(t=0;t<W.ITEMBOX_SIZE;t++)0!==this._itemBox[t]&&(e.strength+=this._wwa.getObjectAttributeById(this._itemBox[t],W.ATR_STRENGTH),e.defence+=this._wwa.getObjectAttributeById(this._itemBox[t],W.ATR_DEFENCE));var s=e.minus(this._equipStatus);this._wwa.setStatusChangedEffect(s),this._equipStatus=e,this.updateStatusValueBox()}hasItem(t){for(var e=0;e<W.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,W.ATR_MODE)!==p.NORMAL}useItem(){var t;t=this._itemBox[this._readyToUseItemPos-1],this._wwa.getObjectAttributeById(t,W.ATR_MODE)!==p.NOT_DISAPPEAR&&this.removeItemByItemPosition(this._readyToUseItemPos);var e=lt("item"+(this._readyToUseItemPos-1));return setTimeout((()=>{e.classList.contains("onpress")&&e.classList.remove("onpress")}),W.DEFAULT_FRAME_INTERVAL),this._isReadyToUseItem=!1,this._readyToUseItemPos=void 0,t}canHaveMoreItems(){return this._getBlankItemPos()!==W.ITEMBOX_IS_FULL}removeItemByItemPosition(t){var e;0!==this._itemBox[t-1]&&(this._wwa.getObjectAttributeById(this._itemBox[t-1],W.ATR_MODE)!==p.NORMAL&&((e=dt("#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<W.ITEMBOX_SIZE;s++)if(this._itemBox[s]===t)return this._wwa.getObjectAttributeById(this._itemBox[s],W.ATR_MODE)!==p.NORMAL&&((e=dt("#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<=W.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=W.BATTLE_INTERVAL_FRAME_NUM,this._battleTurnNum=0,this._enemy=t,this._state=yt.BATTLE}isFighting(){return this._state===yt.BATTLE}isTurn(){return this._isPlayerTurn}getTurnNum(){return this._battleTurnNum}isBattleStartFrame(){return this._battleFrameCounter===W.BATTLE_INTERVAL_FRAME_NUM&&0===this._battleTurnNum}fight(){if(!this.isFighting())throw new Error("バトルが開始されていません。");if(0===this._battleTurnNum&&this._battleFrameCounter===W.BATTLE_INTERVAL_FRAME_NUM&&this._wwa.showMonsterWindow(),!(--this._battleFrameCounter>0)){this._battleTurnNum++,this._wwa.isBattleSpeedIndexForQuickBattle(this._speedIndex)||this._battleTurnNum>W.BATTLE_SPEED_CHANGE_TURN_NUM?(1===this._battleTurnNum&&(this._wwa.playSound(L.ATTACK),this._wwa.vibration(!1)),this._battleFrameCounter=1):(this._battleFrameCounter=W.BATTLE_INTERVAL_FRAME_NUM,this._wwa.playSound(L.ATTACK),this._wwa.vibration(!0));var t=this.getStatus(),e=this._enemy.status;if(this._isPlayerTurn){if(t.strength>e.defence||t.defence<e.strength)return e.energy>t.strength-e.defence?t.strength>e.defence&&this._enemy.damage(t.strength-e.defence):(this._wwa.playSound(this._wwa.getObjectAttributeById(this._enemy.partsID,W.ATR_SOUND)),this.earnGold(e.gold),this._wwa.setStatusChangedEffect(new o(0,0,0,e.gold)),0!==this._enemy.item?this._wwa.setPartsOnPosition(g.OBJECT,this._enemy.item,this._enemy.position):this._wwa.setPartsOnPosition(g.OBJECT,0,this._enemy.position),this._wwa.reserveAppearPartsInNextFrame(this._enemy.position,w.OBJECT,this._enemy.partsID),this._state=yt.CONTROLLABLE,this._wwa.generatePageAndReserveExecution(this._enemy.message,!1,!1,this._enemy.partsID,g.OBJECT,this._enemy.position),this._enemy.battleEndProcess(),this._battleTurnNum=0,this._enemy=null),void(this._isPlayerTurn=!1);this._enemy.battleEndProcess();const s=this._wwa.resolveSystemMessage(a.CANNOT_DAMAGE_MONSTER);"BLANK"!==s&&this._wwa.generatePageAndReserveExecution(s,!1,!0),this._battleTurnNum=0,this._enemy=null}else e.strength>t.defence&&(t.energy>e.strength-t.defence?this.damage(e.strength-t.defence):(this.setEnergy(0),this._enemy.battleEndProcess(),this._state=yt.CONTROLLABLE,this._battleTurnNum=0,this._enemy=null,this._wwa.shouldApplyGameOver({isCalledByMacro:!1})&&this._wwa.gameover()));this._isPlayerTurn=!0}}readyToUseItem(t){var e;if(!this.canUseItem(t))throw new Error("アイテムがないか、アイテムが使えません。");e=this._itemBox[t-1],this._wwa.getObjectAttributeById(e,W.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(),a=s.getPartsCoord(),i=s.getOffsetCoord(),r=(t.x-a.x)*W.CHIP_SIZE+e.x-i.x+W.CHIP_SIZE/2,o=(t.y-a.y)*W.CHIP_SIZE+e.y-i.y+W.CHIP_SIZE/2;return new n(r,o)}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=W.CHIP_SIZE/x[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(W.MAX_SPEED_INDEX,this._speedIndex+1)}speedDown(){return this._speedIndex=Math.max(W.MIN_SPEED_INDEX,this._speedIndex-1)}setSpeedIndex(t){if(t<W.MIN_SPEED_INDEX||W.MAX_SPEED_INDEX<t)throw new Error("#set_speed の引数が異常です:"+t);return this._speedIndex=t,this._speedIndex}constructor(t,e,s,a,i,o,n){super(e),this.itemTransitioningClassName="item-transitioning",this.overwittenItemClassName="item-overwritten",this.overwittenItemSelector=`.${this.overwittenItemClassName}`,this.itemEffectStartTimers=new Array(W.ITEMBOX_SIZE),this._status=a,this._equipStatus=new r(0,0),this._itemBox=new Array(W.ITEMBOX_SIZE),this._itemBoxElement=new Array(W.ITEMBOX_SIZE),this._itemUsingEvent=new Array(W.ITEMBOX_SIZE);for(var _=0;_<this._itemBox.length;_++)this._itemBox[_]=0,this._itemBoxElement[_]=dt("#item"+_+">.item-disp");this.updateItemBox(),this._energyMax=i,this._dir=u.DOWN,this._isMovingImage=!1,this._wwa=t,this._state=yt.CONTROLLABLE,this._camera=s,this._isPartsEventExecuted=!1,this._energyValueElement=dt("#disp-energy>.status-value-box"),this._strengthValueElement=dt("#disp-strength>.status-value-box"),this._defenceValueElement=dt("#disp-defence>.status-value-box"),this._goldValueElement=dt("#disp-gold>.status-value-box"),this._isReadyToUseItem=!1,this._isClickableItemGot=!1,this._moves=o,this._moveMacroWaitingRemainMoves=0,this._moveObjectAutoExecTimer=0,this.updateStatusValueBox(),this._partsAppeared=!1,this._afterMoveMacroFlag=!1,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=W.PLAYER_LOOKING_AROUND_START_FRAME,this._speedIndex=n,this._messageDelayFrameCount=0}}class Dt{constructor(t,e,s,a,i,r,o){this._partsID=t,this._position=e,this._imgCoord=s,this._status=a,this._message=i,this._item=r,this._battleEndCallback=o}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(){this._battleEndCallback()}}class Ct{constructor(t,e,s,a,i){this._player=t,this._objectID=e,this._srcPos=s,this._destPos=a,this._dir=i,this._currentPos=this._srcPos.clone()}update(){var t=this._player.getSpeedIndex();return this._currentPos=this._currentPos.getNextFramePosition(this._dir,x[t],x[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 ft{constructor(t,e){this._wwa=t,this._player=e,this.clear()}add(t,e,s,a){this._queue.push(new Ct(this._player,t,e,s,a))}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(g.OBJECT,0,this._queue[s].beforePosition.getPartsCoord()),this._wwa.setPartsOnPosition(g.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()}}function Nt(t,e,s=0){if("boolean"==typeof t)return t;const a=Pt(t.left,e,s),i=Pt(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,a,i)}function Pt(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":return e.userVars[t.index];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()*Pt(t.argument,e));case"ITEM_COUNT":return e.itemBox.filter((s=>s===Pt(t.argument,e))).length;default:return s}}function Mt(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("未定義の演算子です")}}const Rt="-?\\d+",Lt=`v\\[(${Rt})\\]`,bt=`m\\[${Rt}\\]\\[${Rt}\\]`,xt=`m\\[(${Rt})\\]\\[(${Rt})\\]`,Bt=`o\\[${Rt}\\]\\[${Rt}\\]`,Ut=`o\\[(${Rt})\\]\\[(${Rt})\\]`,Wt=`ITEM\\[${Rt}\\]`,Yt=`ITEM\\[(${Rt})\\]`,Ft=`${`v\\[${Rt}\\]`}|${bt}|${Bt}|${Wt}`,kt="HP|HPMAX|AT|DF|GD|STEP|PDIR",Vt=`${Ft}|${bt}|${Bt}|${Wt}|${kt}`,Gt=`${Rt}|${Ft}|AT_TOTAL|AT_ITEMS|DF_TOTAL|DF_ITEMS|TIME|X|Y|PX|PY|ID|TYPE|ITEM_COUNT_ALL|${kt}`,Ht=`RAND\\((${Gt})\\)`,Kt=`ITEM_COUNT\\((${Gt})\\)`,Xt=`${Gt}|${`${`RAND\\((?:${Gt})\\)`}|${`ITEM_COUNT\\((?:${Gt})\\)`}`}`,jt="\\+|\\-|\\*|\\/|%",Jt="^\\(",$t="\\)$",Zt=new RegExp(`^${Rt}$`),qt=new RegExp(`^${Lt}$`),Qt=new RegExp(`^${xt}$`),zt=new RegExp(`^${Ut}$`),te=new RegExp(`^${Yt}$`),ee=new RegExp(`^${Ht}$`),se=new RegExp(`${Kt}$`),ae=new RegExp(`${Jt}(${Vt})=(${Xt})(${jt})(${Xt})${$t}`),ie=new RegExp(`${Jt}(${Vt})(=|\\+=|\\-=|\\*=|\\/=|%=)(${Xt})${$t}`),re=new RegExp(`^(${Xt})(?:(${jt})(${Xt}))?$`),oe=new RegExp(`${Jt}(${Xt})(>|<|<=|>=|==|!=)(${Xt})${$t}`);function ne(t){return"RAND"!==t.type&&"ITEM_COUNT"!==t.type}function _e(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(qt);if(e){const t=he(e);return null===t?null:{type:"VARIABLE",index:t}}const s=t.match(Qt);if(s){const t=ce(s);return null===t?null:{type:"MAP",x:t[0],y:t[1]}}const a=t.match(zt);if(a){const t=ce(a);return null===t?null:{type:"OBJECT",x:t[0],y:t[1]}}const i=t.match(te);if(i){const t=he(i);return null===t?null:{type:"ITEM",boxIndex1To12:t}}if(t.match(Zt)){const e=parseInt(t,10);return null===e||isNaN(e)?null:{type:"NUMBER",rawValue:e}}const r=t.match(ee);if(r){const t=r.length>=2?_e(r[1]):null;return null!==t&&ne(t)?{type:"RAND",argument:t}:null}const o=t.match(se);if(o){const t=o.length>=2?_e(o[1]):null;return null!==t&&ne(t)?{type:"ITEM_COUNT",argument:t}:null}return null}}function he(t){const e=t.length>=2?Number(t[1]):null;return null===e||isNaN(e)?null:e}function ce(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 le(t,e){var s;switch(null===(s=_e(e))||void 0===s?void 0:s.type){case"VARIABLE":{const s=e.match(/^v\[(\d+)\]$/),a=Number(s[1]);if(null===a||isNaN(a))throw new Error("ユーザ変数の添字のパースに失敗しました");return{assignee:"variable",index:a,rawValue:t}}case"MAP":{const s=e.match(/^m\[(\d+)\]\[(\d+)\]$/),a=Number(s[1]),i=Number(s[2]);if(null===a||null===i||isNaN(a)||isNaN(i))throw new Error("背景パーツの添字のパースに失敗しました");return{assignee:"map",x:a,y:i,rawValue:t}}case"OBJECT":{const s=e.match(/^o\[(\d+)\]\[(\d+)\]$/),a=Number(s[1]),i=Number(s[2]);if(null===a||null===i||isNaN(a)||isNaN(i))throw new Error("物体パーツの添字のパースに失敗しました");return{assignee:"mapObject",x:a,y:i,rawValue:t}}case"ITEM":{const s=e.match(/^ITEM\[(\d+)\]$/),a=Number(s[1]);if(null===a||isNaN(a))throw new Error("アイテムの添字のパースに失敗しました");return{assignee:"item",boxIndex1to12:a,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 ue(t){return t.replace(/\s/g,"")}function de(t,e,s=0){return Pt(_e(t),e,s)}function Ee(t,e,s=0){const a=ue(t).match(re);if(null!==a){const t=de(a[1],e,s),i=a[3]?de(a[3],e,s):void 0,r=a[2];return r&&i?Mt(r,t,i):t}throw new Error("マクロ引数のフォーマットを満たしていません: "+t)}function me(t){const e=ue(t).match(oe);if(null===e||e.length<=3)return void console.error(`判定式が異常です: ${t}`);const s=_e(e[1]),a=_e(e[3]);if(s&&a)return{left:s,right:a,operator:e[2]};console.error(`判定式が異常です: ${t}`)}class we{constructor(t,e,s,a,i,r){this.firstNode=t,this.isLastPage=e,this.showChoice=s,this.isSystemMessage=a,this.scoreOptions=i,this.extraInfo=r}}class pe{constructor(){}}class ge extends pe{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||Nt(e.descriminant,t()))return e.next}hasElseBranch(){return this.branches.filter((t=>Boolean(t.elseBranch))).length>=1}}class Ae extends pe{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 Se(t){return void 0===t||(t instanceof ge?t.branches.reduce(((t,e)=>t&&Se(e.next)),!0):t instanceof Ae?t.isEmpty()&&Se(t.next):void 0)}const Te=t=>t===N.SHOW_STR||t===N.SHOW_STR2||"text"===t||"normalMacro"===t;class Ie{constructor(t,e,s,a,i,r){this._wwa=t,this._triggerPartsID=e,this._triggerPartsType=s,this._triggerPartsPosition=a,this.macroType=i,this.macroArgs=r}isJunction(){return[N.IF,N.ELSE_IF,N.ELSE,N.END_IF].includes(this.macroType)}execute(){try{switch(this.macroType){case N.IMGPLAYER:return this._executeImgPlayerMacro(),{};case N.IMGYESNO:return this._executeImgYesNoMacro(),{};case N.HPMAX:return this._executeHPMaxMacro(),{};case N.SAVE:return this._executeSaveMacro(),{};case N.ITEM:return this._executeItemMacro(),{};case N.DEFAULT:return this._executeDefaultMacro(),{};case N.OLDMAP:return this._executeOldMapMacro(),{};case N.PARTS:return this._executePartsMacro(),{};case N.MOVE:return this._executeMoveMacro(),{};case N.MAP:return this._executeMapMacro(1),{};case N.DIRMAP:return this._executeDirMapMacro(),{};case N.IMGFRAME:return this._executeImgFrameMacro(),{};case N.IMGBOM:return this._executeImgBomMacro(),{};case N.DELPLAYER:return this._executeDelPlayerMacro(),{};case N.FACE:return this._executeFaceMacro(),{};case N.EFFECT:return this._executeEffectMacro(),{};case N.GAMEOVER:return this._executeGameOverMacro(),{};case N.IMGCLICK:return this._executeImgClickMacro(),{};case N.STATUS:{const{isGameOver:t}=this._executeStatusMacro();return{isGameOver:t}}case N.EFFITEM:return this._executeEffItemMacro(),{};case N.COLOR:return this._executeColorMacro(),{};case N.WAIT:return this._executeWaitMacro(),{};case N.SOUND:return this._executeSoundMacro(),{};case N.GAMEPAD_BUTTON:return this._executeGamePadButtonMacro(),{};case N.OLDMOVE:return this._executeOldMoveMacro(),{};case N.JUMPGATE:return this._executeJumpGateMacro(),{};case N.RECPOSITION:return this._executeRecPositionMacro(),{};case N.JUMPRECPOSITION:return this._executeJumpRecPositionMacro(),{};case N.CONSOLE_LOG:return this._executeConsoleLogMacro(1),{};case N.COPY_HP_TO:return this._executeCopyHpToMacro(),{};case N.SET_HP:{const{isGameOver:t}=this._executeSetHPMacro();return{isGameOver:t}}case N.COPY_HPMAX_TO:return this._executeCopyHpMaxToMacro(),{};case N.SET_HPMAX:return this._executeSetHpMaxMacro(),{};case N.COPY_AT_TO:return this._executeCopyAtToMacro(),{};case N.SET_AT:return this._executeSetAtMacro(),{};case N.COPY_DF_TO:return this._executeCopyDfToMacro(),{};case N.SET_DF:return this._executeSetDfMacro(),{};case N.COPY_MONEY_TO:return this._executeCopyMoneyToMacro(),{};case N.SET_MONEY:return this._executeSetMoneyMacro(),{};case N.COPY_STEP_COUNT_TO:return this._executeSetStepCountMacro(),{};case N.VAR_SET_VAL:return this._executeVarSetValMacro(),{};case N.VAR_SET:return this._executeVarSetMacro(),{};case N.VAR_ADD:return this._executeVarAddMacro(),{};case N.VAR_SUB:return this._executeVarSubMacro(),{};case N.VAR_MUL:return this._executeVarMulMacro(),{};case N.VAR_DIV:return this._executeVarDivMacro(),{};case N.VAR_MOD:return this._executeVarModMacro(),{};case N.VAR_SET_RAND:return this._executeVarSetRandMacro(),{};case N.GAME_SPEED:return this._executeGameSpeedMacro(),{};case N.SHOW_STR:case N.SHOW_STR2:case N.IF:return{};case N.LEGACY_IF:return this._executeLegacyIfMacro(),{};case N.ELSE_IF:case N.ELSE:case N.END_IF:return{};case N.SET_SPEED:return this._executeSetSpeedMacro(),{};case N.COPY_TIME_TO:return this._executeCopyTimeToMacro(),{};case N.HIDE_STATUS:return this._executeHideStatusMacro(),{};case N.VAR_MAP:return this._executeVarMapMacro(),{};case N.NO_GAMEOVER:return this._executeNoGameOverMacro(),{};case N.SET:{const{isGameOver:t}=this._executeSetMacro();return{isGameOver:t}}case N.MAP2:return this._executeMapMacro(2),{};case N.CONSOLE_LOG2:return this._executeConsoleLogMacro(2),{};case N.DELAYBGM:return this._executeDelayBgmMacro(),{};case N.SYSMSG:return this._executeSysMsgMacro(),{};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 a=Number(s),i=a>=0?Math.floor(a):Math.ceil(a);return isNaN(i)?Ee(s,this._wwa.generateTokenValues({id:this._triggerPartsID,type:this._triggerPartsType,position:this._triggerPartsPosition}),e):i}_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],a=this._evaluateIntValue(3,g.OBJECT);if(t<0)throw new Error("入力変数が不正です");this._wwa.varMap(this._triggerPartsPosition,e,s,t,a)}_executeImgPlayerMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setPlayerImgCoord(new n(t,e))}_executeImgYesNoMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setYesNoImgCoord(new n(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,g.OBJECT),a=this._evaluateIntValue(3);if(s!==g.OBJECT&&s!==g.MAP)throw new Error("パーツ種別が不明です");if(0!==a&&1!==a&&(a=1),t<0||e<0)throw new Error("パーツ番号が不正です");if(s===g.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,!!a)}_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,g.OBJECT);if(e<0)throw new Error("パーツ番号が不正です");if(s===g.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],a=this.macroArgs[2];this._wwa.appearPartsEval(this._triggerPartsPosition,t,a,e,s)}else if(2===t){const t=this._evaluateIntValue(1),a=this._evaluateIntValue(2);if(isNaN(t)||isNaN(a))throw new Error("出現先座標が不正です");this._wwa.appearPartsEval(this._triggerPartsPosition,`${t}`,`${a}`,e,s)}}_executeDirMapMacro(){this._concatEmptyArgs(3);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2,g.OBJECT);if(isNaN(t)||isNaN(e)||isNaN(s))throw new Error("引数が整数ではありません");if(t<0)throw new Error("パーツ番号が不正です");if(s===g.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===R.ENERGY||t===R.STRENGTH||t===R.DEFENCE||t===R.GOLD)this._wwa.setStatusIconCoord(t,new n(e,s));else if(t===R.WIDE_CELL_ROW)this._wwa.setWideCellCoord(new n(e,s));else if(t===R.ITEM_BG)this._wwa.setItemboxBackgroundPosition({x:e,y:s});else{if(t!==R.MAIN_FRAME)throw new Error("種別が不正です。");this._wwa.setFrameCoord(new n(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 n(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),a=this._evaluateIntValue(2),i=this._evaluateIntValue(3),r=this._evaluateIntValue(4),o=this._evaluateIntValue(5);if(e<0||s<0||a<0||i<0||r<0||o<0)throw new Error("各引数は0以上の整数でなければなりません。");t=new h(new n(e,s),new n(a,i),new n(r,o)),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 a,i=this._evaluateIntValue(s);if(i<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");if(s+1===this.macroArgs.length)throw new Error("画像のパーツ座標指定で、Y座標が指定されていません。");if((a=this._evaluateIntValue(s+1))<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");e.push(new n(i,a))}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 n(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 n(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),a=this._evaluateIntValue(3);if(t<0||t>5)throw new Error("種別は0から5までです");if(e<0||e>255||s<0||s>255||a<0||a>255)throw new Error("色が範囲外です");this._wwa.changeStyleRule(t,e,s,a)}_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>W.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}})}_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(function(t){return e.some((e=>e===t))}(t))return t;return function(t){for(let s of e)if(i[s].code===t)return s}(this._evaluateIntValue(0))}}class ve{constructor(t,e,s,a,i,r,o){this._wwa=t,this._coord=e,this._width=s,this._height=a,this._isVisible=i,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=o+"",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 ye extends ve{constructor(t,e,s,a,i,r,o){super(t,new n(e.x,e.y),s,a,i,r,201),this._cgFileName=o,this._monsterBox=document.createElement("div"),this._monsterBox.style.width=W.CHIP_SIZE+"px",this._monsterBox.style.height=W.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 Oe extends ve{constructor(t,e,s,a){t.isClassicMode()?(super(t,new n(2*W.CHIP_SIZE,30),7*W.CHIP_SIZE,40,s,a,202),this._element.style.borderWidth="0",this._element.style.borderRadius="4px",this._element.style.fontSize="20px",this._element.style.lineHeight="40px"):super(t,new n(e.x,e.y),340,30,s,a,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 De,Ce;Oe.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"}(De||(De={}));class fe{constructor(t,e,s,a,i,r,o,n,_,h){this._wwaSave=void 0,this._save_select_id=0,this._save_counter=0,this._save_close=!1;var c=this,l=r.replace("(","\\(").replace(")","\\)");switch(this._wwa=t,this._cgFileName=r,this._x=e,this._y=s,this._width=a,this._height=i,this._message="",this._isVisible=o,this._isYesno=n,this._isItemMenu=_,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=h,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(){c._isInputDisable||(t.setYesNoInput(m.YES),c.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(){c._isInputDisable||(t.setYesNoInput(m.NO),c.update())},this._ynWrapperElement.appendChild(this._divYesElement),this._ynWrapperElement.appendChild(this._divNoElement),c._isInputDisable=!1,t.userDevice.device){case S.SP:case S.VR:this._parentElement.classList.add("useScaleUp")}this.update()}setPosition(t,e,s,a){this._x=t,this._y=e,this._width=s,this._height=a,this.update()}setPositionByPlayerPosition(t,e,s,a,i){var r,o=a.getPartsCoord().substract(i.getPartsCoord()).y;r=t?De.BOTTOM:e?De.SCORE:s?De.CENTER:o>=Math.ceil(W.V_PARTS_NUM_IN_WINDOW/2)?De.TOP:De.BOTTOM,this.setPositionEasy(r)}setPositionEasy(t){var e=Math.floor(this._element.clientHeight/2);return t===De.CENTER?(this._y=W.MAP_WINDOW_HEIGHT/2-e,void this.update()):t===De.TOP?(this._y=Math.max(20,W.MAP_WINDOW_HEIGHT/4-e)+10,void this.update()):t===De.BOTTOM?(this._y=Math.min(W.MAP_WINDOW_HEIGHT-20-this._element.clientHeight,3*W.MAP_WINDOW_HEIGHT/4-e),void this.update()):t===De.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,a="";for(let r=0;r<t.length||0!=s;r++)if(this.isWideChar(t.charAt(r))?s+=2:s+=1,a+=t.charAt(r),s+1>2*W.MSG_STR_WIDTH){"。"!==t.charAt(r+1)&&"、"!==t.charAt(r+1)||(a+=t.charAt(r+1),r++);var i=document.createElement("span");i.style.display="inline-block",i.style.width="100%",i.textContent=a,e.appendChild(i),s=0,a=""}return e}update(){var t=this._wwa.getYesNoImgCoord();this._isYesno?(this._wwa.getYesNoState()===m.YES?(this._divYesElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_YESP_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_NO_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px"):this._wwa.getYesNoState()===m.NO?(this._divYesElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_YES_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_NOP_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px"):(this._divYesElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_YES_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_NO_X)*W.CHIP_SIZE+"px -"+t.y*W.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 a;this._wwa.isClassicMode()?a=this.createClassicTextElement(t):(a=document.createElement("span"),a.textContent=e[s]),this._msgWrapperElement.appendChild(a),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,a,i,r,o,n,_,h,c;e=document.createElement("div"),h=(n=document.getElementById("disp-energy")).style.backgroundPosition,c=n.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()})),(a=document.createElement("div")).classList.add("ss"),s.appendChild(a),(i=document.createElement("div")).classList.add("wide-cell-row"),i.style.backgroundPosition=h,i.style.backgroundImage=c,s.appendChild(i),e.appendChild(s),t.flag&&(a.appendChild(t.cvs),(r=document.createElement("span")).textContent=t.getDateText(),t.isLastSaveData()&&(r.style.color=Y.DATE_LAST_SAVE_TEXT_COLOR),a.appendChild(r),(o=document.createElement("div")).classList.add("status-icon"),o.style.backgroundImage=c,o.style.backgroundPosition="-120px -80px",i.appendChild(o),(_=document.createElement("div")).classList.add("status-value-box"),_.textContent=t.getStatusEnergy(),i.appendChild(_));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"),a=s.length,i=0;i<a;i++)e=s[i],t===i?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=W.CONTROLL_WAIT_FRAME}saveControll(t){if(!(this._save_counter>0||this._isInputDisable)){switch(t){case u.DOWN:this._save_select_id-=2,this.cursor_wait();break;case u.UP:this._save_select_id+=2,this.cursor_wait();break;case u.LEFT:this._save_select_id--,this.cursor_wait();break;case u.RIGHT:this._save_select_id++,this.cursor_wait()}this.setSaveID((this._save_select_id+Y.QUICK_SAVE_MAX)%Y.QUICK_SAVE_MAX)}}get windowName(){return"MessageWindow"}}class Ne{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.isNoEffect?this.damageDispElem.textContent="攻撃無効":s.isOverMaxTurn?this.damageDispElem.textContent="長期戦が予想されます":this.damageDispElem.textContent="予測ダメージ "+s.damage}}class Pe{constructor(t,e,s){var a;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 i=0;i<W.BATTLE_ESTIMATE_MONSTER_TYPE_MAX;i++)a=new Ne(i,this._imgFileName,this._element),this._edes.push(a),this._element.appendChild(a.elem);this._element.addEventListener("click",(()=>{this._wwa.hideBattleEstimateWindow()})),this._parent.appendChild(this._element)}update(t,e){for(var s=0;s<W.BATTLE_ESTIMATE_MONSTER_TYPE_MAX;s++)if(s>=e.length)this._edes[s].hide();else{var a=this._wwa.getObjectAttributeById(e[s],W.ATR_X),i=this._wwa.getObjectAttributeById(e[s],W.ATR_Y),r=new n(a,i),_=this._wwa.getObjectAttributeById(e[s],W.ATR_ENERGY),h=this._wwa.getObjectAttributeById(e[s],W.ATR_STRENGTH),c=this._wwa.getObjectAttributeById(e[s],W.ATR_DEFENCE),l=new o(_,h,c,0),u=Re(t,l);this._edes[s].setResult(r,l,u),this._edes[s].show()}}show(){this._element.style.display="block"}hide(){this._element.style.display="none"}}class Me{constructor(t,e,s){this.isNoEffect=t,this.isOverMaxTurn=e,this.damage=s}}function Re(t,e){var s=e.energy,a=t.strength-e.defence,i=Math.max(0,e.strength-t.defence),r=0,o=0;if(!(a>0))return new Me(!0,!1,0);for(;;){if(r++,(s-=a)<=0)return new Me(!1,!1,o);if(o+=i,r>1e4)return new Me(!1,!0,0)}}!function(t){t[t.SAVE=0]="SAVE",t[t.LOAD=1]="LOAD"}(Ce||(Ce={}));class Le{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=Ce.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===Ce.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===Ce.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 a=document.createElement("span");a.textContent=e[s],this._descriptionElement.appendChild(a),this._descriptionElement.appendChild(document.createElement("br"))}this._isVisible?this._element.style.display="block":this._element.style.display="none"}}function be(){return"ontouchstart"in window&&"ontouchend"in window&&"ontouchmove"in window}function xe(t,e,s){var a,i=document.createElement("style");i.type="text/css",i.setAttribute("id",W.WWA_STYLE_TAG_ID),(a="head",document.getElementsByTagName(a))[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="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="${W.SCREEN_WIDTH}" height="${W.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&&(lt("wwa-cover").style.backgroundImage=`url(${e})`,lt("wwa-cover").style.backgroundRepeat="no-repeat",lt("wwa-cover").style.backgroundPosition="0 0")}class Be{update(){this.counter>0&&this.counter--}cursor_wait(){this.counter=W.CONTROLL_WAIT_FRAME}allClear(){this.col=0,this.row=0,this.counter=0}controll(t){if(!(this.counter>0))switch(t){case u.DOWN:this.row<Be.ROW_MAX-1&&(this.row++,this.openView(),this.cursor_wait());break;case u.UP:this.row>0&&(this.row--,this.openView(),this.cursor_wait());break;case u.LEFT:this.col>0&&(this.col--,this.openView(),this.cursor_wait());break;case u.RIGHT:this.col<Be.COL_MAX-1&&(this.col++,this.openView(),this.cursor_wait())}}ok(){this.close();var t=null;(t=dt(Be.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<Be.COL_MAX;t++)for(e=0;e<Be.ROW_MAX;e++)(s=lt(Be.DOM_ID_TABLE[e][t])).classList.contains("onpress")&&s.classList.remove("onpress")}openView(){this.close();lt(Be.DOM_ID_TABLE[this.row][this.col]).classList.add("onpress")}init(){this.allClear(),this.openView()}constructor(){this.allClear()}}Be.ROW_MAX=8,Be.COL_MAX=3,Be.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"]],Be.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 Ue=s(705);function We(t){return`^ /${231*t+8310}P+>A[]`}function Ye(t){return(0,Ue.MD5)(t).toString()}var Fe="map",ke="mapObject",Ve="systemMessage",Ge="userVar",He={mapAttribute:!0,objectAttribute:!0,message:!0};class Ke{static compress(t){var e,s,a={};for(e in t)if(!He[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}a[e]=s}return a}static compressObject(t,e,s){var a,i,r,o;switch(t){case Fe:case ke:var n,_,h,c,l,u,d,E,m,w,p,g,A,S;for(l in a={},m={},E={},e)for(c in i=e[l],r=s[l],o={},_=-1,i)(d=i[c])!==r[c]&&(o[c]=d,void 0===m[d]&&(m[d]={}),void 0===(p=m[d])[l]&&(p[l]=[]),(A=p[l]).push(Number(c)));for(g in m)for(l in p=m[g],void 0===E[g]&&(E[g]={}),w=E[g],void 0===a[g]&&(a[g]=[]),_=-1,p)1===(A=p[l]).length?(void 0===w[u=A[0]]&&(w[u]=[]),(S=w[u]).push(Number(l))):(h=(n=Number(l))-_-1,_=n,a[g].push(this.getCompressArray(A),h));for(g in E)for(c in d=Number(g),_=-1,w=E[g])S=w[c],h=(n=Number(c))-_-1,_=n,1===S.length?a[g].push(h,S[0]):a[g].push(h,this.getCompressArray(S));var T=[];for(g in _=-1,a)h=(n=Number(g))-_-1,_=n,T.push(h,a[g]);return this._usingByteFlag&&JSON.stringify(T).length>=this._mapByteLength?this.compressMapAllObject(e,s,this._firstRandomMapObjectUtf8Table[t]):T;case Ve:var I;for(t in a={},e)I=e[t],s[t]!==I&&(a[t]=I);break;case Ge:return this.compressUserVars(e);default:return e}if(0!==Object.keys(a).length)return a}static compressUserVars(t){return t.map(((t,e)=>[e,t])).filter((([t,e])=>0!==e))}static compressMapAllObject(t,e,s){var a,i,r,o,n,_,h,c,l,u,d,E,m,w,p,g,A=this._restartData.mapWidth,S=new Uint8Array(this._mapByteLength),T=-1;for(r=0,o=0,_=0,h=0,p=0,d=[],w={},l=[],u=[],i=0;i<A;i++)for(a=0;a<A;a++)(c=t[i][a])!==e[i][a]&&(-1===T&&(T=o),S[o]=S[o]|1<<r,_=o,void 0===w[c]&&(w[c]=new je(c,p++)),w[c].count++),8===++r&&(r=0,o++);for(n in w)d[w[n].index]=w[n];for(E in d.sort(this.idSort),m={},d)m[c=d[E].id]=Number(E),l[E]=c;for(i=0;i<A;i++)for(a=0;a<A;a++)(c=t[i][a])!==e[i][a]&&(u[h++]=m[c]);if(s){for(g=S.length,T=-1,_=0,o=0;o<g;o++)S[o]=S[o]&~s[o],0!==S[o]&&(-1===T&&(T=o),_=o);-1===T&&(T=0,_=0)}return[T,S.subarray(T,_+1),l,this.indexListCompress(u,l.length)]}static indexListCompress(t,e){var s,a,i,r,o,n,_=[];for(r=t.length,a=0,s=0;s<r;s++){for(o=t[s],n=0,i=s+1;i<r&&o===t[i];i++)n++,s=i;switch(n){case 0:_[a++]=o;break;case 1:_[a++]=o,_[a++]=o;break;default:_[a++]=o,_[a++]=e+n}}return _}static idSort(t,e){return e.count-t.count}static getCompressArray(t){var e,s,a,i,r,o,n,_,h=[];for(e=-1,r=t.length,o=0,i=0;i<r;i++){for(s=(a=t[i])-e,n=0,_=i;_<r-1&&t[_]+1===t[_+1];)_++,n++;n<this.MIN_LOOP_COUNT?h[o++]=s:(i=_,a+=n,h[o++]=0,h[o++]=s,h[o++]=n-this.MIN_LOOP_COUNT),e=a}return h}static getDecompressArray(t){var e,s,a,i,r,o,n,_=[];for(e=-1,r=t.length,i=0,n=0;i<r;i++)if(0===(s=t[i])){for(o=(a=e+(s=t[++i]))+t[++i]+this.MIN_LOOP_COUNT;a<=o;a++)_[n++]=a;e=o}else a=e+s,_[n++]=a,e=a;return _}static decompress(t){var e,s,a;for(s in e=JSON.parse(JSON.stringify(this._restartData)),t){switch(typeof(a=t[s])){case"number":case"string":case"boolean":case"undefined":break;case"object":null!==a&&(a=this.decompressObject(s,a,e[s]));break;case"function":continue}e[s]=a}return[e,{isWorldNameEmpty:void 0===t.worldName}]}static decompressObject(t,e,s){var a;switch(t){case Fe:case ke:var i,r,o,n,_,h,c,l;a={},r=-1;var u,d,E=e;if(4===(l=E.length)&&"number"==typeof E[0]&&(E[1]instanceof Uint8Array||E[1]instanceof Array)&&E[2]instanceof Array&&E[3]instanceof Array)return this.decompressAllMapObject(E,s,this._firstRandomMapObjectUtf8Table[t]),s;for(c=0;c<l;c+=2)r=i=r+Number(E[c])+1,_=i,a[i]=E[c+1];for(h in a){for(_=Number(h),l=(E=a[h]).length,u=[],d=[],c=0;c<l;c+=2){var m=E[c],w=E[c+1];m instanceof Array&&(m=this.getDecompressArray(m)),w instanceof Array&&(w=this.getDecompressArray(w)),"object"==typeof m?u.push({x:m,y:w}):d.push({x:m,y:w})}var p;for(p in r=-1,u)if(r=i=r+Number(u[p].y)+1,m=u[p].x,n=String(i),m instanceof Array)for(l=(E=m).length,c=0;c<l;c++)o=String(E[c]),s[n][o]=_;else o=String(m),s[n][o]=_;for(p in r=-1,d)if(r=i=r+Number(d[p].x)+1,w=d[p].y,o=String(i),w instanceof Array)for(l=(E=w).length,c=0;c<l;c++)s[n=String(E[c])][o]=_;else s[n=String(w)][o]=_}return s;case Ge:return this.decompressUserVars(e);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(W.USER_VAR_NUM);for(let e=0;e<W.USER_VAR_NUM;e++)t[e]=0;return t}static decompressAllMapObject(t,e,s){var a,i,r,o,n,_,h,c,l,u,d,E=this._restartData.mapWidth,m=new Uint8Array(this._mapByteLength);d=t[0],o=t[2],i=t[3];var w=t[1];if(m.set(w,d),s)for(p=m.length,l=0;l<p;l++)m[l]=m[l]|s[l];r=[];var p,g,A,S,T,I,v=o.length;for(p=i.length,g=0,A=0;g<p;g++){if((n=i[g])>=v)for(S=n-v,T=0;T<S;T++)r[A++]=I;else r[A++]=n;I=n}for(c=0,l=0,u=0,_=0,p=m.length,l=0;l<p;l++)for(c=0;c<8;c++){if(m[l]&1<<c){if(void 0===(n=r[_++]))return!1;a=o[n],h=u%E,e[u/E|0][h]=a}u++}return!0}static setRestartData(t,e){this._restartData=t,this._mapByteLength=Math.ceil(t.mapWidth*t.mapWidth/8),this._firstRandomMapObjectUtf8Table[ke]=this.getChangedUint8Array(e[ke],t[ke])}static getChangedUint8Array(t,e){var s,a,i,r,o=this._restartData.mapWidth,n=new Uint8Array(this._mapByteLength),_=-1;for(i=0,r=0,a=0;a<o;a++)for(s=0;s<o;s++)t[a][s]!==e[a][s]&&(-1===_&&(_=r),n[r]=n[r]|1<<i),8===++i&&(i=0,r++);return n}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}}Ke._usingByteFlag=!1,Ke.MIN_LOOP_COUNT=3,Ke._restartData=void 0,Ke._mapByteLength=0,Ke._firstRandomMapObjectUtf8Table=new class{};var Xe=Ke;class je{constructor(t,e){this.id=0,this.index=0,this.count=0,this.id=t,this.index=e}}class Je{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=Y.QUICK_SAVE_THUMNAIL_WIDTH,this.cvs.height=Y.QUICK_SAVE_THUMNAIL_HEIGHT,this.ctx=this.cvs.getContext("2d",{alpha:!1})}showQickLoad(){lt("cell-load").textContent=F.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 a=document.createElement("img");a.src=t,a.addEventListener("load",(()=>{this.flag=!0,this.ctx.drawImage(a,0,0,a.width,a.height,0,0,this.cvs.width,this.cvs.height)})),this.showQickLoad()}catch(t){}}getDateText(){let t,e,s,a,i,r;return this.date?(t=this.date.getFullYear(),e=this.date.getMonth()+1,s=this.date.getDate(),a=this.date.getHours(),i=this.date.getMinutes(),r=this.date.getSeconds(),t=("000"+t).slice(-4),e=("0"+e).slice(-2),s=("0"+s).slice(-2),a=("0"+a).slice(-2),i=("0"+i).slice(-2),r=("0"+r).slice(-2),t+"/"+e+"/"+s+" "+a+":"+i+":"+r):""}isLastSaveData(){return this===this._parent.getLastSaveData()}}class $e extends Je{save(t,e){var s=super.save.apply(this,arguments);return this._parent.dbUpdateSaveData(this._id,t,e,this.date),s}}class Ze extends Array{constructor(){super(),Object.setPrototypeOf(this,Object.create(Ze.prototype))}hasSaveData(){for(var t=0;t<Y.QUICK_SAVE_MAX;t++)if(this[t].flag)return!0;return!1}getLastSaveData(){for(var t,e,s=0;s<Y.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 qe=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 Qe extends Ze{constructor(t,e,s=Qe.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 a=0;a<Y.QUICK_SAVE_MAX;a++)this[a]=new $e(a,this);this.onCheckLoadingSaveData=t,this.onCompleteLoadingSaveData=e,this.createDataBase(),this.selectSaveData()}indexDBOpen(){return indexedDB.open(Y.INDEXEDDB_DB_NAME,201205201)}createDataBase(){try{var t=this.indexDBOpen();t.onupgradeneeded=e=>{var s=t.result,a={keyPath:this.keyPath};s.objectStoreNames.contains(Y.INDEXEDDB_TABLE_NAME)||s.createObjectStore(Y.INDEXEDDB_TABLE_NAME,a).createIndex("url","url",{unique:!1})},t.onsuccess=Qe.doNotAnything,t.onerror=Qe.doNotAnything,t.onblocked=Qe.doNotAnything}catch(t){}}getObjectStore(t){const e=t;try{var s=e.transaction(Y.INDEXEDDB_TABLE_NAME,this.IDBTransaction.READ_WRITE).objectStore(Y.INDEXEDDB_TABLE_NAME)}catch(t){return}return s}makeSaveDataItem(t,e,s,a){return{url:location.href,id:t,hash:is.checkOriginalMapString,image:e.toDataURL(),data:s,date:a,worldName:is.worldName,mapDataRevisionKey:is.mapDataRevisionKey}}getSaveDataResult(t,e){const s=t.index("url"),a=IDBKeyRange.only(location.href),i=s.getAll(a);i.onsuccess=()=>{e(i.result)}}dbUpdateSaveData(t,e,s,a){const i=this.indexDBOpen();i.onupgradeneeded=Qe.doNotAnything,i.onsuccess=()=>{const r=this.getObjectStore(i.result),o=Xe.compress(s),n=this.makeSaveDataItem(t,e,o,a);this.selectDatas[t]=n;const _=r.put(n);_.onsuccess=Qe.doNotAnything,_.onerror=Qe.doNotAnything},i.onerror=Qe.doNotAnything,i.onblocked=Qe.doNotAnything}dbDeleteSaveData(t){const e=this.indexDBOpen();e.onupgradeneeded=Qe.doNotAnything,e.onsuccess=()=>{const s=this.getObjectStore(e.result);t.forEach((t=>{s.delete([t,location.href])}))},e.onerror=Qe.doNotAnything,e.onblocked=Qe.doNotAnything}selectSaveData(){const t=this.indexDBOpen();t.onupgradeneeded=Qe.doNotAnything,t.onsuccess=()=>{const e=this.getObjectStore(t.result);this.selectDatas=[];this.getSaveDataResult(e,(t=>{var e,s,a;let i=[];for(s=t.length,e=0;e<s;e++){var r=t[e];try{a={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(a.worldName,a.hash,a.mapDataRevisionKey);if(null!==s){i.push({id:a.id,cause:s});continue}if(!this[a.id])continue;const o=qe(Xe.decompress(a.data)[0]);this[a.id].saveDataSet(a.image,o,a.date)}i.length>0&&this.dbDeleteSaveData(i.map((t=>t.id)));const o=i.map((t=>t.cause)).filter(((t,e,s)=>s.indexOf(t)===e));this.onCompleteLoadingSaveData(o)}))},t.onerror=Qe.doNotAnything,t.onblocked=Qe.doNotAnything}}Qe.doNotAnything=()=>{};var ze,ts=Qe;class es extends Je{}class ss extends Ze{constructor(){super(),this._saveNo=0,this._lastAutoSaveMove=0,this._autoInterval=Y.SAVE_INTERVAL_MOVE,Object.setPrototypeOf(this,Object.create(ss.prototype));for(var t=0;t<Y.QUICK_SAVE_MAX;t++)this[t]=new es(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%Y.QUICK_SAVE_MAX}setAutoSaveInterval(t){t<0?console.warn(`オートセーブの歩数 (${t}) に負の値が設定されています。`):this._autoInterval=0|t}}function as(t,e){return(0,Ue.MD5)(t+e).toString()}class is{constructor(t,e,s,a,i){is.checkOriginalMapString=t.checkOriginalMapString,is.worldName=e,is.mapDataRevisionKey=as(e,s),this._wwaDBSaveList=new ts(a,i),this._wwaLogSaveList=new ss,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 a=this.list[s];return!!a&&a.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?I.CALL_BY_PASSWORD_LOAD:this._wwaDBSaveList.hasSaveData()?I.CALL_BY_QUICK_LOAD:this._wwaLogSaveList.hasSaveData()?I.CALL_BY_LOG_QUICK_LOAD:I.CALL_BY_PASSWORD_LOAD}getSecondSaveChoiceCallInfo(t){return this.list===this._wwaDBSaveList&&this._wwaLogSaveList.hasSaveData()?I.CALL_BY_LOG_QUICK_LOAD:t?I.CALL_BY_PASSWORD_LOAD:I.NONE}gameStart(t,e){this._wwaLogSaveList.setPlayer(e),this.quickSaveButtonUpdate(t)}quickSaveButtonUpdate(t){t.disableSaveFlag?lt("cell-save").textContent=F.EMPTY_SAVE:lt("cell-save").textContent=F.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"}(ze||(ze={}));class rs{constructor(t,e,s,a){this.id=t,this.fileName=e,this.audioContext=s,this.audioGain=a,this.disposeBufferSource=t=>{try{t.stop(),t.disconnect(this.audioGain),t.buffer=null}catch(t){}t.onended=null},this.audioContext=s,this.audioGain=a,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>=L.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 os=(t,e)=>{const s=new Array(t);for(let t=0;t<s.length;t++)s[t]=new Array(e);return s};var ns,_s,hs;function cs(t,e){const s=function(t){return t[ns.CHECK]+256*t[ns.CHECK+1]}(t),a=function(t,e){let s=0;if(t[ns.VERSION]>=29){for(let i=2;i<e;i++)s+=(a=t[i],((a%=256)>=128?a-256:a)*(i%8+1));s=s%65536&65535}var a;return s}(t,e);if(s!==a)throw new Error("マップデータが壊れているようです。\n チェックサムの値は"+s+"ですが、実際の和は"+a+"でした。")}!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"}(ns||(ns={}));class ls{}ls.ITEMBOX_SIZE=12,ls.MAP_ATR_MAX=60,ls.OBJ_ATR_MAX=60,ls.OLD_MAP_ATR_MAX=40,ls.OLD_OBJ_ATR_MAX=40,ls.ATR_CROP1=1,ls.ATR_CROP2=2,ls.ATR_TYPE=3,ls.ATR_JUMP_X=16,ls.ATR_JUMP_Y=17,ls.MAP_LOCALGATE=2,ls.OBJECT_LOCALGATE=18,ls.SYSTEM_MESSAGE_NUM=20,ls.IMGPOS_DEFAULT_YESNO_X=3,ls.IMGPOS_DEFAULT_YESNO_Y=1,ls.IMGPOS_DEFAULT_PLAYER_X=2,ls.IMGPOS_DEFAULT_PLAYER_Y=0,ls.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0,ls.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0,ls.IMGPOS_DEFAULT_STATUS_X=3,ls.IMGPOS_DEFAULT_STATUS_Y=2,ls.IMGRELPOS_ENERGY_ICON_X=0,ls.IMGRELPOS_STRENGTH_ICON_X=1,ls.IMGRELPOS_DEFENCE_ICON_X=2,ls.IMGRELPOS_GOLD_ICON_X=3,ls.IMGPOS_DEFAULT_WIDE_CELL_X=4,ls.IMGPOS_DEFAULT_WIDE_CELL_Y=3,ls.IMGPOS_DEFAULT_ITEMBOX_X=1,ls.IMGPOS_DEFAULT_ITEMBOX_Y=2,ls.IMGPOS_DEFAULT_FRAME_X=0,ls.IMGPOS_DEFAULT_FRAME_Y=1,ls.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3,ls.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3,ls.DEFAULT_DISABLE_SAVE=!1,ls.DEFAULT_OLDMAP=!1,ls.DEFAULT_OBJECT_NO_COLLAPSE=!1,ls.DEFAULT_FRAME_COLOR_R=255,ls.DEFAULT_FRAME_COLOR_G=255,ls.DEFAULT_FRAME_COLOR_B=255,ls.DEFAULT_FRAMEOUT_COLOR_R=96,ls.DEFAULT_FRAMEOUT_COLOR_G=96,ls.DEFAULT_FRAMEOUT_COLOR_B=96,ls.DEFAULT_STR_COLOR_R=0,ls.DEFAULT_STR_COLOR_G=0,ls.DEFAULT_STR_COLOR_B=0,ls.DEFAULT_STATUS_COLOR_R=0,ls.DEFAULT_STATUS_COLOR_G=0,ls.DEFAULT_STATUS_COLOR_B=0,ls.DEFAULT_MOVES=0,ls.DEFAULT_SPEED_INDEX=3,ls.USER_VAR_NUM=256;!function(t){t[t.MAP=1]="MAP",t[t.OBJECT=0]="OBJECT"}(_s||(_s={})),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"}(hs||(hs={}));class us{constructor(t,e,s){this.byteMapData=t,this.eventEmitter=s,cs(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,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:{}}}extractAllData(){var t,e;return this.wwaData.version=this.byteMapData[ns.VERSION],this._extractInitialParameters(),this.wwaData.version>=29?this.currentPosition=ns.MAPDATA_TOP:this.currentPosition=ns.OLD_MAPDATA_TOP,this.wwaData.map=this._getFieldDataFromBits(_s.MAP,this.wwaData.mapPartsMax).concat(),this.wwaData.mapObject=this._getFieldDataFromBits(_s.OBJECT,this.wwaData.objPartsMax).concat(),t=this.wwaData.version>29?ls.MAP_ATR_MAX:ls.OLD_MAP_ATR_MAX,e=this.wwaData.version>29?ls.OBJ_ATR_MAX:ls.OLD_OBJ_ATR_MAX,this.wwaData.mapAttribute=this._getPartsDataFromBits(_s.MAP,this.wwaData.mapPartsMax,t).concat(),this.wwaData.objectAttribute=this._getPartsDataFromBits(_s.OBJECT,this.wwaData.objPartsMax,e).concat(),this.wwaData.version<=29&&(this._convertAttributeV2toV3(_s.MAP),this._convertAttributeV2toV3(_s.OBJECT)),this._replaceAllRandomObjects(),this.wwaData}_convertAttributeV2toV3(t){var e,s,a;if(t==_s.MAP)e=this.wwaData.mapPartsMax,s=this.wwaData.mapAttribute,a=ls.MAP_LOCALGATE;else{if(t!=_s.OBJECT)throw new Error("謎のパーツ種別が指定されました");e=this.wwaData.objPartsMax,s=this.wwaData.objectAttribute,a=ls.OBJECT_LOCALGATE}for(var i=0;i<e;i++){for(var r=9;r>=0;r--){var o=255&s[i][20+2*r],n=s[i][20+2*r]>>8,_=255&s[i][20+2*r+1],h=s[i][20+2*r+1]>>8;250===_?_=9e3:_>100&&(_+=9840),250===h?h=9e3:h>100&&(h+=9840),s[i][20+4*r]=o,s[i][20+4*r+3]=n,s[i][20+4*r+1]=_,s[i][20+4*r+2]=h}s[i][ls.ATR_TYPE]===a&&(s[i][ls.ATR_JUMP_X]>100&&(s[i][ls.ATR_JUMP_X]+=9840),s[i][ls.ATR_JUMP_Y]>100&&(s[i][ls.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(ns.GAMEOVER_X),this.wwaData.gameoverY=this._get2BytesNumber(ns.GAMEOVER_Y),this.wwaData.playerX=this._get2BytesNumber(ns.PLAYER_X),this.wwaData.playerY=this._get2BytesNumber(ns.PLAYER_Y),this.wwaData.mapPartsMax=this._get2BytesNumber(ns.MAP_COUNT),this.wwaData.objPartsMax=this._get2BytesNumber(ns.OBJ_COUNT),this.wwaData.isOldMap=!1):(this.wwaData.gameoverX=this._get1ByteNumber(ns.OLD_GAMEOVER_X),this.wwaData.gameoverY=this._get1ByteNumber(ns.OLD_GAMEOVER_Y),this.wwaData.playerX=this._get1ByteNumber(ns.OLD_PLAYER_X),this.wwaData.playerY=this._get1ByteNumber(ns.OLD_PLAYER_Y),this.wwaData.mapPartsMax=this._get1ByteNumber(ns.OLD_MAP_COUNT),this.wwaData.objPartsMax=this._get1ByteNumber(ns.OLD_OBJ_COUNT),this.wwaData.isOldMap=!0),this.wwaData.statusEnergyMax=this._get2BytesNumber(ns.STATUS_ENERGY_MAX),this.wwaData.statusEnergy=this._get2BytesNumber(ns.STATUS_ENERGY),this.wwaData.statusStrength=this._get2BytesNumber(ns.STATUS_STRENGTH),this.wwaData.statusDefence=this._get2BytesNumber(ns.STATUS_DEFENCE),this.wwaData.statusGold=this._get2BytesNumber(ns.STATUS_GOLD),this._extractInitialItemData(),this.wwaData.mapWidth=this._get2BytesNumber(ns.MAP_SIZE),this.wwaData.messageNum=this._get2BytesNumber(ns.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?ns.ITEMBOX_TOP:ns.OLD_ITEMBOX_TOP;this.wwaData.itemBox=new Array(ls.ITEMBOX_SIZE);for(let e=0;e<ls.ITEMBOX_SIZE;e++)this.wwaData.itemBox[e]=this._get1ByteNumber(t+e)}_getFieldDataFromBits(t,e){var s,a,i;for(i=os(this.wwaData.mapWidth,this.wwaData.mapWidth),s=0;s<this.wwaData.mapWidth;s++)for(a=0;a<this.wwaData.mapWidth;a++)this.wwaData.version>29?(i[s][a]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(i[s][a]=this._get1ByteNumber(this.currentPosition),this.currentPosition+=1),(s*this.wwaData.mapWidth+a)%200==0&&this.emitProgress(s*this.wwaData.mapWidth+a,this.wwaData.mapWidth*this.wwaData.mapWidth,t===_s.MAP?hs.MAP_LOAD:hs.OBJ_LOAD),i[s][a]>=e&&(i[s][a]=0);return this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,t===_s.MAP?hs.MAP_LOAD:hs.OBJ_LOAD),i}_getPartsDataFromBits(t,e,s){var a,i,r;for(r=os(e,s),a=0;a<e;a++)for(i=0;i<s;i++)(a*this.wwaData.mapWidth+i)%200==0&&this.emitProgress(a*s+i,e*s,t===_s.MAP?hs.MAP_ATTR:hs.OBJ_ATTR),i!==ls.ATR_CROP1&&i!==ls.ATR_CROP2?(r[a][i]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(r[a][i]=0,this.currentPosition+=2);return this.emitProgress(e*s,e*s,t===_s.MAP?hs.MAP_ATTR:hs.OBJ_ATTR),r}_replaceAllRandomObjects(){this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,hs.RAND_PARTS)}emitProgress(t,e,s){this.eventEmitter.dispatch("progress",{current:t,total:e,stage:s})}}class ds{constructor(t,e,s,a){this.wwaData=t,this.compressedMapData=e,this.startPosition=s,this.eventEmitter=a,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:hs.MESSAGE});for(;t.messageNum<10;)t.message.push(""),t.messageNum++;this.eventEmitter.dispatch("progress",{current:t.message.length,total:t.message.length,stage:hs.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(ls.SYSTEM_MESSAGE_NUM);for(let e=0;e<ls.SYSTEM_MESSAGE_NUM;e++)t.version>=30?t.systemMessage[e]=this.getMessageFromData():t.systemMessage[e]="";t.yesnoImgPosX=ls.IMGPOS_DEFAULT_YESNO_X,t.yesnoImgPosY=ls.IMGPOS_DEFAULT_YESNO_Y,t.playerImgPosX=ls.IMGPOS_DEFAULT_PLAYER_X,t.playerImgPosY=ls.IMGPOS_DEFAULT_PLAYER_Y,t.clickableItemSignImgPosX=ls.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X,t.clickableItemSignImgPosY=ls.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y,t.disableSaveFlag=ls.DEFAULT_DISABLE_SAVE,t.isOldMap=ls.DEFAULT_OLDMAP,t.isOldMove=t.version<31,t.objectNoCollapseDefaultFlag=ls.DEFAULT_OBJECT_NO_COLLAPSE,t.delPlayerFlag=!1,t.bgm=0,t.effectCoords=[],t.effectWaits=0,t.imgStatusEnergyX=ls.IMGPOS_DEFAULT_STATUS_X+ls.IMGRELPOS_ENERGY_ICON_X,t.imgStatusEnergyY=ls.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusStrengthX=ls.IMGPOS_DEFAULT_STATUS_X+ls.IMGRELPOS_STRENGTH_ICON_X,t.imgStatusStrengthY=ls.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusDefenceX=ls.IMGPOS_DEFAULT_STATUS_X+ls.IMGRELPOS_DEFENCE_ICON_X,t.imgStatusDefenceY=ls.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusGoldX=ls.IMGPOS_DEFAULT_STATUS_X+ls.IMGRELPOS_GOLD_ICON_X,t.imgStatusGoldY=ls.IMGPOS_DEFAULT_STATUS_Y,t.imgWideCellX=ls.IMGPOS_DEFAULT_WIDE_CELL_X,t.imgWideCellY=ls.IMGPOS_DEFAULT_WIDE_CELL_Y,t.imgItemboxX=ls.IMGPOS_DEFAULT_ITEMBOX_X,t.imgItemboxY=ls.IMGPOS_DEFAULT_ITEMBOX_Y,t.imgFrameX=ls.IMGPOS_DEFAULT_FRAME_X,t.imgFrameY=ls.IMGPOS_DEFAULT_FRAME_Y,t.imgBattleEffectX=ls.IMGPOS_DEFAULT_BATTLE_EFFECT_X,t.imgBattleEffectY=ls.IMGPOS_DEFAULT_BATTLE_EFFECT_Y,t.imgClickX=0,t.imgClickY=0,t.frameColorR=ls.DEFAULT_FRAME_COLOR_R,t.frameColorG=ls.DEFAULT_FRAME_COLOR_G,t.frameColorB=ls.DEFAULT_FRAME_COLOR_B,t.frameOutColorR=ls.DEFAULT_FRAMEOUT_COLOR_R,t.frameOutColorG=ls.DEFAULT_FRAMEOUT_COLOR_G,t.frameOutColorB=ls.DEFAULT_FRAMEOUT_COLOR_B,t.fontColorR=ls.DEFAULT_STR_COLOR_R,t.fontColorG=ls.DEFAULT_STR_COLOR_G,t.fontColorB=ls.DEFAULT_STR_COLOR_B,t.statusColorR=ls.DEFAULT_STATUS_COLOR_R,t.statusColorG=ls.DEFAULT_STATUS_COLOR_G,t.statusColorB=ls.DEFAULT_STATUS_COLOR_B,t.moves=ls.DEFAULT_MOVES,t.gameSpeedIndex=ls.DEFAULT_SPEED_INDEX,t.permitChangeGameSpeed=!0,t.userVar=new Array(ls.USER_VAR_NUM);for(let e=0;e<ls.USER_VAR_NUM;e++)t.userVar[e]=0;return t.playTime=0,t.isVisibleStatusEnergy=!0,t.isVisibleStatusStrength=!0,t.isVisibleStatusDefence=!0,t.isVisibleStatusGold=!0,t.gameOverPolicy="default",t.bgmDelayDurationMs=0,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 Es{constructor(){}}class ms extends Es{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 ms.fetch(this.uri);ms.handleError(this.uri,t);return await t.arrayBuffer()}}var ws=s(699),ps=s.n(ws);class gs extends Es{constructor(t){super(),this.fileName=t}async request(){return new Promise(((t,e)=>{ps().readFile(this.fileName,((s,a)=>{s&&e(s),t(a.buffer)}))}))}}class As{constructor(t,e){this.fileName=t,this.eventEmitter=e}async requestAndLoadMapData(){const t=(e=this.fileName,"undefined"!=typeof window?new ms(e):new gs(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:a,compressedEndPosition:i}=function(t){let e,s,a=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(a[s++]=t[e],t[e]===t[e+1]){const i=t[e+2];for(let r=0;r<i;r++)a[s++]=t[e];e+=2}if(s+255>=a.length){var i=new Uint8Array(a.length+65e3);i.set(a),a=i}}return console.log("EXTRACT DATA = "+s+" "+e),{byteMapData:a,byteMapLength:s,compressedEndPosition:e+3}}(e),r=new us(s,a,this.eventEmitter).extractAllData();return new ds(r,e,i,this.eventEmitter).load()}catch(t){throw t}}}class Ss{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)}}const Ts="user-variable-label";const Is="user-variable-card";function vs({index:t,value:e}){const s=document.createElement("div");return s.classList.add(Is),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(Ts),t}()),e}(t)),s.appendChild(function(t){const e=document.createElement("div");e.classList.add("value"),"string"==typeof t&&e.setAttribute("title",String(t));return ys(e,t),e}(e)),s}function ys(t,e){t.textContent=void 0===e?"-":String(e)}const Os="user-variable-list";function Ds({index:t,value:e}){const s=document.createElement("li");return s.appendChild(vs({index:t,value:e})),s}function Cs(t,{index:e,value:s}){t.appendChild(Ds({index:e,value:s}))}const fs="information";function Ns(t,e,s=!1){t.textContent=`${s?"【エラー】":""}${e}`}function Ps({heading:t,contentVisibilityToggleButton:e,information:s}){const a=document.createElement("header");return a.appendChild(function({heading:t,contentVisibilityToggleButton:e}){const s=document.createElement("div");s.classList.add("heading-area");const a=document.createElement("h2");a.textContent=t.text,s.appendChild(a);const i=document.createElement("button");i.classList.add("content-visibility-toggle-button"),Ms(i,!0),e.onClick&&i.addEventListener("click",e.onClick.bind(i));return s.appendChild(i),s}({heading:t,contentVisibilityToggleButton:e})),s&&a.appendChild(function(){const t=document.createElement("p");return t.classList.add(fs),Ns(t,"強調されている番号にカーソルを乗せると説明が表示されます。"),t}()),a}function Ms(t,e){t.textContent=e?"▲隠す":"▼表示"}const Rs="user-variable-list-section";function Ls({kind:t}){const e=document.createElement("section");e.classList.add(Rs),e.dataset.kind=t;const s=function({kind:t}){const e=document.createElement("ul");return e.classList.add(Os),"numbered"===t&&Array.from({length:W.USER_VAR_NUM}).map(((t,e)=>Ds({index:e}))).forEach((t=>e.appendChild(t))),e}({kind:t}),a=Ps({heading:{text:"named"===t?"名前つき変数一覧":"変数一覧"},information:"numbered"===t?{}:void 0,contentVisibilityToggleButton:{onClick:t=>{const e=a.querySelector(`.${fs}`);"true"===s.getAttribute("aria-hidden")?function(t,e,s){t.removeAttribute("aria-hidden"),e instanceof HTMLElement&&e.removeAttribute("aria-hidden");s instanceof HTMLElement&&Ms(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&&Ms(s,!1)}(s,e,t.target)}}});return e.appendChild(a),e.appendChild(s),e}function bs(t,e){t instanceof HTMLElement&&Array.from({length:W.USER_VAR_NUM}).map(((s,a)=>{const i=function(t,e){return t.querySelector(`${Ws(e)} > .value`)}(t,a);i instanceof HTMLElement&&ys(i,e[a])}))}function xs(t,e){t&&Array.from({length:W.USER_VAR_NUM}).map(((s,a)=>{const i=e[a];if(!i)return;const r=function(t,e){return t.querySelector(`${Ws(e)} > .index`)}(t,a);if(!(r instanceof HTMLElement))return;const o=r.querySelector(`.${Ts}`);o instanceof HTMLElement&&(function(t,e){t.textContent=e}(o,i),function(t,e){t.dataset.labelledVarIndex="true",t.addEventListener("mouseover",(()=>e.removeAttribute("aria-hidden"))),t.addEventListener("mouseleave",(()=>e.setAttribute("aria-hidden","true")))}(r,o))}))}function Bs(t,e,s=!1){if(!t)return;const a=function(t){return t.querySelector(`.${Us} > header > .${fs}`)}(t);a instanceof HTMLElement&&Ns(a,e,s)}const Us=`.${Rs}[data-kind="numbered"]`;function Ws(t){return`${Us} > .${Os} > li > .${Is}[data-var-index="${CSS.escape(String(t))}"]`}function Ys(t,e){if(!(t instanceof HTMLElement))return;const s=function(t){return t.querySelector(`${Fs} > .${Os}`)}(t);if(s instanceof HTMLElement)for(const[a,i]of e){const e=ks(t,a);e instanceof HTMLElement?ys(e,i):Cs(s,{index:a,value:i})}}const Fs=`.${Rs}[data-kind="named"]`;function ks(t,e){return t.querySelector(`${function(t){return`${Fs} > .${Os} > li > .${Is}[data-var-index="${CSS.escape(t)}"]`}(e)} > .value`)}let Vs;function Gs(t,e,s){var a=new k;return a.current=t,a.total=e,a.stage=s,a}class Hs{constructor(t,e=!1,s,i,r,h,c="",d=!1,E=null,w,p,g=!1,y=null){var O;this._useSuspend=!1,this._useLookingAround=!0,this._isDisallowLoadOldSave=!1,this.audioExtension="",this.soundLoadedCheckTimer=void 0,this._playTimeCalculator=void 0,this.mainCaller=()=>this._main(),this.soundCheckCaller=()=>this.checkAllSoundLoaded(),this._checkTurnKeyPressed=()=>this._keyStore.checkHitKey($.KEY_ESC)||this._keyStore.checkHitKey($.KEY_SHIFT)||this._keyStore.checkHitKey($.KEY_N),this._saveDataList=[],this.wwaCustomEventEmitter=new Ss(lt("wwa-wrapper")),window.addEventListener("click",(t=>{this._isActive=!1})),lt("wwa-wrapper").addEventListener("click",(t=>{t.stopPropagation(),this._isActive=!0})),this._isActive=!0,null===s?(this._hasTitleImg=!1,this._cvsCover=lt("progress-panel"),(O=this._cvsCover.getContext("2d")).fillStyle="rgb(0, 0, 0)"):this._hasTitleImg=!0;try{this._hasTitleImg?lt("version").textContent="WWA Wing Ver.3.12.20":this._setLoadingMessage(O,0)}catch(t){}this._dumpElement=E;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 C=new Audio;"no"!==C.canPlayType("audio/mpeg")&&""!==C.canPlayType("audio/mpeg")?this.audioExtension="mp3":this.audioExtension="m4a",this.userDevice=new f,this._isURLGateEnable=e,this._isClassicModeEnable=i,this._mainCallCounter=0,this._animationCounter=0,this._statusPressCounter=new o(0,0,0,0),c?"/"!==c[c.length-1]&&(c+="/"):c="./audio/",this._audioDirectory=c,this._bottomButtonType=h?l.GOTO_WWA:l.BATTLE_REPORT;var N=(new Date).getTime();if(!!location.href.match(/^file/))if(this.userDevice.device===S.GAME){if(this.userDevice.os===A.NINTENDO)W.BATTLE_INTERVAL_FRAME_NUM=5;this._bottomButtonType=l.GAME_END}else alert("【警告】直接HTMLファイルを開いているようです。\nこのプログラムは正常に動作しない可能性があります。\nマップデータの確認を行う場合には同梱の「wwa-server.exe」をご利用ください。\n"+(this.userDevice.browser===T.FIREFOX?"Firefoxの場合も、バージョン68以降はローカルのHTMLファイルを直接開いた場合、通常起動できないことを確認しております。":""));switch(this.userDevice.device){case S.VR:case S.GAME:this._usePassword=!1;break;default:this._usePassword=!0}switch(lt("cell-save").textContent=F.QUICK_SAVE,this._usePassword?lt("cell-load").textContent=F.PASSWORD:lt("cell-load").textContent=F.EMPTY_LOAD,this._bottomButtonType){case l.GOTO_WWA:lt("cell-gotowwa").textContent=F.GOTO_WWA;break;case l.BATTLE_REPORT:lt("cell-gotowwa").textContent=F.BATTLE_REPORT;break;case l.GAME_END:lt("cell-gotowwa").textContent=F.GAME_END}this._loadHandler=t=>{this._wwaData=t,this._wwaData.isItemEffectEnabled=r;try{this._hasTitleImg?lt("version").textContent+=" (Map data Ver. "+Math.floor(this._wwaData.version/10)+"."+ +this._wwaData.version%10+")":this._setLoadingMessage(O,1)}catch(t){}var e=lt("wwa-wrapper").getAttribute("data-wwa-mapdata").split("/");e.pop(),e.push(this._wwaData.mapCGName),this._wwaData.mapCGName=e.join("/"),this._playTimeCalculator=new rt,this._restartData=JSON.parse(JSON.stringify(this._wwaData)),this.checkOriginalMapString=this._generateMapDataHash(this._restartData),this.initCSSRule(),this._setProgressBar(Gs(0,4,V.GAME_INIT)),this._setLoadingMessage(O,2);var s=new Image;s.src=this._wwaData.mapCGName,s.addEventListener("error",(()=>{this._setErrorMessage("画像ファイル「"+this._wwaData.mapCGName+"」が見つかりませんでした。\n管理者の方へ: データがアップロードされているか、\nパーミッションを確かめてください。",O)}));var i=this._wwaData.mapCGName.replace("(","\\(").replace(")","\\)");const h=t=>{t.style.backgroundImage="url("+i+")"};Array.prototype.forEach.call(Et("div.item-cell"),(t=>{t.style.backgroundPosition=`-${this._wwaData.imgItemboxX*W.CHIP_SIZE}px -${this._wwaData.imgItemboxY*W.CHIP_SIZE}px`,t.style.backgroundImage="url("+i+")"})),Array.prototype.forEach.call(Et("div.wide-cell-row"),(t=>{t.style.backgroundPosition="-160px -120px",t.style.backgroundImage="url("+i+")"})),Array.prototype.forEach.call(Et(".item-cell>.item-click-border"),(t=>{t.style.backgroundImage="url('"+W.ITEM_BORDER_IMG_DATA_URL+"')",t.style.backgroundPosition="0 0",t.style.display="none",t.style.cursor="pointer"})),Array.prototype.forEach.call(Et(".item-cell>.item-disp"),h),Array.prototype.forEach.call(Et("div.wide-cell-row>.status-icon"),h),this.setStatusIconCoord(R.ENERGY,new n(this._wwaData.imgStatusEnergyX,this._wwaData.imgStatusEnergyY)),this.setStatusIconCoord(R.STRENGTH,new n(this._wwaData.imgStatusStrengthX,this._wwaData.imgStatusStrengthY)),this.setStatusIconCoord(R.DEFENCE,new n(this._wwaData.imgStatusDefenceX,this._wwaData.imgStatusDefenceY)),this.setStatusIconCoord(R.GOLD,new n(this._wwaData.imgStatusGoldX,this._wwaData.imgStatusGoldY)),this._setProgressBar(Gs(1,4,V.GAME_INIT)),this._setLoadingMessage(O,3),this._mapIDTableCreate(),this._replaceAllRandomObjects();var c=(new Date).getTime();console.log("Loading Complete!"+(c-N)+"ms"),this._cvs=lt("wwa-map");var l=this._cvs.getContext("2d",{alpha:!1});l.fillStyle="rgba( 255, 255, 255, 0.5)",l.fillRect(0,0,440,440);var E=new _(this,this._wwaData.playerX,this._wwaData.playerY);this._camera=new Tt(E),this._itemMenu=new Be;var w=new o(this._wwaData.statusEnergy,this._wwaData.statusStrength,this._wwaData.statusDefence,this._wwaData.statusGold);this._player=new Ot(this,E,this._camera,w,this._wwaData.statusEnergyMax,this._wwaData.moves,this._wwaData.gameSpeedIndex),this._objectMovingDataManager=new ft(this,this._player),this._camera.setPlayer(this._player),this._keyStore=new st,this._mouseStore=new at,g?(this._virtualPadButtonElements={BUTTON_ENTER:lt("wwa-enter-button"),BUTTON_ESC:lt("wwa-esc-button"),BUTTON_FAST:lt("wwa-fast-button"),BUTTON_SLOW:lt("wwa-slow-button"),BUTTON_LEFT:lt("wwa-left-button"),BUTTON_UP:lt("wwa-up-button"),BUTTON_RIGHT:lt("wwa-right-button"),BUTTON_DOWN:lt("wwa-down-button")},this._virtualPadStore=new ht(this._virtualPadButtonElements,be(),lt("wwa-virtualpad-right"),lt("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)}(y,(()=>{this._virtualPadStore.toggleVisible()}))):(this._virtualPadButtonElements=null,this._virtualPadStore=new ht({})),this._gamePadStore=new it,this._pages=[],this._yesNoJudge=m.UNSELECTED,this._yesNoJudgeInNextFrame=m.UNSELECTED,this._yesNoChoiceCallInfo=I.NONE,this._prevFrameEventExected=!1,this._isLastPage=!1,this._reservedPartsAppearances=[],this._reservedJumpDestination=void 0,this._shouldSetNextPage=!1,this._passwordLoadExecInNextFrame=!1,this._messageWindow=new fe(this,50,180,340,0,this._wwaData.mapCGName,!1,!0,!1,lt("wwa-wrapper")),this._scoreWindow=new Oe(this,new n(50,50),!1,lt("wwa-wrapper")),this._wwaSave=new is(Vs,Vs._wwaData.worldName,Vs._wwaData.worldPassNumber,this._checkSaveDataCompatibility.bind(this),(t=>{if(t.length>0){let e="これまでに保存されていたセーブデータは、下記の理由により消えたものがあります。";t.forEach((t=>{switch(t){case ze.UNMATCHED_WORLD_NAME:e+="\n・制作者によるマップデータのワールド名の変更";break;case ze.UNMATCHED_WORLD_PASS_NUMBER:e+="\n・制作者によるマップデータの暗証番号の変更";break;case ze.DISALLOW_OLD_REVISION_WORLD_SAVE_DATA:e+="\n・制作者によるマップデータの内容変更 (マップデータ制作者の設定により、内容が変更されるとセーブデータが消去されます)"}})),alert(e)}})),this._isDisallowLoadOldSave=d,this._messageWindow.setWWASave(this._wwaSave),Xe.setRestartData(this._restartData,this._wwaData),this.clearFaces();const T=lt("wwa-wrapper").getAttribute("data-wwa-resume-savedata");if("string"==typeof T&&(this._useSuspend=!0,T)){var D=Xe.getStartWWAData(T);this._restartData!==D&&(this._applyQuickLoad(D),this._wwaSave.resumeStart())}const C=lt("wwa-wrapper").getAttribute("data-wwa-autosave");null!==C&&this._wwaSave.setAutoSaveInterval(0|Number(C));const f=lt("wwa-wrapper").getAttribute("data-wwa-looking-around");if(this._useLookingAround=!(f&&f.match(/false/i)),this._setProgressBar(Gs(2,4,V.GAME_INIT)),this._setLoadingMessage(O,4),window.addEventListener("keydown",(t=>{if(this._isActive){if(this.userDevice.os===A.NINTENDO)return t.preventDefault(),void t.stopPropagation();this._keyStore.setPressInfo(t.keyCode),t.keyCode!==$.KEY_F5?this._player.isWaitingMessage()?t.keyCode!==$.KEY_DOWN&&t.keyCode!==$.KEY_LEFT&&t.keyCode!==$.KEY_RIGHT&&t.keyCode!==$.KEY_UP&&t.keyCode!==$.KEY_SHIFT&&t.keyCode!==$.KEY_ENTER&&t.keyCode!==$.KEY_ESC&&t.keyCode!==$.KEY_SPACE||t.preventDefault():this._player.isWaitingPasswordWindow()||t.keyCode!==$.KEY_DOWN&&t.keyCode!==$.KEY_LEFT&&t.keyCode!==$.KEY_RIGHT&&t.keyCode!==$.KEY_UP&&t.keyCode!==$.KEY_SHIFT&&t.keyCode!==$.KEY_ENTER&&t.keyCode!==$.KEY_1&&t.keyCode!==$.KEY_2&&t.keyCode!==$.KEY_3&&t.keyCode!==$.KEY_A&&t.keyCode!==$.KEY_C&&t.keyCode!==$.KEY_D&&t.keyCode!==$.KEY_E&&t.keyCode!==$.KEY_M&&t.keyCode!==$.KEY_N&&t.keyCode!==$.KEY_Q&&t.keyCode!==$.KEY_S&&t.keyCode!==$.KEY_W&&t.keyCode!==$.KEY_X&&t.keyCode!==$.KEY_Y&&t.keyCode!==$.KEY_Z&&t.keyCode!==$.KEY_ESC&&t.keyCode!==$.KEY_F1&&t.keyCode!==$.KEY_F2&&t.keyCode!==$.KEY_F3&&t.keyCode!==$.KEY_F4&&t.keyCode!==$.KEY_F6&&t.keyCode!==$.KEY_F7&&t.keyCode!==$.KEY_F8&&t.keyCode!==$.KEY_F12&&t.keyCode!==$.KEY_SPACE||t.preventDefault():t.preventDefault()}})),window.addEventListener("keyup",(t=>{if(this._isActive){if(this.userDevice.os===A.NINTENDO)return t.preventDefault(),void t.stopPropagation();this._keyStore.setReleaseInfo(t.keyCode),t.keyCode===$.KEY_F5?t.preventDefault():t.keyCode!==$.KEY_DOWN&&t.keyCode!==$.KEY_LEFT&&t.keyCode!==$.KEY_RIGHT&&t.keyCode!==$.KEY_UP&&t.keyCode!==$.KEY_SHIFT&&t.keyCode!==$.KEY_ENTER&&t.keyCode!==$.KEY_1&&t.keyCode!==$.KEY_2&&t.keyCode!==$.KEY_3&&t.keyCode!==$.KEY_A&&t.keyCode!==$.KEY_C&&t.keyCode!==$.KEY_D&&t.keyCode!==$.KEY_E&&t.keyCode!==$.KEY_M&&t.keyCode!==$.KEY_N&&t.keyCode!==$.KEY_Q&&t.keyCode!==$.KEY_S&&t.keyCode!==$.KEY_W&&t.keyCode!==$.KEY_X&&t.keyCode!==$.KEY_Y&&t.keyCode!==$.KEY_Z&&t.keyCode!==$.KEY_ESC&&t.keyCode!==$.KEY_F1&&t.keyCode!==$.KEY_F3&&t.keyCode!==$.KEY_F4&&t.keyCode!==$.KEY_F6&&t.keyCode!==$.KEY_F7&&t.keyCode!==$.KEY_F8&&t.keyCode!==$.KEY_F9&&t.keyCode!==$.KEY_F12&&t.keyCode!==$.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=lt("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=mt(t.clientX,t.clientY),s=this._player.getDrawingCenterPosition(),a=e.substract(s),i=Math.abs(a.x),r=Math.abs(a.y);let o,n=!1;if(i<W.CHIP_SIZE&&r<W.CHIP_SIZE){switch(s.x/W.CHIP_SIZE|0){case 0:n=!0,o=u.LEFT;break;case W.H_PARTS_NUM_IN_WINDOW-1:n=!0,o=u.RIGHT}switch(s.y/W.CHIP_SIZE|0){case 0:n=!0,o=u.UP;break;case W.V_PARTS_NUM_IN_WINDOW-1:n=!0,o=u.DOWN}}n||(a.y>0&&r>i?o=u.DOWN:a.y<0&&r>i?o=u.UP:a.x>0&&r<i?o=u.RIGHT:a.x<0&&r<i&&(o=u.LEFT)),this._mouseStore.setPressInfo(o,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],a=mt(s.clientX,s.clientY),i=this._player.getDrawingCenterPosition(),r=a.substract(i),o=Math.abs(r.x),n=Math.abs(r.y);let _,h=!1;if(o<W.CHIP_SIZE&&n<W.CHIP_SIZE){switch(i.x/W.CHIP_SIZE|0){case 0:h=!0,_=u.LEFT;break;case W.H_PARTS_NUM_IN_WINDOW-1:h=!0,_=u.RIGHT}switch(i.y/W.CHIP_SIZE|0){case 0:h=!0,_=u.UP;break;case W.V_PARTS_NUM_IN_WINDOW-1:h=!0,_=u.DOWN}}h||(r.y>0&&n>o?_=u.DOWN:r.y<0&&n>o?_=u.UP:r.x>0&&n<o?_=u.RIGHT:r.x<0&&n<o&&(_=u.LEFT)),this._mouseStore.setPressInfo(_,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)}lt("button-load").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(v.QUICK_LOAD)})),lt("button-save").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(v.QUICK_SAVE)})),lt("button-restart").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(v.RESTART_GAME)})),lt("button-gotowwa").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(v.GOTO_WWA,!1,!1)})),Array.prototype.forEach.call(Et(".wide-cell-row"),(t=>{t.addEventListener("click",(()=>{this._displayHelp()}))})),this._frameCoord=new n(W.IMGPOS_DEFAULT_FRAME_X,W.IMGPOS_DEFAULT_YESNO_Y),this._battleEffectCoord=new n(W.IMGPOS_DEFAULT_BATTLE_EFFECT_X,W.IMGPOS_DEFAULT_BATTLE_EFFECT_Y),this._battleEstimateWindow=new Pe(this,this._wwaData.mapCGName,lt("wwa-wrapper")),this._passwordWindow=new Le(this,lt("wwa-wrapper"),d),this._monsterWindow=new ye(this,new n(50,180),340,60,!1,lt("wwa-wrapper"),this._wwaData.mapCGName),this._setProgressBar(Gs(3,4,V.GAME_INIT)),this._isLoadedSound=!1,this._temporaryInputDisable=!1,this._paintSkipByDoorOpen=!1,this._clearFacesInNextFrame=!1,this._useConsole=!1,this.wwaCustomEvent("wwa_startup"),this._cgManager=new St(l,this._wwaData.mapCGName,this._frameCoord,(()=>{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(a.CONFIRM_LOAD_SOUND);if("ON"===e)return this._isLoadedSound=!0,t(),this._setLoadingMessage(O,V.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||O.clearRect(0,0,W.SCREEN_WIDTH,W.SCREEN_HEIGHT),this._usePassword){let t=e;p&&(t+='\n\n※変数表示が有効になっています。\n公開前に必ずHTMLファイル内の\n data-wwa-display-user-vars="true" \nを消してください。'),this._messageWindow.setMessage(t),this._messageWindow.show(),this._setProgressBar(Gs(4,4,V.GAME_INIT));var s=setInterval((()=>{this._keyStore.update(),this._gamePadStore.update(),this._virtualPadStore.update(),this._yesNoJudgeInNextFrame===m.UNSELECTED&&(this._keyStore.getKeyState($.KEY_ENTER)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_Y)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this._yesNoJudgeInNextFrame=m.YES:(this._keyStore.getKeyState($.KEY_N)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_ESC)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&(this._yesNoJudgeInNextFrame=m.NO)),this._yesNoJudgeInNextFrame===m.YES?(clearInterval(s),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout((()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=m.UNSELECTED,this._yesNoJudgeInNextFrame=m.UNSELECTED,this._isLoadedSound=!0,this._setLoadingMessage(O,V.AUDIO),this.loadSound(),window.requestAnimationFrame(this.soundCheckCaller)}),W.YESNO_PRESS_DISP_FRAME_NUM*W.DEFAULT_FRAME_INTERVAL)):this._yesNoJudgeInNextFrame===m.NO&&(clearInterval(s),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout((()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=m.UNSELECTED,this._yesNoJudgeInNextFrame=m.UNSELECTED,this._isLoadedSound=!1,this.openGameWindow()}),W.YESNO_PRESS_DISP_FRAME_NUM*W.DEFAULT_FRAME_INTERVAL))}),W.DEFAULT_FRAME_INTERVAL)}else clearInterval(s),this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=m.UNSELECTED,this._yesNoJudgeInNextFrame=m.UNSELECTED,this._isLoadedSound=!0,this.loadSound(),window.requestAnimationFrame(this.soundCheckCaller)})),this.wwaCustomEvent("wwa_start")};const P=new Ss;P.addListener("mapData",(t=>this._loadHandler(t))),P.addListener("progress",(t=>this._setProgressBar(t))),P.addListener("error",(t=>this._setErrorMessage("下記のエラーが発生しました。: \n"+t.message,O)));new As(t,P).requestAndLoadMapData().then((async()=>{if(this._canDisplayUserVars=p,this._userVarNameList=[],this._canDisplayUserVars)return this._inlineUserVarViewer={topUserVarIndex:0,isVisible:!1},w?(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} が壊れています。`}))))(w):{kind:"noFileSpecified",errorMessage:"data-wwa-user-var-names-file 属性に、変数の説明を記したファイル名を書くことで、その説明を表示できます。詳しくはマニュアルをご覧ください。"}})).then((t=>{if(t)if("noFileSpecified"!==t.kind){if("data"!==t.kind)return this._userVarNameListRequestError=t,void Bs(this._dumpElement,this._userVarNameListRequestError.errorMessage,!0);if(!t.data||"object"!=typeof t.data)return this._userVarNameListRequestError={kind:"notObject",errorMessage:`ユーザ変数一覧 ${w} が正しい形式で書かれていません。`},void Bs(this._dumpElement,this._userVarNameListRequestError.errorMessage,!0);this._userVarNameList=this.convertUserVariableNameListToArray(t.data),xs(this._dumpElement,this._userVarNameList)}else Bs(this._dumpElement,t.errorMessage,!1)}))}convertUserVariableNameListToArray(t){const e=new Array(W.USER_VAR_NUM);for(let t=0;t<W.USER_VAR_NUM;t++)e[t]=void 0;return Object.keys(t).forEach((s=>{const a=parseInt(s,10);"string"!=typeof t[s]||"string"!=typeof s||isNaN(a)||a<0||a>=W.USER_VAR_NUM||(e[a]=t[s])})),e}_setProgressBar(t){this._hasTitleImg&&(t.stage<=W.LOAD_STAGE_MAX_EXCEPT_AUDIO?(lt("progress-message-container").textContent=t.stage===W.LOAD_STAGE_MAX_EXCEPT_AUDIO?"World Name: "+this._wwaData.worldName:tt[t.stage],lt("progress-bar").style.width=(1*t.stage+t.current/t.total*1)/(W.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*W.MAP_WINDOW_WIDTH+"px",lt("progress-disp").textContent=((1*t.stage+t.current/t.total*1)/(W.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*100).toFixed(2)+"%"):(this._usePassword?lt("progress-message-container").textContent="効果音/BGMを読み込んでいます。(スペースキーでスキップ)":lt("progress-message-container").textContent="ゲームデータを読み込んでいます。",lt("progress-bar-audio").style.width=t.current*W.MAP_WINDOW_WIDTH/t.total+"px",lt("progress-disp").textContent=(t.current/t.total*100).toFixed(2)+"%"))}_setLoadingMessage(t,e){if(!this._hasTitleImg)if(e<=0)t.font=H.TITLE+"px "+W.LOADING_FONT,t.fillText(et[0],G.TITLE_X,G.TITLE_Y),t.font=H.FOOTER+"px "+W.LOADING_FONT,t.fillText("WWA Wing Ver.3.12.20",G.FOOTER_X,G.COPYRIGHT_Y);else if(e<=et.length)t.font=H.LOADING+"px "+W.LOADING_FONT,e>=2&&(t.clearRect(G.LOADING_X,G.LOADING_Y+G.LINE*(e-3),W.SCREEN_WIDTH-G.LOADING_X,G.LINE),t.fillText(et[e-1]+" Complete!",G.LOADING_X,G.LOADING_Y+G.LINE*(e-2))),e<et.length&&t.fillText(et[e],G.LOADING_X,G.LOADING_Y+G.LINE*(e-1)),1==e&&(t.font=H.FOOTER+"px "+W.LOADING_FONT,t.fillText("World Name "+this._wwaData.worldName,G.FOOTER_X,G.WORLD_Y),t.fillText(" (Map data Ver. "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10+")",G.FOOTER_X,G.WORLD_Y+G.LINE));else{var s;s=this._isSkippedSoundMessage?G.LOADING_Y+G.LINE*(et.length-1):G.FOOTER_Y,e<=V.AUDIO?t.fillText("Now Sound data Loading .....",G.LOADING_X,s):(t.clearRect(G.LOADING_X,s-G.LINE,W.SCREEN_WIDTH-G.LOADING_X,G.LINE),t.fillText("Now Sound data Loading ..... Complete!",G.LOADING_X,s))}}_setErrorMessage(t,e){this._hasTitleImg?alert(t):(e.clearRect(0,0,W.SCREEN_WIDTH,W.SCREEN_HEIGHT),e.font=H.ERRROR+"px "+W.LOADING_FONT,t.split("\n").forEach((function(t,s){e.fillText(t,G.ERROR_X,G.ERROR_Y+G.LINE*s)})))}createSoundInstance(t){if(0===t||t===L.NO_SOUND||this.sounds[t])return;const e=`${this._audioDirectory}${t}.${this.audioExtension}`;this.sounds[t]=new rs(t,e,this.audioContext,this.audioGain)}loadSound(){this.sounds=new Array(W.SOUND_MAX+1),this.createSoundInstance(L.DECISION),this.createSoundInstance(L.ATTACK);for(let t=1;t<this._wwaData.mapPartsMax;t++){const e=this._wwaData.mapAttribute[t][W.ATR_SOUND];this.createSoundInstance(e)}for(let t=1;t<this._wwaData.objPartsMax;t++){if(this._wwaData.objectAttribute[t][W.ATR_TYPE]===W.OBJECT_RANDOM)continue;const e=this._wwaData.objectAttribute[t][W.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<L.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($.KEY_SPACE)===J.KEYDOWN&&(this._soundLoadSkipFlag=!0);for(let s=1;s<=W.SOUND_MAX;s++){const a=this.sounds[s];void 0===a||a.isError()||(e++,a.hasData()&&t++)}if(t<e&&!this._soundLoadSkipFlag)return this._setProgressBar(Gs(t,e,V.AUDIO)),void window.requestAnimationFrame(this.soundCheckCaller);this._setProgressBar(Gs(W.SOUND_MAX,W.SOUND_MAX,V.AUDIO)),this._setLoadingMessage(s,V.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===L.NO_SOUND?this._wwaData.bgm=0:t>=L.BGM_LB&&(this._wwaData.bgm=t));if(t<0||t>=W.SOUND_MAX)return void console.warn("サウンド番号が範囲外です。");if(t>=L.BGM_LB&&this._wwaData.bgm===t)return;if((t===L.NO_SOUND||t>=L.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===L.NO_SOUND)return;this.sounds[t].hasData()?t>=L.BGM_LB?(this.sounds[t].play(null!=e?e:this._wwaData.bgmDelayDurationMs),this._wwaData.bgm=t):this.sounds[t].play():t>=L.BGM_LB&&(this._wwaData.bgm=t,this._setSoundLoadedCheckTimer(t))}openGameWindow(){var t=this._player.getPosition();lt("wwa-cover").style.opacity="0",0!==this.getObjectIdByPosition(t)&&this._player.setPartsAppearedFlag();var e=lt("wwa-wrapper").getAttribute("data-wwa-resume-savedata");if("string"==typeof e&&(this._useSuspend=!0,e)){var s=Xe.getStartWWAData(e);this._restartData!==s&&(this._applyQuickLoad(s),this._wwaSave.resumeStart())}setTimeout((()=>{lt("wwa-wrapper").removeChild(lt("wwa-cover")),this._main()}),W.SPLASH_SCREEN_DISP_MILLS)}onselectitem(t){if(this._player.canUseItem(t)){lt("item"+(t-1)).classList.add("onpress"),this.playSound(L.DECISION);const i=this.resolveSystemMessage(a.CONFIRM_USE_ITEM);if("BLANK"===i){this._player.readyToUseItem(t);var e=this._player.useItem(),s=this.getObjectAttributeById(e,W.ATR_STRING);this.generatePageAndReserveExecution(this.getMessageById(s),!1,!1,e,g.OBJECT,this._player.getPosition().getPartsCoord())}else this.generatePageAndReserveExecution(i,!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_ITEM_USE,this._yesNoUseItemPos=t;return!0}return!1}onselectbutton(t,e=!1,s=!1){var a=lt(P[t]);if(this.playSound(L.DECISION),this._itemMenu.close(),a.classList.add("onpress"),t===v.QUICK_LOAD)switch(this._yesNoChoiceCallInfo=this._wwaSave.getFirstSaveChoiceCallInfo(e),this._yesNoChoiceCallInfo){case I.CALL_BY_QUICK_LOAD:case I.CALL_BY_LOG_QUICK_LOAD:var i,r="";switch(this._yesNoChoiceCallInfo){case I.CALL_BY_QUICK_LOAD:r="読み込むデータを選んでください。",this._wwaSave.selectDBSaveDataList();break;case I.CALL_BY_LOG_QUICK_LOAD:r="読み込むオートセーブを選んでください。",this._wwaSave.selectLogSaveDataList()}switch(i=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._messageWindow.createSaveDom(),i){case I.CALL_BY_LOG_QUICK_LOAD:this.generatePageAndReserveExecution(r+"\n→Noでオートセーブ復帰画面に移ります。",!0,!0);break;case I.CALL_BY_PASSWORD_LOAD:this.generatePageAndReserveExecution(r+"\n→Noでデータ復帰用パスワードの\n 入力選択ができます。",!0,!0);break;case I.NONE:this.generatePageAndReserveExecution(r,!0,!0)}break;case I.CALL_BY_PASSWORD_LOAD:this.onpasswordloadcalled()}else if(t===v.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=I.CALL_BY_QUICK_SAVE):(this.generatePageAndReserveExecution("データの一時保存先を選んでください。",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_QUICK_SAVE));else if(t===v.RESTART_GAME)this.generatePageAndReserveExecution("初めからスタートしなおしますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_RESTART_GAME;else if(t===v.GOTO_WWA)if(s)this._bottomButtonType!==l.GOTO_WWA&<(P[v.GOTO_WWA]).classList.remove("onpress"),this.generatePageAndReserveExecution("WWAの公式サイトを開きますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_GOTO_WWA;else switch(this._bottomButtonType){case l.GOTO_WWA:this._yesNoChoiceCallInfo=I.CALL_BY_GOTO_WWA,this.generatePageAndReserveExecution("WWAの公式サイトを開きますか?",!0,!0);break;case l.GAME_END:this._yesNoChoiceCallInfo=I.CALL_BY_END_GAME,this.generatePageAndReserveExecution("WWAゲームを終了しますか?",!0,!0);break;case l.BATTLE_REPORT:this.launchBattleEstimateWindow()}}onpasswordloadcalled(){this._usePassword?(lt(P[v.QUICK_LOAD]).classList.add("onpress"),this.generatePageAndReserveExecution("データ復帰用のパスワードを入力しますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_PASSWORD_LOAD):this.generatePageAndReserveExecution("セーブデータがありません。",!1,!0)}onpasswordsavecalled(){lt(P[v.QUICK_SAVE]).classList.add("onpress"),this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):this._useSuspend?(this.generatePageAndReserveExecution("ゲームを中断しますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_SUSPEND):this._usePassword&&(this.generatePageAndReserveExecution("データ復帰用のパスワードを表示しますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_PASSWORD_SAVE)}onpasssuspendsavecalled(){lt(P[v.QUICK_SAVE]).classList.add("onpress"),this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):(this.generatePageAndReserveExecution("ゲームを中断しますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_SUSPEND)}onitemmenucalled(){this.generatePageAndReserveExecution("右のメニューを選択してください。",!1,!0),this._messageWindow.setItemMenuChoice(!0),this.playSound(L.DECISION),this._itemMenu.openView()}onchangespeed(t){if(!this._wwaData.permitChangeGameSpeed){const t=this.resolveSystemMessage(a.GAME_SPEED_CHANGE_DISABLED);return void("BLANK"!==t&&this.generatePageAndReserveExecution(t,!1,!0))}switch(t){case y.UP:this._player.speedUp();break;case y.DOWN:this._player.speedDown()}const e=this.resolveSystemMessage(a.GAME_SPEED_CHANGED);"BLANK"!==e&&this.generatePageAndReserveExecution(e,!1,!0)}isBattleSpeedIndexForQuickBattle(t){return W.QUICK_BATTLE_SPEED_INDECIES.some((e=>e===t))}_executeNode(t,e){var s;if(t instanceof Ae)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 ge){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())),a=Boolean(t.scoreOptions);a&&0===s.length&&s.push(new Ae("スコアを表示します。"));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,a,t.isSystemMessage,this._player.getPosition(),this._camera.getPosition()),a&&(this._lastScoreOptions=t.scoreOptions,this.updateScore(t.scoreOptions),this._scoreWindow.show()),this._player.setMessageWaiting(),this._isLastPage=t.isLastPage;break}if(0===this._pages.length){this._hideMessageWindow();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(I.CALL_BY_LOG_QUICK_SAVE),this._player.isDelayFrame())this._player.updateDelayFrame();else{const t=this._player.getDir(),e=[NaN,NaN,$.KEY_DOWN,NaN,$.KEY_LEFT,NaN,$.KEY_RIGHT,NaN,$.KEY_UP,NaN][t];this._actionGamePadButtonItemMacro()||(this._keyStore.getKeyStateForControllPlayer($.KEY_LEFT)===J.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer($.KEY_UP)===J.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer($.KEY_RIGHT)===J.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer($.KEY_DOWN)===J.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(u.LEFT)===Z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(u.UP)===Z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(u.RIGHT)===Z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(u.DOWN)===Z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(e)?this._checkTurnKeyPressed()?this._player.setDir(t):(this._player.controll(t),this._objectMovingDataManager.update()):this._keyStore.checkHitKey($.KEY_LEFT)?this._checkTurnKeyPressed()?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._keyStore.checkHitKey($.KEY_UP)?this._checkTurnKeyPressed()?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._keyStore.checkHitKey($.KEY_RIGHT)?this._checkTurnKeyPressed()?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._keyStore.checkHitKey($.KEY_DOWN)?this._checkTurnKeyPressed()?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(u.LEFT)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(u.UP)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(u.RIGHT)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(u.DOWN)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_LEFT)?this._gamePadStore.buttonPressed(Q.BUTTON_INDEX_B)?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_UP)?this._gamePadStore.buttonPressed(Q.BUTTON_INDEX_B)?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_RIGHT)?this._gamePadStore.buttonPressed(Q.BUTTON_INDEX_B)?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_DOWN)?this._gamePadStore.buttonPressed(Q.BUTTON_INDEX_B)?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_LEFT")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_UP")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_RIGHT")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_DOWN")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._keyStore.getKeyState($.KEY_1)===J.KEYDOWN?this.onselectitem(1):this._keyStore.getKeyState($.KEY_2)===J.KEYDOWN?this.onselectitem(2):this._keyStore.getKeyState($.KEY_3)===J.KEYDOWN?this.onselectitem(3):this._keyStore.getKeyState($.KEY_Q)===J.KEYDOWN?this.onselectitem(4):this._keyStore.getKeyState($.KEY_W)===J.KEYDOWN?this.onselectitem(5):this._keyStore.getKeyState($.KEY_E)===J.KEYDOWN?this.onselectitem(6):this._keyStore.getKeyState($.KEY_A)===J.KEYDOWN?this.onselectitem(7):this._keyStore.getKeyState($.KEY_S)===J.KEYDOWN?this.onselectitem(8):this._keyStore.getKeyState($.KEY_D)===J.KEYDOWN?this.onselectitem(9):this._keyStore.getKeyState($.KEY_Z)===J.KEYDOWN?this.onselectitem(10):this._keyStore.getKeyState($.KEY_X)===J.KEYDOWN?this.onselectitem(11):this._keyStore.getKeyState($.KEY_C)===J.KEYDOWN?this.onselectitem(12):this._keyStore.getKeyState($.KEY_I)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_MINUS)||this._virtualPadStore.checkTouchButton("BUTTON_SLOW")?this.onchangespeed(y.DOWN):this._keyStore.getKeyState($.KEY_P)===J.KEYDOWN||this._keyStore.checkHitKey($.KEY_F2)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_PLUS)||this._virtualPadStore.checkTouchButton("BUTTON_FAST")?this.onchangespeed(y.UP):this._keyStore.getKeyState($.KEY_F1)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_M)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this.launchBattleEstimateWindow():this._keyStore.checkHitKey($.KEY_F3)?(this.playSound(L.DECISION),this.onselectbutton(v.QUICK_LOAD,!0)):this._keyStore.checkHitKey($.KEY_F4)?(this.playSound(L.DECISION),this._useSuspend?this.onpasssuspendsavecalled():this._usePassword&&this.onpasswordsavecalled()):this._keyStore.checkHitKey($.KEY_F5)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.BUTTON_INDEX_ZR)?this.onselectbutton(v.QUICK_LOAD):this._keyStore.checkHitKey($.KEY_F6)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.BUTTON_INDEX_ZL)?this.onselectbutton(v.QUICK_SAVE):this._keyStore.checkHitKey($.KEY_F7)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.BUTTON_INDEX_R)?this.onselectbutton(v.RESTART_GAME):this._keyStore.checkHitKey($.KEY_F8)?this.onselectbutton(v.GOTO_WWA,!1,!0):this._keyStore.checkHitKey($.KEY_F9)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_X)||this._virtualPadStore.checkTouchButton("BUTTON_ESC")?(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onitemmenucalled():this._keyStore.checkHitKey($.KEY_V)?this._displayUserVars():(this._keyStore.checkHitKey($.KEY_F12)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_Y))&&this._displayHelp())}this._keyStore.memorizeKeyStateOnControllableFrame(),this._mouseStore.memorizeMouseStateOnControllableFrame()}else if(this._player.isJumped())this._camera.isResetting()||this._player.processAfterJump();else if(this._player.isMoving())this._player.move(),this._objectMovingDataManager.update();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($.KEY_LEFT)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_LEFT)||this._virtualPadStore.checkTouchButton("BUTTON_LEFT")?this._messageWindow.saveControll(u.LEFT):this._keyStore.checkHitKey($.KEY_UP)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_UP)||this._virtualPadStore.checkTouchButton("BUTTON_UP")?this._messageWindow.saveControll(u.UP):this._keyStore.checkHitKey($.KEY_RIGHT)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_RIGHT)||this._virtualPadStore.checkTouchButton("BUTTON_RIGHT")?this._messageWindow.saveControll(u.RIGHT):(this._keyStore.checkHitKey($.KEY_DOWN)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_DOWN)||this._virtualPadStore.checkTouchButton("BUTTON_DOWN"))&&this._messageWindow.saveControll(u.DOWN))),this._messageWindow.isInputDisable()||(this._yesNoJudge===m.UNSELECTED&&(this._keyStore.getKeyState($.KEY_ENTER)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_Y)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this._yesNoJudge=m.YES:(this._keyStore.getKeyState($.KEY_N)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_ESC)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&(this._yesNoJudge=m.NO)),(this._yesNoJudge===m.YES||this._yesNoJudge===m.NO)&&(this.playSound(L.DECISION),this._yesNoDispCounter=W.YESNO_PRESS_DISP_FRAME_NUM,this._messageWindow.setInputDisable(),this._messageWindow.update()));else if(this._messageWindow.isItemMenuChoice()){if(this._itemMenu.update(),this._keyStore.checkHitKey($.KEY_LEFT)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_LEFT)||this._virtualPadStore.checkTouchingButton("BUTTON_LEFT")?this._itemMenu.controll(u.LEFT):this._keyStore.checkHitKey($.KEY_UP)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_UP)||this._virtualPadStore.checkTouchingButton("BUTTON_UP")?this._itemMenu.controll(u.UP):this._keyStore.checkHitKey($.KEY_RIGHT)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_RIGHT)||this._virtualPadStore.checkTouchingButton("BUTTON_RIGHT")?this._itemMenu.controll(u.RIGHT):(this._keyStore.checkHitKey($.KEY_DOWN)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_DOWN)||this._virtualPadStore.checkTouchingButton("BUTTON_DOWN"))&&this._itemMenu.controll(u.DOWN),this._keyStore.getKeyState($.KEY_ENTER)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_Y)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER"))this._setNextPage(),this._messageWindow.setItemMenuChoice(!1),this._itemMenu.ok();else if(this._mouseStore.checkClickMouse(u.LEFT)||this._mouseStore.checkClickMouse(u.UP)||this._mouseStore.checkClickMouse(u.RIGHT)||this._mouseStore.checkClickMouse(u.DOWN)||this._keyStore.getKeyState($.KEY_N)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_ESC)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC")){for(var s=0;s<P.length;s++){(o=lt(P[s])).classList.contains("onpress")&&o.classList.remove("onpress")}this._itemMenu.ng(),this._setNextPage(),this.playSound(L.DECISION),this._messageWindow.setItemMenuChoice(!1)}}else{var a=this._keyStore.getKeyStateForMessageCheck($.KEY_ENTER),i=this._keyStore.getKeyStateForMessageCheck($.KEY_SPACE),r=this._keyStore.getKeyStateForMessageCheck($.KEY_ESC);if(a===J.KEYDOWN||a===J.KEYPRESS_MESSAGECHANGE||i===J.KEYDOWN||i===J.KEYPRESS_MESSAGECHANGE||r===J.KEYDOWN||r===J.KEYPRESS_MESSAGECHANGE||this._mouseStore.getMouseState()===Z.MOUSEDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")||this._virtualPadStore.checkTouchButton("BUTTON_ESC")){for(s=0;s<P.length;s++){var o;(o=lt(P[s])).classList.contains("onpress")&&o.classList.remove("onpress")}this._setNextPage()}}if(null===(t=this._inlineUserVarViewer)||void 0===t?void 0:t.isVisible){let t=!1;this._keyStore.getKeyState($.KEY_DOWN)===J.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex++,t=!0),this._keyStore.getKeyState($.KEY_UP)===J.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex--,t=!0),this._keyStore.getKeyState($.KEY_RIGHT)===J.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex+=W.INLINE_USER_VAR_VIEWER_DISPLAY_NUM,t=!0),this._keyStore.getKeyState($.KEY_LEFT)===J.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex-=W.INLINE_USER_VAR_VIEWER_DISPLAY_NUM,t=!0),this._inlineUserVarViewer.topUserVarIndex<0&&(this._inlineUserVarViewer.topUserVarIndex+=W.USER_VAR_NUM),this._inlineUserVarViewer.topUserVarIndex>W.USER_VAR_NUM&&(this._inlineUserVarViewer.topUserVarIndex-=W.USER_VAR_NUM),t&&(this._setNextPage(),this._inlineUserVarViewer.isVisible=!0,this._displayUserVars()),this._keyStore.getKeyState($.KEY_V)===J.KEYDOWN&&this._setNextPage()}}else this._player.isWatingEstimateWindow()?(this._keyStore.getKeyState($.KEY_ENTER)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_SPACE)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.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._prevFrameEventExected=!1,this._player.getPosition().isJustPosition()&&this._camera.getPosition().isScreenTopPosition()){if(!(this._shouldTreatWillMessageDisplay(this._pages)||this._player.isJumped()||this._player.isWaitingMessage()||this._player.isWatingEstimateWindow()||this._player.isWaitingMoveMacro()||this._player.isFighting())){this._player.isPartsAppearedTime()&&this._player.clearPartsAppearedFlag(),this._replaceRandomObjectsInScreen();var n=this.checkMap();n||this.checkObject(),this._prevFrameEventExected=n}this._player.isWaitingMessage()&&this._messageWindow.isYesNoChoice()&&this._yesNoJudge!==m.UNSELECTED&&!this._player.isWaitingMoveMacro()&&!this._player.isFighting()&&this._execChoiceWindowRunningEvent()}this._passwordLoadExecInNextFrame&&(this._stopUpdateByLoadFlag=!0,this._loadType=O.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*W.ANIMATION_REP_HALF_FRAME)),this._camera.isResetting()&&this._camera.advanceTransitionStepNum(),this._player.isWaitingMessage()||(this._player.decrementLookingAroundTimer(),this._statusPressCounter.energy>0&&0==--this._statusPressCounter.energy&<("disp-energy").classList.remove("onpress"),this._statusPressCounter.strength>0&&0==--this._statusPressCounter.strength&<("disp-strength").classList.remove("onpress"),this._statusPressCounter.defence>0&&0==--this._statusPressCounter.defence&<("disp-defence").classList.remove("onpress"),this._statusPressCounter.gold>0&&0==--this._statusPressCounter.gold&<("disp-gold").classList.remove("onpress")),this._player.isWaitingMoveMacro()&&this._player.decrementMoveObjectAutoExecTimer(),this._stopUpdateByLoadFlag?this._fadeout((()=>{this._loadType===O.QUICK_LOAD?(this._quickLoad(),this.wwaCustomEvent("wwa_quickload")):this._loadType===O.RESTART_GAME?(this._restartGame(),this.wwaCustomEvent("wwa_restert")):this._loadType===O.PASSWORD&&(this._applyQuickLoad(this._passwordSaveExtractData),this._passwordSaveExtractData=void 0,this.wwaCustomEvent("wwa_passwordload")),setTimeout(this.mainCaller,W.DEFAULT_FRAME_INTERVAL,this)})):window.requestAnimationFrame(this.mainCaller),function({dumpElement:t,namedUserVar:e,userVar:s}){e&&Ys(t,e),s&&bs(t,s)}({dumpElement:this._dumpElement,userVar:this._wwaData.userVar})}vibration(t){this._gamePadStore.vibration(t)}_drawAll(){var t,e,s=this._camera.getPosition().getPartsCoord(),a=this._camera.getPosition().getOffsetCoord(),i=W.MAP_WINDOW_HEIGHT,r=this._player.getPosition().getPartsCoord();if(this._paintSkipByDoorOpen)this._paintSkipByDoorOpen=!1;else{if(this._cgManager.clearCanvas(0,0,W.MAP_WINDOW_WIDTH,W.MAP_WINDOW_HEIGHT),this._cgManager.drawBase(0,0,W.MAP_WINDOW_WIDTH,W.MAP_WINDOW_HEIGHT),this._camera.isResetting()){if(null!==this._camera.getPreviousPosition())var o=this._camera.getPreviousPosition().getPartsCoord(),n=this._camera.getPreviousPosition().getOffsetCoord();i=this._camera.getTransitionStepNum()*W.CHIP_SIZE}var _=!1;if(i!==this._cgManager.mapCacheYLimit&&(this._cgManager.mapCacheYLimit=i,_=!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,_=!0),_&&(this._cgManager.clearBackCanvas(),this._cgManager.clearObjectCanvases()),this._camera.isResetting()&&(this._drawMap(o,n,i,!0),this._drawPlayer(o,n,i,!0),this._drawObjects(o,n,i,!0),this._camera.isFinalStep()))var h=255,c=setInterval((()=>{var t=lt("wwa-fader");if((h-=3*W.FADEOUT_SPEED)<=0)return clearInterval(c),t.style.backgroundColor="transparent",t.removeAttribute("style"),void(t.style.display="none");t.style.opacity=h/255+""}),20);this._drawMap(s,a,i,!1,_),this._drawPlayer(s,a,i),this._drawObjects(s,a,i,!1,_),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,W.CHIP_SIZE*(t-s.x)-a.x,W.CHIP_SIZE*(e-s.y)-a.y)),this._drawEffect(),this._drawFaces(),this._drawFrame()}}_drawMap(t,e,s,a=!1,i=!1){if(void 0!==t){var r,o=Math.max(0,t.x-1),n=Math.min(this._wwaData.mapWidth-1,t.x+W.H_PARTS_NUM_IN_WINDOW),_=Math.max(0,t.y-1),h=Math.min(this._wwaData.mapWidth-1,t.y+W.V_PARTS_NUM_IN_WINDOW);if(r=0,a)for(var c=o;c<=n;c++)for(var l=_;l<=h;l++){var u=this._wwaData.map[l][c],d=this._wwaData.mapAttribute[u][W.ATR_X]/W.CHIP_SIZE,E=this._wwaData.mapAttribute[u][W.ATR_Y]/W.CHIP_SIZE,m=W.CHIP_SIZE*(c-t.x)-e.x,w=W.CHIP_SIZE*(l-t.y)-e.y;this._cgManager.copyBackCanvasWithLowerYLimit(d,E,m,w,s)}else{for(c=o;c<=n;c++)for(l=_;l<=h;l++){u=this._wwaData.map[l][c];this._cgManager.mapCache[r]!==u&&(this._cgManager.mapCache[r]=u,i=!0),r++}if(i){this._cgManager.clearBackCanvasWithLowerYLimit(s);for(c=o;c<=n;c++)for(l=_;l<=h;l++){u=this._wwaData.map[l][c],d=this._wwaData.mapAttribute[u][W.ATR_X]/W.CHIP_SIZE,E=this._wwaData.mapAttribute[u][W.ATR_Y]/W.CHIP_SIZE,m=W.CHIP_SIZE*(c-t.x)-e.x,w=W.CHIP_SIZE*(l-t.y)-e.y;this._cgManager.copyBackCanvasWithUpperYLimit(d,E,m,w,s)}}this._cgManager.drawBackCanvas()}}}_drawPlayer(t,e,s,a=!1){if(void 0===t||this._wwaData.delPlayerFlag)return;const i=this._player.getPosition().getPartsCoord(),r=this._player.getPosition().getOffsetCoord(),o=[NaN,NaN,2,NaN,4,NaN,6,NaN,0,NaN][this._player.getDir()],n=(i.x-t.x)*W.CHIP_SIZE+r.x-e.x,_=(i.y-t.y)*W.CHIP_SIZE+r.y-e.y;let h;if(this._useLookingAround&&this._player.isLookingAround()&&!this._player.isWaitingMessage()){const t=[2,3,4,5,0,1,6,7];h=this._wwaData.playerImgPosX+t[Math.floor(this._mainCallCounter%64/8)]}else h=this._player.isMovingImage()?this._wwaData.playerImgPosX+o+1:this._wwaData.playerImgPosX+o;a?this._cgManager.drawCanvasWithLowerYLimit(h,this._wwaData.playerImgPosY,n,_,s):this._cgManager.drawCanvasWithUpperYLimit(h,this._wwaData.playerImgPosY,n,_,s)}_drawObjects(t,e,s,a=!1,i=!1){if(void 0!==t){var r,o,_,h,l,u,d,E,m,w,p,g,A,S,T=Math.max(0,t.x-1),I=Math.min(this._wwaData.mapWidth-1,t.x+W.H_PARTS_NUM_IN_WINDOW),v=Math.max(0,t.y-1),y=Math.min(this._wwaData.mapWidth-1,t.y+W.V_PARTS_NUM_IN_WINDOW),O=0,C=this._animationCounter>W.ANIMATION_REP_HALF_FRAME,f=this._player.isFighting()&&this._player.isTurn()&&this._player.getPosition().getPartsCoord().equals(this._monster.position);if(a)for(w=T;w<=I;w++)for(p=v;p<=y;p++)f&&new n(w,p).equals(this._monster.position)||(g=this._wwaData.mapObject[p][w],r=new n(0,0),this._wwaData.objectAttribute[g][W.ATR_MOVE]!==D.STATIC&&null!==(m=this._objectMovingDataManager.getOffsetByBeforePartsCoord(new n(w,p)))&&(r=m),l=W.CHIP_SIZE*(w-t.x)+r.x-e.x,u=W.CHIP_SIZE*(p-t.y)+r.y-e.y,o=C||0===this._wwaData.objectAttribute[g][W.ATR_X2]&&0===this._wwaData.objectAttribute[g][W.ATR_Y2],_=this._wwaData.objectAttribute[g][o?W.ATR_X:W.ATR_X2]/W.CHIP_SIZE,h=this._wwaData.objectAttribute[g][o?W.ATR_Y:W.ATR_Y2]/W.CHIP_SIZE,d=this._wwaData.objectAttribute[g][W.ATR_TYPE],E=this._wwaData.objectAttribute[g][W.ATR_NUMBER],0===g||this._checkNoDrawObject(new n(w,p),d,E)||this._cgManager.copyObjectCanvasWithLowerYLimit(C?1:0,_,h,l,u,s));else{var N,P,M,R,L,b=[],x=[];for(w=T;w<=I;w++)for(p=v;p<=y;p++)A=g=this._wwaData.mapObject[p][w],d=this._wwaData.objectAttribute[g][W.ATR_TYPE],E=this._wwaData.objectAttribute[g][W.ATR_NUMBER],this._checkNoDrawObject(new n(w,p),d,E)&&(A=0),P=this._wwaData.objectAttribute[g][W.ATR_MOVE]===D.STATIC,0!==A&&(M=!(!f||!new n(w,p).equals(this._monster.position)),P?x.push(new c(g,w,p,P,M)):(b.push(new c(g,w,p,P,M)),A=0),M&&(A=0)),this._cgManager.mapObjectCache[O]!==A&&(this._cgManager.mapObjectCache[O]=A,i=!0),O++;for(i&&(this._cgManager.clearObjectCanvasesWithLowerYLimit(s),Array.prototype.push.apply(b,x)),L=b.length,R=0;R<L;R++)if(w=(N=b[R]).x,p=N.y,g=N.partsIDObj,P=N.isStatic,M=N.isFighting,l=W.CHIP_SIZE*(w-t.x)-e.x,u=W.CHIP_SIZE*(p-t.y)-e.y,P){if(M)continue;for(S=0;S<2;S++)o=!!S||0===this._wwaData.objectAttribute[g][W.ATR_X2]&&0===this._wwaData.objectAttribute[g][W.ATR_Y2],_=this._wwaData.objectAttribute[g][o?W.ATR_X:W.ATR_X2]/W.CHIP_SIZE,h=this._wwaData.objectAttribute[g][o?W.ATR_Y:W.ATR_Y2]/W.CHIP_SIZE,this._cgManager.copyObjectCanvasWithUpperYLimit(S,_,h,l,u,s)}else null!==(m=this._objectMovingDataManager.getOffsetByBeforePartsCoord(new n(w,p)))&&(l+=m.x,u+=m.y),o=C||0===this._wwaData.objectAttribute[g][W.ATR_X2]&&0===this._wwaData.objectAttribute[g][W.ATR_Y2],_=this._wwaData.objectAttribute[g][o?W.ATR_X:W.ATR_X2]/W.CHIP_SIZE,h=this._wwaData.objectAttribute[g][o?W.ATR_Y:W.ATR_Y2]/W.CHIP_SIZE,this._cgManager.drawCanvasWithUpperYLimit(_,h,l,u,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()}_checkNoDrawObject(t,e,s){var a=this._player.getPosition(),i=a.getPartsCoord();return!(!a.isJustPosition()||i.x!==t.x||i.y!==t.y||this._wwaData.objectNoCollapseDefaultFlag)&&(e===W.OBJECT_DOOR&&0===s||(e===W.OBJECT_STATUS||e===W.OBJECT_MESSAGE||e===W.OBJECT_ITEM||e===W.OBJECT_SELL||e===W.OBJECT_BUY||e===W.OBJECT_SELL||e===W.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][W.ATR_TYPE]}getObjectTypeByPosition(t){var e=t.getPartsCoord(),s=this._wwaData.mapObject[e.y][e.x];return this._wwaData.objectAttribute[s][W.ATR_TYPE]}getMapAttributeByPosition(t,e){var s=t.getPartsCoord(),a=this._wwaData.map[s.y][s.x];return this._wwaData.mapAttribute[a][e]}isCurrentPosMapPartsIncludingMessage(t){return 0!==this.getMapAttributeByPosition(t,W.ATR_STRING)}getObjectAttributeByPosition(t,e){var s=t.getPartsCoord(),a=this._wwaData.mapObject[s.y][s.x];return this._wwaData.objectAttribute[a][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][W.ATR_X]}getObjectCropYById(t){return this._wwaData.objectAttribute[t][W.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],a=this._wwaData.mapAttribute[s][W.ATR_TYPE],i=t.x===e.x&&t.y===e.y,r=!1;return(!i||this._player.getLastExecPartsIDOnSamePosition(g.MAP)!==s)&&(a===W.MAP_STREET?r=this._execMapStreetEvent(t,s,a):a===W.MAP_WALL?r=this._execMapWallEvent(t,s,a):a===W.MAP_LOCALGATE?r=this._execMapLocalGateEvent(t,s,a):a===W.MAP_URLGATE&&(r=this._execMapUrlGateEvent(t,s,a)),i&&!this._player.isJumped()&&this._player.setLastExecInfoOnSamePosition(g.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],a=this._wwaData.objectAttribute[s][W.ATR_TYPE],i=t.x===e.x&&t.y===e.y;i&&this._player.getLastExecPartsIDOnSamePosition(g.OBJECT)===s||(a===W.OBJECT_NORMAL?this._execObjectNormalEvent(t,s,a):a===W.OBJECT_MESSAGE?this._execObjectMessageEvent(t,s,a):a===W.OBJECT_MONSTER?this._execObjectMonsterEvent(t,s,a):a===W.OBJECT_ITEM?this._execObjectItemEvent(t,s,a):a===W.OBJECT_DOOR?this._execObjectDoorEvent(t,s,a):a===W.OBJECT_STATUS?this._execObjectStatusEvent(t,s,a):a===W.OBJECT_BUY?this._execObjectBuyEvent(t,s,a):a===W.OBJECT_SELL?this._execObjectSellEvent(t,s,a):a===W.OBJECT_URLGATE?this._execObjectUrlGateEvent(t,s,a):a===W.OBJECT_SCORE?this._execObjectScoreEvent(t,s,a):a===W.OBJECT_SELECT?this._execObjectYesNoChoiceEvent(t,s,a):a===W.OBJECT_LOCALGATE&&this._execObjectLocalGateEvent(t,s,a),i&&!this._player.isJumped()&&this._player.setLastExecInfoOnSamePosition(g.OBJECT,s))}_execMapStreetEvent(t,e,s){var a=this._wwaData.mapAttribute[e][W.ATR_ITEM];if(0!==a&&!this._player.hasItem(a))return!1;this.reserveAppearPartsInNextFrame(t,w.MAP,e);const i=this._wwaData.mapAttribute[e][W.ATR_STRING],r=this._wwaData.message[i],o=this._wwaData.mapAttribute[e][W.ATR_NUMBER];return this._waitFrame+=o*W.WAIT_TIME_FRAME_NUM,this._temporaryInputDisable=!0,this.generatePageAndReserveExecution(r,!1,!1,e,g.MAP,t.clone()),this.playSound(this._wwaData.mapAttribute[e][W.ATR_SOUND]),0!==i&&this._shouldTreatWillMessageDisplay(this._pages)||0!==o}_shouldTreatWillMessageDisplay(t){return t.reduce(((t,e)=>t||!Se(e.firstNode)),!1)}_execMapWallEvent(t,e,s){var a=this.getObjectIdByPosition(t.convertIntoPosition(this)),i=this.getObjectAttributeById(a,W.ATR_TYPE);if(0===a||i===W.OBJECT_NORMAL||i===W.OBJECT_DOOR&&(!this._player.hasItem(this.getObjectAttributeById(a,W.ATR_ITEM))||this.getObjectAttributeById(i,W.ATR_MODE)===W.PASSABLE_OBJECT)){this.reserveAppearPartsInNextFrame(t,w.MAP,e);var r=this._wwaData.mapAttribute[e][W.ATR_STRING],o=this._wwaData.message[r];return this.generatePageAndReserveExecution(o,!1,!1,e,g.MAP,t.clone()),this.playSound(this._wwaData.mapAttribute[e][W.ATR_SOUND]),!1}return!1}_execMapLocalGateEvent(t,e,s){var a=this._player.getPosition().getPartsCoord(),i=this._wwaData.mapAttribute[e][W.ATR_JUMP_X],r=this._wwaData.mapAttribute[e][W.ATR_JUMP_Y];return i>W.RELATIVE_COORD_LOWER&&(i=t.x+i-W.RELATIVE_COORD_BIAS),r>W.RELATIVE_COORD_LOWER&&(r=t.y+r-W.RELATIVE_COORD_BIAS),this.reserveAppearPartsInNextFrame(t,w.MAP,e),0<=i&&0<=r&&i<this._wwaData.mapWidth&&r<this._wwaData.mapWidth&&(i!==a.x||r!==a.y)&&(this.reserveJumpInNextFrame(new _(this,i,r,0,0)),this.playSound(this._wwaData.mapAttribute[e][W.ATR_SOUND]),!0)}_execMapUrlGateEvent(t,e,s){var i=this._wwaData.mapAttribute[e][W.ATR_STRING];if(!this._isURLGateEnable)return!0;const r=this.resolveSystemMessage(a.CONFIRM_ENTER_URL_GATE);if("BLANK"!==r)return this.generatePageAndReserveExecution(r,!0,!0),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_MAP_PARTS,this._yesNoURL=this._wwaData.message[i].split(/\s/g)[0],!0;location.href=wt(this._wwaData.message[i].split(/\s/g)[0])}_execObjectNormalEvent(t,e,s){}_execObjectMessageEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_STRING],i=this._wwaData.message[a],r=this._player.getPosition().getPartsCoord(),o=this._wwaData.objectAttribute[e][W.ATR_SOUND];t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t),this.generatePageAndReserveExecution(i,!1,!1,e,g.OBJECT,t),this._waitFrame+=this._wwaData.objectAttribute[e][W.ATR_NUMBER]*W.WAIT_TIME_FRAME_NUM,this._temporaryInputDisable=!0,this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this.playSound(o)}_execObjectStatusEvent(t,e,s){var a=new o(this._wwaData.objectAttribute[e][W.ATR_ENERGY],this._wwaData.objectAttribute[e][W.ATR_STRENGTH],this._wwaData.objectAttribute[e][W.ATR_DEFENCE],this._wwaData.objectAttribute[e][W.ATR_GOLD]),i=this._wwaData.objectAttribute[e][W.ATR_STRING],r=this._wwaData.message[i],n=this._player.getStatusWithoutEquipments();if(a.strength>W.STATUS_MINUS_BORDER&&n.strength<a.strength-W.STATUS_MINUS_BORDER||a.defence>W.STATUS_MINUS_BORDER&&n.defence<a.defence-W.STATUS_MINUS_BORDER||a.gold>W.STATUS_MINUS_BORDER&&n.gold<a.gold-W.STATUS_MINUS_BORDER)return this.setPartsOnPosition(g.OBJECT,0,t),this._keyStore.allClear(),void this._mouseStore.clear();a.energy=a.energy>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-a.energy:a.energy,a.strength=a.strength>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-a.strength:a.strength,a.defence=a.defence>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-a.defence:a.defence,a.gold=a.gold>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-a.gold:a.gold,this._player.addStatusAll(a),this.setStatusChangedEffect(a),this._player.isDead()&&0!==this._wwaData.objectAttribute[e][W.ATR_ENERGY]&&this.shouldApplyGameOver({isCalledByMacro:!1})?this.gameover():(this.generatePageAndReserveExecution(r,!1,!1,e,g.OBJECT,t.clone()),this.setPartsOnPosition(g.OBJECT,0,t),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND]))}_execObjectMonsterEvent(t,e,s){var a=new n(this._wwaData.objectAttribute[e][W.ATR_X],this._wwaData.objectAttribute[e][W.ATR_Y]),i=new o(this._wwaData.objectAttribute[e][W.ATR_ENERGY],this._wwaData.objectAttribute[e][W.ATR_STRENGTH],this._wwaData.objectAttribute[e][W.ATR_DEFENCE],this._wwaData.objectAttribute[e][W.ATR_GOLD]),r=this._wwaData.message[this._wwaData.objectAttribute[e][W.ATR_STRING]],_=this._wwaData.objectAttribute[e][W.ATR_ITEM];this._monster=new Dt(e,t,a,i,r,_,(()=>{this._monsterWindow.hide()})),this._player.startBattleWith(this._monster)}_execObjectBuyEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_STRING],i=this._wwaData.message[a],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t),this.generatePageAndReserveExecution(i,!0,!1,e,g.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND])}_execObjectSellEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_STRING],i=this._wwaData.message[a],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t),this.generatePageAndReserveExecution(i,!0,!1,e,g.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND])}_execObjectItemEvent(t,e,s){var i=this._wwaData.objectAttribute[e][W.ATR_STRING],r=this._wwaData.message[i];try{var o=this._camera.getPosition().getScreenTopPosition().getPartsCoord(),_=(t.x-o.x)*W.CHIP_SIZE,h=(t.y-o.y)*W.CHIP_SIZE;this._player.addItem(e,this._wwaData.objectAttribute[e][W.ATR_NUMBER],!1,this._wwaData.isItemEffectEnabled?{screenPixelCoord:new n(_,h),itemBoxBackgroundImageCoord:new n(this._wwaData.imgItemboxX*W.CHIP_SIZE,this._wwaData.imgItemboxY*W.CHIP_SIZE)}:void 0),this.setPartsOnPosition(g.OBJECT,0,t),0!==this._wwaData.objectAttribute[e][W.ATR_MODE]||(this.generatePageAndReserveExecution(r,!1,!1,e,g.OBJECT,t.clone()),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e))}catch(t){const e=this.resolveSystemMessage(a.ITEM_BOX_FULL);"BLANK"!==e&&this.generatePageAndReserveExecution(e,!1,!0)}this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND])}_execObjectDoorEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_ITEM],i=this._wwaData.objectAttribute[e][W.ATR_STRING],r=this._wwaData.message[i];this._player.hasItem(a)&&(0===this._wwaData.objectAttribute[e][W.ATR_MODE]&&this._player.removeItemByPartsID(a),this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND]),this.generatePageAndReserveExecution(r,!1,!1,e,g.OBJECT,t.clone()),this.setPartsOnPosition(g.OBJECT,0,t),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this._paintSkipByDoorOpen=!0)}_execObjectYesNoChoiceEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_STRING],i=this._wwaData.message[a],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t),this.generatePageAndReserveExecution(i,!0,!1,e,g.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND])}_execObjectLocalGateEvent(t,e,s){var a=this._player.getPosition().getPartsCoord();t.x!==a.x||t.y!==a.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t);var i=this._wwaData.objectAttribute[e][W.ATR_JUMP_X],r=this._wwaData.objectAttribute[e][W.ATR_JUMP_Y];i>W.RELATIVE_COORD_LOWER&&(i=a.x+i-W.RELATIVE_COORD_BIAS),r>W.RELATIVE_COORD_LOWER&&(r=a.y+r-W.RELATIVE_COORD_BIAS),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),0<=i&&0<=r&&i<this._wwaData.mapWidth&&r<this._wwaData.mapWidth&&(i!==a.x||r!==a.y)&&(this.reserveJumpInNextFrame(new _(this,i,r,0,0)),this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND]))}_execObjectUrlGateEvent(t,e,s){var i=this._wwaData.objectAttribute[e][W.ATR_STRING];if(!this._isURLGateEnable)return;const r=this.resolveSystemMessage(a.CONFIRM_ENTER_URL_GATE);"BLANK"!==r?(this.generatePageAndReserveExecution(r,!0,!0),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_OBJECT_PARTS,this._yesNoURL=this._wwaData.message[i].split(/\s/g)[0]):location.href=wt(this._wwaData.message[i].split(/\s/g)[0])}_execObjectScoreEvent(t,e,s){const a=this._wwaData.objectAttribute[e][W.ATR_STRING];this.generatePageAndReserveExecution(this._wwaData.message[a],!1,!1,e,g.OBJECT,t,{rates:{energy:this._wwaData.objectAttribute[e][W.ATR_ENERGY],strength:this._wwaData.objectAttribute[e][W.ATR_STRENGTH],defence:this._wwaData.objectAttribute[e][W.ATR_DEFENCE],gold:this._wwaData.objectAttribute[e][W.ATR_GOLD]}}),this.playSound(this._wwaData.objectAttribute[e][W.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][W.ATR_GOLD])){const t=this.resolveSystemMessage(a.NO_MONEY);return"BLANK"!==t&&this._pages.push(new we(new Ae(t),!0,!1,!0)),{}}if(0!==this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ITEM]){const t=this._yesNoChoicePartsCoord,e=this._camera.getPosition().getScreenTopPosition().getPartsCoord(),s=(t.x-e.x)*W.CHIP_SIZE,i=(t.y-e.y)*W.CHIP_SIZE,r=this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ITEM],o=this._wwaData.objectAttribute[r][W.ATR_NUMBER];try{this._player.addItem(r,o,!1,this._wwaData.isItemEffectEnabled?{screenPixelCoord:new n(s,i),itemBoxBackgroundImageCoord:new n(this._wwaData.imgItemboxX*W.CHIP_SIZE,this._wwaData.imgItemboxY*W.CHIP_SIZE)}:void 0)}catch(t){const e=this.resolveSystemMessage(a.ITEM_BOX_FULL);return"BLANK"!==e&&this._pages.push(new we(new Ae(e),!0,!1,!0)),{}}}const t=new o(this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ENERGY],this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_STRENGTH],this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_DEFENCE],-this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_GOLD]);return t.energy=t.energy>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-t.energy:t.energy,this.setStatusChangedEffect(t),this._player.addStatusAll(t),this._player.isDead()&&0!==this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.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===m.YES){if(this._yesNoChoiceCallInfo===I.CALL_BY_MAP_PARTS)(t=this._wwaData.mapAttribute[this._yesNoChoicePartsID][W.ATR_TYPE])===W.MAP_URLGATE&&(location.href=wt(this._yesNoURL));else if(this._yesNoChoiceCallInfo===I.CALL_BY_OBJECT_PARTS)if((t=this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_TYPE])===W.OBJECT_BUY)if(this._player.hasItem(this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ITEM]))this._player.removeItemByPartsID(this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ITEM]),e=this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_GOLD],this._player.earnGold(e),this.setStatusChangedEffect(new o(0,0,0,e)),this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.OBJECT,this._yesNoChoicePartsID);else{const t=this.resolveSystemMessage(a.NO_ITEM);"BLANK"!==t&&this._pages.push(new we(new Ae(t),!0,!1,!0))}else if(t===W.OBJECT_SELL){const{isGameOver:t}=this._execChoiceWindowObjectSellEvent();if(t)return}else t===W.OBJECT_SELECT?this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.CHOICE_YES,this._yesNoChoicePartsID):t===W.OBJECT_URLGATE&&(location.href=wt(this._yesNoURL));else this._yesNoChoiceCallInfo===I.CALL_BY_ITEM_USE?this._player.readyToUseItem(this._yesNoUseItemPos):this._yesNoChoiceCallInfo===I.CALL_BY_QUICK_LOAD||this._yesNoChoiceCallInfo===I.CALL_BY_LOG_QUICK_LOAD?(this._messageWindow.deleteSaveDom(),lt(P[v.QUICK_LOAD]).classList.remove("onpress"),this._messageWindow.load()&&(this._stopUpdateByLoadFlag=!0,this._loadType=O.QUICK_LOAD)):this._yesNoChoiceCallInfo===I.CALL_BY_QUICK_SAVE?(this._messageWindow.deleteSaveDom(),lt(P[v.QUICK_SAVE]).classList.remove("onpress"),this._quickSave(I.CALL_BY_QUICK_SAVE)):this._yesNoChoiceCallInfo===I.CALL_BY_RESTART_GAME?(lt(P[v.RESTART_GAME]).classList.remove("onpress"),this._stopUpdateByLoadFlag=!0,this._loadType=O.RESTART_GAME):this._yesNoChoiceCallInfo===I.CALL_BY_END_GAME?(window.history.back(-1),lt(P[v.GOTO_WWA]).classList.remove("onpress")):this._yesNoChoiceCallInfo===I.CALL_BY_GOTO_WWA?(location.href=wt(W.WWA_HOME),lt(P[v.GOTO_WWA]).classList.remove("onpress")):this._yesNoChoiceCallInfo===I.CALL_BY_PASSWORD_LOAD?(lt(P[v.QUICK_LOAD]).classList.remove("onpress"),this._player.setPasswordWindowWating(),this._passwordWindow.show(Ce.LOAD)):this._yesNoChoiceCallInfo===I.CALL_BY_PASSWORD_SAVE?(lt(P[v.QUICK_SAVE]).classList.remove("onpress"),this._player.setPasswordWindowWating(),this._passwordWindow.password=this._quickSave(I.CALL_BY_PASSWORD_SAVE),this._passwordWindow.show(Ce.SAVE)):this._yesNoChoiceCallInfo===I.CALL_BY_SUSPEND&&(lt(P[v.QUICK_SAVE]).classList.remove("onpress"),this._quickSave(I.CALL_BY_SUSPEND));this._yesNoJudge=m.UNSELECTED,this._setNextPage(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=I.NONE,this._messageWindow.setYesNoChoice(!1)}else if(this._yesNoJudge===m.NO){if(this._yesNoChoiceCallInfo===I.CALL_BY_MAP_PARTS)t=this._wwaData.mapAttribute[this._yesNoChoicePartsID][W.ATR_TYPE],W.MAP_URLGATE;else if(this._yesNoChoiceCallInfo===I.CALL_BY_OBJECT_PARTS)(t=this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_TYPE])===W.OBJECT_BUY||t===W.OBJECT_SELL||(t===W.OBJECT_SELECT?this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.CHOICE_NO,this._yesNoChoicePartsID):W.OBJECT_URLGATE);else if(this._yesNoChoiceCallInfo===I.CALL_BY_ITEM_USE){lt("item"+(this._yesNoUseItemPos-1)).classList.remove("onpress")}else if(this._yesNoChoiceCallInfo===I.CALL_BY_QUICK_LOAD||this._yesNoChoiceCallInfo===I.CALL_BY_LOG_QUICK_LOAD)switch(this._messageWindow.deleteSaveDom(),this._yesNoChoiceCallInfo=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._yesNoChoiceCallInfo){case I.NONE:lt(P[v.QUICK_LOAD]).classList.remove("onpress");break;case I.CALL_BY_PASSWORD_LOAD:return this._yesNoJudge=m.UNSELECTED,void this.onpasswordloadcalled();case I.CALL_BY_LOG_QUICK_LOAD:this._wwaSave.selectLogSaveDataList(),this._messageWindow.createSaveDom();var s=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword);switch(this._yesNoJudge=m.UNSELECTED,s){case I.CALL_BY_PASSWORD_LOAD:this.generatePageAndReserveExecution("読み込むオートセーブを選んでください。\n→Noでデータ復帰用パスワードの\n 入力選択ができます。",!0,!0);break;case I.NONE:this.generatePageAndReserveExecution("読み込むオートセーブを選んでください。",!0,!0)}return}else if(this._yesNoChoiceCallInfo===I.CALL_BY_QUICK_SAVE){if(this._messageWindow.deleteSaveDom(),this._usePassword||this._useSuspend)return this._yesNoJudge=m.UNSELECTED,void(this._useSuspend?this.onpasssuspendsavecalled():this._usePassword&&this.onpasswordsavecalled());lt(P[v.QUICK_SAVE]).classList.remove("onpress")}else if(this._yesNoChoiceCallInfo===I.CALL_BY_RESTART_GAME)lt(P[v.RESTART_GAME]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_END_GAME)lt(P[v.GOTO_WWA]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_GOTO_WWA)lt(P[v.GOTO_WWA]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_PASSWORD_LOAD)lt(P[v.QUICK_LOAD]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_PASSWORD_SAVE)lt(P[v.QUICK_SAVE]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_SUSPEND){if(this._usePassword)return this._yesNoJudge=m.UNSELECTED,void this.onpasswordsavecalled();lt(P[v.QUICK_SAVE]).classList.remove("onpress")}this._yesNoJudge=m.UNSELECTED,this._setNextPage(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=I.NONE,this._messageWindow.setYesNoChoice(!1)}}generatePageAndReserveExecution(t,e,s,a=0,i=g.OBJECT,r=new n(0,0),o=void 0){const _=this.generatePagesByRawMessage(t,a,i,r,s,e,o);this._pages=this._pages.concat(_),this._shouldSetNextPage=!0}generatePagesByRawMessage(t,e,s,a,i,r,o){const n=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(/\/\//)?gt(gt(t).replace(/^.*\/\/(?!:s?ptth)/gi,"")):t})).filter((t=>void 0!==t)).join("\n").replace(/\\\/\\\//gi,"//");if(""===n)return o?[new we(void 0,!0,!1,!1,o,{partsId:e,partsType:s,partsPosition:a})]:[];const _=n.split(/\<p\>/gi);return _.map(((t,n)=>{let h,c,l;const u={id:e,type:s,position:a},d=this.parseMessageLines(t,e,s,a),E=[];return d.forEach(((t,e)=>{try{const s=0===e?void 0:d[e-1].type,a=E[E.length-1],i=this.createNewNode(t,!h||!Te(s),{triggerParts:u}),r=this.processConditionalExecuteMacroLine(i,t,a,E);r&&(l=r),s?this.connectOrMergeToPreviousNode(t,s,c,i,a,l,{triggerParts:u}):h=i,i&&(c=i)}catch(t){console.error(`$if-$else_if-$else-$endif マクロの解析中にエラーが発生しました。ページ ${e}`),console.error(t)}})),new we(h,n===_.length-1,0===n&&r,i,0===n&&o,{partsId:e,partsType:s,partsPosition:a})}))}parseMessageLines(t,e,s,a){return t.split("\n").map((t=>{const i=t.match(/(\$(?:[a-zA-Z_][a-zA-Z0-9_]*)(?:.*))/);if(!i||i.length<2)return t.startsWith("$")?void 0:{type:"text",text:t};const r=function(t,e,s,a,i){var r;let o=i.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)\=(.*)$/);if((null===o||3!==o.length)&&(o=i.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)/),null===o||2!==o.length))throw new Error("マクロではありません");const n=`$${o[1].toLowerCase()}`,_="$if"===n&&i.match(/,/)?N.LEGACY_IF:b[n],h=Boolean(_!==N.SHOW_STR&&_!==N.SHOW_STR2),c=(null!==(r=o[2])&&void 0!==r?r:"").split(",").map((t=>h?t.trim():t));return new Ie(t,e,s,a,void 0===_?N.UNDEFINED:_,c)}(this,e,s,a,i[1]);switch(r.macroType){case N.IF:case N.ELSE_IF:case N.ELSE:case N.END_IF:case N.SHOW_STR:case N.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 N.IF:return new ge([{descriminant:me(t.macro.macroArgs[0])}]);case N.SHOW_STR:case N.SHOW_STR2:return e?new Ae(this._generateShowStrString(t.macro.macroArgs,{triggerParts:s.triggerParts,version:t.type===N.SHOW_STR2?2:1})):void 0;case"text":return e?new Ae(t.text):void 0;case"normalMacro":return e?new Ae("",[t.macro]):void 0;default:return}}processConditionalExecuteMacroLine(t,e,s,a){const i=0===a.length;switch(e.type){case N.IF:return void a.push(t);case N.ELSE_IF:if(i)throw new Error("構文エラー: $if を呼ぶ前に $else_if は呼べません");return void s.appendBranch({descriminant:me(e.macro.macroArgs[0])});case N.ELSE:if(i)throw new Error("構文エラー: $if を呼ぶ前に $else は呼べません");return void s.appendBranch({descriminant:!0,elseBranch:{type:"real"}});case N.END_IF:if(i)throw new Error("構文エラー: $if を呼ぶ前に $endif は呼べません");return a.pop()}}connectOrMergeToPreviousNode(t,e,s,a,i,r,o){const n=Te(e);switch(e){case N.IF:case N.ELSE_IF:case N.ELSE:if(!a||!i)return;const e=i.getLastUnconnectedBranch();if(!e)throw new Error("lastUnconnectedBranchが見つかりませんでした。");return void(e.next=a);case N.END_IF:if(!(a&&r instanceof ge))return;for(let t=0;t<r.branches.length;t++){let e=r.branches[t].next;e?this.connectToFinalNode(e,a):r.branches[t]=a}return void(r.hasElseBranch()||r.branches.push({next:a,descriminant:!0,elseBranch:{type:"pesudo-else"}}));default:if(!(n&&s instanceof Ae))return;const _=!s.isEmpty();t.type===N.SHOW_STR||t.type===N.SHOW_STR2?s.appendMessage(this._generateShowStrString(t.macro.macroArgs,{triggerParts:o.triggerParts,version:t.type===N.SHOW_STR2?2:1}),_):"text"===t.type?s.appendMessage(t.text,_):"normalMacro"===t.type?s.macro.push(t.macro):s.next=a}}connectToFinalNode(t,e){let s=t;for(;;)if(s instanceof ge&&(s=s.branches[0].next),s instanceof Ae){if(!s.next)return void(s.next=e);s=s.next}}appearParts({pos:t,triggerType:e,triggerPartsId:s}){var a,i,r,o,h,c,l=e===w.CHOICE_NO?W.APPERANCE_PARTS_MIN_INDEX_NO:W.APPERANCE_PARTS_MIN_INDEX,u=e===w.CHOICE_YES?W.APPERANCE_PARTS_MAX_INDEX_YES:W.APPERANCE_PARTS_MAX_INDEX;for(e===w.MAP?(s=0===s?this._wwaData.map[t.y][t.x]:s,a=g.MAP):(s=0===s?this._wwaData.mapObject[t.y][t.x]:s,a=g.OBJECT),c=l;c<=u;c++){var d=W.ATR_APPERANCE_BASE+c*W.REL_ATR_APPERANCE_UNIT_LENGTH,E=d+W.REL_ATR_APPERANCE_ID,m=d+W.REL_ATR_APPERANCE_X,p=d+W.REL_ATR_APPERANCE_Y,A=d+W.REL_ATR_APPERANCE_TYPE;if(i=a===g.MAP?this._wwaData.mapAttribute[s][E]:this._wwaData.objectAttribute[s][E],r=a===g.MAP?this._wwaData.mapAttribute[s][A]:this._wwaData.objectAttribute[s][A],o=a===g.MAP?this._wwaData.mapAttribute[s][m]:this._wwaData.objectAttribute[s][m],h=a===g.MAP?this._wwaData.mapAttribute[s][p]:this._wwaData.objectAttribute[s][p],o===W.PLAYER_COORD?(o=this._player.getPosition().getPartsCoord().x,this._player.resetEventExecutionInfo()):o>W.RELATIVE_COORD_LOWER&&(o=t.x+o-W.RELATIVE_COORD_BIAS),h===W.PLAYER_COORD?(h=this._player.getPosition().getPartsCoord().y,this._player.resetEventExecutionInfo()):h>W.RELATIVE_COORD_LOWER&&(h=t.y+h-W.RELATIVE_COORD_BIAS),0!==o||0!==h)try{if(new _(this,o,h,0,0),r===g.MAP){if(i>=this._wwaData.mapPartsMax)throw new Error("背景パーツの範囲外IDが指定されました");var S=new n(o,h);this.setPartsOnPosition(g.MAP,i,S)}else{if(i>=this._wwaData.objPartsMax)throw new Error("物体パーツの範囲外IDが指定されました");S=new n(o,h);this.setPartsOnPosition(g.OBJECT,i,S),this._replaceRandomObject(new n(o,h)),o===this._player.getPosition().getPartsCoord().x&&h===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 a=this._player.getPosition().getPartsCoord(),i=this._player.getDir(),r=d[i],o=E[i];this.appearPartsEval(a,(r>=0?"+":"-")+Math.abs(r)*t,(o>=0?"+":"-")+Math.abs(o)*t,e,s)}appearPartsEval(t,e,s,a,i){var r,o,h=this._player.getPosition().getPartsCoord();if("P"===e||"p"===e)r=h.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)o=h.y;else if("+"===s[0])o=t.y+parseInt(s.substr(1));else if("-"===s[0])o=t.y-parseInt(s.substr(1));else if(o=parseInt(s),isNaN(o))throw new Error("座標として解釈できない文字が含まれています。");try{new _(this,r,o,0,0);if(i===g.MAP){if(a>=this._wwaData.mapPartsMax)throw new Error("背景パーツの範囲外IDが指定されました");var c=new n(r,o);this.setPartsOnPosition(g.MAP,a,c)}else{if(a>=this._wwaData.objPartsMax)throw new Error("物体パーツの範囲外IDが指定されました");c=new n(r,o);this.setPartsOnPosition(g.OBJECT,a,c),this._replaceRandomObject(new n(r,o)),r===this._player.getPosition().getPartsCoord().x&&o===this._player.getPosition().getPartsCoord().y&&this._player.setPartsAppearedFlag()}}catch(t){}}_replaceRandomObject(t){var e,s,a=this._wwaData.mapObject[t.y][t.x];if(this._wwaData.objectAttribute[a][W.ATR_TYPE]===W.OBJECT_RANDOM){for(var i=0;i<W.RANDOM_ITERATION_MAX;i++){if(s=Math.floor(10*Math.random()),(e=this._wwaData.objectAttribute[a][W.ATR_RANDOM_BASE+s])>=this._wwaData.objPartsMax){e=0;break}if(this._wwaData.objectAttribute[e][W.ATR_TYPE]!==W.OBJECT_RANDOM)break;a=e}this.setPartsOnPosition(g.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+W.H_PARTS_NUM_IN_WINDOW),a=Math.max(0,t.y-1),i=Math.min(this._wwaData.mapWidth-1,t.y+W.V_PARTS_NUM_IN_WINDOW),r=e;r<=s;r++)for(var o=a;o<=i;o++)this._replaceRandomObject(new n(r,o))}_replaceAllRandomObjects(){for(var t=0;t<this._wwaData.mapWidth;t++)for(var e=0;e<this._wwaData.mapWidth;e++)this._replaceRandomObject(new n(t,e))}gameover(){var t=this._wwaData.gameoverX,e=this._wwaData.gameoverY;this._yesNoJudge=m.UNSELECTED,this._pages=[],this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=I.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._player.jumpTo(new _(this,t,e,0,0))}setYesNoInput(t){this._yesNoJudgeInNextFrame=t}getYesNoState(){return void 0!==this._yesNoJudgeInNextFrame?this._yesNoJudgeInNextFrame:this._yesNoJudge}setStatusChangedEffect(t){this._wwaData.isItemEffectEnabled&&(0!==t.strength&&(lt("disp-strength").classList.add("onpress"),this._statusPressCounter.strength=W.STATUS_CHANGED_EFFECT_FRAME_NUM),0!==t.defence&&(lt("disp-defence").classList.add("onpress"),this._statusPressCounter.defence=W.STATUS_CHANGED_EFFECT_FRAME_NUM),t instanceof o&&(0!==t.energy&&(lt("disp-energy").classList.add("onpress"),this._statusPressCounter.energy=W.STATUS_CHANGED_EFFECT_FRAME_NUM),0!==t.gold&&(lt("disp-gold").classList.add("onpress"),this._statusPressCounter.gold=W.STATUS_CHANGED_EFFECT_FRAME_NUM)))}setPartsOnPosition(t,e,s){var a,i,r=s.y<<j.BITSHIFT|s.x;t===g.MAP?(a=this._wwaData.map[s.y][s.x],e=this.loadMapPartsID(e),a=this.loadMapPartsID(a),this._wwaData.map[s.y][s.x]=e,-1!==(i=this._mapIDTable[a].indexOf(r))&&this._mapIDTable[a].splice(i,1),-1===(i=this._mapIDTable[e].indexOf(r))&&this._mapIDTable[e].push(r)):(a=this._wwaData.mapObject[s.y][s.x],e=this.loadMapPartsObjectID(e),a=this.loadMapPartsObjectID(a),this._wwaData.mapObject[s.y][s.x]=e,-1!==(i=this._mapObjectIDTable[a].indexOf(r))&&this._mapObjectIDTable[a].splice(i,1),-1===(i=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 a=0;a<t[s].length;){var i=this._countSamePartsLength(t[s],a);e[s].push([t[s][a],i]),a+=i}}return e}_decompressMap(t){for(var e=[],s=0;s<t.length;s++){e[s]=[];for(var a=0;a<t[s].length;a++)for(var i=t[s][a][1],r=0;r<i;r++)e[s].push(t[s][a][0])}return e}_generateMapDataHash(t){var e="A",s=0,a=0,i=0;for(i=0;i<t.map.length;i++){for(a=0;a<t.map[i].length;)s=this._countSamePartsLength(t.map[i],a),e+=t.map[i][a]+"|"+s+"/",a+=s;for(a=0;a<t.mapObject[i].length;)s=this._countSamePartsLength(t.mapObject[i],a),e+=t.mapObject[i][a]+"|"+s+"/",a+=s}for(var r=0;r<t.mapAttribute.length;r++)for(var o=0;o<t.mapAttribute[r].length;o++)e+=t.mapAttribute[r][o]+"/";for(var n=0;n<t.objectAttribute.length;n++)for(var _=0;_<t.objectAttribute[n].length;_++)e+=t.objectAttribute[n][_]+"/";return Ye(e+="Z")}_generateSaveDataHash(t){var e=this._generateMapDataHash(t),s=[];for(var a in t)"map"!==a&&"mapObject"!==a&&"mapCompressed"!==a&&"mapObjectCompressed"!==a&&"mapAttribute"!==a&&"objectAttribute"!==a&&"checkString"!==a&&s.push(a);s.sort();for(var i=0;i<s.length;i++)e+=pt(t[s[i]]);return Ye(e)}compressSystem(){return Xe}_quickSave(t){var e,s,a,i,r=JSON.parse(JSON.stringify(this._wwaData)),o=this._player.getPosition().getPartsCoord(),n=this._player.getStatusWithoutEquipments();switch(r.itemBox=this._player.getCopyOfItemBox(),r.playerX=o.x,r.playerY=o.y,r.statusEnergyMax=this._player.getEnergyMax(),r.statusEnergy=n.energy,r.statusStrength=n.strength,r.statusDefence=n.defence,r.statusGold=n.gold,r.moves=this._player.getMoveCount(),r.frameCount=this._player.getFrameCount(),r.gameSpeedIndex=this._player.getSpeedIndex(),r.playTime=null!==(s=null===(e=this._playTimeCalculator)||void 0===e?void 0:e.calculateTimeMs())&&void 0!==s?s:0,t){case I.CALL_BY_LOG_QUICK_SAVE:case I.CALL_BY_QUICK_SAVE:case I.CALL_BY_SUSPEND:break;case I.CALL_BY_PASSWORD_SAVE:r.checkOriginalMapString=this.checkOriginalMapString,r.checkString=this._generateSaveDataHash(r)}switch(r.message=void 0,r.mapAttribute=void 0,r.objectAttribute=void 0,t){case I.CALL_BY_QUICK_SAVE:return this._messageWindow.save(this._cvs,r),this.wwaCustomEvent("wwa_quicksave",{data:r}),"";case I.CALL_BY_PASSWORD_SAVE:const t=Xe.compress(r);t.isCompress=1;const e=JSON.stringify(t);return this.wwaCustomEvent("wwa_passwordsave",{data:r,compress:t}),a=e,i=this._wwaData.worldPassNumber,console.warn(Ue.enc.Utf8.parse(a)),Ue.AES.encrypt(Ue.enc.Utf8.parse(a),We(i)).toString();case I.CALL_BY_SUSPEND:this.wwaCustomEvent("wwa_suspend",{data:r,compress:Xe.compress(r)});break;case I.CALL_BY_LOG_QUICK_SAVE:this.wwaCustomEvent("wwa_autosave",{data:r}),this._wwaSave.autoSave(this._cvs,r)}}wwaCustomEvent(t,e={}){this.wwaCustomEventEmitter.dispatch(t,e)}_decodePassword(t){let e,s="";try{a=t,i=this._wwaData.worldPassNumber,s=Ue.AES.decrypt(a,We(i)).toString(Ue.enc.Utf8)}catch(t){e=t}var a,i,r;if(!s){console.warn("新方式でのパスワード暗号化解除失敗:",e);try{s=function(t,e,s){return Ue.AES.decrypt(t,function(t,e){return`^ /${231*t+8310+e}P+>A[]`}(e,s)).toString(Ue.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]=Xe.decompress(r);return[qe(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 a,i=!1;if(null!==e){const t=this._decodePassword(e);a=t[0],i=t[1].isWorldNameEmpty}else a=JSON.parse(JSON.stringify(t?this._restartData:this._messageWindow.load()));if(a.message=JSON.parse(JSON.stringify(this._restartData.message)),a.mapAttribute=JSON.parse(JSON.stringify(this._restartData.mapAttribute)),a.objectAttribute=JSON.parse(JSON.stringify(this._restartData.objectAttribute)),void 0===a.map&&(a.map=this._decompressMap(a.mapCompressed)),void 0===a.mapObject&&(a.mapObject=this._decompressMap(a.mapObjectCompressed)),delete a.mapCompressed,delete a.mapObjectCompressed,null!==e){if(!i&&a.worldName!==this._wwaData.worldName)throw console.error("Invalid title",`(password)=${a.worldName} (current map)=${this._wwaData.worldName}`),new Error("前回パスワード取得時から、制作者によってワールド名が変更されたためロードできませんでした。\n予めご了承ください。");const t=this.checkOriginalMapString;if(this._isDisallowLoadOldSave&&a.checkOriginalMapString!==t)throw console.error("Invalid hash",`(password)=${a.checkOriginalMapString} (current map)=${t}`),new Error("前回パスワード取得時から、制作者によってマップが変更されたためロードできませんでした。\n(マップデータ制作者の設定により、内容が変更されると以前のパスワードは利用できなくなります。)\n予めご了承ください。");console.log("Valid Password!")}return s&&this._applyQuickLoad(a),a}_applyQuickLoad(t){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(L.NO_SOUND):this.playSound(t.bgm,t.bgmDelayDurationMs),this.setImgClick(new n(t.imgClickX,t.imgClickY)),0!==this.getObjectIdByPosition(this._player.getPosition())&&this._player.setPartsAppearedFlag(),this._playTimeCalculator=new rt(t.playTime),this._wwaData=t,this._mapIDTableCreate(),this._replaceAllRandomObjects(),this.setStatusIconCoord(R.ENERGY,new n(t.imgStatusEnergyX,t.imgStatusEnergyY)),this.setStatusIconCoord(R.STRENGTH,new n(t.imgStatusStrengthX,t.imgStatusStrengthY)),this.setStatusIconCoord(R.DEFENCE,new n(t.imgStatusDefenceX,t.imgStatusDefenceY)),this.setStatusIconCoord(R.GOLD,new n(t.imgStatusGoldX,t.imgStatusGoldY)),this.setWideCellCoord(new n(t.imgWideCellX,t.imgWideCellY)),this.setItemboxBackgroundPosition({x:t.imgItemboxX,y:t.imgItemboxY}),this.setFrameCoord(new n(t.imgFrameX,t.imgFrameY)),this.setPlayerSpeedIndex(t.gameSpeedIndex),this.updateCSSRule(),this.updateEffect(),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 a=s<<j.BITSHIFT|e;t=this._wwaData.map[s][e],this._mapIDTable[t]instanceof Array||(this._mapIDTable[t]=[]),this._mapIDTable[t].push(a),t=this._wwaData.mapObject[s][e],this._mapObjectIDTable[t]instanceof Array||(this._mapObjectIDTable[t]=[]),this._mapObjectIDTable[t].push(a)}}_restartGame(){this._quickLoad(!0)}_fadeout(t){var e=0,s=W.MAP_WINDOW_WIDTH,a=W.FADEOUT_SPEED,i=lt("wwa-fader");i.style.display="block";var r=setInterval((()=>{if(e+=a,(s-=2*a)<=0||2*e>W.MAP_WINDOW_WIDTH)return i.removeAttribute("style"),i.style.display="block",i.style.borderWidth="0",i.style.width=W.MAP_WINDOW_WIDTH+"px",i.style.height=W.MAP_WINDOW_HEIGHT+"px",i.style.backgroundColor="#808080",clearInterval(r),void t();i.style.width=s+"px",i.style.height=s+"px",i.style.borderWidth=e+"px"}),20)}moveObjects(t){var e,s,a,i=this._camera.getPosition(),r=(this._player.getPosition(),i.getPartsCoord(),i.getPartsCoord().x),o=i.getPartsCoord().y;if(this.getMapAttributeByPosition(this._player.getPosition(),W.ATR_TYPE)!==W.MAP_LOCALGATE&&this.getObjectAttributeByPosition(this._player.getPosition(),W.ATR_TYPE)!==W.OBJECT_LOCALGATE){for(e=new Array(W.V_PARTS_NUM_IN_WINDOW+2),this.hoge=new Array(W.V_PARTS_NUM_IN_WINDOW+2),a=-1;a<=W.V_PARTS_NUM_IN_WINDOW;a++)for(e[a+1]=new Array(W.H_PARTS_NUM_IN_WINDOW+2),this.hoge[a+1]=new Array(W.H_PARTS_NUM_IN_WINDOW+2),s=-1;s<=W.H_PARTS_NUM_IN_WINDOW;s++)if(o+a<0||o+a>=this._wwaData.mapWidth||r+s<0||r+s>=this._wwaData.mapWidth)e[a+1][s+1]=0,this.hoge[a+1][s+1]=0;else{try{var h=(c=new _(this,r+s,o+a,0,0)).getPartsCoord()}catch(t){e[a+1][s+1]=0,this.hoge[a+1][s+1]=0;continue}this._wwaData.mapObject[h.y][h.x];e[a+1][s+1]=this._wwaData.mapObject[h.y][h.x],this.hoge[a+1][s+1]=-this._wwaData.mapObject[h.y][h.x]}for(s=-1;s<=W.H_PARTS_NUM_IN_WINDOW;s++)if(!(r+s<0||r+s>=this._wwaData.mapWidth))for(a=-1;a<=W.V_PARTS_NUM_IN_WINDOW;a++)if(!(o+a<0||o+a>=this._wwaData.mapWidth)){try{var c;h=(c=new _(this,r+s,o+a,0,0)).getPartsCoord()}catch(t){continue}var l=this._wwaData.mapObject[h.y][h.x];if(0!==l&&this._wwaData.objectAttribute[l][W.ATR_MOVE]!==D.STATIC&&this._wwaData.objectAttribute[l][W.ATR_TYPE]!==W.OBJECT_LOCALGATE&&this._wwaData.objectAttribute[l][W.ATR_TYPE]!==W.OBJECT_RANDOM&&(this._wwaData.objectAttribute[l][W.ATR_MOVE]===D.CHASE_PLAYER||this._wwaData.objectAttribute[l][W.ATR_MOVE]===D.RUN_OUT||this._wwaData.objectAttribute[l][W.ATR_MOVE]===D.HANG_AROUND)){var u=this._wwaData.objectAttribute[l][W.ATR_MOVE];if(u!==D.HANG_AROUND){var d,E=this._getCandidateCoord(t,c,u),m=new n(E.x,h.y),w=new n(h.x,E.y),p=null;if(this._objectCanMoveTo(t,E,e))this._setObjectsInNextFrame(h,E,r,o,e,l);else{var g=this._getSecondCandidateMoveMode(t,h,E,m,w,this._wwaData.objectAttribute[l][W.ATR_TYPE]===W.OBJECT_MONSTER,e);g===C.MODE_X?this._setObjectsInNextFrame(h,m,r,o,e,l):g===C.MODE_Y?this._setObjectsInNextFrame(h,w,r,o,e,l):null===(p=this._getThirdCandidate(t,c,E,u,e))||this._wwaData.isOldMove?(d=this._getRandomMoveCoord(t,c,e),this._setObjectsInNextFrame(h,d,r,o,e,l)):this._setObjectsInNextFrame(h,p,r,o,e,l)}}else d=this._getRandomMoveCoord(t,c,e),this._setObjectsInNextFrame(h,d,r,o,e,l)}}}}_getCandidateCoord(t,e,s){var a=e.getPartsCoord();this._player.getPosition().getOffsetCoord(),this._player.getPosition().getPartsCoord();try{var i=t?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord()}catch(t){throw new Error("予期せぬ方向への移動のようです。")}var r=a.clone(),o=0,n=0;return s===D.CHASE_PLAYER?(o=a.x>i.x?-1:a.x<i.x?1:0,n=a.y>i.y?-1:a.y<i.y?1:0):s===D.RUN_OUT&&(o=a.x>i.x?1:a.x<i.x?-1:0,n=a.y>i.y?1:a.y<i.y?-1:0),r.x+=o,r.y+=n,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,a,i,r,o){return!t||(this._player.getDir()!==u.UP&&this._player.getDir()!==u.DOWN||!r)&&(this._player.getDir()!==u.LEFT&&this._player.getDir()!==u.RIGHT||r)?this._objectCanMoveTo(t,a,o)?C.MODE_X:this._objectCanMoveTo(t,i,o)?C.MODE_Y:C.UNDECIDED:this._objectCanMoveTo(t,i,o)?C.MODE_Y:this._objectCanMoveTo(t,a,o)?C.MODE_X:C.UNDECIDED}_getThirdCandidate(t,e,s,a,i){var r,o=a===D.CHASE_PLAYER?1:a===D.RUN_OUT?-1:0,_=t?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord(),h=e.getPartsCoord();if(_.x!==h.x){if(r=new n(s.x,h.y+1*o),this._objectCanMoveTo(t,r,i))return r;if(r=new n(s.x,h.y-1*o),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x,h.y+1*o),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x,h.y-1*o),this._objectCanMoveTo(t,r,i))return r}if(_.y!==h.y){if(r=new n(h.x+1*o,s.y),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x-1*o,s.y),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x+1*o,h.y),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x-1*o,h.y),this._objectCanMoveTo(t,r,i))return r}return null}_getRandomMoveCoord(t,e,s){const a=e.getPartsCoord(),i=a.clone(),r=this._wwaData.isOldMove?W.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31:W.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],o=Math.floor(Math.random()*e.length);if(i.x=a.x+e[o],i.y=a.y+r[o],this._objectCanMoveTo(t,i,s))return i}return a}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 a=this._wwaData.map[e.y][e.x],i=this._wwaData.mapObject[e.y][e.x],r=this._wwaData.mapAttribute[a][W.ATR_TYPE],o=this._camera.getPosition(),n=o.getPartsCoord().x,_=o.getPartsCoord().y;if(0===a&&!this.isOldMap()||r===W.MAP_WALL)return!1;var h=e.x-n+1,c=e.y-_+1;if(0<=h&&0<=c&&h<s.length&&c<s.length){if(0!==s[c][h])return!1}else if(0!==i)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,a,i,r){var o=e.x-s+1,n=e.y-a+1;0<=e.x&&e.x<=this._wwaData.mapWidth&&0<=e.y&&e.y<=this._wwaData.mapWidth&&(0<=o&&o<i.length&&0<=n&&n<i.length&&(i[t.y-a+1][t.x-s+1]=0,i[e.y-a+1][e.x-s+1]=r,this.hoge[e.y-a+1][e.x-s+1]=r),this._objectMovingDataManager.add(r,t.convertIntoPosition(this),e.convertIntoPosition(this),t.getDirectionTo(e)))}launchBattleEstimateWindow(){var t=this._camera.getPosition().getPartsCoord(),e=Math.max(0,t.x),s=Math.min(this._wwaData.mapWidth-1,t.x+W.H_PARTS_NUM_IN_WINDOW-1),a=Math.max(0,t.y),i=Math.min(this._wwaData.mapWidth-1,t.y+W.V_PARTS_NUM_IN_WINDOW-1),r=[];this.playSound(L.DECISION);for(var o=e;o<=s;o++)for(var n=a;n<=i;n++){var _=this._wwaData.mapObject[n][o];this._wwaData.objectAttribute[_][W.ATR_TYPE]===W.OBJECT_MONSTER&&-1===r.indexOf(_)&&r.push(_)}return this._bottomButtonType===l.BATTLE_REPORT&<(P[v.GOTO_WWA]).classList.add("onpress"),0===r.length?(lt(P[v.GOTO_WWA]).classList.remove("onpress"),this.hideBattleEstimateWindow(),!1):(this._battleEstimateWindow.update(this._player.getStatus(),r),this._battleEstimateWindow.show(),this._player.setEstimateWindowWating(),!0)}hideBattleEstimateWindow(){this._battleEstimateWindow.hide(),this._player.clearEstimateWindowWaiting(),lt(P[v.GOTO_WWA]).classList.remove("onpress")}hidePasswordWindow(t=!1){if(this._passwordWindow.hide(),t||this._passwordWindow.mode===Ce.SAVE)this._player.clearPasswordWindowWaiting();else{try{var e=this._quickLoad(!1,this._passwordWindow.password,!1)}catch(t){return this._player.clearPasswordWindowWaiting(),void alert("セーブデータの復元に失敗しました。\nエラー詳細:\n"+t.message)}this._passwordLoadExecInNextFrame=!0,this._passwordSaveExtractData=e}}_displayUserVars(){if(this._canDisplayUserVars&&this._inlineUserVarViewer&&(this._inlineUserVarViewer.isVisible=!0,this._player.isControllable())){let 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<W.INLINE_USER_VAR_VIEWER_DISPLAY_NUM;e++){let s=(this._inlineUserVarViewer.topUserVarIndex+e)%W.USER_VAR_NUM;t+=`${`変数 ${s}: ${this._userVarNameList&&this._userVarNameList[s]?this._userVarNameList[s]:"名無し"}`}: ${this._wwaData.userVar[s]}\n`}t+="\n操作方法\n",t+="上キー:1つ戻す 下キー:1つ進める\n",t+="左キー:10つ戻す 右キー:10つ進める\n",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 A.NINTENDO:e=" 【操作方法】\nA:Yes,戦闘結果予測の表示\nB:No\nX:メニュー\nY:このリストの表示\nR:初めからスタート\nZL:データの一時保存\nZR:一時保存データの読み込み\n+: 移動速度を上げる\n-: 移動速度を落とす\n WWA Wing バージョン:3.12.20\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;case A.PLAY_STATION:e=" 【操作方法】\n〇:Yes,戦闘結果予測の表示\n×:No\n△:メニュー\n□:このリストの表示\nR1:初めからスタート\nL2:データの一時保存\nR2:一時保存データの読み込み\nOPTIONS: 移動速度を上げる\nSHARE: 移動速度を落とす\n 現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?" プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:3.12.20\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;case A.XBOX:e=" 【操作方法】\nB:Yes,戦闘結果予測の表示\nA:No\nY:メニュー\nX:このリストの表示\nRB:初めからスタート\nLT:データの一時保存\nRT:一時保存データの読み込み\nMENU: 移動速度を上げる\nWINDOW: 移動速度を落とす\n 現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?" プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:3.12.20\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 バージョン:3.12.20\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;default:return}e&&this.generatePageAndReserveExecution(e,!1,!0)}}_setNextPage(){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?this._hideMessageWindow():this._shouldSetNextPage=!0,this._inlineUserVarViewer&&(this._inlineUserVarViewer.isVisible=!1)}_hideMessageWindow(){var t=0;this._player.isReadyToUseItem()&&(t=this._player.useItem());var e=this.getObjectAttributeById(t,W.ATR_STRING);this.clearFaces(),0===e?(this._messageWindow.isVisible()&&(this._player.setDelayFrame(),this._messageWindow.hide(),this._keyStore.allClear(),this._mouseStore.clear()),this._player.clearMessageWaiting()):this.generatePageAndReserveExecution(this.getMessageById(e),!1,!1,t,g.OBJECT,this._player.getPosition().getPartsCoord())}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=g.OBJECT,a=!1){var i,r,o,n,_,h,c,l,u=this._camera.getPosition().getPartsCoord(),d=a?Math.max(0,u.x):0,E=a?Math.min(this._wwaData.mapWidth-1,u.x+W.H_PARTS_NUM_IN_WINDOW-1):this._wwaData.mapWidth-1,m=a?Math.max(0,u.y):0,w=a?Math.min(this._wwaData.mapWidth-1,u.y+W.V_PARTS_NUM_IN_WINDOW)-1:this._wwaData.mapWidth-1;if(a=0!==d||E!==this._wwaData.mapWidth-1||0!==m||w!==this._wwaData.mapWidth-1,s===g.OBJECT)if(t=this.loadMapPartsObjectID(t),e=this.loadMapPartsObjectID(e),n=this._mapObjectIDTable[t].concat(),(c=this._mapObjectIDTable[t]).length=0,l=this._mapObjectIDTable[e],r=n.length,a)for(o=0;o<r;o++)_=(i=n[o])&j.BITMASK,h=i>>>j.BITSHIFT&j.BITMASK,d<=_&&_<=E&&m<=h&&h<=w?(this._wwaData.mapObject[h][_]=e,l.push(i)):c.push(i);else{for(o=0;o<r;o++)_=(i=n[o])&j.BITMASK,h=i>>>j.BITSHIFT&j.BITMASK,this._wwaData.mapObject[h][_]=e;Array.prototype.push.apply(l,n)}else if(t=this.loadMapPartsID(t),e=this.loadMapPartsID(e),n=this._mapIDTable[t].concat(),(c=this._mapIDTable[t]).length=0,l=this._mapIDTable[e],r=n.length,a)for(o=0;o<r;o++)_=(i=n[o])&j.BITMASK,h=i>>>j.BITSHIFT&j.BITMASK,d<=_&&_<=E&&m<=h&&h<=w?(this._wwaData.map[h][_]=e,l.push(i)):c.push(i);else{for(o=0;o<r;o++)_=(i=n[o])&j.BITMASK,h=i>>>j.BITSHIFT&j.BITMASK,this._wwaData.map[h][_]=e;Array.prototype.push.apply(l,n)}}getYesNoImgCoord(){return new n(this._wwaData.yesnoImgPosX,this._wwaData.yesnoImgPosY)}setYesNoImgCoord(t){return this._wwaData.yesnoImgPosX=t.x,this._wwaData.yesnoImgPosY=t.y,t}getPlayerImgCoord(){return new n(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}toValidStatusValue(t){return this.isNotNumberTypeOrNaN(t)||t<0?0:Math.floor(t)}setPlayerStatus(t,e,s){if(t===M.ENERGY){if(this._player.setEnergy(this.toValidStatusValue(e)),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:s}))return this.gameover(),{isGameOver:!0}}else if(t===M.STRENGTH)this._player.setStrength(this.toValidStatusValue(e));else if(t===M.DEFENCE)this._player.setDefence(this.toValidStatusValue(e));else if(t===M.GOLD)this._player.setGold(this.toValidStatusValue(e));else{if(t!==M.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*W.CHIP_SIZE,a=e.y*W.CHIP_SIZE,i=t=>{dt(`${t}>.status-icon`).style.backgroundPosition=`-${s}px -${a}px`};switch(t){case R.ENERGY:this._wwaData.imgStatusEnergyX=e.x,this._wwaData.imgStatusEnergyY=e.y,i("#disp-energy");break;case R.STRENGTH:this._wwaData.imgStatusStrengthX=e.x,this._wwaData.imgStatusStrengthY=e.y,i("#disp-strength");break;case R.DEFENCE:this._wwaData.imgStatusDefenceX=e.x,this._wwaData.imgStatusDefenceY=e.y,i("#disp-defence");break;case R.GOLD:this._wwaData.imgStatusGoldX=e.x,this._wwaData.imgStatusGoldY=e.y,i("#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*W.CHIP_SIZE,s=t.y*W.CHIP_SIZE;return Array.prototype.forEach.call(Et("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)}setImgClick(t){if(this._wwaData.imgClickX=t.x,this._wwaData.imgClickY=t.y,t.equals(new n(0,0)))Array.prototype.forEach.call(Et(".item-cell>.item-click-border"),(t=>{t.style.backgroundImage="url('"+W.ITEM_BORDER_IMG_DATA_URL+"')",t.style.backgroundPosition="0 0"}));else{var e=this._wwaData.mapCGName.replace("(","\\(").replace(")","\\)");Array.prototype.forEach.call(Et(".item-cell>.item-click-border"),(s=>{s.style.backgroundImage="url('"+e+"')",s.style.backgroundPosition="-"+t.x*W.CHIP_SIZE+"px -"+t.y*W.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}initCSSRule(){this._styleElm=lt(W.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,a=`\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`,i="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[X.MESSAGE_WINDOW]=this._sheet.addRule(e,a),this._stylePos[X.SIDEBAR]=this._sheet.addRule(i,r)):(this._stylePos[X.MESSAGE_WINDOW]=this._sheet.insertRule(`${e} { ${a} }`,0),this._stylePos[X.SIDEBAR]=this._sheet.insertRule(`${i} { ${r} }`,1))}changeStyleRule(t,e,s,a){t===K.COLOR_FRAME?(this._wwaData.frameColorR=e,this._wwaData.frameColorG=s,this._wwaData.frameColorB=a):t===K.COLOR_FRAMEOUT?(this._wwaData.frameOutColorR=e,this._wwaData.frameOutColorG=s,this._wwaData.frameOutColorB=a):t===K.COLOR_STR?(this._wwaData.fontColorR=e,this._wwaData.fontColorG=s,this._wwaData.fontColorB=a):t===K.COLOR_STATUS_STR&&(this._wwaData.statusColorR=e,this._wwaData.statusColorG=s,this._wwaData.statusColorB=a),this.updateCSSRule()}showMonsterWindow(){this._monsterWindow.show()}isClassicMode(){return this._isClassicModeEnable}isConsoleOutputMode(){return this._useConsole}forcedJumpGate(t,e){this._player.jumpTo(new _(this,t,e,0,0))}setUserVar(t,e){if(this.isNotNumberTypeOrNaN(t)||!this.isValidUserVarIndex(t))throw new Error(`代入先のユーザ変数の番号 が 0 以上 ${W.USER_VAR_NUM-1} 以下の数値になっていません!`);this._wwaData.userVar[t]=this.toAssignableValue(e),this._messageWindow.update()}toAssignableValue(t){const e=t>0?Math.floor(t):Math.ceil(t),s=Math.max(Math.min(e,W.USER_VAR_NUM_MAX_VALUE),W.USET_VAR_NUM_MIN_VALUE);return this.isNotNumberTypeOrNaN(s)?0:s}isValidUserVarIndex(t){return"number"==typeof t&&t>=0&&t<W.USER_VAR_NUM&&(0|t)===t}isNotNumberTypeOrNaN(t){return"number"!=typeof t||t!=t}getUserVar(t){return this._wwaData.userVar[t]}recUserPosition(t,e){var s=this._player.getPosition().getPartsCoord();this.setUserVar(t,s.x),this.setUserVar(e,s.y)}jumpRecUserPosition(t,e){this.forcedJumpGate(this._wwaData.userVar[t],this._wwaData.userVar[e])}outputUserVar(t){console.log("Var["+t+"] = "+this._wwaData.userVar[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("ユーザ変数の添字が範囲外です。");return this._player.setEnergy(this.toValidStatusValue(this._wwaData.userVar[t])),this._player.updateStatusValueBox(),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:e})?(this.gameover(),{isGameOver:!0}):{}}setHPMAXUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");this._player.setEnergyMax(this.toValidStatusValue(this._wwaData.userVar[t])),this._player.updateStatusValueBox()}setATUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");this._player.setStrength(this.toValidStatusValue(this._wwaData.userVar[t])),this._player.updateStatusValueBox()}setDFUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");this._player.setDefence(this.toValidStatusValue(this._wwaData.userVar[t])),this._player.updateStatusValueBox()}setMONEYUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");this._player.setGold(this.toValidStatusValue(this._wwaData.userVar[t])),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._wwaData.userVar[e])}setUserValAdd(t,e){this.setUserVar(t,this._wwaData.userVar[t]+this._wwaData.userVar[e])}setUserValSub(t,e){this.setUserVar(t,this._wwaData.userVar[t]-this._wwaData.userVar[e])}setUserValMul(t,e){this.setUserVar(t,this._wwaData.userVar[t]*this._wwaData.userVar[e])}setUserValDiv(t,e){this.setUserVar(t,0===this._wwaData.userVar[e]?0:this._wwaData.userVar[t]/this._wwaData.userVar[e])}setUserValMod(t,e){this.setUserVar(t,0===this._wwaData.userVar[e]?0:this._wwaData.userVar[t]%this._wwaData.userVar[e])}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._wwaData.userVar[s]:s;return null!==ue(t).match(re)?()=>Ee(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=ue(t),a=s.match(ae);if(null!==a){const t=de(a[2],e),s=de(a[4],e);return le(Mt(a[3],t,s),a[1])}const i=s.match(ie);if(null!==i){const t=de(i[1],e),s=de(i[3],e);return le(Mt(i[2],t,s),i[1])}throw new Error("setMacroのフォーマットを満たしていません: "+t)}(t,this.generateTokenValues(e.triggerParts)),{assignee:a,rawValue:i}=s;switch(a){case"energy":if(this._player.setEnergy(this.toValidStatusValue(i)),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:!0}))return this._player.updateStatusValueBox(),this.gameover(),{isGameOver:!0};break;case"energyMax":this._player.setEnergyMax(this.toValidStatusValue(i));break;case"strength":this._player.setStrength(this.toValidStatusValue(i));break;case"defence":this._player.setDefence(this.toValidStatusValue(i));break;case"gold":this._player.setGold(this.toValidStatusValue(i));break;case"moveCount":this._player.setMoveCount(this.toValidStatusValue(i));break;case"variable":if(isNaN(s.index)||!this.isValidUserVarIndex(s.index))throw new Error("ユーザ変数の添字が範囲外です。");this.setUserVar(s.index,this.toAssignableValue(i));break;case"map":this.appearPartsEval(e.triggerParts.position,`${s.x}`,`${s.y}`,s.rawValue,g.MAP);break;case"mapObject":this.appearPartsEval(e.triggerParts.position,`${s.x}`,`${s.y}`,s.rawValue,g.OBJECT);break;case"item":this.setPlayerGetItem(s.boxIndex1to12,i);break;case"playerDirection":this._player.setDir(i)}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._wwaData.userVar,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),a=parseInt(e[2],10);if(!this.isValidUserVarIndex(s)||!this.isValidUserVarIndex(a))throw new Error("判定対象のユーザ変数の添字が範囲外です!");const i=this._wwaData.userVar[s],r=e[1],o=this._wwaData.userVar[a],n=t=>parseInt(t,10)?g.MAP:g.OBJECT;if(this.compareUserVar(i,r,o)){const s=parseInt(e[3],10),a=e[4],i=e[5],r=n(e[6]);return void this.appearPartsEval(t,a,i,s,r)}if(void 0===e[9])return;const _=parseInt(e[7],10),h=e[8],c=e[9],l=n(e[10]);this.appearPartsEval(t,h,c,_,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<W.MIN_SPEED_INDEX||W.MAX_SPEED_INDEX<t)throw new Error("#set_speed の引数が異常です:"+t);this._wwaData.gameSpeedIndex=this._player.setSpeedIndex(t)}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>U.length)throw new Error("隠すパラメータは0から3の間で指定してください。");this._changeStatusVisibility(U[t],!e),this._player.updateStatusValueBox()}varMap(t,e,s,a,i){if(!this.isValidUserVarIndex(a))throw new Error("対象のユーザ変数の添字が範囲外です");const r=this._wwaData.userVar[a];if(r<0)throw new Error("負のパーツ番号は指定できません");if(i===g.OBJECT&&r>=this.getObjectPartsNum())throw new Error("物体パーツ番号の最大値を超えるパーツ番号が指定されました");if(i===g.MAP&&r>=this.getMapPartsNum())throw new Error("背景パーツ番号の最大値を超えるパーツ番号が指定されました");this.appearPartsEval(t,e,s,r,i)}setItemboxBackgroundPosition(t){this._wwaData.imgItemboxX=t.x,this._wwaData.imgItemboxY=t.y,Array.prototype.forEach.call(Et("div.item-cell"),(e=>{e.style.backgroundPosition=`-${t.x*W.CHIP_SIZE}px -${t.y*W.CHIP_SIZE}px`}))}_getVirtualPadButton(t){if(!ot.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,a;for(t=this._wwaData.gamePadButtonItemTable.length,e=0;e<t;e++)if(s=this._wwaData.gamePadButtonItemTable[e]){switch(a=!1,e){case Q.BUTTON_CROSS_KEY_LEFT:this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_LEFT)&&(a=!0);break;case Q.BUTTON_CROSS_KEY_RIGHT:this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_RIGHT)&&(a=!0);break;case Q.BUTTON_CROSS_KEY_UP:this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_UP)&&(a=!0);break;case Q.BUTTON_CROSS_KEY_DOWN:this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_DOWN)&&(a=!0)}if(this._gamePadStore.buttonTrigger(e)&&(a=!0),a&&this.onselectitem(s))return!0}return!1}setGamePadButtonItemTable(t,e){var s,a;if(!this._wwaData.gamePadButtonItemTable)for(a in this._wwaData.gamePadButtonItemTable=[],Q)s=a,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?ze.UNMATCHED_WORLD_NAME:s&&s!==as(this._wwaData.worldName,this._wwaData.worldPassNumber)?ze.UNMATCHED_WORLD_PASS_NUMBER:this._isDisallowLoadOldSave&&e!==this.checkOriginalMapString?ze.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}_loadSystemMessage(t){if(this._wwaData.customSystemMessages[t])return this._wwaData.customSystemMessages[t];const e=i[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 a.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 A.NINTENDO:return"Xボタンを押すか、右のボックスをタップする";case A.PLAY_STATION:return"△ボタンを押す";case A.XBOX:return"Yボタンを押す";default:return"右のボックスを選択する"}default:return"右のボックスを選択する"}})());case a.GAME_SPEED_CHANGED:{const t=this._player.getSpeedIndex();return e.replaceAll("%GAME_SPEED_NAME%",B[t]).replaceAll("%HIGH_SPEED_MESSAGE%",this.isBattleSpeedIndexForQuickBattle(t)?"戦闘も速くなります。\n":"").replaceAll("%MAX_SPEED_INDEX%",String(W.MAX_SPEED_INDEX+1)).replaceAll("%GAME_SPEED_INDEX%",String(t+1)).replaceAll("%SPEED_UP_BUTTON%",this.userDevice.os===A.NINTENDO?"+ボタン":"Pキー").replaceAll("%SPEED_DOWN_BUTTON%",this.userDevice.os===A.NINTENDO?"-ボタン":"Iキー")}default:return e}}overwriteSystemMessage(t,e){this._wwaData.customSystemMessages[t]=e}}var Ks=!1;function Xs(){if(navigator.userAgent.match(/(?:msie|trident)/i)||navigator.userAgent.match(/edge/i))return void alert("このゲームをプレイするには、Google Chrome や Mozilla Firefox などの最新のブラウザでこのページを開いてください。\nご利用の環境のサポートは、既に終了しています。");Array.prototype.forEach.call(Et("a.wwa-copyright"),(t=>{t.addEventListener("click",(()=>{Ks=!0}))})),window.addEventListener("beforeunload",(t=>{var e="このページを離れますか?";if(Ks)return Ks=!1,t.returnValue=e,e}));var t=lt("wwa-wrapper").getAttribute("data-wwa-title-img");const e=lt("wwa-wrapper").getAttribute("data-wwa-virtualpad-enable"),s=null!==e&&null!==e.match(/^true$/i);xe(lt("wwa-wrapper"),t,s);var a=lt("wwa-wrapper").getAttribute("data-wwa-mapdata"),i=lt("wwa-wrapper").getAttribute("data-wwa-audio-dir"),r=lt("wwa-wrapper").getAttribute("data-wwa-var-dump-elm"),o=null,n="true"===lt("wwa-wrapper").getAttribute("data-wwa-display-user-vars"),_=lt("wwa-wrapper").getAttribute("data-wwa-user-var-names-file");lt("wwa-wrapper").hasAttribute("data-wwa-var-dump-elm")&&n&&(o=function(t){const e=ut(t);return e instanceof HTMLElement?(e.classList.add("wwa-vardump-wrapper"),e.appendChild(Ls({kind:"numbered"})),e):null}(r));var h=!0;lt("wwa-wrapper").getAttribute("data-wwa-urlgate-enable").match(/^false$/i)&&(h=!1);var c=lt("wwa-wrapper").getAttribute("data-wwa-classic-mode-enable"),l=!1;null!==c&&c.match(/^true$/i)&&(l=!0);var u=!0,d=lt("wwa-wrapper").getAttribute("data-wwa-item-effect-enable");null!==d&&d.match(/^false$/i)&&(u=!1);let E=!1;const m=lt("wwa-wrapper").getAttribute("data-wwa-use-go-to-wwa");null!==m&&m.match(/^true$/i)&&(E=!0);const w=lt("wwa-wrapper").getAttribute("data-wwa-virtualpad-viewport-fit-enable");be()&&null!==w&&w.match(/^true$/i)&&(!function(){const t=document.getElementsByTagName("head")[0];let e=document.createElement("meta");e.setAttribute("name","viewport"),t.appendChild(e),ct()}(),window.addEventListener("resize",ct));const p=lt("wwa-wrapper").getAttribute("data-wwa-virtualpad-controller-elm"),g=s&&p?dt(p):null,A=(()=>{const t=lt("wwa-wrapper").getAttribute("data-wwa-disallow-load-old-save");return!(null===t||!t.match(/^true$/i))})();Vs=new Hs(a,h,t,l,u,E,i,A,o,_,n,s,g)}"complete"===document.readyState?setTimeout(Xs):window.addEventListener("load",(function(){setTimeout(Xs)}))}()}();
|
|
21
|
+
function(){var t=a,e=t.lib,s=e.WordArray,i=e.Hasher,r=t.algo,o=s.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]),n=s.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]),_=s.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]),h=s.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]),c=s.create([0,1518500249,1859775393,2400959708,2840853838]),l=s.create([1352829926,1548603684,1836072691,2053994217,0]),u=r.RIPEMD160=i.extend({_doReset:function(){this._hash=s.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var s=0;s<16;s++){var a=e+s,i=t[a];t[a]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8)}var r,u,A,S,T,I,v,y,O,D,C,f=this._hash.words,N=c.words,P=l.words,M=o.words,R=n.words,L=_.words,b=h.words;for(I=r=f[0],v=u=f[1],y=A=f[2],O=S=f[3],D=T=f[4],s=0;s<80;s+=1)C=r+t[e+M[s]]|0,C+=s<16?d(u,A,S)+N[0]:s<32?E(u,A,S)+N[1]:s<48?m(u,A,S)+N[2]:s<64?w(u,A,S)+N[3]:p(u,A,S)+N[4],C=(C=g(C|=0,L[s]))+T|0,r=T,T=S,S=g(A,10),A=u,u=C,C=I+t[e+R[s]]|0,C+=s<16?p(v,y,O)+P[0]:s<32?w(v,y,O)+P[1]:s<48?m(v,y,O)+P[2]:s<64?E(v,y,O)+P[3]:d(v,y,O)+P[4],C=(C=g(C|=0,b[s]))+D|0,I=D,D=O,O=g(y,10),y=v,v=C;C=f[1]+A+O|0,f[1]=f[2]+S+D|0,f[2]=f[3]+T+I|0,f[3]=f[4]+r+v|0,f[4]=f[0]+u+y|0,f[0]=C},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,a=8*t.sigBytes;e[a>>>5]|=128<<24-a%32,e[14+(a+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),t.sigBytes=4*(e.length+1),this._process();for(var i=this._hash,r=i.words,o=0;o<5;o++){var n=r[o];r[o]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}return i},clone:function(){var t=i.clone.call(this);return t._hash=this._hash.clone(),t}});function d(t,e,s){return t^e^s}function E(t,e,s){return t&e|~t&s}function m(t,e,s){return(t|~e)^s}function w(t,e,s){return t&s|e&~s}function p(t,e,s){return t^(e|~s)}function g(t,e){return t<<e|t>>>32-e}t.RIPEMD160=i._createHelper(u),t.HmacRIPEMD160=i._createHmacHelper(u)}(Math),a.RIPEMD160)},648:function(t,e,s){var a,i,r,o,n,_,h,c;t.exports=(c=s(518),i=(a=c).lib,r=i.WordArray,o=i.Hasher,n=a.algo,_=[],h=n.SHA1=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var s=this._hash.words,a=s[0],i=s[1],r=s[2],o=s[3],n=s[4],h=0;h<80;h++){if(h<16)_[h]=0|t[e+h];else{var c=_[h-3]^_[h-8]^_[h-14]^_[h-16];_[h]=c<<1|c>>>31}var l=(a<<5|a>>>27)+n+_[h];l+=h<20?1518500249+(i&r|~i&o):h<40?1859775393+(i^r^o):h<60?(i&r|i&o|r&o)-1894007588:(i^r^o)-899497514,n=o,o=r,r=i<<30|i>>>2,i=a,a=l}s[0]=s[0]+a|0,s[1]=s[1]+i|0,s[2]=s[2]+r|0,s[3]=s[3]+o|0,s[4]=s[4]+n|0},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,a=8*t.sigBytes;return e[a>>>5]|=128<<24-a%32,e[14+(a+64>>>9<<4)]=Math.floor(s/4294967296),e[15+(a+64>>>9<<4)]=s,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}}),a.SHA1=o._createHelper(h),a.HmacSHA1=o._createHmacHelper(h),c.SHA1)},623:function(t,e,s){var a,i,r,o,n,_;t.exports=(_=s(518),s(110),i=(a=_).lib.WordArray,r=a.algo,o=r.SHA256,n=r.SHA224=o.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=o._doFinalize.call(this);return t.sigBytes-=4,t}}),a.SHA224=o._createHelper(n),a.HmacSHA224=o._createHmacHelper(n),_.SHA224)},110:function(t,e,s){var a;t.exports=(a=s(518),function(t){var e=a,s=e.lib,i=s.WordArray,r=s.Hasher,o=e.algo,n=[],_=[];!function(){function e(e){for(var s=t.sqrt(e),a=2;a<=s;a++)if(!(e%a))return!1;return!0}function s(t){return 4294967296*(t-(0|t))|0}for(var a=2,i=0;i<64;)e(a)&&(i<8&&(n[i]=s(t.pow(a,.5))),_[i]=s(t.pow(a,1/3)),i++),a++}();var h=[],c=o.SHA256=r.extend({_doReset:function(){this._hash=new i.init(n.slice(0))},_doProcessBlock:function(t,e){for(var s=this._hash.words,a=s[0],i=s[1],r=s[2],o=s[3],n=s[4],c=s[5],l=s[6],u=s[7],d=0;d<64;d++){if(d<16)h[d]=0|t[e+d];else{var E=h[d-15],m=(E<<25|E>>>7)^(E<<14|E>>>18)^E>>>3,w=h[d-2],p=(w<<15|w>>>17)^(w<<13|w>>>19)^w>>>10;h[d]=m+h[d-7]+p+h[d-16]}var g=a&i^a&r^i&r,A=(a<<30|a>>>2)^(a<<19|a>>>13)^(a<<10|a>>>22),S=u+((n<<26|n>>>6)^(n<<21|n>>>11)^(n<<7|n>>>25))+(n&c^~n&l)+_[d]+h[d];u=l,l=c,c=n,n=o+S|0,o=r,r=i,i=a,a=S+(A+g)|0}s[0]=s[0]+a|0,s[1]=s[1]+i|0,s[2]=s[2]+r|0,s[3]=s[3]+o|0,s[4]=s[4]+n|0,s[5]=s[5]+c|0,s[6]=s[6]+l|0,s[7]=s[7]+u|0},_doFinalize:function(){var e=this._data,s=e.words,a=8*this._nDataBytes,i=8*e.sigBytes;return s[i>>>5]|=128<<24-i%32,s[14+(i+64>>>9<<4)]=t.floor(a/4294967296),s[15+(i+64>>>9<<4)]=a,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(c),e.HmacSHA256=r._createHmacHelper(c)}(Math),a.SHA256)},882:function(t,e,s){var a;t.exports=(a=s(518),s(703),function(t){var e=a,s=e.lib,i=s.WordArray,r=s.Hasher,o=e.x64.Word,n=e.algo,_=[],h=[],c=[];!function(){for(var t=1,e=0,s=0;s<24;s++){_[t+5*e]=(s+1)*(s+2)/2%64;var a=(2*t+3*e)%5;t=e%5,e=a}for(t=0;t<5;t++)for(e=0;e<5;e++)h[t+5*e]=e+(2*t+3*e)%5*5;for(var i=1,r=0;r<24;r++){for(var n=0,l=0,u=0;u<7;u++){if(1&i){var d=(1<<u)-1;d<32?l^=1<<d:n^=1<<d-32}128&i?i=i<<1^113:i<<=1}c[r]=o.create(n,l)}}();var l=[];!function(){for(var t=0;t<25;t++)l[t]=o.create()}();var u=n.SHA3=r.extend({cfg:r.cfg.extend({outputLength:512}),_doReset:function(){for(var t=this._state=[],e=0;e<25;e++)t[e]=new o.init;this.blockSize=(1600-2*this.cfg.outputLength)/32},_doProcessBlock:function(t,e){for(var s=this._state,a=this.blockSize/2,i=0;i<a;i++){var r=t[e+2*i],o=t[e+2*i+1];r=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),o=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),(f=s[i]).high^=o,f.low^=r}for(var n=0;n<24;n++){for(var u=0;u<5;u++){for(var d=0,E=0,m=0;m<5;m++)d^=(f=s[u+5*m]).high,E^=f.low;var w=l[u];w.high=d,w.low=E}for(u=0;u<5;u++){var p=l[(u+4)%5],g=l[(u+1)%5],A=g.high,S=g.low;for(d=p.high^(A<<1|S>>>31),E=p.low^(S<<1|A>>>31),m=0;m<5;m++)(f=s[u+5*m]).high^=d,f.low^=E}for(var T=1;T<25;T++){var I=(f=s[T]).high,v=f.low,y=_[T];y<32?(d=I<<y|v>>>32-y,E=v<<y|I>>>32-y):(d=v<<y-32|I>>>64-y,E=I<<y-32|v>>>64-y);var O=l[h[T]];O.high=d,O.low=E}var D=l[0],C=s[0];for(D.high=C.high,D.low=C.low,u=0;u<5;u++)for(m=0;m<5;m++){var f=s[T=u+5*m],N=l[T],P=l[(u+1)%5+5*m],M=l[(u+2)%5+5*m];f.high=N.high^~P.high&M.high,f.low=N.low^~P.low&M.low}f=s[0];var R=c[n];f.high^=R.high,f.low^=R.low}},_doFinalize:function(){var e=this._data,s=e.words,a=(this._nDataBytes,8*e.sigBytes),r=32*this.blockSize;s[a>>>5]|=1<<24-a%32,s[(t.ceil((a+1)/r)*r>>>5)-1]|=128,e.sigBytes=4*s.length,this._process();for(var o=this._state,n=this.cfg.outputLength/8,_=n/8,h=[],c=0;c<_;c++){var l=o[c],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),h.push(d),h.push(u)}return new i.init(h,n)},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),a.SHA3)},78:function(t,e,s){var a,i,r,o,n,_,h,c;t.exports=(c=s(518),s(703),s(759),i=(a=c).x64,r=i.Word,o=i.WordArray,n=a.algo,_=n.SHA512,h=n.SHA384=_.extend({_doReset:function(){this._hash=new o.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=_._doFinalize.call(this);return t.sigBytes-=16,t}}),a.SHA384=_._createHelper(h),a.HmacSHA384=_._createHmacHelper(h),c.SHA384)},759:function(t,e,s){var a;t.exports=(a=s(518),s(703),function(){var t=a,e=t.lib.Hasher,s=t.x64,i=s.Word,r=s.WordArray,o=t.algo;function n(){return i.create.apply(i,arguments)}var _=[n(1116352408,3609767458),n(1899447441,602891725),n(3049323471,3964484399),n(3921009573,2173295548),n(961987163,4081628472),n(1508970993,3053834265),n(2453635748,2937671579),n(2870763221,3664609560),n(3624381080,2734883394),n(310598401,1164996542),n(607225278,1323610764),n(1426881987,3590304994),n(1925078388,4068182383),n(2162078206,991336113),n(2614888103,633803317),n(3248222580,3479774868),n(3835390401,2666613458),n(4022224774,944711139),n(264347078,2341262773),n(604807628,2007800933),n(770255983,1495990901),n(1249150122,1856431235),n(1555081692,3175218132),n(1996064986,2198950837),n(2554220882,3999719339),n(2821834349,766784016),n(2952996808,2566594879),n(3210313671,3203337956),n(3336571891,1034457026),n(3584528711,2466948901),n(113926993,3758326383),n(338241895,168717936),n(666307205,1188179964),n(773529912,1546045734),n(1294757372,1522805485),n(1396182291,2643833823),n(1695183700,2343527390),n(1986661051,1014477480),n(2177026350,1206759142),n(2456956037,344077627),n(2730485921,1290863460),n(2820302411,3158454273),n(3259730800,3505952657),n(3345764771,106217008),n(3516065817,3606008344),n(3600352804,1432725776),n(4094571909,1467031594),n(275423344,851169720),n(430227734,3100823752),n(506948616,1363258195),n(659060556,3750685593),n(883997877,3785050280),n(958139571,3318307427),n(1322822218,3812723403),n(1537002063,2003034995),n(1747873779,3602036899),n(1955562222,1575990012),n(2024104815,1125592928),n(2227730452,2716904306),n(2361852424,442776044),n(2428436474,593698344),n(2756734187,3733110249),n(3204031479,2999351573),n(3329325298,3815920427),n(3391569614,3928383900),n(3515267271,566280711),n(3940187606,3454069534),n(4118630271,4000239992),n(116418474,1914138554),n(174292421,2731055270),n(289380356,3203993006),n(460393269,320620315),n(685471733,587496836),n(852142971,1086792851),n(1017036298,365543100),n(1126000580,2618297676),n(1288033470,3409855158),n(1501505948,4234509866),n(1607167915,987167468),n(1816402316,1246189591)],h=[];!function(){for(var t=0;t<80;t++)h[t]=n()}();var c=o.SHA512=e.extend({_doReset:function(){this._hash=new r.init([new i.init(1779033703,4089235720),new i.init(3144134277,2227873595),new i.init(1013904242,4271175723),new i.init(2773480762,1595750129),new i.init(1359893119,2917565137),new i.init(2600822924,725511199),new i.init(528734635,4215389547),new i.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var s=this._hash.words,a=s[0],i=s[1],r=s[2],o=s[3],n=s[4],c=s[5],l=s[6],u=s[7],d=a.high,E=a.low,m=i.high,w=i.low,p=r.high,g=r.low,A=o.high,S=o.low,T=n.high,I=n.low,v=c.high,y=c.low,O=l.high,D=l.low,C=u.high,f=u.low,N=d,P=E,M=m,R=w,L=p,b=g,x=A,B=S,U=T,W=I,Y=v,F=y,k=O,V=D,G=C,H=f,K=0;K<80;K++){var X,j,J=h[K];if(K<16)j=J.high=0|t[e+2*K],X=J.low=0|t[e+2*K+1];else{var $=h[K-15],Z=$.high,q=$.low,Q=(Z>>>1|q<<31)^(Z>>>8|q<<24)^Z>>>7,z=(q>>>1|Z<<31)^(q>>>8|Z<<24)^(q>>>7|Z<<25),tt=h[K-2],et=tt.high,st=tt.low,at=(et>>>19|st<<13)^(et<<3|st>>>29)^et>>>6,it=(st>>>19|et<<13)^(st<<3|et>>>29)^(st>>>6|et<<26),rt=h[K-7],ot=rt.high,nt=rt.low,_t=h[K-16],ht=_t.high,ct=_t.low;j=(j=(j=Q+ot+((X=z+nt)>>>0<z>>>0?1:0))+at+((X+=it)>>>0<it>>>0?1:0))+ht+((X+=ct)>>>0<ct>>>0?1:0),J.high=j,J.low=X}var lt,ut=U&Y^~U&k,dt=W&F^~W&V,Et=N&M^N&L^M&L,mt=P&R^P&b^R&b,wt=(N>>>28|P<<4)^(N<<30|P>>>2)^(N<<25|P>>>7),pt=(P>>>28|N<<4)^(P<<30|N>>>2)^(P<<25|N>>>7),gt=(U>>>14|W<<18)^(U>>>18|W<<14)^(U<<23|W>>>9),At=(W>>>14|U<<18)^(W>>>18|U<<14)^(W<<23|U>>>9),St=_[K],Tt=St.high,It=St.low,vt=G+gt+((lt=H+At)>>>0<H>>>0?1:0),yt=pt+mt;G=k,H=V,k=Y,V=F,Y=U,F=W,U=x+(vt=(vt=(vt=vt+ut+((lt+=dt)>>>0<dt>>>0?1:0))+Tt+((lt+=It)>>>0<It>>>0?1:0))+j+((lt+=X)>>>0<X>>>0?1:0))+((W=B+lt|0)>>>0<B>>>0?1:0)|0,x=L,B=b,L=M,b=R,M=N,R=P,N=vt+(wt+Et+(yt>>>0<pt>>>0?1:0))+((P=lt+yt|0)>>>0<lt>>>0?1:0)|0}E=a.low=E+P,a.high=d+N+(E>>>0<P>>>0?1:0),w=i.low=w+R,i.high=m+M+(w>>>0<R>>>0?1:0),g=r.low=g+b,r.high=p+L+(g>>>0<b>>>0?1:0),S=o.low=S+B,o.high=A+x+(S>>>0<B>>>0?1:0),I=n.low=I+W,n.high=T+U+(I>>>0<W>>>0?1:0),y=c.low=y+F,c.high=v+Y+(y>>>0<F>>>0?1:0),D=l.low=D+V,l.high=O+k+(D>>>0<V>>>0?1:0),f=u.low=f+H,u.high=C+G+(f>>>0<H>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,s=8*this._nDataBytes,a=8*t.sigBytes;return e[a>>>5]|=128<<24-a%32,e[30+(a+128>>>10<<5)]=Math.floor(s/4294967296),e[31+(a+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(c),t.HmacSHA512=e._createHmacHelper(c)}(),a.SHA512)},865:function(t,e,s){var a;t.exports=(a=s(518),s(201),s(989),s(953),s(768),function(){var t=a,e=t.lib,s=e.WordArray,i=e.BlockCipher,r=t.algo,o=[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],n=[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],_=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{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}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=r.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],s=0;s<56;s++){var a=o[s]-1;e[s]=t[a>>>5]>>>31-a%32&1}for(var i=this._subKeys=[],r=0;r<16;r++){var h=i[r]=[],c=_[r];for(s=0;s<24;s++)h[s/6|0]|=e[(n[s]-1+c)%28]<<31-s%6,h[4+(s/6|0)]|=e[28+(n[s+24]-1+c)%28]<<31-s%6;for(h[0]=h[0]<<1|h[0]>>>31,s=1;s<7;s++)h[s]=h[s]>>>4*(s-1)+3;h[7]=h[7]<<5|h[7]>>>27}var l=this._invSubKeys=[];for(s=0;s<16;s++)l[s]=i[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 a=0;a<16;a++){for(var i=s[a],r=this._lBlock,o=this._rBlock,n=0,_=0;_<8;_++)n|=h[_][((o^i[_])&c[_])>>>0];this._lBlock=o,this._rBlock=r^n}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=i._createHelper(l);var E=r.TripleDES=i.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),a=t.length<4?t.slice(0,2):t.slice(2,4),i=t.length<6?t.slice(0,2):t.slice(4,6);this._des1=l.createEncryptor(s.create(e)),this._des2=l.createEncryptor(s.create(a)),this._des3=l.createEncryptor(s.create(i))},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=i._createHelper(E)}(),a.TripleDES)},703:function(t,e,s){var a;t.exports=(a=s(518),function(t){var e=a,s=e.lib,i=s.Base,r=s.WordArray,o=e.x64={};o.Word=i.extend({init:function(t,e){this.high=t,this.low=e}}),o.WordArray=i.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=[],a=0;a<e;a++){var i=t[a];s.push(i.high),s.push(i.low)}return r.create(s,this.sigBytes)},clone:function(){for(var t=i.clone.call(this),e=t.words=this.words.slice(0),s=e.length,a=0;a<s;a++)e[a]=e[a].clone();return t}})}(),a)},156:function(){},699:function(){}},e={};function s(a){var i=e[a];if(void 0!==i)return i.exports;var r=e[a]={exports:{}};return t[a].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 a in e)s.o(e,a)&&!s.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:e[a]})},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:"相手の防御能力が高すぎる!"},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),a=e.reduce(((t,e)=>({...t,[e]:e})),{}),i=t;class r{add(t){return this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return new r(this.strength+t.strength,this.defence+t.defence)}minus(t){return new r(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 o extends r{add(t){return t instanceof o&&(this.energy+=t.energy,this.gold+=t.gold),this.strength+=t.strength,this.defence+=t.defence,this}plus(t){return t instanceof o?new o(this.energy+t.energy,this.strength+t.strength,this.defence+t.defence,this.gold+t.gold):new o(this.energy,this.strength+t.strength,this.defence+t.defence,this.gold)}minus(t){return t instanceof o?new o(this.energy-t.energy,this.strength-t.strength,this.defence-t.defence,this.gold-t.gold):new o(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)}constructor(t,e,s,a){super(e,s),this.energy=t,this.gold=a}}class n{equals(t){return this.x===t.x&&this.y===t.y}substract(t){return new n(this.x-t.x,this.y-t.y)}clone(){return new n(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?u.RIGHT_UP:this.y===t.y?u.RIGHT:u.RIGHT_DOWN:this.x===t.x?this.y>t.y?u.UP:this.y===t.y?u.NO_DIRECTION:u.DOWN:this.y>t.y?u.LEFT_UP:this.y===t.y?u.LEFT:u.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/(W.H_PARTS_NUM_IN_WINDOW-1))*(W.H_PARTS_NUM_IN_WINDOW-1),e=Math.floor(this._partsCoord.y/(W.V_PARTS_NUM_IN_WINDOW-1))*(W.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(),a=t.getPartsCoord().clone();return e.x===s-1&&a.x--,e.y===s-1&&a.y--,a.convertIntoPosition(this._wwa).getScreenTopPosition()}getNextJustPosition(t){if(void 0!==t){var e=this._partsCoord;return new _(this._wwa,e.x+d[t],e.y+E[t],0,0)}var s=this._partsCoord.x,a=this._partsCoord.y;return this._offsetCoord.x<0?s--:this._offsetCoord.x>0&&s++,this._offsetCoord.y<0?a--:this._offsetCoord.y>0&&a++,new _(this._wwa,s,a,0,0)}getNextFramePosition(t,e,s){var a=this._partsCoord.x,i=this._partsCoord.y,r=this._offsetCoord.x+d[t]*e,o=this._offsetCoord.y+E[t]*s;if(r<0){var n=Math.floor(Math.abs(r)/W.CHIP_SIZE);a-=n,r=(r+n*W.CHIP_SIZE)%W.CHIP_SIZE}if(o<0){var h=Math.floor(Math.abs(o)/W.CHIP_SIZE);i-=h,o=(o+h*W.CHIP_SIZE)%W.CHIP_SIZE}return r>=W.CHIP_SIZE&&(a+=Math.floor(r/W.CHIP_SIZE),r=(r+W.CHIP_SIZE)%W.CHIP_SIZE),o>=W.CHIP_SIZE&&(i+=Math.floor(o/W.CHIP_SIZE),o=(o+W.CHIP_SIZE)%W.CHIP_SIZE),new _(this._wwa,a,i,r,o)}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,a=this._partsCoord.x,i=this._partsCoord.y,r=e?1:0;return s.x<=a&&a<s.x+W.H_PARTS_NUM_IN_WINDOW-r&&s.y<=i&&i<s.y+W.V_PARTS_NUM_IN_WINDOW-r}hasLocalGate(){return this._wwa.getMapTypeByPosition(this)===W.MAP_LOCALGATE||this._wwa.getObjectTypeByPosition(this)===W.OBJECT_LOCALGATE}clone(){return new _(this._wwa,this._partsCoord.x,this._partsCoord.y,this._offsetCoord.x,this._offsetCoord.y)}constructor(t,e,s,a=0,i=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&&a>0||s<0||s>=r||s>=r-1&&i>0)throw new Error("範囲外の座標です!! parts:("+e+", "+s+"), offset:("+a+", "+i+"), mapWidth = "+r);this._partsCoord=new n(e,s),this._offsetCoord=new n(a,i)}}class h{constructor(t,e,s){this.destPos=t.clone(),this.srcPos=e.clone(),this.srcSize=s.clone()}}class c{constructor(t,e,s,a,i){this.partsIDObj=t,this.x=e,this.y=s,this.isStatic=a,this.isFighting=i}}var l,u;!function(t){t[t.GOTO_WWA=0]="GOTO_WWA",t[t.BATTLE_REPORT=1]="BATTLE_REPORT",t[t.GAME_END=2]="GAME_END"}(l||(l={})),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"}(u||(u={}));const d=[0,-1,0,1,-1,0,1,-1,0,1],E=[0,1,1,1,0,0,0,-1,-1,-1];var m,w,p,g,A,S,T,I,v,y,O,D,C;!function(t){t[t.YES=0]="YES",t[t.NO=1]="NO",t[t.UNSELECTED=2]="UNSELECTED"}(m||(m={})),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"}(p||(p={})),function(t){t[t.MAP=1]="MAP",t[t.OBJECT=0]="OBJECT"}(g||(g={}));class f{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)?A.XBOX:t.match(/windows/i)?A.WINDOWS:t.match(/macintosh/i)?"ontouchstart"in document?A.IOS:A.MACINTOSH:t.match(/iphone|ipad|ipod/i)?A.IOS:t.match(/oculus/i)?A.OCULUS:t.match(/android/i)?A.ANDROID:t.match(/nintendo/i)?A.NINTENDO:t.match(/playstation/i)?A.PLAY_STATION:t.match(/linux/i)?A.LINUX:A.OTHERS}getBrowser(t){return t.match(/chrome/i)?T.CHROME:t.match(/firefox/i)?T.FIREFOX:t.match(/safari/i)?T.SAFARI:T.OTHERS}getDevice(){switch(this.os){case A.WINDOWS:case A.MACINTOSH:case A.LINUX:return S.PC;case A.IOS:case A.ANDROID:return S.SP;case A.OCULUS:return S.VR;case A.NINTENDO:case A.PLAY_STATION:case A.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"}(A||(A={})),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"}(T||(T={})),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"}(I||(I={})),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"}(v||(v={})),function(t){t[t.UP=0]="UP",t[t.DOWN=1]="DOWN"}(y||(y={})),function(t){t[t.QUICK_LOAD=0]="QUICK_LOAD",t[t.RESTART_GAME=1]="RESTART_GAME",t[t.PASSWORD=2]="PASSWORD"}(O||(O={})),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"}(C||(C={}));var N,P=["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.GAMEPAD_BUTTON=100]="GAMEPAD_BUTTON",t[t.OLDMOVE=101]="OLDMOVE",t[t.LEGACY_IF=10050]="LEGACY_IF"}(N||(N={}));var M,R,L,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,$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"}(M||(M={})),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"}(R||(R={})),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"}(L||(L={}));const x=[1,2,5,8,10,20],B=["超低速","低速","準低速","中速","高速","超高速"],U=["energy","strength","defence","gold"];class W{}W.WWA_HOME="http://wwajp.com",W.ITEMBOX_SIZE=12,W.MAP_ATR_MAX=60,W.OBJ_ATR_MAX=60,W.OLD_MAP_ATR_MAX=40,W.OLD_OBJ_ATR_MAX=40,W.ATR_TYPE=3,W.ATR_MODE=4,W.ATR_STRING=5,W.ATR_X=6,W.ATR_Y=7,W.ATR_X2=8,W.ATR_Y2=9,W.ATR_ENERGY=10,W.ATR_STRENGTH=11,W.ATR_DEFENCE=12,W.ATR_GOLD=13,W.ATR_ITEM=14,W.ATR_NUMBER=15,W.ATR_JUMP_X=16,W.ATR_MOVE=16,W.ATR_JUMP_Y=17,W.ATR_SOUND=19,W.ATR_APPERANCE_BASE=20,W.REL_ATR_APPERANCE_ID=0,W.REL_ATR_APPERANCE_X=1,W.REL_ATR_APPERANCE_Y=2,W.REL_ATR_APPERANCE_TYPE=3,W.REL_ATR_APPERANCE_UNIT_LENGTH=4,W.ATR_RANDOM_BASE=10,W.RANDOM_ATR_NUM=10,W.RANDOM_ITERATION_MAX=10,W.MAP_STREET=0,W.MAP_WALL=1,W.MAP_LOCALGATE=2,W.MAP_URLGATE=4,W.OBJECT_NORMAL=0,W.OBJECT_MESSAGE=1,W.OBJECT_URLGATE=2,W.OBJECT_STATUS=3,W.OBJECT_ITEM=4,W.OBJECT_DOOR=5,W.OBJECT_MONSTER=6,W.OBJECT_SCORE=11,W.OBJECT_SELL=14,W.OBJECT_BUY=15,W.OBJECT_RANDOM=16,W.OBJECT_SELECT=17,W.OBJECT_LOCALGATE=18,W.SYSTEM_MESSAGE_NUM=20,W.IMGPOS_DEFAULT_YESNO_X=3,W.IMGPOS_DEFAULT_YESNO_Y=1,W.IMGRELPOS_YESNO_YES_X=0,W.IMGRELPOS_YESNO_NO_X=1,W.IMGRELPOS_YESNO_YESP_X=2,W.IMGRELPOS_YESNO_NOP_X=3,W.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0,W.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0,W.IMGPOS_DEFAULT_FRAME_X=0,W.IMGPOS_DEFAULT_FRAME_Y=1,W.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3,W.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3,W.DEFAULT_DISABLE_SAVE=!1,W.DEFAULT_OLDMAP=!1,W.DEFAULT_OBJECT_NO_COLLAPSE=!1,W.SPLASH_SCREEN_DISP_MILLS=100,W.DEFAULT_FRAME_INTERVAL=20,W.GAMEOVER_FRAME_INTERVAL=50,W.YESNO_PRESS_DISP_FRAME_NUM=20,W.WAIT_TIME_FRAME_NUM=6,W.CHIP_SIZE=40,W.MAP_WINDOW_WIDTH=440,W.MAP_WINDOW_HEIGHT=440,W.H_PARTS_NUM_IN_WINDOW=W.MAP_WINDOW_WIDTH/W.CHIP_SIZE,W.V_PARTS_NUM_IN_WINDOW=W.MAP_WINDOW_HEIGHT/W.CHIP_SIZE,W.MIN_SPEED_INDEX=0,W.MAX_SPEED_INDEX=x.length-1,W.QUICK_BATTLE_SPEED_INDECIES=[x.length-2,x.length-1],W.ANIMATION_REP_HALF_FRAME=22,W.PLAYER_LOOKING_AROUND_START_FRAME=4*W.ANIMATION_REP_HALF_FRAME,W.RELATIVE_COORD_BIAS=1e4,W.RELATIVE_COORD_LOWER=W.RELATIVE_COORD_BIAS-1e3,W.PLAYER_COORD=W.RELATIVE_COORD_BIAS-1e3,W.LOCALGATE_PLAYER_WAIT_FRAME=5,W.STATUS_CHANGED_EFFECT_FRAME_NUM=20,W.PASSABLE_OBJECT=1,W.APPERANCE_PARTS_MIN_INDEX=0,W.APPERANCE_PARTS_MAX_INDEX=9,W.APPERANCE_PARTS_MIN_INDEX_NO=5,W.APPERANCE_PARTS_MAX_INDEX_YES=4,W.FADEOUT_SPEED=8,W.STATUS_MINUS_BORDER=3e4,W.ITEMBOX_IS_FULL=-1,W.BATTLE_INTERVAL_FRAME_NUM=10,W.BATTLE_SPEED_CHANGE_TURN_NUM=40,W.RANDOM_MOVE_ITERATION_NUM=50,W.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31=8,W.BATTLE_ESTIMATE_MONSTER_TYPE_MAX=8,W.SOUND_MAX=100,W.ITEM_BORDER_IMG_DATA_URL="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAArklEQVRYR+2Y0QqAIAxFt///aENJHwxxuJUSxzeh3S7HXaNpEkly4FIRzba0GEyHeVTN7jqDWvb7V4Y1NLibZIY0NbiL5G3MZLCe / 1fn3XJgJYjB7mgg6O1VCEKwXo79JeklY62nB62kRs9BEIKkeNIDhISQEBJC4k0BBCF4D7D4cV9shf99ixdB + MrM0y3fa3zV05D45GOqhwPMGPkYlccIOEY2VKUN0UNVXxC7ADj7mDi9aFZZAAAAAElFTkSuQmCC",W.LOAD_STAGE_MAX_EXCEPT_AUDIO=7,W.WWA_STYLE_TAG_ID="wwa-additional-style",W.DEFAULT_FRAME_COLOR_R=255,W.DEFAULT_FRAME_COLOR_G=255,W.DEFAULT_FRAME_COLOR_B=255,W.DEFAULT_FRAMEOUT_COLOR_R=96,W.DEFAULT_FRAMEOUT_COLOR_G=96,W.DEFAULT_FRAMEOUT_COLOR_B=96,W.DEFAULT_STRBACK_COLOR_R=0,W.DEFAULT_STRBACK_COLOR_G=0,W.DEFAULT_STRBACK_COLOR_B=0,W.DEFAULT_STATUS_COLOR_R=0,W.DEFAULT_STATUS_COLOR_G=0,W.DEFAULT_STATUS_COLOR_B=0,W.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM=20,W.WWAP_SERVER_OLD="http://wwawing.com/wwap",W.WWAP_SERVER="https://wwaphoenix.github.io",W.WWAP_SERVER_AUDIO_DIR="audio",W.WWAP_SERVER_TITLE_IMG="cover_p.gif",W.WWAP_SERVER_LOADER_NO_WORKER="wwaload.noworker.js",W.SCREEN_WIDTH=560,W.SCREEN_HEIGHT=440,W.LOADING_FONT="Times New Roman",W.MSG_STR_WIDTH=16,W.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME=20,W.ITEMBOX_TOP_Y=140,W.USER_VAR_NUM=256,W.USER_VAR_NUM_MAX_VALUE=9007199254740991,W.USET_VAR_NUM_MIN_VALUE=-9007199254740991,W.CONTROLL_WAIT_FRAME=6,W.INLINE_USER_VAR_VIEWER_DISPLAY_NUM=10;class Y{}Y.QUICK_SAVE_MAX=4,Y.QUICK_SAVE_THUMNAIL_WIDTH=99,Y.QUICK_SAVE_THUMNAIL_HEIGHT=99,Y.SAVE_INTERVAL_MOVE=200,Y.INDEXEDDB_DB_NAME="WWA_WING_DB",Y.INDEXEDDB_TABLE_NAME="SAVE_TABLE",Y.DATE_LAST_SAVE_TEXT_COLOR="rgba(255,255,0,1)";class F{}F.EMPTY_LOAD="",F.EMPTY_SAVE="",F.PASSWORD="Password",F.QUICK_SAVE="Quick Save",F.QUICK_LOAD="Quick Load",F.BATTLE_REPORT="Battle Report",F.GAME_END="Game End",F.GOTO_WWA="Goto WWA",F.RESTART_GAME="Restart Game";class k{}var V;!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"}(V||(V={}));var G,H,K,X,j,J,$,Z,q,Q,z,tt=["ロードの準備をしています。","背景パーツを読み込んでいます。","物体パーツを読み込んでます。","背景パーツの属性を読み込んでます。","物体パーツの属性を読み込んでます。","ランダムパーツを置換しています。","メッセージを読み込んでます。","Welcome to WWA Wing!"],et=["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"}(G||(G={})),function(t){t[t.TITLE=32]="TITLE",t[t.LOADING=22]="LOADING",t[t.FOOTER=18]="FOOTER",t[t.ERRROR=16]="ERRROR"}(H||(H={})),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"}(K||(K={})),function(t){t[t.MESSAGE_WINDOW=0]="MESSAGE_WINDOW",t[t.SIDEBAR=1]="SIDEBAR"}(X||(X={})),function(t){t[t.BITSHIFT=16]="BITSHIFT",t[t.BITMASK=65535]="BITMASK"}(j||(j={})),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"}(J||(J={})),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_C=67]="KEY_C",t[t.KEY_D=68]="KEY_D",t[t.KEY_E=69]="KEY_E",t[t.KEY_I=73]="KEY_I",t[t.KEY_M=77]="KEY_M",t[t.KEY_N=78]="KEY_N",t[t.KEY_P=80]="KEY_P",t[t.KEY_Q=81]="KEY_Q",t[t.KEY_S=83]="KEY_S",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"}($||($={}));class st{checkHitKey(t){var e=this.getKeyState(t);return e===J.KEYDOWN||e===J.KEYPRESS}getKeyState(t){return this._prevKeyState[t]?this._keyState[t]?J.KEYPRESS:J.KEYUP:this._keyState[t]?J.KEYDOWN:J.NONE}getKeyStateForControllPlayer(t){return this._prevKeyStateOnControllable[t]?this._keyState[t]?J.KEYPRESS:J.KEYUP:this._keyState[t]?J.KEYDOWN:J.NONE}getKeyStateForMessageCheck(t){return this._prevKeyState[t]?this._keyState[t]?this._keyInputContinueFrameNum[t]>=W.KEYPRESS_MESSAGE_CHANGE_FRAME_NUM?J.KEYPRESS_MESSAGECHANGE:J.KEYPRESS:J.KEYUP:this._keyState[t]?J.KEYDOWN:J.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<st.KEY_BUFFER_MAX;t++)this._keyState[t]&&this._keyInputContinueFrameNum[t]++}memorizeKeyStateOnControllableFrame(){this._prevKeyStateOnControllable=this._keyState.slice()}allClear(){var t;for(this._nextKeyState=new Array(st.KEY_BUFFER_MAX),t=0;t<st.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1}constructor(){var t;for(this._nextKeyState=new Array(st.KEY_BUFFER_MAX),this._keyState=new Array(st.KEY_BUFFER_MAX),this._prevKeyState=new Array(st.KEY_BUFFER_MAX),this._prevKeyStateOnControllable=new Array(st.KEY_BUFFER_MAX),this._keyInputContinueFrameNum=new Array(st.KEY_BUFFER_MAX),t=0;t<st.KEY_BUFFER_MAX;t++)this._nextKeyState[t]=!1,this._keyState[t]=!1,this._prevKeyState[t]=!1,this._prevKeyStateOnControllable[t]=!1,this._keyInputContinueFrameNum[t]=0}}st.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 at{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"}(Q||(Q={})),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"}(z||(z={}));class it{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,a,i,r;for(s=t.length,e=0;e<s;e++){a=t[e];var o=this.gamepad.buttons[a];if(!o)return!1;if(i="object"==typeof o?!0===o.pressed:1===o,r=this.triggers[a],this.triggers[a]=i,i&&!r)return!0}return!1}buttonPressed(...t){if(!this.gamepad)return!1;var e,s,a;for(s=t.length,e=0;e<s;e++){a=t[e];var i=this.gamepad.buttons[a];if(!i)return!1;if("object"==typeof i?!0===i.pressed:1===i)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 Q.BUTTON_CROSS_KEY_UP:if(this.gamepad.axes[z.AXES_L_VERTICAL_INDEX]<=-.6||this.gamepad.axes[z.AXES_R_VERTICAL_INDEX]<=-.6||-1===this.stickFloor(z.AXES_CROSS_KEY)||this.buttonPressed(Q.BUTTON_CROSS_KEY_UP))return!0;break;case Q.BUTTON_CROSS_KEY_DOWN:if(this.gamepad.axes[z.AXES_L_VERTICAL_INDEX]>=.7||this.gamepad.axes[z.AXES_R_VERTICAL_INDEX]>=.7||.1===this.stickFloor(z.AXES_CROSS_KEY)||this.buttonPressed(Q.BUTTON_CROSS_KEY_DOWN))return!0;break;case Q.BUTTON_CROSS_KEY_LEFT:if(this.gamepad.axes[z.AXES_L_HORIZONTAL_INDEX]<=-.7||this.gamepad.axes[z.AXES_R_HORIZONTAL_INDEX]<=-.7||.7===this.stickFloor(z.AXES_CROSS_KEY)||this.buttonPressed(Q.BUTTON_CROSS_KEY_LEFT))return!0;break;case Q.BUTTON_CROSS_KEY_RIGHT:if(this.gamepad.axes[z.AXES_L_HORIZONTAL_INDEX]>.6||this.gamepad.axes[z.AXES_R_HORIZONTAL_INDEX]>.6||-.5===this.stickFloor(z.AXES_CROSS_KEY)||this.buttonPressed(Q.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,a;for(s=t.length,e=0;e<s;e++){a=t[e];var i=this.gamepad.axes[a];return"number"!=typeof i?0:Math.floor(10*i)/10}return 0}}class rt{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 rt.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 ot=["BUTTON_ENTER","BUTTON_ESC","BUTTON_SIDEBAR","BUTTON_FAST","BUTTON_SLOW","BUTTON_LEFT","BUTTON_UP","BUTTON_RIGHT","BUTTON_DOWN"],nt=["BUTTON_LEFT","BUTTON_UP","BUTTON_RIGHT","BUTTON_DOWN"],_t=new Set(nt);class ht{constructor(t,e=!1,s=null,a=null,i=null,r=null){if(this._enabled=null!==t,this._visible=e,this._onTouchStart=i||null,this._onTouchEnd=r||null,this._availableButtons=[],this._isTouchingButtons={},this._moveButtonsElement=a,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 a=e;this._availableButtons.push(a),s.setAttribute("type",e),this._isTouchingButtons[a]={prev:!1,current:!1,next:!1};const i=t=>{t.cancelable&&t.preventDefault()},r=t=>{i(t),this.allClear()};s.addEventListener("touchstart",(t=>{i(t),this.setTouchInfo(a)})),s.addEventListener("touchcancel",r),ht.isMoveButton(a)?(s.addEventListener("touchmove",this._detectMovingMoveButton.bind(this)),s.addEventListener("touchend",this.allMoveClear.bind(this))):s.addEventListener("touchend",(t=>{i(t),this.clearTouchInfo(a)}))}null!==a&&a.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(),a=document.body.getBoundingClientRect(),i=s.left-a.left+s.width/2,r=s.top-a.top+s.height/2,o=e.pageX-i,n=e.pageY-r;o>=n?o<=-n?this.setTouchInfo("BUTTON_UP"):this.setTouchInfo("BUTTON_RIGHT"):o>=-n?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,a=e.current;return s&&a?"TOUCHING":a?"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(){nt.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 a=this._isTouchingButtons[t];if(void 0!==a)switch(this._isTouchingButtons[t].prev=a.current,this._isTouchingButtons[t].current=a.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 ct(){const t=document.querySelector("meta[name='viewport']"),e=window.innerWidth,s=window.innerHeight;let a="user-scalable=no";if(e>s){a=`width=${Math.floor(e/s*456)},${a}`}else e<=s&&(a=`width=576,${a}`);null==t||t.setAttribute("content",`${a}`)}var lt=t=>document.getElementById(t),ut=t=>document.querySelector(t),dt=t=>document.querySelector(t),Et=t=>document.querySelectorAll(t),mt=(t,e)=>{var s,a,i=window.pageXOffset||document.body.scrollLeft||document.documentElement.scrollLeft,r=window.pageYOffset||document.body.scrollTop||document.documentElement.scrollTop;return s=t-lt("wwa-wrapper").offsetLeft+i,a=e-lt("wwa-wrapper").offsetTop+r,new n(s,a)},wt=t=>t.match(/^https?:\/\//)||t.match(/^\.\.\//)?t:location.href="./"+t,pt=t=>{var e="";if(t instanceof Array){for(var s=0;s<t.length;s++)e+=pt(t[s])+"/";return e}return t+""};const gt=t=>t.split("").reverse().join("");class At{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._isTransparent=s}drawCanvas(t,e,s,a,i){this.ctx.drawImage(t,W.CHIP_SIZE*e,W.CHIP_SIZE*s,W.CHIP_SIZE,W.CHIP_SIZE,a,i,W.CHIP_SIZE,W.CHIP_SIZE)}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,a){this._isTransparent?this.ctx.clearRect(t,e,s,a):(this.ctx.fillStyle="#9E9E9E",this.ctx.fillRect(t,e,s,a))}}class St{_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,W.MAP_WINDOW_WIDTH-W.CHIP_SIZE,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+2,0,W.MAP_WINDOW_HEIGHT-W.CHIP_SIZE),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+2,W.MAP_WINDOW_WIDTH-W.CHIP_SIZE,W.MAP_WINDOW_HEIGHT-W.CHIP_SIZE);for(var t=1;t<W.H_PARTS_NUM_IN_WINDOW-1;t++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y,W.CHIP_SIZE*t,0),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+1,this._frameCoord.y+2,W.CHIP_SIZE*t,W.MAP_WINDOW_HEIGHT-W.CHIP_SIZE);for(t=1;t<W.V_PARTS_NUM_IN_WINDOW-1;t++)this._frameCanvas.drawCanvas(this._image,this._frameCoord.x,this._frameCoord.y+1,0,W.CHIP_SIZE*t),this._frameCanvas.drawCanvas(this._image,this._frameCoord.x+2,this._frameCoord.y+1,W.MAP_WINDOW_WIDTH-W.CHIP_SIZE,W.CHIP_SIZE*t)}updateEffects(t){var e;if(t){var s,a=t.length;for(e=0;e<a;e++){var i=t[e];(s=this._effectCanvases[e])?s.clear():s=this._effectCanvases[e]=new At(W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,!0);for(var r=0;r<W.V_PARTS_NUM_IN_WINDOW;r++)for(var o=0;o<W.H_PARTS_NUM_IN_WINDOW;o++)s.drawCanvas(this._image,i.x,i.y,o*W.CHIP_SIZE,r*W.CHIP_SIZE)}}}drawFrame(){this._ctx.drawImage(this._frameCanvas.cvs,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-1),W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE,0,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-1),W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE),this._ctx.drawImage(this._frameCanvas.cvs,0,W.CHIP_SIZE,W.CHIP_SIZE,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-2),0,W.CHIP_SIZE,W.CHIP_SIZE,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-2)),this._ctx.drawImage(this._frameCanvas.cvs,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-1),W.CHIP_SIZE,W.CHIP_SIZE,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-2),W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-1),W.CHIP_SIZE,W.CHIP_SIZE,W.CHIP_SIZE*(W.H_PARTS_NUM_IN_WINDOW-2))}drawEffect(t){var e=this._effectCanvases[t];e&&this._ctx.drawImage(e.cvs,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW)}drawCanvas(t,e,s,a){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._image,W.CHIP_SIZE*t,W.CHIP_SIZE*e,W.CHIP_SIZE,W.CHIP_SIZE,s,a,W.CHIP_SIZE,W.CHIP_SIZE)}drawCanvasWithSize(t,e,s,a,i,r){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._image,W.CHIP_SIZE*t,W.CHIP_SIZE*e,W.CHIP_SIZE*s,W.CHIP_SIZE*a,i,r,W.CHIP_SIZE*s,W.CHIP_SIZE*a)}drawCanvasWithUpperYLimit(t,e,s,a,i){if(!this._isLoaded)throw new Error("No image was loaded.");var r=Math.max(0,a+W.CHIP_SIZE-i);r>=W.CHIP_SIZE||this._ctx.drawImage(this._image,W.CHIP_SIZE*t,W.CHIP_SIZE*e,W.CHIP_SIZE,W.CHIP_SIZE-r,s,a,W.CHIP_SIZE,W.CHIP_SIZE)}copyCanvas(t,e){return(s,a,i,r,o)=>{if(!this._isLoaded)throw new Error("No image was loaded.");const n=Math.max(0,e(r,o));n>=W.CHIP_SIZE||t.ctx.drawImage(this._image,W.CHIP_SIZE*s,W.CHIP_SIZE*a+n,W.CHIP_SIZE,W.CHIP_SIZE-n,i,r+n,W.CHIP_SIZE,W.CHIP_SIZE)}}copyBackCanvasWithUpperYLimit(t,e,s,a,i){this.copyCanvas(this._backCanvas,((t,e)=>t+W.CHIP_SIZE-e))(t,e,s,a,i)}copyBackCanvasWithLowerYLimit(t,e,s,a,i){this.copyCanvas(this._backCanvas,((t,e)=>e-t))(t,e,s,a,i)}copyObjectCanvasWithUpperYLimit(t,e,s,a,i,r){this.copyCanvas(this._objectCanvases[t],((t,e)=>t+W.CHIP_SIZE-e))(e,s,a,i,r)}copyObjectCanvasWithLowerYLimit(t,e,s,a,i,r){this.copyCanvas(this._objectCanvases[t],((t,e)=>e-t))(e,s,a,i,r)}drawBackCanvas(){if(!this._isLoaded)throw new Error("No image was loaded.");this._ctx.drawImage(this._backCanvas.cvs,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.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,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,0,0,W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.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,a,i){if(!this._isLoaded)throw new Error("No image was loaded.");var r=Math.max(0,i-a);r>=W.CHIP_SIZE||this._ctx.drawImage(this._image,W.CHIP_SIZE*t,W.CHIP_SIZE*e+r,W.CHIP_SIZE,W.CHIP_SIZE-r,s,a+r,W.CHIP_SIZE,W.CHIP_SIZE)}clearCanvas(t,e,s,a){this._ctx.clearRect(t,e,s,a)}drawBase(t,e,s,a){this._ctx.fillStyle="#9E9E9E",this._ctx.fillRect(t,e,s,a)}setFrameImage(t){this._frameCoord=t,this.createFrame()}constructor(t,e,s,a){var i;for(this._isLoaded=!1,this.mapCache=void 0,this.mapObjectCache=void 0,this.mapCacheYLimit=0,this._frameCanvas=new At(W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,!0),this._backCanvas=new At(W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,!1),this._objectCanvases=[],this._effectCanvases=[],i=0;i<2;i++)this._objectCanvases[i]=new At(W.CHIP_SIZE*W.V_PARTS_NUM_IN_WINDOW,W.CHIP_SIZE*W.H_PARTS_NUM_IN_WINDOW,!0);this._ctx=t,this._fileName=e,this._loadCompleteCallBack=a,this._load(),this._frameCoord=s.clone(),this.cpPartsLog=new n(0,0)}}class Tt{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=x[this._player.getSpeedIndex()];this._position=this._position.getNextFramePosition(t,e*(W.H_PARTS_NUM_IN_WINDOW-1),e*(W.V_PARTS_NUM_IN_WINDOW-1))}getTransitionStepNum(){return this._transitionStep}advanceTransitionStepNum(){return++this._transitionStep,this._transitionStep===W.V_PARTS_NUM_IN_WINDOW&&(this._isResetting=!1,this._transitionStep=0),this._transitionStep}isFinalStep(){if(!1===this._isResetting)throw new Error("リセット中ではありません。");return this._transitionStep===W.V_PARTS_NUM_IN_WINDOW-1}reset(t){this._positionPrev=this._position,this._position=t.getDefaultCameraPosition(),this._transitionStep=0,this._isResetting=!0}}class It{getPosition(){return this._position}constructor(t){this._position=t}}class vt extends It{constructor(t){super(t)}}var yt;!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"}(yt||(yt={}));class Ot extends vt{move(){if(this.isControllable())this.controll(this._dir);else if(this._state===yt.CAMERA_MOVING){try{this._camera.move(this._dir)}catch(t){}this._isOnCameraStopPosition()&&(this._state=yt.CONTROLLABLE)}else if(this._state===yt.MOVING){try{var t=this._position.getNextFramePosition(this._dir,x[this._speedIndex],x[this._speedIndex])}catch(t){}t.isJustPosition()&&(this._state=yt.CONTROLLABLE,this.toggleMovingImage(),this._moves++,this._isPartsEventExecuted=!1,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0),this._position=t}}controll(t){var e,s;if(this.isControllable()){this._isPreparedForLookingAround=!1,this._dir=t;try{e=this._position.getNextFramePosition(this._dir,x[this._speedIndex],x[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=yt.CAMERA_MOVING}catch(t){this._state=yt.CONTROLLABLE}return}if(!this.canMoveTo(s))return this._wwa.getMapTypeByPosition(s)===W.MAP_WALL&&this._wwa.checkMap(s.getPartsCoord()),void this._wwa.checkObject(s.getPartsCoord());this._position=e,this._state=yt.MOVING,this._wwa.getMapAttributeByPosition(this._position.getNextJustPosition(t),W.ATR_TYPE)!==W.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)!==W.MAP_WALL&&(0===this._wwa.getObjectIdByPosition(t)||(this._wwa.getObjectTypeByPosition(t)===W.OBJECT_NORMAL&&this._wwa.getObjectAttributeByPosition(t,W.ATR_MODE)===W.PASSABLE_OBJECT||this._wwa.getObjectTypeByPosition(t)===W.OBJECT_DOOR&&this._wwa.getObjectAttributeByPosition(t,W.ATR_NUMBER)===W.PASSABLE_OBJECT&&!this.hasItem(this._wwa.getObjectAttributeByPosition(t,W.ATR_ITEM)))))}isMoving(){return this._state==yt.MOVING||this._state==yt.CAMERA_MOVING}_isOnCameraMovingPosition(){var t=this._camera.getPosition().getPartsCoord(),e=this.getPosition().getPartsCoord();return e.x-t.x==W.H_PARTS_NUM_IN_WINDOW-1&&this._dir===u.RIGHT||e.x===t.x&&this._dir===u.LEFT||e.y-t.y==W.V_PARTS_NUM_IN_WINDOW-1&&this._dir===u.DOWN||e.y===t.y&&this._dir===u.UP}_isOnCameraStopPosition(){var t=this._camera.getPosition().getPartsCoord(),e=this.getPosition().getPartsCoord();return e.x-t.x==W.H_PARTS_NUM_IN_WINDOW-1&&this._dir===u.LEFT||e.x===t.x&&this._dir===u.RIGHT||e.y-t.y==W.V_PARTS_NUM_IN_WINDOW-1&&this._dir===u.UP||e.y===t.y&&this._dir===u.DOWN}isControllable(){var t=this._afterMoveMacroFlag;return this._afterMoveMacroFlag=!1,this._state===yt.CONTROLLABLE&&!this._partsAppeared&&(this._wwa.getMapTypeByPosition(this._position)!==W.MAP_LOCALGATE&&this._wwa.getMapTypeByPosition(this._position)!==W.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===yt.LOCALGATE_JUMPED||this._state===yt.LOCALGATE_JUMPED_WITH_MESSAGE}setMessageWaiting(){this._state=yt.MESSAGE_WAITING}isWaitingMessage(){return this._state===yt.MESSAGE_WAITING}isDelayFrame(){return this._messageDelayFrameCount>0}updateDelayFrame(){this._messageDelayFrameCount--}setDelayFrame(){this._messageDelayFrameCount=1}clearMessageWaiting(){this._state!==yt.MESSAGE_WAITING&&this._state!==yt.LOCALGATE_JUMPED_WITH_MESSAGE||(this._state===yt.MESSAGE_WAITING?this._state=yt.CONTROLLABLE:this._state===yt.LOCALGATE_JUMPED_WITH_MESSAGE&&(this._state=yt.LOCALGATE_JUMPED),this._isPartsEventExecuted=!0,this._isPreparedForLookingAround&&(this._lookingAroundTimer=W.PLAYER_LOOKING_AROUND_START_FRAME))}setEstimateWindowWating(){this._state=yt.ESTIMATE_WINDOW_WAITING}isWatingEstimateWindow(){return this._state===yt.ESTIMATE_WINDOW_WAITING}clearEstimateWindowWaiting(){this._state===yt.ESTIMATE_WINDOW_WAITING&&(this._state=yt.CONTROLLABLE)}setPasswordWindowWating(){this._state=yt.PASSWORD_WINDOW_WAITING}isWaitingPasswordWindow(){return this._state===yt.PASSWORD_WINDOW_WAITING}clearPasswordWindowWaiting(){this._state===yt.PASSWORD_WINDOW_WAITING&&(this._state=yt.CONTROLLABLE)}isPartsEventExecuted(){return this._isPartsEventExecuted}resetEventExecutionInfo(){this._isPartsEventExecuted=!1}getLastExecPartsIDOnSamePosition(t){return t===g.MAP?this._samePosLastExecutedMapID:this._samePosLastExecutedObjID}setLastExecInfoOnSamePosition(t,e){t===g.MAP?this._samePosLastExecutedMapID=e:this._samePosLastExecutedObjID=e}processAfterJump(){this._state!==yt.LOCALGATE_JUMPED&&this._state!==yt.LOCALGATE_JUMPED_WITH_MESSAGE||0==--this._jumpWaitFramesRemain&&(this._state=this._state===yt.LOCALGATE_JUMPED?yt.CONTROLLABLE:yt.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===yt.MESSAGE_WAITING?yt.LOCALGATE_JUMPED_WITH_MESSAGE:yt.LOCALGATE_JUMPED,this._jumpWaitFramesRemain=W.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,t.hasLocalGate()?this._dir=u.DOWN:t.getPartsCoord().y<=this._wwa.getMapWidth()-2&&t.getNextJustPosition(u.DOWN).hasLocalGate()?this._dir=u.UP:t.getPartsCoord().y>=1&&t.getNextJustPosition(u.UP).hasLocalGate()?this._dir=u.DOWN:t.getPartsCoord().x<=this._wwa.getMapWidth()-2&&t.getNextJustPosition(u.RIGHT).hasLocalGate()?this._dir=u.LEFT:t.getPartsCoord().x>=1&&t.getNextJustPosition(u.LEFT).hasLocalGate()?this._dir=u.RIGHT:this._dir=u.DOWN,this._camera.getPosition().equals(e)||(this._isPreparedForLookingAround=!0,this._lookingAroundTimer=W.PLAYER_LOOKING_AROUND_START_FRAME),!0)}systemJumpTo(t){this._position=t,this._camera.reset(t),this._camera.resetPreviousPosition(),this._state=yt.LOCALGATE_JUMPED,this._jumpWaitFramesRemain=W.LOCALGATE_PLAYER_WAIT_FRAME,this._samePosLastExecutedMapID=void 0,this._samePosLastExecutedObjID=void 0,this._dir=u.DOWN,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=W.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 r(0,0))}getStatusOfEquipments(){return this._equipStatus.plus(new r(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],a=ut("#item"+e);if(0===this._itemBox[e]){s.style.backgroundPosition="-40px 0px",this.disposeItemEffect(e,this._itemBoxElement[e],a);continue}const i=this._wwa.getObjectCropXById(this._itemBox[e]),r=this._wwa.getObjectCropYById(this._itemBox[e]);if(!t||e!==t.insertPos-1){s.style.backgroundPosition="-"+i+"px -"+r+"px",this.disposeItemEffect(e,this._itemBoxElement[e],a);continue}const o=t.itemScreenPixelCoord.x-t.itemBoxScreenPixelCoord.x,n=t.itemScreenPixelCoord.y-t.itemBoxScreenPixelCoord.y,_=-o*W.DEFAULT_FRAME_INTERVAL/W.ITEM_EFFECT_SPEED_PIXEL_PER_FRAME,h=0===t.overwrittenObjectId||void 0===t.overwrittenObjectId,c=h?t.itemBoxBackgroundImageCoord.x:this._wwa.getObjectCropXById(t.overwrittenObjectId),l=h?t.itemBoxBackgroundImageCoord.y:this._wwa.getObjectCropYById(t.overwrittenObjectId);s.style.left=o+"px",s.style.top=n+"px","number"==typeof this.itemEffectStartTimers[e]&&clearInterval(this.itemEffectStartTimers[e]),this.itemEffectStartTimers[e]=window.setTimeout((()=>{this.itemEffectStartTimers[e]=void 0,this.startItemEffect(e,s,a,{target:{x:i,y:r},overwritten:{x:c,y:l}},_)}),W.DEFAULT_FRAME_INTERVAL)}}startItemEffect(t,e,s,a,i){const r=s.querySelector(this.overwittenItemSelector);r&&s.removeChild(r);const o=document.createElement("div");o.classList.add(this.overwittenItemClassName),o.style.backgroundPosition="-"+a.overwritten.x+"px -"+a.overwritten.y+"px",o.style.backgroundImage=s.style.backgroundImage,s.appendChild(o),e.style.backgroundPosition="-"+a.target.x+"px -"+a.target.y+"px",e.style.transitionDuration=i+"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 a=s.querySelector(this.overwittenItemSelector);a&&s.removeChild(a)}isDead(){return this._status.energy<=0}addItem(t,e=0,s=!1,a){var i,r,o,_=this._wwa.getObjectAttributeById(t,W.ATR_NUMBER),h=0;if(0===e&&0!==_&&(e=_),0===e){if(0===t)return;if((i=this._getBlankItemPos())===W.ITEMBOX_IS_FULL)throw new Error("これ以上、アイテムを持てません。");h=this._itemBox[i-1],this._forceSetItemBox(i,t)}else if(!1===s)if(i=e,o=this._itemBox[i-1],this._wwa.getObjectAttributeById(o,W.ATR_NUMBER)!==this._wwa.getObjectAttributeById(t,W.ATR_NUMBER)){if((r=this._getBlankItemPos())===W.ITEMBOX_IS_FULL)throw new Error("これ以上、アイテムを持てません。");this._forceSetItemBox(r,o),this._forceSetItemBox(i,t)}else h=this._itemBox[i-1],this._forceSetItemBox(i,t);else i=e,h=this._itemBox[i-1],this._forceSetItemBox(i,t);this._updateEquipmentStatus(),this.updateItemBox(a?{insertPos:i,itemScreenPixelCoord:a.screenPixelCoord,itemBoxBackgroundImageCoord:a.itemBoxBackgroundImageCoord,itemBoxScreenPixelCoord:new n(W.MAP_WINDOW_WIDTH+(i-1)%3*W.CHIP_SIZE,W.ITEMBOX_TOP_Y+Math.floor((i-1)/3)*W.CHIP_SIZE),overwrittenObjectId:h}:void 0)}_forceSetItemBox(t,e){var s=this,i=dt("#item"+(t-1)+">.item-click-border"),r=this._wwa.getObjectAttributeById(e,W.ATR_MODE);if(this.removeItemByItemPosition(t),this._itemBox[t-1]=e,0!==e&&r!==p.NORMAL){const e=this._wwa.resolveSystemMessage(a.ITEM_SELECT_TUTORIAL);this._isClickableItemGot||("BLANK"!==e&&this._wwa.generatePageAndReserveExecution(e,!1,!0),this._isClickableItemGot=!0),i.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),i.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 W.ITEMBOX_IS_FULL}_updateEquipmentStatus(){var t,e=new r(0,0);for(t=0;t<W.ITEMBOX_SIZE;t++)0!==this._itemBox[t]&&(e.strength+=this._wwa.getObjectAttributeById(this._itemBox[t],W.ATR_STRENGTH),e.defence+=this._wwa.getObjectAttributeById(this._itemBox[t],W.ATR_DEFENCE));var s=e.minus(this._equipStatus);this._wwa.setStatusChangedEffect(s),this._equipStatus=e,this.updateStatusValueBox()}hasItem(t){for(var e=0;e<W.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,W.ATR_MODE)!==p.NORMAL}useItem(){var t;t=this._itemBox[this._readyToUseItemPos-1],this._wwa.getObjectAttributeById(t,W.ATR_MODE)!==p.NOT_DISAPPEAR&&this.removeItemByItemPosition(this._readyToUseItemPos);var e=lt("item"+(this._readyToUseItemPos-1));return setTimeout((()=>{e.classList.contains("onpress")&&e.classList.remove("onpress")}),W.DEFAULT_FRAME_INTERVAL),this._isReadyToUseItem=!1,this._readyToUseItemPos=void 0,t}canHaveMoreItems(){return this._getBlankItemPos()!==W.ITEMBOX_IS_FULL}removeItemByItemPosition(t){var e;0!==this._itemBox[t-1]&&(this._wwa.getObjectAttributeById(this._itemBox[t-1],W.ATR_MODE)!==p.NORMAL&&((e=dt("#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<W.ITEMBOX_SIZE;s++)if(this._itemBox[s]===t)return this._wwa.getObjectAttributeById(this._itemBox[s],W.ATR_MODE)!==p.NORMAL&&((e=dt("#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<=W.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=W.BATTLE_INTERVAL_FRAME_NUM,this._battleTurnNum=0,this._enemy=t,this._state=yt.BATTLE}isFighting(){return this._state===yt.BATTLE}isTurn(){return this._isPlayerTurn}getTurnNum(){return this._battleTurnNum}isBattleStartFrame(){return this._battleFrameCounter===W.BATTLE_INTERVAL_FRAME_NUM&&0===this._battleTurnNum}fight(){if(!this.isFighting())throw new Error("バトルが開始されていません。");if(0===this._battleTurnNum&&this._battleFrameCounter===W.BATTLE_INTERVAL_FRAME_NUM&&this._wwa.showMonsterWindow(),!(--this._battleFrameCounter>0)){this._battleTurnNum++,this._wwa.isBattleSpeedIndexForQuickBattle(this._speedIndex)||this._battleTurnNum>W.BATTLE_SPEED_CHANGE_TURN_NUM?(1===this._battleTurnNum&&(this._wwa.playSound(L.ATTACK),this._wwa.vibration(!1)),this._battleFrameCounter=1):(this._battleFrameCounter=W.BATTLE_INTERVAL_FRAME_NUM,this._wwa.playSound(L.ATTACK),this._wwa.vibration(!0));var t=this.getStatus(),e=this._enemy.status;if(this._isPlayerTurn){if(t.strength>e.defence||t.defence<e.strength)return e.energy>t.strength-e.defence?t.strength>e.defence&&this._enemy.damage(t.strength-e.defence):(this._wwa.playSound(this._wwa.getObjectAttributeById(this._enemy.partsID,W.ATR_SOUND)),this.earnGold(e.gold),this._wwa.setStatusChangedEffect(new o(0,0,0,e.gold)),0!==this._enemy.item?this._wwa.setPartsOnPosition(g.OBJECT,this._enemy.item,this._enemy.position):this._wwa.setPartsOnPosition(g.OBJECT,0,this._enemy.position),this._wwa.reserveAppearPartsInNextFrame(this._enemy.position,w.OBJECT,this._enemy.partsID),this._state=yt.CONTROLLABLE,this._wwa.generatePageAndReserveExecution(this._enemy.message,!1,!1,this._enemy.partsID,g.OBJECT,this._enemy.position),this._enemy.battleEndProcess(),this._battleTurnNum=0,this._enemy=null),void(this._isPlayerTurn=!1);this._enemy.battleEndProcess();const s=this._wwa.resolveSystemMessage(a.CANNOT_DAMAGE_MONSTER);"BLANK"!==s&&this._wwa.generatePageAndReserveExecution(s,!1,!0),this._battleTurnNum=0,this._enemy=null}else e.strength>t.defence&&(t.energy>e.strength-t.defence?this.damage(e.strength-t.defence):(this.setEnergy(0),this._enemy.battleEndProcess(),this._state=yt.CONTROLLABLE,this._battleTurnNum=0,this._enemy=null,this._wwa.shouldApplyGameOver({isCalledByMacro:!1})&&this._wwa.gameover()));this._isPlayerTurn=!0}}readyToUseItem(t){var e;if(!this.canUseItem(t))throw new Error("アイテムがないか、アイテムが使えません。");e=this._itemBox[t-1],this._wwa.getObjectAttributeById(e,W.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(),a=s.getPartsCoord(),i=s.getOffsetCoord(),r=(t.x-a.x)*W.CHIP_SIZE+e.x-i.x+W.CHIP_SIZE/2,o=(t.y-a.y)*W.CHIP_SIZE+e.y-i.y+W.CHIP_SIZE/2;return new n(r,o)}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=W.CHIP_SIZE/x[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(W.MAX_SPEED_INDEX,this._speedIndex+1)}speedDown(){return this._speedIndex=Math.max(W.MIN_SPEED_INDEX,this._speedIndex-1)}setSpeedIndex(t){if(t<W.MIN_SPEED_INDEX||W.MAX_SPEED_INDEX<t)throw new Error("#set_speed の引数が異常です:"+t);return this._speedIndex=t,this._speedIndex}constructor(t,e,s,a,i,o,n){super(e),this.itemTransitioningClassName="item-transitioning",this.overwittenItemClassName="item-overwritten",this.overwittenItemSelector=`.${this.overwittenItemClassName}`,this.itemEffectStartTimers=new Array(W.ITEMBOX_SIZE),this._status=a,this._equipStatus=new r(0,0),this._itemBox=new Array(W.ITEMBOX_SIZE),this._itemBoxElement=new Array(W.ITEMBOX_SIZE),this._itemUsingEvent=new Array(W.ITEMBOX_SIZE);for(var _=0;_<this._itemBox.length;_++)this._itemBox[_]=0,this._itemBoxElement[_]=dt("#item"+_+">.item-disp");this.updateItemBox(),this._energyMax=i,this._dir=u.DOWN,this._isMovingImage=!1,this._wwa=t,this._state=yt.CONTROLLABLE,this._camera=s,this._isPartsEventExecuted=!1,this._energyValueElement=dt("#disp-energy>.status-value-box"),this._strengthValueElement=dt("#disp-strength>.status-value-box"),this._defenceValueElement=dt("#disp-defence>.status-value-box"),this._goldValueElement=dt("#disp-gold>.status-value-box"),this._isReadyToUseItem=!1,this._isClickableItemGot=!1,this._moves=o,this._moveMacroWaitingRemainMoves=0,this._moveObjectAutoExecTimer=0,this.updateStatusValueBox(),this._partsAppeared=!1,this._afterMoveMacroFlag=!1,this._isPreparedForLookingAround=!0,this._lookingAroundTimer=W.PLAYER_LOOKING_AROUND_START_FRAME,this._speedIndex=n,this._messageDelayFrameCount=0}}class Dt{constructor(t,e,s,a,i,r,o){this._partsID=t,this._position=e,this._imgCoord=s,this._status=a,this._message=i,this._item=r,this._battleEndCallback=o}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(){this._battleEndCallback()}}class Ct{constructor(t,e,s,a,i){this._player=t,this._objectID=e,this._srcPos=s,this._destPos=a,this._dir=i,this._currentPos=this._srcPos.clone()}update(){var t=this._player.getSpeedIndex();return this._currentPos=this._currentPos.getNextFramePosition(this._dir,x[t],x[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 ft{constructor(t,e){this._wwa=t,this._player=e,this.clear()}add(t,e,s,a){this._queue.push(new Ct(this._player,t,e,s,a))}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(g.OBJECT,0,this._queue[s].beforePosition.getPartsCoord()),this._wwa.setPartsOnPosition(g.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()}}function Nt(t,e,s=0){if("boolean"==typeof t)return t;const a=Pt(t.left,e,s),i=Pt(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,a,i)}function Pt(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":return e.userVars[t.index];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()*Pt(t.argument,e));case"ITEM_COUNT":return e.itemBox.filter((s=>s===Pt(t.argument,e))).length;default:return s}}function Mt(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("未定義の演算子です")}}const Rt="-?\\d+",Lt=`v\\[(${Rt})\\]`,bt=`m\\[${Rt}\\]\\[${Rt}\\]`,xt=`m\\[(${Rt})\\]\\[(${Rt})\\]`,Bt=`o\\[${Rt}\\]\\[${Rt}\\]`,Ut=`o\\[(${Rt})\\]\\[(${Rt})\\]`,Wt=`ITEM\\[${Rt}\\]`,Yt=`ITEM\\[(${Rt})\\]`,Ft=`${`v\\[${Rt}\\]`}|${bt}|${Bt}|${Wt}`,kt="HP|HPMAX|AT|DF|GD|STEP|PDIR",Vt=`${Ft}|${bt}|${Bt}|${Wt}|${kt}`,Gt=`${Rt}|${Ft}|AT_TOTAL|AT_ITEMS|DF_TOTAL|DF_ITEMS|TIME|X|Y|PX|PY|ID|TYPE|ITEM_COUNT_ALL|${kt}`,Ht=`RAND\\((${Gt})\\)`,Kt=`ITEM_COUNT\\((${Gt})\\)`,Xt=`${Gt}|${`${`RAND\\((?:${Gt})\\)`}|${`ITEM_COUNT\\((?:${Gt})\\)`}`}`,jt="\\+|\\-|\\*|\\/|%",Jt="^\\(",$t="\\)$",Zt=new RegExp(`^${Rt}$`),qt=new RegExp(`^${Lt}$`),Qt=new RegExp(`^${xt}$`),zt=new RegExp(`^${Ut}$`),te=new RegExp(`^${Yt}$`),ee=new RegExp(`^${Ht}$`),se=new RegExp(`${Kt}$`),ae=new RegExp(`${Jt}(${Vt})=(${Xt})(${jt})(${Xt})${$t}`),ie=new RegExp(`${Jt}(${Vt})(=|\\+=|\\-=|\\*=|\\/=|%=)(${Xt})${$t}`),re=new RegExp(`^(${Xt})(?:(${jt})(${Xt}))?$`),oe=new RegExp(`${Jt}(${Xt})(>|<|<=|>=|==|!=)(${Xt})${$t}`);function ne(t){return"RAND"!==t.type&&"ITEM_COUNT"!==t.type}function _e(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(qt);if(e){const t=he(e);return null===t?null:{type:"VARIABLE",index:t}}const s=t.match(Qt);if(s){const t=ce(s);return null===t?null:{type:"MAP",x:t[0],y:t[1]}}const a=t.match(zt);if(a){const t=ce(a);return null===t?null:{type:"OBJECT",x:t[0],y:t[1]}}const i=t.match(te);if(i){const t=he(i);return null===t?null:{type:"ITEM",boxIndex1To12:t}}if(t.match(Zt)){const e=parseInt(t,10);return null===e||isNaN(e)?null:{type:"NUMBER",rawValue:e}}const r=t.match(ee);if(r){const t=r.length>=2?_e(r[1]):null;return null!==t&&ne(t)?{type:"RAND",argument:t}:null}const o=t.match(se);if(o){const t=o.length>=2?_e(o[1]):null;return null!==t&&ne(t)?{type:"ITEM_COUNT",argument:t}:null}return null}}function he(t){const e=t.length>=2?Number(t[1]):null;return null===e||isNaN(e)?null:e}function ce(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 le(t,e){var s;switch(null===(s=_e(e))||void 0===s?void 0:s.type){case"VARIABLE":{const s=e.match(/^v\[(\d+)\]$/),a=Number(s[1]);if(null===a||isNaN(a))throw new Error("ユーザ変数の添字のパースに失敗しました");return{assignee:"variable",index:a,rawValue:t}}case"MAP":{const s=e.match(/^m\[(\d+)\]\[(\d+)\]$/),a=Number(s[1]),i=Number(s[2]);if(null===a||null===i||isNaN(a)||isNaN(i))throw new Error("背景パーツの添字のパースに失敗しました");return{assignee:"map",x:a,y:i,rawValue:t}}case"OBJECT":{const s=e.match(/^o\[(\d+)\]\[(\d+)\]$/),a=Number(s[1]),i=Number(s[2]);if(null===a||null===i||isNaN(a)||isNaN(i))throw new Error("物体パーツの添字のパースに失敗しました");return{assignee:"mapObject",x:a,y:i,rawValue:t}}case"ITEM":{const s=e.match(/^ITEM\[(\d+)\]$/),a=Number(s[1]);if(null===a||isNaN(a))throw new Error("アイテムの添字のパースに失敗しました");return{assignee:"item",boxIndex1to12:a,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 ue(t){return t.replace(/\s/g,"")}function de(t,e,s=0){return Pt(_e(t),e,s)}function Ee(t,e,s=0){const a=ue(t).match(re);if(null!==a){const t=de(a[1],e,s),i=a[3]?de(a[3],e,s):void 0,r=a[2];return r&&i?Mt(r,t,i):t}throw new Error("マクロ引数のフォーマットを満たしていません: "+t)}function me(t){const e=ue(t).match(oe);if(null===e||e.length<=3)return void console.error(`判定式が異常です: ${t}`);const s=_e(e[1]),a=_e(e[3]);if(s&&a)return{left:s,right:a,operator:e[2]};console.error(`判定式が異常です: ${t}`)}class we{constructor(t,e,s,a,i,r){this.firstNode=t,this.isLastPage=e,this.showChoice=s,this.isSystemMessage=a,this.scoreOptions=i,this.extraInfo=r}}class pe{constructor(){}}class ge extends pe{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||Nt(e.descriminant,t()))return e.next}hasElseBranch(){return this.branches.filter((t=>Boolean(t.elseBranch))).length>=1}}class Ae extends pe{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 Se(t){return void 0===t||(t instanceof ge?t.branches.reduce(((t,e)=>t&&Se(e.next)),!0):t instanceof Ae?t.isEmpty()&&Se(t.next):void 0)}const Te=t=>t===N.SHOW_STR||t===N.SHOW_STR2||"text"===t||"normalMacro"===t;class Ie{constructor(t,e,s,a,i,r){this._wwa=t,this._triggerPartsID=e,this._triggerPartsType=s,this._triggerPartsPosition=a,this.macroType=i,this.macroArgs=r}isJunction(){return[N.IF,N.ELSE_IF,N.ELSE,N.END_IF].includes(this.macroType)}execute(){try{switch(this.macroType){case N.IMGPLAYER:return this._executeImgPlayerMacro(),{};case N.IMGYESNO:return this._executeImgYesNoMacro(),{};case N.HPMAX:return this._executeHPMaxMacro(),{};case N.SAVE:return this._executeSaveMacro(),{};case N.ITEM:return this._executeItemMacro(),{};case N.DEFAULT:return this._executeDefaultMacro(),{};case N.OLDMAP:return this._executeOldMapMacro(),{};case N.PARTS:return this._executePartsMacro(),{};case N.MOVE:return this._executeMoveMacro(),{};case N.MAP:return this._executeMapMacro(1),{};case N.DIRMAP:return this._executeDirMapMacro(),{};case N.IMGFRAME:return this._executeImgFrameMacro(),{};case N.IMGBOM:return this._executeImgBomMacro(),{};case N.DELPLAYER:return this._executeDelPlayerMacro(),{};case N.FACE:return this._executeFaceMacro(),{};case N.EFFECT:return this._executeEffectMacro(),{};case N.GAMEOVER:return this._executeGameOverMacro(),{};case N.IMGCLICK:return this._executeImgClickMacro(),{};case N.STATUS:{const{isGameOver:t}=this._executeStatusMacro();return{isGameOver:t}}case N.EFFITEM:return this._executeEffItemMacro(),{};case N.COLOR:return this._executeColorMacro(),{};case N.WAIT:return this._executeWaitMacro(),{};case N.SOUND:return this._executeSoundMacro(),{};case N.GAMEPAD_BUTTON:return this._executeGamePadButtonMacro(),{};case N.OLDMOVE:return this._executeOldMoveMacro(),{};case N.JUMPGATE:return this._executeJumpGateMacro(),{};case N.RECPOSITION:return this._executeRecPositionMacro(),{};case N.JUMPRECPOSITION:return this._executeJumpRecPositionMacro(),{};case N.CONSOLE_LOG:return this._executeConsoleLogMacro(1),{};case N.COPY_HP_TO:return this._executeCopyHpToMacro(),{};case N.SET_HP:{const{isGameOver:t}=this._executeSetHPMacro();return{isGameOver:t}}case N.COPY_HPMAX_TO:return this._executeCopyHpMaxToMacro(),{};case N.SET_HPMAX:return this._executeSetHpMaxMacro(),{};case N.COPY_AT_TO:return this._executeCopyAtToMacro(),{};case N.SET_AT:return this._executeSetAtMacro(),{};case N.COPY_DF_TO:return this._executeCopyDfToMacro(),{};case N.SET_DF:return this._executeSetDfMacro(),{};case N.COPY_MONEY_TO:return this._executeCopyMoneyToMacro(),{};case N.SET_MONEY:return this._executeSetMoneyMacro(),{};case N.COPY_STEP_COUNT_TO:return this._executeSetStepCountMacro(),{};case N.VAR_SET_VAL:return this._executeVarSetValMacro(),{};case N.VAR_SET:return this._executeVarSetMacro(),{};case N.VAR_ADD:return this._executeVarAddMacro(),{};case N.VAR_SUB:return this._executeVarSubMacro(),{};case N.VAR_MUL:return this._executeVarMulMacro(),{};case N.VAR_DIV:return this._executeVarDivMacro(),{};case N.VAR_MOD:return this._executeVarModMacro(),{};case N.VAR_SET_RAND:return this._executeVarSetRandMacro(),{};case N.GAME_SPEED:return this._executeGameSpeedMacro(),{};case N.SHOW_STR:case N.SHOW_STR2:case N.IF:return{};case N.LEGACY_IF:return this._executeLegacyIfMacro(),{};case N.ELSE_IF:case N.ELSE:case N.END_IF:return{};case N.SET_SPEED:return this._executeSetSpeedMacro(),{};case N.COPY_TIME_TO:return this._executeCopyTimeToMacro(),{};case N.HIDE_STATUS:return this._executeHideStatusMacro(),{};case N.VAR_MAP:return this._executeVarMapMacro(),{};case N.NO_GAMEOVER:return this._executeNoGameOverMacro(),{};case N.SET:{const{isGameOver:t}=this._executeSetMacro();return{isGameOver:t}}case N.MAP2:return this._executeMapMacro(2),{};case N.CONSOLE_LOG2:return this._executeConsoleLogMacro(2),{};case N.DELAYBGM:return this._executeDelayBgmMacro(),{};case N.SYSMSG:return this._executeSysMsgMacro(),{};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 a=Number(s),i=a>=0?Math.floor(a):Math.ceil(a);return isNaN(i)?Ee(s,this._wwa.generateTokenValues({id:this._triggerPartsID,type:this._triggerPartsType,position:this._triggerPartsPosition}),e):i}_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],a=this._evaluateIntValue(3,g.OBJECT);if(t<0)throw new Error("入力変数が不正です");this._wwa.varMap(this._triggerPartsPosition,e,s,t,a)}_executeImgPlayerMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setPlayerImgCoord(new n(t,e))}_executeImgYesNoMacro(){this._concatEmptyArgs(2);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1);this._wwa.setYesNoImgCoord(new n(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,g.OBJECT),a=this._evaluateIntValue(3);if(s!==g.OBJECT&&s!==g.MAP)throw new Error("パーツ種別が不明です");if(0!==a&&1!==a&&(a=1),t<0||e<0)throw new Error("パーツ番号が不正です");if(s===g.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,!!a)}_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,g.OBJECT);if(e<0)throw new Error("パーツ番号が不正です");if(s===g.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],a=this.macroArgs[2];this._wwa.appearPartsEval(this._triggerPartsPosition,t,a,e,s)}else if(2===t){const t=this._evaluateIntValue(1),a=this._evaluateIntValue(2);if(isNaN(t)||isNaN(a))throw new Error("出現先座標が不正です");this._wwa.appearPartsEval(this._triggerPartsPosition,`${t}`,`${a}`,e,s)}}_executeDirMapMacro(){this._concatEmptyArgs(3);var t=this._evaluateIntValue(0),e=this._evaluateIntValue(1),s=this._evaluateIntValue(2,g.OBJECT);if(isNaN(t)||isNaN(e)||isNaN(s))throw new Error("引数が整数ではありません");if(t<0)throw new Error("パーツ番号が不正です");if(s===g.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===R.ENERGY||t===R.STRENGTH||t===R.DEFENCE||t===R.GOLD)this._wwa.setStatusIconCoord(t,new n(e,s));else if(t===R.WIDE_CELL_ROW)this._wwa.setWideCellCoord(new n(e,s));else if(t===R.ITEM_BG)this._wwa.setItemboxBackgroundPosition({x:e,y:s});else{if(t!==R.MAIN_FRAME)throw new Error("種別が不正です。");this._wwa.setFrameCoord(new n(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 n(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),a=this._evaluateIntValue(2),i=this._evaluateIntValue(3),r=this._evaluateIntValue(4),o=this._evaluateIntValue(5);if(e<0||s<0||a<0||i<0||r<0||o<0)throw new Error("各引数は0以上の整数でなければなりません。");t=new h(new n(e,s),new n(a,i),new n(r,o)),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 a,i=this._evaluateIntValue(s);if(i<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");if(s+1===this.macroArgs.length)throw new Error("画像のパーツ座標指定で、Y座標が指定されていません。");if((a=this._evaluateIntValue(s+1))<0)throw new Error("画像のパーツ座標指定は0以上の整数でなければなりません。");e.push(new n(i,a))}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 n(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 n(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),a=this._evaluateIntValue(3);if(t<0||t>5)throw new Error("種別は0から5までです");if(e<0||e>255||s<0||s>255||a<0||a>255)throw new Error("色が範囲外です");this._wwa.changeStyleRule(t,e,s,a)}_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>W.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}})}_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(function(t){return e.some((e=>e===t))}(t))return t;return function(t){for(let s of e)if(i[s].code===t)return s}(this._evaluateIntValue(0))}}class ve{constructor(t,e,s,a,i,r,o){this._wwa=t,this._coord=e,this._width=s,this._height=a,this._isVisible=i,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=o+"",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 ye extends ve{constructor(t,e,s,a,i,r,o){super(t,new n(e.x,e.y),s,a,i,r,201),this._cgFileName=o,this._monsterBox=document.createElement("div"),this._monsterBox.style.width=W.CHIP_SIZE+"px",this._monsterBox.style.height=W.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 Oe extends ve{constructor(t,e,s,a){t.isClassicMode()?(super(t,new n(2*W.CHIP_SIZE,30),7*W.CHIP_SIZE,40,s,a,202),this._element.style.borderWidth="0",this._element.style.borderRadius="4px",this._element.style.fontSize="20px",this._element.style.lineHeight="40px"):super(t,new n(e.x,e.y),340,30,s,a,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 De,Ce;Oe.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"}(De||(De={}));class fe{constructor(t,e,s,a,i,r,o,n,_,h){this._wwaSave=void 0,this._save_select_id=0,this._save_counter=0,this._save_close=!1;var c=this,l=r.replace("(","\\(").replace(")","\\)");switch(this._wwa=t,this._cgFileName=r,this._x=e,this._y=s,this._width=a,this._height=i,this._message="",this._isVisible=o,this._isYesno=n,this._isItemMenu=_,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=h,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(){c._isInputDisable||(t.setYesNoInput(m.YES),c.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(){c._isInputDisable||(t.setYesNoInput(m.NO),c.update())},this._ynWrapperElement.appendChild(this._divYesElement),this._ynWrapperElement.appendChild(this._divNoElement),c._isInputDisable=!1,t.userDevice.device){case S.SP:case S.VR:this._parentElement.classList.add("useScaleUp")}this.update()}setPosition(t,e,s,a){this._x=t,this._y=e,this._width=s,this._height=a,this.update()}setPositionByPlayerPosition(t,e,s,a,i){var r,o=a.getPartsCoord().substract(i.getPartsCoord()).y;r=t?De.BOTTOM:e?De.SCORE:s?De.CENTER:o>=Math.ceil(W.V_PARTS_NUM_IN_WINDOW/2)?De.TOP:De.BOTTOM,this.setPositionEasy(r)}setPositionEasy(t){var e=Math.floor(this._element.clientHeight/2);return t===De.CENTER?(this._y=W.MAP_WINDOW_HEIGHT/2-e,void this.update()):t===De.TOP?(this._y=Math.max(20,W.MAP_WINDOW_HEIGHT/4-e)+10,void this.update()):t===De.BOTTOM?(this._y=Math.min(W.MAP_WINDOW_HEIGHT-20-this._element.clientHeight,3*W.MAP_WINDOW_HEIGHT/4-e),void this.update()):t===De.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,a="";for(let r=0;r<t.length||0!=s;r++)if(this.isWideChar(t.charAt(r))?s+=2:s+=1,a+=t.charAt(r),s+1>2*W.MSG_STR_WIDTH){"。"!==t.charAt(r+1)&&"、"!==t.charAt(r+1)||(a+=t.charAt(r+1),r++);var i=document.createElement("span");i.style.display="inline-block",i.style.width="100%",i.textContent=a,e.appendChild(i),s=0,a=""}return e}update(){var t=this._wwa.getYesNoImgCoord();this._isYesno?(this._wwa.getYesNoState()===m.YES?(this._divYesElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_YESP_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_NO_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px"):this._wwa.getYesNoState()===m.NO?(this._divYesElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_YES_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_NOP_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px"):(this._divYesElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_YES_X)*W.CHIP_SIZE+"px -"+t.y*W.CHIP_SIZE+"px",this._divNoElement.style.backgroundPosition="-"+(t.x+W.IMGRELPOS_YESNO_NO_X)*W.CHIP_SIZE+"px -"+t.y*W.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 a;this._wwa.isClassicMode()?a=this.createClassicTextElement(t):(a=document.createElement("span"),a.textContent=e[s]),this._msgWrapperElement.appendChild(a),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,a,i,r,o,n,_,h,c;e=document.createElement("div"),h=(n=document.getElementById("disp-energy")).style.backgroundPosition,c=n.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()})),(a=document.createElement("div")).classList.add("ss"),s.appendChild(a),(i=document.createElement("div")).classList.add("wide-cell-row"),i.style.backgroundPosition=h,i.style.backgroundImage=c,s.appendChild(i),e.appendChild(s),t.flag&&(a.appendChild(t.cvs),(r=document.createElement("span")).textContent=t.getDateText(),t.isLastSaveData()&&(r.style.color=Y.DATE_LAST_SAVE_TEXT_COLOR),a.appendChild(r),(o=document.createElement("div")).classList.add("status-icon"),o.style.backgroundImage=c,o.style.backgroundPosition="-120px -80px",i.appendChild(o),(_=document.createElement("div")).classList.add("status-value-box"),_.textContent=t.getStatusEnergy(),i.appendChild(_));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"),a=s.length,i=0;i<a;i++)e=s[i],t===i?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=W.CONTROLL_WAIT_FRAME}saveControll(t){if(!(this._save_counter>0||this._isInputDisable)){switch(t){case u.DOWN:this._save_select_id-=2,this.cursor_wait();break;case u.UP:this._save_select_id+=2,this.cursor_wait();break;case u.LEFT:this._save_select_id--,this.cursor_wait();break;case u.RIGHT:this._save_select_id++,this.cursor_wait()}this.setSaveID((this._save_select_id+Y.QUICK_SAVE_MAX)%Y.QUICK_SAVE_MAX)}}get windowName(){return"MessageWindow"}}class Ne{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.isNoEffect?this.damageDispElem.textContent="攻撃無効":s.isOverMaxTurn?this.damageDispElem.textContent="長期戦が予想されます":this.damageDispElem.textContent="予測ダメージ "+s.damage}}class Pe{constructor(t,e,s){var a;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 i=0;i<W.BATTLE_ESTIMATE_MONSTER_TYPE_MAX;i++)a=new Ne(i,this._imgFileName,this._element),this._edes.push(a),this._element.appendChild(a.elem);this._element.addEventListener("click",(()=>{this._wwa.hideBattleEstimateWindow()})),this._parent.appendChild(this._element)}update(t,e){for(var s=0;s<W.BATTLE_ESTIMATE_MONSTER_TYPE_MAX;s++)if(s>=e.length)this._edes[s].hide();else{var a=this._wwa.getObjectAttributeById(e[s],W.ATR_X),i=this._wwa.getObjectAttributeById(e[s],W.ATR_Y),r=new n(a,i),_=this._wwa.getObjectAttributeById(e[s],W.ATR_ENERGY),h=this._wwa.getObjectAttributeById(e[s],W.ATR_STRENGTH),c=this._wwa.getObjectAttributeById(e[s],W.ATR_DEFENCE),l=new o(_,h,c,0),u=Re(t,l);this._edes[s].setResult(r,l,u),this._edes[s].show()}}show(){this._element.style.display="block"}hide(){this._element.style.display="none"}}class Me{constructor(t,e,s){this.isNoEffect=t,this.isOverMaxTurn=e,this.damage=s}}function Re(t,e){var s=e.energy,a=t.strength-e.defence,i=Math.max(0,e.strength-t.defence),r=0,o=0;if(!(a>0))return new Me(!0,!1,0);for(;;){if(r++,(s-=a)<=0)return new Me(!1,!1,o);if(o+=i,r>1e4)return new Me(!1,!0,0)}}!function(t){t[t.SAVE=0]="SAVE",t[t.LOAD=1]="LOAD"}(Ce||(Ce={}));class Le{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=Ce.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===Ce.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===Ce.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 a=document.createElement("span");a.textContent=e[s],this._descriptionElement.appendChild(a),this._descriptionElement.appendChild(document.createElement("br"))}this._isVisible?this._element.style.display="block":this._element.style.display="none"}}function be(){return"ontouchstart"in window&&"ontouchend"in window&&"ontouchmove"in window}function xe(t,e,s){var a,i=document.createElement("style");i.type="text/css",i.setAttribute("id",W.WWA_STYLE_TAG_ID),(a="head",document.getElementsByTagName(a))[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="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="${W.SCREEN_WIDTH}" height="${W.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&&(lt("wwa-cover").style.backgroundImage=`url(${e})`,lt("wwa-cover").style.backgroundRepeat="no-repeat",lt("wwa-cover").style.backgroundPosition="0 0")}class Be{update(){this.counter>0&&this.counter--}cursor_wait(){this.counter=W.CONTROLL_WAIT_FRAME}allClear(){this.col=0,this.row=0,this.counter=0}controll(t){if(!(this.counter>0))switch(t){case u.DOWN:this.row<Be.ROW_MAX-1&&(this.row++,this.openView(),this.cursor_wait());break;case u.UP:this.row>0&&(this.row--,this.openView(),this.cursor_wait());break;case u.LEFT:this.col>0&&(this.col--,this.openView(),this.cursor_wait());break;case u.RIGHT:this.col<Be.COL_MAX-1&&(this.col++,this.openView(),this.cursor_wait())}}ok(){this.close();var t=null;(t=dt(Be.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<Be.COL_MAX;t++)for(e=0;e<Be.ROW_MAX;e++)(s=lt(Be.DOM_ID_TABLE[e][t])).classList.contains("onpress")&&s.classList.remove("onpress")}openView(){this.close();lt(Be.DOM_ID_TABLE[this.row][this.col]).classList.add("onpress")}init(){this.allClear(),this.openView()}constructor(){this.allClear()}}Be.ROW_MAX=8,Be.COL_MAX=3,Be.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"]],Be.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 Ue=s(705);function We(t){return`^ /${231*t+8310}P+>A[]`}function Ye(t){return(0,Ue.MD5)(t).toString()}var Fe="map",ke="mapObject",Ve="systemMessage",Ge="userVar",He={mapAttribute:!0,objectAttribute:!0,message:!0};class Ke{static compress(t){var e,s,a={};for(e in t)if(!He[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}a[e]=s}return a}static compressObject(t,e,s){var a,i,r,o;switch(t){case Fe:case ke:var n,_,h,c,l,u,d,E,m,w,p,g,A,S;for(l in a={},m={},E={},e)for(c in i=e[l],r=s[l],o={},_=-1,i)(d=i[c])!==r[c]&&(o[c]=d,void 0===m[d]&&(m[d]={}),void 0===(p=m[d])[l]&&(p[l]=[]),(A=p[l]).push(Number(c)));for(g in m)for(l in p=m[g],void 0===E[g]&&(E[g]={}),w=E[g],void 0===a[g]&&(a[g]=[]),_=-1,p)1===(A=p[l]).length?(void 0===w[u=A[0]]&&(w[u]=[]),(S=w[u]).push(Number(l))):(h=(n=Number(l))-_-1,_=n,a[g].push(this.getCompressArray(A),h));for(g in E)for(c in d=Number(g),_=-1,w=E[g])S=w[c],h=(n=Number(c))-_-1,_=n,1===S.length?a[g].push(h,S[0]):a[g].push(h,this.getCompressArray(S));var T=[];for(g in _=-1,a)h=(n=Number(g))-_-1,_=n,T.push(h,a[g]);return this._usingByteFlag&&JSON.stringify(T).length>=this._mapByteLength?this.compressMapAllObject(e,s,this._firstRandomMapObjectUtf8Table[t]):T;case Ve:var I;for(t in a={},e)I=e[t],s[t]!==I&&(a[t]=I);break;case Ge:return this.compressUserVars(e);default:return e}if(0!==Object.keys(a).length)return a}static compressUserVars(t){return t.map(((t,e)=>[e,t])).filter((([t,e])=>0!==e))}static compressMapAllObject(t,e,s){var a,i,r,o,n,_,h,c,l,u,d,E,m,w,p,g,A=this._restartData.mapWidth,S=new Uint8Array(this._mapByteLength),T=-1;for(r=0,o=0,_=0,h=0,p=0,d=[],w={},l=[],u=[],i=0;i<A;i++)for(a=0;a<A;a++)(c=t[i][a])!==e[i][a]&&(-1===T&&(T=o),S[o]=S[o]|1<<r,_=o,void 0===w[c]&&(w[c]=new je(c,p++)),w[c].count++),8===++r&&(r=0,o++);for(n in w)d[w[n].index]=w[n];for(E in d.sort(this.idSort),m={},d)m[c=d[E].id]=Number(E),l[E]=c;for(i=0;i<A;i++)for(a=0;a<A;a++)(c=t[i][a])!==e[i][a]&&(u[h++]=m[c]);if(s){for(g=S.length,T=-1,_=0,o=0;o<g;o++)S[o]=S[o]&~s[o],0!==S[o]&&(-1===T&&(T=o),_=o);-1===T&&(T=0,_=0)}return[T,S.subarray(T,_+1),l,this.indexListCompress(u,l.length)]}static indexListCompress(t,e){var s,a,i,r,o,n,_=[];for(r=t.length,a=0,s=0;s<r;s++){for(o=t[s],n=0,i=s+1;i<r&&o===t[i];i++)n++,s=i;switch(n){case 0:_[a++]=o;break;case 1:_[a++]=o,_[a++]=o;break;default:_[a++]=o,_[a++]=e+n}}return _}static idSort(t,e){return e.count-t.count}static getCompressArray(t){var e,s,a,i,r,o,n,_,h=[];for(e=-1,r=t.length,o=0,i=0;i<r;i++){for(s=(a=t[i])-e,n=0,_=i;_<r-1&&t[_]+1===t[_+1];)_++,n++;n<this.MIN_LOOP_COUNT?h[o++]=s:(i=_,a+=n,h[o++]=0,h[o++]=s,h[o++]=n-this.MIN_LOOP_COUNT),e=a}return h}static getDecompressArray(t){var e,s,a,i,r,o,n,_=[];for(e=-1,r=t.length,i=0,n=0;i<r;i++)if(0===(s=t[i])){for(o=(a=e+(s=t[++i]))+t[++i]+this.MIN_LOOP_COUNT;a<=o;a++)_[n++]=a;e=o}else a=e+s,_[n++]=a,e=a;return _}static decompress(t){var e,s,a;for(s in e=JSON.parse(JSON.stringify(this._restartData)),t){switch(typeof(a=t[s])){case"number":case"string":case"boolean":case"undefined":break;case"object":null!==a&&(a=this.decompressObject(s,a,e[s]));break;case"function":continue}e[s]=a}return[e,{isWorldNameEmpty:void 0===t.worldName}]}static decompressObject(t,e,s){var a;switch(t){case Fe:case ke:var i,r,o,n,_,h,c,l;a={},r=-1;var u,d,E=e;if(4===(l=E.length)&&"number"==typeof E[0]&&(E[1]instanceof Uint8Array||E[1]instanceof Array)&&E[2]instanceof Array&&E[3]instanceof Array)return this.decompressAllMapObject(E,s,this._firstRandomMapObjectUtf8Table[t]),s;for(c=0;c<l;c+=2)r=i=r+Number(E[c])+1,_=i,a[i]=E[c+1];for(h in a){for(_=Number(h),l=(E=a[h]).length,u=[],d=[],c=0;c<l;c+=2){var m=E[c],w=E[c+1];m instanceof Array&&(m=this.getDecompressArray(m)),w instanceof Array&&(w=this.getDecompressArray(w)),"object"==typeof m?u.push({x:m,y:w}):d.push({x:m,y:w})}var p;for(p in r=-1,u)if(r=i=r+Number(u[p].y)+1,m=u[p].x,n=String(i),m instanceof Array)for(l=(E=m).length,c=0;c<l;c++)o=String(E[c]),s[n][o]=_;else o=String(m),s[n][o]=_;for(p in r=-1,d)if(r=i=r+Number(d[p].x)+1,w=d[p].y,o=String(i),w instanceof Array)for(l=(E=w).length,c=0;c<l;c++)s[n=String(E[c])][o]=_;else s[n=String(w)][o]=_}return s;case Ge:return this.decompressUserVars(e);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(W.USER_VAR_NUM);for(let e=0;e<W.USER_VAR_NUM;e++)t[e]=0;return t}static decompressAllMapObject(t,e,s){var a,i,r,o,n,_,h,c,l,u,d,E=this._restartData.mapWidth,m=new Uint8Array(this._mapByteLength);d=t[0],o=t[2],i=t[3];var w=t[1];if(m.set(w,d),s)for(p=m.length,l=0;l<p;l++)m[l]=m[l]|s[l];r=[];var p,g,A,S,T,I,v=o.length;for(p=i.length,g=0,A=0;g<p;g++){if((n=i[g])>=v)for(S=n-v,T=0;T<S;T++)r[A++]=I;else r[A++]=n;I=n}for(c=0,l=0,u=0,_=0,p=m.length,l=0;l<p;l++)for(c=0;c<8;c++){if(m[l]&1<<c){if(void 0===(n=r[_++]))return!1;a=o[n],h=u%E,e[u/E|0][h]=a}u++}return!0}static setRestartData(t,e){this._restartData=t,this._mapByteLength=Math.ceil(t.mapWidth*t.mapWidth/8),this._firstRandomMapObjectUtf8Table[ke]=this.getChangedUint8Array(e[ke],t[ke])}static getChangedUint8Array(t,e){var s,a,i,r,o=this._restartData.mapWidth,n=new Uint8Array(this._mapByteLength),_=-1;for(i=0,r=0,a=0;a<o;a++)for(s=0;s<o;s++)t[a][s]!==e[a][s]&&(-1===_&&(_=r),n[r]=n[r]|1<<i),8===++i&&(i=0,r++);return n}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}}Ke._usingByteFlag=!1,Ke.MIN_LOOP_COUNT=3,Ke._restartData=void 0,Ke._mapByteLength=0,Ke._firstRandomMapObjectUtf8Table=new class{};var Xe=Ke;class je{constructor(t,e){this.id=0,this.index=0,this.count=0,this.id=t,this.index=e}}class Je{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=Y.QUICK_SAVE_THUMNAIL_WIDTH,this.cvs.height=Y.QUICK_SAVE_THUMNAIL_HEIGHT,this.ctx=this.cvs.getContext("2d",{alpha:!1})}showQickLoad(){lt("cell-load").textContent=F.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 a=document.createElement("img");a.src=t,a.addEventListener("load",(()=>{this.flag=!0,this.ctx.drawImage(a,0,0,a.width,a.height,0,0,this.cvs.width,this.cvs.height)})),this.showQickLoad()}catch(t){}}getDateText(){let t,e,s,a,i,r;return this.date?(t=this.date.getFullYear(),e=this.date.getMonth()+1,s=this.date.getDate(),a=this.date.getHours(),i=this.date.getMinutes(),r=this.date.getSeconds(),t=("000"+t).slice(-4),e=("0"+e).slice(-2),s=("0"+s).slice(-2),a=("0"+a).slice(-2),i=("0"+i).slice(-2),r=("0"+r).slice(-2),t+"/"+e+"/"+s+" "+a+":"+i+":"+r):""}isLastSaveData(){return this===this._parent.getLastSaveData()}}class $e extends Je{save(t,e){var s=super.save.apply(this,arguments);return this._parent.dbUpdateSaveData(this._id,t,e,this.date),s}}class Ze extends Array{constructor(){super(),Object.setPrototypeOf(this,Object.create(Ze.prototype))}hasSaveData(){for(var t=0;t<Y.QUICK_SAVE_MAX;t++)if(this[t].flag)return!0;return!1}getLastSaveData(){for(var t,e,s=0;s<Y.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 qe=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 Qe extends Ze{constructor(t,e,s=Qe.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 a=0;a<Y.QUICK_SAVE_MAX;a++)this[a]=new $e(a,this);this.onCheckLoadingSaveData=t,this.onCompleteLoadingSaveData=e,this.createDataBase(),this.selectSaveData()}indexDBOpen(){return indexedDB.open(Y.INDEXEDDB_DB_NAME,201205201)}createDataBase(){try{var t=this.indexDBOpen();t.onupgradeneeded=e=>{var s=t.result,a={keyPath:this.keyPath};s.objectStoreNames.contains(Y.INDEXEDDB_TABLE_NAME)||s.createObjectStore(Y.INDEXEDDB_TABLE_NAME,a).createIndex("url","url",{unique:!1})},t.onsuccess=Qe.doNotAnything,t.onerror=Qe.doNotAnything,t.onblocked=Qe.doNotAnything}catch(t){}}getObjectStore(t){const e=t;try{var s=e.transaction(Y.INDEXEDDB_TABLE_NAME,this.IDBTransaction.READ_WRITE).objectStore(Y.INDEXEDDB_TABLE_NAME)}catch(t){return}return s}makeSaveDataItem(t,e,s,a){return{url:location.href,id:t,hash:is.checkOriginalMapString,image:e.toDataURL(),data:s,date:a,worldName:is.worldName,mapDataRevisionKey:is.mapDataRevisionKey}}getSaveDataResult(t,e){const s=t.index("url"),a=IDBKeyRange.only(location.href),i=s.getAll(a);i.onsuccess=()=>{e(i.result)}}dbUpdateSaveData(t,e,s,a){const i=this.indexDBOpen();i.onupgradeneeded=Qe.doNotAnything,i.onsuccess=()=>{const r=this.getObjectStore(i.result),o=Xe.compress(s),n=this.makeSaveDataItem(t,e,o,a);this.selectDatas[t]=n;const _=r.put(n);_.onsuccess=Qe.doNotAnything,_.onerror=Qe.doNotAnything},i.onerror=Qe.doNotAnything,i.onblocked=Qe.doNotAnything}dbDeleteSaveData(t){const e=this.indexDBOpen();e.onupgradeneeded=Qe.doNotAnything,e.onsuccess=()=>{const s=this.getObjectStore(e.result);t.forEach((t=>{s.delete([t,location.href])}))},e.onerror=Qe.doNotAnything,e.onblocked=Qe.doNotAnything}selectSaveData(){const t=this.indexDBOpen();t.onupgradeneeded=Qe.doNotAnything,t.onsuccess=()=>{const e=this.getObjectStore(t.result);this.selectDatas=[];this.getSaveDataResult(e,(t=>{var e,s,a;let i=[];for(s=t.length,e=0;e<s;e++){var r=t[e];try{a={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(a.worldName,a.hash,a.mapDataRevisionKey);if(null!==s){i.push({id:a.id,cause:s});continue}if(!this[a.id])continue;const o=qe(Xe.decompress(a.data)[0]);this[a.id].saveDataSet(a.image,o,a.date)}i.length>0&&this.dbDeleteSaveData(i.map((t=>t.id)));const o=i.map((t=>t.cause)).filter(((t,e,s)=>s.indexOf(t)===e));this.onCompleteLoadingSaveData(o)}))},t.onerror=Qe.doNotAnything,t.onblocked=Qe.doNotAnything}}Qe.doNotAnything=()=>{};var ze,ts=Qe;class es extends Je{}class ss extends Ze{constructor(){super(),this._saveNo=0,this._lastAutoSaveMove=0,this._autoInterval=Y.SAVE_INTERVAL_MOVE,Object.setPrototypeOf(this,Object.create(ss.prototype));for(var t=0;t<Y.QUICK_SAVE_MAX;t++)this[t]=new es(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%Y.QUICK_SAVE_MAX}setAutoSaveInterval(t){t<0?console.warn(`オートセーブの歩数 (${t}) に負の値が設定されています。`):this._autoInterval=0|t}}function as(t,e){return(0,Ue.MD5)(t+e).toString()}class is{constructor(t,e,s,a,i){is.checkOriginalMapString=t.checkOriginalMapString,is.worldName=e,is.mapDataRevisionKey=as(e,s),this._wwaDBSaveList=new ts(a,i),this._wwaLogSaveList=new ss,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 a=this.list[s];return!!a&&a.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?I.CALL_BY_PASSWORD_LOAD:this._wwaDBSaveList.hasSaveData()?I.CALL_BY_QUICK_LOAD:this._wwaLogSaveList.hasSaveData()?I.CALL_BY_LOG_QUICK_LOAD:I.CALL_BY_PASSWORD_LOAD}getSecondSaveChoiceCallInfo(t){return this.list===this._wwaDBSaveList&&this._wwaLogSaveList.hasSaveData()?I.CALL_BY_LOG_QUICK_LOAD:t?I.CALL_BY_PASSWORD_LOAD:I.NONE}gameStart(t,e){this._wwaLogSaveList.setPlayer(e),this.quickSaveButtonUpdate(t)}quickSaveButtonUpdate(t){t.disableSaveFlag?lt("cell-save").textContent=F.EMPTY_SAVE:lt("cell-save").textContent=F.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"}(ze||(ze={}));class rs{constructor(t,e,s,a){this.id=t,this.fileName=e,this.audioContext=s,this.audioGain=a,this.disposeBufferSource=t=>{try{t.stop(),t.disconnect(this.audioGain),t.buffer=null}catch(t){}t.onended=null},this.audioContext=s,this.audioGain=a,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>=L.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 os=(t,e)=>{const s=new Array(t);for(let t=0;t<s.length;t++)s[t]=new Array(e);return s};var ns,_s,hs;function cs(t,e){const s=function(t){return t[ns.CHECK]+256*t[ns.CHECK+1]}(t),a=function(t,e){let s=0;if(t[ns.VERSION]>=29){for(let i=2;i<e;i++)s+=(a=t[i],((a%=256)>=128?a-256:a)*(i%8+1));s=s%65536&65535}var a;return s}(t,e);if(s!==a)throw new Error("マップデータが壊れているようです。\n チェックサムの値は"+s+"ですが、実際の和は"+a+"でした。")}!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"}(ns||(ns={}));class ls{}ls.ITEMBOX_SIZE=12,ls.MAP_ATR_MAX=60,ls.OBJ_ATR_MAX=60,ls.OLD_MAP_ATR_MAX=40,ls.OLD_OBJ_ATR_MAX=40,ls.ATR_CROP1=1,ls.ATR_CROP2=2,ls.ATR_TYPE=3,ls.ATR_JUMP_X=16,ls.ATR_JUMP_Y=17,ls.MAP_LOCALGATE=2,ls.OBJECT_LOCALGATE=18,ls.SYSTEM_MESSAGE_NUM=20,ls.IMGPOS_DEFAULT_YESNO_X=3,ls.IMGPOS_DEFAULT_YESNO_Y=1,ls.IMGPOS_DEFAULT_PLAYER_X=2,ls.IMGPOS_DEFAULT_PLAYER_Y=0,ls.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X=0,ls.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y=0,ls.IMGPOS_DEFAULT_STATUS_X=3,ls.IMGPOS_DEFAULT_STATUS_Y=2,ls.IMGRELPOS_ENERGY_ICON_X=0,ls.IMGRELPOS_STRENGTH_ICON_X=1,ls.IMGRELPOS_DEFENCE_ICON_X=2,ls.IMGRELPOS_GOLD_ICON_X=3,ls.IMGPOS_DEFAULT_WIDE_CELL_X=4,ls.IMGPOS_DEFAULT_WIDE_CELL_Y=3,ls.IMGPOS_DEFAULT_ITEMBOX_X=1,ls.IMGPOS_DEFAULT_ITEMBOX_Y=2,ls.IMGPOS_DEFAULT_FRAME_X=0,ls.IMGPOS_DEFAULT_FRAME_Y=1,ls.IMGPOS_DEFAULT_BATTLE_EFFECT_X=3,ls.IMGPOS_DEFAULT_BATTLE_EFFECT_Y=3,ls.DEFAULT_DISABLE_SAVE=!1,ls.DEFAULT_OLDMAP=!1,ls.DEFAULT_OBJECT_NO_COLLAPSE=!1,ls.DEFAULT_FRAME_COLOR_R=255,ls.DEFAULT_FRAME_COLOR_G=255,ls.DEFAULT_FRAME_COLOR_B=255,ls.DEFAULT_FRAMEOUT_COLOR_R=96,ls.DEFAULT_FRAMEOUT_COLOR_G=96,ls.DEFAULT_FRAMEOUT_COLOR_B=96,ls.DEFAULT_STR_COLOR_R=0,ls.DEFAULT_STR_COLOR_G=0,ls.DEFAULT_STR_COLOR_B=0,ls.DEFAULT_STATUS_COLOR_R=0,ls.DEFAULT_STATUS_COLOR_G=0,ls.DEFAULT_STATUS_COLOR_B=0,ls.DEFAULT_MOVES=0,ls.DEFAULT_SPEED_INDEX=3,ls.USER_VAR_NUM=256;!function(t){t[t.MAP=1]="MAP",t[t.OBJECT=0]="OBJECT"}(_s||(_s={})),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"}(hs||(hs={}));class us{constructor(t,e,s){this.byteMapData=t,this.eventEmitter=s,cs(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,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:{}}}extractAllData(){var t,e;return this.wwaData.version=this.byteMapData[ns.VERSION],this._extractInitialParameters(),this.wwaData.version>=29?this.currentPosition=ns.MAPDATA_TOP:this.currentPosition=ns.OLD_MAPDATA_TOP,this.wwaData.map=this._getFieldDataFromBits(_s.MAP,this.wwaData.mapPartsMax).concat(),this.wwaData.mapObject=this._getFieldDataFromBits(_s.OBJECT,this.wwaData.objPartsMax).concat(),t=this.wwaData.version>29?ls.MAP_ATR_MAX:ls.OLD_MAP_ATR_MAX,e=this.wwaData.version>29?ls.OBJ_ATR_MAX:ls.OLD_OBJ_ATR_MAX,this.wwaData.mapAttribute=this._getPartsDataFromBits(_s.MAP,this.wwaData.mapPartsMax,t).concat(),this.wwaData.objectAttribute=this._getPartsDataFromBits(_s.OBJECT,this.wwaData.objPartsMax,e).concat(),this.wwaData.version<=29&&(this._convertAttributeV2toV3(_s.MAP),this._convertAttributeV2toV3(_s.OBJECT)),this._replaceAllRandomObjects(),this.wwaData}_convertAttributeV2toV3(t){var e,s,a;if(t==_s.MAP)e=this.wwaData.mapPartsMax,s=this.wwaData.mapAttribute,a=ls.MAP_LOCALGATE;else{if(t!=_s.OBJECT)throw new Error("謎のパーツ種別が指定されました");e=this.wwaData.objPartsMax,s=this.wwaData.objectAttribute,a=ls.OBJECT_LOCALGATE}for(var i=0;i<e;i++){for(var r=9;r>=0;r--){var o=255&s[i][20+2*r],n=s[i][20+2*r]>>8,_=255&s[i][20+2*r+1],h=s[i][20+2*r+1]>>8;250===_?_=9e3:_>100&&(_+=9840),250===h?h=9e3:h>100&&(h+=9840),s[i][20+4*r]=o,s[i][20+4*r+3]=n,s[i][20+4*r+1]=_,s[i][20+4*r+2]=h}s[i][ls.ATR_TYPE]===a&&(s[i][ls.ATR_JUMP_X]>100&&(s[i][ls.ATR_JUMP_X]+=9840),s[i][ls.ATR_JUMP_Y]>100&&(s[i][ls.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(ns.GAMEOVER_X),this.wwaData.gameoverY=this._get2BytesNumber(ns.GAMEOVER_Y),this.wwaData.playerX=this._get2BytesNumber(ns.PLAYER_X),this.wwaData.playerY=this._get2BytesNumber(ns.PLAYER_Y),this.wwaData.mapPartsMax=this._get2BytesNumber(ns.MAP_COUNT),this.wwaData.objPartsMax=this._get2BytesNumber(ns.OBJ_COUNT),this.wwaData.isOldMap=!1):(this.wwaData.gameoverX=this._get1ByteNumber(ns.OLD_GAMEOVER_X),this.wwaData.gameoverY=this._get1ByteNumber(ns.OLD_GAMEOVER_Y),this.wwaData.playerX=this._get1ByteNumber(ns.OLD_PLAYER_X),this.wwaData.playerY=this._get1ByteNumber(ns.OLD_PLAYER_Y),this.wwaData.mapPartsMax=this._get1ByteNumber(ns.OLD_MAP_COUNT),this.wwaData.objPartsMax=this._get1ByteNumber(ns.OLD_OBJ_COUNT),this.wwaData.isOldMap=!0),this.wwaData.statusEnergyMax=this._get2BytesNumber(ns.STATUS_ENERGY_MAX),this.wwaData.statusEnergy=this._get2BytesNumber(ns.STATUS_ENERGY),this.wwaData.statusStrength=this._get2BytesNumber(ns.STATUS_STRENGTH),this.wwaData.statusDefence=this._get2BytesNumber(ns.STATUS_DEFENCE),this.wwaData.statusGold=this._get2BytesNumber(ns.STATUS_GOLD),this._extractInitialItemData(),this.wwaData.mapWidth=this._get2BytesNumber(ns.MAP_SIZE),this.wwaData.messageNum=this._get2BytesNumber(ns.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?ns.ITEMBOX_TOP:ns.OLD_ITEMBOX_TOP;this.wwaData.itemBox=new Array(ls.ITEMBOX_SIZE);for(let e=0;e<ls.ITEMBOX_SIZE;e++)this.wwaData.itemBox[e]=this._get1ByteNumber(t+e)}_getFieldDataFromBits(t,e){var s,a,i;for(i=os(this.wwaData.mapWidth,this.wwaData.mapWidth),s=0;s<this.wwaData.mapWidth;s++)for(a=0;a<this.wwaData.mapWidth;a++)this.wwaData.version>29?(i[s][a]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(i[s][a]=this._get1ByteNumber(this.currentPosition),this.currentPosition+=1),(s*this.wwaData.mapWidth+a)%200==0&&this.emitProgress(s*this.wwaData.mapWidth+a,this.wwaData.mapWidth*this.wwaData.mapWidth,t===_s.MAP?hs.MAP_LOAD:hs.OBJ_LOAD),i[s][a]>=e&&(i[s][a]=0);return this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,t===_s.MAP?hs.MAP_LOAD:hs.OBJ_LOAD),i}_getPartsDataFromBits(t,e,s){var a,i,r;for(r=os(e,s),a=0;a<e;a++)for(i=0;i<s;i++)(a*this.wwaData.mapWidth+i)%200==0&&this.emitProgress(a*s+i,e*s,t===_s.MAP?hs.MAP_ATTR:hs.OBJ_ATTR),i!==ls.ATR_CROP1&&i!==ls.ATR_CROP2?(r[a][i]=this._get2BytesNumber(this.currentPosition),this.currentPosition+=2):(r[a][i]=0,this.currentPosition+=2);return this.emitProgress(e*s,e*s,t===_s.MAP?hs.MAP_ATTR:hs.OBJ_ATTR),r}_replaceAllRandomObjects(){this.emitProgress(this.wwaData.mapWidth*this.wwaData.mapWidth,this.wwaData.mapWidth*this.wwaData.mapWidth,hs.RAND_PARTS)}emitProgress(t,e,s){this.eventEmitter.dispatch("progress",{current:t,total:e,stage:s})}}class ds{constructor(t,e,s,a){this.wwaData=t,this.compressedMapData=e,this.startPosition=s,this.eventEmitter=a,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:hs.MESSAGE});for(;t.messageNum<10;)t.message.push(""),t.messageNum++;this.eventEmitter.dispatch("progress",{current:t.message.length,total:t.message.length,stage:hs.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(ls.SYSTEM_MESSAGE_NUM);for(let e=0;e<ls.SYSTEM_MESSAGE_NUM;e++)t.version>=30?t.systemMessage[e]=this.getMessageFromData():t.systemMessage[e]="";t.yesnoImgPosX=ls.IMGPOS_DEFAULT_YESNO_X,t.yesnoImgPosY=ls.IMGPOS_DEFAULT_YESNO_Y,t.playerImgPosX=ls.IMGPOS_DEFAULT_PLAYER_X,t.playerImgPosY=ls.IMGPOS_DEFAULT_PLAYER_Y,t.clickableItemSignImgPosX=ls.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_X,t.clickableItemSignImgPosY=ls.IMGPOS_DEFAULT_CLICKABLE_ITEM_SIGN_Y,t.disableSaveFlag=ls.DEFAULT_DISABLE_SAVE,t.isOldMap=ls.DEFAULT_OLDMAP,t.isOldMove=t.version<31,t.objectNoCollapseDefaultFlag=ls.DEFAULT_OBJECT_NO_COLLAPSE,t.delPlayerFlag=!1,t.bgm=0,t.effectCoords=[],t.effectWaits=0,t.imgStatusEnergyX=ls.IMGPOS_DEFAULT_STATUS_X+ls.IMGRELPOS_ENERGY_ICON_X,t.imgStatusEnergyY=ls.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusStrengthX=ls.IMGPOS_DEFAULT_STATUS_X+ls.IMGRELPOS_STRENGTH_ICON_X,t.imgStatusStrengthY=ls.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusDefenceX=ls.IMGPOS_DEFAULT_STATUS_X+ls.IMGRELPOS_DEFENCE_ICON_X,t.imgStatusDefenceY=ls.IMGPOS_DEFAULT_STATUS_Y,t.imgStatusGoldX=ls.IMGPOS_DEFAULT_STATUS_X+ls.IMGRELPOS_GOLD_ICON_X,t.imgStatusGoldY=ls.IMGPOS_DEFAULT_STATUS_Y,t.imgWideCellX=ls.IMGPOS_DEFAULT_WIDE_CELL_X,t.imgWideCellY=ls.IMGPOS_DEFAULT_WIDE_CELL_Y,t.imgItemboxX=ls.IMGPOS_DEFAULT_ITEMBOX_X,t.imgItemboxY=ls.IMGPOS_DEFAULT_ITEMBOX_Y,t.imgFrameX=ls.IMGPOS_DEFAULT_FRAME_X,t.imgFrameY=ls.IMGPOS_DEFAULT_FRAME_Y,t.imgBattleEffectX=ls.IMGPOS_DEFAULT_BATTLE_EFFECT_X,t.imgBattleEffectY=ls.IMGPOS_DEFAULT_BATTLE_EFFECT_Y,t.imgClickX=0,t.imgClickY=0,t.frameColorR=ls.DEFAULT_FRAME_COLOR_R,t.frameColorG=ls.DEFAULT_FRAME_COLOR_G,t.frameColorB=ls.DEFAULT_FRAME_COLOR_B,t.frameOutColorR=ls.DEFAULT_FRAMEOUT_COLOR_R,t.frameOutColorG=ls.DEFAULT_FRAMEOUT_COLOR_G,t.frameOutColorB=ls.DEFAULT_FRAMEOUT_COLOR_B,t.fontColorR=ls.DEFAULT_STR_COLOR_R,t.fontColorG=ls.DEFAULT_STR_COLOR_G,t.fontColorB=ls.DEFAULT_STR_COLOR_B,t.statusColorR=ls.DEFAULT_STATUS_COLOR_R,t.statusColorG=ls.DEFAULT_STATUS_COLOR_G,t.statusColorB=ls.DEFAULT_STATUS_COLOR_B,t.moves=ls.DEFAULT_MOVES,t.gameSpeedIndex=ls.DEFAULT_SPEED_INDEX,t.permitChangeGameSpeed=!0,t.userVar=new Array(ls.USER_VAR_NUM);for(let e=0;e<ls.USER_VAR_NUM;e++)t.userVar[e]=0;return t.playTime=0,t.isVisibleStatusEnergy=!0,t.isVisibleStatusStrength=!0,t.isVisibleStatusDefence=!0,t.isVisibleStatusGold=!0,t.gameOverPolicy="default",t.bgmDelayDurationMs=0,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 Es{constructor(){}}class ms extends Es{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 ms.fetch(this.uri);ms.handleError(this.uri,t);return await t.arrayBuffer()}}var ws=s(699),ps=s.n(ws);class gs extends Es{constructor(t){super(),this.fileName=t}async request(){return new Promise(((t,e)=>{ps().readFile(this.fileName,((s,a)=>{s&&e(s),t(a.buffer)}))}))}}class As{constructor(t,e){this.fileName=t,this.eventEmitter=e}async requestAndLoadMapData(){const t=(e=this.fileName,"undefined"!=typeof window?new ms(e):new gs(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:a,compressedEndPosition:i}=function(t){let e,s,a=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(a[s++]=t[e],t[e]===t[e+1]){const i=t[e+2];for(let r=0;r<i;r++)a[s++]=t[e];e+=2}if(s+255>=a.length){var i=new Uint8Array(a.length+65e3);i.set(a),a=i}}return console.log("EXTRACT DATA = "+s+" "+e),{byteMapData:a,byteMapLength:s,compressedEndPosition:e+3}}(e),r=new us(s,a,this.eventEmitter).extractAllData();return new ds(r,e,i,this.eventEmitter).load()}catch(t){throw t}}}class Ss{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)}}const Ts="user-variable-label";const Is="user-variable-card";function vs({index:t,value:e}){const s=document.createElement("div");return s.classList.add(Is),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(Ts),t}()),e}(t)),s.appendChild(function(t){const e=document.createElement("div");e.classList.add("value"),"string"==typeof t&&e.setAttribute("title",String(t));return ys(e,t),e}(e)),s}function ys(t,e){t.textContent=void 0===e?"-":String(e)}const Os="user-variable-list";function Ds({index:t,value:e}){const s=document.createElement("li");return s.appendChild(vs({index:t,value:e})),s}function Cs(t,{index:e,value:s}){t.appendChild(Ds({index:e,value:s}))}const fs="information";function Ns(t,e,s=!1){t.textContent=`${s?"【エラー】":""}${e}`}function Ps({heading:t,contentVisibilityToggleButton:e,information:s}){const a=document.createElement("header");return a.appendChild(function({heading:t,contentVisibilityToggleButton:e}){const s=document.createElement("div");s.classList.add("heading-area");const a=document.createElement("h2");a.textContent=t.text,s.appendChild(a);const i=document.createElement("button");i.classList.add("content-visibility-toggle-button"),Ms(i,!0),e.onClick&&i.addEventListener("click",e.onClick.bind(i));return s.appendChild(i),s}({heading:t,contentVisibilityToggleButton:e})),s&&a.appendChild(function(){const t=document.createElement("p");return t.classList.add(fs),Ns(t,"強調されている番号にカーソルを乗せると説明が表示されます。"),t}()),a}function Ms(t,e){t.textContent=e?"▲隠す":"▼表示"}const Rs="user-variable-list-section";function Ls({kind:t}){const e=document.createElement("section");e.classList.add(Rs),e.dataset.kind=t;const s=function({kind:t}){const e=document.createElement("ul");return e.classList.add(Os),"numbered"===t&&Array.from({length:W.USER_VAR_NUM}).map(((t,e)=>Ds({index:e}))).forEach((t=>e.appendChild(t))),e}({kind:t}),a=Ps({heading:{text:"named"===t?"名前つき変数一覧":"変数一覧"},information:"numbered"===t?{}:void 0,contentVisibilityToggleButton:{onClick:t=>{const e=a.querySelector(`.${fs}`);"true"===s.getAttribute("aria-hidden")?function(t,e,s){t.removeAttribute("aria-hidden"),e instanceof HTMLElement&&e.removeAttribute("aria-hidden");s instanceof HTMLElement&&Ms(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&&Ms(s,!1)}(s,e,t.target)}}});return e.appendChild(a),e.appendChild(s),e}function bs(t,e){t instanceof HTMLElement&&Array.from({length:W.USER_VAR_NUM}).map(((s,a)=>{const i=function(t,e){return t.querySelector(`${Ws(e)} > .value`)}(t,a);i instanceof HTMLElement&&ys(i,e[a])}))}function xs(t,e){t&&Array.from({length:W.USER_VAR_NUM}).map(((s,a)=>{const i=e[a];if(!i)return;const r=function(t,e){return t.querySelector(`${Ws(e)} > .index`)}(t,a);if(!(r instanceof HTMLElement))return;const o=r.querySelector(`.${Ts}`);o instanceof HTMLElement&&(function(t,e){t.textContent=e}(o,i),function(t,e){t.dataset.labelledVarIndex="true",t.addEventListener("mouseover",(()=>e.removeAttribute("aria-hidden"))),t.addEventListener("mouseleave",(()=>e.setAttribute("aria-hidden","true")))}(r,o))}))}function Bs(t,e,s=!1){if(!t)return;const a=function(t){return t.querySelector(`.${Us} > header > .${fs}`)}(t);a instanceof HTMLElement&&Ns(a,e,s)}const Us=`.${Rs}[data-kind="numbered"]`;function Ws(t){return`${Us} > .${Os} > li > .${Is}[data-var-index="${CSS.escape(String(t))}"]`}function Ys(t,e){if(!(t instanceof HTMLElement))return;const s=function(t){return t.querySelector(`${Fs} > .${Os}`)}(t);if(s instanceof HTMLElement)for(const[a,i]of e){const e=ks(t,a);e instanceof HTMLElement?ys(e,i):Cs(s,{index:a,value:i})}}const Fs=`.${Rs}[data-kind="named"]`;function ks(t,e){return t.querySelector(`${function(t){return`${Fs} > .${Os} > li > .${Is}[data-var-index="${CSS.escape(t)}"]`}(e)} > .value`)}let Vs;function Gs(t,e,s){var a=new k;return a.current=t,a.total=e,a.stage=s,a}class Hs{constructor(t,e=!1,s,i,r,h,c="",d=!1,E=null,w,p,g=!1,y=null){var O;this._useSuspend=!1,this._useLookingAround=!0,this._isDisallowLoadOldSave=!1,this.audioExtension="",this.soundLoadedCheckTimer=void 0,this._playTimeCalculator=void 0,this.mainCaller=()=>this._main(),this.soundCheckCaller=()=>this.checkAllSoundLoaded(),this._checkTurnKeyPressed=()=>this._keyStore.checkHitKey($.KEY_ESC)||this._keyStore.checkHitKey($.KEY_SHIFT)||this._keyStore.checkHitKey($.KEY_N),this._saveDataList=[],this.wwaCustomEventEmitter=new Ss(lt("wwa-wrapper")),window.addEventListener("click",(t=>{this._isActive=!1})),lt("wwa-wrapper").addEventListener("click",(t=>{t.stopPropagation(),this._isActive=!0})),this._isActive=!0,null===s?(this._hasTitleImg=!1,this._cvsCover=lt("progress-panel"),(O=this._cvsCover.getContext("2d")).fillStyle="rgb(0, 0, 0)"):this._hasTitleImg=!0;try{this._hasTitleImg?lt("version").textContent="WWA Wing Ver.3.12.22":this._setLoadingMessage(O,0)}catch(t){}this._dumpElement=E;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 C=new Audio;"no"!==C.canPlayType("audio/mpeg")&&""!==C.canPlayType("audio/mpeg")?this.audioExtension="mp3":this.audioExtension="m4a",this.userDevice=new f,this._isURLGateEnable=e,this._isClassicModeEnable=i,this._mainCallCounter=0,this._animationCounter=0,this._statusPressCounter=new o(0,0,0,0),c?"/"!==c[c.length-1]&&(c+="/"):c="./audio/",this._audioDirectory=c,this._bottomButtonType=h?l.GOTO_WWA:l.BATTLE_REPORT;var N=(new Date).getTime();if(!!location.href.match(/^file/))if(this.userDevice.device===S.GAME){if(this.userDevice.os===A.NINTENDO)W.BATTLE_INTERVAL_FRAME_NUM=5;this._bottomButtonType=l.GAME_END}else alert("【警告】直接HTMLファイルを開いているようです。\nこのプログラムは正常に動作しない可能性があります。\nマップデータの確認を行う場合には同梱の「wwa-server.exe」をご利用ください。\n"+(this.userDevice.browser===T.FIREFOX?"Firefoxの場合も、バージョン68以降はローカルのHTMLファイルを直接開いた場合、通常起動できないことを確認しております。":""));switch(this.userDevice.device){case S.VR:case S.GAME:this._usePassword=!1;break;default:this._usePassword=!0}switch(lt("cell-save").textContent=F.QUICK_SAVE,this._usePassword?lt("cell-load").textContent=F.PASSWORD:lt("cell-load").textContent=F.EMPTY_LOAD,this._bottomButtonType){case l.GOTO_WWA:lt("cell-gotowwa").textContent=F.GOTO_WWA;break;case l.BATTLE_REPORT:lt("cell-gotowwa").textContent=F.BATTLE_REPORT;break;case l.GAME_END:lt("cell-gotowwa").textContent=F.GAME_END}this._loadHandler=t=>{this._wwaData=t,this._wwaData.isItemEffectEnabled=r;try{this._hasTitleImg?lt("version").textContent+=" (Map data Ver. "+Math.floor(this._wwaData.version/10)+"."+ +this._wwaData.version%10+")":this._setLoadingMessage(O,1)}catch(t){}var e=lt("wwa-wrapper").getAttribute("data-wwa-mapdata").split("/");e.pop(),e.push(this._wwaData.mapCGName),this._wwaData.mapCGName=e.join("/"),this._playTimeCalculator=new rt,this._restartData=JSON.parse(JSON.stringify(this._wwaData)),this.checkOriginalMapString=this._generateMapDataHash(this._restartData),this.initCSSRule(),this._setProgressBar(Gs(0,4,V.GAME_INIT)),this._setLoadingMessage(O,2);var s=new Image;s.src=this._wwaData.mapCGName,s.addEventListener("error",(()=>{this._setErrorMessage("画像ファイル「"+this._wwaData.mapCGName+"」が見つかりませんでした。\n管理者の方へ: データがアップロードされているか、\nパーミッションを確かめてください。",O)}));var i=this._wwaData.mapCGName.replace("(","\\(").replace(")","\\)");const h=t=>{t.style.backgroundImage="url("+i+")"};Array.prototype.forEach.call(Et("div.item-cell"),(t=>{t.style.backgroundPosition=`-${this._wwaData.imgItemboxX*W.CHIP_SIZE}px -${this._wwaData.imgItemboxY*W.CHIP_SIZE}px`,t.style.backgroundImage="url("+i+")"})),Array.prototype.forEach.call(Et("div.wide-cell-row"),(t=>{t.style.backgroundPosition="-160px -120px",t.style.backgroundImage="url("+i+")"})),Array.prototype.forEach.call(Et(".item-cell>.item-click-border"),(t=>{t.style.backgroundImage="url('"+W.ITEM_BORDER_IMG_DATA_URL+"')",t.style.backgroundPosition="0 0",t.style.display="none",t.style.cursor="pointer"})),Array.prototype.forEach.call(Et(".item-cell>.item-disp"),h),Array.prototype.forEach.call(Et("div.wide-cell-row>.status-icon"),h),this.setStatusIconCoord(R.ENERGY,new n(this._wwaData.imgStatusEnergyX,this._wwaData.imgStatusEnergyY)),this.setStatusIconCoord(R.STRENGTH,new n(this._wwaData.imgStatusStrengthX,this._wwaData.imgStatusStrengthY)),this.setStatusIconCoord(R.DEFENCE,new n(this._wwaData.imgStatusDefenceX,this._wwaData.imgStatusDefenceY)),this.setStatusIconCoord(R.GOLD,new n(this._wwaData.imgStatusGoldX,this._wwaData.imgStatusGoldY)),this._setProgressBar(Gs(1,4,V.GAME_INIT)),this._setLoadingMessage(O,3),this._mapIDTableCreate(),this._replaceAllRandomObjects();var c=(new Date).getTime();console.log("Loading Complete!"+(c-N)+"ms"),this._cvs=lt("wwa-map");var l=this._cvs.getContext("2d",{alpha:!1});l.fillStyle="rgba( 255, 255, 255, 0.5)",l.fillRect(0,0,440,440);var E=new _(this,this._wwaData.playerX,this._wwaData.playerY);this._camera=new Tt(E),this._itemMenu=new Be;var w=new o(this._wwaData.statusEnergy,this._wwaData.statusStrength,this._wwaData.statusDefence,this._wwaData.statusGold);this._player=new Ot(this,E,this._camera,w,this._wwaData.statusEnergyMax,this._wwaData.moves,this._wwaData.gameSpeedIndex),this._objectMovingDataManager=new ft(this,this._player),this._camera.setPlayer(this._player),this._keyStore=new st,this._mouseStore=new at,g?(this._virtualPadButtonElements={BUTTON_ENTER:lt("wwa-enter-button"),BUTTON_ESC:lt("wwa-esc-button"),BUTTON_FAST:lt("wwa-fast-button"),BUTTON_SLOW:lt("wwa-slow-button"),BUTTON_LEFT:lt("wwa-left-button"),BUTTON_UP:lt("wwa-up-button"),BUTTON_RIGHT:lt("wwa-right-button"),BUTTON_DOWN:lt("wwa-down-button")},this._virtualPadStore=new ht(this._virtualPadButtonElements,be(),lt("wwa-virtualpad-right"),lt("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)}(y,(()=>{this._virtualPadStore.toggleVisible()}))):(this._virtualPadButtonElements=null,this._virtualPadStore=new ht({})),this._gamePadStore=new it,this._pages=[],this._yesNoJudge=m.UNSELECTED,this._yesNoJudgeInNextFrame=m.UNSELECTED,this._yesNoChoiceCallInfo=I.NONE,this._prevFrameEventExected=!1,this._isLastPage=!1,this._reservedPartsAppearances=[],this._reservedJumpDestination=void 0,this._shouldSetNextPage=!1,this._passwordLoadExecInNextFrame=!1,this._messageWindow=new fe(this,50,180,340,0,this._wwaData.mapCGName,!1,!0,!1,lt("wwa-wrapper")),this._scoreWindow=new Oe(this,new n(50,50),!1,lt("wwa-wrapper")),this._wwaSave=new is(Vs,Vs._wwaData.worldName,Vs._wwaData.worldPassNumber,this._checkSaveDataCompatibility.bind(this),(t=>{if(t.length>0){let e="これまでに保存されていたセーブデータは、下記の理由により消えたものがあります。";t.forEach((t=>{switch(t){case ze.UNMATCHED_WORLD_NAME:e+="\n・制作者によるマップデータのワールド名の変更";break;case ze.UNMATCHED_WORLD_PASS_NUMBER:e+="\n・制作者によるマップデータの暗証番号の変更";break;case ze.DISALLOW_OLD_REVISION_WORLD_SAVE_DATA:e+="\n・制作者によるマップデータの内容変更 (マップデータ制作者の設定により、内容が変更されるとセーブデータが消去されます)"}})),alert(e)}})),this._isDisallowLoadOldSave=d,this._messageWindow.setWWASave(this._wwaSave),Xe.setRestartData(this._restartData,this._wwaData),this.clearFaces();const T=lt("wwa-wrapper").getAttribute("data-wwa-resume-savedata");if("string"==typeof T&&(this._useSuspend=!0,T)){var D=Xe.getStartWWAData(T);this._restartData!==D&&(this._applyQuickLoad(D),this._wwaSave.resumeStart())}const C=lt("wwa-wrapper").getAttribute("data-wwa-autosave");null!==C&&this._wwaSave.setAutoSaveInterval(0|Number(C));const f=lt("wwa-wrapper").getAttribute("data-wwa-looking-around");if(this._useLookingAround=!(f&&f.match(/false/i)),this._setProgressBar(Gs(2,4,V.GAME_INIT)),this._setLoadingMessage(O,4),window.addEventListener("keydown",(t=>{if(this._isActive){if(this.userDevice.os===A.NINTENDO)return t.preventDefault(),void t.stopPropagation();this._keyStore.setPressInfo(t.keyCode),t.keyCode!==$.KEY_F5?this._player.isWaitingMessage()?t.keyCode!==$.KEY_DOWN&&t.keyCode!==$.KEY_LEFT&&t.keyCode!==$.KEY_RIGHT&&t.keyCode!==$.KEY_UP&&t.keyCode!==$.KEY_SHIFT&&t.keyCode!==$.KEY_ENTER&&t.keyCode!==$.KEY_ESC&&t.keyCode!==$.KEY_SPACE||t.preventDefault():this._player.isWaitingPasswordWindow()||t.keyCode!==$.KEY_DOWN&&t.keyCode!==$.KEY_LEFT&&t.keyCode!==$.KEY_RIGHT&&t.keyCode!==$.KEY_UP&&t.keyCode!==$.KEY_SHIFT&&t.keyCode!==$.KEY_ENTER&&t.keyCode!==$.KEY_1&&t.keyCode!==$.KEY_2&&t.keyCode!==$.KEY_3&&t.keyCode!==$.KEY_A&&t.keyCode!==$.KEY_C&&t.keyCode!==$.KEY_D&&t.keyCode!==$.KEY_E&&t.keyCode!==$.KEY_M&&t.keyCode!==$.KEY_N&&t.keyCode!==$.KEY_Q&&t.keyCode!==$.KEY_S&&t.keyCode!==$.KEY_W&&t.keyCode!==$.KEY_X&&t.keyCode!==$.KEY_Y&&t.keyCode!==$.KEY_Z&&t.keyCode!==$.KEY_ESC&&t.keyCode!==$.KEY_F1&&t.keyCode!==$.KEY_F2&&t.keyCode!==$.KEY_F3&&t.keyCode!==$.KEY_F4&&t.keyCode!==$.KEY_F6&&t.keyCode!==$.KEY_F7&&t.keyCode!==$.KEY_F8&&t.keyCode!==$.KEY_F12&&t.keyCode!==$.KEY_SPACE||t.preventDefault():t.preventDefault()}})),window.addEventListener("keyup",(t=>{if(this._isActive){if(this.userDevice.os===A.NINTENDO)return t.preventDefault(),void t.stopPropagation();this._keyStore.setReleaseInfo(t.keyCode),t.keyCode===$.KEY_F5?t.preventDefault():t.keyCode!==$.KEY_DOWN&&t.keyCode!==$.KEY_LEFT&&t.keyCode!==$.KEY_RIGHT&&t.keyCode!==$.KEY_UP&&t.keyCode!==$.KEY_SHIFT&&t.keyCode!==$.KEY_ENTER&&t.keyCode!==$.KEY_1&&t.keyCode!==$.KEY_2&&t.keyCode!==$.KEY_3&&t.keyCode!==$.KEY_A&&t.keyCode!==$.KEY_C&&t.keyCode!==$.KEY_D&&t.keyCode!==$.KEY_E&&t.keyCode!==$.KEY_M&&t.keyCode!==$.KEY_N&&t.keyCode!==$.KEY_Q&&t.keyCode!==$.KEY_S&&t.keyCode!==$.KEY_W&&t.keyCode!==$.KEY_X&&t.keyCode!==$.KEY_Y&&t.keyCode!==$.KEY_Z&&t.keyCode!==$.KEY_ESC&&t.keyCode!==$.KEY_F1&&t.keyCode!==$.KEY_F3&&t.keyCode!==$.KEY_F4&&t.keyCode!==$.KEY_F6&&t.keyCode!==$.KEY_F7&&t.keyCode!==$.KEY_F8&&t.keyCode!==$.KEY_F9&&t.keyCode!==$.KEY_F12&&t.keyCode!==$.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=lt("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=mt(t.clientX,t.clientY),s=this._player.getDrawingCenterPosition(),a=e.substract(s),i=Math.abs(a.x),r=Math.abs(a.y);let o,n=!1;if(i<W.CHIP_SIZE&&r<W.CHIP_SIZE){switch(s.x/W.CHIP_SIZE|0){case 0:n=!0,o=u.LEFT;break;case W.H_PARTS_NUM_IN_WINDOW-1:n=!0,o=u.RIGHT}switch(s.y/W.CHIP_SIZE|0){case 0:n=!0,o=u.UP;break;case W.V_PARTS_NUM_IN_WINDOW-1:n=!0,o=u.DOWN}}n||(a.y>0&&r>i?o=u.DOWN:a.y<0&&r>i?o=u.UP:a.x>0&&r<i?o=u.RIGHT:a.x<0&&r<i&&(o=u.LEFT)),this._mouseStore.setPressInfo(o,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],a=mt(s.clientX,s.clientY),i=this._player.getDrawingCenterPosition(),r=a.substract(i),o=Math.abs(r.x),n=Math.abs(r.y);let _,h=!1;if(o<W.CHIP_SIZE&&n<W.CHIP_SIZE){switch(i.x/W.CHIP_SIZE|0){case 0:h=!0,_=u.LEFT;break;case W.H_PARTS_NUM_IN_WINDOW-1:h=!0,_=u.RIGHT}switch(i.y/W.CHIP_SIZE|0){case 0:h=!0,_=u.UP;break;case W.V_PARTS_NUM_IN_WINDOW-1:h=!0,_=u.DOWN}}h||(r.y>0&&n>o?_=u.DOWN:r.y<0&&n>o?_=u.UP:r.x>0&&n<o?_=u.RIGHT:r.x<0&&n<o&&(_=u.LEFT)),this._mouseStore.setPressInfo(_,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)}lt("button-load").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(v.QUICK_LOAD)})),lt("button-save").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(v.QUICK_SAVE)})),lt("button-restart").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(v.RESTART_GAME)})),lt("button-gotowwa").addEventListener("click",(()=>{(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onselectbutton(v.GOTO_WWA,!1,!1)})),Array.prototype.forEach.call(Et(".wide-cell-row"),(t=>{t.addEventListener("click",(()=>{this._displayHelp()}))})),this._frameCoord=new n(W.IMGPOS_DEFAULT_FRAME_X,W.IMGPOS_DEFAULT_YESNO_Y),this._battleEffectCoord=new n(W.IMGPOS_DEFAULT_BATTLE_EFFECT_X,W.IMGPOS_DEFAULT_BATTLE_EFFECT_Y),this._battleEstimateWindow=new Pe(this,this._wwaData.mapCGName,lt("wwa-wrapper")),this._passwordWindow=new Le(this,lt("wwa-wrapper"),d),this._monsterWindow=new ye(this,new n(50,180),340,60,!1,lt("wwa-wrapper"),this._wwaData.mapCGName),this._setProgressBar(Gs(3,4,V.GAME_INIT)),this._isLoadedSound=!1,this._temporaryInputDisable=!1,this._paintSkipByDoorOpen=!1,this._clearFacesInNextFrame=!1,this._useConsole=!1,this.wwaCustomEvent("wwa_startup"),this._cgManager=new St(l,this._wwaData.mapCGName,this._frameCoord,(()=>{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(a.CONFIRM_LOAD_SOUND);if("ON"===e)return this._isLoadedSound=!0,t(),this._setLoadingMessage(O,V.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||O.clearRect(0,0,W.SCREEN_WIDTH,W.SCREEN_HEIGHT),this._usePassword){let t=e;p&&(t+='\n\n※変数表示が有効になっています。\n公開前に必ずHTMLファイル内の\n data-wwa-display-user-vars="true" \nを消してください。'),this._messageWindow.setMessage(t),this._messageWindow.show(),this._setProgressBar(Gs(4,4,V.GAME_INIT));var s=setInterval((()=>{this._keyStore.update(),this._gamePadStore.update(),this._virtualPadStore.update(),this._yesNoJudgeInNextFrame===m.UNSELECTED&&(this._keyStore.getKeyState($.KEY_ENTER)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_Y)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this._yesNoJudgeInNextFrame=m.YES:(this._keyStore.getKeyState($.KEY_N)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_ESC)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&(this._yesNoJudgeInNextFrame=m.NO)),this._yesNoJudgeInNextFrame===m.YES?(clearInterval(s),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout((()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=m.UNSELECTED,this._yesNoJudgeInNextFrame=m.UNSELECTED,this._isLoadedSound=!0,this._setLoadingMessage(O,V.AUDIO),this.loadSound(),window.requestAnimationFrame(this.soundCheckCaller)}),W.YESNO_PRESS_DISP_FRAME_NUM*W.DEFAULT_FRAME_INTERVAL)):this._yesNoJudgeInNextFrame===m.NO&&(clearInterval(s),this._messageWindow.update(),this._yesNoJudge=this._yesNoJudgeInNextFrame,this._messageWindow.setInputDisable(),setTimeout((()=>{this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=m.UNSELECTED,this._yesNoJudgeInNextFrame=m.UNSELECTED,this._isLoadedSound=!1,this.openGameWindow()}),W.YESNO_PRESS_DISP_FRAME_NUM*W.DEFAULT_FRAME_INTERVAL))}),W.DEFAULT_FRAME_INTERVAL)}else clearInterval(s),this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoJudge=m.UNSELECTED,this._yesNoJudgeInNextFrame=m.UNSELECTED,this._isLoadedSound=!0,this.loadSound(),window.requestAnimationFrame(this.soundCheckCaller)})),this.wwaCustomEvent("wwa_start")};const P=new Ss;P.addListener("mapData",(t=>this._loadHandler(t))),P.addListener("progress",(t=>this._setProgressBar(t))),P.addListener("error",(t=>this._setErrorMessage("下記のエラーが発生しました。: \n"+t.message,O)));new As(t,P).requestAndLoadMapData().then((async()=>{if(this._canDisplayUserVars=p,this._userVarNameList=[],this._canDisplayUserVars)return this._inlineUserVarViewer={topUserVarIndex:0,isVisible:!1},w?(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} が壊れています。`}))))(w):{kind:"noFileSpecified",errorMessage:"data-wwa-user-var-names-file 属性に、変数の説明を記したファイル名を書くことで、その説明を表示できます。詳しくはマニュアルをご覧ください。"}})).then((t=>{if(t)if("noFileSpecified"!==t.kind){if("data"!==t.kind)return this._userVarNameListRequestError=t,void Bs(this._dumpElement,this._userVarNameListRequestError.errorMessage,!0);if(!t.data||"object"!=typeof t.data)return this._userVarNameListRequestError={kind:"notObject",errorMessage:`ユーザ変数一覧 ${w} が正しい形式で書かれていません。`},void Bs(this._dumpElement,this._userVarNameListRequestError.errorMessage,!0);this._userVarNameList=this.convertUserVariableNameListToArray(t.data),xs(this._dumpElement,this._userVarNameList)}else Bs(this._dumpElement,t.errorMessage,!1)}))}convertUserVariableNameListToArray(t){const e=new Array(W.USER_VAR_NUM);for(let t=0;t<W.USER_VAR_NUM;t++)e[t]=void 0;return Object.keys(t).forEach((s=>{const a=parseInt(s,10);"string"!=typeof t[s]||"string"!=typeof s||isNaN(a)||a<0||a>=W.USER_VAR_NUM||(e[a]=t[s])})),e}_setProgressBar(t){this._hasTitleImg&&(t.stage<=W.LOAD_STAGE_MAX_EXCEPT_AUDIO?(lt("progress-message-container").textContent=t.stage===W.LOAD_STAGE_MAX_EXCEPT_AUDIO?"World Name: "+this._wwaData.worldName:tt[t.stage],lt("progress-bar").style.width=(1*t.stage+t.current/t.total*1)/(W.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*W.MAP_WINDOW_WIDTH+"px",lt("progress-disp").textContent=((1*t.stage+t.current/t.total*1)/(W.LOAD_STAGE_MAX_EXCEPT_AUDIO+1)*100).toFixed(2)+"%"):(this._usePassword?lt("progress-message-container").textContent="効果音/BGMを読み込んでいます。(スペースキーでスキップ)":lt("progress-message-container").textContent="ゲームデータを読み込んでいます。",lt("progress-bar-audio").style.width=t.current*W.MAP_WINDOW_WIDTH/t.total+"px",lt("progress-disp").textContent=(t.current/t.total*100).toFixed(2)+"%"))}_setLoadingMessage(t,e){if(!this._hasTitleImg)if(e<=0)t.font=H.TITLE+"px "+W.LOADING_FONT,t.fillText(et[0],G.TITLE_X,G.TITLE_Y),t.font=H.FOOTER+"px "+W.LOADING_FONT,t.fillText("WWA Wing Ver.3.12.22",G.FOOTER_X,G.COPYRIGHT_Y);else if(e<=et.length)t.font=H.LOADING+"px "+W.LOADING_FONT,e>=2&&(t.clearRect(G.LOADING_X,G.LOADING_Y+G.LINE*(e-3),W.SCREEN_WIDTH-G.LOADING_X,G.LINE),t.fillText(et[e-1]+" Complete!",G.LOADING_X,G.LOADING_Y+G.LINE*(e-2))),e<et.length&&t.fillText(et[e],G.LOADING_X,G.LOADING_Y+G.LINE*(e-1)),1==e&&(t.font=H.FOOTER+"px "+W.LOADING_FONT,t.fillText("World Name "+this._wwaData.worldName,G.FOOTER_X,G.WORLD_Y),t.fillText(" (Map data Ver. "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10+")",G.FOOTER_X,G.WORLD_Y+G.LINE));else{var s;s=this._isSkippedSoundMessage?G.LOADING_Y+G.LINE*(et.length-1):G.FOOTER_Y,e<=V.AUDIO?t.fillText("Now Sound data Loading .....",G.LOADING_X,s):(t.clearRect(G.LOADING_X,s-G.LINE,W.SCREEN_WIDTH-G.LOADING_X,G.LINE),t.fillText("Now Sound data Loading ..... Complete!",G.LOADING_X,s))}}_setErrorMessage(t,e){this._hasTitleImg?alert(t):(e.clearRect(0,0,W.SCREEN_WIDTH,W.SCREEN_HEIGHT),e.font=H.ERRROR+"px "+W.LOADING_FONT,t.split("\n").forEach((function(t,s){e.fillText(t,G.ERROR_X,G.ERROR_Y+G.LINE*s)})))}createSoundInstance(t){if(0===t||t===L.NO_SOUND||this.sounds[t])return;const e=`${this._audioDirectory}${t}.${this.audioExtension}`;this.sounds[t]=new rs(t,e,this.audioContext,this.audioGain)}loadSound(){this.sounds=new Array(W.SOUND_MAX+1),this.createSoundInstance(L.DECISION),this.createSoundInstance(L.ATTACK);for(let t=1;t<this._wwaData.mapPartsMax;t++){const e=this._wwaData.mapAttribute[t][W.ATR_SOUND];this.createSoundInstance(e)}for(let t=1;t<this._wwaData.objPartsMax;t++){if(this._wwaData.objectAttribute[t][W.ATR_TYPE]===W.OBJECT_RANDOM)continue;const e=this._wwaData.objectAttribute[t][W.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<L.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($.KEY_SPACE)===J.KEYDOWN&&(this._soundLoadSkipFlag=!0);for(let s=1;s<=W.SOUND_MAX;s++){const a=this.sounds[s];void 0===a||a.isError()||(e++,a.hasData()&&t++)}if(t<e&&!this._soundLoadSkipFlag)return this._setProgressBar(Gs(t,e,V.AUDIO)),void window.requestAnimationFrame(this.soundCheckCaller);this._setProgressBar(Gs(W.SOUND_MAX,W.SOUND_MAX,V.AUDIO)),this._setLoadingMessage(s,V.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===L.NO_SOUND?this._wwaData.bgm=0:t>=L.BGM_LB&&(this._wwaData.bgm=t));if(t<0||t>=W.SOUND_MAX)return void console.warn("サウンド番号が範囲外です。");if(t>=L.BGM_LB&&this._wwaData.bgm===t)return;if((t===L.NO_SOUND||t>=L.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===L.NO_SOUND)return;this.sounds[t].hasData()?t>=L.BGM_LB?(this.sounds[t].play(null!=e?e:this._wwaData.bgmDelayDurationMs),this._wwaData.bgm=t):this.sounds[t].play():t>=L.BGM_LB&&(this._wwaData.bgm=t,this._setSoundLoadedCheckTimer(t))}openGameWindow(){var t=this._player.getPosition();lt("wwa-cover").style.opacity="0",0!==this.getObjectIdByPosition(t)&&this._player.setPartsAppearedFlag();var e=lt("wwa-wrapper").getAttribute("data-wwa-resume-savedata");if("string"==typeof e&&(this._useSuspend=!0,e)){var s=Xe.getStartWWAData(e);this._restartData!==s&&(this._applyQuickLoad(s),this._wwaSave.resumeStart())}setTimeout((()=>{lt("wwa-wrapper").removeChild(lt("wwa-cover")),this._main()}),W.SPLASH_SCREEN_DISP_MILLS)}onselectitem(t){if(this._player.canUseItem(t)){lt("item"+(t-1)).classList.add("onpress"),this.playSound(L.DECISION);const i=this.resolveSystemMessage(a.CONFIRM_USE_ITEM);if("BLANK"===i){this._player.readyToUseItem(t);var e=this._player.useItem(),s=this.getObjectAttributeById(e,W.ATR_STRING);this.generatePageAndReserveExecution(this.getMessageById(s),!1,!1,e,g.OBJECT,this._player.getPosition().getPartsCoord())}else this.generatePageAndReserveExecution(i,!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_ITEM_USE,this._yesNoUseItemPos=t;return!0}return!1}onselectbutton(t,e=!1,s=!1){var a=lt(P[t]);if(this.playSound(L.DECISION),this._itemMenu.close(),a.classList.add("onpress"),t===v.QUICK_LOAD)switch(this._yesNoChoiceCallInfo=this._wwaSave.getFirstSaveChoiceCallInfo(e),this._yesNoChoiceCallInfo){case I.CALL_BY_QUICK_LOAD:case I.CALL_BY_LOG_QUICK_LOAD:var i,r="";switch(this._yesNoChoiceCallInfo){case I.CALL_BY_QUICK_LOAD:r="読み込むデータを選んでください。",this._wwaSave.selectDBSaveDataList();break;case I.CALL_BY_LOG_QUICK_LOAD:r="読み込むオートセーブを選んでください。",this._wwaSave.selectLogSaveDataList()}switch(i=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._messageWindow.createSaveDom(),i){case I.CALL_BY_LOG_QUICK_LOAD:this.generatePageAndReserveExecution(r+"\n→Noでオートセーブ復帰画面に移ります。",!0,!0);break;case I.CALL_BY_PASSWORD_LOAD:this.generatePageAndReserveExecution(r+"\n→Noでデータ復帰用パスワードの\n 入力選択ができます。",!0,!0);break;case I.NONE:this.generatePageAndReserveExecution(r,!0,!0)}break;case I.CALL_BY_PASSWORD_LOAD:this.onpasswordloadcalled()}else if(t===v.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=I.CALL_BY_QUICK_SAVE):(this.generatePageAndReserveExecution("データの一時保存先を選んでください。",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_QUICK_SAVE));else if(t===v.RESTART_GAME)this.generatePageAndReserveExecution("初めからスタートしなおしますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_RESTART_GAME;else if(t===v.GOTO_WWA)if(s)this._bottomButtonType!==l.GOTO_WWA&<(P[v.GOTO_WWA]).classList.remove("onpress"),this.generatePageAndReserveExecution("WWAの公式サイトを開きますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_GOTO_WWA;else switch(this._bottomButtonType){case l.GOTO_WWA:this._yesNoChoiceCallInfo=I.CALL_BY_GOTO_WWA,this.generatePageAndReserveExecution("WWAの公式サイトを開きますか?",!0,!0);break;case l.GAME_END:this._yesNoChoiceCallInfo=I.CALL_BY_END_GAME,this.generatePageAndReserveExecution("WWAゲームを終了しますか?",!0,!0);break;case l.BATTLE_REPORT:this.launchBattleEstimateWindow()}}onpasswordloadcalled(){this._usePassword?(lt(P[v.QUICK_LOAD]).classList.add("onpress"),this.generatePageAndReserveExecution("データ復帰用のパスワードを入力しますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_PASSWORD_LOAD):this.generatePageAndReserveExecution("セーブデータがありません。",!1,!0)}onpasswordsavecalled(){lt(P[v.QUICK_SAVE]).classList.add("onpress"),this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):this._useSuspend?(this.generatePageAndReserveExecution("ゲームを中断しますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_SUSPEND):this._usePassword&&(this.generatePageAndReserveExecution("データ復帰用のパスワードを表示しますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_PASSWORD_SAVE)}onpasssuspendsavecalled(){lt(P[v.QUICK_SAVE]).classList.add("onpress"),this._wwaData.disableSaveFlag?this.generatePageAndReserveExecution("ここではセーブ機能は\n使用できません。",!1,!0):(this.generatePageAndReserveExecution("ゲームを中断しますか?",!0,!0),this._yesNoChoiceCallInfo=I.CALL_BY_SUSPEND)}onitemmenucalled(){this.generatePageAndReserveExecution("右のメニューを選択してください。",!1,!0),this._messageWindow.setItemMenuChoice(!0),this.playSound(L.DECISION),this._itemMenu.openView()}onchangespeed(t){if(!this._wwaData.permitChangeGameSpeed){const t=this.resolveSystemMessage(a.GAME_SPEED_CHANGE_DISABLED);return void("BLANK"!==t&&this.generatePageAndReserveExecution(t,!1,!0))}switch(t){case y.UP:this._player.speedUp();break;case y.DOWN:this._player.speedDown()}const e=this.resolveSystemMessage(a.GAME_SPEED_CHANGED);"BLANK"!==e&&this.generatePageAndReserveExecution(e,!1,!0)}isBattleSpeedIndexForQuickBattle(t){return W.QUICK_BATTLE_SPEED_INDECIES.some((e=>e===t))}_executeNode(t,e){var s;if(t instanceof Ae)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 ge){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())),a=Boolean(t.scoreOptions);a&&0===s.length&&s.push(new Ae("スコアを表示します。"));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,a,t.isSystemMessage,this._player.getPosition(),this._camera.getPosition()),a&&(this._lastScoreOptions=t.scoreOptions,this.updateScore(t.scoreOptions),this._scoreWindow.show()),this._player.setMessageWaiting(),this._isLastPage=t.isLastPage;break}if(0===this._pages.length){this._hideMessageWindow();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(I.CALL_BY_LOG_QUICK_SAVE),this._player.isDelayFrame())this._player.updateDelayFrame();else{const t=this._player.getDir(),e=[NaN,NaN,$.KEY_DOWN,NaN,$.KEY_LEFT,NaN,$.KEY_RIGHT,NaN,$.KEY_UP,NaN][t];this._actionGamePadButtonItemMacro()||(this._keyStore.getKeyStateForControllPlayer($.KEY_LEFT)===J.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer($.KEY_UP)===J.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer($.KEY_RIGHT)===J.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._keyStore.getKeyStateForControllPlayer($.KEY_DOWN)===J.KEYDOWN?this._checkTurnKeyPressed()?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(u.LEFT)===Z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(u.UP)===Z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(u.RIGHT)===Z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._mouseStore.getMouseStateForControllPlayer(u.DOWN)===Z.MOUSEDOWN?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._keyStore.checkHitKey(e)?this._checkTurnKeyPressed()?this._player.setDir(t):(this._player.controll(t),this._objectMovingDataManager.update()):this._keyStore.checkHitKey($.KEY_LEFT)?this._checkTurnKeyPressed()?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._keyStore.checkHitKey($.KEY_UP)?this._checkTurnKeyPressed()?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._keyStore.checkHitKey($.KEY_RIGHT)?this._checkTurnKeyPressed()?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._keyStore.checkHitKey($.KEY_DOWN)?this._checkTurnKeyPressed()?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(u.LEFT)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(u.UP)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(u.RIGHT)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._mouseStore.checkClickMouse(u.DOWN)?this._mouseStore.touchIDIsSetDir()?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_LEFT)?this._gamePadStore.buttonPressed(Q.BUTTON_INDEX_B)?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_UP)?this._gamePadStore.buttonPressed(Q.BUTTON_INDEX_B)?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_RIGHT)?this._gamePadStore.buttonPressed(Q.BUTTON_INDEX_B)?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_DOWN)?this._gamePadStore.buttonPressed(Q.BUTTON_INDEX_B)?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_LEFT")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(u.LEFT):(this._player.controll(u.LEFT),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_UP")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(u.UP):(this._player.controll(u.UP),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_RIGHT")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(u.RIGHT):(this._player.controll(u.RIGHT),this._objectMovingDataManager.update()):this._virtualPadStore.checkTouchingButton("BUTTON_DOWN")?this._virtualPadStore.checkTouchingButton("BUTTON_ESC")?this._player.setDir(u.DOWN):(this._player.controll(u.DOWN),this._objectMovingDataManager.update()):this._keyStore.getKeyState($.KEY_1)===J.KEYDOWN?this.onselectitem(1):this._keyStore.getKeyState($.KEY_2)===J.KEYDOWN?this.onselectitem(2):this._keyStore.getKeyState($.KEY_3)===J.KEYDOWN?this.onselectitem(3):this._keyStore.getKeyState($.KEY_Q)===J.KEYDOWN?this.onselectitem(4):this._keyStore.getKeyState($.KEY_W)===J.KEYDOWN?this.onselectitem(5):this._keyStore.getKeyState($.KEY_E)===J.KEYDOWN?this.onselectitem(6):this._keyStore.getKeyState($.KEY_A)===J.KEYDOWN?this.onselectitem(7):this._keyStore.getKeyState($.KEY_S)===J.KEYDOWN?this.onselectitem(8):this._keyStore.getKeyState($.KEY_D)===J.KEYDOWN?this.onselectitem(9):this._keyStore.getKeyState($.KEY_Z)===J.KEYDOWN?this.onselectitem(10):this._keyStore.getKeyState($.KEY_X)===J.KEYDOWN?this.onselectitem(11):this._keyStore.getKeyState($.KEY_C)===J.KEYDOWN?this.onselectitem(12):this._keyStore.getKeyState($.KEY_I)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_MINUS)||this._virtualPadStore.checkTouchButton("BUTTON_SLOW")?this.onchangespeed(y.DOWN):this._keyStore.getKeyState($.KEY_P)===J.KEYDOWN||this._keyStore.checkHitKey($.KEY_F2)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_PLUS)||this._virtualPadStore.checkTouchButton("BUTTON_FAST")?this.onchangespeed(y.UP):this._keyStore.getKeyState($.KEY_F1)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_M)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this.launchBattleEstimateWindow():this._keyStore.checkHitKey($.KEY_F3)?(this.playSound(L.DECISION),this.onselectbutton(v.QUICK_LOAD,!0)):this._keyStore.checkHitKey($.KEY_F4)?(this.playSound(L.DECISION),this._useSuspend?this.onpasssuspendsavecalled():this._usePassword&&this.onpasswordsavecalled()):this._keyStore.checkHitKey($.KEY_F5)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.BUTTON_INDEX_ZR)?this.onselectbutton(v.QUICK_LOAD):this._keyStore.checkHitKey($.KEY_F6)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.BUTTON_INDEX_ZL)?this.onselectbutton(v.QUICK_SAVE):this._keyStore.checkHitKey($.KEY_F7)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.BUTTON_INDEX_R)?this.onselectbutton(v.RESTART_GAME):this._keyStore.checkHitKey($.KEY_F8)?this.onselectbutton(v.GOTO_WWA,!1,!0):this._keyStore.checkHitKey($.KEY_F9)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_X)||this._virtualPadStore.checkTouchButton("BUTTON_ESC")?(this._player.isControllable()||this._messageWindow.isItemMenuChoice())&&this.onitemmenucalled():this._keyStore.checkHitKey($.KEY_V)?this._displayUserVars():(this._keyStore.checkHitKey($.KEY_F12)||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_Y))&&this._displayHelp())}this._keyStore.memorizeKeyStateOnControllableFrame(),this._mouseStore.memorizeMouseStateOnControllableFrame()}else if(this._player.isJumped())this._camera.isResetting()||this._player.processAfterJump();else if(this._player.isMoving())this._player.move(),this._objectMovingDataManager.update();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($.KEY_LEFT)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_LEFT)||this._virtualPadStore.checkTouchButton("BUTTON_LEFT")?this._messageWindow.saveControll(u.LEFT):this._keyStore.checkHitKey($.KEY_UP)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_UP)||this._virtualPadStore.checkTouchButton("BUTTON_UP")?this._messageWindow.saveControll(u.UP):this._keyStore.checkHitKey($.KEY_RIGHT)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_RIGHT)||this._virtualPadStore.checkTouchButton("BUTTON_RIGHT")?this._messageWindow.saveControll(u.RIGHT):(this._keyStore.checkHitKey($.KEY_DOWN)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_DOWN)||this._virtualPadStore.checkTouchButton("BUTTON_DOWN"))&&this._messageWindow.saveControll(u.DOWN))),this._messageWindow.isInputDisable()||(this._yesNoJudge===m.UNSELECTED&&(this._keyStore.getKeyState($.KEY_ENTER)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_Y)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")?this._yesNoJudge=m.YES:(this._keyStore.getKeyState($.KEY_N)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_ESC)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC"))&&(this._yesNoJudge=m.NO)),(this._yesNoJudge===m.YES||this._yesNoJudge===m.NO)&&(this.playSound(L.DECISION),this._yesNoDispCounter=W.YESNO_PRESS_DISP_FRAME_NUM,this._messageWindow.setInputDisable(),this._messageWindow.update()));else if(this._messageWindow.isItemMenuChoice()){if(this._itemMenu.update(),this._keyStore.checkHitKey($.KEY_LEFT)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_LEFT)||this._virtualPadStore.checkTouchingButton("BUTTON_LEFT")?this._itemMenu.controll(u.LEFT):this._keyStore.checkHitKey($.KEY_UP)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_UP)||this._virtualPadStore.checkTouchingButton("BUTTON_UP")?this._itemMenu.controll(u.UP):this._keyStore.checkHitKey($.KEY_RIGHT)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_RIGHT)||this._virtualPadStore.checkTouchingButton("BUTTON_RIGHT")?this._itemMenu.controll(u.RIGHT):(this._keyStore.checkHitKey($.KEY_DOWN)||this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_DOWN)||this._virtualPadStore.checkTouchingButton("BUTTON_DOWN"))&&this._itemMenu.controll(u.DOWN),this._keyStore.getKeyState($.KEY_ENTER)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_Y)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER"))this._setNextPage(),this._messageWindow.setItemMenuChoice(!1),this._itemMenu.ok();else if(this._mouseStore.checkClickMouse(u.LEFT)||this._mouseStore.checkClickMouse(u.UP)||this._mouseStore.checkClickMouse(u.RIGHT)||this._mouseStore.checkClickMouse(u.DOWN)||this._keyStore.getKeyState($.KEY_N)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_ESC)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ESC")){for(var s=0;s<P.length;s++){(o=lt(P[s])).classList.contains("onpress")&&o.classList.remove("onpress")}this._itemMenu.ng(),this._setNextPage(),this.playSound(L.DECISION),this._messageWindow.setItemMenuChoice(!1)}}else{var a=this._keyStore.getKeyStateForMessageCheck($.KEY_ENTER),i=this._keyStore.getKeyStateForMessageCheck($.KEY_SPACE),r=this._keyStore.getKeyStateForMessageCheck($.KEY_ESC);if(a===J.KEYDOWN||a===J.KEYPRESS_MESSAGECHANGE||i===J.KEYDOWN||i===J.KEYPRESS_MESSAGECHANGE||r===J.KEYDOWN||r===J.KEYPRESS_MESSAGECHANGE||this._mouseStore.getMouseState()===Z.MOUSEDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.BUTTON_INDEX_B)||this._virtualPadStore.checkTouchButton("BUTTON_ENTER")||this._virtualPadStore.checkTouchButton("BUTTON_ESC")){for(s=0;s<P.length;s++){var o;(o=lt(P[s])).classList.contains("onpress")&&o.classList.remove("onpress")}this._setNextPage()}}if(null===(t=this._inlineUserVarViewer)||void 0===t?void 0:t.isVisible){let t=!1;this._keyStore.getKeyState($.KEY_DOWN)===J.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex++,t=!0),this._keyStore.getKeyState($.KEY_UP)===J.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex--,t=!0),this._keyStore.getKeyState($.KEY_RIGHT)===J.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex+=W.INLINE_USER_VAR_VIEWER_DISPLAY_NUM,t=!0),this._keyStore.getKeyState($.KEY_LEFT)===J.KEYDOWN&&(this._inlineUserVarViewer.topUserVarIndex-=W.INLINE_USER_VAR_VIEWER_DISPLAY_NUM,t=!0),this._inlineUserVarViewer.topUserVarIndex<0&&(this._inlineUserVarViewer.topUserVarIndex+=W.USER_VAR_NUM),this._inlineUserVarViewer.topUserVarIndex>W.USER_VAR_NUM&&(this._inlineUserVarViewer.topUserVarIndex-=W.USER_VAR_NUM),t&&(this._setNextPage(),this._inlineUserVarViewer.isVisible=!0,this._displayUserVars()),this._keyStore.getKeyState($.KEY_V)===J.KEYDOWN&&this._setNextPage()}}else this._player.isWatingEstimateWindow()?(this._keyStore.getKeyState($.KEY_ENTER)===J.KEYDOWN||this._keyStore.getKeyState($.KEY_SPACE)===J.KEYDOWN||this._gamePadStore.buttonTrigger(Q.BUTTON_INDEX_A,Q.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._prevFrameEventExected=!1,this._player.getPosition().isJustPosition()&&this._camera.getPosition().isScreenTopPosition()){if(!(this._shouldTreatWillMessageDisplay(this._pages)||this._player.isJumped()||this._player.isWaitingMessage()||this._player.isWatingEstimateWindow()||this._player.isWaitingMoveMacro()||this._player.isFighting())){this._player.isPartsAppearedTime()&&this._player.clearPartsAppearedFlag(),this._replaceRandomObjectsInScreen();var n=this.checkMap();n||this.checkObject(),this._prevFrameEventExected=n}this._player.isWaitingMessage()&&this._messageWindow.isYesNoChoice()&&this._yesNoJudge!==m.UNSELECTED&&!this._player.isWaitingMoveMacro()&&!this._player.isFighting()&&this._execChoiceWindowRunningEvent()}this._passwordLoadExecInNextFrame&&(this._stopUpdateByLoadFlag=!0,this._loadType=O.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*W.ANIMATION_REP_HALF_FRAME)),this._camera.isResetting()&&this._camera.advanceTransitionStepNum(),this._player.isWaitingMessage()||(this._player.decrementLookingAroundTimer(),this._statusPressCounter.energy>0&&0==--this._statusPressCounter.energy&<("disp-energy").classList.remove("onpress"),this._statusPressCounter.strength>0&&0==--this._statusPressCounter.strength&<("disp-strength").classList.remove("onpress"),this._statusPressCounter.defence>0&&0==--this._statusPressCounter.defence&<("disp-defence").classList.remove("onpress"),this._statusPressCounter.gold>0&&0==--this._statusPressCounter.gold&<("disp-gold").classList.remove("onpress")),this._player.isWaitingMoveMacro()&&this._player.decrementMoveObjectAutoExecTimer(),this._stopUpdateByLoadFlag?this._fadeout((()=>{this._loadType===O.QUICK_LOAD?(this._quickLoad(),this.wwaCustomEvent("wwa_quickload")):this._loadType===O.RESTART_GAME?(this._restartGame(),this.wwaCustomEvent("wwa_restert")):this._loadType===O.PASSWORD&&(this._applyQuickLoad(this._passwordSaveExtractData),this._passwordSaveExtractData=void 0,this.wwaCustomEvent("wwa_passwordload")),setTimeout(this.mainCaller,W.DEFAULT_FRAME_INTERVAL,this)})):window.requestAnimationFrame(this.mainCaller),function({dumpElement:t,namedUserVar:e,userVar:s}){e&&Ys(t,e),s&&bs(t,s)}({dumpElement:this._dumpElement,userVar:this._wwaData.userVar})}vibration(t){this._gamePadStore.vibration(t)}_drawAll(){var t,e,s=this._camera.getPosition().getPartsCoord(),a=this._camera.getPosition().getOffsetCoord(),i=W.MAP_WINDOW_HEIGHT,r=this._player.getPosition().getPartsCoord();if(this._paintSkipByDoorOpen)this._paintSkipByDoorOpen=!1;else{if(this._cgManager.clearCanvas(0,0,W.MAP_WINDOW_WIDTH,W.MAP_WINDOW_HEIGHT),this._cgManager.drawBase(0,0,W.MAP_WINDOW_WIDTH,W.MAP_WINDOW_HEIGHT),this._camera.isResetting()){if(null!==this._camera.getPreviousPosition())var o=this._camera.getPreviousPosition().getPartsCoord(),n=this._camera.getPreviousPosition().getOffsetCoord();i=this._camera.getTransitionStepNum()*W.CHIP_SIZE}var _=!1;if(i!==this._cgManager.mapCacheYLimit&&(this._cgManager.mapCacheYLimit=i,_=!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,_=!0),_&&(this._cgManager.clearBackCanvas(),this._cgManager.clearObjectCanvases()),this._camera.isResetting()&&(this._drawMap(o,n,i,!0),this._drawPlayer(o,n,i,!0),this._drawObjects(o,n,i,!0),this._camera.isFinalStep()))var h=255,c=setInterval((()=>{var t=lt("wwa-fader");if((h-=3*W.FADEOUT_SPEED)<=0)return clearInterval(c),t.style.backgroundColor="transparent",t.removeAttribute("style"),void(t.style.display="none");t.style.opacity=h/255+""}),20);this._drawMap(s,a,i,!1,_),this._drawPlayer(s,a,i),this._drawObjects(s,a,i,!1,_),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,W.CHIP_SIZE*(t-s.x)-a.x,W.CHIP_SIZE*(e-s.y)-a.y)),this._drawEffect(),this._drawFaces(),this._drawFrame()}}_drawMap(t,e,s,a=!1,i=!1){if(void 0!==t){var r,o=Math.max(0,t.x-1),n=Math.min(this._wwaData.mapWidth-1,t.x+W.H_PARTS_NUM_IN_WINDOW),_=Math.max(0,t.y-1),h=Math.min(this._wwaData.mapWidth-1,t.y+W.V_PARTS_NUM_IN_WINDOW);if(r=0,a)for(var c=o;c<=n;c++)for(var l=_;l<=h;l++){var u=this._wwaData.map[l][c],d=this._wwaData.mapAttribute[u][W.ATR_X]/W.CHIP_SIZE,E=this._wwaData.mapAttribute[u][W.ATR_Y]/W.CHIP_SIZE,m=W.CHIP_SIZE*(c-t.x)-e.x,w=W.CHIP_SIZE*(l-t.y)-e.y;this._cgManager.copyBackCanvasWithLowerYLimit(d,E,m,w,s)}else{for(c=o;c<=n;c++)for(l=_;l<=h;l++){u=this._wwaData.map[l][c];this._cgManager.mapCache[r]!==u&&(this._cgManager.mapCache[r]=u,i=!0),r++}if(i){this._cgManager.clearBackCanvasWithLowerYLimit(s);for(c=o;c<=n;c++)for(l=_;l<=h;l++){u=this._wwaData.map[l][c],d=this._wwaData.mapAttribute[u][W.ATR_X]/W.CHIP_SIZE,E=this._wwaData.mapAttribute[u][W.ATR_Y]/W.CHIP_SIZE,m=W.CHIP_SIZE*(c-t.x)-e.x,w=W.CHIP_SIZE*(l-t.y)-e.y;this._cgManager.copyBackCanvasWithUpperYLimit(d,E,m,w,s)}}this._cgManager.drawBackCanvas()}}}_drawPlayer(t,e,s,a=!1){if(void 0===t||this._wwaData.delPlayerFlag)return;const i=this._player.getPosition().getPartsCoord(),r=this._player.getPosition().getOffsetCoord(),o=[NaN,NaN,2,NaN,4,NaN,6,NaN,0,NaN][this._player.getDir()],n=(i.x-t.x)*W.CHIP_SIZE+r.x-e.x,_=(i.y-t.y)*W.CHIP_SIZE+r.y-e.y;let h;if(this._useLookingAround&&this._player.isLookingAround()&&!this._player.isWaitingMessage()){const t=[2,3,4,5,0,1,6,7];h=this._wwaData.playerImgPosX+t[Math.floor(this._mainCallCounter%64/8)]}else h=this._player.isMovingImage()?this._wwaData.playerImgPosX+o+1:this._wwaData.playerImgPosX+o;a?this._cgManager.drawCanvasWithLowerYLimit(h,this._wwaData.playerImgPosY,n,_,s):this._cgManager.drawCanvasWithUpperYLimit(h,this._wwaData.playerImgPosY,n,_,s)}_drawObjects(t,e,s,a=!1,i=!1){if(void 0!==t){var r,o,_,h,l,u,d,E,m,w,p,g,A,S,T=Math.max(0,t.x-1),I=Math.min(this._wwaData.mapWidth-1,t.x+W.H_PARTS_NUM_IN_WINDOW),v=Math.max(0,t.y-1),y=Math.min(this._wwaData.mapWidth-1,t.y+W.V_PARTS_NUM_IN_WINDOW),O=0,C=this._animationCounter>W.ANIMATION_REP_HALF_FRAME,f=this._player.isFighting()&&this._player.isTurn()&&this._player.getPosition().getPartsCoord().equals(this._monster.position);if(a)for(w=T;w<=I;w++)for(p=v;p<=y;p++)f&&new n(w,p).equals(this._monster.position)||(g=this._wwaData.mapObject[p][w],r=new n(0,0),this._wwaData.objectAttribute[g][W.ATR_MOVE]!==D.STATIC&&null!==(m=this._objectMovingDataManager.getOffsetByBeforePartsCoord(new n(w,p)))&&(r=m),l=W.CHIP_SIZE*(w-t.x)+r.x-e.x,u=W.CHIP_SIZE*(p-t.y)+r.y-e.y,o=C||0===this._wwaData.objectAttribute[g][W.ATR_X2]&&0===this._wwaData.objectAttribute[g][W.ATR_Y2],_=this._wwaData.objectAttribute[g][o?W.ATR_X:W.ATR_X2]/W.CHIP_SIZE,h=this._wwaData.objectAttribute[g][o?W.ATR_Y:W.ATR_Y2]/W.CHIP_SIZE,d=this._wwaData.objectAttribute[g][W.ATR_TYPE],E=this._wwaData.objectAttribute[g][W.ATR_NUMBER],0===g||this._checkNoDrawObject(new n(w,p),d,E)||this._cgManager.copyObjectCanvasWithLowerYLimit(C?1:0,_,h,l,u,s));else{var N,P,M,R,L,b=[],x=[];for(w=T;w<=I;w++)for(p=v;p<=y;p++)A=g=this._wwaData.mapObject[p][w],d=this._wwaData.objectAttribute[g][W.ATR_TYPE],E=this._wwaData.objectAttribute[g][W.ATR_NUMBER],this._checkNoDrawObject(new n(w,p),d,E)&&(A=0),P=this._wwaData.objectAttribute[g][W.ATR_MOVE]===D.STATIC,0!==A&&(M=!(!f||!new n(w,p).equals(this._monster.position)),P?x.push(new c(g,w,p,P,M)):(b.push(new c(g,w,p,P,M)),A=0),M&&(A=0)),this._cgManager.mapObjectCache[O]!==A&&(this._cgManager.mapObjectCache[O]=A,i=!0),O++;for(i&&(this._cgManager.clearObjectCanvasesWithLowerYLimit(s),Array.prototype.push.apply(b,x)),L=b.length,R=0;R<L;R++)if(w=(N=b[R]).x,p=N.y,g=N.partsIDObj,P=N.isStatic,M=N.isFighting,l=W.CHIP_SIZE*(w-t.x)-e.x,u=W.CHIP_SIZE*(p-t.y)-e.y,P){if(M)continue;for(S=0;S<2;S++)o=!!S||0===this._wwaData.objectAttribute[g][W.ATR_X2]&&0===this._wwaData.objectAttribute[g][W.ATR_Y2],_=this._wwaData.objectAttribute[g][o?W.ATR_X:W.ATR_X2]/W.CHIP_SIZE,h=this._wwaData.objectAttribute[g][o?W.ATR_Y:W.ATR_Y2]/W.CHIP_SIZE,this._cgManager.copyObjectCanvasWithUpperYLimit(S,_,h,l,u,s)}else null!==(m=this._objectMovingDataManager.getOffsetByBeforePartsCoord(new n(w,p)))&&(l+=m.x,u+=m.y),o=C||0===this._wwaData.objectAttribute[g][W.ATR_X2]&&0===this._wwaData.objectAttribute[g][W.ATR_Y2],_=this._wwaData.objectAttribute[g][o?W.ATR_X:W.ATR_X2]/W.CHIP_SIZE,h=this._wwaData.objectAttribute[g][o?W.ATR_Y:W.ATR_Y2]/W.CHIP_SIZE,this._cgManager.drawCanvasWithUpperYLimit(_,h,l,u,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()}_checkNoDrawObject(t,e,s){var a=this._player.getPosition(),i=a.getPartsCoord();return!(!a.isJustPosition()||i.x!==t.x||i.y!==t.y||this._wwaData.objectNoCollapseDefaultFlag)&&(e===W.OBJECT_DOOR&&0===s||(e===W.OBJECT_STATUS||e===W.OBJECT_MESSAGE||e===W.OBJECT_ITEM||e===W.OBJECT_SELL||e===W.OBJECT_BUY||e===W.OBJECT_SELL||e===W.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][W.ATR_TYPE]}getObjectTypeByPosition(t){var e=t.getPartsCoord(),s=this._wwaData.mapObject[e.y][e.x];return this._wwaData.objectAttribute[s][W.ATR_TYPE]}getMapAttributeByPosition(t,e){var s=t.getPartsCoord(),a=this._wwaData.map[s.y][s.x];return this._wwaData.mapAttribute[a][e]}isCurrentPosMapPartsIncludingMessage(t){return 0!==this.getMapAttributeByPosition(t,W.ATR_STRING)}getObjectAttributeByPosition(t,e){var s=t.getPartsCoord(),a=this._wwaData.mapObject[s.y][s.x];return this._wwaData.objectAttribute[a][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][W.ATR_X]}getObjectCropYById(t){return this._wwaData.objectAttribute[t][W.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],a=this._wwaData.mapAttribute[s][W.ATR_TYPE],i=t.x===e.x&&t.y===e.y,r=!1;return(!i||this._player.getLastExecPartsIDOnSamePosition(g.MAP)!==s)&&(a===W.MAP_STREET?r=this._execMapStreetEvent(t,s,a):a===W.MAP_WALL?r=this._execMapWallEvent(t,s,a):a===W.MAP_LOCALGATE?r=this._execMapLocalGateEvent(t,s,a):a===W.MAP_URLGATE&&(r=this._execMapUrlGateEvent(t,s,a)),i&&!this._player.isJumped()&&this._player.setLastExecInfoOnSamePosition(g.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],a=this._wwaData.objectAttribute[s][W.ATR_TYPE],i=t.x===e.x&&t.y===e.y;i&&this._player.getLastExecPartsIDOnSamePosition(g.OBJECT)===s||(a===W.OBJECT_NORMAL?this._execObjectNormalEvent(t,s,a):a===W.OBJECT_MESSAGE?this._execObjectMessageEvent(t,s,a):a===W.OBJECT_MONSTER?this._execObjectMonsterEvent(t,s,a):a===W.OBJECT_ITEM?this._execObjectItemEvent(t,s,a):a===W.OBJECT_DOOR?this._execObjectDoorEvent(t,s,a):a===W.OBJECT_STATUS?this._execObjectStatusEvent(t,s,a):a===W.OBJECT_BUY?this._execObjectBuyEvent(t,s,a):a===W.OBJECT_SELL?this._execObjectSellEvent(t,s,a):a===W.OBJECT_URLGATE?this._execObjectUrlGateEvent(t,s,a):a===W.OBJECT_SCORE?this._execObjectScoreEvent(t,s,a):a===W.OBJECT_SELECT?this._execObjectYesNoChoiceEvent(t,s,a):a===W.OBJECT_LOCALGATE&&this._execObjectLocalGateEvent(t,s,a),i&&!this._player.isJumped()&&this._player.setLastExecInfoOnSamePosition(g.OBJECT,s))}_execMapStreetEvent(t,e,s){var a=this._wwaData.mapAttribute[e][W.ATR_ITEM];if(0!==a&&!this._player.hasItem(a))return!1;this.reserveAppearPartsInNextFrame(t,w.MAP,e);const i=this._wwaData.mapAttribute[e][W.ATR_STRING],r=this._wwaData.message[i],o=this._wwaData.mapAttribute[e][W.ATR_NUMBER];return this._waitFrame+=o*W.WAIT_TIME_FRAME_NUM,this._temporaryInputDisable=!0,this.generatePageAndReserveExecution(r,!1,!1,e,g.MAP,t.clone()),this.playSound(this._wwaData.mapAttribute[e][W.ATR_SOUND]),0!==i&&this._shouldTreatWillMessageDisplay(this._pages)||0!==o}_shouldTreatWillMessageDisplay(t){return t.reduce(((t,e)=>t||!Se(e.firstNode)),!1)}_execMapWallEvent(t,e,s){var a=this.getObjectIdByPosition(t.convertIntoPosition(this)),i=this.getObjectAttributeById(a,W.ATR_TYPE);if(0===a||i===W.OBJECT_NORMAL||i===W.OBJECT_DOOR&&(!this._player.hasItem(this.getObjectAttributeById(a,W.ATR_ITEM))||this.getObjectAttributeById(i,W.ATR_MODE)===W.PASSABLE_OBJECT)){this.reserveAppearPartsInNextFrame(t,w.MAP,e);var r=this._wwaData.mapAttribute[e][W.ATR_STRING],o=this._wwaData.message[r];return this.generatePageAndReserveExecution(o,!1,!1,e,g.MAP,t.clone()),this.playSound(this._wwaData.mapAttribute[e][W.ATR_SOUND]),!1}return!1}_execMapLocalGateEvent(t,e,s){var a=this._player.getPosition().getPartsCoord(),i=this._wwaData.mapAttribute[e][W.ATR_JUMP_X],r=this._wwaData.mapAttribute[e][W.ATR_JUMP_Y];return i>W.RELATIVE_COORD_LOWER&&(i=t.x+i-W.RELATIVE_COORD_BIAS),r>W.RELATIVE_COORD_LOWER&&(r=t.y+r-W.RELATIVE_COORD_BIAS),this.reserveAppearPartsInNextFrame(t,w.MAP,e),0<=i&&0<=r&&i<this._wwaData.mapWidth&&r<this._wwaData.mapWidth&&(i!==a.x||r!==a.y)&&(this.reserveJumpInNextFrame(new _(this,i,r,0,0)),this.playSound(this._wwaData.mapAttribute[e][W.ATR_SOUND]),!0)}_execMapUrlGateEvent(t,e,s){var i=this._wwaData.mapAttribute[e][W.ATR_STRING];if(!this._isURLGateEnable)return!0;const r=this.resolveSystemMessage(a.CONFIRM_ENTER_URL_GATE);if("BLANK"!==r)return this.generatePageAndReserveExecution(r,!0,!0),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_MAP_PARTS,this._yesNoURL=this._wwaData.message[i].split(/\s/g)[0],!0;location.href=wt(this._wwaData.message[i].split(/\s/g)[0])}_execObjectNormalEvent(t,e,s){}_execObjectMessageEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_STRING],i=this._wwaData.message[a],r=this._player.getPosition().getPartsCoord(),o=this._wwaData.objectAttribute[e][W.ATR_SOUND];t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t),this.generatePageAndReserveExecution(i,!1,!1,e,g.OBJECT,t),this._waitFrame+=this._wwaData.objectAttribute[e][W.ATR_NUMBER]*W.WAIT_TIME_FRAME_NUM,this._temporaryInputDisable=!0,this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this.playSound(o)}_execObjectStatusEvent(t,e,s){var a=new o(this._wwaData.objectAttribute[e][W.ATR_ENERGY],this._wwaData.objectAttribute[e][W.ATR_STRENGTH],this._wwaData.objectAttribute[e][W.ATR_DEFENCE],this._wwaData.objectAttribute[e][W.ATR_GOLD]),i=this._wwaData.objectAttribute[e][W.ATR_STRING],r=this._wwaData.message[i],n=this._player.getStatusWithoutEquipments();if(a.strength>W.STATUS_MINUS_BORDER&&n.strength<a.strength-W.STATUS_MINUS_BORDER||a.defence>W.STATUS_MINUS_BORDER&&n.defence<a.defence-W.STATUS_MINUS_BORDER||a.gold>W.STATUS_MINUS_BORDER&&n.gold<a.gold-W.STATUS_MINUS_BORDER)return this.setPartsOnPosition(g.OBJECT,0,t),this._keyStore.allClear(),void this._mouseStore.clear();a.energy=a.energy>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-a.energy:a.energy,a.strength=a.strength>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-a.strength:a.strength,a.defence=a.defence>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-a.defence:a.defence,a.gold=a.gold>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-a.gold:a.gold,this._player.addStatusAll(a),this.setStatusChangedEffect(a),this._player.isDead()&&0!==this._wwaData.objectAttribute[e][W.ATR_ENERGY]&&this.shouldApplyGameOver({isCalledByMacro:!1})?this.gameover():(this.generatePageAndReserveExecution(r,!1,!1,e,g.OBJECT,t.clone()),this.setPartsOnPosition(g.OBJECT,0,t),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND]))}_execObjectMonsterEvent(t,e,s){var a=new n(this._wwaData.objectAttribute[e][W.ATR_X],this._wwaData.objectAttribute[e][W.ATR_Y]),i=new o(this._wwaData.objectAttribute[e][W.ATR_ENERGY],this._wwaData.objectAttribute[e][W.ATR_STRENGTH],this._wwaData.objectAttribute[e][W.ATR_DEFENCE],this._wwaData.objectAttribute[e][W.ATR_GOLD]),r=this._wwaData.message[this._wwaData.objectAttribute[e][W.ATR_STRING]],_=this._wwaData.objectAttribute[e][W.ATR_ITEM];this._monster=new Dt(e,t,a,i,r,_,(()=>{this._monsterWindow.hide()})),this._player.startBattleWith(this._monster)}_execObjectBuyEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_STRING],i=this._wwaData.message[a],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t),this.generatePageAndReserveExecution(i,!0,!1,e,g.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND])}_execObjectSellEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_STRING],i=this._wwaData.message[a],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t),this.generatePageAndReserveExecution(i,!0,!1,e,g.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND])}_execObjectItemEvent(t,e,s){var i=this._wwaData.objectAttribute[e][W.ATR_STRING],r=this._wwaData.message[i];try{var o=this._camera.getPosition().getScreenTopPosition().getPartsCoord(),_=(t.x-o.x)*W.CHIP_SIZE,h=(t.y-o.y)*W.CHIP_SIZE;this._player.addItem(e,this._wwaData.objectAttribute[e][W.ATR_NUMBER],!1,this._wwaData.isItemEffectEnabled?{screenPixelCoord:new n(_,h),itemBoxBackgroundImageCoord:new n(this._wwaData.imgItemboxX*W.CHIP_SIZE,this._wwaData.imgItemboxY*W.CHIP_SIZE)}:void 0),this.setPartsOnPosition(g.OBJECT,0,t),0!==this._wwaData.objectAttribute[e][W.ATR_MODE]||(this.generatePageAndReserveExecution(r,!1,!1,e,g.OBJECT,t.clone()),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e))}catch(t){const e=this.resolveSystemMessage(a.ITEM_BOX_FULL);"BLANK"!==e&&this.generatePageAndReserveExecution(e,!1,!0)}this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND])}_execObjectDoorEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_ITEM],i=this._wwaData.objectAttribute[e][W.ATR_STRING],r=this._wwaData.message[i];this._player.hasItem(a)&&(0===this._wwaData.objectAttribute[e][W.ATR_MODE]&&this._player.removeItemByPartsID(a),this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND]),this.generatePageAndReserveExecution(r,!1,!1,e,g.OBJECT,t.clone()),this.setPartsOnPosition(g.OBJECT,0,t),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),this._paintSkipByDoorOpen=!0)}_execObjectYesNoChoiceEvent(t,e,s){var a=this._wwaData.objectAttribute[e][W.ATR_STRING],i=this._wwaData.message[a],r=this._player.getPosition().getPartsCoord();t.x!==r.x||t.y!==r.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t),this.generatePageAndReserveExecution(i,!0,!1,e,g.OBJECT,t.clone()),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_OBJECT_PARTS,this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND])}_execObjectLocalGateEvent(t,e,s){var a=this._player.getPosition().getPartsCoord();t.x!==a.x||t.y!==a.y||this._wwaData.objectNoCollapseDefaultFlag||this.setPartsOnPosition(g.OBJECT,0,t);var i=this._wwaData.objectAttribute[e][W.ATR_JUMP_X],r=this._wwaData.objectAttribute[e][W.ATR_JUMP_Y];i>W.RELATIVE_COORD_LOWER&&(i=a.x+i-W.RELATIVE_COORD_BIAS),r>W.RELATIVE_COORD_LOWER&&(r=a.y+r-W.RELATIVE_COORD_BIAS),this.reserveAppearPartsInNextFrame(t,w.OBJECT,e),0<=i&&0<=r&&i<this._wwaData.mapWidth&&r<this._wwaData.mapWidth&&(i!==a.x||r!==a.y)&&(this.reserveJumpInNextFrame(new _(this,i,r,0,0)),this.playSound(this._wwaData.objectAttribute[e][W.ATR_SOUND]))}_execObjectUrlGateEvent(t,e,s){var i=this._wwaData.objectAttribute[e][W.ATR_STRING];if(!this._isURLGateEnable)return;const r=this.resolveSystemMessage(a.CONFIRM_ENTER_URL_GATE);"BLANK"!==r?(this.generatePageAndReserveExecution(r,!0,!0),this._yesNoChoicePartsCoord=t,this._yesNoChoicePartsID=e,this._yesNoChoiceCallInfo=I.CALL_BY_OBJECT_PARTS,this._yesNoURL=this._wwaData.message[i].split(/\s/g)[0]):location.href=wt(this._wwaData.message[i].split(/\s/g)[0])}_execObjectScoreEvent(t,e,s){const a=this._wwaData.objectAttribute[e][W.ATR_STRING];this.generatePageAndReserveExecution(this._wwaData.message[a],!1,!1,e,g.OBJECT,t,{rates:{energy:this._wwaData.objectAttribute[e][W.ATR_ENERGY],strength:this._wwaData.objectAttribute[e][W.ATR_STRENGTH],defence:this._wwaData.objectAttribute[e][W.ATR_DEFENCE],gold:this._wwaData.objectAttribute[e][W.ATR_GOLD]}}),this.playSound(this._wwaData.objectAttribute[e][W.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][W.ATR_GOLD])){const t=this.resolveSystemMessage(a.NO_MONEY);return"BLANK"!==t&&this._pages.push(new we(new Ae(t),!0,!1,!0)),{}}if(0!==this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ITEM]){const t=this._yesNoChoicePartsCoord,e=this._camera.getPosition().getScreenTopPosition().getPartsCoord(),s=(t.x-e.x)*W.CHIP_SIZE,i=(t.y-e.y)*W.CHIP_SIZE,r=this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ITEM],o=this._wwaData.objectAttribute[r][W.ATR_NUMBER];try{this._player.addItem(r,o,!1,this._wwaData.isItemEffectEnabled?{screenPixelCoord:new n(s,i),itemBoxBackgroundImageCoord:new n(this._wwaData.imgItemboxX*W.CHIP_SIZE,this._wwaData.imgItemboxY*W.CHIP_SIZE)}:void 0)}catch(t){const e=this.resolveSystemMessage(a.ITEM_BOX_FULL);return"BLANK"!==e&&this._pages.push(new we(new Ae(e),!0,!1,!0)),{}}}const t=new o(this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ENERGY],this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_STRENGTH],this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_DEFENCE],-this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_GOLD]);return t.energy=t.energy>W.STATUS_MINUS_BORDER?W.STATUS_MINUS_BORDER-t.energy:t.energy,this.setStatusChangedEffect(t),this._player.addStatusAll(t),this._player.isDead()&&0!==this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.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===m.YES){if(this._yesNoChoiceCallInfo===I.CALL_BY_MAP_PARTS)(t=this._wwaData.mapAttribute[this._yesNoChoicePartsID][W.ATR_TYPE])===W.MAP_URLGATE&&(location.href=wt(this._yesNoURL));else if(this._yesNoChoiceCallInfo===I.CALL_BY_OBJECT_PARTS)if((t=this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_TYPE])===W.OBJECT_BUY)if(this._player.hasItem(this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ITEM]))this._player.removeItemByPartsID(this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_ITEM]),e=this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_GOLD],this._player.earnGold(e),this.setStatusChangedEffect(new o(0,0,0,e)),this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.OBJECT,this._yesNoChoicePartsID);else{const t=this.resolveSystemMessage(a.NO_ITEM);"BLANK"!==t&&this._pages.push(new we(new Ae(t),!0,!1,!0))}else if(t===W.OBJECT_SELL){const{isGameOver:t}=this._execChoiceWindowObjectSellEvent();if(t)return}else t===W.OBJECT_SELECT?this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.CHOICE_YES,this._yesNoChoicePartsID):t===W.OBJECT_URLGATE&&(location.href=wt(this._yesNoURL));else this._yesNoChoiceCallInfo===I.CALL_BY_ITEM_USE?this._player.readyToUseItem(this._yesNoUseItemPos):this._yesNoChoiceCallInfo===I.CALL_BY_QUICK_LOAD||this._yesNoChoiceCallInfo===I.CALL_BY_LOG_QUICK_LOAD?(this._messageWindow.deleteSaveDom(),lt(P[v.QUICK_LOAD]).classList.remove("onpress"),this._messageWindow.load()&&(this._stopUpdateByLoadFlag=!0,this._loadType=O.QUICK_LOAD)):this._yesNoChoiceCallInfo===I.CALL_BY_QUICK_SAVE?(this._messageWindow.deleteSaveDom(),lt(P[v.QUICK_SAVE]).classList.remove("onpress"),this._quickSave(I.CALL_BY_QUICK_SAVE)):this._yesNoChoiceCallInfo===I.CALL_BY_RESTART_GAME?(lt(P[v.RESTART_GAME]).classList.remove("onpress"),this._stopUpdateByLoadFlag=!0,this._loadType=O.RESTART_GAME):this._yesNoChoiceCallInfo===I.CALL_BY_END_GAME?(window.history.back(-1),lt(P[v.GOTO_WWA]).classList.remove("onpress")):this._yesNoChoiceCallInfo===I.CALL_BY_GOTO_WWA?(location.href=wt(W.WWA_HOME),lt(P[v.GOTO_WWA]).classList.remove("onpress")):this._yesNoChoiceCallInfo===I.CALL_BY_PASSWORD_LOAD?(lt(P[v.QUICK_LOAD]).classList.remove("onpress"),this._player.setPasswordWindowWating(),this._passwordWindow.show(Ce.LOAD)):this._yesNoChoiceCallInfo===I.CALL_BY_PASSWORD_SAVE?(lt(P[v.QUICK_SAVE]).classList.remove("onpress"),this._player.setPasswordWindowWating(),this._passwordWindow.password=this._quickSave(I.CALL_BY_PASSWORD_SAVE),this._passwordWindow.show(Ce.SAVE)):this._yesNoChoiceCallInfo===I.CALL_BY_SUSPEND&&(lt(P[v.QUICK_SAVE]).classList.remove("onpress"),this._quickSave(I.CALL_BY_SUSPEND));this._yesNoJudge=m.UNSELECTED,this._setNextPage(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=I.NONE,this._messageWindow.setYesNoChoice(!1)}else if(this._yesNoJudge===m.NO){if(this._yesNoChoiceCallInfo===I.CALL_BY_MAP_PARTS)t=this._wwaData.mapAttribute[this._yesNoChoicePartsID][W.ATR_TYPE],W.MAP_URLGATE;else if(this._yesNoChoiceCallInfo===I.CALL_BY_OBJECT_PARTS)(t=this._wwaData.objectAttribute[this._yesNoChoicePartsID][W.ATR_TYPE])===W.OBJECT_BUY||t===W.OBJECT_SELL||(t===W.OBJECT_SELECT?this.reserveAppearPartsInNextFrame(this._yesNoChoicePartsCoord,w.CHOICE_NO,this._yesNoChoicePartsID):W.OBJECT_URLGATE);else if(this._yesNoChoiceCallInfo===I.CALL_BY_ITEM_USE){lt("item"+(this._yesNoUseItemPos-1)).classList.remove("onpress")}else if(this._yesNoChoiceCallInfo===I.CALL_BY_QUICK_LOAD||this._yesNoChoiceCallInfo===I.CALL_BY_LOG_QUICK_LOAD)switch(this._messageWindow.deleteSaveDom(),this._yesNoChoiceCallInfo=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword),this._yesNoChoiceCallInfo){case I.NONE:lt(P[v.QUICK_LOAD]).classList.remove("onpress");break;case I.CALL_BY_PASSWORD_LOAD:return this._yesNoJudge=m.UNSELECTED,void this.onpasswordloadcalled();case I.CALL_BY_LOG_QUICK_LOAD:this._wwaSave.selectLogSaveDataList(),this._messageWindow.createSaveDom();var s=this._wwaSave.getSecondSaveChoiceCallInfo(this._usePassword);switch(this._yesNoJudge=m.UNSELECTED,s){case I.CALL_BY_PASSWORD_LOAD:this.generatePageAndReserveExecution("読み込むオートセーブを選んでください。\n→Noでデータ復帰用パスワードの\n 入力選択ができます。",!0,!0);break;case I.NONE:this.generatePageAndReserveExecution("読み込むオートセーブを選んでください。",!0,!0)}return}else if(this._yesNoChoiceCallInfo===I.CALL_BY_QUICK_SAVE){if(this._messageWindow.deleteSaveDom(),this._usePassword||this._useSuspend)return this._yesNoJudge=m.UNSELECTED,void(this._useSuspend?this.onpasssuspendsavecalled():this._usePassword&&this.onpasswordsavecalled());lt(P[v.QUICK_SAVE]).classList.remove("onpress")}else if(this._yesNoChoiceCallInfo===I.CALL_BY_RESTART_GAME)lt(P[v.RESTART_GAME]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_END_GAME)lt(P[v.GOTO_WWA]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_GOTO_WWA)lt(P[v.GOTO_WWA]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_PASSWORD_LOAD)lt(P[v.QUICK_LOAD]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_PASSWORD_SAVE)lt(P[v.QUICK_SAVE]).classList.remove("onpress");else if(this._yesNoChoiceCallInfo===I.CALL_BY_SUSPEND){if(this._usePassword)return this._yesNoJudge=m.UNSELECTED,void this.onpasswordsavecalled();lt(P[v.QUICK_SAVE]).classList.remove("onpress")}this._yesNoJudge=m.UNSELECTED,this._setNextPage(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=I.NONE,this._messageWindow.setYesNoChoice(!1)}}generatePageAndReserveExecution(t,e,s,a=0,i=g.OBJECT,r=new n(0,0),o=void 0){const _=this.generatePagesByRawMessage(t,a,i,r,s,e,o);this._pages=this._pages.concat(_),this._shouldSetNextPage=!0}generatePagesByRawMessage(t,e,s,a,i,r,o){const n=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(/\/\//)?gt(gt(t).replace(/^.*\/\/(?!:s?ptth)/gi,"")):t})).filter((t=>void 0!==t)).join("\n").replace(/\\\/\\\//gi,"//");if(""===n)return o?[new we(void 0,!0,!1,!1,o,{partsId:e,partsType:s,partsPosition:a})]:[];const _=n.split(/\<p\>/gi);return _.map(((t,n)=>{let h,c,l;const u={id:e,type:s,position:a},d=this.parseMessageLines(t,e,s,a),E=[];return d.forEach(((t,e)=>{try{const s=0===e?void 0:d[e-1].type,a=E[E.length-1],i=this.createNewNode(t,!h||!Te(s),{triggerParts:u}),r=this.processConditionalExecuteMacroLine(i,t,a,E);r&&(l=r),s?this.connectOrMergeToPreviousNode(t,s,c,i,a,l,{triggerParts:u}):h=i,i&&(c=i)}catch(t){console.error(`$if-$else_if-$else-$endif マクロの解析中にエラーが発生しました。ページ ${e}`),console.error(t)}})),new we(h,n===_.length-1,0===n&&r,i,0===n&&o,{partsId:e,partsType:s,partsPosition:a})}))}parseMessageLines(t,e,s,a){return t.split("\n").map((t=>{const i=t.match(/(\$(?:[a-zA-Z_][a-zA-Z0-9_]*)(?:.*))/);if(!i||i.length<2)return t.startsWith("$")?void 0:{type:"text",text:t};const r=function(t,e,s,a,i){var r;let o=i.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)\=(.*)$/);if((null===o||3!==o.length)&&(o=i.match(/^\$([a-zA-Z_][a-zA-Z0-9_]*)/),null===o||2!==o.length))throw new Error("マクロではありません");const n=`$${o[1].toLowerCase()}`,_="$if"===n&&i.match(/,/)?N.LEGACY_IF:b[n],h=Boolean(_!==N.SHOW_STR&&_!==N.SHOW_STR2),c=(null!==(r=o[2])&&void 0!==r?r:"").split(",").map((t=>h?t.trim():t));return new Ie(t,e,s,a,void 0===_?N.UNDEFINED:_,c)}(this,e,s,a,i[1]);switch(r.macroType){case N.IF:case N.ELSE_IF:case N.ELSE:case N.END_IF:case N.SHOW_STR:case N.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 N.IF:return new ge([{descriminant:me(t.macro.macroArgs[0])}]);case N.SHOW_STR:case N.SHOW_STR2:return e?new Ae(this._generateShowStrString(t.macro.macroArgs,{triggerParts:s.triggerParts,version:t.type===N.SHOW_STR2?2:1})):void 0;case"text":return e?new Ae(t.text):void 0;case"normalMacro":return e?new Ae("",[t.macro]):void 0;default:return}}processConditionalExecuteMacroLine(t,e,s,a){const i=0===a.length;switch(e.type){case N.IF:return void a.push(t);case N.ELSE_IF:if(i)throw new Error("構文エラー: $if を呼ぶ前に $else_if は呼べません");return void s.appendBranch({descriminant:me(e.macro.macroArgs[0])});case N.ELSE:if(i)throw new Error("構文エラー: $if を呼ぶ前に $else は呼べません");return void s.appendBranch({descriminant:!0,elseBranch:{type:"real"}});case N.END_IF:if(i)throw new Error("構文エラー: $if を呼ぶ前に $endif は呼べません");return a.pop()}}connectOrMergeToPreviousNode(t,e,s,a,i,r,o){const n=Te(e);switch(e){case N.IF:case N.ELSE_IF:case N.ELSE:if(!a||!i)return;const e=i.getLastUnconnectedBranch();if(!e)throw new Error("lastUnconnectedBranchが見つかりませんでした。");return void(e.next=a);case N.END_IF:if(!(a&&r instanceof ge))return;for(let t=0;t<r.branches.length;t++){let e=r.branches[t].next;e?this.connectToFinalNode(e,a):r.branches[t]=a}return void(r.hasElseBranch()||r.branches.push({next:a,descriminant:!0,elseBranch:{type:"pesudo-else"}}));default:if(!(n&&s instanceof Ae))return;const _=!s.isEmpty();t.type===N.SHOW_STR||t.type===N.SHOW_STR2?s.appendMessage(this._generateShowStrString(t.macro.macroArgs,{triggerParts:o.triggerParts,version:t.type===N.SHOW_STR2?2:1}),_):"text"===t.type?s.appendMessage(t.text,_):"normalMacro"===t.type?s.macro.push(t.macro):s.next=a}}connectToFinalNode(t,e){let s=t;for(;;)if(s instanceof ge&&(s=s.branches[0].next),s instanceof Ae){if(!s.next)return void(s.next=e);s=s.next}}appearParts({pos:t,triggerType:e,triggerPartsId:s}){var a,i,r,o,h,c,l=e===w.CHOICE_NO?W.APPERANCE_PARTS_MIN_INDEX_NO:W.APPERANCE_PARTS_MIN_INDEX,u=e===w.CHOICE_YES?W.APPERANCE_PARTS_MAX_INDEX_YES:W.APPERANCE_PARTS_MAX_INDEX;for(e===w.MAP?(s=0===s?this._wwaData.map[t.y][t.x]:s,a=g.MAP):(s=0===s?this._wwaData.mapObject[t.y][t.x]:s,a=g.OBJECT),c=l;c<=u;c++){var d=W.ATR_APPERANCE_BASE+c*W.REL_ATR_APPERANCE_UNIT_LENGTH,E=d+W.REL_ATR_APPERANCE_ID,m=d+W.REL_ATR_APPERANCE_X,p=d+W.REL_ATR_APPERANCE_Y,A=d+W.REL_ATR_APPERANCE_TYPE;if(i=a===g.MAP?this._wwaData.mapAttribute[s][E]:this._wwaData.objectAttribute[s][E],r=a===g.MAP?this._wwaData.mapAttribute[s][A]:this._wwaData.objectAttribute[s][A],o=a===g.MAP?this._wwaData.mapAttribute[s][m]:this._wwaData.objectAttribute[s][m],h=a===g.MAP?this._wwaData.mapAttribute[s][p]:this._wwaData.objectAttribute[s][p],o===W.PLAYER_COORD?(o=this._player.getPosition().getPartsCoord().x,this._player.resetEventExecutionInfo()):o>W.RELATIVE_COORD_LOWER&&(o=t.x+o-W.RELATIVE_COORD_BIAS),h===W.PLAYER_COORD?(h=this._player.getPosition().getPartsCoord().y,this._player.resetEventExecutionInfo()):h>W.RELATIVE_COORD_LOWER&&(h=t.y+h-W.RELATIVE_COORD_BIAS),0!==o||0!==h)try{if(new _(this,o,h,0,0),r===g.MAP){if(i>=this._wwaData.mapPartsMax)throw new Error("背景パーツの範囲外IDが指定されました");var S=new n(o,h);this.setPartsOnPosition(g.MAP,i,S)}else{if(i>=this._wwaData.objPartsMax)throw new Error("物体パーツの範囲外IDが指定されました");S=new n(o,h);this.setPartsOnPosition(g.OBJECT,i,S),this._replaceRandomObject(new n(o,h)),o===this._player.getPosition().getPartsCoord().x&&h===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 a=this._player.getPosition().getPartsCoord(),i=this._player.getDir(),r=d[i],o=E[i];this.appearPartsEval(a,(r>=0?"+":"-")+Math.abs(r)*t,(o>=0?"+":"-")+Math.abs(o)*t,e,s)}appearPartsEval(t,e,s,a,i){var r,o,h=this._player.getPosition().getPartsCoord();if("P"===e||"p"===e)r=h.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)o=h.y;else if("+"===s[0])o=t.y+parseInt(s.substr(1));else if("-"===s[0])o=t.y-parseInt(s.substr(1));else if(o=parseInt(s),isNaN(o))throw new Error("座標として解釈できない文字が含まれています。");try{new _(this,r,o,0,0);if(i===g.MAP){if(a>=this._wwaData.mapPartsMax)throw new Error("背景パーツの範囲外IDが指定されました");var c=new n(r,o);this.setPartsOnPosition(g.MAP,a,c)}else{if(a>=this._wwaData.objPartsMax)throw new Error("物体パーツの範囲外IDが指定されました");c=new n(r,o);this.setPartsOnPosition(g.OBJECT,a,c),this._replaceRandomObject(new n(r,o)),r===this._player.getPosition().getPartsCoord().x&&o===this._player.getPosition().getPartsCoord().y&&this._player.setPartsAppearedFlag()}}catch(t){}}_replaceRandomObject(t){var e,s,a=this._wwaData.mapObject[t.y][t.x];if(this._wwaData.objectAttribute[a][W.ATR_TYPE]===W.OBJECT_RANDOM){for(var i=0;i<W.RANDOM_ITERATION_MAX;i++){if(s=Math.floor(10*Math.random()),(e=this._wwaData.objectAttribute[a][W.ATR_RANDOM_BASE+s])>=this._wwaData.objPartsMax){e=0;break}if(this._wwaData.objectAttribute[e][W.ATR_TYPE]!==W.OBJECT_RANDOM)break;a=e}this.setPartsOnPosition(g.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+W.H_PARTS_NUM_IN_WINDOW),a=Math.max(0,t.y-1),i=Math.min(this._wwaData.mapWidth-1,t.y+W.V_PARTS_NUM_IN_WINDOW),r=e;r<=s;r++)for(var o=a;o<=i;o++)this._replaceRandomObject(new n(r,o))}_replaceAllRandomObjects(){for(var t=0;t<this._wwaData.mapWidth;t++)for(var e=0;e<this._wwaData.mapWidth;e++)this._replaceRandomObject(new n(t,e))}gameover(){var t=this._wwaData.gameoverX,e=this._wwaData.gameoverY;this._yesNoJudge=m.UNSELECTED,this._pages=[],this._player.setDelayFrame(),this._messageWindow.hide(),this._yesNoChoicePartsCoord=void 0,this._yesNoChoicePartsID=void 0,this._yesNoUseItemPos=void 0,this._yesNoChoiceCallInfo=I.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._player.jumpTo(new _(this,t,e,0,0))}setYesNoInput(t){this._yesNoJudgeInNextFrame=t}getYesNoState(){return void 0!==this._yesNoJudgeInNextFrame?this._yesNoJudgeInNextFrame:this._yesNoJudge}setStatusChangedEffect(t){this._wwaData.isItemEffectEnabled&&(0!==t.strength&&(lt("disp-strength").classList.add("onpress"),this._statusPressCounter.strength=W.STATUS_CHANGED_EFFECT_FRAME_NUM),0!==t.defence&&(lt("disp-defence").classList.add("onpress"),this._statusPressCounter.defence=W.STATUS_CHANGED_EFFECT_FRAME_NUM),t instanceof o&&(0!==t.energy&&(lt("disp-energy").classList.add("onpress"),this._statusPressCounter.energy=W.STATUS_CHANGED_EFFECT_FRAME_NUM),0!==t.gold&&(lt("disp-gold").classList.add("onpress"),this._statusPressCounter.gold=W.STATUS_CHANGED_EFFECT_FRAME_NUM)))}setPartsOnPosition(t,e,s){var a,i,r=s.y<<j.BITSHIFT|s.x;t===g.MAP?(a=this._wwaData.map[s.y][s.x],e=this.loadMapPartsID(e),a=this.loadMapPartsID(a),this._wwaData.map[s.y][s.x]=e,-1!==(i=this._mapIDTable[a].indexOf(r))&&this._mapIDTable[a].splice(i,1),-1===(i=this._mapIDTable[e].indexOf(r))&&this._mapIDTable[e].push(r)):(a=this._wwaData.mapObject[s.y][s.x],e=this.loadMapPartsObjectID(e),a=this.loadMapPartsObjectID(a),this._wwaData.mapObject[s.y][s.x]=e,-1!==(i=this._mapObjectIDTable[a].indexOf(r))&&this._mapObjectIDTable[a].splice(i,1),-1===(i=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 a=0;a<t[s].length;){var i=this._countSamePartsLength(t[s],a);e[s].push([t[s][a],i]),a+=i}}return e}_decompressMap(t){for(var e=[],s=0;s<t.length;s++){e[s]=[];for(var a=0;a<t[s].length;a++)for(var i=t[s][a][1],r=0;r<i;r++)e[s].push(t[s][a][0])}return e}_generateMapDataHash(t){var e="A",s=0,a=0,i=0;for(i=0;i<t.map.length;i++){for(a=0;a<t.map[i].length;)s=this._countSamePartsLength(t.map[i],a),e+=t.map[i][a]+"|"+s+"/",a+=s;for(a=0;a<t.mapObject[i].length;)s=this._countSamePartsLength(t.mapObject[i],a),e+=t.mapObject[i][a]+"|"+s+"/",a+=s}for(var r=0;r<t.mapAttribute.length;r++)for(var o=0;o<t.mapAttribute[r].length;o++)e+=t.mapAttribute[r][o]+"/";for(var n=0;n<t.objectAttribute.length;n++)for(var _=0;_<t.objectAttribute[n].length;_++)e+=t.objectAttribute[n][_]+"/";return Ye(e+="Z")}_generateSaveDataHash(t){var e=this._generateMapDataHash(t),s=[];for(var a in t)"map"!==a&&"mapObject"!==a&&"mapCompressed"!==a&&"mapObjectCompressed"!==a&&"mapAttribute"!==a&&"objectAttribute"!==a&&"checkString"!==a&&s.push(a);s.sort();for(var i=0;i<s.length;i++)e+=pt(t[s[i]]);return Ye(e)}compressSystem(){return Xe}_quickSave(t){var e,s,a,i,r=JSON.parse(JSON.stringify(this._wwaData)),o=this._player.getPosition().getPartsCoord(),n=this._player.getStatusWithoutEquipments();switch(r.itemBox=this._player.getCopyOfItemBox(),r.playerX=o.x,r.playerY=o.y,r.statusEnergyMax=this._player.getEnergyMax(),r.statusEnergy=n.energy,r.statusStrength=n.strength,r.statusDefence=n.defence,r.statusGold=n.gold,r.moves=this._player.getMoveCount(),r.frameCount=this._player.getFrameCount(),r.gameSpeedIndex=this._player.getSpeedIndex(),r.playTime=null!==(s=null===(e=this._playTimeCalculator)||void 0===e?void 0:e.calculateTimeMs())&&void 0!==s?s:0,t){case I.CALL_BY_LOG_QUICK_SAVE:case I.CALL_BY_QUICK_SAVE:case I.CALL_BY_SUSPEND:break;case I.CALL_BY_PASSWORD_SAVE:r.checkOriginalMapString=this.checkOriginalMapString,r.checkString=this._generateSaveDataHash(r)}switch(r.message=void 0,r.mapAttribute=void 0,r.objectAttribute=void 0,t){case I.CALL_BY_QUICK_SAVE:return this._messageWindow.save(this._cvs,r),this.wwaCustomEvent("wwa_quicksave",{data:r}),"";case I.CALL_BY_PASSWORD_SAVE:const t=Xe.compress(r);t.isCompress=1;const e=JSON.stringify(t);return this.wwaCustomEvent("wwa_passwordsave",{data:r,compress:t}),a=e,i=this._wwaData.worldPassNumber,console.warn(Ue.enc.Utf8.parse(a)),Ue.AES.encrypt(Ue.enc.Utf8.parse(a),We(i)).toString();case I.CALL_BY_SUSPEND:this.wwaCustomEvent("wwa_suspend",{data:r,compress:Xe.compress(r)});break;case I.CALL_BY_LOG_QUICK_SAVE:this.wwaCustomEvent("wwa_autosave",{data:r}),this._wwaSave.autoSave(this._cvs,r)}}wwaCustomEvent(t,e={}){this.wwaCustomEventEmitter.dispatch(t,e)}_decodePassword(t){let e,s="";try{a=t,i=this._wwaData.worldPassNumber,s=Ue.AES.decrypt(a,We(i)).toString(Ue.enc.Utf8)}catch(t){e=t}var a,i,r;if(!s){console.warn("新方式でのパスワード暗号化解除失敗:",e);try{s=function(t,e,s){return Ue.AES.decrypt(t,function(t,e){return`^ /${231*t+8310+e}P+>A[]`}(e,s)).toString(Ue.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]=Xe.decompress(r);return[qe(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 a,i=!1;if(null!==e){const t=this._decodePassword(e);a=t[0],i=t[1].isWorldNameEmpty}else a=JSON.parse(JSON.stringify(t?this._restartData:this._messageWindow.load()));if(a.message=JSON.parse(JSON.stringify(this._restartData.message)),a.mapAttribute=JSON.parse(JSON.stringify(this._restartData.mapAttribute)),a.objectAttribute=JSON.parse(JSON.stringify(this._restartData.objectAttribute)),void 0===a.map&&(a.map=this._decompressMap(a.mapCompressed)),void 0===a.mapObject&&(a.mapObject=this._decompressMap(a.mapObjectCompressed)),delete a.mapCompressed,delete a.mapObjectCompressed,null!==e){if(!i&&a.worldName!==this._wwaData.worldName)throw console.error("Invalid title",`(password)=${a.worldName} (current map)=${this._wwaData.worldName}`),new Error("前回パスワード取得時から、制作者によってワールド名が変更されたためロードできませんでした。\n予めご了承ください。");const t=this.checkOriginalMapString;if(this._isDisallowLoadOldSave&&a.checkOriginalMapString!==t)throw console.error("Invalid hash",`(password)=${a.checkOriginalMapString} (current map)=${t}`),new Error("前回パスワード取得時から、制作者によってマップが変更されたためロードできませんでした。\n(マップデータ制作者の設定により、内容が変更されると以前のパスワードは利用できなくなります。)\n予めご了承ください。");console.log("Valid Password!")}return s&&this._applyQuickLoad(a),a}_applyQuickLoad(t){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(L.NO_SOUND):this.playSound(t.bgm,t.bgmDelayDurationMs),this.setImgClick(new n(t.imgClickX,t.imgClickY)),0!==this.getObjectIdByPosition(this._player.getPosition())&&this._player.setPartsAppearedFlag(),this._playTimeCalculator=new rt(t.playTime),this._wwaData=t,this._mapIDTableCreate(),this._replaceAllRandomObjects(),this.setStatusIconCoord(R.ENERGY,new n(t.imgStatusEnergyX,t.imgStatusEnergyY)),this.setStatusIconCoord(R.STRENGTH,new n(t.imgStatusStrengthX,t.imgStatusStrengthY)),this.setStatusIconCoord(R.DEFENCE,new n(t.imgStatusDefenceX,t.imgStatusDefenceY)),this.setStatusIconCoord(R.GOLD,new n(t.imgStatusGoldX,t.imgStatusGoldY)),this.setWideCellCoord(new n(t.imgWideCellX,t.imgWideCellY)),this.setItemboxBackgroundPosition({x:t.imgItemboxX,y:t.imgItemboxY}),this.setFrameCoord(new n(t.imgFrameX,t.imgFrameY)),this.setPlayerSpeedIndex(t.gameSpeedIndex),this.updateCSSRule(),this.updateEffect(),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 a=s<<j.BITSHIFT|e;t=this._wwaData.map[s][e],this._mapIDTable[t]instanceof Array||(this._mapIDTable[t]=[]),this._mapIDTable[t].push(a),t=this._wwaData.mapObject[s][e],this._mapObjectIDTable[t]instanceof Array||(this._mapObjectIDTable[t]=[]),this._mapObjectIDTable[t].push(a)}}_restartGame(){this._quickLoad(!0)}_fadeout(t){var e=0,s=W.MAP_WINDOW_WIDTH,a=W.FADEOUT_SPEED,i=lt("wwa-fader");i.style.display="block";var r=setInterval((()=>{if(e+=a,(s-=2*a)<=0||2*e>W.MAP_WINDOW_WIDTH)return i.removeAttribute("style"),i.style.display="block",i.style.borderWidth="0",i.style.width=W.MAP_WINDOW_WIDTH+"px",i.style.height=W.MAP_WINDOW_HEIGHT+"px",i.style.backgroundColor="#808080",clearInterval(r),void t();i.style.width=s+"px",i.style.height=s+"px",i.style.borderWidth=e+"px"}),20)}moveObjects(t){var e,s,a,i=this._camera.getPosition(),r=(this._player.getPosition(),i.getPartsCoord(),i.getPartsCoord().x),o=i.getPartsCoord().y;if(this.getMapAttributeByPosition(this._player.getPosition(),W.ATR_TYPE)!==W.MAP_LOCALGATE&&this.getObjectAttributeByPosition(this._player.getPosition(),W.ATR_TYPE)!==W.OBJECT_LOCALGATE){for(e=new Array(W.V_PARTS_NUM_IN_WINDOW+2),this.hoge=new Array(W.V_PARTS_NUM_IN_WINDOW+2),a=-1;a<=W.V_PARTS_NUM_IN_WINDOW;a++)for(e[a+1]=new Array(W.H_PARTS_NUM_IN_WINDOW+2),this.hoge[a+1]=new Array(W.H_PARTS_NUM_IN_WINDOW+2),s=-1;s<=W.H_PARTS_NUM_IN_WINDOW;s++)if(o+a<0||o+a>=this._wwaData.mapWidth||r+s<0||r+s>=this._wwaData.mapWidth)e[a+1][s+1]=0,this.hoge[a+1][s+1]=0;else{try{var h=(c=new _(this,r+s,o+a,0,0)).getPartsCoord()}catch(t){e[a+1][s+1]=0,this.hoge[a+1][s+1]=0;continue}this._wwaData.mapObject[h.y][h.x];e[a+1][s+1]=this._wwaData.mapObject[h.y][h.x],this.hoge[a+1][s+1]=-this._wwaData.mapObject[h.y][h.x]}for(s=-1;s<=W.H_PARTS_NUM_IN_WINDOW;s++)if(!(r+s<0||r+s>=this._wwaData.mapWidth))for(a=-1;a<=W.V_PARTS_NUM_IN_WINDOW;a++)if(!(o+a<0||o+a>=this._wwaData.mapWidth)){try{var c;h=(c=new _(this,r+s,o+a,0,0)).getPartsCoord()}catch(t){continue}var l=this._wwaData.mapObject[h.y][h.x];if(0!==l&&this._wwaData.objectAttribute[l][W.ATR_MOVE]!==D.STATIC&&this._wwaData.objectAttribute[l][W.ATR_TYPE]!==W.OBJECT_LOCALGATE&&this._wwaData.objectAttribute[l][W.ATR_TYPE]!==W.OBJECT_RANDOM&&(this._wwaData.objectAttribute[l][W.ATR_MOVE]===D.CHASE_PLAYER||this._wwaData.objectAttribute[l][W.ATR_MOVE]===D.RUN_OUT||this._wwaData.objectAttribute[l][W.ATR_MOVE]===D.HANG_AROUND)){var u=this._wwaData.objectAttribute[l][W.ATR_MOVE];if(u!==D.HANG_AROUND){var d,E=this._getCandidateCoord(t,c,u),m=new n(E.x,h.y),w=new n(h.x,E.y),p=null;if(this._objectCanMoveTo(t,E,e))this._setObjectsInNextFrame(h,E,r,o,e,l);else{var g=this._getSecondCandidateMoveMode(t,h,E,m,w,this._wwaData.objectAttribute[l][W.ATR_TYPE]===W.OBJECT_MONSTER,e);g===C.MODE_X?this._setObjectsInNextFrame(h,m,r,o,e,l):g===C.MODE_Y?this._setObjectsInNextFrame(h,w,r,o,e,l):null===(p=this._getThirdCandidate(t,c,E,u,e))||this._wwaData.isOldMove?(d=this._getRandomMoveCoord(t,c,e),this._setObjectsInNextFrame(h,d,r,o,e,l)):this._setObjectsInNextFrame(h,p,r,o,e,l)}}else d=this._getRandomMoveCoord(t,c,e),this._setObjectsInNextFrame(h,d,r,o,e,l)}}}}_getCandidateCoord(t,e,s){var a=e.getPartsCoord();this._player.getPosition().getOffsetCoord(),this._player.getPosition().getPartsCoord();try{var i=t?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord()}catch(t){throw new Error("予期せぬ方向への移動のようです。")}var r=a.clone(),o=0,n=0;return s===D.CHASE_PLAYER?(o=a.x>i.x?-1:a.x<i.x?1:0,n=a.y>i.y?-1:a.y<i.y?1:0):s===D.RUN_OUT&&(o=a.x>i.x?1:a.x<i.x?-1:0,n=a.y>i.y?1:a.y<i.y?-1:0),r.x+=o,r.y+=n,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,a,i,r,o){return!t||(this._player.getDir()!==u.UP&&this._player.getDir()!==u.DOWN||!r)&&(this._player.getDir()!==u.LEFT&&this._player.getDir()!==u.RIGHT||r)?this._objectCanMoveTo(t,a,o)?C.MODE_X:this._objectCanMoveTo(t,i,o)?C.MODE_Y:C.UNDECIDED:this._objectCanMoveTo(t,i,o)?C.MODE_Y:this._objectCanMoveTo(t,a,o)?C.MODE_X:C.UNDECIDED}_getThirdCandidate(t,e,s,a,i){var r,o=a===D.CHASE_PLAYER?1:a===D.RUN_OUT?-1:0,_=t?this._player.getPosition().getNextJustPosition().getPartsCoord():this._player.getPosition().getPartsCoord(),h=e.getPartsCoord();if(_.x!==h.x){if(r=new n(s.x,h.y+1*o),this._objectCanMoveTo(t,r,i))return r;if(r=new n(s.x,h.y-1*o),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x,h.y+1*o),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x,h.y-1*o),this._objectCanMoveTo(t,r,i))return r}if(_.y!==h.y){if(r=new n(h.x+1*o,s.y),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x-1*o,s.y),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x+1*o,h.y),this._objectCanMoveTo(t,r,i))return r;if(r=new n(h.x-1*o,h.y),this._objectCanMoveTo(t,r,i))return r}return null}_getRandomMoveCoord(t,e,s){const a=e.getPartsCoord(),i=a.clone(),r=this._wwaData.isOldMove?W.RANDOM_MOVE_ITERATION_NUM_BEFORE_V31:W.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],o=Math.floor(Math.random()*e.length);if(i.x=a.x+e[o],i.y=a.y+r[o],this._objectCanMoveTo(t,i,s))return i}return a}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 a=this._wwaData.map[e.y][e.x],i=this._wwaData.mapObject[e.y][e.x],r=this._wwaData.mapAttribute[a][W.ATR_TYPE],o=this._camera.getPosition(),n=o.getPartsCoord().x,_=o.getPartsCoord().y;if(0===a&&!this.isOldMap()||r===W.MAP_WALL)return!1;var h=e.x-n+1,c=e.y-_+1;if(0<=h&&0<=c&&h<s.length&&c<s.length){if(0!==s[c][h])return!1}else if(0!==i)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,a,i,r){var o=e.x-s+1,n=e.y-a+1;0<=e.x&&e.x<=this._wwaData.mapWidth&&0<=e.y&&e.y<=this._wwaData.mapWidth&&(0<=o&&o<i.length&&0<=n&&n<i.length&&(i[t.y-a+1][t.x-s+1]=0,i[e.y-a+1][e.x-s+1]=r,this.hoge[e.y-a+1][e.x-s+1]=r),this._objectMovingDataManager.add(r,t.convertIntoPosition(this),e.convertIntoPosition(this),t.getDirectionTo(e)))}launchBattleEstimateWindow(){var t=this._camera.getPosition().getPartsCoord(),e=Math.max(0,t.x),s=Math.min(this._wwaData.mapWidth-1,t.x+W.H_PARTS_NUM_IN_WINDOW-1),a=Math.max(0,t.y),i=Math.min(this._wwaData.mapWidth-1,t.y+W.V_PARTS_NUM_IN_WINDOW-1),r=[];this.playSound(L.DECISION);for(var o=e;o<=s;o++)for(var n=a;n<=i;n++){var _=this._wwaData.mapObject[n][o];this._wwaData.objectAttribute[_][W.ATR_TYPE]===W.OBJECT_MONSTER&&-1===r.indexOf(_)&&r.push(_)}return this._bottomButtonType===l.BATTLE_REPORT&<(P[v.GOTO_WWA]).classList.add("onpress"),0===r.length?(lt(P[v.GOTO_WWA]).classList.remove("onpress"),this.hideBattleEstimateWindow(),!1):(this._battleEstimateWindow.update(this._player.getStatus(),r),this._battleEstimateWindow.show(),this._player.setEstimateWindowWating(),!0)}hideBattleEstimateWindow(){this._battleEstimateWindow.hide(),this._player.clearEstimateWindowWaiting(),lt(P[v.GOTO_WWA]).classList.remove("onpress")}hidePasswordWindow(t=!1){if(this._passwordWindow.hide(),t||this._passwordWindow.mode===Ce.SAVE)this._player.clearPasswordWindowWaiting();else{try{var e=this._quickLoad(!1,this._passwordWindow.password,!1)}catch(t){return this._player.clearPasswordWindowWaiting(),void alert("セーブデータの復元に失敗しました。\nエラー詳細:\n"+t.message)}this._passwordLoadExecInNextFrame=!0,this._passwordSaveExtractData=e}}_displayUserVars(){if(this._canDisplayUserVars&&this._inlineUserVarViewer&&(this._inlineUserVarViewer.isVisible=!0,this._player.isControllable())){let 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<W.INLINE_USER_VAR_VIEWER_DISPLAY_NUM;e++){let s=(this._inlineUserVarViewer.topUserVarIndex+e)%W.USER_VAR_NUM;t+=`${`変数 ${s}: ${this._userVarNameList&&this._userVarNameList[s]?this._userVarNameList[s]:"名無し"}`}: ${this._wwaData.userVar[s]}\n`}t+="\n操作方法\n",t+="上キー:1つ戻す 下キー:1つ進める\n",t+="左キー:10つ戻す 右キー:10つ進める\n",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 A.NINTENDO:e=" 【操作方法】\nA:Yes,戦闘結果予測の表示\nB:No\nX:メニュー\nY:このリストの表示\nR:初めからスタート\nZL:データの一時保存\nZR:一時保存データの読み込み\n+: 移動速度を上げる\n-: 移動速度を落とす\n WWA Wing バージョン:3.12.22\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;case A.PLAY_STATION:e=" 【操作方法】\n〇:Yes,戦闘結果予測の表示\n×:No\n△:メニュー\n□:このリストの表示\nR1:初めからスタート\nL2:データの一時保存\nR2:一時保存データの読み込み\nOPTIONS: 移動速度を上げる\nSHARE: 移動速度を落とす\n 現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?" プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:3.12.22\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;case A.XBOX:e=" 【操作方法】\nB:Yes,戦闘結果予測の表示\nA:No\nY:メニュー\nX:このリストの表示\nRB:初めからスタート\nLT:データの一時保存\nRT:一時保存データの読み込み\nMENU: 移動速度を上げる\nWINDOW: 移動速度を落とす\n 現在の移動回数:"+this._player.getMoveCount()+"\n"+(s?" プレイ時間:"+s+"\n":"")+" WWA Wing バージョン:3.12.22\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 バージョン:3.12.22\n マップデータ バージョン: "+Math.floor(this._wwaData.version/10)+"."+this._wwaData.version%10;break;default:return}e&&this.generatePageAndReserveExecution(e,!1,!0)}}_setNextPage(){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?this._hideMessageWindow():this._shouldSetNextPage=!0,this._inlineUserVarViewer&&(this._inlineUserVarViewer.isVisible=!1)}_hideMessageWindow(){var t=0;this._player.isReadyToUseItem()&&(t=this._player.useItem());var e=this.getObjectAttributeById(t,W.ATR_STRING);this.clearFaces(),0===e?(this._messageWindow.isVisible()&&(this._player.setDelayFrame(),this._messageWindow.hide(),this._keyStore.allClear(),this._mouseStore.clear()),this._player.clearMessageWaiting()):this.generatePageAndReserveExecution(this.getMessageById(e),!1,!1,t,g.OBJECT,this._player.getPosition().getPartsCoord())}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=g.OBJECT,a=!1){var i,r,o,n,_,h,c,l,u=this._camera.getPosition().getPartsCoord(),d=a?Math.max(0,u.x):0,E=a?Math.min(this._wwaData.mapWidth-1,u.x+W.H_PARTS_NUM_IN_WINDOW-1):this._wwaData.mapWidth-1,m=a?Math.max(0,u.y):0,w=a?Math.min(this._wwaData.mapWidth-1,u.y+W.V_PARTS_NUM_IN_WINDOW)-1:this._wwaData.mapWidth-1;if(a=0!==d||E!==this._wwaData.mapWidth-1||0!==m||w!==this._wwaData.mapWidth-1,s===g.OBJECT)if(t=this.loadMapPartsObjectID(t),e=this.loadMapPartsObjectID(e),n=this._mapObjectIDTable[t].concat(),(c=this._mapObjectIDTable[t]).length=0,l=this._mapObjectIDTable[e],r=n.length,a)for(o=0;o<r;o++)_=(i=n[o])&j.BITMASK,h=i>>>j.BITSHIFT&j.BITMASK,d<=_&&_<=E&&m<=h&&h<=w?(this._wwaData.mapObject[h][_]=e,l.push(i)):c.push(i);else{for(o=0;o<r;o++)_=(i=n[o])&j.BITMASK,h=i>>>j.BITSHIFT&j.BITMASK,this._wwaData.mapObject[h][_]=e;Array.prototype.push.apply(l,n)}else if(t=this.loadMapPartsID(t),e=this.loadMapPartsID(e),n=this._mapIDTable[t].concat(),(c=this._mapIDTable[t]).length=0,l=this._mapIDTable[e],r=n.length,a)for(o=0;o<r;o++)_=(i=n[o])&j.BITMASK,h=i>>>j.BITSHIFT&j.BITMASK,d<=_&&_<=E&&m<=h&&h<=w?(this._wwaData.map[h][_]=e,l.push(i)):c.push(i);else{for(o=0;o<r;o++)_=(i=n[o])&j.BITMASK,h=i>>>j.BITSHIFT&j.BITMASK,this._wwaData.map[h][_]=e;Array.prototype.push.apply(l,n)}}getYesNoImgCoord(){return new n(this._wwaData.yesnoImgPosX,this._wwaData.yesnoImgPosY)}setYesNoImgCoord(t){return this._wwaData.yesnoImgPosX=t.x,this._wwaData.yesnoImgPosY=t.y,t}getPlayerImgCoord(){return new n(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}toValidStatusValue(t){return this.isNotNumberTypeOrNaN(t)||t<0?0:Math.floor(t)}setPlayerStatus(t,e,s){if(t===M.ENERGY){if(this._player.setEnergy(this.toValidStatusValue(e)),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:s}))return this.gameover(),{isGameOver:!0}}else if(t===M.STRENGTH)this._player.setStrength(this.toValidStatusValue(e));else if(t===M.DEFENCE)this._player.setDefence(this.toValidStatusValue(e));else if(t===M.GOLD)this._player.setGold(this.toValidStatusValue(e));else{if(t!==M.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*W.CHIP_SIZE,a=e.y*W.CHIP_SIZE,i=t=>{dt(`${t}>.status-icon`).style.backgroundPosition=`-${s}px -${a}px`};switch(t){case R.ENERGY:this._wwaData.imgStatusEnergyX=e.x,this._wwaData.imgStatusEnergyY=e.y,i("#disp-energy");break;case R.STRENGTH:this._wwaData.imgStatusStrengthX=e.x,this._wwaData.imgStatusStrengthY=e.y,i("#disp-strength");break;case R.DEFENCE:this._wwaData.imgStatusDefenceX=e.x,this._wwaData.imgStatusDefenceY=e.y,i("#disp-defence");break;case R.GOLD:this._wwaData.imgStatusGoldX=e.x,this._wwaData.imgStatusGoldY=e.y,i("#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*W.CHIP_SIZE,s=t.y*W.CHIP_SIZE;return Array.prototype.forEach.call(Et("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)}setImgClick(t){if(this._wwaData.imgClickX=t.x,this._wwaData.imgClickY=t.y,t.equals(new n(0,0)))Array.prototype.forEach.call(Et(".item-cell>.item-click-border"),(t=>{t.style.backgroundImage="url('"+W.ITEM_BORDER_IMG_DATA_URL+"')",t.style.backgroundPosition="0 0"}));else{var e=this._wwaData.mapCGName.replace("(","\\(").replace(")","\\)");Array.prototype.forEach.call(Et(".item-cell>.item-click-border"),(s=>{s.style.backgroundImage="url('"+e+"')",s.style.backgroundPosition="-"+t.x*W.CHIP_SIZE+"px -"+t.y*W.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}initCSSRule(){this._styleElm=lt(W.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,a=`\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`,i="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[X.MESSAGE_WINDOW]=this._sheet.addRule(e,a),this._stylePos[X.SIDEBAR]=this._sheet.addRule(i,r)):(this._stylePos[X.MESSAGE_WINDOW]=this._sheet.insertRule(`${e} { ${a} }`,0),this._stylePos[X.SIDEBAR]=this._sheet.insertRule(`${i} { ${r} }`,1))}changeStyleRule(t,e,s,a){t===K.COLOR_FRAME?(this._wwaData.frameColorR=e,this._wwaData.frameColorG=s,this._wwaData.frameColorB=a):t===K.COLOR_FRAMEOUT?(this._wwaData.frameOutColorR=e,this._wwaData.frameOutColorG=s,this._wwaData.frameOutColorB=a):t===K.COLOR_STR?(this._wwaData.fontColorR=e,this._wwaData.fontColorG=s,this._wwaData.fontColorB=a):t===K.COLOR_STATUS_STR&&(this._wwaData.statusColorR=e,this._wwaData.statusColorG=s,this._wwaData.statusColorB=a),this.updateCSSRule()}showMonsterWindow(){this._monsterWindow.show()}isClassicMode(){return this._isClassicModeEnable}isConsoleOutputMode(){return this._useConsole}forcedJumpGate(t,e){this._player.jumpTo(new _(this,t,e,0,0))}setUserVar(t,e){if(this.isNotNumberTypeOrNaN(t)||!this.isValidUserVarIndex(t))throw new Error(`代入先のユーザ変数の番号 が 0 以上 ${W.USER_VAR_NUM-1} 以下の数値になっていません!`);this._wwaData.userVar[t]=this.toAssignableValue(e),this._messageWindow.update()}toAssignableValue(t){const e=t>0?Math.floor(t):Math.ceil(t),s=Math.max(Math.min(e,W.USER_VAR_NUM_MAX_VALUE),W.USET_VAR_NUM_MIN_VALUE);return this.isNotNumberTypeOrNaN(s)?0:s}isValidUserVarIndex(t){return"number"==typeof t&&t>=0&&t<W.USER_VAR_NUM&&(0|t)===t}isNotNumberTypeOrNaN(t){return"number"!=typeof t||t!=t}getUserVar(t){return this._wwaData.userVar[t]}recUserPosition(t,e){var s=this._player.getPosition().getPartsCoord();this.setUserVar(t,s.x),this.setUserVar(e,s.y)}jumpRecUserPosition(t,e){this.forcedJumpGate(this._wwaData.userVar[t],this._wwaData.userVar[e])}outputUserVar(t){console.log("Var["+t+"] = "+this._wwaData.userVar[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("ユーザ変数の添字が範囲外です。");return this._player.setEnergy(this.toValidStatusValue(this._wwaData.userVar[t])),this._player.updateStatusValueBox(),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:e})?(this.gameover(),{isGameOver:!0}):{}}setHPMAXUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");this._player.setEnergyMax(this.toValidStatusValue(this._wwaData.userVar[t])),this._player.updateStatusValueBox()}setATUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");this._player.setStrength(this.toValidStatusValue(this._wwaData.userVar[t])),this._player.updateStatusValueBox()}setDFUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");this._player.setDefence(this.toValidStatusValue(this._wwaData.userVar[t])),this._player.updateStatusValueBox()}setMONEYUserVar(t){if(!this.isValidUserVarIndex(t))throw new Error("ユーザ変数の添字が範囲外です。");this._player.setGold(this.toValidStatusValue(this._wwaData.userVar[t])),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._wwaData.userVar[e])}setUserValAdd(t,e){this.setUserVar(t,this._wwaData.userVar[t]+this._wwaData.userVar[e])}setUserValSub(t,e){this.setUserVar(t,this._wwaData.userVar[t]-this._wwaData.userVar[e])}setUserValMul(t,e){this.setUserVar(t,this._wwaData.userVar[t]*this._wwaData.userVar[e])}setUserValDiv(t,e){this.setUserVar(t,0===this._wwaData.userVar[e]?0:this._wwaData.userVar[t]/this._wwaData.userVar[e])}setUserValMod(t,e){this.setUserVar(t,0===this._wwaData.userVar[e]?0:this._wwaData.userVar[t]%this._wwaData.userVar[e])}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._wwaData.userVar[s]:s;return null!==ue(t).match(re)?()=>Ee(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=ue(t),a=s.match(ae);if(null!==a){const t=de(a[2],e),s=de(a[4],e);return le(Mt(a[3],t,s),a[1])}const i=s.match(ie);if(null!==i){const t=de(i[1],e),s=de(i[3],e);return le(Mt(i[2],t,s),i[1])}throw new Error("setMacroのフォーマットを満たしていません: "+t)}(t,this.generateTokenValues(e.triggerParts)),{assignee:a,rawValue:i}=s;switch(a){case"energy":if(this._player.setEnergy(this.toValidStatusValue(i)),this._player.isDead()&&this.shouldApplyGameOver({isCalledByMacro:!0}))return this._player.updateStatusValueBox(),this.gameover(),{isGameOver:!0};break;case"energyMax":this._player.setEnergyMax(this.toValidStatusValue(i));break;case"strength":this._player.setStrength(this.toValidStatusValue(i));break;case"defence":this._player.setDefence(this.toValidStatusValue(i));break;case"gold":this._player.setGold(this.toValidStatusValue(i));break;case"moveCount":this._player.setMoveCount(this.toValidStatusValue(i));break;case"variable":if(isNaN(s.index)||!this.isValidUserVarIndex(s.index))throw new Error("ユーザ変数の添字が範囲外です。");this.setUserVar(s.index,this.toAssignableValue(i));break;case"map":this.appearPartsEval(e.triggerParts.position,`${s.x}`,`${s.y}`,s.rawValue,g.MAP);break;case"mapObject":this.appearPartsEval(e.triggerParts.position,`${s.x}`,`${s.y}`,s.rawValue,g.OBJECT);break;case"item":this.setPlayerGetItem(s.boxIndex1to12,i);break;case"playerDirection":this._player.setDir(i)}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._wwaData.userVar,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),a=parseInt(e[2],10);if(!this.isValidUserVarIndex(s)||!this.isValidUserVarIndex(a))throw new Error("判定対象のユーザ変数の添字が範囲外です!");const i=this._wwaData.userVar[s],r=e[1],o=this._wwaData.userVar[a],n=t=>parseInt(t,10)?g.MAP:g.OBJECT;if(this.compareUserVar(i,r,o)){const s=parseInt(e[3],10),a=e[4],i=e[5],r=n(e[6]);return void this.appearPartsEval(t,a,i,s,r)}if(void 0===e[9])return;const _=parseInt(e[7],10),h=e[8],c=e[9],l=n(e[10]);this.appearPartsEval(t,h,c,_,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<W.MIN_SPEED_INDEX||W.MAX_SPEED_INDEX<t)throw new Error("#set_speed の引数が異常です:"+t);this._wwaData.gameSpeedIndex=this._player.setSpeedIndex(t)}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>U.length)throw new Error("隠すパラメータは0から3の間で指定してください。");this._changeStatusVisibility(U[t],!e),this._player.updateStatusValueBox()}varMap(t,e,s,a,i){if(!this.isValidUserVarIndex(a))throw new Error("対象のユーザ変数の添字が範囲外です");const r=this._wwaData.userVar[a];if(r<0)throw new Error("負のパーツ番号は指定できません");if(i===g.OBJECT&&r>=this.getObjectPartsNum())throw new Error("物体パーツ番号の最大値を超えるパーツ番号が指定されました");if(i===g.MAP&&r>=this.getMapPartsNum())throw new Error("背景パーツ番号の最大値を超えるパーツ番号が指定されました");this.appearPartsEval(t,e,s,r,i)}setItemboxBackgroundPosition(t){this._wwaData.imgItemboxX=t.x,this._wwaData.imgItemboxY=t.y,Array.prototype.forEach.call(Et("div.item-cell"),(e=>{e.style.backgroundPosition=`-${t.x*W.CHIP_SIZE}px -${t.y*W.CHIP_SIZE}px`}))}_getVirtualPadButton(t){if(!ot.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,a;for(t=this._wwaData.gamePadButtonItemTable.length,e=0;e<t;e++)if(s=this._wwaData.gamePadButtonItemTable[e]){switch(a=!1,e){case Q.BUTTON_CROSS_KEY_LEFT:this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_LEFT)&&(a=!0);break;case Q.BUTTON_CROSS_KEY_RIGHT:this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_RIGHT)&&(a=!0);break;case Q.BUTTON_CROSS_KEY_UP:this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_UP)&&(a=!0);break;case Q.BUTTON_CROSS_KEY_DOWN:this._gamePadStore.crossPressed(Q.BUTTON_CROSS_KEY_DOWN)&&(a=!0)}if(this._gamePadStore.buttonTrigger(e)&&(a=!0),a&&this.onselectitem(s))return!0}return!1}setGamePadButtonItemTable(t,e){var s,a;if(!this._wwaData.gamePadButtonItemTable)for(a in this._wwaData.gamePadButtonItemTable=[],Q)s=a,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?ze.UNMATCHED_WORLD_NAME:s&&s!==as(this._wwaData.worldName,this._wwaData.worldPassNumber)?ze.UNMATCHED_WORLD_PASS_NUMBER:this._isDisallowLoadOldSave&&e!==this.checkOriginalMapString?ze.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}_loadSystemMessage(t){if(this._wwaData.customSystemMessages[t])return this._wwaData.customSystemMessages[t];const e=i[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 a.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 A.NINTENDO:return"Xボタンを押すか、右のボックスをタップする";case A.PLAY_STATION:return"△ボタンを押す";case A.XBOX:return"Yボタンを押す";default:return"右のボックスを選択する"}default:return"右のボックスを選択する"}})());case a.GAME_SPEED_CHANGED:{const t=this._player.getSpeedIndex();return e.replaceAll("%GAME_SPEED_NAME%",B[t]).replaceAll("%HIGH_SPEED_MESSAGE%",this.isBattleSpeedIndexForQuickBattle(t)?"戦闘も速くなります。\n":"").replaceAll("%MAX_SPEED_INDEX%",String(W.MAX_SPEED_INDEX+1)).replaceAll("%GAME_SPEED_INDEX%",String(t+1)).replaceAll("%SPEED_UP_BUTTON%",this.userDevice.os===A.NINTENDO?"+ボタン":"Pキー").replaceAll("%SPEED_DOWN_BUTTON%",this.userDevice.os===A.NINTENDO?"-ボタン":"Iキー")}default:return e}}overwriteSystemMessage(t,e){this._wwaData.customSystemMessages[t]=e}}var Ks=!1;function Xs(){if(navigator.userAgent.match(/(?:msie|trident)/i)||navigator.userAgent.match(/edge/i))return void alert("このゲームをプレイするには、Google Chrome や Mozilla Firefox などの最新のブラウザでこのページを開いてください。\nご利用の環境のサポートは、既に終了しています。");Array.prototype.forEach.call(Et("a.wwa-copyright"),(t=>{t.addEventListener("click",(()=>{Ks=!0}))})),window.addEventListener("beforeunload",(t=>{var e="このページを離れますか?";if(Ks)return Ks=!1,t.returnValue=e,e}));var t=lt("wwa-wrapper").getAttribute("data-wwa-title-img");const e=lt("wwa-wrapper").getAttribute("data-wwa-virtualpad-enable"),s=null!==e&&null!==e.match(/^true$/i);xe(lt("wwa-wrapper"),t,s);var a=lt("wwa-wrapper").getAttribute("data-wwa-mapdata"),i=lt("wwa-wrapper").getAttribute("data-wwa-audio-dir"),r=lt("wwa-wrapper").getAttribute("data-wwa-var-dump-elm"),o=null,n="true"===lt("wwa-wrapper").getAttribute("data-wwa-display-user-vars"),_=lt("wwa-wrapper").getAttribute("data-wwa-user-var-names-file");lt("wwa-wrapper").hasAttribute("data-wwa-var-dump-elm")&&n&&(o=function(t){const e=ut(t);return e instanceof HTMLElement?(e.classList.add("wwa-vardump-wrapper"),e.appendChild(Ls({kind:"numbered"})),e):null}(r));var h=!0;lt("wwa-wrapper").getAttribute("data-wwa-urlgate-enable").match(/^false$/i)&&(h=!1);var c=lt("wwa-wrapper").getAttribute("data-wwa-classic-mode-enable"),l=!1;null!==c&&c.match(/^true$/i)&&(l=!0);var u=!0,d=lt("wwa-wrapper").getAttribute("data-wwa-item-effect-enable");null!==d&&d.match(/^false$/i)&&(u=!1);let E=!1;const m=lt("wwa-wrapper").getAttribute("data-wwa-use-go-to-wwa");null!==m&&m.match(/^true$/i)&&(E=!0);const w=lt("wwa-wrapper").getAttribute("data-wwa-virtualpad-viewport-fit-enable");be()&&null!==w&&w.match(/^true$/i)&&(!function(){const t=document.getElementsByTagName("head")[0];let e=document.createElement("meta");e.setAttribute("name","viewport"),t.appendChild(e),ct()}(),window.addEventListener("resize",ct));const p=lt("wwa-wrapper").getAttribute("data-wwa-virtualpad-controller-elm"),g=s&&p?dt(p):null,A=(()=>{const t=lt("wwa-wrapper").getAttribute("data-wwa-disallow-load-old-save");return!(null===t||!t.match(/^true$/i))})();Vs=new Hs(a,h,t,l,u,E,i,A,o,_,n,s,g)}"complete"===document.readyState?setTimeout(Xs):window.addEventListener("load",(function(){setTimeout(Xs)}))}()}();
|