this.wordle = this.wordle || {}, this.wordle.bundle = function(e) {
"use strict";
function a(e) {
return (a = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
return typeof e
} : function(e) {
return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e
})(e)
}
function s(e, a) {
if (!(e instanceof a)) throw new TypeError("Cannot call a class as a function")
}
function t(e, a) {
for (var s = 0; s < a.length; s++) {
var t = a[s];
t.enumerable = t.enumerable || !1, t.configurable = !0, "value" in t && (t.writable = !0), Object.defineProperty(e, t.key, t)
}
}
function o(e, a, s) {
return a && t(e.prototype, a), s && t(e, s), e
}
function n(e, a, s) {
return a in e ? Object.defineProperty(e, a, {
value: s,
enumerable: !0,
configurable: !0,
writable: !0
}) : e[a] = s, e
}
function r(e, a) {
if ("function" != typeof a && null !== a) throw new TypeError("Super expression must either be null or a function");
e.prototype = Object.create(a && a.prototype, {
constructor: {
value: e,
writable: !0,
configurable: !0
}
}), a && l(e, a)
}
function i(e) {
return (i = Object.setPrototypeOf ? Object.getPrototypeOf : function(e) {
return e.__proto__ || Object.getPrototypeOf(e)
})(e)
}
function l(e, a) {
return (l = Object.setPrototypeOf || function(e, a) {
return e.__proto__ = a, e
})(e, a)
}
function d() {
if ("undefined" == typeof Reflect || !Reflect.construct) return !1;
if (Reflect.construct.sham) return !1;
if ("function" == typeof Proxy) return !0;
try {
return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], (function() {}))), !0
} catch (e) {
return !1
}
}
function u(e, a, s) {
return (u = d() ? Reflect.construct : function(e, a, s) {
var t = [null];
t.push.apply(t, a);
var o = new(Function.bind.apply(e, t));
return s && l(o, s.prototype), o
}).apply(null, arguments)
}
function c(e) {
var a = "function" == typeof Map ? new Map : void 0;
return (c = function(e) {
if (null === e || (s = e, -1 === Function.toString.call(s).indexOf("[native code]"))) return e;
var s;
if ("function" != typeof e) throw new TypeError("Super expression must either be null or a function");
if (void 0 !== a) {
if (a.has(e)) return a.get(e);
a.set(e, t)
}
function t() {
return u(e, arguments, i(this).constructor)
}
return t.prototype = Object.create(e.prototype, {
constructor: {
value: t,
enumerable: !1,
writable: !0,
configurable: !0
}
}), l(t, e)
})(e)
}
function p(e) {
if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
return e
}
function m(e, a) {
return !a || "object" != typeof a && "function" != typeof a ? p(e) : a
}
function h(e) {
var a = d();
return function() {
var s, t = i(e);
if (a) {
var o = i(this).constructor;
s = Reflect.construct(t, arguments, o)
} else s = t.apply(this, arguments);
return m(this, s)
}
}
function y(e, a) {
return function(e) {
if (Array.isArray(e)) return e
}(e) || function(e, a) {
var s = null == e ? null : "undefined" != typeof Symbol && e[Symbol.iterator] || e["@@iterator"];
if (null == s) return;
var t, o, n = [],
r = !0,
i = !1;
try {
for (s = s.call(e); !(r = (t = s.next()).done) && (n.push(t.value), !a || n.length !== a); r = !0);
} catch (e) {
i = !0, o = e
} finally {
try {
r || null == s.return || s.return()
} finally {
if (i) throw o
}
}
return n
}(e, a) || b(e, a) || function() {
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}()
}
function g(e) {
return function(e) {
if (Array.isArray(e)) return f(e)
}(e) || function(e) {
if ("undefined" != typeof Symbol && null != e[Symbol.iterator] || null != e["@@iterator"]) return Array.from(e)
}(e) || b(e) || function() {
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")
}()
}
function b(e, a) {
if (e) {
if ("string" == typeof e) return f(e, a);
var s = Object.prototype.toString.call(e).slice(8, -1);
return "Object" === s && e.constructor && (s = e.constructor.name), "Map" === s || "Set" === s ? Array.from(e) : "Arguments" === s || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(s) ? f(e, a) : void 0
}
}
function f(e, a) {
(null == a || a > e.length) && (a = e.length);
for (var s = 0, t = new Array(a); s < a; s++) t[s] = e[s];
return t
}
var k = document.createElement("template");
k.innerHTML = "\n\n
\n";
var v = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
return s(this, t), n(p(e = a.call(this)), "_letter", ""), n(p(e), "_state", "empty"), n(p(e), "_animation", "idle"), n(p(e), "_last", !1), n(p(e), "_reveal", !1), e.attachShadow({
mode: "open"
}), e
}
return o(t, [{
key: "last",
set: function(e) {
this._last = e
}
}, {
key: "connectedCallback",
value: function() {
var e = this;
this.shadowRoot.appendChild(k.content.cloneNode(!0)), this.$tile = this.shadowRoot.querySelector(".tile"), this.$tile.addEventListener("animationend", (function(a) {
"PopIn" === a.animationName && (e._animation = "idle"), "FlipIn" === a.animationName && (e.$tile.dataset.state = e._state, e._animation = "flip-out"), "FlipOut" === a.animationName && (e._animation = "idle", e._last && e.dispatchEvent(new CustomEvent("game-last-tile-revealed-in-row", {
bubbles: !0,
composed: !0
}))), e._render()
})), this._render()
}
}, {
key: "attributeChangedCallback",
value: function(e, a, s) {
switch (e) {
case "letter":
if (s === a) break;
var t = "null" === s ? "" : s;
this._letter = t, this._state = t ? "tbd" : "empty", this._animation = t ? "pop" : "idle";
break;
case "evaluation":
if (!s) break;
this._state = s;
break;
case "reveal":
this._animation = "flip-in", this._reveal = !0
}
this._render()
}
}, {
key: "_render",
value: function() {
this.$tile && (this.$tile.textContent = this._letter, ["empty", "tbd"].includes(this._state) && (this.$tile.dataset.state = this._state), (["empty", "tbd"].includes(this._state) || this._reveal) && this.$tile.dataset.animation != this._animation && (this.$tile.dataset.animation = this._animation))
}
}], [{
key: "observedAttributes",
get: function() {
return ["letter", "evaluation", "reveal"]
}
}]), t
}(c(HTMLElement));
customElements.define("game-tile", v);
var w = document.createElement("template");
w.innerHTML = '\n \n \n';
var x = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
return s(this, t), (e = a.call(this)).attachShadow({
mode: "open"
}), e._letters = "", e._evaluation = [], e._length, e
}
return o(t, [{
key: "evaluation",
get: function() {
return this._evaluation
},
set: function(e) {
var a = this;
this._evaluation = e, this.$tiles && this.$tiles.forEach((function(e, s) {
e.setAttribute("evaluation", a._evaluation[s]), setTimeout((function() {
e.setAttribute("reveal", "")
}), 300 * s)
}))
}
}, {
key: "connectedCallback",
value: function() {
var e = this;
this.shadowRoot.appendChild(w.content.cloneNode(!0)), this.$row = this.shadowRoot.querySelector(".row");
for (var a = function(a) {
var s = document.createElement("game-tile"),
t = e._letters[a];
(t && s.setAttribute("letter", t), e._evaluation[a]) && (s.setAttribute("evaluation", e._evaluation[a]), setTimeout((function() {
s.setAttribute("reveal", "")
}), 100 * a));
a === e._length - 1 && (s.last = !0), e.$row.appendChild(s)
}, s = 0; s < this._length; s++) a(s);
this.$tiles = this.shadowRoot.querySelectorAll("game-tile"), this.addEventListener("animationend", (function(a) {
"Shake" === a.animationName && e.removeAttribute("invalid")
}))
}
}, {
key: "attributeChangedCallback",
value: function(e, a, s) {
switch (e) {
case "letters":
this._letters = s || "";
break;
case "length":
this._length = parseInt(s, 10);
break;
case "win":
if (null === s) {
this.$tiles.forEach((function(e) {
e.classList.remove("win")
}));
break
}
this.$tiles.forEach((function(e, a) {
e.classList.add("win"), e.style.animationDelay = "".concat(100 * a, "ms")
}))
}
this._render()
}
}, {
key: "_render",
value: function() {
var e = this;
this.$row && this.$tiles.forEach((function(a, s) {
var t = e._letters[s];
t ? a.setAttribute("letter", t) : a.removeAttribute("letter")
}))
}
}], [{
key: "observedAttributes",
get: function() {
return ["letters", "length", "invalid", "win"]
}
}]), t
}(c(HTMLElement));
customElements.define("game-row", x);
var z = document.createElement("template");
z.innerHTML = "\n \n";
var j = "darkTheme",
S = "colorBlindTheme",
_ = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
s(this, t), n(p(e = a.call(this)), "isDarkTheme", !1), n(p(e), "isColorBlindTheme", !1), e.attachShadow({
mode: "open"
});
var o = JSON.parse(window.localStorage.getItem(j)),
r = window.matchMedia("(prefers-color-scheme: dark)").matches,
i = JSON.parse(window.localStorage.getItem(S));
return !0 === o || !1 === o ? e.setDarkTheme(o) : r && e.setDarkTheme(!0), !0 !== i && !1 !== i || e.setColorBlindTheme(i), e
}
return o(t, [{
key: "setDarkTheme",
value: function(e) {
var a = document.querySelector("body");
e && !a.classList.contains("nightmode") ? a.classList.add("nightmode") : a.classList.remove("nightmode"), this.isDarkTheme = e, window.localStorage.setItem(j, JSON.stringify(e))
}
}, {
key: "setColorBlindTheme",
value: function(e) {
var a = document.querySelector("body");
e && !a.classList.contains("colorblind") ? a.classList.add("colorblind") : a.classList.remove("colorblind"), this.isColorBlindTheme = e, window.localStorage.setItem(S, JSON.stringify(e))
}
}, {
key: "connectedCallback",
value: function() {
var e = this;
this.shadowRoot.appendChild(z.content.cloneNode(!0)), this.shadowRoot.addEventListener("game-setting-change", (function(a) {
var s = a.detail,
t = s.name,
o = s.checked;
switch (t) {
case "dark-theme":
return void e.setDarkTheme(o);
case "color-blind-theme":
return void e.setColorBlindTheme(o)
}
}))
}
}]), t
}(c(HTMLElement));
function q(e, a) {
return e === a || e != e && a != a
}
function E(e, a) {
for (var s = e.length; s--;)
if (q(e[s][0], a)) return s;
return -1
}
customElements.define("game-theme-manager", _);
var A = Array.prototype.splice;
function C(e) {
var a = -1,
s = null == e ? 0 : e.length;
for (this.clear(); ++a < s;) {
var t = e[a];
this.set(t[0], t[1])
}
}
C.prototype.clear = function() {
this.__data__ = [], this.size = 0
}, C.prototype.delete = function(e) {
var a = this.__data__,
s = E(a, e);
return !(s < 0) && (s == a.length - 1 ? a.pop() : A.call(a, s, 1), --this.size, !0)
}, C.prototype.get = function(e) {
var a = this.__data__,
s = E(a, e);
return s < 0 ? void 0 : a[s][1]
}, C.prototype.has = function(e) {
return E(this.__data__, e) > -1
}, C.prototype.set = function(e, a) {
var s = this.__data__,
t = E(s, e);
return t < 0 ? (++this.size, s.push([e, a])) : s[t][1] = a, this
};
var L = "object" == ("undefined" == typeof global ? "undefined" : a(global)) && global && global.Object === Object && global,
T = "object" == ("undefined" == typeof self ? "undefined" : a(self)) && self && self.Object === Object && self,
I = L || T || Function("return this")(),
M = I.Symbol,
O = Object.prototype,
R = O.hasOwnProperty,
P = O.toString,
$ = M ? M.toStringTag : void 0;
var H = Object.prototype.toString;
var N = M ? M.toStringTag : void 0;
function D(e) {
return null == e ? void 0 === e ? "[object Undefined]" : "[object Null]" : N && N in Object(e) ? function(e) {
var a = R.call(e, $),
s = e[$];
try {
e[$] = void 0;
var t = !0
} catch (e) {}
var o = P.call(e);
return t && (a ? e[$] = s : delete e[$]), o
}(e) : function(e) {
return H.call(e)
}(e)
}
function G(e) {
var s = a(e);
return null != e && ("object" == s || "function" == s)
}
function B(e) {
if (!G(e)) return !1;
var a = D(e);
return "[object Function]" == a || "[object GeneratorFunction]" == a || "[object AsyncFunction]" == a || "[object Proxy]" == a
}
var F, W = I["__core-js_shared__"],
Y = (F = /[^.]+$/.exec(W && W.keys && W.keys.IE_PROTO || "")) ? "Symbol(src)_1." + F : "";
var J = Function.prototype.toString;
var U = /^\[object .+?Constructor\]$/,
X = Function.prototype,
V = Object.prototype,
K = X.toString,
Q = V.hasOwnProperty,
Z = RegExp("^" + K.call(Q).replace(/[\\^$.*+?()[\]{}|]/g, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
function ee(e) {
return !(!G(e) || (a = e, Y && Y in a)) && (B(e) ? Z : U).test(function(e) {
if (null != e) {
try {
return J.call(e)
} catch (e) {}
try {
return e + ""
} catch (e) {}
}
return ""
}(e));
var a
}
function ae(e, a) {
var s = function(e, a) {
return null == e ? void 0 : e[a]
}(e, a);
return ee(s) ? s : void 0
}
var se = ae(I, "Map"),
te = ae(Object, "create");
var oe = Object.prototype.hasOwnProperty;
var ne = Object.prototype.hasOwnProperty;
function re(e) {
var a = -1,
s = null == e ? 0 : e.length;
for (this.clear(); ++a < s;) {
var t = e[a];
this.set(t[0], t[1])
}
}
function ie(e, s) {
var t, o, n = e.__data__;
return ("string" == (o = a(t = s)) || "number" == o || "symbol" == o || "boolean" == o ? "__proto__" !== t : null === t) ? n["string" == typeof s ? "string" : "hash"] : n.map
}
function le(e) {
var a = -1,
s = null == e ? 0 : e.length;
for (this.clear(); ++a < s;) {
var t = e[a];
this.set(t[0], t[1])
}
}
re.prototype.clear = function() {
this.__data__ = te ? te(null) : {}, this.size = 0
}, re.prototype.delete = function(e) {
var a = this.has(e) && delete this.__data__[e];
return this.size -= a ? 1 : 0, a
}, re.prototype.get = function(e) {
var a = this.__data__;
if (te) {
var s = a[e];
return "__lodash_hash_undefined__" === s ? void 0 : s
}
return oe.call(a, e) ? a[e] : void 0
}, re.prototype.has = function(e) {
var a = this.__data__;
return te ? void 0 !== a[e] : ne.call(a, e)
}, re.prototype.set = function(e, a) {
var s = this.__data__;
return this.size += this.has(e) ? 0 : 1, s[e] = te && void 0 === a ? "__lodash_hash_undefined__" : a, this
}, le.prototype.clear = function() {
this.size = 0, this.__data__ = {
hash: new re,
map: new(se || C),
string: new re
}
}, le.prototype.delete = function(e) {
var a = ie(this, e).delete(e);
return this.size -= a ? 1 : 0, a
}, le.prototype.get = function(e) {
return ie(this, e).get(e)
}, le.prototype.has = function(e) {
return ie(this, e).has(e)
}, le.prototype.set = function(e, a) {
var s = ie(this, e),
t = s.size;
return s.set(e, a), this.size += s.size == t ? 0 : 1, this
};
function de(e) {
var a = this.__data__ = new C(e);
this.size = a.size
}
de.prototype.clear = function() {
this.__data__ = new C, this.size = 0
}, de.prototype.delete = function(e) {
var a = this.__data__,
s = a.delete(e);
return this.size = a.size, s
}, de.prototype.get = function(e) {
return this.__data__.get(e)
}, de.prototype.has = function(e) {
return this.__data__.has(e)
}, de.prototype.set = function(e, a) {
var s = this.__data__;
if (s instanceof C) {
var t = s.__data__;
if (!se || t.length < 199) return t.push([e, a]), this.size = ++s.size, this;
s = this.__data__ = new le(t)
}
return s.set(e, a), this.size = s.size, this
};
var ue = function() {
try {
var e = ae(Object, "defineProperty");
return e({}, "", {}), e
} catch (e) {}
}();
function ce(e, a, s) {
"__proto__" == a && ue ? ue(e, a, {
configurable: !0,
enumerable: !0,
value: s,
writable: !0
}) : e[a] = s
}
function pe(e, a, s) {
(void 0 !== s && !q(e[a], s) || void 0 === s && !(a in e)) && ce(e, a, s)
}
var me, he = function(e, a, s) {
for (var t = -1, o = Object(e), n = s(e), r = n.length; r--;) {
var i = n[me ? r : ++t];
if (!1 === a(o[i], i, o)) break
}
return e
},
ye = "object" == (void 0 === e ? "undefined" : a(e)) && e && !e.nodeType && e,
ge = ye && "object" == ("undefined" == typeof module ? "undefined" : a(module)) && module && !module.nodeType && module,
be = ge && ge.exports === ye ? I.Buffer : void 0,
fe = be ? be.allocUnsafe : void 0;
var ke = I.Uint8Array;
function ve(e, a) {
var s, t, o = a ? (s = e.buffer, t = new s.constructor(s.byteLength), new ke(t).set(new ke(s)), t) : e.buffer;
return new e.constructor(o, e.byteOffset, e.length)
}
var we = Object.create,
xe = function() {
function e() {}
return function(a) {
if (!G(a)) return {};
if (we) return we(a);
e.prototype = a;
var s = new e;
return e.prototype = void 0, s
}
}();
var ze, je, Se = (ze = Object.getPrototypeOf, je = Object, function(e) {
return ze(je(e))
}),
_e = Object.prototype;
function qe(e) {
var a = e && e.constructor;
return e === ("function" == typeof a && a.prototype || _e)
}
function Ee(e) {
return null != e && "object" == a(e)
}
function Ae(e) {
return Ee(e) && "[object Arguments]" == D(e)
}
var Ce = Object.prototype,
Le = Ce.hasOwnProperty,
Te = Ce.propertyIsEnumerable,
Ie = Ae(function() {
return arguments
}()) ? Ae : function(e) {
return Ee(e) && Le.call(e, "callee") && !Te.call(e, "callee")
},
Me = Array.isArray;
function Oe(e) {
return "number" == typeof e && e > -1 && e % 1 == 0 && e <= 9007199254740991
}
function Re(e) {
return null != e && Oe(e.length) && !B(e)
}
var Pe = "object" == (void 0 === e ? "undefined" : a(e)) && e && !e.nodeType && e,
$e = Pe && "object" == ("undefined" == typeof module ? "undefined" : a(module)) && module && !module.nodeType && module,
He = $e && $e.exports === Pe ? I.Buffer : void 0,
Ne = (He ? He.isBuffer : void 0) || function() {
return !1
},
De = Function.prototype,
Ge = Object.prototype,
Be = De.toString,
Fe = Ge.hasOwnProperty,
We = Be.call(Object);
var Ye = {};
Ye["[object Float32Array]"] = Ye["[object Float64Array]"] = Ye["[object Int8Array]"] = Ye["[object Int16Array]"] = Ye["[object Int32Array]"] = Ye["[object Uint8Array]"] = Ye["[object Uint8ClampedArray]"] = Ye["[object Uint16Array]"] = Ye["[object Uint32Array]"] = !0, Ye["[object Arguments]"] = Ye["[object Array]"] = Ye["[object ArrayBuffer]"] = Ye["[object Boolean]"] = Ye["[object DataView]"] = Ye["[object Date]"] = Ye["[object Error]"] = Ye["[object Function]"] = Ye["[object Map]"] = Ye["[object Number]"] = Ye["[object Object]"] = Ye["[object RegExp]"] = Ye["[object Set]"] = Ye["[object String]"] = Ye["[object WeakMap]"] = !1;
var Je = "object" == (void 0 === e ? "undefined" : a(e)) && e && !e.nodeType && e,
Ue = Je && "object" == ("undefined" == typeof module ? "undefined" : a(module)) && module && !module.nodeType && module,
Xe = Ue && Ue.exports === Je && L.process,
Ve = function() {
try {
var e = Ue && Ue.require && Ue.require("util").types;
return e || Xe && Xe.binding && Xe.binding("util")
} catch (e) {}
}(),
Ke = Ve && Ve.isTypedArray,
Qe = Ke ? function(e) {
return function(a) {
return e(a)
}
}(Ke) : function(e) {
return Ee(e) && Oe(e.length) && !!Ye[D(e)]
};
function Ze(e, a) {
if (("constructor" !== a || "function" != typeof e[a]) && "__proto__" != a) return e[a]
}
var ea = Object.prototype.hasOwnProperty;
function aa(e, a, s) {
var t = e[a];
ea.call(e, a) && q(t, s) && (void 0 !== s || a in e) || ce(e, a, s)
}
var sa = /^(?:0|[1-9]\d*)$/;
function ta(e, s) {
var t = a(e);
return !!(s = null == s ? 9007199254740991 : s) && ("number" == t || "symbol" != t && sa.test(e)) && e > -1 && e % 1 == 0 && e < s
}
var oa = Object.prototype.hasOwnProperty;
function na(e, a) {
var s = Me(e),
t = !s && Ie(e),
o = !s && !t && Ne(e),
n = !s && !t && !o && Qe(e),
r = s || t || o || n,
i = r ? function(e, a) {
for (var s = -1, t = Array(e); ++s < e;) t[s] = a(s);
return t
}(e.length, String) : [],
l = i.length;
for (var d in e) !a && !oa.call(e, d) || r && ("length" == d || o && ("offset" == d || "parent" == d) || n && ("buffer" == d || "byteLength" == d || "byteOffset" == d) || ta(d, l)) || i.push(d);
return i
}
var ra = Object.prototype.hasOwnProperty;
function ia(e) {
if (!G(e)) return function(e) {
var a = [];
if (null != e)
for (var s in Object(e)) a.push(s);
return a
}(e);
var a = qe(e),
s = [];
for (var t in e)("constructor" != t || !a && ra.call(e, t)) && s.push(t);
return s
}
function la(e) {
return Re(e) ? na(e, !0) : ia(e)
}
function da(e) {
return function(e, a, s, t) {
var o = !s;
s || (s = {});
for (var n = -1, r = a.length; ++n < r;) {
var i = a[n],
l = t ? t(s[i], e[i], i, s, e) : void 0;
void 0 === l && (l = e[i]), o ? ce(s, i, l) : aa(s, i, l)
}
return s
}(e, la(e))
}
function ua(e, a, s, t, o, n, r) {
var i = Ze(e, s),
l = Ze(a, s),
d = r.get(l);
if (d) pe(e, s, d);
else {
var u, c = n ? n(i, l, s + "", e, a, r) : void 0,
p = void 0 === c;
if (p) {
var m = Me(l),
h = !m && Ne(l),
y = !m && !h && Qe(l);
c = l, m || h || y ? Me(i) ? c = i : Ee(u = i) && Re(u) ? c = function(e, a) {
var s = -1,
t = e.length;
for (a || (a = Array(t)); ++s < t;) a[s] = e[s];
return a
}(i) : h ? (p = !1, c = function(e, a) {
if (a) return e.slice();
var s = e.length,
t = fe ? fe(s) : new e.constructor(s);
return e.copy(t), t
}(l, !0)) : y ? (p = !1, c = ve(l, !0)) : c = [] : function(e) {
if (!Ee(e) || "[object Object]" != D(e)) return !1;
var a = Se(e);
if (null === a) return !0;
var s = Fe.call(a, "constructor") && a.constructor;
return "function" == typeof s && s instanceof s && Be.call(s) == We
}(l) || Ie(l) ? (c = i, Ie(i) ? c = da(i) : G(i) && !B(i) || (c = function(e) {
return "function" != typeof e.constructor || qe(e) ? {} : xe(Se(e))
}(l))) : p = !1
}
p && (r.set(l, c), o(c, l, t, n, r), r.delete(l)), pe(e, s, c)
}
}
function ca(e, a, s, t, o) {
e !== a && he(a, (function(n, r) {
if (o || (o = new de), G(n)) ua(e, a, r, s, ca, t, o);
else {
var i = t ? t(Ze(e, r), n, r + "", e, a, o) : void 0;
void 0 === i && (i = n), pe(e, r, i)
}
}), la)
}
function pa(e) {
return e
}
function ma(e, a, s) {
switch (s.length) {
case 0:
return e.call(a);
case 1:
return e.call(a, s[0]);
case 2:
return e.call(a, s[0], s[1]);
case 3:
return e.call(a, s[0], s[1], s[2])
}
return e.apply(a, s)
}
var ha = Math.max;
var ya = ue ? function(e, a) {
return ue(e, "toString", {
configurable: !0,
enumerable: !1,
value: (s = a, function() {
return s
}),
writable: !0
});
var s
} : pa,
ga = Date.now;
var ba = function(e) {
var a = 0,
s = 0;
return function() {
var t = ga(),
o = 16 - (t - s);
if (s = t, o > 0) {
if (++a >= 800) return arguments[0]
} else a = 0;
return e.apply(void 0, arguments)
}
}(ya);
function fa(e, a) {
return ba(function(e, a, s) {
return a = ha(void 0 === a ? e.length - 1 : a, 0),
function() {
for (var t = arguments, o = -1, n = ha(t.length - a, 0), r = Array(n); ++o < n;) r[o] = t[a + o];
o = -1;
for (var i = Array(a + 1); ++o < a;) i[o] = t[o];
return i[a] = s(r), ma(e, this, i)
}
}(e, a, pa), e + "")
}
var ka, va = (ka = function(e, a, s) {
ca(e, a, s)
}, fa((function(e, s) {
var t = -1,
o = s.length,
n = o > 1 ? s[o - 1] : void 0,
r = o > 2 ? s[2] : void 0;
for (n = ka.length > 3 && "function" == typeof n ? (o--, n) : void 0, r && function(e, s, t) {
if (!G(t)) return !1;
var o = a(s);
return !!("number" == o ? Re(t) && ta(s, t.length) : "string" == o && s in t) && q(t[s], e)
}(s[0], s[1], r) && (n = o < 3 ? void 0 : n, o = 1), e = Object(e); ++t < o;) {
var i = s[t];
i && ka(e, i, t, n)
}
return e
}))),
wa = "gameState",
xa = {
boardState: null,
evaluations: null,
rowIndex: null,
solution: null,
gameStatus: null,
lastPlayedTs: null,
lastCompletedTs: null,
restoringFromLocalStorage: null,
hardMode: !1
};
function za() {
var e = window.localStorage.getItem(wa) || JSON.stringify(xa);
return JSON.parse(e)
}
function ja(e) {
var a = za();
! function(e) {
window.localStorage.setItem(wa, JSON.stringify(e))
}(va(a, e))
}
var Sa = document.createElement("template");
Sa.innerHTML = '\n \n
\n \n
\n
\n
Hard Mode
\n
Any revealed hints must be used in subsequent guesses
\n \n \n');
var Qa = document.createElement("template");
Qa.innerHTML = '\n\n\n\n\n\n';
var Za = "IN_PROGRESS",
es = "WIN",
as = "FAIL",
ss = ["Genius", "Magnificent", "Impressive", "Splendid", "Great", "Phew"],
ts = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
s(this, t), n(p(e = a.call(this)), "tileIndex", 0), n(p(e), "rowIndex", 0), n(p(e), "solution", void 0), n(p(e), "boardState", void 0), n(p(e), "evaluations", void 0), n(p(e), "canInput", !0), n(p(e), "gameStatus", Za), n(p(e), "letterEvaluations", {}), n(p(e), "$board", void 0), n(p(e), "$keyboard", void 0), n(p(e), "$game", void 0), n(p(e), "today", void 0), n(p(e), "lastPlayedTs", void 0), n(p(e), "lastCompletedTs", void 0), n(p(e), "hardMode", void 0), n(p(e), "dayOffset", void 0), e.attachShadow({
mode: "open"
}), e.today = new Date;
var o = za();
return e.lastPlayedTs = o.lastPlayedTs, !e.lastPlayedTs || Na(new Date(e.lastPlayedTs), e.today) >= 1 ? (e.boardState = new Array(6).fill(""), e.evaluations = new Array(6).fill(null), e.solution = Da(e.today), e.dayOffset = Ga(e.today), e.lastCompletedTs = o.lastCompletedTs, e.hardMode = o.hardMode, e.restoringFromLocalStorage = !1, ja({
rowIndex: e.rowIndex,
boardState: e.boardState,
evaluations: e.evaluations,
solution: e.solution,
gameStatus: e.gameStatus
}), Ca("event", "level_start", {
level_name: Wa(e.solution)
})) : (e.boardState = o.boardState, e.evaluations = o.evaluations, e.rowIndex = o.rowIndex, e.solution = o.solution, e.dayOffset = Ga(e.today), e.letterEvaluations = Pa(e.boardState, e.evaluations), e.gameStatus = o.gameStatus, e.lastCompletedTs = o.lastCompletedTs, e.hardMode = o.hardMode, e.gameStatus !== Za && (e.canInput = !1), e.restoringFromLocalStorage = !0), e
}
return o(t, [{
key: "evaluateRow",
value: function() {
if (5 === this.tileIndex && !(this.rowIndex >= 6)) {
var e, a = this.$board.querySelectorAll("game-row")[this.rowIndex],
s = this.boardState[this.rowIndex];
if (e = s, !Ta.includes(e) && !La.includes(e)) return a.setAttribute("invalid", ""), void this.addToast("Not in word list");
if (this.hardMode) {
var t = function(e, a, s) {
if (!e || !a || !s) return {
validGuess: !0
};
for (var t = 0; t < s.length; t++)
if (s[t] === Ma && e[t] !== a[t]) return {
validGuess: !1,
errorMessage: "".concat($a(t + 1), " letter must be ").concat(a[t].toUpperCase())
};
for (var o = {}, n = 0; n < s.length; n++)[Ma, Ia].includes(s[n]) && (o[a[n]] ? o[a[n]] += 1 : o[a[n]] = 1);
var r = e.split("").reduce((function(e, a) {
return e[a] ? e[a] += 1 : e[a] = 1, e
}), {});
for (var i in o)
if ((r[i] || 0) < o[i]) return {
validGuess: !1,
errorMessage: "Guess must contain ".concat(i.toUpperCase())
};
return {
validGuess: !0
}
}(s, this.boardState[this.rowIndex - 1], this.evaluations[this.rowIndex - 1]),
o = t.validGuess,
n = t.errorMessage;
if (!o) return a.setAttribute("invalid", ""), void this.addToast(n || "Not valid in hard mode")
}
var r = function(e, a) {
for (var s = Array(a.length).fill(Oa), t = Array(a.length).fill(!0), o = Array(a.length).fill(!0), n = 0; n < e.length; n++) e[n] === a[n] && o[n] && (s[n] = Ma, t[n] = !1, o[n] = !1);
for (var r = 0; r < e.length; r++) {
var i = e[r];
if (t[r])
for (var l = 0; l < a.length; l++) {
var d = a[l];
if (o[l] && i === d) {
s[r] = Ia, o[l] = !1;
break
}
}
}
return s
}(s, this.solution);
this.evaluations[this.rowIndex] = r, this.letterEvaluations = Pa(this.boardState, this.evaluations), a.evaluation = this.evaluations[this.rowIndex], this.rowIndex += 1;
var i = this.rowIndex >= 6,
l = r.every((function(e) {
return "correct" === e
}));
if (i || l) Va({
isWin: l,
isStreak: !!this.lastCompletedTs && 1 === Na(new Date(this.lastCompletedTs), new Date),
numGuesses: this.rowIndex
}), ja({
lastCompletedTs: Date.now()
}), this.gameStatus = l ? es : as, Ca("event", "level_end", {
level_name: Wa(this.solution),
num_guesses: this.rowIndex,
success: l
});
this.tileIndex = 0, this.canInput = !1, ja({
rowIndex: this.rowIndex,
boardState: this.boardState,
evaluations: this.evaluations,
solution: this.solution,
gameStatus: this.gameStatus,
lastPlayedTs: Date.now()
})
}
}
}, {
key: "addLetter",
value: function(e) {
this.gameStatus === Za && (this.canInput && (this.tileIndex >= 5 || (this.boardState[this.rowIndex] += e, this.$board.querySelectorAll("game-row")[this.rowIndex].setAttribute("letters", this.boardState[this.rowIndex]), this.tileIndex += 1)))
}
}, {
key: "removeLetter",
value: function() {
if (this.gameStatus === Za && this.canInput && !(this.tileIndex <= 0)) {
this.boardState[this.rowIndex] = this.boardState[this.rowIndex].slice(0, this.boardState[this.rowIndex].length - 1);
var e = this.$board.querySelectorAll("game-row")[this.rowIndex];
this.boardState[this.rowIndex] ? e.setAttribute("letters", this.boardState[this.rowIndex]) : e.removeAttribute("letters"), e.removeAttribute("invalid"), this.tileIndex -= 1
}
}
}, {
key: "submitGuess",
value: function() {
if (this.gameStatus === Za && this.canInput) {
if (5 !== this.tileIndex) return this.$board.querySelectorAll("game-row")[this.rowIndex].setAttribute("invalid", ""), void this.addToast("Not enough letters");
this.evaluateRow()
}
}
}, {
key: "addToast",
value: function(e, a) {
var s = arguments.length > 2 && void 0 !== arguments[2] && arguments[2],
t = document.createElement("game-toast");
t.setAttribute("text", e), a && t.setAttribute("duration", a), s ? this.shadowRoot.querySelector("#system-toaster").prepend(t) : this.shadowRoot.querySelector("#game-toaster").prepend(t)
}
}, {
key: "sizeBoard",
value: function() {
var e = this.shadowRoot.querySelector("#board-container"),
a = Math.min(Math.floor(e.clientHeight * (5 / 6)), 350),
s = 6 * Math.floor(a / 5);
this.$board.style.width = "".concat(a, "px"), this.$board.style.height = "".concat(s, "px")
}
}, {
key: "showStatsModal",
value: function() {
var e = this.$game.querySelector("game-modal"),
a = document.createElement("game-stats");
this.gameStatus === es && this.rowIndex <= 6 && a.setAttribute("highlight-guess", this.rowIndex), a.gameApp = this, e.appendChild(a), e.setAttribute("open", "")
}
}, {
key: "showHelpModal",
value: function() {
var e = this.$game.querySelector("game-modal");
e.appendChild(document.createElement("game-help")), e.setAttribute("open", "")
}
}, {
key: "connectedCallback",
value: function() {
var e = this;
this.shadowRoot.appendChild(Ka.content.cloneNode(!0)), this.$game = this.shadowRoot.querySelector("#game"), this.$board = this.shadowRoot.querySelector("#board"), this.$keyboard = this.shadowRoot.querySelector("game-keyboard"), this.sizeBoard(), this.lastPlayedTs || setTimeout((function() {
return e.showHelpModal()
}), 100);
for (var a = 0; a < 6; a++) {
var s = document.createElement("game-row");
s.setAttribute("letters", this.boardState[a]), s.setAttribute("length", 5), this.evaluations[a] && (s.evaluation = this.evaluations[a]), this.$board.appendChild(s)
}
this.$game.addEventListener("game-key-press", (function(a) {
var s = a.detail.key;
"←" === s || "Backspace" === s ? e.removeLetter() : "↵" === s || "Enter" === s ? e.submitGuess() : Ba.includes(s.toLowerCase()) && e.addLetter(s.toLowerCase())
})), this.$game.addEventListener("game-last-tile-revealed-in-row", (function(a) {
e.$keyboard.letterEvaluations = e.letterEvaluations, e.rowIndex < 6 && (e.canInput = !0);
var s = e.$board.querySelectorAll("game-row")[e.rowIndex - 1];
(a.path || a.composedPath && a.composedPath()).includes(s) && ([es, as].includes(e.gameStatus) && (e.restoringFromLocalStorage ? e.showStatsModal() : (e.gameStatus === es && (s.setAttribute("win", ""), e.addToast(ss[e.rowIndex - 1], 2e3)), e.gameStatus === as && e.addToast(e.solution.toUpperCase(), 1 / 0), setTimeout((function() {
e.showStatsModal()
}), 2500))), e.restoringFromLocalStorage = !1)
})), this.shadowRoot.addEventListener("game-setting-change", (function(a) {
var s = a.detail,
t = s.name,
o = s.checked,
n = s.disabled;
switch (t) {
case "hard-mode":
return void(n ? e.addToast("Hard mode can only be enabled at the start of a round", 1500, !0) : (e.hardMode = o, ja({
hardMode: o
})))
}
})), this.shadowRoot.getElementById("settings-button").addEventListener("click", (function(a) {
var s = e.$game.querySelector("game-page"),
t = document.createTextNode("Settings");
s.appendChild(t);
var o = document.createElement("game-settings");
o.setAttribute("slot", "content"), o.gameApp = e, s.appendChild(o), s.setAttribute("open", "")
})), this.shadowRoot.getElementById("help-button").addEventListener("click", (function(a) {
var s = e.$game.querySelector("game-page"),
t = document.createTextNode("How to play");
s.appendChild(t);
var o = document.createElement("game-help");
o.setAttribute("page", ""), o.setAttribute("slot", "content"), s.appendChild(o), s.setAttribute("open", "")
})), this.shadowRoot.getElementById("statistics-button").addEventListener("click", (function(a) {
e.showStatsModal()
})), window.addEventListener("resize", this.sizeBoard.bind(this))
}
}, {
key: "disconnectedCallback",
value: function() {}
}, {
key: "debugTools",
value: function() {
var e = this;
this.shadowRoot.getElementById("debug-tools").appendChild(Qa.content.cloneNode(!0)), this.shadowRoot.getElementById("toast").addEventListener("click", (function(a) {
e.addToast("hello world")
})), this.shadowRoot.getElementById("modal").addEventListener("click", (function(a) {
var s = e.$game.querySelector("game-modal");
s.textContent = "hello plz", s.setAttribute("open", "")
})), this.shadowRoot.getElementById("reveal").addEventListener("click", (function() {
e.evaluateRow()
})), this.shadowRoot.getElementById("shake").addEventListener("click", (function() {
e.$board.querySelectorAll("game-row")[e.rowIndex].setAttribute("invalid", "")
})), this.shadowRoot.getElementById("bounce").addEventListener("click", (function() {
var a = e.$board.querySelectorAll("game-row")[e.rowIndex - 1];
"" === a.getAttribute("win") ? a.removeAttribute("win") : a.setAttribute("win", "")
}))
}
}]), t
}(c(HTMLElement));
customElements.define("game-app", ts);
var os = document.createElement("template");
os.innerHTML = "\n \n
\n
\n \n
\n \n
\n
\n
\n');
var ns = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
return s(this, t), (e = a.call(this)).attachShadow({
mode: "open"
}), e
}
return o(t, [{
key: "connectedCallback",
value: function() {
var e = this;
this.shadowRoot.appendChild(os.content.cloneNode(!0)), this.addEventListener("click", (function(a) {
e.shadowRoot.querySelector(".content").classList.add("closing")
})), this.shadowRoot.addEventListener("animationend", (function(a) {
"SlideOut" === a.animationName && (e.shadowRoot.querySelector(".content").classList.remove("closing"), e.removeChild(e.firstChild), e.removeAttribute("open"))
}))
}
}]), t
}(c(HTMLElement));
customElements.define("game-modal", ns);
var rs = document.createElement("template");
rs.innerHTML = "\n \n \n";
var is = document.createElement("template");
is.innerHTML = "\n \n";
var ls = document.createElement("template");
ls.innerHTML = '\n \n';
var ds = [
["q", "w", "e", "r", "t", "y", "u", "i", "o", "p"],
["-", "a", "s", "d", "f", "g", "h", "j", "k", "l", "-"],
["↵", "z", "x", "c", "v", "b", "n", "m", "←"]
],
us = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
return s(this, t), n(p(e = a.call(this)), "_letterEvaluations", {}), e.attachShadow({
mode: "open"
}), e
}
return o(t, [{
key: "letterEvaluations",
set: function(e) {
this._letterEvaluations = e, this._render()
}
}, {
key: "dispatchKeyPressEvent",
value: function(e) {
this.dispatchEvent(new CustomEvent("game-key-press", {
bubbles: !0,
composed: !0,
detail: {
key: e
}
}))
}
}, {
key: "connectedCallback",
value: function() {
var e = this;
this.shadowRoot.appendChild(rs.content.cloneNode(!0)), this.$keyboard = this.shadowRoot.getElementById("keyboard"), this.$keyboard.addEventListener("click", (function(a) {
var s = a.target.closest("button");
s && e.$keyboard.contains(s) && e.dispatchKeyPressEvent(s.dataset.key)
})), window.addEventListener("keydown", (function(a) {
if (!0 !== a.repeat) {
var s = a.key,
t = a.metaKey,
o = a.ctrlKey;
t || o || (Ba.includes(s.toLowerCase()) || "Backspace" === s || "Enter" === s) && e.dispatchKeyPressEvent(s)
}
})), this.$keyboard.addEventListener("transitionend", (function(a) {
var s = a.target.closest("button");
s && e.$keyboard.contains(s) && s.classList.remove("fade")
})), ds.forEach((function(a) {
var s = document.createElement("div");
s.classList.add("row"), a.forEach((function(e) {
var a;
if (e >= "a" && e <= "z" || "←" === e || "↵" === e) {
if ((a = is.content.cloneNode(!0).firstElementChild).dataset.key = e, a.textContent = e, "←" === e) {
var t = document.createElement("game-icon");
t.setAttribute("icon", "backspace"), a.textContent = "", a.appendChild(t), a.classList.add("one-and-a-half")
}
"↵" == e && (a.textContent = "enter", a.classList.add("one-and-a-half"))
} else(a = ls.content.cloneNode(!0).firstElementChild).classList.add(1 === e.length ? "half" : "one");
s.appendChild(a)
})), e.$keyboard.appendChild(s)
})), this._render()
}
}, {
key: "_render",
value: function() {
for (var e in this._letterEvaluations) {
var a = this.$keyboard.querySelector('[data-key="'.concat(e, '"]'));
a.dataset.state = this._letterEvaluations[e], a.classList.add("fade")
}
}
}]), t
}(c(HTMLElement));
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
function cs(e, a, s, t) {
return new(s || (s = Promise))((function(o, n) {
function r(e) {
try {
l(t.next(e))
} catch (e) {
n(e)
}
}
function i(e) {
try {
l(t.throw(e))
} catch (e) {
n(e)
}
}
function l(e) {
var a;
e.done ? o(e.value) : (a = e.value, a instanceof s ? a : new s((function(e) {
e(a)
}))).then(r, i)
}
l((t = t.apply(e, a || [])).next())
}))
}
function ps(e, a) {
var s, t, o, n, r = {
label: 0,
sent: function() {
if (1 & o[0]) throw o[1];
return o[1]
},
trys: [],
ops: []
};
return n = {
next: i(0),
throw: i(1),
return: i(2)
}, "function" == typeof Symbol && (n[Symbol.iterator] = function() {
return this
}), n;
function i(n) {
return function(i) {
return function(n) {
if (s) throw new TypeError("Generator is already executing.");
for (; r;) try {
if (s = 1, t && (o = 2 & n[0] ? t.return : n[0] ? t.throw || ((o = t.return) && o.call(t), 0) : t.next) && !(o = o.call(t, n[1])).done) return o;
switch (t = 0, o && (n = [2 & n[0], o.value]), n[0]) {
case 0:
case 1:
o = n;
break;
case 4:
return r.label++, {
value: n[1],
done: !1
};
case 5:
r.label++, t = n[1], n = [0];
continue;
case 7:
n = r.ops.pop(), r.trys.pop();
continue;
default:
if (!((o = (o = r.trys).length > 0 && o[o.length - 1]) || 6 !== n[0] && 2 !== n[0])) {
r = 0;
continue
}
if (3 === n[0] && (!o || n[1] > o[0] && n[1] < o[3])) {
r.label = n[1];
break
}
if (6 === n[0] && r.label < o[1]) {
r.label = o[1], o = n;
break
}
if (o && r.label < o[2]) {
r.label = o[2], r.ops.push(n);
break
}
o[2] && r.ops.pop(), r.trys.pop();
continue
}
n = a.call(e, r)
} catch (e) {
n = [6, e], t = 0
} finally {
s = o = 0
}
if (5 & n[0]) throw n[1];
return {
value: n[0] ? n[1] : void 0,
done: !0
}
}([n, i])
}
}
}
customElements.define("game-keyboard", us),
function() {
(console.warn || console.log).apply(console, arguments)
}.bind("[clipboard-polyfill]");
var ms, hs, ys, gs, bs = "undefined" == typeof navigator ? void 0 : navigator,
fs = null == bs ? void 0 : bs.clipboard;
null === (ms = null == fs ? void 0 : fs.read) || void 0 === ms || ms.bind(fs), null === (hs = null == fs ? void 0 : fs.readText) || void 0 === hs || hs.bind(fs);
var ks = (null === (ys = null == fs ? void 0 : fs.write) || void 0 === ys || ys.bind(fs), null === (gs = null == fs ? void 0 : fs.writeText) || void 0 === gs ? void 0 : gs.bind(fs)),
vs = "undefined" == typeof window ? void 0 : window,
ws = (null == vs || vs.ClipboardItem, vs);
var xs = function() {
this.success = !1
};
function zs(e, a, s) {
for (var t in e.success = !0, a) {
var o = a[t],
n = s.clipboardData;
n.setData(t, o), "text/plain" === t && n.getData(t) !== o && (e.success = !1)
}
s.preventDefault()
}
function js(e) {
var a = new xs,
s = zs.bind(this, a, e);
document.addEventListener("copy", s);
try {
document.execCommand("copy")
} finally {
document.removeEventListener("copy", s)
}
return a.success
}
function Ss(e, a) {
_s(e);
var s = js(a);
return qs(), s
}
function _s(e) {
var a = document.getSelection();
if (a) {
var s = document.createRange();
s.selectNodeContents(e), a.removeAllRanges(), a.addRange(s)
}
}
function qs() {
var e = document.getSelection();
e && e.removeAllRanges()
}
function Es(e) {
return cs(this, void 0, void 0, (function() {
var a;
return ps(this, (function(s) {
if (a = "text/plain" in e, "undefined" == typeof ClipboardEvent && void 0 !== ws.clipboardData && void 0 !== ws.clipboardData.setData) {
if (!a) throw new Error("No `text/plain` value was specified.");
if (t = e["text/plain"], ws.clipboardData.setData("Text", t)) return [2, !0];
throw new Error("Copying failed, possibly because the user rejected it.")
}
var t;
return js(e) || navigator.userAgent.indexOf("Edge") > -1 || Ss(document.body, e) || function(e) {
var a = document.createElement("div");
a.setAttribute("style", "-webkit-user-select: text !important"), a.textContent = "temporary element", document.body.appendChild(a);
var s = Ss(a, e);
return document.body.removeChild(a), s
}(e) || function(e) {
var a = document.createElement("div");
a.setAttribute("style", "-webkit-user-select: text !important");
var s = a;
a.attachShadow && (s = a.attachShadow({
mode: "open"
}));
var t = document.createElement("span");
t.innerText = e, s.appendChild(t), document.body.appendChild(a), _s(t);
var o = document.execCommand("copy");
return qs(), document.body.removeChild(a), o
}(e["text/plain"]) ? [2, !0] : [2, !1]
}))
}))
}
function As(e, a, s) {
try {
t = navigator.userAgent || navigator.vendor || window.opera, !/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(t) && !/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0, 4)) || navigator.userAgent.toLowerCase().indexOf("firefox") > -1 || void 0 === navigator.share || !navigator.canShare || !navigator.canShare(e) ? function(e) {
return cs(this, void 0, void 0, (function() {
return ps(this, (function(a) {
if (ks) return [2, ks(e)];
if (!Es(function(e) {
var a = {};
return a["text/plain"] = e, a
}(e))) throw new Error("writeText() failed");
return [2]
}))
}))
}(e.text).then(a, s) : navigator.share(e)
} catch (e) {
s()
}
var t
}
var Cs = document.createElement("template");
Cs.innerHTML = '\n \n\n
\n
Statistics
\n \n
Guess Distribution
\n \n \n
\n';
var Ls = document.createElement("template");
Ls.innerHTML = '\n
\n \n \n
\n';
var Ts = document.createElement("template");
Ts.innerHTML = '\n
\n \n
\n
\n
\n
\n
\n
\n
\n';
var Is = document.createElement("template");
Is.innerHTML = '\n
\n
Next WORDLE
\n
\n
\n
\n \n
\n
\n
\n
\n
\n \n
\n';
var Ms = {
currentStreak: "Current Streak",
maxStreak: "Max Streak",
winPercentage: "Win %",
gamesPlayed: "Played",
gamesWon: "Won",
averageGuesses: "Av. Guesses"
},
Os = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
return s(this, t), n(p(e = a.call(this)), "stats", {}), n(p(e), "gameApp", void 0), e.attachShadow({
mode: "open"
}), e.stats = Xa(), e
}
return o(t, [{
key: "connectedCallback",
value: function() {
var e = this;
this.shadowRoot.appendChild(Cs.content.cloneNode(!0));
var a = this.shadowRoot.getElementById("statistics"),
s = this.shadowRoot.getElementById("guess-distribution"),
t = Math.max.apply(Math, g(Object.values(this.stats.guesses)));
if (Object.values(this.stats.guesses).every((function(e) {
return 0 === e
}))) {
var o = document.createElement("div");
o.classList.add("no-data"), o.innerText = "No Data", s.appendChild(o)
} else
for (var n = 1; n < Object.keys(this.stats.guesses).length; n++) {
var r = n,
i = this.stats.guesses[n],
l = Ts.content.cloneNode(!0),
d = Math.max(7, Math.round(i / t * 100));
l.querySelector(".guess").textContent = r;
var u = l.querySelector(".graph-bar");
if (u.style.width = "".concat(d, "%"), "number" == typeof i) {
l.querySelector(".num-guesses").textContent = i, i > 0 && u.classList.add("align-right");
var c = parseInt(this.getAttribute("highlight-guess"), 10);
c && n === c && u.classList.add("highlight")
}
s.appendChild(l)
}
if (["gamesPlayed", "winPercentage", "currentStreak", "maxStreak"].forEach((function(s) {
var t = Ms[s],
o = e.stats[s],
n = Ls.content.cloneNode(!0);
n.querySelector(".label").textContent = t, n.querySelector(".statistic").textContent = o, a.appendChild(n)
})), this.gameApp.gameStatus !== Za) {
var p = this.shadowRoot.querySelector(".footer"),
m = Is.content.cloneNode(!0);
p.appendChild(m), this.shadowRoot.querySelector("button#share-button").addEventListener("click", (function(a) {
a.preventDefault(), a.stopPropagation();
As(function(e) {
var a = e.evaluations,
s = e.dayOffset,
t = e.rowIndex,
o = e.isHardMode,
n = e.isWin,
r = JSON.parse(window.localStorage.getItem(j)),
i = JSON.parse(window.localStorage.getItem(S)),
l = "Wordle ".concat(s);
l += " ".concat(n ? t : "X", "/").concat(6), o && (l += "*");
var d = "";
return a.forEach((function(e) {
e && (e.forEach((function(e) {
if (e) {
var a = "";
switch (e) {
case Ma:
a = function(e) {
return e ? "🟧" : "🟩"
}(i);
break;
case Ia:
a = function(e) {
return e ? "🟦" : "🟨"
}(i);
break;
case Oa:
a = function(e) {
return e ? "⬛" : "⬜"
}(r)
}
d += a
}
})), d += "\n")
})), {
text: "".concat(l, "\n\n").concat(d.trimEnd())
}
}({
evaluations: e.gameApp.evaluations,
dayOffset: e.gameApp.dayOffset,
rowIndex: e.gameApp.rowIndex,
isHardMode: e.gameApp.hardMode,
isWin: e.gameApp.gameStatus === es
}), (function() {
e.gameApp.addToast("Copied results to clipboard", 2e3, !0)
}), (function() {
e.gameApp.addToast("Share failed", 2e3, !0)
}))
}))
}
}
}]), t
}(c(HTMLElement));
customElements.define("game-stats", Os);
var Rs = document.createElement("template");
Rs.innerHTML = '\n \n
\n \n
\n
\n
\n \n';
var Ps = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
return s(this, t), (e = a.call(this)).attachShadow({
mode: "open"
}), e
}
return o(t, [{
key: "connectedCallback",
value: function() {
var e = this;
this.shadowRoot.appendChild(Rs.content.cloneNode(!0)), this.shadowRoot.querySelector(".container").addEventListener("click", (function(a) {
a.stopPropagation(), e.hasAttribute("checked") ? e.removeAttribute("checked") : e.setAttribute("checked", ""), e.dispatchEvent(new CustomEvent("game-switch-change", {
bubbles: !0,
composed: !0,
detail: {
name: e.getAttribute("name"),
checked: e.hasAttribute("checked"),
disabled: e.hasAttribute("disabled")
}
}))
}))
}
}], [{
key: "observedAttributes",
get: function() {
return ["checked"]
}
}]), t
}(c(HTMLElement));
customElements.define("game-switch", Ps);
var $s = document.createElement("template");
$s.innerHTML = '\n \n \n
\n
Guess the WORDLE in 6 tries.
\n
Each guess must be a valid 5 letter word. Hit the enter button to submit.
\n
After each guess, the color of the tiles will change to show how close your guess was to the word.
\n
\n
Examples
\n
\n
\n \n \n \n \n \n
\n
The letter W is in the word and in the correct spot.
\n
\n
\n
\n \n \n \n \n \n
\n
The letter I is in the word but in the wrong spot.
\n
\n
\n
\n \n \n \n \n \n
\n
The letter U is not in the word in any spot.
\n
\n
\n
A new WORDLE will be available each day!
\n
\n \n';
var Hs = function(e) {
r(t, e);
var a = h(t);
function t() {
var e;
return s(this, t), (e = a.call(this)).attachShadow({
mode: "open"
}), e
}
return o(t, [{
key: "connectedCallback",
value: function() {
this.shadowRoot.appendChild($s.content.cloneNode(!0))
}
}]), t
}(c(HTMLElement));
customElements.define("game-help", Hs);
var Ns = document.createElement("template");
Ns.innerHTML = "\n \n