( () => {
var Bo = Object.create;
var Kt = Object.defineProperty;
var vo = Object.getOwnPropertyDescriptor;
var Uo = Object.getOwnPropertyNames;
var yo = Object.getPrototypeOf
, Io = Object.prototype.hasOwnProperty;
var xo = (o, t, e) => t in o ? Kt(o, t, {
enumerable: !0,
configurable: !0,
writable: !0,
value: e
}) : o[t] = e;
var Ct = (o => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(o,{
get: (t, e) => (typeof require < "u" ? require : t)[e]
}) : o)(function(o) {
if (typeof require < "u")
return require.apply(this, arguments);
throw Error('Dynamic require of "' + o + '" is not supported')
});
var ni = (o, t) => () => (t || o((t = {
exports: {}
}).exports, t),
t.exports)
, S = (o, t) => {
for (var e in t)
Kt(o, e, {
get: t[e],
enumerable: !0
})
}
, Co = (o, t, e, n) => {
if (t && typeof t == "object" || typeof t == "function")
for (let i of Uo(t))
!Io.call(o, i) && i !== e && Kt(o, i, {
get: () => t[i],
enumerable: !(n = vo(t, i)) || n.enumerable
});
return o
}
;
var $t = (o, t, e) => (e = o != null ? Bo(yo(o)) : {},
Co(t || !o || !o.__esModule ? Kt(e, "default", {
value: o,
enumerable: !0
}) : e, o));
var M = (o, t, e) => (xo(o, typeof t != "symbol" ? t + "" : t, e),
e);
var Oe = ni(Ge => {
(function() {
"use strict";
var o = function() {
this.init()
};
o.prototype = {
init: function() {
var s = this || t;
return s._counter = 1e3,
s._html5AudioPool = [],
s.html5PoolSize = 10,
s._codecs = {},
s._howls = [],
s._muted = !1,
s._volume = 1,
s._canPlayEvent = "canplaythrough",
s._navigator = typeof window < "u" && window.navigator ? window.navigator : null,
s.masterGain = null,
s.noAudio = !1,
s.usingWebAudio = !0,
s.autoSuspend = !0,
s.ctx = null,
s.autoUnlock = !0,
s._setup(),
s
},
volume: function(s) {
var r = this || t;
if (s = parseFloat(s),
r.ctx || g(),
typeof s < "u" && s >= 0 && s <= 1) {
if (r._volume = s,
r._muted)
return r;
r.usingWebAudio && r.masterGain.gain.setValueAtTime(s, t.ctx.currentTime);
for (var d = 0; d < r._howls.length; d++)
if (!r._howls[d]._webAudio)
for (var h = r._howls[d]._getSoundIds(), b = 0; b < h.length; b++) {
var m = r._howls[d]._soundById(h[b]);
m && m._node && (m._node.volume = m._volume * s)
}
return r
}
return r._volume
},
mute: function(s) {
var r = this || t;
r.ctx || g(),
r._muted = s,
r.usingWebAudio && r.masterGain.gain.setValueAtTime(s ? 0 : r._volume, t.ctx.currentTime);
for (var d = 0; d < r._howls.length; d++)
if (!r._howls[d]._webAudio)
for (var h = r._howls[d]._getSoundIds(), b = 0; b < h.length; b++) {
var m = r._howls[d]._soundById(h[b]);
m && m._node && (m._node.muted = s ? !0 : m._muted)
}
return r
},
stop: function() {
for (var s = this || t, r = 0; r < s._howls.length; r++)
s._howls[r].stop();
return s
},
unload: function() {
for (var s = this || t, r = s._howls.length - 1; r >= 0; r--)
s._howls[r].unload();
return s.usingWebAudio && s.ctx && typeof s.ctx.close < "u" && (s.ctx.close(),
s.ctx = null,
g()),
s
},
codecs: function(s) {
return (this || t)._codecs[s.replace(/^x-/, "")]
},
_setup: function() {
var s = this || t;
if (s.state = s.ctx && s.ctx.state || "suspended",
s._autoSuspend(),
!s.usingWebAudio)
if (typeof Audio < "u")
try {
var r = new Audio;
typeof r.oncanplaythrough > "u" && (s._canPlayEvent = "canplay")
} catch {
s.noAudio = !0
}
else
s.noAudio = !0;
try {
var r = new Audio;
r.muted && (s.noAudio = !0)
} catch {}
return s.noAudio || s._setupCodecs(),
s
},
_setupCodecs: function() {
var s = this || t
, r = null;
try {
r = typeof Audio < "u" ? new Audio : null
} catch {
return s
}
if (!r || typeof r.canPlayType != "function")
return s;
var d = r.canPlayType("audio/mpeg;").replace(/^no$/, "")
, h = s._navigator ? s._navigator.userAgent : ""
, b = h.match(/OPR\/(\d+)/g)
, m = b && parseInt(b[0].split("/")[1], 10) < 33
, p = h.indexOf("Safari") !== -1 && h.indexOf("Chrome") === -1
, Q = h.match(/Version\/(.*?) /)
, f = p && Q && parseInt(Q[1], 10) < 15;
return s._codecs = {
mp3: !!(!m && (d || r.canPlayType("audio/mp3;").replace(/^no$/, ""))),
mpeg: !!d,
opus: !!r.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/, ""),
ogg: !!r.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
oga: !!r.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/, ""),
wav: !!(r.canPlayType('audio/wav; codecs="1"') || r.canPlayType("audio/wav")).replace(/^no$/, ""),
aac: !!r.canPlayType("audio/aac;").replace(/^no$/, ""),
caf: !!r.canPlayType("audio/x-caf;").replace(/^no$/, ""),
m4a: !!(r.canPlayType("audio/x-m4a;") || r.canPlayType("audio/m4a;") || r.canPlayType("audio/aac;")).replace(/^no$/, ""),
m4b: !!(r.canPlayType("audio/x-m4b;") || r.canPlayType("audio/m4b;") || r.canPlayType("audio/aac;")).replace(/^no$/, ""),
mp4: !!(r.canPlayType("audio/x-mp4;") || r.canPlayType("audio/mp4;") || r.canPlayType("audio/aac;")).replace(/^no$/, ""),
weba: !!(!f && r.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")),
webm: !!(!f && r.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/, "")),
dolby: !!r.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/, ""),
flac: !!(r.canPlayType("audio/x-flac;") || r.canPlayType("audio/flac;")).replace(/^no$/, "")
},
s
},
_unlockAudio: function() {
var s = this || t;
if (!(s._audioUnlocked || !s.ctx)) {
s._audioUnlocked = !1,
s.autoUnlock = !1,
!s._mobileUnloaded && s.ctx.sampleRate !== 44100 && (s._mobileUnloaded = !0,
s.unload()),
s._scratchBuffer = s.ctx.createBuffer(1, 1, 22050);
var r = function(d) {
for (; s._html5AudioPool.length < s.html5PoolSize; )
try {
var h = new Audio;
h._unlocked = !0,
s._releaseHtml5Audio(h)
} catch {
s.noAudio = !0;
break
}
for (var b = 0; b < s._howls.length; b++)
if (!s._howls[b]._webAudio)
for (var m = s._howls[b]._getSoundIds(), p = 0; p < m.length; p++) {
var Q = s._howls[b]._soundById(m[p]);
Q && Q._node && !Q._node._unlocked && (Q._node._unlocked = !0,
Q._node.load())
}
s._autoResume();
var f = s.ctx.createBufferSource();
f.buffer = s._scratchBuffer,
f.connect(s.ctx.destination),
typeof f.start > "u" ? f.noteOn(0) : f.start(0),
typeof s.ctx.resume == "function" && s.ctx.resume(),
f.onended = function() {
f.disconnect(0),
s._audioUnlocked = !0,
document.removeEventListener("touchstart", r, !0),
document.removeEventListener("touchend", r, !0),
document.removeEventListener("click", r, !0),
document.removeEventListener("keydown", r, !0);
for (var B = 0; B < s._howls.length; B++)
s._howls[B]._emit("unlock")
}
};
return document.addEventListener("touchstart", r, !0),
document.addEventListener("touchend", r, !0),
document.addEventListener("click", r, !0),
document.addEventListener("keydown", r, !0),
s
}
},
_obtainHtml5Audio: function() {
var s = this || t;
if (s._html5AudioPool.length)
return s._html5AudioPool.pop();
var r = new Audio().play();
return r && typeof Promise < "u" && (r instanceof Promise || typeof r.then == "function") && r.catch(function() {
console.warn("HTML5 Audio pool exhausted, returning potentially locked audio object.")
}),
new Audio
},
_releaseHtml5Audio: function(s) {
var r = this || t;
return s._unlocked && r._html5AudioPool.push(s),
r
},
_autoSuspend: function() {
var s = this;
if (!(!s.autoSuspend || !s.ctx || typeof s.ctx.suspend > "u" || !t.usingWebAudio)) {
for (var r = 0; r < s._howls.length; r++)
if (s._howls[r]._webAudio) {
for (var d = 0; d < s._howls[r]._sounds.length; d++)
if (!s._howls[r]._sounds[d]._paused)
return s
}
return s._suspendTimer && clearTimeout(s._suspendTimer),
s._suspendTimer = setTimeout(function() {
if (s.autoSuspend) {
s._suspendTimer = null,
s.state = "suspending";
var h = function() {
s.state = "suspended",
s._resumeAfterSuspend && (delete s._resumeAfterSuspend,
s._autoResume())
};
s.ctx.suspend().then(h, h)
}
}, 3e4),
s
}
},
_autoResume: function() {
var s = this;
if (!(!s.ctx || typeof s.ctx.resume > "u" || !t.usingWebAudio))
return s.state === "running" && s.ctx.state !== "interrupted" && s._suspendTimer ? (clearTimeout(s._suspendTimer),
s._suspendTimer = null) : s.state === "suspended" || s.state === "running" && s.ctx.state === "interrupted" ? (s.ctx.resume().then(function() {
s.state = "running";
for (var r = 0; r < s._howls.length; r++)
s._howls[r]._emit("resume")
}),
s._suspendTimer && (clearTimeout(s._suspendTimer),
s._suspendTimer = null)) : s.state === "suspending" && (s._resumeAfterSuspend = !0),
s
}
};
var t = new o
, e = function(s) {
var r = this;
if (!s.src || s.src.length === 0) {
console.error("An array of source files must be passed with any new Howl.");
return
}
r.init(s)
};
e.prototype = {
init: function(s) {
var r = this;
return t.ctx || g(),
r._autoplay = s.autoplay || !1,
r._format = typeof s.format != "string" ? s.format : [s.format],
r._html5 = s.html5 || !1,
r._muted = s.mute || !1,
r._loop = s.loop || !1,
r._pool = s.pool || 5,
r._preload = typeof s.preload == "boolean" || s.preload === "metadata" ? s.preload : !0,
r._rate = s.rate || 1,
r._sprite = s.sprite || {},
r._src = typeof s.src != "string" ? s.src : [s.src],
r._volume = s.volume !== void 0 ? s.volume : 1,
r._xhr = {
method: s.xhr && s.xhr.method ? s.xhr.method : "GET",
headers: s.xhr && s.xhr.headers ? s.xhr.headers : null,
withCredentials: s.xhr && s.xhr.withCredentials ? s.xhr.withCredentials : !1
},
r._duration = 0,
r._state = "unloaded",
r._sounds = [],
r._endTimers = {},
r._queue = [],
r._playLock = !1,
r._onend = s.onend ? [{
fn: s.onend
}] : [],
r._onfade = s.onfade ? [{
fn: s.onfade
}] : [],
r._onload = s.onload ? [{
fn: s.onload
}] : [],
r._onloaderror = s.onloaderror ? [{
fn: s.onloaderror
}] : [],
r._onplayerror = s.onplayerror ? [{
fn: s.onplayerror
}] : [],
r._onpause = s.onpause ? [{
fn: s.onpause
}] : [],
r._onplay = s.onplay ? [{
fn: s.onplay
}] : [],
r._onstop = s.onstop ? [{
fn: s.onstop
}] : [],
r._onmute = s.onmute ? [{
fn: s.onmute
}] : [],
r._onvolume = s.onvolume ? [{
fn: s.onvolume
}] : [],
r._onrate = s.onrate ? [{
fn: s.onrate
}] : [],
r._onseek = s.onseek ? [{
fn: s.onseek
}] : [],
r._onunlock = s.onunlock ? [{
fn: s.onunlock
}] : [],
r._onresume = [],
r._webAudio = t.usingWebAudio && !r._html5,
typeof t.ctx < "u" && t.ctx && t.autoUnlock && t._unlockAudio(),
t._howls.push(r),
r._autoplay && r._queue.push({
event: "play",
action: function() {
r.play()
}
}),
r._preload && r._preload !== "none" && r.load(),
r
},
load: function() {
var s = this
, r = null;
if (t.noAudio) {
s._emit("loaderror", null, "No audio support.");
return
}
typeof s._src == "string" && (s._src = [s._src]);
for (var d = 0; d < s._src.length; d++) {
var h, b;
if (s._format && s._format[d])
h = s._format[d];
else {
if (b = s._src[d],
typeof b != "string") {
s._emit("loaderror", null, "Non-string found in selected audio sources - ignoring.");
continue
}
h = /^data:audio\/([^;,]+);/i.exec(b),
h || (h = /\.([^.]+)$/.exec(b.split("?", 1)[0])),
h && (h = h[1].toLowerCase())
}
if (h || console.warn('No file extension was found. Consider using the "format" property or specify an extension.'),
h && t.codecs(h)) {
r = s._src[d];
break
}
}
if (!r) {
s._emit("loaderror", null, "No codec support for selected audio sources.");
return
}
return s._src = r,
s._state = "loading",
window.location.protocol === "https:" && r.slice(0, 5) === "http:" && (s._html5 = !0,
s._webAudio = !1),
new n(s),
s._webAudio && a(s),
s
},
play: function(s, r) {
var d = this
, h = null;
if (typeof s == "number")
h = s,
s = null;
else {
if (typeof s == "string" && d._state === "loaded" && !d._sprite[s])
return null;
if (typeof s > "u" && (s = "__default",
!d._playLock)) {
for (var b = 0, m = 0; m < d._sounds.length; m++)
d._sounds[m]._paused && !d._sounds[m]._ended && (b++,
h = d._sounds[m]._id);
b === 1 ? s = null : h = null
}
}
var p = h ? d._soundById(h) : d._inactiveSound();
if (!p)
return null;
if (h && !s && (s = p._sprite || "__default"),
d._state !== "loaded") {
p._sprite = s,
p._ended = !1;
var Q = p._id;
return d._queue.push({
event: "play",
action: function() {
d.play(Q)
}
}),
Q
}
if (h && !p._paused)
return r || d._loadQueue("play"),
p._id;
d._webAudio && t._autoResume();
var f = Math.max(0, p._seek > 0 ? p._seek : d._sprite[s][0] / 1e3)
, B = Math.max(0, (d._sprite[s][0] + d._sprite[s][1]) / 1e3 - f)
, x = B * 1e3 / Math.abs(p._rate)
, I = d._sprite[s][0] / 1e3
, w = (d._sprite[s][0] + d._sprite[s][1]) / 1e3;
p._sprite = s,
p._ended = !1;
var y = function() {
p._paused = !1,
p._seek = f,
p._start = I,
p._stop = w,
p._loop = !!(p._loop || d._sprite[s][2])
};
if (f >= w) {
d._ended(p);
return
}
var C = p._node;
if (d._webAudio) {
var E = function() {
d._playLock = !1,
y(),
d._refreshBuffer(p);
var L = p._muted || d._muted ? 0 : p._volume;
C.gain.setValueAtTime(L, t.ctx.currentTime),
p._playStart = t.ctx.currentTime,
typeof C.bufferSource.start > "u" ? p._loop ? C.bufferSource.noteGrainOn(0, f, 86400) : C.bufferSource.noteGrainOn(0, f, B) : p._loop ? C.bufferSource.start(0, f, 86400) : C.bufferSource.start(0, f, B),
x !== 1 / 0 && (d._endTimers[p._id] = setTimeout(d._ended.bind(d, p), x)),
r || setTimeout(function() {
d._emit("play", p._id),
d._loadQueue()
}, 0)
};
t.state === "running" && t.ctx.state !== "interrupted" ? E() : (d._playLock = !0,
d.once("resume", E),
d._clearTimer(p._id))
} else {
var v = function() {
C.currentTime = f,
C.muted = p._muted || d._muted || t._muted || C.muted,
C.volume = p._volume * t.volume(),
C.playbackRate = p._rate;
try {
var L = C.play();
if (L && typeof Promise < "u" && (L instanceof Promise || typeof L.then == "function") ? (d._playLock = !0,
y(),
L.then(function() {
d._playLock = !1,
C._unlocked = !0,
r ? d._loadQueue() : d._emit("play", p._id)
}).catch(function() {
d._playLock = !1,
d._emit("playerror", p._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),
p._ended = !0,
p._paused = !0
})) : r || (d._playLock = !1,
y(),
d._emit("play", p._id)),
C.playbackRate = p._rate,
C.paused) {
d._emit("playerror", p._id, "Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");
return
}
s !== "__default" || p._loop ? d._endTimers[p._id] = setTimeout(d._ended.bind(d, p), x) : (d._endTimers[p._id] = function() {
d._ended(p),
C.removeEventListener("ended", d._endTimers[p._id], !1)
}
,
C.addEventListener("ended", d._endTimers[p._id], !1))
} catch (z) {
d._emit("playerror", p._id, z)
}
};
C.src === "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA" && (C.src = d._src,
C.load());
var X = window && window.ejecta || !C.readyState && t._navigator.isCocoonJS;
if (C.readyState >= 3 || X)
v();
else {
d._playLock = !0,
d._state = "loading";
var O = function() {
d._state = "loaded",
v(),
C.removeEventListener(t._canPlayEvent, O, !1)
};
C.addEventListener(t._canPlayEvent, O, !1),
d._clearTimer(p._id)
}
}
return p._id
},
pause: function(s) {
var r = this;
if (r._state !== "loaded" || r._playLock)
return r._queue.push({
event: "pause",
action: function() {
r.pause(s)
}
}),
r;
for (var d = r._getSoundIds(s), h = 0; h < d.length; h++) {
r._clearTimer(d[h]);
var b = r._soundById(d[h]);
if (b && !b._paused && (b._seek = r.seek(d[h]),
b._rateSeek = 0,
b._paused = !0,
r._stopFade(d[h]),
b._node))
if (r._webAudio) {
if (!b._node.bufferSource)
continue;
typeof b._node.bufferSource.stop > "u" ? b._node.bufferSource.noteOff(0) : b._node.bufferSource.stop(0),
r._cleanBuffer(b._node)
} else
(!isNaN(b._node.duration) || b._node.duration === 1 / 0) && b._node.pause();
arguments[1] || r._emit("pause", b ? b._id : null)
}
return r
},
stop: function(s, r) {
var d = this;
if (d._state !== "loaded" || d._playLock)
return d._queue.push({
event: "stop",
action: function() {
d.stop(s)
}
}),
d;
for (var h = d._getSoundIds(s), b = 0; b < h.length; b++) {
d._clearTimer(h[b]);
var m = d._soundById(h[b]);
m && (m._seek = m._start || 0,
m._rateSeek = 0,
m._paused = !0,
m._ended = !0,
d._stopFade(h[b]),
m._node && (d._webAudio ? m._node.bufferSource && (typeof m._node.bufferSource.stop > "u" ? m._node.bufferSource.noteOff(0) : m._node.bufferSource.stop(0),
d._cleanBuffer(m._node)) : (!isNaN(m._node.duration) || m._node.duration === 1 / 0) && (m._node.currentTime = m._start || 0,
m._node.pause(),
m._node.duration === 1 / 0 && d._clearSound(m._node))),
r || d._emit("stop", m._id))
}
return d
},
mute: function(s, r) {
var d = this;
if (d._state !== "loaded" || d._playLock)
return d._queue.push({
event: "mute",
action: function() {
d.mute(s, r)
}
}),
d;
if (typeof r > "u")
if (typeof s == "boolean")
d._muted = s;
else
return d._muted;
for (var h = d._getSoundIds(r), b = 0; b < h.length; b++) {
var m = d._soundById(h[b]);
m && (m._muted = s,
m._interval && d._stopFade(m._id),
d._webAudio && m._node ? m._node.gain.setValueAtTime(s ? 0 : m._volume, t.ctx.currentTime) : m._node && (m._node.muted = t._muted ? !0 : s),
d._emit("mute", m._id))
}
return d
},
volume: function() {
var s = this, r = arguments, d, h;
if (r.length === 0)
return s._volume;
if (r.length === 1 || r.length === 2 && typeof r[1] > "u") {
var b = s._getSoundIds()
, m = b.indexOf(r[0]);
m >= 0 ? h = parseInt(r[0], 10) : d = parseFloat(r[0])
} else
r.length >= 2 && (d = parseFloat(r[0]),
h = parseInt(r[1], 10));
var p;
if (typeof d < "u" && d >= 0 && d <= 1) {
if (s._state !== "loaded" || s._playLock)
return s._queue.push({
event: "volume",
action: function() {
s.volume.apply(s, r)
}
}),
s;
typeof h > "u" && (s._volume = d),
h = s._getSoundIds(h);
for (var Q = 0; Q < h.length; Q++)
p = s._soundById(h[Q]),
p && (p._volume = d,
r[2] || s._stopFade(h[Q]),
s._webAudio && p._node && !p._muted ? p._node.gain.setValueAtTime(d, t.ctx.currentTime) : p._node && !p._muted && (p._node.volume = d * t.volume()),
s._emit("volume", p._id))
} else
return p = h ? s._soundById(h) : s._sounds[0],
p ? p._volume : 0;
return s
},
fade: function(s, r, d, h) {
var b = this;
if (b._state !== "loaded" || b._playLock)
return b._queue.push({
event: "fade",
action: function() {
b.fade(s, r, d, h)
}
}),
b;
s = Math.min(Math.max(0, parseFloat(s)), 1),
r = Math.min(Math.max(0, parseFloat(r)), 1),
d = parseFloat(d),
b.volume(s, h);
for (var m = b._getSoundIds(h), p = 0; p < m.length; p++) {
var Q = b._soundById(m[p]);
if (Q) {
if (h || b._stopFade(m[p]),
b._webAudio && !Q._muted) {
var f = t.ctx.currentTime
, B = f + d / 1e3;
Q._volume = s,
Q._node.gain.setValueAtTime(s, f),
Q._node.gain.linearRampToValueAtTime(r, B)
}
b._startFadeInterval(Q, s, r, d, m[p], typeof h > "u")
}
}
return b
},
_startFadeInterval: function(s, r, d, h, b, m) {
var p = this
, Q = r
, f = d - r
, B = Math.abs(f / .01)
, x = Math.max(4, B > 0 ? h / B : h)
, I = Date.now();
s._fadeTo = d,
s._interval = setInterval(function() {
var w = (Date.now() - I) / h;
I = Date.now(),
Q += f * w,
Q = Math.round(Q * 100) / 100,
f < 0 ? Q = Math.max(d, Q) : Q = Math.min(d, Q),
p._webAudio ? s._volume = Q : p.volume(Q, s._id, !0),
m && (p._volume = Q),
(d < r && Q <= d || d > r && Q >= d) && (clearInterval(s._interval),
s._interval = null,
s._fadeTo = null,
p.volume(d, s._id),
p._emit("fade", s._id))
}, x)
},
_stopFade: function(s) {
var r = this
, d = r._soundById(s);
return d && d._interval && (r._webAudio && d._node.gain.cancelScheduledValues(t.ctx.currentTime),
clearInterval(d._interval),
d._interval = null,
r.volume(d._fadeTo, s),
d._fadeTo = null,
r._emit("fade", s)),
r
},
loop: function() {
var s = this, r = arguments, d, h, b;
if (r.length === 0)
return s._loop;
if (r.length === 1)
if (typeof r[0] == "boolean")
d = r[0],
s._loop = d;
else
return b = s._soundById(parseInt(r[0], 10)),
b ? b._loop : !1;
else
r.length === 2 && (d = r[0],
h = parseInt(r[1], 10));
for (var m = s._getSoundIds(h), p = 0; p < m.length; p++)
b = s._soundById(m[p]),
b && (b._loop = d,
s._webAudio && b._node && b._node.bufferSource && (b._node.bufferSource.loop = d,
d && (b._node.bufferSource.loopStart = b._start || 0,
b._node.bufferSource.loopEnd = b._stop,
s.playing(m[p]) && (s.pause(m[p], !0),
s.play(m[p], !0)))));
return s
},
rate: function() {
var s = this, r = arguments, d, h;
if (r.length === 0)
h = s._sounds[0]._id;
else if (r.length === 1) {
var b = s._getSoundIds()
, m = b.indexOf(r[0]);
m >= 0 ? h = parseInt(r[0], 10) : d = parseFloat(r[0])
} else
r.length === 2 && (d = parseFloat(r[0]),
h = parseInt(r[1], 10));
var p;
if (typeof d == "number") {
if (s._state !== "loaded" || s._playLock)
return s._queue.push({
event: "rate",
action: function() {
s.rate.apply(s, r)
}
}),
s;
typeof h > "u" && (s._rate = d),
h = s._getSoundIds(h);
for (var Q = 0; Q < h.length; Q++)
if (p = s._soundById(h[Q]),
p) {
s.playing(h[Q]) && (p._rateSeek = s.seek(h[Q]),
p._playStart = s._webAudio ? t.ctx.currentTime : p._playStart),
p._rate = d,
s._webAudio && p._node && p._node.bufferSource ? p._node.bufferSource.playbackRate.setValueAtTime(d, t.ctx.currentTime) : p._node && (p._node.playbackRate = d);
var f = s.seek(h[Q])
, B = (s._sprite[p._sprite][0] + s._sprite[p._sprite][1]) / 1e3 - f
, x = B * 1e3 / Math.abs(p._rate);
(s._endTimers[h[Q]] || !p._paused) && (s._clearTimer(h[Q]),
s._endTimers[h[Q]] = setTimeout(s._ended.bind(s, p), x)),
s._emit("rate", p._id)
}
} else
return p = s._soundById(h),
p ? p._rate : s._rate;
return s
},
seek: function() {
var s = this, r = arguments, d, h;
if (r.length === 0)
s._sounds.length && (h = s._sounds[0]._id);
else if (r.length === 1) {
var b = s._getSoundIds()
, m = b.indexOf(r[0]);
m >= 0 ? h = parseInt(r[0], 10) : s._sounds.length && (h = s._sounds[0]._id,
d = parseFloat(r[0]))
} else
r.length === 2 && (d = parseFloat(r[0]),
h = parseInt(r[1], 10));
if (typeof h > "u")
return 0;
if (typeof d == "number" && (s._state !== "loaded" || s._playLock))
return s._queue.push({
event: "seek",
action: function() {
s.seek.apply(s, r)
}
}),
s;
var p = s._soundById(h);
if (p)
if (typeof d == "number" && d >= 0) {
var Q = s.playing(h);
Q && s.pause(h, !0),
p._seek = d,
p._ended = !1,
s._clearTimer(h),
!s._webAudio && p._node && !isNaN(p._node.duration) && (p._node.currentTime = d);
var f = function() {
Q && s.play(h, !0),
s._emit("seek", h)
};
if (Q && !s._webAudio) {
var B = function() {
s._playLock ? setTimeout(B, 0) : f()
};
setTimeout(B, 0)
} else
f()
} else if (s._webAudio) {
var x = s.playing(h) ? t.ctx.currentTime - p._playStart : 0
, I = p._rateSeek ? p._rateSeek - p._seek : 0;
return p._seek + (I + x * Math.abs(p._rate))
} else
return p._node.currentTime;
return s
},
playing: function(s) {
var r = this;
if (typeof s == "number") {
var d = r._soundById(s);
return d ? !d._paused : !1
}
for (var h = 0; h < r._sounds.length; h++)
if (!r._sounds[h]._paused)
return !0;
return !1
},
duration: function(s) {
var r = this
, d = r._duration
, h = r._soundById(s);
return h && (d = r._sprite[h._sprite][1] / 1e3),
d
},
state: function() {
return this._state
},
unload: function() {
for (var s = this, r = s._sounds, d = 0; d < r.length; d++)
r[d]._paused || s.stop(r[d]._id),
s._webAudio || (s._clearSound(r[d]._node),
r[d]._node.removeEventListener("error", r[d]._errorFn, !1),
r[d]._node.removeEventListener(t._canPlayEvent, r[d]._loadFn, !1),
r[d]._node.removeEventListener("ended", r[d]._endFn, !1),
t._releaseHtml5Audio(r[d]._node)),
delete r[d]._node,
s._clearTimer(r[d]._id);
var h = t._howls.indexOf(s);
h >= 0 && t._howls.splice(h, 1);
var b = !0;
for (d = 0; d < t._howls.length; d++)
if (t._howls[d]._src === s._src || s._src.indexOf(t._howls[d]._src) >= 0) {
b = !1;
break
}
return i && b && delete i[s._src],
t.noAudio = !1,
s._state = "unloaded",
s._sounds = [],
s = null,
null
},
on: function(s, r, d, h) {
var b = this
, m = b["_on" + s];
return typeof r == "function" && m.push(h ? {
id: d,
fn: r,
once: h
} : {
id: d,
fn: r
}),
b
},
off: function(s, r, d) {
var h = this
, b = h["_on" + s]
, m = 0;
if (typeof r == "number" && (d = r,
r = null),
r || d)
for (m = 0; m < b.length; m++) {
var p = d === b[m].id;
if (r === b[m].fn && p || !r && p) {
b.splice(m, 1);
break
}
}
else if (s)
h["_on" + s] = [];
else {
var Q = Object.keys(h);
for (m = 0; m < Q.length; m++)
Q[m].indexOf("_on") === 0 && Array.isArray(h[Q[m]]) && (h[Q[m]] = [])
}
return h
},
once: function(s, r, d) {
var h = this;
return h.on(s, r, d, 1),
h
},
_emit: function(s, r, d) {
for (var h = this, b = h["_on" + s], m = b.length - 1; m >= 0; m--)
(!b[m].id || b[m].id === r || s === "load") && (setTimeout(function(p) {
p.call(this, r, d)
}
.bind(h, b[m].fn), 0),
b[m].once && h.off(s, b[m].fn, b[m].id));
return h._loadQueue(s),
h
},
_loadQueue: function(s) {
var r = this;
if (r._queue.length > 0) {
var d = r._queue[0];
d.event === s && (r._queue.shift(),
r._loadQueue()),
s || d.action()
}
return r
},
_ended: function(s) {
var r = this
, d = s._sprite;
if (!r._webAudio && s._node && !s._node.paused && !s._node.ended && s._node.currentTime < s._stop)
return setTimeout(r._ended.bind(r, s), 100),
r;
var h = !!(s._loop || r._sprite[d][2]);
if (r._emit("end", s._id),
!r._webAudio && h && r.stop(s._id, !0).play(s._id),
r._webAudio && h) {
r._emit("play", s._id),
s._seek = s._start || 0,
s._rateSeek = 0,
s._playStart = t.ctx.currentTime;
var b = (s._stop - s._start) * 1e3 / Math.abs(s._rate);
r._endTimers[s._id] = setTimeout(r._ended.bind(r, s), b)
}
return r._webAudio && !h && (s._paused = !0,
s._ended = !0,
s._seek = s._start || 0,
s._rateSeek = 0,
r._clearTimer(s._id),
r._cleanBuffer(s._node),
t._autoSuspend()),
!r._webAudio && !h && r.stop(s._id, !0),
r
},
_clearTimer: function(s) {
var r = this;
if (r._endTimers[s]) {
if (typeof r._endTimers[s] != "function")
clearTimeout(r._endTimers[s]);
else {
var d = r._soundById(s);
d && d._node && d._node.removeEventListener("ended", r._endTimers[s], !1)
}
delete r._endTimers[s]
}
return r
},
_soundById: function(s) {
for (var r = this, d = 0; d < r._sounds.length; d++)
if (s === r._sounds[d]._id)
return r._sounds[d];
return null
},
_inactiveSound: function() {
var s = this;
s._drain();
for (var r = 0; r < s._sounds.length; r++)
if (s._sounds[r]._ended)
return s._sounds[r].reset();
return new n(s)
},
_drain: function() {
var s = this
, r = s._pool
, d = 0
, h = 0;
if (!(s._sounds.length < r)) {
for (h = 0; h < s._sounds.length; h++)
s._sounds[h]._ended && d++;
for (h = s._sounds.length - 1; h >= 0; h--) {
if (d <= r)
return;
s._sounds[h]._ended && (s._webAudio && s._sounds[h]._node && s._sounds[h]._node.disconnect(0),
s._sounds.splice(h, 1),
d--)
}
}
},
_getSoundIds: function(s) {
var r = this;
if (typeof s > "u") {
for (var d = [], h = 0; h < r._sounds.length; h++)
d.push(r._sounds[h]._id);
return d
} else
return [s]
},
_refreshBuffer: function(s) {
var r = this;
return s._node.bufferSource = t.ctx.createBufferSource(),
s._node.bufferSource.buffer = i[r._src],
s._panner ? s._node.bufferSource.connect(s._panner) : s._node.bufferSource.connect(s._node),
s._node.bufferSource.loop = s._loop,
s._loop && (s._node.bufferSource.loopStart = s._start || 0,
s._node.bufferSource.loopEnd = s._stop || 0),
s._node.bufferSource.playbackRate.setValueAtTime(s._rate, t.ctx.currentTime),
r
},
_cleanBuffer: function(s) {
var r = this
, d = t._navigator && t._navigator.vendor.indexOf("Apple") >= 0;
if (!s.bufferSource)
return r;
if (t._scratchBuffer && s.bufferSource && (s.bufferSource.onended = null,
s.bufferSource.disconnect(0),
d))
try {
s.bufferSource.buffer = t._scratchBuffer
} catch {}
return s.bufferSource = null,
r
},
_clearSound: function(s) {
var r = /MSIE |Trident\//.test(t._navigator && t._navigator.userAgent);
r || (s.src = "data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")
}
};
var n = function(s) {
this._parent = s,
this.init()
};
n.prototype = {
init: function() {
var s = this
, r = s._parent;
return s._muted = r._muted,
s._loop = r._loop,
s._volume = r._volume,
s._rate = r._rate,
s._seek = 0,
s._paused = !0,
s._ended = !0,
s._sprite = "__default",
s._id = ++t._counter,
r._sounds.push(s),
s.create(),
s
},
create: function() {
var s = this
, r = s._parent
, d = t._muted || s._muted || s._parent._muted ? 0 : s._volume;
return r._webAudio ? (s._node = typeof t.ctx.createGain > "u" ? t.ctx.createGainNode() : t.ctx.createGain(),
s._node.gain.setValueAtTime(d, t.ctx.currentTime),
s._node.paused = !0,
s._node.connect(t.masterGain)) : t.noAudio || (s._node = t._obtainHtml5Audio(),
s._errorFn = s._errorListener.bind(s),
s._node.addEventListener("error", s._errorFn, !1),
s._loadFn = s._loadListener.bind(s),
s._node.addEventListener(t._canPlayEvent, s._loadFn, !1),
s._endFn = s._endListener.bind(s),
s._node.addEventListener("ended", s._endFn, !1),
s._node.src = r._src,
s._node.preload = r._preload === !0 ? "auto" : r._preload,
s._node.volume = d * t.volume(),
s._node.load()),
s
},
reset: function() {
var s = this
, r = s._parent;
return s._muted = r._muted,
s._loop = r._loop,
s._volume = r._volume,
s._rate = r._rate,
s._seek = 0,
s._rateSeek = 0,
s._paused = !0,
s._ended = !0,
s._sprite = "__default",
s._id = ++t._counter,
s
},
_errorListener: function() {
var s = this;
s._parent._emit("loaderror", s._id, s._node.error ? s._node.error.code : 0),
s._node.removeEventListener("error", s._errorFn, !1)
},
_loadListener: function() {
var s = this
, r = s._parent;
r._duration = Math.ceil(s._node.duration * 10) / 10,
Object.keys(r._sprite).length === 0 && (r._sprite = {
__default: [0, r._duration * 1e3]
}),
r._state !== "loaded" && (r._state = "loaded",
r._emit("load"),
r._loadQueue()),
s._node.removeEventListener(t._canPlayEvent, s._loadFn, !1)
},
_endListener: function() {
var s = this
, r = s._parent;
r._duration === 1 / 0 && (r._duration = Math.ceil(s._node.duration * 10) / 10,
r._sprite.__default[1] === 1 / 0 && (r._sprite.__default[1] = r._duration * 1e3),
r._ended(s)),
s._node.removeEventListener("ended", s._endFn, !1)
}
};
var i = {}
, a = function(s) {
var r = s._src;
if (i[r]) {
s._duration = i[r].duration,
u(s);
return
}
if (/^data:[^;]+;base64,/.test(r)) {
for (var d = atob(r.split(",")[1]), h = new Uint8Array(d.length), b = 0; b < d.length; ++b)
h[b] = d.charCodeAt(b);
c(h.buffer, s)
} else {
var m = new XMLHttpRequest;
m.open(s._xhr.method, r, !0),
m.withCredentials = s._xhr.withCredentials,
m.responseType = "arraybuffer",
s._xhr.headers && Object.keys(s._xhr.headers).forEach(function(p) {
m.setRequestHeader(p, s._xhr.headers[p])
}),
m.onload = function() {
var p = (m.status + "")[0];
if (p !== "0" && p !== "2" && p !== "3") {
s._emit("loaderror", null, "Failed loading audio file with status: " + m.status + ".");
return
}
c(m.response, s)
}
,
m.onerror = function() {
s._webAudio && (s._html5 = !0,
s._webAudio = !1,
s._sounds = [],
delete i[r],
s.load())
}
,
l(m)
}
}
, l = function(s) {
try {
s.send()
} catch {
s.onerror()
}
}
, c = function(s, r) {
var d = function() {
r._emit("loaderror", null, "Decoding audio data failed.")
}
, h = function(b) {
b && r._sounds.length > 0 ? (i[r._src] = b,
u(r, b)) : d()
};
typeof Promise < "u" && t.ctx.decodeAudioData.length === 1 ? t.ctx.decodeAudioData(s).then(h).catch(d) : t.ctx.decodeAudioData(s, h, d)
}
, u = function(s, r) {
r && !s._duration && (s._duration = r.duration),
Object.keys(s._sprite).length === 0 && (s._sprite = {
__default: [0, s._duration * 1e3]
}),
s._state !== "loaded" && (s._state = "loaded",
s._emit("load"),
s._loadQueue())
}
, g = function() {
if (t.usingWebAudio) {
try {
typeof AudioContext < "u" ? t.ctx = new AudioContext : typeof webkitAudioContext < "u" ? t.ctx = new webkitAudioContext : t.usingWebAudio = !1
} catch {
t.usingWebAudio = !1
}
t.ctx || (t.usingWebAudio = !1);
var s = /iP(hone|od|ad)/.test(t._navigator && t._navigator.platform)
, r = t._navigator && t._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/)
, d = r ? parseInt(r[1], 10) : null;
if (s && d && d < 9) {
var h = /safari/.test(t._navigator && t._navigator.userAgent.toLowerCase());
t._navigator && !h && (t.usingWebAudio = !1)
}
t.usingWebAudio && (t.masterGain = typeof t.ctx.createGain > "u" ? t.ctx.createGainNode() : t.ctx.createGain(),
t.masterGain.gain.setValueAtTime(t._muted ? 0 : t._volume, t.ctx.currentTime),
t.masterGain.connect(t.ctx.destination)),
t._setup()
}
};
typeof define == "function" && define.amd && define([], function() {
return {
Howler: t,
Howl: e
}
}),
typeof Ge < "u" && (Ge.Howler = t,
Ge.Howl = e),
typeof global < "u" ? (global.HowlerGlobal = o,
global.Howler = t,
global.Howl = e,
global.Sound = n) : typeof window < "u" && (window.HowlerGlobal = o,
window.Howler = t,
window.Howl = e,
window.Sound = n)
}
)();
(function() {
"use strict";
HowlerGlobal.prototype._pos = [0, 0, 0],
HowlerGlobal.prototype._orientation = [0, 0, -1, 0, 1, 0],
HowlerGlobal.prototype.stereo = function(t) {
var e = this;
if (!e.ctx || !e.ctx.listener)
return e;
for (var n = e._howls.length - 1; n >= 0; n--)
e._howls[n].stereo(t);
return e
}
,
HowlerGlobal.prototype.pos = function(t, e, n) {
var i = this;
if (!i.ctx || !i.ctx.listener)
return i;
if (e = typeof e != "number" ? i._pos[1] : e,
n = typeof n != "number" ? i._pos[2] : n,
typeof t == "number")
i._pos = [t, e, n],
typeof i.ctx.listener.positionX < "u" ? (i.ctx.listener.positionX.setTargetAtTime(i._pos[0], Howler.ctx.currentTime, .1),
i.ctx.listener.positionY.setTargetAtTime(i._pos[1], Howler.ctx.currentTime, .1),
i.ctx.listener.positionZ.setTargetAtTime(i._pos[2], Howler.ctx.currentTime, .1)) : i.ctx.listener.setPosition(i._pos[0], i._pos[1], i._pos[2]);
else
return i._pos;
return i
}
,
HowlerGlobal.prototype.orientation = function(t, e, n, i, a, l) {
var c = this;
if (!c.ctx || !c.ctx.listener)
return c;
var u = c._orientation;
if (e = typeof e != "number" ? u[1] : e,
n = typeof n != "number" ? u[2] : n,
i = typeof i != "number" ? u[3] : i,
a = typeof a != "number" ? u[4] : a,
l = typeof l != "number" ? u[5] : l,
typeof t == "number")
c._orientation = [t, e, n, i, a, l],
typeof c.ctx.listener.forwardX < "u" ? (c.ctx.listener.forwardX.setTargetAtTime(t, Howler.ctx.currentTime, .1),
c.ctx.listener.forwardY.setTargetAtTime(e, Howler.ctx.currentTime, .1),
c.ctx.listener.forwardZ.setTargetAtTime(n, Howler.ctx.currentTime, .1),
c.ctx.listener.upX.setTargetAtTime(i, Howler.ctx.currentTime, .1),
c.ctx.listener.upY.setTargetAtTime(a, Howler.ctx.currentTime, .1),
c.ctx.listener.upZ.setTargetAtTime(l, Howler.ctx.currentTime, .1)) : c.ctx.listener.setOrientation(t, e, n, i, a, l);
else
return u;
return c
}
,
Howl.prototype.init = function(t) {
return function(e) {
var n = this;
return n._orientation = e.orientation || [1, 0, 0],
n._stereo = e.stereo || null,
n._pos = e.pos || null,
n._pannerAttr = {
coneInnerAngle: typeof e.coneInnerAngle < "u" ? e.coneInnerAngle : 360,
coneOuterAngle: typeof e.coneOuterAngle < "u" ? e.coneOuterAngle : 360,
coneOuterGain: typeof e.coneOuterGain < "u" ? e.coneOuterGain : 0,
distanceModel: typeof e.distanceModel < "u" ? e.distanceModel : "inverse",
maxDistance: typeof e.maxDistance < "u" ? e.maxDistance : 1e4,
panningModel: typeof e.panningModel < "u" ? e.panningModel : "HRTF",
refDistance: typeof e.refDistance < "u" ? e.refDistance : 1,
rolloffFactor: typeof e.rolloffFactor < "u" ? e.rolloffFactor : 1
},
n._onstereo = e.onstereo ? [{
fn: e.onstereo
}] : [],
n._onpos = e.onpos ? [{
fn: e.onpos
}] : [],
n._onorientation = e.onorientation ? [{
fn: e.onorientation
}] : [],
t.call(this, e)
}
}(Howl.prototype.init),
Howl.prototype.stereo = function(t, e) {
var n = this;
if (!n._webAudio)
return n;
if (n._state !== "loaded")
return n._queue.push({
event: "stereo",
action: function() {
n.stereo(t, e)
}
}),
n;
var i = typeof Howler.ctx.createStereoPanner > "u" ? "spatial" : "stereo";
if (typeof e > "u")
if (typeof t == "number")
n._stereo = t,
n._pos = [t, 0, 0];
else
return n._stereo;
for (var a = n._getSoundIds(e), l = 0; l < a.length; l++) {
var c = n._soundById(a[l]);
if (c)
if (typeof t == "number")
c._stereo = t,
c._pos = [t, 0, 0],
c._node && (c._pannerAttr.panningModel = "equalpower",
(!c._panner || !c._panner.pan) && o(c, i),
i === "spatial" ? typeof c._panner.positionX < "u" ? (c._panner.positionX.setValueAtTime(t, Howler.ctx.currentTime),
c._panner.positionY.setValueAtTime(0, Howler.ctx.currentTime),
c._panner.positionZ.setValueAtTime(0, Howler.ctx.currentTime)) : c._panner.setPosition(t, 0, 0) : c._panner.pan.setValueAtTime(t, Howler.ctx.currentTime)),
n._emit("stereo", c._id);
else
return c._stereo
}
return n
}
,
Howl.prototype.pos = function(t, e, n, i) {
var a = this;
if (!a._webAudio)
return a;
if (a._state !== "loaded")
return a._queue.push({
event: "pos",
action: function() {
a.pos(t, e, n, i)
}
}),
a;
if (e = typeof e != "number" ? 0 : e,
n = typeof n != "number" ? -.5 : n,
typeof i > "u")
if (typeof t == "number")
a._pos = [t, e, n];
else
return a._pos;
for (var l = a._getSoundIds(i), c = 0; c < l.length; c++) {
var u = a._soundById(l[c]);
if (u)
if (typeof t == "number")
u._pos = [t, e, n],
u._node && ((!u._panner || u._panner.pan) && o(u, "spatial"),
typeof u._panner.positionX < "u" ? (u._panner.positionX.setValueAtTime(t, Howler.ctx.currentTime),
u._panner.positionY.setValueAtTime(e, Howler.ctx.currentTime),
u._panner.positionZ.setValueAtTime(n, Howler.ctx.currentTime)) : u._panner.setPosition(t, e, n)),
a._emit("pos", u._id);
else
return u._pos
}
return a
}
,
Howl.prototype.orientation = function(t, e, n, i) {
var a = this;
if (!a._webAudio)
return a;
if (a._state !== "loaded")
return a._queue.push({
event: "orientation",
action: function() {
a.orientation(t, e, n, i)
}
}),
a;
if (e = typeof e != "number" ? a._orientation[1] : e,
n = typeof n != "number" ? a._orientation[2] : n,
typeof i > "u")
if (typeof t == "number")
a._orientation = [t, e, n];
else
return a._orientation;
for (var l = a._getSoundIds(i), c = 0; c < l.length; c++) {
var u = a._soundById(l[c]);
if (u)
if (typeof t == "number")
u._orientation = [t, e, n],
u._node && (u._panner || (u._pos || (u._pos = a._pos || [0, 0, -.5]),
o(u, "spatial")),
typeof u._panner.orientationX < "u" ? (u._panner.orientationX.setValueAtTime(t, Howler.ctx.currentTime),
u._panner.orientationY.setValueAtTime(e, Howler.ctx.currentTime),
u._panner.orientationZ.setValueAtTime(n, Howler.ctx.currentTime)) : u._panner.setOrientation(t, e, n)),
a._emit("orientation", u._id);
else
return u._orientation
}
return a
}
,
Howl.prototype.pannerAttr = function() {
var t = this, e = arguments, n, i, a;
if (!t._webAudio)
return t;
if (e.length === 0)
return t._pannerAttr;
if (e.length === 1)
if (typeof e[0] == "object")
n = e[0],
typeof i > "u" && (n.pannerAttr || (n.pannerAttr = {
coneInnerAngle: n.coneInnerAngle,
coneOuterAngle: n.coneOuterAngle,
coneOuterGain: n.coneOuterGain,
distanceModel: n.distanceModel,
maxDistance: n.maxDistance,
refDistance: n.refDistance,
rolloffFactor: n.rolloffFactor,
panningModel: n.panningModel
}),
t._pannerAttr = {
coneInnerAngle: typeof n.pannerAttr.coneInnerAngle < "u" ? n.pannerAttr.coneInnerAngle : t._coneInnerAngle,
coneOuterAngle: typeof n.pannerAttr.coneOuterAngle < "u" ? n.pannerAttr.coneOuterAngle : t._coneOuterAngle,
coneOuterGain: typeof n.pannerAttr.coneOuterGain < "u" ? n.pannerAttr.coneOuterGain : t._coneOuterGain,
distanceModel: typeof n.pannerAttr.distanceModel < "u" ? n.pannerAttr.distanceModel : t._distanceModel,
maxDistance: typeof n.pannerAttr.maxDistance < "u" ? n.pannerAttr.maxDistance : t._maxDistance,
refDistance: typeof n.pannerAttr.refDistance < "u" ? n.pannerAttr.refDistance : t._refDistance,
rolloffFactor: typeof n.pannerAttr.rolloffFactor < "u" ? n.pannerAttr.rolloffFactor : t._rolloffFactor,
panningModel: typeof n.pannerAttr.panningModel < "u" ? n.pannerAttr.panningModel : t._panningModel
});
else
return a = t._soundById(parseInt(e[0], 10)),
a ? a._pannerAttr : t._pannerAttr;
else
e.length === 2 && (n = e[0],
i = parseInt(e[1], 10));
for (var l = t._getSoundIds(i), c = 0; c < l.length; c++)
if (a = t._soundById(l[c]),
a) {
var u = a._pannerAttr;
u = {
coneInnerAngle: typeof n.coneInnerAngle < "u" ? n.coneInnerAngle : u.coneInnerAngle,
coneOuterAngle: typeof n.coneOuterAngle < "u" ? n.coneOuterAngle : u.coneOuterAngle,
coneOuterGain: typeof n.coneOuterGain < "u" ? n.coneOuterGain : u.coneOuterGain,
distanceModel: typeof n.distanceModel < "u" ? n.distanceModel : u.distanceModel,
maxDistance: typeof n.maxDistance < "u" ? n.maxDistance : u.maxDistance,
refDistance: typeof n.refDistance < "u" ? n.refDistance : u.refDistance,
rolloffFactor: typeof n.rolloffFactor < "u" ? n.rolloffFactor : u.rolloffFactor,
panningModel: typeof n.panningModel < "u" ? n.panningModel : u.panningModel
};
var g = a._panner;
g || (a._pos || (a._pos = t._pos || [0, 0, -.5]),
o(a, "spatial"),
g = a._panner),
g.coneInnerAngle = u.coneInnerAngle,
g.coneOuterAngle = u.coneOuterAngle,
g.coneOuterGain = u.coneOuterGain,
g.distanceModel = u.distanceModel,
g.maxDistance = u.maxDistance,
g.refDistance = u.refDistance,
g.rolloffFactor = u.rolloffFactor,
g.panningModel = u.panningModel
}
return t
}
,
Sound.prototype.init = function(t) {
return function() {
var e = this
, n = e._parent;
e._orientation = n._orientation,
e._stereo = n._stereo,
e._pos = n._pos,
e._pannerAttr = n._pannerAttr,
t.call(this),
e._stereo ? n.stereo(e._stereo) : e._pos && n.pos(e._pos[0], e._pos[1], e._pos[2], e._id)
}
}(Sound.prototype.init),
Sound.prototype.reset = function(t) {
return function() {
var e = this
, n = e._parent;
return e._orientation = n._orientation,
e._stereo = n._stereo,
e._pos = n._pos,
e._pannerAttr = n._pannerAttr,
e._stereo ? n.stereo(e._stereo) : e._pos ? n.pos(e._pos[0], e._pos[1], e._pos[2], e._id) : e._panner && (e._panner.disconnect(0),
e._panner = void 0,
n._refreshBuffer(e)),
t.call(this)
}
}(Sound.prototype.reset);
var o = function(t, e) {
e = e || "spatial",
e === "spatial" ? (t._panner = Howler.ctx.createPanner(),
t._panner.coneInnerAngle = t._pannerAttr.coneInnerAngle,
t._panner.coneOuterAngle = t._pannerAttr.coneOuterAngle,
t._panner.coneOuterGain = t._pannerAttr.coneOuterGain,
t._panner.distanceModel = t._pannerAttr.distanceModel,
t._panner.maxDistance = t._pannerAttr.maxDistance,
t._panner.refDistance = t._pannerAttr.refDistance,
t._panner.rolloffFactor = t._pannerAttr.rolloffFactor,
t._panner.panningModel = t._pannerAttr.panningModel,
typeof t._panner.positionX < "u" ? (t._panner.positionX.setValueAtTime(t._pos[0], Howler.ctx.currentTime),
t._panner.positionY.setValueAtTime(t._pos[1], Howler.ctx.currentTime),
t._panner.positionZ.setValueAtTime(t._pos[2], Howler.ctx.currentTime)) : t._panner.setPosition(t._pos[0], t._pos[1], t._pos[2]),
typeof t._panner.orientationX < "u" ? (t._panner.orientationX.setValueAtTime(t._orientation[0], Howler.ctx.currentTime),
t._panner.orientationY.setValueAtTime(t._orientation[1], Howler.ctx.currentTime),
t._panner.orientationZ.setValueAtTime(t._orientation[2], Howler.ctx.currentTime)) : t._panner.setOrientation(t._orientation[0], t._orientation[1], t._orientation[2])) : (t._panner = Howler.ctx.createStereoPanner(),
t._panner.pan.setValueAtTime(t._stereo, Howler.ctx.currentTime)),
t._panner.connect(t._node),
t._paused || t._parent.pause(t._id, !0).play(t._id, !0)
}
}
)()
}
);
var bo = ni( (go, Pn) => {
(function(o) {
typeof go == "object" && typeof Pn < "u" ? Pn.exports = o() : typeof define == "function" && define.amd ? define([], o) : (typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : this).basicScroll = o()
}
)(function() {
return function o(t, e, n) {
function i(c, u) {
if (!e[c]) {
if (!t[c]) {
var g = typeof Ct == "function" && Ct;
if (!u && g)
return g(c, !0);
if (a)
return a(c, !0);
var s = new Error("Cannot find module '" + c + "'");
throw s.code = "MODULE_NOT_FOUND",
s
}
var r = e[c] = {
exports: {}
};
t[c][0].call(r.exports, function(d) {
return i(t[c][1][d] || d)
}, r, r.exports, o, t, e, n)
}
return e[c].exports
}
for (var a = typeof Ct == "function" && Ct, l = 0; l < n.length; l++)
i(n[l]);
return i
}({
1: [function(o, t, e) {
t.exports = function(n) {
var i = 2.5949095;
return (n *= 2) < 1 ? n * n * ((i + 1) * n - i) * .5 : .5 * ((n -= 2) * n * ((i + 1) * n + i) + 2)
}
}
, {}],
2: [function(o, t, e) {
t.exports = function(n) {
var i = 1.70158;
return n * n * ((i + 1) * n - i)
}
}
, {}],
3: [function(o, t, e) {
t.exports = function(n) {
var i = 1.70158;
return --n * n * ((i + 1) * n + i) + 1
}
}
, {}],
4: [function(o, t, e) {
var n = o("./bounce-out");
t.exports = function(i) {
return i < .5 ? .5 * (1 - n(1 - 2 * i)) : .5 * n(2 * i - 1) + .5
}
}
, {
"./bounce-out": 6
}],
5: [function(o, t, e) {
var n = o("./bounce-out");
t.exports = function(i) {
return 1 - n(1 - i)
}
}
, {
"./bounce-out": 6
}],
6: [function(o, t, e) {
t.exports = function(n) {
var i = n * n;
return n < 4 / 11 ? 7.5625 * i : n < 8 / 11 ? 9.075 * i - 9.9 * n + 3.4 : n < .9 ? 4356 / 361 * i - 35442 / 1805 * n + 16061 / 1805 : 10.8 * n * n - 20.52 * n + 10.72
}
}
, {}],
7: [function(o, t, e) {
t.exports = function(n) {
return (n *= 2) < 1 ? -.5 * (Math.sqrt(1 - n * n) - 1) : .5 * (Math.sqrt(1 - (n -= 2) * n) + 1)
}
}
, {}],
8: [function(o, t, e) {
t.exports = function(n) {
return 1 - Math.sqrt(1 - n * n)
}
}
, {}],
9: [function(o, t, e) {
t.exports = function(n) {
return Math.sqrt(1 - --n * n)
}
}
, {}],
10: [function(o, t, e) {
t.exports = function(n) {
return n < .5 ? 4 * n * n * n : .5 * Math.pow(2 * n - 2, 3) + 1
}
}
, {}],
11: [function(o, t, e) {
t.exports = function(n) {
return n * n * n
}
}
, {}],
12: [function(o, t, e) {
t.exports = function(n) {
var i = n - 1;
return i * i * i + 1
}
}
, {}],
13: [function(o, t, e) {
t.exports = function(n) {
return n < .5 ? .5 * Math.sin(13 * Math.PI / 2 * 2 * n) * Math.pow(2, 10 * (2 * n - 1)) : .5 * Math.sin(-13 * Math.PI / 2 * (2 * n - 1 + 1)) * Math.pow(2, -10 * (2 * n - 1)) + 1
}
}
, {}],
14: [function(o, t, e) {
t.exports = function(n) {
return Math.sin(13 * n * Math.PI / 2) * Math.pow(2, 10 * (n - 1))
}
}
, {}],
15: [function(o, t, e) {
t.exports = function(n) {
return Math.sin(-13 * (n + 1) * Math.PI / 2) * Math.pow(2, -10 * n) + 1
}
}
, {}],
16: [function(o, t, e) {
t.exports = function(n) {
return n === 0 || n === 1 ? n : n < .5 ? .5 * Math.pow(2, 20 * n - 10) : -.5 * Math.pow(2, 10 - 20 * n) + 1
}
}
, {}],
17: [function(o, t, e) {
t.exports = function(n) {
return n === 0 ? n : Math.pow(2, 10 * (n - 1))
}
}
, {}],
18: [function(o, t, e) {
t.exports = function(n) {
return n === 1 ? n : 1 - Math.pow(2, -10 * n)
}
}
, {}],
19: [function(o, t, e) {
t.exports = {
backInOut: o("./back-in-out"),
backIn: o("./back-in"),
backOut: o("./back-out"),
bounceInOut: o("./bounce-in-out"),
bounceIn: o("./bounce-in"),
bounceOut: o("./bounce-out"),
circInOut: o("./circ-in-out"),
circIn: o("./circ-in"),
circOut: o("./circ-out"),
cubicInOut: o("./cubic-in-out"),
cubicIn: o("./cubic-in"),
cubicOut: o("./cubic-out"),
elasticInOut: o("./elastic-in-out"),
elasticIn: o("./elastic-in"),
elasticOut: o("./elastic-out"),
expoInOut: o("./expo-in-out"),
expoIn: o("./expo-in"),
expoOut: o("./expo-out"),
linear: o("./linear"),
quadInOut: o("./quad-in-out"),
quadIn: o("./quad-in"),
quadOut: o("./quad-out"),
quartInOut: o("./quart-in-out"),
quartIn: o("./quart-in"),
quartOut: o("./quart-out"),
quintInOut: o("./quint-in-out"),
quintIn: o("./quint-in"),
quintOut: o("./quint-out"),
sineInOut: o("./sine-in-out"),
sineIn: o("./sine-in"),
sineOut: o("./sine-out")
}
}
, {
"./back-in": 2,
"./back-in-out": 1,
"./back-out": 3,
"./bounce-in": 5,
"./bounce-in-out": 4,
"./bounce-out": 6,
"./circ-in": 8,
"./circ-in-out": 7,
"./circ-out": 9,
"./cubic-in": 11,
"./cubic-in-out": 10,
"./cubic-out": 12,
"./elastic-in": 14,
"./elastic-in-out": 13,
"./elastic-out": 15,
"./expo-in": 17,
"./expo-in-out": 16,
"./expo-out": 18,
"./linear": 20,
"./quad-in": 22,
"./quad-in-out": 21,
"./quad-out": 23,
"./quart-in": 25,
"./quart-in-out": 24,
"./quart-out": 26,
"./quint-in": 28,
"./quint-in-out": 27,
"./quint-out": 29,
"./sine-in": 31,
"./sine-in-out": 30,
"./sine-out": 32
}],
20: [function(o, t, e) {
t.exports = function(n) {
return n
}
}
, {}],
21: [function(o, t, e) {
t.exports = function(n) {
return (n /= .5) < 1 ? .5 * n * n : -.5 * (--n * (n - 2) - 1)
}
}
, {}],
22: [function(o, t, e) {
t.exports = function(n) {
return n * n
}
}
, {}],
23: [function(o, t, e) {
t.exports = function(n) {
return -n * (n - 2)
}
}
, {}],
24: [function(o, t, e) {
t.exports = function(n) {
return n < .5 ? 8 * Math.pow(n, 4) : -8 * Math.pow(n - 1, 4) + 1
}
}
, {}],
25: [function(o, t, e) {
t.exports = function(n) {
return Math.pow(n, 4)
}
}
, {}],
26: [function(o, t, e) {
t.exports = function(n) {
return Math.pow(n - 1, 3) * (1 - n) + 1
}
}
, {}],
27: [function(o, t, e) {
t.exports = function(n) {
return (n *= 2) < 1 ? .5 * n * n * n * n * n : .5 * ((n -= 2) * n * n * n * n + 2)
}
}
, {}],
28: [function(o, t, e) {
t.exports = function(n) {
return n * n * n * n * n
}
}
, {}],
29: [function(o, t, e) {
t.exports = function(n) {
return --n * n * n * n * n + 1
}
}
, {}],
30: [function(o, t, e) {
t.exports = function(n) {
return -.5 * (Math.cos(Math.PI * n) - 1)
}
}
, {}],
31: [function(o, t, e) {
t.exports = function(n) {
var i = Math.cos(n * Math.PI * .5);
return Math.abs(i) < 1e-14 ? 1 : 1 - i
}
}
, {}],
32: [function(o, t, e) {
t.exports = function(n) {
return Math.sin(n * Math.PI / 2)
}
}
, {}],
33: [function(o, t, e) {
t.exports = function(n, i) {
i || (i = [0, ""]),
n = String(n);
var a = parseFloat(n, 10);
return i[0] = a,
i[1] = n.match(/[\d.\-\+]*\s*(.*)/)[1] || "",
i
}
}
, {}],
34: [function(o, t, e) {
"use strict";
Object.defineProperty(e, "__esModule", {
value: !0
}),
e.create = void 0;
var n = a(o("parse-unit"))
, i = a(o("eases"));
function a(I) {
return I && I.__esModule ? I : {
default: I
}
}
function l(I) {
return (l = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(w) {
return typeof w
}
: function(w) {
return w && typeof Symbol == "function" && w.constructor === Symbol && w !== Symbol.prototype ? "symbol" : typeof w
}
)(I)
}
var c, u, g, s = [], r = typeof window < "u", d = function() {
return (document.scrollingElement || document.documentElement).scrollTop
}, h = function() {
return window.innerHeight || window.outerHeight
}, b = function(I) {
return isNaN((0,
n.default)(I)[0]) === !1
}, m = function(I) {
var w = (0,
n.default)(I);
return {
value: w[0],
unit: w[1]
}
}, p = function(I) {
return String(I).match(/^[a-z]+-[a-z]+$/) !== null
}, Q = function(I, w) {
return I === !0 ? w.elem : I instanceof HTMLElement ? w.direct : w.global
}, f = function(I, w) {
var y = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : d()
, C = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : h()
, E = w.getBoundingClientRect()
, v = I.match(/^[a-z]+/)[0]
, X = I.match(/[a-z]+$/)[0]
, O = 0;
return X === "top" && (O -= 0),
X === "middle" && (O -= C / 2),
X === "bottom" && (O -= C),
v === "top" && (O += E.top + y),
v === "middle" && (O += E.top + y + E.height / 2),
v === "bottom" && (O += E.top + y + E.height),
"".concat(O, "px")
}, B = function(I) {
var w = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : d()
, y = I.getData()
, C = y.to.value - y.from.value
, E = w - y.from.value
, v = E / (C / 100)
, X = Math.min(Math.max(v, 0), 100)
, O = Q(y.direct, {
global: document.documentElement,
elem: y.elem,
direct: y.direct
})
, L = Object.keys(y.props).reduce(function(Jt, Ht) {
var lt = y.props[Ht]
, Pt = lt.from.unit || lt.to.unit
, po = lt.from.value - lt.to.value
, Qo = lt.timing(X / 100)
, fo = lt.from.value - po * Qo
, Fo = Math.round(1e4 * fo) / 1e4;
return Jt[Ht] = Fo + Pt,
Jt
}, {})
, z = v >= 0 && v <= 100
, je = v < 0 || v > 100;
return z === !0 && y.inside(I, v, L),
je === !0 && y.outside(I, v, L),
{
elem: O,
props: L
}
}, x = function(I, w) {
Object.keys(w).forEach(function(y) {
return function(C, E) {
C.style.setProperty(E.key, E.value)
}(I, {
key: y,
value: w[y]
})
})
};
e.create = function(I) {
var w = null
, y = !1
, C = {
isActive: function() {
return y
},
getData: function() {
return w
},
calculate: function() {
w = function() {
var v = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
if ((v = Object.assign({}, v)).inside == null && (v.inside = function() {}
),
v.outside == null && (v.outside = function() {}
),
v.direct == null && (v.direct = !1),
v.track == null && (v.track = !0),
v.props == null && (v.props = {}),
v.from == null)
throw new Error("Missing property `from`");
if (v.to == null)
throw new Error("Missing property `to`");
if (typeof v.inside != "function")
throw new Error("Property `inside` must be undefined or a function");
if (typeof v.outside != "function")
throw new Error("Property `outside` must be undefined or a function");
if (typeof v.direct != "boolean" && v.direct instanceof HTMLElement == 0)
throw new Error("Property `direct` must be undefined, a boolean or a DOM element/node");
if (v.direct === !0 && v.elem == null)
throw new Error("Property `elem` is required when `direct` is true");
if (typeof v.track != "boolean")
throw new Error("Property `track` must be undefined or a boolean");
if (l(v.props) !== "object")
throw new Error("Property `props` must be undefined or an object");
if (v.elem == null) {
if (b(v.from) === !1)
throw new Error("Property `from` must be a absolute value when no `elem` has been provided");
if (b(v.to) === !1)
throw new Error("Property `to` must be a absolute value when no `elem` has been provided")
} else
p(v.from) === !0 && (v.from = f(v.from, v.elem)),
p(v.to) === !0 && (v.to = f(v.to, v.elem));
return v.from = m(v.from),
v.to = m(v.to),
v.props = Object.keys(v.props).reduce(function(X, O) {
var L = Object.assign({}, v.props[O]);
if (b(L.from) === !1)
throw new Error("Property `from` of prop must be a absolute value");
if (b(L.to) === !1)
throw new Error("Property `from` of prop must be a absolute value");
if (L.from = m(L.from),
L.to = m(L.to),
L.timing == null && (L.timing = i.default.linear),
typeof L.timing != "string" && typeof L.timing != "function")
throw new Error("Property `timing` of prop must be undefined, a string or a function");
if (typeof L.timing == "string" && i.default[L.timing] == null)
throw new Error("Unknown timing for property `timing` of prop");
return typeof L.timing == "string" && (L.timing = i.default[L.timing]),
X[O] = L,
X
}, {}),
v
}(I)
},
update: function() {
var v = B(C)
, X = v.elem
, O = v.props;
return x(X, O),
O
},
start: function() {
y = !0
},
stop: function() {
y = !1
},
destroy: function() {
s[E] = void 0
}
}
, E = s.push(C) - 1;
return C.calculate(),
C
}
,
r === !0 ? (function I(w, y) {
var C = function() {
requestAnimationFrame(function() {
return I(w, y)
})
}
, E = function(X) {
return X.filter(function(O) {
return O != null && O.isActive()
})
}(s);
if (E.length === 0)
return C();
var v = d();
if (y === v)
return C();
y = v,
E.map(function(X) {
return B(X, v)
}).forEach(function(X) {
var O = X.elem
, L = X.props;
return x(O, L)
}),
C()
}(),
window.addEventListener("resize", (c = function() {
(function(I) {
return I.filter(function(w) {
return w != null && w.getData().track
})
}
)(s).forEach(function(I) {
I.calculate(),
I.update()
})
}
,
u = 50,
g = null,
function() {
for (var I = arguments.length, w = new Array(I), y = 0; y < I; y++)
w[y] = arguments[y];
clearTimeout(g),
g = setTimeout(function() {
return c.apply(void 0, w)
}, u)
}
))) : console.warn("basicScroll is not executing because you are using it in an environment without a `window` object")
}
, {
eases: 19,
"parse-unit": 33
}]
}, {}, [34])(34)
})
}
);
var Re = class {
constructor(t, e, n) {
this.eventTarget = t,
this.eventName = e,
this.eventOptions = n,
this.unorderedBindings = new Set
}
connect() {
this.eventTarget.addEventListener(this.eventName, this, this.eventOptions)
}
disconnect() {
this.eventTarget.removeEventListener(this.eventName, this, this.eventOptions)
}
bindingConnected(t) {
this.unorderedBindings.add(t)
}
bindingDisconnected(t) {
this.unorderedBindings.delete(t)
}
handleEvent(t) {
let e = wo(t);
for (let n of this.bindings) {
if (e.immediatePropagationStopped)
break;
n.handleEvent(e)
}
}
hasBindings() {
return this.unorderedBindings.size > 0
}
get bindings() {
return Array.from(this.unorderedBindings).sort( (t, e) => {
let n = t.index
, i = e.index;
return n < i ? -1 : n > i ? 1 : 0
}
)
}
}
;
function wo(o) {
if ("immediatePropagationStopped"in o)
return o;
{
let {stopImmediatePropagation: t} = o;
return Object.assign(o, {
immediatePropagationStopped: !1,
stopImmediatePropagation() {
this.immediatePropagationStopped = !0,
t.call(this)
}
})
}
}
var ke = class {
constructor(t) {
this.application = t,
this.eventListenerMaps = new Map,
this.started = !1
}
start() {
this.started || (this.started = !0,
this.eventListeners.forEach(t => t.connect()))
}
stop() {
this.started && (this.started = !1,
this.eventListeners.forEach(t => t.disconnect()))
}
get eventListeners() {
return Array.from(this.eventListenerMaps.values()).reduce( (t, e) => t.concat(Array.from(e.values())), [])
}
bindingConnected(t) {
this.fetchEventListenerForBinding(t).bindingConnected(t)
}
bindingDisconnected(t, e=!1) {
this.fetchEventListenerForBinding(t).bindingDisconnected(t),
e && this.clearEventListenersForBinding(t)
}
handleError(t, e, n={}) {
this.application.handleError(t, `Error ${e}`, n)
}
clearEventListenersForBinding(t) {
let e = this.fetchEventListenerForBinding(t);
e.hasBindings() || (e.disconnect(),
this.removeMappedEventListenerFor(t))
}
removeMappedEventListenerFor(t) {
let {eventTarget: e, eventName: n, eventOptions: i} = t
, a = this.fetchEventListenerMapForEventTarget(e)
, l = this.cacheKey(n, i);
a.delete(l),
a.size == 0 && this.eventListenerMaps.delete(e)
}
fetchEventListenerForBinding(t) {
let {eventTarget: e, eventName: n, eventOptions: i} = t;
return this.fetchEventListener(e, n, i)
}
fetchEventListener(t, e, n) {
let i = this.fetchEventListenerMapForEventTarget(t)
, a = this.cacheKey(e, n)
, l = i.get(a);
return l || (l = this.createEventListener(t, e, n),
i.set(a, l)),
l
}
createEventListener(t, e, n) {
let i = new Re(t,e,n);
return this.started && i.connect(),
i
}
fetchEventListenerMapForEventTarget(t) {
let e = this.eventListenerMaps.get(t);
return e || (e = new Map,
this.eventListenerMaps.set(t, e)),
e
}
cacheKey(t, e) {
let n = [t];
return Object.keys(e).sort().forEach(i => {
n.push(`${e[i] ? "" : "!"}${i}`)
}
),
n.join(":")
}
}
, Lo = {
stop({event: o, value: t}) {
return t && o.stopPropagation(),
!0
},
prevent({event: o, value: t}) {
return t && o.preventDefault(),
!0
},
self({event: o, value: t, element: e}) {
return t ? e === o.target : !0
}
}
, Ao = /^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;
function Mo(o) {
let e = o.trim().match(Ao) || []
, n = e[2]
, i = e[3];
return i && !["keydown", "keyup", "keypress"].includes(n) && (n += `.${i}`,
i = ""),
{
eventTarget: Wo(e[4]),
eventName: n,
eventOptions: e[7] ? Go(e[7]) : {},
identifier: e[5],
methodName: e[6],
keyFilter: e[1] || i
}
}
function Wo(o) {
if (o == "window")
return window;
if (o == "document")
return document
}
function Go(o) {
return o.split(":").reduce( (t, e) => Object.assign(t, {
[e.replace(/^!/, "")]: !/^!/.test(e)
}), {})
}
function Oo(o) {
if (o == window)
return "window";
if (o == document)
return "document"
}
function dn(o) {
return o.replace(/(?:[_-])([a-z0-9])/g, (t, e) => e.toUpperCase())
}
function Ve(o) {
return dn(o.replace(/--/g, "-").replace(/__/g, "_"))
}
function Lt(o) {
return o.charAt(0).toUpperCase() + o.slice(1)
}
function hi(o) {
return o.replace(/([A-Z])/g, (t, e) => `-${e.toLowerCase()}`)
}
function Zo(o) {
return o.match(/[^\s]+/g) || []
}
function ii(o) {
return o != null
}
function Ye(o, t) {
return Object.prototype.hasOwnProperty.call(o, t)
}
var oi = ["meta", "ctrl", "alt", "shift"]
, Se = class {
constructor(t, e, n, i) {
this.element = t,
this.index = e,
this.eventTarget = n.eventTarget || t,
this.eventName = n.eventName || Do(t) || qt("missing event name"),
this.eventOptions = n.eventOptions || {},
this.identifier = n.identifier || qt("missing identifier"),
this.methodName = n.methodName || qt("missing method name"),
this.keyFilter = n.keyFilter || "",
this.schema = i
}
static forToken(t, e) {
return new this(t.element,t.index,Mo(t.content),e)
}
toString() {
let t = this.keyFilter ? `.${this.keyFilter}` : ""
, e = this.eventTargetName ? `@${this.eventTargetName}` : "";
return `${this.eventName}${t}${e}->${this.identifier}#${this.methodName}`
}
shouldIgnoreKeyboardEvent(t) {
if (!this.keyFilter)
return !1;
let e = this.keyFilter.split("+");
if (this.keyFilterDissatisfied(t, e))
return !0;
let n = e.filter(i => !oi.includes(i))[0];
return n ? (Ye(this.keyMappings, n) || qt(`contains unknown key filter: ${this.keyFilter}`),
this.keyMappings[n].toLowerCase() !== t.key.toLowerCase()) : !1
}
shouldIgnoreMouseEvent(t) {
if (!this.keyFilter)
return !1;
let e = [this.keyFilter];
return !!this.keyFilterDissatisfied(t, e)
}
get params() {
let t = {}
, e = new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");
for (let {name: n, value: i} of Array.from(this.element.attributes)) {
let a = n.match(e)
, l = a && a[1];
l && (t[dn(l)] = Xo(i))
}
return t
}
get eventTargetName() {
return Oo(this.eventTarget)
}
get keyMappings() {
return this.schema.keyMappings
}
keyFilterDissatisfied(t, e) {
let[n,i,a,l] = oi.map(c => e.includes(c));
return t.metaKey !== n || t.ctrlKey !== i || t.altKey !== a || t.shiftKey !== l
}
}
, si = {
a: () => "click",
button: () => "click",
form: () => "submit",
details: () => "toggle",
input: o => o.getAttribute("type") == "submit" ? "click" : "input",
select: () => "change",
textarea: () => "input"
};
function Do(o) {
let t = o.tagName.toLowerCase();
if (t in si)
return si[t](o)
}
function qt(o) {
throw new Error(o)
}
function Xo(o) {
try {
return JSON.parse(o)
} catch {
return o
}
}
var Te = class {
constructor(t, e) {
this.context = t,
this.action = e
}
get index() {
return this.action.index
}
get eventTarget() {
return this.action.eventTarget
}
get eventOptions() {
return this.action.eventOptions
}
get identifier() {
return this.context.identifier
}
handleEvent(t) {
let e = this.prepareActionEvent(t);
this.willBeInvokedByEvent(t) && this.applyEventModifiers(e) && this.invokeWithEvent(e)
}
get eventName() {
return this.action.eventName
}
get method() {
let t = this.controller[this.methodName];
if (typeof t == "function")
return t;
throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)
}
applyEventModifiers(t) {
let {element: e} = this.action
, {actionDescriptorFilters: n} = this.context.application
, {controller: i} = this.context
, a = !0;
for (let[l,c] of Object.entries(this.eventOptions))
if (l in n) {
let u = n[l];
a = a && u({
name: l,
value: c,
event: t,
element: e,
controller: i
})
} else
continue;
return a
}
prepareActionEvent(t) {
return Object.assign(t, {
params: this.action.params
})
}
invokeWithEvent(t) {
let {target: e, currentTarget: n} = t;
try {
this.method.call(this.controller, t),
this.context.logDebugActivity(this.methodName, {
event: t,
target: e,
currentTarget: n,
action: this.methodName
})
} catch (i) {
let {identifier: a, controller: l, element: c, index: u} = this
, g = {
identifier: a,
controller: l,
element: c,
index: u,
event: t
};
this.context.handleError(i, `invoking action "${this.action}"`, g)
}
}
willBeInvokedByEvent(t) {
let e = t.target;
return t instanceof KeyboardEvent && this.action.shouldIgnoreKeyboardEvent(t) || t instanceof MouseEvent && this.action.shouldIgnoreMouseEvent(t) ? !1 : this.element === e ? !0 : e instanceof Element && this.element.contains(e) ? this.scope.containsElement(e) : this.scope.containsElement(this.action.element)
}
get controller() {
return this.context.controller
}
get methodName() {
return this.action.methodName
}
get element() {
return this.scope.element
}
get scope() {
return this.context.scope
}
}
, te = class {
constructor(t, e) {
this.mutationObserverInit = {
attributes: !0,
childList: !0,
subtree: !0
},
this.element = t,
this.started = !1,
this.delegate = e,
this.elements = new Set,
this.mutationObserver = new MutationObserver(n => this.processMutations(n))
}
start() {
this.started || (this.started = !0,
this.mutationObserver.observe(this.element, this.mutationObserverInit),
this.refresh())
}
pause(t) {
this.started && (this.mutationObserver.disconnect(),
this.started = !1),
t(),
this.started || (this.mutationObserver.observe(this.element, this.mutationObserverInit),
this.started = !0)
}
stop() {
this.started && (this.mutationObserver.takeRecords(),
this.mutationObserver.disconnect(),
this.started = !1)
}
refresh() {
if (this.started) {
let t = new Set(this.matchElementsInTree());
for (let e of Array.from(this.elements))
t.has(e) || this.removeElement(e);
for (let e of Array.from(t))
this.addElement(e)
}
}
processMutations(t) {
if (this.started)
for (let e of t)
this.processMutation(e)
}
processMutation(t) {
t.type == "attributes" ? this.processAttributeChange(t.target, t.attributeName) : t.type == "childList" && (this.processRemovedNodes(t.removedNodes),
this.processAddedNodes(t.addedNodes))
}
processAttributeChange(t, e) {
this.elements.has(t) ? this.delegate.elementAttributeChanged && this.matchElement(t) ? this.delegate.elementAttributeChanged(t, e) : this.removeElement(t) : this.matchElement(t) && this.addElement(t)
}
processRemovedNodes(t) {
for (let e of Array.from(t)) {
let n = this.elementFromNode(e);
n && this.processTree(n, this.removeElement)
}
}
processAddedNodes(t) {
for (let e of Array.from(t)) {
let n = this.elementFromNode(e);
n && this.elementIsActive(n) && this.processTree(n, this.addElement)
}
}
matchElement(t) {
return this.delegate.matchElement(t)
}
matchElementsInTree(t=this.element) {
return this.delegate.matchElementsInTree(t)
}
processTree(t, e) {
for (let n of this.matchElementsInTree(t))
e.call(this, n)
}
elementFromNode(t) {
if (t.nodeType == Node.ELEMENT_NODE)
return t
}
elementIsActive(t) {
return t.isConnected != this.element.isConnected ? !1 : this.element.contains(t)
}
addElement(t) {
this.elements.has(t) || this.elementIsActive(t) && (this.elements.add(t),
this.delegate.elementMatched && this.delegate.elementMatched(t))
}
removeElement(t) {
this.elements.has(t) && (this.elements.delete(t),
this.delegate.elementUnmatched && this.delegate.elementUnmatched(t))
}
}
, ee = class {
constructor(t, e, n) {
this.attributeName = e,
this.delegate = n,
this.elementObserver = new te(t,this)
}
get element() {
return this.elementObserver.element
}
get selector() {
return `[${this.attributeName}]`
}
start() {
this.elementObserver.start()
}
pause(t) {
this.elementObserver.pause(t)
}
stop() {
this.elementObserver.stop()
}
refresh() {
this.elementObserver.refresh()
}
get started() {
return this.elementObserver.started
}
matchElement(t) {
return t.hasAttribute(this.attributeName)
}
matchElementsInTree(t) {
let e = this.matchElement(t) ? [t] : []
, n = Array.from(t.querySelectorAll(this.selector));
return e.concat(n)
}
elementMatched(t) {
this.delegate.elementMatchedAttribute && this.delegate.elementMatchedAttribute(t, this.attributeName)
}
elementUnmatched(t) {
this.delegate.elementUnmatchedAttribute && this.delegate.elementUnmatchedAttribute(t, this.attributeName)
}
elementAttributeChanged(t, e) {
this.delegate.elementAttributeValueChanged && this.attributeName == e && this.delegate.elementAttributeValueChanged(t, e)
}
}
;
function Eo(o, t, e) {
gi(o, t).add(e)
}
function No(o, t, e) {
gi(o, t).delete(e),
jo(o, t)
}
function gi(o, t) {
let e = o.get(t);
return e || (e = new Set,
o.set(t, e)),
e
}
function jo(o, t) {
let e = o.get(t);
e != null && e.size == 0 && o.delete(t)
}
var it = class {
constructor() {
this.valuesByKey = new Map
}
get keys() {
return Array.from(this.valuesByKey.keys())
}
get values() {
return Array.from(this.valuesByKey.values()).reduce( (e, n) => e.concat(Array.from(n)), [])
}
get size() {
return Array.from(this.valuesByKey.values()).reduce( (e, n) => e + n.size, 0)
}
add(t, e) {
Eo(this.valuesByKey, t, e)
}
delete(t, e) {
No(this.valuesByKey, t, e)
}
has(t, e) {
let n = this.valuesByKey.get(t);
return n != null && n.has(e)
}
hasKey(t) {
return this.valuesByKey.has(t)
}
hasValue(t) {
return Array.from(this.valuesByKey.values()).some(n => n.has(t))
}
getValuesForKey(t) {
let e = this.valuesByKey.get(t);
return e ? Array.from(e) : []
}
getKeysForValue(t) {
return Array.from(this.valuesByKey).filter( ([e,n]) => n.has(t)).map( ([e,n]) => e)
}
}
;
var ze = class {
constructor(t, e, n, i) {
this._selector = e,
this.details = i,
this.elementObserver = new te(t,this),
this.delegate = n,
this.matchesByElement = new it
}
get started() {
return this.elementObserver.started
}
get selector() {
return this._selector
}
set selector(t) {
this._selector = t,
this.refresh()
}
start() {
this.elementObserver.start()
}
pause(t) {
this.elementObserver.pause(t)
}
stop() {
this.elementObserver.stop()
}
refresh() {
this.elementObserver.refresh()
}
get element() {
return this.elementObserver.element
}
matchElement(t) {
let {selector: e} = this;
if (e) {
let n = t.matches(e);
return this.delegate.selectorMatchElement ? n && this.delegate.selectorMatchElement(t, this.details) : n
} else
return !1
}
matchElementsInTree(t) {
let {selector: e} = this;
if (e) {
let n = this.matchElement(t) ? [t] : []
, i = Array.from(t.querySelectorAll(e)).filter(a => this.matchElement(a));
return n.concat(i)
} else
return []
}
elementMatched(t) {
let {selector: e} = this;
e && this.selectorMatched(t, e)
}
elementUnmatched(t) {
let e = this.matchesByElement.getKeysForValue(t);
for (let n of e)
this.selectorUnmatched(t, n)
}
elementAttributeChanged(t, e) {
let {selector: n} = this;
if (n) {
let i = this.matchElement(t)
, a = this.matchesByElement.has(n, t);
i && !a ? this.selectorMatched(t, n) : !i && a && this.selectorUnmatched(t, n)
}
}
selectorMatched(t, e) {
this.delegate.selectorMatched(t, e, this.details),
this.matchesByElement.add(e, t)
}
selectorUnmatched(t, e) {
this.delegate.selectorUnmatched(t, e, this.details),
this.matchesByElement.delete(e, t)
}
}
, _e = class {
constructor(t, e) {
this.element = t,
this.delegate = e,
this.started = !1,
this.stringMap = new Map,
this.mutationObserver = new MutationObserver(n => this.processMutations(n))
}
start() {
this.started || (this.started = !0,
this.mutationObserver.observe(this.element, {
attributes: !0,
attributeOldValue: !0
}),
this.refresh())
}
stop() {
this.started && (this.mutationObserver.takeRecords(),
this.mutationObserver.disconnect(),
this.started = !1)
}
refresh() {
if (this.started)
for (let t of this.knownAttributeNames)
this.refreshAttribute(t, null)
}
processMutations(t) {
if (this.started)
for (let e of t)
this.processMutation(e)
}
processMutation(t) {
let e = t.attributeName;
e && this.refreshAttribute(e, t.oldValue)
}
refreshAttribute(t, e) {
let n = this.delegate.getStringMapKeyForAttribute(t);
if (n != null) {
this.stringMap.has(t) || this.stringMapKeyAdded(n, t);
let i = this.element.getAttribute(t);
if (this.stringMap.get(t) != i && this.stringMapValueChanged(i, n, e),
i == null) {
let a = this.stringMap.get(t);
this.stringMap.delete(t),
a && this.stringMapKeyRemoved(n, t, a)
} else
this.stringMap.set(t, i)
}
}
stringMapKeyAdded(t, e) {
this.delegate.stringMapKeyAdded && this.delegate.stringMapKeyAdded(t, e)
}
stringMapValueChanged(t, e, n) {
this.delegate.stringMapValueChanged && this.delegate.stringMapValueChanged(t, e, n)
}
stringMapKeyRemoved(t, e, n) {
this.delegate.stringMapKeyRemoved && this.delegate.stringMapKeyRemoved(t, e, n)
}
get knownAttributeNames() {
return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))
}
get currentAttributeNames() {
return Array.from(this.element.attributes).map(t => t.name)
}
get recordedAttributeNames() {
return Array.from(this.stringMap.keys())
}
}
, ne = class {
constructor(t, e, n) {
this.attributeObserver = new ee(t,e,this),
this.delegate = n,
this.tokensByElement = new it
}
get started() {
return this.attributeObserver.started
}
start() {
this.attributeObserver.start()
}
pause(t) {
this.attributeObserver.pause(t)
}
stop() {
this.attributeObserver.stop()
}
refresh() {
this.attributeObserver.refresh()
}
get element() {
return this.attributeObserver.element
}
get attributeName() {
return this.attributeObserver.attributeName
}
elementMatchedAttribute(t) {
this.tokensMatched(this.readTokensForElement(t))
}
elementAttributeValueChanged(t) {
let[e,n] = this.refreshTokensForElement(t);
this.tokensUnmatched(e),
this.tokensMatched(n)
}
elementUnmatchedAttribute(t) {
this.tokensUnmatched(this.tokensByElement.getValuesForKey(t))
}
tokensMatched(t) {
t.forEach(e => this.tokenMatched(e))
}
tokensUnmatched(t) {
t.forEach(e => this.tokenUnmatched(e))
}
tokenMatched(t) {
this.delegate.tokenMatched(t),
this.tokensByElement.add(t.element, t)
}
tokenUnmatched(t) {
this.delegate.tokenUnmatched(t),
this.tokensByElement.delete(t.element, t)
}
refreshTokensForElement(t) {
let e = this.tokensByElement.getValuesForKey(t)
, n = this.readTokensForElement(t)
, i = ko(e, n).findIndex( ([a,l]) => !Vo(a, l));
return i == -1 ? [[], []] : [e.slice(i), n.slice(i)]
}
readTokensForElement(t) {
let e = this.attributeName
, n = t.getAttribute(e) || "";
return Ro(n, t, e)
}
}
;
function Ro(o, t, e) {
return o.trim().split(/\s+/).filter(n => n.length).map( (n, i) => ({
element: t,
attributeName: e,
content: n,
index: i
}))
}
function ko(o, t) {
let e = Math.max(o.length, t.length);
return Array.from({
length: e
}, (n, i) => [o[i], t[i]])
}
function Vo(o, t) {
return o && t && o.index == t.index && o.content == t.content
}
var ie = class {
constructor(t, e, n) {
this.tokenListObserver = new ne(t,e,this),
this.delegate = n,
this.parseResultsByToken = new WeakMap,
this.valuesByTokenByElement = new WeakMap
}
get started() {
return this.tokenListObserver.started
}
start() {
this.tokenListObserver.start()
}
stop() {
this.tokenListObserver.stop()
}
refresh() {
this.tokenListObserver.refresh()
}
get element() {
return this.tokenListObserver.element
}
get attributeName() {
return this.tokenListObserver.attributeName
}
tokenMatched(t) {
let {element: e} = t
, {value: n} = this.fetchParseResultForToken(t);
n && (this.fetchValuesByTokenForElement(e).set(t, n),
this.delegate.elementMatchedValue(e, n))
}
tokenUnmatched(t) {
let {element: e} = t
, {value: n} = this.fetchParseResultForToken(t);
n && (this.fetchValuesByTokenForElement(e).delete(t),
this.delegate.elementUnmatchedValue(e, n))
}
fetchParseResultForToken(t) {
let e = this.parseResultsByToken.get(t);
return e || (e = this.parseToken(t),
this.parseResultsByToken.set(t, e)),
e
}
fetchValuesByTokenForElement(t) {
let e = this.valuesByTokenByElement.get(t);
return e || (e = new Map,
this.valuesByTokenByElement.set(t, e)),
e
}
parseToken(t) {
try {
return {
value: this.delegate.parseValueForToken(t)
}
} catch (e) {
return {
error: e
}
}
}
}
, Je = class {
constructor(t, e) {
this.context = t,
this.delegate = e,
this.bindingsByAction = new Map
}
start() {
this.valueListObserver || (this.valueListObserver = new ie(this.element,this.actionAttribute,this),
this.valueListObserver.start())
}
stop() {
this.valueListObserver && (this.valueListObserver.stop(),
delete this.valueListObserver,
this.disconnectAllActions())
}
get element() {
return this.context.element
}
get identifier() {
return this.context.identifier
}
get actionAttribute() {
return this.schema.actionAttribute
}
get schema() {
return this.context.schema
}
get bindings() {
return Array.from(this.bindingsByAction.values())
}
connectAction(t) {
let e = new Te(this.context,t);
this.bindingsByAction.set(t, e),
this.delegate.bindingConnected(e)
}
disconnectAction(t) {
let e = this.bindingsByAction.get(t);
e && (this.bindingsByAction.delete(t),
this.delegate.bindingDisconnected(e))
}
disconnectAllActions() {
this.bindings.forEach(t => this.delegate.bindingDisconnected(t, !0)),
this.bindingsByAction.clear()
}
parseValueForToken(t) {
let e = Se.forToken(t, this.schema);
if (e.identifier == this.identifier)
return e
}
elementMatchedValue(t, e) {
this.connectAction(e)
}
elementUnmatchedValue(t, e) {
this.disconnectAction(e)
}
}
, He = class {
constructor(t, e) {
this.context = t,
this.receiver = e,
this.stringMapObserver = new _e(this.element,this),
this.valueDescriptorMap = this.controller.valueDescriptorMap
}
start() {
this.stringMapObserver.start(),
this.invokeChangedCallbacksForDefaultValues()
}
stop() {
this.stringMapObserver.stop()
}
get element() {
return this.context.element
}
get controller() {
return this.context.controller
}
getStringMapKeyForAttribute(t) {
if (t in this.valueDescriptorMap)
return this.valueDescriptorMap[t].name
}
stringMapKeyAdded(t, e) {
let n = this.valueDescriptorMap[e];
this.hasValue(t) || this.invokeChangedCallback(t, n.writer(this.receiver[t]), n.writer(n.defaultValue))
}
stringMapValueChanged(t, e, n) {
let i = this.valueDescriptorNameMap[e];
t !== null && (n === null && (n = i.writer(i.defaultValue)),
this.invokeChangedCallback(e, t, n))
}
stringMapKeyRemoved(t, e, n) {
let i = this.valueDescriptorNameMap[t];
this.hasValue(t) ? this.invokeChangedCallback(t, i.writer(this.receiver[t]), n) : this.invokeChangedCallback(t, i.writer(i.defaultValue), n)
}
invokeChangedCallbacksForDefaultValues() {
for (let {key: t, name: e, defaultValue: n, writer: i} of this.valueDescriptors)
n != null && !this.controller.data.has(t) && this.invokeChangedCallback(e, i(n), void 0)
}
invokeChangedCallback(t, e, n) {
let i = `${t}Changed`
, a = this.receiver[i];
if (typeof a == "function") {
let l = this.valueDescriptorNameMap[t];
try {
let c = l.reader(e)
, u = n;
n && (u = l.reader(n)),
a.call(this.receiver, c, u)
} catch (c) {
throw c instanceof TypeError && (c.message = `Stimulus Value "${this.context.identifier}.${l.name}" - ${c.message}`),
c
}
}
}
get valueDescriptors() {
let {valueDescriptorMap: t} = this;
return Object.keys(t).map(e => t[e])
}
get valueDescriptorNameMap() {
let t = {};
return Object.keys(this.valueDescriptorMap).forEach(e => {
let n = this.valueDescriptorMap[e];
t[n.name] = n
}
),
t
}
hasValue(t) {
let e = this.valueDescriptorNameMap[t]
, n = `has${Lt(e.name)}`;
return this.receiver[n]
}
}
, Pe = class {
constructor(t, e) {
this.context = t,
this.delegate = e,
this.targetsByName = new it
}
start() {
this.tokenListObserver || (this.tokenListObserver = new ne(this.element,this.attributeName,this),
this.tokenListObserver.start())
}
stop() {
this.tokenListObserver && (this.disconnectAllTargets(),
this.tokenListObserver.stop(),
delete this.tokenListObserver)
}
tokenMatched({element: t, content: e}) {
this.scope.containsElement(t) && this.connectTarget(t, e)
}
tokenUnmatched({element: t, content: e}) {
this.disconnectTarget(t, e)
}
connectTarget(t, e) {
var n;
this.targetsByName.has(e, t) || (this.targetsByName.add(e, t),
(n = this.tokenListObserver) === null || n === void 0 || n.pause( () => this.delegate.targetConnected(t, e)))
}
disconnectTarget(t, e) {
var n;
this.targetsByName.has(e, t) && (this.targetsByName.delete(e, t),
(n = this.tokenListObserver) === null || n === void 0 || n.pause( () => this.delegate.targetDisconnected(t, e)))
}
disconnectAllTargets() {
for (let t of this.targetsByName.keys)
for (let e of this.targetsByName.getValuesForKey(t))
this.disconnectTarget(e, t)
}
get attributeName() {
return `data-${this.context.identifier}-target`
}
get element() {
return this.context.element
}
get scope() {
return this.context.scope
}
}
;
function At(o, t) {
let e = bi(o);
return Array.from(e.reduce( (n, i) => (So(i, t).forEach(a => n.add(a)),
n), new Set))
}
function Yo(o, t) {
return bi(o).reduce( (n, i) => (n.push(...To(i, t)),
n), [])
}
function bi(o) {
let t = [];
for (; o; )
t.push(o),
o = Object.getPrototypeOf(o);
return t.reverse()
}
function So(o, t) {
let e = o[t];
return Array.isArray(e) ? e : []
}
function To(o, t) {
let e = o[t];
return e ? Object.keys(e).map(n => [n, e[n]]) : []
}
var Ke = class {
constructor(t, e) {
this.started = !1,
this.context = t,
this.delegate = e,
this.outletsByName = new it,
this.outletElementsByName = new it,
this.selectorObserverMap = new Map,
this.attributeObserverMap = new Map
}
start() {
this.started || (this.outletDefinitions.forEach(t => {
this.setupSelectorObserverForOutlet(t),
this.setupAttributeObserverForOutlet(t)
}
),
this.started = !0,
this.dependentContexts.forEach(t => t.refresh()))
}
refresh() {
this.selectorObserverMap.forEach(t => t.refresh()),
this.attributeObserverMap.forEach(t => t.refresh())
}
stop() {
this.started && (this.started = !1,
this.disconnectAllOutlets(),
this.stopSelectorObservers(),
this.stopAttributeObservers())
}
stopSelectorObservers() {
this.selectorObserverMap.size > 0 && (this.selectorObserverMap.forEach(t => t.stop()),
this.selectorObserverMap.clear())
}
stopAttributeObservers() {
this.attributeObserverMap.size > 0 && (this.attributeObserverMap.forEach(t => t.stop()),
this.attributeObserverMap.clear())
}
selectorMatched(t, e, {outletName: n}) {
let i = this.getOutlet(t, n);
i && this.connectOutlet(i, t, n)
}
selectorUnmatched(t, e, {outletName: n}) {
let i = this.getOutletFromMap(t, n);
i && this.disconnectOutlet(i, t, n)
}
selectorMatchElement(t, {outletName: e}) {
let n = this.selector(e)
, i = this.hasOutlet(t, e)
, a = t.matches(`[${this.schema.controllerAttribute}~=${e}]`);
return n ? i && a && t.matches(n) : !1
}
elementMatchedAttribute(t, e) {
let n = this.getOutletNameFromOutletAttributeName(e);
n && this.updateSelectorObserverForOutlet(n)
}
elementAttributeValueChanged(t, e) {
let n = this.getOutletNameFromOutletAttributeName(e);
n && this.updateSelectorObserverForOutlet(n)
}
elementUnmatchedAttribute(t, e) {
let n = this.getOutletNameFromOutletAttributeName(e);
n && this.updateSelectorObserverForOutlet(n)
}
connectOutlet(t, e, n) {
var i;
this.outletElementsByName.has(n, e) || (this.outletsByName.add(n, t),
this.outletElementsByName.add(n, e),
(i = this.selectorObserverMap.get(n)) === null || i === void 0 || i.pause( () => this.delegate.outletConnected(t, e, n)))
}
disconnectOutlet(t, e, n) {
var i;
this.outletElementsByName.has(n, e) && (this.outletsByName.delete(n, t),
this.outletElementsByName.delete(n, e),
(i = this.selectorObserverMap.get(n)) === null || i === void 0 || i.pause( () => this.delegate.outletDisconnected(t, e, n)))
}
disconnectAllOutlets() {
for (let t of this.outletElementsByName.keys)
for (let e of this.outletElementsByName.getValuesForKey(t))
for (let n of this.outletsByName.getValuesForKey(t))
this.disconnectOutlet(n, e, t)
}
updateSelectorObserverForOutlet(t) {
let e = this.selectorObserverMap.get(t);
e && (e.selector = this.selector(t))
}
setupSelectorObserverForOutlet(t) {
let e = this.selector(t)
, n = new ze(document.body,e,this,{
outletName: t
});
this.selectorObserverMap.set(t, n),
n.start()
}
setupAttributeObserverForOutlet(t) {
let e = this.attributeNameForOutletName(t)
, n = new ee(this.scope.element,e,this);
this.attributeObserverMap.set(t, n),
n.start()
}
selector(t) {
return this.scope.outlets.getSelectorForOutletName(t)
}
attributeNameForOutletName(t) {
return this.scope.schema.outletAttributeForScope(this.identifier, t)
}
getOutletNameFromOutletAttributeName(t) {
return this.outletDefinitions.find(e => this.attributeNameForOutletName(e) === t)
}
get outletDependencies() {
let t = new it;
return this.router.modules.forEach(e => {
let n = e.definition.controllerConstructor;
At(n, "outlets").forEach(a => t.add(a, e.identifier))
}
),
t
}
get outletDefinitions() {
return this.outletDependencies.getKeysForValue(this.identifier)
}
get dependentControllerIdentifiers() {
return this.outletDependencies.getValuesForKey(this.identifier)
}
get dependentContexts() {
let t = this.dependentControllerIdentifiers;
return this.router.contexts.filter(e => t.includes(e.identifier))
}
hasOutlet(t, e) {
return !!this.getOutlet(t, e) || !!this.getOutletFromMap(t, e)
}
getOutlet(t, e) {
return this.application.getControllerForElementAndIdentifier(t, e)
}
getOutletFromMap(t, e) {
return this.outletsByName.getValuesForKey(e).find(n => n.element === t)
}
get scope() {
return this.context.scope
}
get schema() {
return this.context.schema
}
get identifier() {
return this.context.identifier
}
get application() {
return this.context.application
}
get router() {
return this.application.router
}
}
, $e = class {
constructor(t, e) {
this.logDebugActivity = (n, i={}) => {
let {identifier: a, controller: l, element: c} = this;
i = Object.assign({
identifier: a,
controller: l,
element: c
}, i),
this.application.logDebugActivity(this.identifier, n, i)
}
,
this.module = t,
this.scope = e,
this.controller = new t.controllerConstructor(this),
this.bindingObserver = new Je(this,this.dispatcher),
this.valueObserver = new He(this,this.controller),
this.targetObserver = new Pe(this,this),
this.outletObserver = new Ke(this,this);
try {
this.controller.initialize(),
this.logDebugActivity("initialize")
} catch (n) {
this.handleError(n, "initializing controller")
}
}
connect() {
this.bindingObserver.start(),
this.valueObserver.start(),
this.targetObserver.start(),
this.outletObserver.start();
try {
this.controller.connect(),
this.logDebugActivity("connect")
} catch (t) {
this.handleError(t, "connecting controller")
}
}
refresh() {
this.outletObserver.refresh()
}
disconnect() {
try {
this.controller.disconnect(),
this.logDebugActivity("disconnect")
} catch (t) {
this.handleError(t, "disconnecting controller")
}
this.outletObserver.stop(),
this.targetObserver.stop(),
this.valueObserver.stop(),
this.bindingObserver.stop()
}
get application() {
return this.module.application
}
get identifier() {
return this.module.identifier
}
get schema() {
return this.application.schema
}
get dispatcher() {
return this.application.dispatcher
}
get element() {
return this.scope.element
}
get parentElement() {
return this.element.parentElement
}
handleError(t, e, n={}) {
let {identifier: i, controller: a, element: l} = this;
n = Object.assign({
identifier: i,
controller: a,
element: l
}, n),
this.application.handleError(t, `Error ${e}`, n)
}
targetConnected(t, e) {
this.invokeControllerMethod(`${e}TargetConnected`, t)
}
targetDisconnected(t, e) {
this.invokeControllerMethod(`${e}TargetDisconnected`, t)
}
outletConnected(t, e, n) {
this.invokeControllerMethod(`${Ve(n)}OutletConnected`, t, e)
}
outletDisconnected(t, e, n) {
this.invokeControllerMethod(`${Ve(n)}OutletDisconnected`, t, e)
}
invokeControllerMethod(t, ...e) {
let n = this.controller;
typeof n[t] == "function" && n[t](...e)
}
}
;
function zo(o) {
return _o(o, Jo(o))
}
function _o(o, t) {
let e = $o(o)
, n = Ho(o.prototype, t);
return Object.defineProperties(e.prototype, n),
e
}
function Jo(o) {
return At(o, "blessings").reduce( (e, n) => {
let i = n(o);
for (let a in i) {
let l = e[a] || {};
e[a] = Object.assign(l, i[a])
}
return e
}
, {})
}
function Ho(o, t) {
return Ko(t).reduce( (e, n) => {
let i = Po(o, t, n);
return i && Object.assign(e, {
[n]: i
}),
e
}
, {})
}
function Po(o, t, e) {
let n = Object.getOwnPropertyDescriptor(o, e);
if (!(n && "value"in n)) {
let a = Object.getOwnPropertyDescriptor(t, e).value;
return n && (a.get = n.get || a.get,
a.set = n.set || a.set),
a
}
}
var Ko = typeof Object.getOwnPropertySymbols == "function" ? o => [...Object.getOwnPropertyNames(o), ...Object.getOwnPropertySymbols(o)] : Object.getOwnPropertyNames
, $o = ( () => {
function o(e) {
function n() {
return Reflect.construct(e, arguments, new.target)
}
return n.prototype = Object.create(e.prototype, {
constructor: {
value: n
}
}),
Reflect.setPrototypeOf(n, e),
n
}
function t() {
let n = o(function() {
this.a.call(this)
});
return n.prototype.a = function() {}
,
new n
}
try {
return t(),
o
} catch {
return n => class extends n {
}
}
}
)();
function qo(o) {
return {
identifier: o.identifier,
controllerConstructor: zo(o.controllerConstructor)
}
}
var qe = class {
constructor(t, e) {
this.application = t,
this.definition = qo(e),
this.contextsByScope = new WeakMap,
this.connectedContexts = new Set
}
get identifier() {
return this.definition.identifier
}
get controllerConstructor() {
return this.definition.controllerConstructor
}
get contexts() {
return Array.from(this.connectedContexts)
}
connectContextForScope(t) {
let e = this.fetchContextForScope(t);
this.connectedContexts.add(e),
e.connect()
}
disconnectContextForScope(t) {
let e = this.contextsByScope.get(t);
e && (this.connectedContexts.delete(e),
e.disconnect())
}
fetchContextForScope(t) {
let e = this.contextsByScope.get(t);
return e || (e = new $e(this,t),
this.contextsByScope.set(t, e)),
e
}
}
, tn = class {
constructor(t) {
this.scope = t
}
has(t) {
return this.data.has(this.getDataKey(t))
}
get(t) {
return this.getAll(t)[0]
}
getAll(t) {
let e = this.data.get(this.getDataKey(t)) || "";
return Zo(e)
}
getAttributeName(t) {
return this.data.getAttributeNameForKey(this.getDataKey(t))
}
getDataKey(t) {
return `${t}-class`
}
get data() {
return this.scope.data
}
}
, en = class {
constructor(t) {
this.scope = t
}
get element() {
return this.scope.element
}
get identifier() {
return this.scope.identifier
}
get(t) {
let e = this.getAttributeNameForKey(t);
return this.element.getAttribute(e)
}
set(t, e) {
let n = this.getAttributeNameForKey(t);
return this.element.setAttribute(n, e),
this.get(t)
}
has(t) {
let e = this.getAttributeNameForKey(t);
return this.element.hasAttribute(e)
}
delete(t) {
if (this.has(t)) {
let e = this.getAttributeNameForKey(t);
return this.element.removeAttribute(e),
!0
} else
return !1
}
getAttributeNameForKey(t) {
return `data-${this.identifier}-${hi(t)}`
}
}
, nn = class {
constructor(t) {
this.warnedKeysByObject = new WeakMap,
this.logger = t
}
warn(t, e, n) {
let i = this.warnedKeysByObject.get(t);
i || (i = new Set,
this.warnedKeysByObject.set(t, i)),
i.has(e) || (i.add(e),
this.logger.warn(n, t))
}
}
;
function on(o, t) {
return `[${o}~="${t}"]`
}
var sn = class {
constructor(t) {
this.scope = t
}
get element() {
return this.scope.element
}
get identifier() {
return this.scope.identifier
}
get schema() {
return this.scope.schema
}
has(t) {
return this.find(t) != null
}
find(...t) {
return t.reduce( (e, n) => e || this.findTarget(n) || this.findLegacyTarget(n), void 0)
}
findAll(...t) {
return t.reduce( (e, n) => [...e, ...this.findAllTargets(n), ...this.findAllLegacyTargets(n)], [])
}
findTarget(t) {
let e = this.getSelectorForTargetName(t);
return this.scope.findElement(e)
}
findAllTargets(t) {
let e = this.getSelectorForTargetName(t);
return this.scope.findAllElements(e)
}
getSelectorForTargetName(t) {
let e = this.schema.targetAttributeForScope(this.identifier);
return on(e, t)
}
findLegacyTarget(t) {
let e = this.getLegacySelectorForTargetName(t);
return this.deprecate(this.scope.findElement(e), t)
}
findAllLegacyTargets(t) {
let e = this.getLegacySelectorForTargetName(t);
return this.scope.findAllElements(e).map(n => this.deprecate(n, t))
}
getLegacySelectorForTargetName(t) {
let e = `${this.identifier}.${t}`;
return on(this.schema.targetAttribute, e)
}
deprecate(t, e) {
if (t) {
let {identifier: n} = this
, i = this.schema.targetAttribute
, a = this.schema.targetAttributeForScope(n);
this.guide.warn(t, `target:${e}`, `Please replace ${i}="${n}.${e}" with ${a}="${e}". The ${i} attribute is deprecated and will be removed in a future version of Stimulus.`)
}
return t
}
get guide() {
return this.scope.guide
}
}
, an = class {
constructor(t, e) {
this.scope = t,
this.controllerElement = e
}
get element() {
return this.scope.element
}
get identifier() {
return this.scope.identifier
}
get schema() {
return this.scope.schema
}
has(t) {
return this.find(t) != null
}
find(...t) {
return t.reduce( (e, n) => e || this.findOutlet(n), void 0)
}
findAll(...t) {
return t.reduce( (e, n) => [...e, ...this.findAllOutlets(n)], [])
}
getSelectorForOutletName(t) {
let e = this.schema.outletAttributeForScope(this.identifier, t);
return this.controllerElement.getAttribute(e)
}
findOutlet(t) {
let e = this.getSelectorForOutletName(t);
if (e)
return this.findElement(e, t)
}
findAllOutlets(t) {
let e = this.getSelectorForOutletName(t);
return e ? this.findAllElements(e, t) : []
}
findElement(t, e) {
return this.scope.queryElements(t).filter(i => this.matchesElement(i, t, e))[0]
}
findAllElements(t, e) {
return this.scope.queryElements(t).filter(i => this.matchesElement(i, t, e))
}
matchesElement(t, e, n) {
let i = t.getAttribute(this.scope.schema.controllerAttribute) || "";
return t.matches(e) && i.split(" ").includes(n)
}
}
, rn = class o {
constructor(t, e, n, i) {
this.targets = new sn(this),
this.classes = new tn(this),
this.data = new en(this),
this.containsElement = a => a.closest(this.controllerSelector) === this.element,
this.schema = t,
this.element = e,
this.identifier = n,
this.guide = new nn(i),
this.outlets = new an(this.documentScope,e)
}
findElement(t) {
return this.element.matches(t) ? this.element : this.queryElements(t).find(this.containsElement)
}
findAllElements(t) {
return [...this.element.matches(t) ? [this.element] : [], ...this.queryElements(t).filter(this.containsElement)]
}
queryElements(t) {
return Array.from(this.element.querySelectorAll(t))
}
get controllerSelector() {
return on(this.schema.controllerAttribute, this.identifier)
}
get isDocumentScope() {
return this.element === document.documentElement
}
get documentScope() {
return this.isDocumentScope ? this : new o(this.schema,document.documentElement,this.identifier,this.guide.logger)
}
}
, ln = class {
constructor(t, e, n) {
this.element = t,
this.schema = e,
this.delegate = n,
this.valueListObserver = new ie(this.element,this.controllerAttribute,this),
this.scopesByIdentifierByElement = new WeakMap,
this.scopeReferenceCounts = new WeakMap
}
start() {
this.valueListObserver.start()
}
stop() {
this.valueListObserver.stop()
}
get controllerAttribute() {
return this.schema.controllerAttribute
}
parseValueForToken(t) {
let {element: e, content: n} = t;
return this.parseValueForElementAndIdentifier(e, n)
}
parseValueForElementAndIdentifier(t, e) {
let n = this.fetchScopesByIdentifierForElement(t)
, i = n.get(e);
return i || (i = this.delegate.createScopeForElementAndIdentifier(t, e),
n.set(e, i)),
i
}
elementMatchedValue(t, e) {
let n = (this.scopeReferenceCounts.get(e) || 0) + 1;
this.scopeReferenceCounts.set(e, n),
n == 1 && this.delegate.scopeConnected(e)
}
elementUnmatchedValue(t, e) {
let n = this.scopeReferenceCounts.get(e);
n && (this.scopeReferenceCounts.set(e, n - 1),
n == 1 && this.delegate.scopeDisconnected(e))
}
fetchScopesByIdentifierForElement(t) {
let e = this.scopesByIdentifierByElement.get(t);
return e || (e = new Map,
this.scopesByIdentifierByElement.set(t, e)),
e
}
}
, cn = class {
constructor(t) {
this.application = t,
this.scopeObserver = new ln(this.element,this.schema,this),
this.scopesByIdentifier = new it,
this.modulesByIdentifier = new Map
}
get element() {
return this.application.element
}
get schema() {
return this.application.schema
}
get logger() {
return this.application.logger
}
get controllerAttribute() {
return this.schema.controllerAttribute
}
get modules() {
return Array.from(this.modulesByIdentifier.values())
}
get contexts() {
return this.modules.reduce( (t, e) => t.concat(e.contexts), [])
}
start() {
this.scopeObserver.start()
}
stop() {
this.scopeObserver.stop()
}
loadDefinition(t) {
this.unloadIdentifier(t.identifier);
let e = new qe(this.application,t);
this.connectModule(e);
let n = t.controllerConstructor.afterLoad;
n && n.call(t.controllerConstructor, t.identifier, this.application)
}
unloadIdentifier(t) {
let e = this.modulesByIdentifier.get(t);
e && this.disconnectModule(e)
}
getContextForElementAndIdentifier(t, e) {
let n = this.modulesByIdentifier.get(e);
if (n)
return n.contexts.find(i => i.element == t)
}
proposeToConnectScopeForElementAndIdentifier(t, e) {
let n = this.scopeObserver.parseValueForElementAndIdentifier(t, e);
n ? this.scopeObserver.elementMatchedValue(n.element, n) : console.error(`Couldn't find or create scope for identifier: "${e}" and element:`, t)
}
handleError(t, e, n) {
this.application.handleError(t, e, n)
}
createScopeForElementAndIdentifier(t, e) {
return new rn(this.schema,t,e,this.logger)
}
scopeConnected(t) {
this.scopesByIdentifier.add(t.identifier, t);
let e = this.modulesByIdentifier.get(t.identifier);
e && e.connectContextForScope(t)
}
scopeDisconnected(t) {
this.scopesByIdentifier.delete(t.identifier, t);
let e = this.modulesByIdentifier.get(t.identifier);
e && e.disconnectContextForScope(t)
}
connectModule(t) {
this.modulesByIdentifier.set(t.identifier, t),
this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(n => t.connectContextForScope(n))
}
disconnectModule(t) {
this.modulesByIdentifier.delete(t.identifier),
this.scopesByIdentifier.getValuesForKey(t.identifier).forEach(n => t.disconnectContextForScope(n))
}
}
, ts = {
controllerAttribute: "data-controller",
actionAttribute: "data-action",
targetAttribute: "data-target",
targetAttributeForScope: o => `data-${o}-target`,
outletAttributeForScope: (o, t) => `data-${o}-${t}-outlet`,
keyMappings: Object.assign(Object.assign({
enter: "Enter",
tab: "Tab",
esc: "Escape",
space: " ",
up: "ArrowUp",
down: "ArrowDown",
left: "ArrowLeft",
right: "ArrowRight",
home: "Home",
end: "End",
page_up: "PageUp",
page_down: "PageDown"
}, ai("abcdefghijklmnopqrstuvwxyz".split("").map(o => [o, o]))), ai("0123456789".split("").map(o => [o, o])))
};
function ai(o) {
return o.reduce( (t, [e,n]) => Object.assign(Object.assign({}, t), {
[e]: n
}), {})
}
var oe = class {
constructor(t=document.documentElement, e=ts) {
this.logger = console,
this.debug = !1,
this.logDebugActivity = (n, i, a={}) => {
this.debug && this.logFormattedMessage(n, i, a)
}
,
this.element = t,
this.schema = e,
this.dispatcher = new ke(this),
this.router = new cn(this),
this.actionDescriptorFilters = Object.assign({}, Lo)
}
static start(t, e) {
let n = new this(t,e);
return n.start(),
n
}
async start() {
await es(),
this.logDebugActivity("application", "starting"),
this.dispatcher.start(),
this.router.start(),
this.logDebugActivity("application", "start")
}
stop() {
this.logDebugActivity("application", "stopping"),
this.dispatcher.stop(),
this.router.stop(),
this.logDebugActivity("application", "stop")
}
register(t, e) {
this.load({
identifier: t,
controllerConstructor: e
})
}
registerActionOption(t, e) {
this.actionDescriptorFilters[t] = e
}
load(t, ...e) {
(Array.isArray(t) ? t : [t, ...e]).forEach(i => {
i.controllerConstructor.shouldLoad && this.router.loadDefinition(i)
}
)
}
unload(t, ...e) {
(Array.isArray(t) ? t : [t, ...e]).forEach(i => this.router.unloadIdentifier(i))
}
get controllers() {
return this.router.contexts.map(t => t.controller)
}
getControllerForElementAndIdentifier(t, e) {
let n = this.router.getContextForElementAndIdentifier(t, e);
return n ? n.controller : null
}
handleError(t, e, n) {
var i;
this.logger.error(`%s
%o
%o`, e, t, n),
(i = window.onerror) === null || i === void 0 || i.call(window, e, "", 0, 0, t)
}
logFormattedMessage(t, e, n={}) {
n = Object.assign({
application: this
}, n),
this.logger.groupCollapsed(`${t} #${e}`),
this.logger.log("details:", Object.assign({}, n)),
this.logger.groupEnd()
}
}
;
function es() {
return new Promise(o => {
document.readyState == "loading" ? document.addEventListener("DOMContentLoaded", () => o()) : o()
}
)
}
function ns(o) {
return At(o, "classes").reduce( (e, n) => Object.assign(e, is(n)), {})
}
function is(o) {
return {
[`${o}Class`]: {
get() {
let {classes: t} = this;
if (t.has(o))
return t.get(o);
{
let e = t.getAttributeName(o);
throw new Error(`Missing attribute "${e}"`)
}
}
},
[`${o}Classes`]: {
get() {
return this.classes.getAll(o)
}
},
[`has${Lt(o)}Class`]: {
get() {
return this.classes.has(o)
}
}
}
}
function os(o) {
return At(o, "outlets").reduce( (e, n) => Object.assign(e, ss(n)), {})
}
function ri(o, t, e) {
return o.application.getControllerForElementAndIdentifier(t, e)
}
function li(o, t, e) {
let n = ri(o, t, e);
if (n || (o.application.router.proposeToConnectScopeForElementAndIdentifier(t, e),
n = ri(o, t, e),
n))
return n
}
function ss(o) {
let t = Ve(o);
return {
[`${t}Outlet`]: {
get() {
let e = this.outlets.find(o)
, n = this.outlets.getSelectorForOutletName(o);
if (e) {
let i = li(this, e, o);
if (i)
return i;
throw new Error(`The provided outlet element is missing an outlet controller "${o}" instance for host controller "${this.identifier}"`)
}
throw new Error(`Missing outlet element "${o}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)
}
},
[`${t}Outlets`]: {
get() {
let e = this.outlets.findAll(o);
return e.length > 0 ? e.map(n => {
let i = li(this, n, o);
if (i)
return i;
console.warn(`The provided outlet element is missing an outlet controller "${o}" instance for host controller "${this.identifier}"`, n)
}
).filter(n => n) : []
}
},
[`${t}OutletElement`]: {
get() {
let e = this.outlets.find(o)
, n = this.outlets.getSelectorForOutletName(o);
if (e)
return e;
throw new Error(`Missing outlet element "${o}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${n}".`)
}
},
[`${t}OutletElements`]: {
get() {
return this.outlets.findAll(o)
}
},
[`has${Lt(t)}Outlet`]: {
get() {
return this.outlets.has(o)
}
}
}
}
function as(o) {
return At(o, "targets").reduce( (e, n) => Object.assign(e, rs(n)), {})
}
function rs(o) {
return {
[`${o}Target`]: {
get() {
let t = this.targets.find(o);
if (t)
return t;
throw new Error(`Missing target element "${o}" for "${this.identifier}" controller`)
}
},
[`${o}Targets`]: {
get() {
return this.targets.findAll(o)
}
},
[`has${Lt(o)}Target`]: {
get() {
return this.targets.has(o)
}
}
}
}
function ls(o) {
let t = Yo(o, "values")
, e = {
valueDescriptorMap: {
get() {
return t.reduce( (n, i) => {
let a = mi(i, this.identifier)
, l = this.data.getAttributeNameForKey(a.key);
return Object.assign(n, {
[l]: a
})
}
, {})
}
}
};
return t.reduce( (n, i) => Object.assign(n, cs(i)), e)
}
function cs(o, t) {
let e = mi(o, t)
, {key: n, name: i, reader: a, writer: l} = e;
return {
[i]: {
get() {
let c = this.data.get(n);
return c !== null ? a(c) : e.defaultValue
},
set(c) {
c === void 0 ? this.data.delete(n) : this.data.set(n, l(c))
}
},
[`has${Lt(i)}`]: {
get() {
return this.data.has(n) || e.hasCustomDefaultValue
}
}
}
}
function mi([o,t], e) {
return gs({
controller: e,
token: o,
typeDefinition: t
})
}
function se(o) {
switch (o) {
case Array:
return "array";
case Boolean:
return "boolean";
case Number:
return "number";
case Object:
return "object";
case String:
return "string"
}
}
function wt(o) {
switch (typeof o) {
case "boolean":
return "boolean";
case "number":
return "number";
case "string":
return "string"
}
if (Array.isArray(o))
return "array";
if (Object.prototype.toString.call(o) === "[object Object]")
return "object"
}
function ds(o) {
let {controller: t, token: e, typeObject: n} = o
, i = ii(n.type)
, a = ii(n.default)
, l = i && a
, c = i && !a
, u = !i && a
, g = se(n.type)
, s = wt(o.typeObject.default);
if (c)
return g;
if (u)
return s;
if (g !== s) {
let r = t ? `${t}.${e}` : e;
throw new Error(`The specified default value for the Stimulus Value "${r}" must match the defined type "${g}". The provided default value of "${n.default}" is of type "${s}".`)
}
if (l)
return g
}
function us(o) {
let {controller: t, token: e, typeDefinition: n} = o
, a = ds({
controller: t,
token: e,
typeObject: n
})
, l = wt(n)
, c = se(n)
, u = a || l || c;
if (u)
return u;
let g = t ? `${t}.${n}` : e;
throw new Error(`Unknown value type "${g}" for "${e}" value`)
}
function hs(o) {
let t = se(o);
if (t)
return ci[t];
let e = Ye(o, "default")
, n = Ye(o, "type")
, i = o;
if (e)
return i.default;
if (n) {
let {type: a} = i
, l = se(a);
if (l)
return ci[l]
}
return o
}
function gs(o) {
let {token: t, typeDefinition: e} = o
, n = `${hi(t)}-value`
, i = us(o);
return {
type: i,
key: n,
name: dn(n),
get defaultValue() {
return hs(e)
},
get hasCustomDefaultValue() {
return wt(e) !== void 0
},
reader: bs[i],
writer: di[i] || di.default
}
}
var ci = {
get array() {
return []
},
boolean: !1,
number: 0,
get object() {
return {}
},
string: ""
}
, bs = {
array(o) {
let t = JSON.parse(o);
if (!Array.isArray(t))
throw new TypeError(`expected value of type "array" but instead got value "${o}" of type "${wt(t)}"`);
return t
},
boolean(o) {
return !(o == "0" || String(o).toLowerCase() == "false")
},
number(o) {
return Number(o.replace(/_/g, ""))
},
object(o) {
let t = JSON.parse(o);
if (t === null || typeof t != "object" || Array.isArray(t))
throw new TypeError(`expected value of type "object" but instead got value "${o}" of type "${wt(t)}"`);
return t
},
string(o) {
return o
}
}
, di = {
default: ms,
array: ui,
object: ui
};
function ui(o) {
return JSON.stringify(o)
}
function ms(o) {
return `${o}`
}
var A = class {
constructor(t) {
this.context = t
}
static get shouldLoad() {
return !0
}
static afterLoad(t, e) {}
get application() {
return this.context.application
}
get scope() {
return this.context.scope
}
get element() {
return this.scope.element
}
get identifier() {
return this.scope.identifier
}
get targets() {
return this.scope.targets
}
get outlets() {
return this.scope.outlets
}
get classes() {
return this.scope.classes
}
get data() {
return this.scope.data
}
initialize() {}
connect() {}
disconnect() {}
dispatch(t, {target: e=this.element, detail: n={}, prefix: i=this.identifier, bubbles: a=!0, cancelable: l=!0}={}) {
let c = i ? `${i}:${t}` : t
, u = new CustomEvent(c,{
detail: n,
bubbles: a,
cancelable: l
});
return e.dispatchEvent(u),
u
}
}
;
A.blessings = [ns, as, ls, os];
A.targets = [];
A.outlets = [];
A.values = {};
var F = (o, t=1e4) => (o = parseFloat(o + "") || 0,
Math.round((o + Number.EPSILON) * t) / t)
, wn = function(o) {
if (!(o && o instanceof Element && o.offsetParent))
return !1;
let t = o.scrollHeight > o.clientHeight
, e = window.getComputedStyle(o).overflowY
, n = e.indexOf("hidden") !== -1
, i = e.indexOf("visible") !== -1;
return t && !n && !i
}
, fe = function(o, t=void 0) {
return !(!o || o === document.body || t && o === t) && (wn(o) ? o : fe(o.parentElement, t))
}
, et = function(o) {
var t = new DOMParser().parseFromString(o, "text/html").body;
if (t.childElementCount > 1) {
for (var e = document.createElement("div"); t.firstChild; )
e.appendChild(t.firstChild);
return e
}
return t.firstChild
}
, Wn = o => `${o || ""}`.split(" ").filter(t => !!t)
, nt = (o, t, e) => {
o && Wn(t).forEach(n => {
o.classList.toggle(n, e || !1)
}
)
}
, dt = class {
constructor(t) {
Object.defineProperty(this, "pageX", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "pageY", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "clientX", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "clientY", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "id", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "time", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "nativePointer", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
this.nativePointer = t,
this.pageX = t.pageX,
this.pageY = t.pageY,
this.clientX = t.clientX,
this.clientY = t.clientY,
this.id = self.Touch && t instanceof Touch ? t.identifier : -1,
this.time = Date.now()
}
}
, Qt = {
passive: !1
}
, Ln = class {
constructor(t, {start: e= () => !0, move: n= () => {}
, end: i= () => {}
}) {
Object.defineProperty(this, "element", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "startCallback", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "moveCallback", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "endCallback", {
enumerable: !0,
configurable: !0,
writable: !0,
value: void 0
}),
Object.defineProperty(this, "currentPointers", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}),
Object.defineProperty(this, "startPointers", {
enumerable: !0,
configurable: !0,
writable: !0,
value: []
}),
this.element = t,
this.startCallback = e,
this.moveCallback = n,
this.endCallback = i;
for (let a of ["onPointerStart", "onTouchStart", "onMove", "onTouchEnd", "onPointerEnd", "onWindowBlur"])
this[a] = this[a].bind(this);
this.element.addEventListener("mousedown", this.onPointerStart, Qt),
this.element.addEventListener("touchstart", this.onTouchStart, Qt),
this.element.addEventListener("touchmove", this.onMove, Qt),
this.element.addEventListener("touchend", this.onTouchEnd),
this.element.addEventListener("touchcancel", this.onTouchEnd)
}
onPointerStart(t) {
if (!t.buttons || t.button !== 0)
return;
let e = new dt(t);
this.currentPointers.some(n => n.id === e.id) || this.triggerPointerStart(e, t) && (window.addEventListener("mousemove", this.onMove),
window.addEventListener("mouseup", this.onPointerEnd),
window.addEventListener("blur", this.onWindowBlur))
}
onTouchStart(t) {
for (let e of Array.from(t.changedTouches || []))
this.triggerPointerStart(new dt(e), t);
window.addEventListener("blur", this.onWindowBlur)
}
onMove(t) {
let e = this.currentPointers.slice()
, n = "changedTouches"in t ? Array.from(t.changedTouches || []).map(a => new dt(a)) : [new dt(t)]
, i = [];
for (let a of n) {
let l = this.currentPointers.findIndex(c => c.id === a.id);
l < 0 || (i.push(a),
this.currentPointers[l] = a)
}
i.length && this.moveCallback(t, this.currentPointers.slice(), e)
}
onPointerEnd(t) {
t.buttons > 0 && t.button !== 0 || (this.triggerPointerEnd(t, new dt(t)),
window.removeEventListener("mousemove", this.onMove),
window.removeEventListener("mouseup", this.onPointerEnd),
window.removeEventListener("blur", this.onWindowBlur))
}
onTouchEnd(t) {
for (let e of Array.from(t.changedTouches || []))
this.triggerPointerEnd(t, new dt(e))
}
triggerPointerStart(t, e) {
return !!this.startCallback(e, t, this.currentPointers.slice()) && (this.currentPointers.push(t),
this.startPointers.push(t),
!0)
}
triggerPointerEnd(t, e) {
let n = this.currentPointers.findIndex(i => i.id === e.id);
n < 0 || (this.currentPointers.splice(n, 1),
this.startPointers.splice(n, 1),
this.endCallback(t, e, this.currentPointers.slice()))
}
onWindowBlur() {
this.clear()
}
clear() {
for (; this.currentPointers.length; ) {
let t = this.currentPointers[this.currentPointers.length - 1];
this.currentPointers.splice(this.currentPointers.length - 1, 1),
this.startPointers.splice(this.currentPointers.length - 1, 1),
this.endCallback(new Event("touchend",{
bubbles: !0,
cancelable: !0,
clientX: t.clientX,
clientY: t.clientY
}), t, this.currentPointers.slice())
}
}
stop() {
this.element.removeEventListener("mousedown", this.onPointerStart, Qt),
this.element.removeEventListener("touchstart", this.onTouchStart, Qt),
this.element.removeEventListener("touchmove", this.onMove, Qt),
this.element.removeEventListener("touchend", this.onTouchEnd),
this.element.removeEventListener("touchcancel", this.onTouchEnd),
window.removeEventListener("mousemove", this.onMove),
window.removeEventListener("mouseup", this.onPointerEnd),
window.removeEventListener("blur", this.onWindowBlur)
}
}
;
function pi(o, t) {
return t ? Math.sqrt(Math.pow(t.clientX - o.clientX, 2) + Math.pow(t.clientY - o.clientY, 2)) : 0
}
function Qi(o, t) {
return t ? {
clientX: (o.clientX + t.clientX) / 2,
clientY: (o.clientY + t.clientY) / 2
} : o
}
var An = o => typeof o == "object" && o !== null && o.constructor === Object && Object.prototype.toString.call(o) === "[object Object]"
, Y = (o, ...t) => {
let e = t.length;
for (let n = 0; n < e; n++) {
let i = t[n] || {};
Object.entries(i).forEach( ([a,l]) => {
let c = Array.isArray(l) ? [] : {};
o[a] || Object.assign(o, {
[a]: c
}),
An(l) ? Object.assign(o[a], Y(c, l)) : Array.isArray(l) ? Object.assign(o, {
[a]: [...l]
}) : Object.assign(o, {
[a]: l
})
}
)
}
return o
}
, un = function(o, t) {
return o.split(".").reduce( (e, n) => typeof e == "object" ? e[n] : void 0, t)
}
, yt = class {
constructor(t={}) {
Object.defineProperty(this, "options", {
enumerable: !0,
configurable: !0,
writable: !0,
value: t
}),
Object.defineProperty(this, "events", {
enumerable: !0,
configurable: !0,
writable: !0,
value: new Map
}),
this.setOptions(t);
for (let e of Object.getOwnPropertyNames(Object.getPrototypeOf(this)))
e.startsWith("on") && typeof this[e] == "function" && (this[e] = this[e].bind(this))
}
setOptions(t) {
this.options = t ? Y({}, this.constructor.defaults, t) : {};
for (let[e,n] of Object.entries(this.option("on") || {}))
this.on(e, n)
}
option(t, ...e) {
let n = un(t, this.options);
return n && typeof n == "function" && (n = n.call(this, this, ...e)),
n
}
optionFor(t, e, n, ...i) {
let a = un(e, t);
var l;
typeof (l = a) != "string" || isNaN(l) || isNaN(parseFloat(l)) || (a = parseFloat(a)),
a === "true" && (a = !0),
a === "false" && (a = !1),
a && typeof a == "function" && (a = a.call(this, this, t, ...i));
let c = un(e, this.options);
return c && typeof c == "function" ? a = c.call(this, this, t, ...i, a) : a === void 0 && (a = c),
a === void 0 ? n : a
}
cn(t) {
let e = this.options.classes;
return e && e[t] || ""
}
localize(t, e=[]) {
t = String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g, (n, i, a) => {
let l = "";
return a ? l = this.option(`${i[0] + i.toLowerCase().substring(1)}.l10n.${a}`) : i && (l = this.option(`l10n.${i}`)),
l || (l = n),
l
}
);
for (let n = 0; n < e.length; n++)
t = t.split(e[n][0]).join(e[n][1]);
return t = t.replace(/\{\{(.*?)\}\}/g, (n, i) => i)
}
on(t, e) {
let n = [];
typeof t == "string" ? n = t.split(" ") : Array.isArray(t) && (n = t),
this.events || (this.events = new Map),
n.forEach(i => {
let a = this.events.get(i);
a || (this.events.set(i, []),
a = []),
a.includes(e) || a.push(e),
this.events.set(i, a)
}
)
}
off(t, e) {
let n = [];
typeof t == "string" ? n = t.split(" ") : Array.isArray(t) && (n = t),
n.forEach(i => {
let a = this.events.get(i);
if (Array.isArray(a)) {
let l = a.indexOf(e);
l > -1 && a.splice(l, 1)
}
}
)
}
emit(t, ...e) {
[...this.events.get(t) || []].forEach(n => n(this, ...e)),
t !== "*" && this.emit("*", t, ...e)
}
}
;
Object.defineProperty(yt, "version", {
enumerable: !0,
configurable: !0,
writable: !0,
value: "5.0.36"
}),
Object.defineProperty(yt, "defaults", {
enumerable: !0,
configurable: !0,
writable: !0,
value: {}
});
var Zt = class extends yt {
constructor(t={}) {
super(t),
Object.defineProperty(this, "plugins", {
enumerable: !0,
configurable: !0,
writable: !0,
value: {}
})
}
attachPlugins(t={}) {
let e = new Map;
for (let[n,i] of Object.entries(t)) {
let a = this.option(n)
, l = this.plugins[n];
l || a === !1 ? l && a === !1 && (l.detach(),
delete this.plugins[n]) : e.set(n, new i(this,a || {}))
}
for (let[n,i] of e)
this.plugins[n] = i,
i.attach()
}
detachPlugins(t) {
t = t || Object.keys(this.plugins);
for (let e of t) {
let n = this.plugins[e];
n && n.detach(),
delete this.plugins[e]
}
return this.emit("detachPlugins"),
this
}
}
, G;
(function(o) {
o[o.Init = 0] = "Init",
o[o.Error = 1] = "Error",
o[o.Ready = 2] = "Ready",
o[o.Panning = 3] = "Panning",
o[o.Mousemove = 4] = "Mousemove",
o[o.Destroy = 5] = "Destroy"
}
)(G || (G = {}));
var ot = ["a", "b", "c", "d", "e", "f"]
, Ti = {
PANUP: "Move up",
PANDOWN: "Move down",
PANLEFT: "Move left",
PANRIGHT: "Move right",
ZOOMIN: "Zoom in",
ZOOMOUT: "Zoom out",
TOGGLEZOOM: "Toggle zoom level",
TOGGLE1TO1: "Toggle zoom level",
ITERATEZOOM: "Toggle zoom level",
ROTATECCW: "Rotate counterclockwise",
ROTATECW: "Rotate clockwise",
FLIPX: "Flip horizontally",
FLIPY: "Flip vertically",
FITX: "Fit horizontally",
FITY: "Fit vertically",
RESET: "Reset",
TOGGLEFS: "Toggle fullscreen"
}
, ps = {
content: null,
width: "auto",
height: "auto",
panMode: "drag",
touch: !0,
dragMinThreshold: 3,
lockAxis: !1,
mouseMoveFactor: 1,
mouseMoveFriction: .12,
zoom: !0,
pinchToZoom: !0,
panOnlyZoomed: "auto",
minScale: 1,
maxScale: 2,
friction: .25,
dragFriction: .35,
decelFriction: .05,
click: "toggleZoom",
dblClick: !1,
wheel: "zoom",
wheelLimit: 7,
spinner: !0,
bounds: "auto",
infinite: !1,
rubberband: !0,
bounce: !0,
maxVelocity: 75,
transformParent: !1,
classes: {
content: "f-panzoom__content",
isLoading: "is-loading",
canZoomIn: "can-zoom_in",
canZoomOut: "can-zoom_out",
isDraggable: "is-draggable",
isDragging: "is-dragging",
inFullscreen: "in-fullscreen",
htmlHasFullscreen: "with-panzoom-in-fullscreen"
},
l10n: Ti
}
, fi = '
{{ERROR}}
"), this.setContent(t, i) } clearContent(t) { if (t.state === void 0) return; this.emit("clearContent", t), t.contentEl && (t.contentEl.remove(), t.contentEl = void 0); let e = t.el; e && (W(e, "has-error"), W(e, "has-unknown"), W(e, `has-${t.type || "unknown"}`)), t.closeBtnEl && t.closeBtnEl.remove(), t.closeBtnEl = void 0, t.captionEl && t.captionEl.remove(), t.captionEl = void 0, t.spinnerEl && t.spinnerEl.remove(), t.spinnerEl = void 0 } getSlide() { var t; let e = this.carousel; return ((t = e?.pages[e?.page]) === null || t === void 0 ? void 0 : t.slides[0]) || void 0 } close(t, e) { if (this.isClosing()) return; let n = new Event("shouldClose",{ bubbles: !0, cancelable: !0 }); if (this.emit("shouldClose", n, t), n.defaultPrevented) return; t && t.cancelable && (t.preventDefault(), t.stopPropagation()); let i = () => { this.proceedClose(t, e) } ; this.startedFs && H && H.isFullscreen() ? Promise.resolve(H.exit()).then( () => i()) : i() } clearIdle() { this.idleTimer && clearTimeout(this.idleTimer), this.idleTimer = null } setIdle(t=!1) { let e = () => { this.clearIdle(), this.idle = !0, U(this.container, "is-idle"), this.emit("setIdle") } ; if (this.clearIdle(), !this.isClosing()) if (t) e(); else { let n = this.option("idle"); n && (this.idleTimer = setTimeout(e, n)) } } endIdle() { this.clearIdle(), this.idle && !this.isClosing() && (this.idle = !1, W(this.container, "is-idle"), this.emit("endIdle")) } resetIdle() { this.endIdle(), this.setIdle() } toggleIdle() { this.idle ? this.endIdle() : this.setIdle(!0) } toggleFullscreen() { H && (H.isFullscreen() ? H.exit() : H.request().then( () => { this.startedFs = !0 } )) } isClosing() { return [R.Closing, R.CustomClosing, R.Destroy].includes(this.state) } proceedClose(t, e) { var n, i; this.state = R.Closing, this.clearIdle(), this.detachEvents(); let a = this.container , l = this.carousel , c = this.getSlide() , u = c && this.option("placeFocusBack") ? c.triggerEl || this.option("triggerEl") : null; if (u && (zi(u) ? xi(u) : u.focus()), a && (W(a, xn), U(a, "is-closing"), a.setAttribute(Un, "true"), this.option("animated") && U(a, In), a.style.pointerEvents = "none"), l) { l.clearTransitions(), (n = l.panzoom) === null || n === void 0 || n.destroy(), (i = l.plugins.Navigation) === null || i === void 0 || i.detach(); for (let g of l.slides) { g.state = k.Closing, this.hideLoading(g); let s = g.contentEl; s && this.stop(s); let r = g?.panzoom; r && (r.stop(), r.detachEvents(), r.detachObserver()), this.isCurrentSlide(g) || l.emit("removeSlide", g) } } Yi = window.scrollX, Si = window.scrollY, window.addEventListener("scroll", this.onScroll), this.emit("close", t), this.state !== R.CustomClosing ? (e === void 0 && c && (e = this.optionFor(c, "hideClass")), e && c ? (this.animate(c.contentEl, e, () => { l && l.emit("removeSlide", c) } ), setTimeout( () => { this.destroy() } , 500)) : this.destroy()) : setTimeout( () => { this.destroy() } , 500) } destroy() { var t; if (this.state === R.Destroy) return; window.removeEventListener("scroll", this.onScroll), this.state = R.Destroy, (t = this.carousel) === null || t === void 0 || t.destroy(); let e = this.container; e && e.remove(), vt.delete(this.id); let n = o.getInstance(); n ? n.focus() : (P && (P.remove(), P = null), gt && (gt.remove(), gt = null), W(document.documentElement, Zi), ( () => { if (!Ot) return; let i = document , a = i.body; a.classList.remove(vn), a.style.setProperty(Xi, ""), i.documentElement.style.setProperty(Di, "") } )(), this.emit("destroy")) } static bind(t, e, n) { if (!Ot) return; let i, a = "", l = {}; if (t === void 0 ? i = document.body : ct(t) ? (i = document.body, a = t, typeof e == "object" && (l = e || {})) : (i = t, ct(e) && (a = e), typeof n == "object" && (l = n || {})), !i || !V(i)) return; a = a || "[data-fancybox]"; let c = o.openers.get(i) || new Map; c.set(a, l), o.openers.set(i, c), c.size === 1 && i.addEventListener("click", o.fromEvent) } static unbind(t, e) { let n, i = ""; if (ct(t) ? (n = document.body, i = t) : (n = t, ct(e) && (i = e)), !n) return; let a = o.openers.get(n); a && i && a.delete(i), i && a || (o.openers.delete(n), n.removeEventListener("click", o.fromEvent)) } static destroy() { let t; for (; t = o.getInstance(); ) t.destroy(); for (let e of o.openers.keys()) e.removeEventListener("click", o.fromEvent); o.openers = new Map } static fromEvent(t) { if (t.defaultPrevented || t.button && t.button !== 0 || t.ctrlKey || t.metaKey || t.shiftKey) return; let e = t.composedPath()[0] , n = e.closest("[data-fancybox-trigger]"); if (n) { let b = n.dataset.fancyboxTrigger || "" , m = document.querySelectorAll(`[data-fancybox="${b}"]`) , p = parseInt(n.dataset.fancyboxIndex || "", 10) || 0; e = m[p] || e } if (!(e && e instanceof Element)) return; let i, a, l, c; if ([...o.openers].reverse().find( ([b,m]) => !(!b.contains(e) || ![...m].reverse().find( ([p,Q]) => { let f = e.closest(p); return !!f && (i = b, a = p, l = f, c = Q, !0) } ))), !i || !a || !l) return; c = c || {}, t.preventDefault(), e = l; let u = [] , g = Y({}, Mn, c); g.event = t, g.triggerEl = e, g.delegate = n; let s = g.groupAll , r = g.groupAttr , d = r && e ? e.getAttribute(`${r}`) : ""; if ((!e || d || s) && (u = [].slice.call(i.querySelectorAll(a))), e && !s && (u = d ? u.filter(b => b.getAttribute(`${r}`) === d) : [e]), !u.length) return; let h = o.getInstance(); return h && h.options.triggerEl && u.indexOf(h.options.triggerEl) > -1 ? void 0 : (e && (g.startIndex = u.indexOf(e)), o.fromNodes(u, g)) } static fromSelector(t, e, n) { let i = null , a = "" , l = {}; if (ct(t) ? (i = document.body, a = t, typeof e == "object" && (l = e || {})) : t instanceof HTMLElement && ct(e) && (i = t, a = e, typeof n == "object" && (l = n || {})), !i || !a) return !1; let c = o.openers.get(i); return !!c && (l = Y({}, c.get(a) || {}, l), !!l && o.fromNodes(Array.from(i.querySelectorAll(a)), l)) } static fromNodes(t, e) { e = Y({}, Mn, e || {}); let n = []; for (let i of t) { let a = i.dataset || {}, l = a[Bt] || i.getAttribute(Cn) || i.getAttribute("currentSrc") || i.getAttribute(Bt) || void 0, c, u = e.delegate, g; u && n.length === e.startIndex && (c = u instanceof HTMLImageElement ? u : u.querySelector("img:not([aria-hidden])")), c || (c = i instanceof HTMLImageElement ? i : i.querySelector("img:not([aria-hidden])")), c && (g = c.currentSrc || c[Bt] || void 0, !g && c.dataset && (g = c.dataset.lazySrc || c.dataset[Bt] || void 0)); let s = { src: l, triggerEl: i, thumbEl: c, thumbElSrc: g, thumbSrc: g }; for (let r in a) { let d = a[r] + ""; d = d !== "false" && (d === "true" || d), s[r] = d } n.push(s) } return new o(n,e) } static getInstance(t) { return t ? vt.get(t) : Array.from(vt.values()).reverse().find(e => !e.isClosing() && e) || null } static getSlide() { var t; return ((t = o.getInstance()) === null || t === void 0 ? void 0 : t.getSlide()) || null } static show(t=[], e={}) { return new o(t,e) } static next() { let t = o.getInstance(); t && t.next() } static prev() { let t = o.getInstance(); t && t.prev() } static close(t=!0, ...e) { if (t) for (let n of vt.values()) n.close(...e); else { let n = o.getInstance(); n && n.close(...e) } } } ; Object.defineProperty(K, "version", { enumerable: !0, configurable: !0, writable: !0, value: "5.0.36" }), Object.defineProperty(K, "defaults", { enumerable: !0, configurable: !0, writable: !0, value: Mn }), Object.defineProperty(K, "Plugins", { enumerable: !0, configurable: !0, writable: !0, value: ws }), Object.defineProperty(K, "openers", { enumerable: !0, configurable: !0, writable: !0, value: new Map }); var On = class extends A { initialize() { this.forceClose = this.forceClose.bind(this) } connect() { this.openValue && this.open(), document.addEventListener("turbo:before-render", this.forceClose) } disconnect() { document.removeEventListener("turbo:before-render", this.forceClose) } open() { this.dialogTarget.showModal() } close() { this.dialogTarget.setAttribute("closing", ""), Promise.all(this.dialogTarget.getAnimations().map(t => t.finished)).then( () => { this.dialogTarget.removeAttribute("closing"), this.dialogTarget.close() } ) } backdropClose(t) { t.target === this.dialogTarget && this.close() } forceClose() { this.dialogTarget.close() } } ; On.targets = ["dialog"], On.values = { open: { type: Boolean, default: !1 } }; var to = On; var Zn = {}; S(Zn, { default: () => Dt }); var Dt = class extends A { connect() { this.nextNote = !1 } audioPlayerTargetConnected(o) { let t = o.querySelector("audio"); t.volume = this.volumeValue } playAudio(o) { let t = o.target; o.target.classList.contains("audio-player") || (t = o.target.closest(".audio-player")); let e = t.querySelector("audio"); if (this.playingValue && this.playingValue != t.id) { let n = document.getElementById(this.playingValue); n && n.querySelector("audio").pause() } e.paused && e.play(), t.classList.add("playing"), this.playingValue = t.id, t.dataset.bpm && (this.bpmValue = t.dataset.bpm) } toggleAudio(o) { let t = o.target; o.target.classList.contains("audio-player") || (t = o.target.closest(".audio-player")); let e = t.querySelector("audio"); t.classList.contains("playing") ? e.pause() : e.play() } pauseAudio(o) { let t = o.target; o.target.classList.contains("audio-player") || (t = o.target.closest(".audio-player")); let e = t.querySelector("audio"); t.classList.remove("playing"), document.querySelector(".audio-player.playing") || (this.playingValue = "") } spawnNote() { if (this.playingValue) { let o = document.getElementById(this.playingValue); if (o) { let t = o.querySelector(".audio-player__dog"); if (t) { o.classList.contains("playing-alt") ? o.classList.remove("playing-alt") : o.classList.add("playing-alt"); let e = document.createElement("img"); e.src = "/assets/images/note-small.png", e.classList.add("absolute", "animate-note", "z-30", "pixel"), e.width = 18, e.height = 18; let n = Math.floor(Math.random() * 10) - 10 , i = Math.floor(Math.random() * 10) - 5 , a = Math.floor(Math.random() * 10) - 40; e.setAttribute("style", `top: ${Math.floor(Math.random() * 10) - 10}; left: ${Math.floor(Math.random() * 30) + 40}%; offset-path: path('M 0 0 C ${n} ${n / 2} ${i} ${a} ${i} ${a}`), t.appendChild(e), setTimeout(function() { e.remove() }, 1e3), o.dataset.bpm && (this.bpmValue = o.dataset.bpm), this.nextNote = setTimeout(this.spawnNote.bind(this), 60 / this.bpmValue * 1e3) } } } } updateVolume(o) { o.target.muted ? (this.mutedValue = !0, this.volumeValue = 0) : (this.mutedValue = !1, this.volumeValue = o.target.volume); for (let t of this.audioPlayerTargets) { let e = t.querySelector("audio"); e.volume = this.volumeValue } } stopNotes() { this.nextNote && (clearTimeout(this.nextNote), this.nextNote = !1) } syncNotes() { this.stopNotes(), this.spawnNote() } } ; M(Dt, "targets", ["audioPlayer"]), M(Dt, "values", { playing: { type: String }, bpm: { type: Number, default: 90 }, volume: { type: Number, default: .5 }, muted: { type: Boolean, default: !1 } }); var Dn = {}; S(Dn, { default: () => Ae }); var Ae = class extends A { connect() { let o = Math.floor(Math.random() * 4) + 8; this.generateStars(o, "left"), this.generateStars(o, "right"), setTimeout(function() { document.getElementById("ch5_cover").classList.add("!hidden") }, 3500) } generateStars(o, t) { for (let e = 0; e < o; e++) { let n = Math.floor(Math.random() * 30) + 10 , i = Math.floor(Math.random() * 15) + 10 + e * 10; this.appendStar(n, i, t) } } appendStar(o, t, e) { let n = Math.floor(Math.random() * 7) + 1 , i = Math.floor(Math.random() * 12) / 3 , a = document.createElement("img"); a.setAttribute("class", "absolute image-pixel animate-ch5-star md:scale-125 lg:scale-150"), a.setAttribute("src", `/assets/images/ch5-star-${n}.png`), a.setAttribute("alt", "Star"), a.setAttribute("aria-hidden", "true"), a.setAttribute("style", `top: ${t}%; right: ${o}%; animation-delay: -${i}s`), e == "left" ? this.containerLeftTarget.append(a) : this.containerRightTarget.append(a) } skipIntro() { this.coverTarget.classList.add("!hidden"), this.logoTarget.currentTime = 2; for (let o of document.querySelectorAll(".skippable")) o.setAttribute("style", "animation-delay: 0s") } } ; M(Ae, "targets", ["star", "containerLeft", "containerRight", "cover", "logo"]); var Yn = {}; S(Yn, { default: () => kt }); var Xn = typeof navigator < "u" ? navigator.userAgent.toLowerCase().indexOf("firefox") > 0 : !1; function En(o, t, e, n) { o.addEventListener ? o.addEventListener(t, e, n) : o.attachEvent && o.attachEvent(`on${t}`, e) } function Xt(o, t, e, n) { o && (o.removeEventListener ? o.removeEventListener(t, e, n) : o.detachEvent && o.detachEvent(`on${t}`, e)) } function io(o, t) { let e = t.slice(0, t.length - 1) , n = []; for (let i = 0; i < e.length; i++) n.push(o[e[i].toLowerCase()]); return n } function oo(o) { typeof o != "string" && (o = ""), o = o.replace(/\s/g, ""); let t = o.split(",") , e = t.lastIndexOf(""); for (; e >= 0; ) t[e - 1] += ",", t.splice(e, 1), e = t.lastIndexOf(""); return t } function As(o, t) { let e = o.length >= t.length ? o : t , n = o.length >= t.length ? t : o , i = !0; for (let a = 0; a < e.length; a++) n.indexOf(e[a]) === -1 && (i = !1); return i } function so(o) { let t = o.keyCode || o.which || o.charCode; return o.key && /^[a-z]$/i.test(o.key) ? o.key.toUpperCase().charCodeAt(0) : (o.code && /^Key[A-Z]$/.test(o.code) && (t = o.code.charCodeAt(3)), t) } var jt = { backspace: 8, "\u232B": 8, tab: 9, clear: 12, enter: 13, "\u21A9": 13, return: 13, esc: 27, escape: 27, space: 32, left: 37, up: 38, right: 39, down: 40, arrowup: 38, arrowdown: 40, arrowleft: 37, arrowright: 39, del: 46, delete: 46, ins: 45, insert: 45, home: 36, end: 35, pageup: 33, pagedown: 34, capslock: 20, num_0: 96, num_1: 97, num_2: 98, num_3: 99, num_4: 100, num_5: 101, num_6: 102, num_7: 103, num_8: 104, num_9: 105, num_multiply: 106, num_add: 107, num_enter: 108, num_subtract: 109, num_decimal: 110, num_divide: 111, "\u21EA": 20, ",": 188, ".": 190, "/": 191, "`": 192, "-": Xn ? 173 : 189, "=": Xn ? 61 : 187, ";": Xn ? 59 : 186, "'": 222, "{": 219, "}": 221, "[": 219, "]": 221, "\\": 220 } , q = { "\u21E7": 16, shift: 16, "\u2325": 18, alt: 18, option: 18, "\u2303": 17, ctrl: 17, control: 17, "\u2318": 91, cmd: 91, meta: 91, command: 91 } , Et = { 16: "shiftKey", 18: "altKey", 17: "ctrlKey", 91: "metaKey", shiftKey: 16, ctrlKey: 17, altKey: 18, metaKey: 91 } , j = { 16: !1, 18: !1, 17: !1, 91: !1 } , D = {}; for (let o = 1; o < 20; o++) jt[`f${o}`] = 111 + o; var Z = [] , Nt = null , It = null , ao = "all" , rt = new Map , xt = o => jt[o.toLowerCase()] || q[o.toLowerCase()] || o.toUpperCase().charCodeAt(0) , Ms = o => Object.keys(jt).find(t => jt[t] === o) , Ws = o => Object.keys(q).find(t => q[t] === o) , ro = o => { ao = o || "all" } , Rt = () => ao || "all" , Gs = () => Z.slice(0) , Os = () => Z.map(o => Ms(o) || Ws(o) || String.fromCharCode(o)) , Zs = () => { let o = []; return Object.keys(D).forEach(t => { D[t].forEach( ({key: e, scope: n, mods: i, shortcut: a}) => { o.push({ scope: n, shortcut: a, mods: i, keys: e.split("+").map(l => xt(l)) }) } ) } ), o } , lo = o => { let t = o.target || o.srcElement , {tagName: e} = t , n = !0 , i = e === "INPUT" && !["checkbox", "radio", "range", "button", "file", "reset", "submit", "color"].includes(t.type); return (t.isContentEditable || (i || e === "TEXTAREA" || e === "SELECT") && !t.readOnly) && (n = !1), n } , Ds = o => (typeof o == "string" && (o = xt(o)), Z.indexOf(o) !== -1) , Xs = (o, t) => { let e, n; o || (o = Rt()); for (let i in D) if (Object.prototype.hasOwnProperty.call(D, i)) for (e = D[i], n = 0; n < e.length; ) e[n].scope === o ? e.splice(n, 1).forEach( ({element: l}) => jn(l)) : n++; Rt() === o && ro(t || "all") } ; function Es(o) { let t = so(o); o.key && o.key.toLowerCase() === "capslock" && (t = xt(o.key)); let e = Z.indexOf(t); if (e >= 0 && Z.splice(e, 1), o.key && o.key.toLowerCase() === "meta" && Z.splice(0, Z.length), (t === 93 || t === 224) && (t = 91), t in j) { j[t] = !1; for (let n in q) q[n] === t && ($[n] = !1) } } var co = (o, ...t) => { if (typeof o > "u") Object.keys(D).forEach(e => { Array.isArray(D[e]) && D[e].forEach(n => Me(n)), delete D[e] } ), jn(null); else if (Array.isArray(o)) o.forEach(e => { e.key && Me(e) } ); else if (typeof o == "object") o.key && Me(o); else if (typeof o == "string") { let[e,n] = t; typeof e == "function" && (n = e, e = ""), Me({ key: o, scope: e, method: n, splitKey: "+" }) } } , Me = ({key: o, scope: t, method: e, splitKey: n="+"}) => { oo(o).forEach(a => { let l = a.split(n) , c = l.length , u = l[c - 1] , g = u === "*" ? "*" : xt(u); if (!D[g]) return; t || (t = Rt()); let s = c > 1 ? io(q, l) : [] , r = []; D[g] = D[g].filter(d => { let b = (e ? d.method === e : !0) && d.scope === t && As(d.mods, s); return b && r.push(d.element), !b } ), r.forEach(d => jn(d)) } ) } ; function eo(o, t, e, n) { if (t.element !== n) return; let i; if (t.scope === e || t.scope === "all") { i = t.mods.length > 0; for (let a in j) Object.prototype.hasOwnProperty.call(j, a) && (!j[a] && t.mods.indexOf(+a) > -1 || j[a] && t.mods.indexOf(+a) === -1) && (i = !1); (t.mods.length === 0 && !j[16] && !j[18] && !j[17] && !j[91] || i || t.shortcut === "*") && (t.keys = [], t.keys = t.keys.concat(Z), t.method(o, t) === !1 && (o.preventDefault ? o.preventDefault() : o.returnValue = !1, o.stopPropagation && o.stopPropagation(), o.cancelBubble && (o.cancelBubble = !0))) } } function no(o, t) { let e = D["*"] , n = so(o); if (o.key && o.key.toLowerCase() === "capslock" || !($.filter || lo).call(this, o)) return; if ((n === 93 || n === 224) && (n = 91), Z.indexOf(n) === -1 && n !== 229 && Z.push(n), ["metaKey", "ctrlKey", "altKey", "shiftKey"].forEach(u => { let g = Et[u]; o[u] && Z.indexOf(g) === -1 ? Z.push(g) : !o[u] && Z.indexOf(g) > -1 ? Z.splice(Z.indexOf(g), 1) : u === "metaKey" && o[u] && (Z = Z.filter(s => s in Et || s === n)) } ), n in j) { j[n] = !0; for (let u in q) if (Object.prototype.hasOwnProperty.call(q, u)) { let g = Et[q[u]]; $[u] = o[g] } if (!e) return } for (let u in j) Object.prototype.hasOwnProperty.call(j, u) && (j[u] = o[Et[u]]); o.getModifierState && !(o.altKey && !o.ctrlKey) && o.getModifierState("AltGraph") && (Z.indexOf(17) === -1 && Z.push(17), Z.indexOf(18) === -1 && Z.push(18), j[17] = !0, j[18] = !0); let a = Rt(); if (e) for (let u = 0; u < e.length; u++) e[u].scope === a && (o.type === "keydown" && e[u].keydown || o.type === "keyup" && e[u].keyup) && eo(o, e[u], a, t); if (!(n in D)) return; let l = D[n] , c = l.length; for (let u = 0; u < c; u++) if ((o.type === "keydown" && l[u].keydown || o.type === "keyup" && l[u].keyup) && l[u].key) { let g = l[u] , {splitKey: s} = g , r = g.key.split(s) , d = []; for (let h = 0; h < r.length; h++) d.push(xt(r[h])); d.sort().join("") === Z.sort().join("") && eo(o, g, a, t) } } var $ = function o(t, e, n) { Z = []; let i = oo(t) , a = [] , l = "all" , c = document , u = 0 , g = !1 , s = !0 , r = "+" , d = !1 , h = !1; if (n === void 0 && typeof e == "function" && (n = e), Object.prototype.toString.call(e) === "[object Object]") { let b = e; b.scope && (l = b.scope), b.element && (c = b.element), b.keyup && (g = b.keyup), b.keydown !== void 0 && (s = b.keydown), b.capture !== void 0 && (d = b.capture), typeof b.splitKey == "string" && (r = b.splitKey), b.single === !0 && (h = !0) } for (typeof e == "string" && (l = e), h && co(t, l); u < i.length; u++) { let b = i[u].split(r); a = [], b.length > 1 && (a = io(q, b)); let m = b[b.length - 1]; m = m === "*" ? "*" : xt(m), m in D || (D[m] = []), D[m].push({ keyup: g, keydown: s, scope: l, mods: a, shortcut: i[u], method: n, key: i[u], splitKey: r, element: c }) } if (typeof c < "u" && typeof window < "u") { if (!rt.has(c)) { let b = (p=window.event) => no(p, c) , m = (p=window.event) => { no(p, c), Es(p) } ; rt.set(c, { keydownListener: b, keyupListenr: m, capture: d }), En(c, "keydown", b, d), En(c, "keyup", m, d) } if (!Nt) { let b = () => { Z = [] } ; Nt = { listener: b, capture: d }, En(window, "focus", b, d) } if (!It && typeof document < "u") { let b = () => { Z = []; for (let Q in j) j[Q] = !1; for (let Q in q) o[Q] = !1 } , m = b , p = b; document.addEventListener("fullscreenchange", m), document.addEventListener("webkitfullscreenchange", p), It = { fullscreen: m, webkit: p } } } }; function Ns(o, t="all") { Object.keys(D).forEach(e => { D[e].filter(i => i.scope === t && i.shortcut === o).forEach(i => { i && i.method && i.method({}, i) } ) } ) } function jn(o) { let t = Object.values(D).flat(); if (t.findIndex( ({element: n}) => n === o) < 0 && o) { let {keydownListener: n, keyupListenr: i, capture: a} = rt.get(o) || {}; n && i && (Xt(o, "keyup", i, a), Xt(o, "keydown", n, a), rt.delete(o)) } if (t.length <= 0 || rt.size <= 0) { if (Array.from(rt.keys()).forEach(i => { let {keydownListener: a, keyupListenr: l, capture: c} = rt.get(i) || {}; a && l && (Xt(i, "keyup", l, c), Xt(i, "keydown", a, c), rt.delete(i)) } ), rt.clear(), Object.keys(D).forEach(i => delete D[i]), Nt) { let {listener: i, capture: a} = Nt; Xt(window, "focus", i, a), Nt = null } It && typeof document < "u" && (document.removeEventListener("fullscreenchange", It.fullscreen), document.removeEventListener("webkitfullscreenchange", It.webkit), It = null) } } var Nn = { getPressedKeyString: Os, setScope: ro, getScope: Rt, deleteScope: Xs, getPressedKeyCodes: Gs, getAllKeyCodes: Zs, isPressed: Ds, filter: lo, trigger: Ns, unbind: co, keyMap: jt, modifier: q, modifierMap: Et }; for (let o in Nn) { let t = o; Object.prototype.hasOwnProperty.call(Nn, t) && ($[t] = Nn[t]) } if (typeof window < "u") { let o = window.hotkeys; $.noConflict = t => (t && window.hotkeys === $ && (window.hotkeys = o), $), window.hotkeys = $ } function js(o, t) { var e = {}; for (var n in o) Object.prototype.hasOwnProperty.call(o, n) && t.indexOf(n) < 0 && (e[n] = o[n]); if (o != null && typeof Object.getOwnPropertySymbols == "function") for (var i = 0, n = Object.getOwnPropertySymbols(o); i < n.length; i++) t.indexOf(n[i]) < 0 && Object.prototype.propertyIsEnumerable.call(o, n[i]) && (e[n[i]] = o[n[i]]); return e } var Rn = { debug: !1, logger: console, dispatchEvent: !0, eventPrefix: !0 } , kn = class { constructor(t, e={}) { var n, i, a; this.log = (u, g) => { this.debug && (this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${u}`, "color: #3B82F6", "color: unset"), this.logger.log(Object.assign({ controllerId: this.controllerId }, g)), this.logger.groupEnd()) } , this.warn = u => { this.logger.warn(`%c${this.controller.identifier} %c${u}`, "color: #3B82F6; font-weight: bold", "color: unset") } , this.dispatch = (u, g={}) => { if (this.dispatchEvent) { let {event: s} = g , r = js(g, ["event"]) , d = this.extendedEvent(u, s || null, r); this.targetElement.dispatchEvent(d), this.log("dispatchEvent", Object.assign({ eventName: d.type }, r)) } } , this.call = (u, g={}) => { let s = this.controller[u]; if (typeof s == "function") return s.call(this.controller, g) } , this.extendedEvent = (u, g, s) => { let {bubbles: r, cancelable: d, composed: h} = g || { bubbles: !0, cancelable: !0, composed: !0 }; return g && Object.assign(s, { originalEvent: g }), new CustomEvent(this.composeEventName(u),{ bubbles: r, cancelable: d, composed: h, detail: s }) } , this.composeEventName = u => { let g = u; return this.eventPrefix === !0 ? g = `${this.controller.identifier}:${u}` : typeof this.eventPrefix == "string" && (g = `${this.eventPrefix}:${u}`), g } , this.debug = (i = (n = e?.debug) !== null && n !== void 0 ? n : t.application.stimulusUseDebug) !== null && i !== void 0 ? i : Rn.debug, this.logger = (a = e?.logger) !== null && a !== void 0 ? a : Rn.logger, this.controller = t, this.controllerId = t.element.id || t.element.dataset.id, this.targetElement = e?.element || t.element; let {dispatchEvent: l, eventPrefix: c} = Object.assign({}, Rn, e); Object.assign(this, { dispatchEvent: l, eventPrefix: c }), this.controllerInitialize = t.initialize.bind(t), this.controllerConnect = t.connect.bind(t), this.controllerDisconnect = t.disconnect.bind(t) } } , Vn = class extends kn { constructor(t, e) { super(t, e), this.bind = () => { for (let[n,i] of Object.entries(this.hotkeysOptions.hotkeys)) { let a = i.handler.bind(this.controller); $(n, i.options, l => a(l, l)) } } , this.unbind = () => { for (let n in this.hotkeysOptions.hotkeys) $.unbind(n) } , this.controller = t, this.hotkeysOptions = e, this.enhanceController(), this.bind() } enhanceController() { this.hotkeysOptions.filter && ($.filter = this.hotkeysOptions.filter); let t = this.controller.disconnect.bind(this.controller) , e = () => { this.unbind(), t() } ; Object.assign(this.controller, { disconnect: e }) } } , Rs = o => ({ handler: o[0], options: { element: o[1] } }) , ks = o => { if (!o.hotkeys) { let t = {}; Object.entries(o).forEach( ([e,n]) => { Object.defineProperty(t, e, { value: Rs(n), writable: !1, enumerable: !0 }) } ), o = { hotkeys: t } } return o } , uo = (o, t) => new Vn(o,ks(t)); var kt = class extends A { connect() { this.butTarget.style.left = "120%", uo(this, { hotkeys: { left: { handler: this.startMove, options: { keydown: !0, keyup: !0 } } } }), window.requestAnimationFrame(this.moveLeft.bind(this)) } startMove(o) { o.type == "keydown" ? this.movingValue = !0 : this.movingValue = !1 } moveLeft() { if (this.movingValue) { let o = this.butTarget.style.left.replace("%", ""); o > 75 && (this.butTarget.style.left = `${o - .05}%`) } window.requestAnimationFrame(this.moveLeft.bind(this)) } } ; M(kt, "targets", ["but"]), M(kt, "values", { moving: { type: Boolean, default: !1 } }); var Sn = {}; S(Sn, { default: () => Vt }); var Vt = class extends A { connect() { this.localeValue = document.querySelector('meta[property="og:locale"]').content, this.getLatestCountdown() } updateCountdown() { this.timeSinceRefreshValue += 1, this.timeSinceRefreshValue >= 300 && (this.timeSinceRefreshValue = 0, this.getLatestCountdown()); let o = new Date().getTime() , t = new Date(this.timeValue) , e = "" , n = t.getTime() - o , i = Math.floor(n / (1e3 * 60 * 60 * 24)); i < 10 && i > 0 && (i = `0${i}`); let a = Math.floor(n % (1e3 * 60 * 60 * 24) / (1e3 * 60 * 60)); a < 10 && a >= 0 && (a = `0${a}`); let l = Math.floor(n % (1e3 * 60 * 60) / (1e3 * 60)); l < 10 && l >= 0 && (l = `0${l}`), l == 0 && (l = "00"); let c = Math.floor(n % (1e3 * 60) / 1e3); if (c < 10 && (c = `0${c}`), i == 0 ? a == 0 ? e = " scale-[1.5]" : e = " scale-[1.3]" : i <= 3 && (e = " scale-[1.1]"), !this.endedValue) if (n < 0) { let u = document.getElementById("game"); u.classList.add("motion-safe:opacity-0", "motion-safe:animate-fade-in"), u.setAttribute("style", "animation-delay: 3.5s"), document.getElementById("ch5_countdown").replaceWith(document.getElementById("game")), this.endedValue = !0 } else { if (this.localeValue == "ja_JP") { let u = this.timeValue.substring(8, 10); this.dateTarget.innerHTML = `${this.timeValue.substring(0, 4)}\u5E74${this.timeValue.substring(6, 7)}\u6708${parseInt(u) + 1}\u65E5\u3000\u30EA\u30EA\u30FC\u30B9` } else { let u = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] , g = this.timeValue.substring(8, 10); this.dateTarget.innerHTML = `Releasing on