/*! For license information please see CookieMonster.js.LICENSE.txt */
(() => {
var e = {
877: function (e) {
!(function (t, o) {
'use strict';
'object' != typeof e.exports
? o(t)
: (e.exports = t.document
? o(t)
: function (e) {
if (!e.document) throw new Error('jscolor needs a window with document');
return o(e);
});
})('undefined' != typeof window ? window : this, function (e) {
'use strict';
var t,
o,
n,
i,
a =
(((i = {
initialized: !1,
instances: [],
readyQueue: [],
register: function () {
void 0 !== e &&
e.document &&
e.document.addEventListener('DOMContentLoaded', i.pub.init, !1);
},
installBySelector: function (t, o) {
if (!(o = o ? i.node(o) : e.document)) throw new Error('Missing root node');
for (
var n = o.querySelectorAll(t),
a = new RegExp(
'(^|\\s)(' + i.pub.lookupClass + ')(\\s*(\\{[^}]*\\})|\\s|$)',
'i',
),
r = 0;
r < n.length;
r += 1
) {
var l, s;
if (
!(n[r].jscolor && n[r].jscolor instanceof i.pub) &&
(void 0 === n[r].type ||
'color' != n[r].type.toLowerCase() ||
!i.isColorAttrSupported) &&
(null !== (l = i.getDataAttr(n[r], 'jscolor')) ||
(n[r].className && (s = n[r].className.match(a))))
) {
var c = n[r],
d = '';
null !== l
? (d = l)
: s &&
(console.warn(
'Installation using class name is DEPRECATED. Use data-jscolor="" attribute instead.' +
i.docsRef,
),
s[4] && (d = s[4]));
var p = null;
if (d.trim())
try {
p = i.parseOptionsStr(d);
} catch (e) {
console.warn(e + '\n' + d);
}
try {
new i.pub(c, p);
} catch (e) {
console.warn(e);
}
}
}
},
parseOptionsStr: function (e) {
var t = null;
try {
t = JSON.parse(e);
} catch (o) {
if (!i.pub.looseJSON)
throw new Error('Could not parse jscolor options as JSON: ' + o);
try {
t = new Function(
'var opts = (' + e + '); return typeof opts === "object" ? opts : {};',
)();
} catch (e) {
throw new Error('Could not evaluate jscolor options: ' + e);
}
}
return t;
},
getInstances: function () {
for (var e = [], t = 0; t < i.instances.length; t += 1)
i.instances[t] && i.instances[t].targetElement && e.push(i.instances[t]);
return e;
},
createEl: function (t) {
var o = e.document.createElement(t);
return i.setData(o, 'gui', !0), o;
},
node: function (t) {
if (!t) return null;
if ('string' == typeof t) {
var o = t,
n = null;
try {
n = e.document.querySelector(o);
} catch (e) {
return console.warn(e), null;
}
return n || console.warn('No element matches the selector: %s', o), n;
}
return i.isNode(t)
? t
: (console.warn('Invalid node of type %s: %s', typeof t, t), null);
},
isNode: function (e) {
return 'object' == typeof Node
? e instanceof Node
: e &&
'object' == typeof e &&
'number' == typeof e.nodeType &&
'string' == typeof e.nodeName;
},
nodeName: function (e) {
return !(!e || !e.nodeName) && e.nodeName.toLowerCase();
},
removeChildren: function (e) {
for (; e.firstChild; ) e.removeChild(e.firstChild);
},
isTextInput: function (e) {
return e && 'input' === i.nodeName(e) && 'text' === e.type.toLowerCase();
},
isButton: function (e) {
if (!e) return !1;
var t = i.nodeName(e);
return (
'button' === t ||
('input' === t &&
['button', 'submit', 'reset'].indexOf(e.type.toLowerCase()) > -1)
);
},
isButtonEmpty: function (e) {
switch (i.nodeName(e)) {
case 'input':
return !e.value || '' === e.value.trim();
case 'button':
return '' === e.textContent.trim();
}
return null;
},
isPassiveEventSupported: (function () {
var t = !1;
try {
var o = Object.defineProperty({}, 'passive', {
get: function () {
t = !0;
},
});
e.addEventListener('testPassive', null, o),
e.removeEventListener('testPassive', null, o);
} catch (e) {}
return t;
})(),
isColorAttrSupported:
((n = e.document.createElement('input')),
!(
!n.setAttribute ||
(n.setAttribute('type', 'color'), 'color' != n.type.toLowerCase())
)),
dataProp: '_data_jscolor',
setData: function () {
var e = arguments[0];
if (3 === arguments.length) {
var t = e.hasOwnProperty(i.dataProp) ? e[i.dataProp] : (e[i.dataProp] = {}),
o = arguments[2];
return (t[(a = arguments[1])] = o), !0;
}
if (2 === arguments.length && 'object' == typeof arguments[1]) {
t = e.hasOwnProperty(i.dataProp) ? e[i.dataProp] : (e[i.dataProp] = {});
var n = arguments[1];
for (var a in n) n.hasOwnProperty(a) && (t[a] = n[a]);
return !0;
}
throw new Error('Invalid arguments');
},
removeData: function () {
var e = arguments[0];
if (!e.hasOwnProperty(i.dataProp)) return !0;
for (var t = 1; t < arguments.length; t += 1) {
var o = arguments[t];
delete e[i.dataProp][o];
}
return !0;
},
getData: function (e, t, o) {
if (!e.hasOwnProperty(i.dataProp)) {
if (void 0 === o) return;
e[i.dataProp] = {};
}
var n = e[i.dataProp];
return n.hasOwnProperty(t) || void 0 === o || (n[t] = o), n[t];
},
getDataAttr: function (e, t) {
var o = 'data-' + t;
return e.getAttribute(o);
},
setDataAttr: function (e, t, o) {
var n = 'data-' + t;
e.setAttribute(n, o);
},
_attachedGroupEvents: {},
attachGroupEvent: function (e, t, o, n) {
i._attachedGroupEvents.hasOwnProperty(e) || (i._attachedGroupEvents[e] = []),
i._attachedGroupEvents[e].push([t, o, n]),
t.addEventListener(o, n, !1);
},
detachGroupEvents: function (e) {
if (i._attachedGroupEvents.hasOwnProperty(e)) {
for (var t = 0; t < i._attachedGroupEvents[e].length; t += 1) {
var o = i._attachedGroupEvents[e][t];
o[0].removeEventListener(o[1], o[2], !1);
}
delete i._attachedGroupEvents[e];
}
},
preventDefault: function (e) {
e.preventDefault && e.preventDefault(), (e.returnValue = !1);
},
captureTarget: function (e) {
e.setCapture && ((i._capturedTarget = e), i._capturedTarget.setCapture());
},
releaseTarget: function () {
i._capturedTarget &&
(i._capturedTarget.releaseCapture(), (i._capturedTarget = null));
},
triggerEvent: function (t, o, n, a) {
if (t) {
var r = null;
return (
'function' == typeof Event
? (r = new Event(o, { bubbles: n, cancelable: a }))
: (r = e.document.createEvent('Event')).initEvent(o, n, a),
!!r && (i.setData(r, 'internal', !0), t.dispatchEvent(r), !0)
);
}
},
triggerInputEvent: function (e, t, o, n) {
e && i.isTextInput(e) && i.triggerEvent(e, t, o, n);
},
eventKey: function (e) {
var t = { 9: 'Tab', 13: 'Enter', 27: 'Escape' };
return 'string' == typeof e.code
? e.code
: void 0 !== e.keyCode && t.hasOwnProperty(e.keyCode)
? t[e.keyCode]
: null;
},
strList: function (e) {
return e ? e.replace(/^\s+|\s+$/g, '').split(/\s+/) : [];
},
hasClass: function (e, t) {
return (
!!t &&
(void 0 !== e.classList
? e.classList.contains(t)
: -1 != (' ' + e.className.replace(/\s+/g, ' ') + ' ').indexOf(' ' + t + ' '))
);
},
addClass: function (e, t) {
var o = i.strList(t);
if (void 0 === e.classList)
for (n = 0; n < o.length; n += 1)
i.hasClass(e, o[n]) || (e.className += (e.className ? ' ' : '') + o[n]);
else for (var n = 0; n < o.length; n += 1) e.classList.add(o[n]);
},
removeClass: function (e, t) {
var o = i.strList(t);
if (void 0 === e.classList)
for (a = 0; a < o.length; a += 1) {
var n = new RegExp(
'^\\s*' + o[a] + '\\s*|\\s*' + o[a] + '\\s*$|\\s+' + o[a] + '(\\s+)',
'g',
);
e.className = e.className.replace(n, '$1');
}
else for (var a = 0; a < o.length; a += 1) e.classList.remove(o[a]);
},
getCompStyle: function (t) {
return (e.getComputedStyle ? e.getComputedStyle(t) : t.currentStyle) || {};
},
setStyle: function (e, t, o, n) {
var a = o ? 'important' : '',
r = null;
for (var l in t)
if (t.hasOwnProperty(l)) {
var s = null;
null === t[l]
? (r || (r = i.getData(e, 'origStyle')),
r && r.hasOwnProperty(l) && (s = r[l]))
: (n &&
(r || (r = i.getData(e, 'origStyle', {})),
r.hasOwnProperty(l) || (r[l] = e.style[l])),
(s = t[l])),
null !== s && e.style.setProperty(l, s, a);
}
},
hexColor: function (e, t, o) {
return (
'#' +
(
('0' + Math.round(e).toString(16)).substr(-2) +
('0' + Math.round(t).toString(16)).substr(-2) +
('0' + Math.round(o).toString(16)).substr(-2)
).toUpperCase()
);
},
hexaColor: function (e, t, o, n) {
return (
'#' +
(
('0' + Math.round(e).toString(16)).substr(-2) +
('0' + Math.round(t).toString(16)).substr(-2) +
('0' + Math.round(o).toString(16)).substr(-2) +
('0' + Math.round(255 * n).toString(16)).substr(-2)
).toUpperCase()
);
},
rgbColor: function (e, t, o) {
return 'rgb(' + Math.round(e) + ',' + Math.round(t) + ',' + Math.round(o) + ')';
},
rgbaColor: function (e, t, o, n) {
return (
'rgba(' +
Math.round(e) +
',' +
Math.round(t) +
',' +
Math.round(o) +
',' +
Math.round(100 * (null == n ? 1 : n)) / 100 +
')'
);
},
linearGradient:
((o = (function () {
for (
var t = 'linear-gradient',
o = ['', '-webkit-', '-moz-', '-o-', '-ms-'],
n = e.document.createElement('div'),
i = 0;
i < o.length;
i += 1
) {
var a = o[i] + t,
r = a + '(to right, rgba(0,0,0,0), rgba(0,0,0,0))';
if (((n.style.background = r), n.style.background)) return a;
}
return t;
})()),
function () {
return o + '(' + Array.prototype.join.call(arguments, ', ') + ')';
}),
setBorderRadius: function (e, t) {
i.setStyle(e, { 'border-radius': t || '0' });
},
setBoxShadow: function (e, t) {
i.setStyle(e, { 'box-shadow': t || 'none' });
},
getElementPos: function (e, t) {
var o = 0,
n = 0,
a = e.getBoundingClientRect();
if (((o = a.left), (n = a.top), !t)) {
var r = i.getViewPos();
(o += r[0]), (n += r[1]);
}
return [o, n];
},
getElementSize: function (e) {
return [e.offsetWidth, e.offsetHeight];
},
getAbsPointerPos: function (e) {
var t = 0,
o = 0;
return (
void 0 !== e.changedTouches && e.changedTouches.length
? ((t = e.changedTouches[0].clientX), (o = e.changedTouches[0].clientY))
: 'number' == typeof e.clientX && ((t = e.clientX), (o = e.clientY)),
{ x: t, y: o }
);
},
getRelPointerPos: function (e) {
var t = (e.target || e.srcElement).getBoundingClientRect(),
o = 0,
n = 0;
return (
void 0 !== e.changedTouches && e.changedTouches.length
? ((o = e.changedTouches[0].clientX), (n = e.changedTouches[0].clientY))
: 'number' == typeof e.clientX && ((o = e.clientX), (n = e.clientY)),
{ x: o - t.left, y: n - t.top }
);
},
getViewPos: function () {
var t = e.document.documentElement;
return [
(e.pageXOffset || t.scrollLeft) - (t.clientLeft || 0),
(e.pageYOffset || t.scrollTop) - (t.clientTop || 0),
];
},
getViewSize: function () {
var t = e.document.documentElement;
return [e.innerWidth || t.clientWidth, e.innerHeight || t.clientHeight];
},
RGB_HSV: function (e, t, o) {
(e /= 255), (t /= 255), (o /= 255);
var n = Math.min(Math.min(e, t), o),
i = Math.max(Math.max(e, t), o),
a = i - n;
if (0 === a) return [null, 0, 100 * i];
var r = e === n ? 3 + (o - t) / a : t === n ? 5 + (e - o) / a : 1 + (t - e) / a;
return [60 * (6 === r ? 0 : r), (a / i) * 100, 100 * i];
},
HSV_RGB: function (e, t, o) {
var n = (o / 100) * 255;
if (null === e) return [n, n, n];
(e /= 60), (t /= 100);
var i = Math.floor(e),
a = n * (1 - t),
r = n * (1 - t * (i % 2 ? e - i : 1 - (e - i)));
switch (i) {
case 6:
case 0:
return [n, r, a];
case 1:
return [r, n, a];
case 2:
return [a, n, r];
case 3:
return [a, r, n];
case 4:
return [r, a, n];
case 5:
return [n, a, r];
}
},
parseColorString: function (e) {
var t,
o = { rgba: null, format: null };
if ((t = e.match(/^\W*([0-9A-F]{3,8})\W*$/i))) {
if (8 === t[1].length)
(o.format = 'hexa'),
(o.rgba = [
parseInt(t[1].substr(0, 2), 16),
parseInt(t[1].substr(2, 2), 16),
parseInt(t[1].substr(4, 2), 16),
parseInt(t[1].substr(6, 2), 16) / 255,
]);
else if (6 === t[1].length)
(o.format = 'hex'),
(o.rgba = [
parseInt(t[1].substr(0, 2), 16),
parseInt(t[1].substr(2, 2), 16),
parseInt(t[1].substr(4, 2), 16),
null,
]);
else {
if (3 !== t[1].length) return !1;
(o.format = 'hex'),
(o.rgba = [
parseInt(t[1].charAt(0) + t[1].charAt(0), 16),
parseInt(t[1].charAt(1) + t[1].charAt(1), 16),
parseInt(t[1].charAt(2) + t[1].charAt(2), 16),
null,
]);
}
return o;
}
if ((t = e.match(/^\W*rgba?\(([^)]*)\)\W*$/i))) {
var n,
i,
a,
r,
l = t[1].split(','),
s = /^\s*(\d+|\d*\.\d+|\d+\.\d*)\s*$/;
if (
l.length >= 3 &&
(n = l[0].match(s)) &&
(i = l[1].match(s)) &&
(a = l[2].match(s))
)
return (
(o.format = 'rgb'),
(o.rgba = [
parseFloat(n[1]) || 0,
parseFloat(i[1]) || 0,
parseFloat(a[1]) || 0,
null,
]),
l.length >= 4 &&
(r = l[3].match(s)) &&
((o.format = 'rgba'), (o.rgba[3] = parseFloat(r[1]) || 0)),
o
);
}
return !1;
},
parsePaletteValue: function (e) {
var t = [];
'string' == typeof e
? e.replace(/#[0-9A-F]{3}([0-9A-F]{3})?|rgba?\(([^)]*)\)/gi, function (e) {
t.push(e);
})
: Array.isArray(e) && (t = e);
for (var o = [], n = 0; n < t.length; n++) {
var a = i.parseColorString(t[n]);
a && o.push(a);
}
return o;
},
containsTranparentColor: function (e) {
for (var t = 0; t < e.length; t++) {
var o = e[t].rgba[3];
if (null !== o && o < 1) return !0;
}
return !1;
},
isAlphaFormat: function (e) {
switch (e.toLowerCase()) {
case 'hexa':
case 'rgba':
return !0;
}
return !1;
},
scaleCanvasForHighDPR: function (t) {
var o = e.devicePixelRatio || 1;
(t.width *= o), (t.height *= o), t.getContext('2d').scale(o, o);
},
genColorPreviewCanvas: function (e, t, o, n) {
var a = Math.round(i.pub.previewSeparator.length),
r = i.pub.chessboardSize,
l = i.pub.chessboardColor1,
s = i.pub.chessboardColor2,
c = o || 2 * r,
d = 2 * r,
p = i.createEl('canvas'),
u = p.getContext('2d');
(p.width = c),
(p.height = d),
n && i.scaleCanvasForHighDPR(p),
(u.fillStyle = l),
u.fillRect(0, 0, c, d),
(u.fillStyle = s);
for (var m = 0; m < c; m += 2 * r)
u.fillRect(m, 0, r, r), u.fillRect(m + r, r, r, r);
e && ((u.fillStyle = e), u.fillRect(0, 0, c, d));
var h = null;
switch (t) {
case 'left':
(h = 0), u.clearRect(0, 0, a / 2, d);
break;
case 'right':
(h = c - a), u.clearRect(c - a / 2, 0, a / 2, d);
}
if (null !== h) {
u.lineWidth = 1;
for (var g = 0; g < i.pub.previewSeparator.length; g += 1)
u.beginPath(),
(u.strokeStyle = i.pub.previewSeparator[g]),
u.moveTo(0.5 + h + g, 0),
u.lineTo(0.5 + h + g, d),
u.stroke();
}
return { canvas: p, width: c, height: d };
},
genColorPreviewGradient: function (e, t, o) {
var n;
return (
(n =
t && o
? [
'to ' + { left: 'right', right: 'left' }[t],
e + ' 0%',
e + ' ' + o + 'px',
'rgba(0,0,0,0) ' + (o + 1) + 'px',
'rgba(0,0,0,0) 100%',
]
: ['to right', e + ' 0%', e + ' 100%']),
i.linearGradient.apply(this, n)
);
},
redrawPosition: function () {
if (i.picker && i.picker.owner) {
var e,
t,
o = i.picker.owner;
o.fixed
? ((e = i.getElementPos(o.targetElement, !0)), (t = [0, 0]))
: ((e = i.getElementPos(o.targetElement)), (t = i.getViewPos()));
var n,
a,
r,
l = i.getElementSize(o.targetElement),
s = i.getViewSize(),
c = i.getPickerDims(o),
d = [c.borderW, c.borderH];
switch (o.position.toLowerCase()) {
case 'left':
(n = 1), (a = 0), (r = -1);
break;
case 'right':
(n = 1), (a = 0), (r = 1);
break;
case 'top':
(n = 0), (a = 1), (r = -1);
break;
default:
(n = 0), (a = 1), (r = 1);
}
var p = (l[a] + d[a]) / 2;
if (o.smartPosition)
u = [
-t[n] + e[n] + d[n] > s[n] &&
-t[n] + e[n] + l[n] / 2 > s[n] / 2 &&
e[n] + l[n] - d[n] >= 0
? e[n] + l[n] - d[n]
: e[n],
-t[a] + e[a] + l[a] + d[a] - p + p * r > s[a]
? -t[a] + e[a] + l[a] / 2 > s[a] / 2 && e[a] + l[a] - p - p * r >= 0
? e[a] + l[a] - p - p * r
: e[a] + l[a] - p + p * r
: e[a] + l[a] - p + p * r >= 0
? e[a] + l[a] - p + p * r
: e[a] + l[a] - p - p * r,
];
else var u = [e[n], e[a] + l[a] - p + p * r];
var m = u[n],
h = u[a],
g = o.fixed ? 'fixed' : 'absolute',
f = (u[0] + d[0] > e[0] || u[0] < e[0] + l[0]) && u[1] + d[1] < e[1] + l[1];
i._drawPosition(o, m, h, g, f);
}
},
_drawPosition: function (e, t, o, n, a) {
var r = a ? 0 : e.shadowBlur;
(i.picker.wrap.style.position = n),
(i.picker.wrap.style.left = t + 'px'),
(i.picker.wrap.style.top = o + 'px'),
i.setBoxShadow(
i.picker.boxS,
e.shadow ? new i.BoxShadow(0, r, e.shadowBlur, 0, e.shadowColor) : null,
);
},
getPickerDims: function (e) {
var t = 2 * e.controlBorderWidth + e.width,
o = 2 * e.controlBorderWidth + e.height,
n = 2 * e.controlBorderWidth + 2 * i.getControlPadding(e) + e.sliderSize;
i.getSliderChannel(e) && (t += n), e.hasAlphaChannel() && (t += n);
var a = i.getPaletteDims(e, t);
a.height && (o += a.height + e.padding),
e.closeButton && (o += 2 * e.controlBorderWidth + e.padding + e.buttonHeight);
var r = t + 2 * e.padding,
l = o + 2 * e.padding;
return {
contentW: t,
contentH: o,
paddedW: r,
paddedH: l,
borderW: r + 2 * e.borderWidth,
borderH: l + 2 * e.borderWidth,
palette: a,
};
},
getPaletteDims: function (e, t) {
var o = 0,
n = 0,
i = 0,
a = 0,
r = 0,
l = e._palette ? e._palette.length : 0;
return (
l &&
((n = (o = e.paletteCols) > 0 ? Math.ceil(l / o) : 0),
(i = Math.max(1, Math.floor((t - (o - 1) * e.paletteSpacing) / o))),
(a = e.paletteHeight ? Math.min(e.paletteHeight, i) : i)),
n && (r = n * a + (n - 1) * e.paletteSpacing),
{ cols: o, rows: n, cellW: i, cellH: a, width: t, height: r }
);
},
getControlPadding: function (e) {
return Math.max(
e.padding / 2,
2 * e.pointerBorderWidth + e.pointerThickness - e.controlBorderWidth,
);
},
getPadYChannel: function (e) {
switch (e.mode.charAt(1).toLowerCase()) {
case 'v':
return 'v';
}
return 's';
},
getSliderChannel: function (e) {
if (e.mode.length > 2)
switch (e.mode.charAt(2).toLowerCase()) {
case 's':
return 's';
case 'v':
return 'v';
}
return null;
},
triggerCallback: function (e, t) {
if (e[t]) {
var o = null;
if ('string' == typeof e[t])
try {
o = new Function(e[t]);
} catch (e) {
console.error(e);
}
else o = e[t];
o && o.call(e);
}
},
triggerGlobal: function (e) {
for (var t = i.getInstances(), o = 0; o < t.length; o += 1) t[o].trigger(e);
},
_pointerMoveEvent: { mouse: 'mousemove', touch: 'touchmove' },
_pointerEndEvent: { mouse: 'mouseup', touch: 'touchend' },
_pointerOrigin: null,
_capturedTarget: null,
onDocumentKeyUp: function (e) {
-1 !== ['Tab', 'Escape'].indexOf(i.eventKey(e)) &&
i.picker &&
i.picker.owner &&
i.picker.owner.tryHide();
},
onWindowResize: function (e) {
i.redrawPosition();
},
onWindowScroll: function (e) {
i.redrawPosition();
},
onParentScroll: function (e) {
i.picker && i.picker.owner && i.picker.owner.tryHide();
},
onDocumentMouseDown: function (e) {
var t = e.target || e.srcElement;
t.jscolor && t.jscolor instanceof i.pub
? t.jscolor.showOnClick && !t.disabled && t.jscolor.show()
: i.getData(t, 'gui')
? i.getData(t, 'control') &&
i.onControlPointerStart(e, t, i.getData(t, 'control'), 'mouse')
: i.picker && i.picker.owner && i.picker.owner.tryHide();
},
onPickerTouchStart: function (e) {
var t = e.target || e.srcElement;
i.getData(t, 'control') &&
i.onControlPointerStart(e, t, i.getData(t, 'control'), 'touch');
},
onControlPointerStart: function (t, o, n, a) {
var r = i.getData(o, 'instance');
i.preventDefault(t), i.captureTarget(o);
var l = function (e, r) {
i.attachGroupEvent(
'drag',
e,
i._pointerMoveEvent[a],
i.onDocumentPointerMove(t, o, n, a, r),
),
i.attachGroupEvent(
'drag',
e,
i._pointerEndEvent[a],
i.onDocumentPointerEnd(t, o, n, a),
);
};
if ((l(e.document, [0, 0]), e.parent && e.frameElement)) {
var s = e.frameElement.getBoundingClientRect(),
c = [-s.left, -s.top];
l(e.parent.window.document, c);
}
var d = i.getAbsPointerPos(t),
p = i.getRelPointerPos(t);
switch (((i._pointerOrigin = { x: d.x - p.x, y: d.y - p.y }), n)) {
case 'pad':
'v' === i.getSliderChannel(r) &&
0 === r.channels.v &&
r.fromHSVA(null, null, 100, null),
i.setPad(r, t, 0, 0);
break;
case 'sld':
i.setSld(r, t, 0);
break;
case 'asld':
i.setASld(r, t, 0);
}
r.trigger('input');
},
onDocumentPointerMove: function (e, t, o, n, a) {
return function (e) {
var n = i.getData(t, 'instance');
switch (o) {
case 'pad':
i.setPad(n, e, a[0], a[1]);
break;
case 'sld':
i.setSld(n, e, a[1]);
break;
case 'asld':
i.setASld(n, e, a[1]);
}
n.trigger('input');
};
},
onDocumentPointerEnd: function (e, t, o, n) {
return function (e) {
var o = i.getData(t, 'instance');
i.detachGroupEvents('drag'),
i.releaseTarget(),
o.trigger('input'),
o.trigger('change');
};
},
onPaletteSampleClick: function (e) {
var t = e.currentTarget,
o = i.getData(t, 'instance'),
n = i.getData(t, 'color');
'any' === o.format.toLowerCase() &&
(o._setFormat(n.format), i.isAlphaFormat(o.getFormat()) || (n.rgba[3] = 1)),
null === n.rgba[3] &&
(!0 === o.paletteSetsAlpha ||
('auto' === o.paletteSetsAlpha && o._paletteHasTransparency)) &&
(n.rgba[3] = 1),
o.fromRGBA.apply(o, n.rgba),
o.trigger('input'),
o.trigger('change'),
o.hideOnPaletteClick && o.hide();
},
setPad: function (e, t, o, n) {
var a = i.getAbsPointerPos(t),
r = o + a.x - i._pointerOrigin.x - e.padding - e.controlBorderWidth,
l = n + a.y - i._pointerOrigin.y - e.padding - e.controlBorderWidth,
s = r * (360 / (e.width - 1)),
c = 100 - l * (100 / (e.height - 1));
switch (i.getPadYChannel(e)) {
case 's':
e.fromHSVA(s, c, null, null);
break;
case 'v':
e.fromHSVA(s, null, c, null);
}
},
setSld: function (e, t, o) {
var n =
100 -
(o +
i.getAbsPointerPos(t).y -
i._pointerOrigin.y -
e.padding -
e.controlBorderWidth) *
(100 / (e.height - 1));
switch (i.getSliderChannel(e)) {
case 's':
e.fromHSVA(null, n, null, null);
break;
case 'v':
e.fromHSVA(null, null, n, null);
}
},
setASld: function (e, t, o) {
var n =
1 -
(o +
i.getAbsPointerPos(t).y -
i._pointerOrigin.y -
e.padding -
e.controlBorderWidth) *
(1 / (e.height - 1));
if (n < 1) {
var a = e.getFormat();
'any' !== e.format.toLowerCase() ||
i.isAlphaFormat(a) ||
e._setFormat('hex' === a ? 'hexa' : 'rgba');
}
e.fromHSVA(null, null, null, n);
},
createPadCanvas: function () {
var e = { elm: null, draw: null },
t = i.createEl('canvas'),
o = t.getContext('2d');
return (
(e.elm = t),
(e.draw = function (e, n, i) {
(t.width = e), (t.height = n), o.clearRect(0, 0, t.width, t.height);
var a = o.createLinearGradient(0, 0, t.width, 0);
a.addColorStop(0, '#F00'),
a.addColorStop(1 / 6, '#FF0'),
a.addColorStop(2 / 6, '#0F0'),
a.addColorStop(0.5, '#0FF'),
a.addColorStop(4 / 6, '#00F'),
a.addColorStop(5 / 6, '#F0F'),
a.addColorStop(1, '#F00'),
(o.fillStyle = a),
o.fillRect(0, 0, t.width, t.height);
var r = o.createLinearGradient(0, 0, 0, t.height);
switch (i.toLowerCase()) {
case 's':
r.addColorStop(0, 'rgba(255,255,255,0)'),
r.addColorStop(1, 'rgba(255,255,255,1)');
break;
case 'v':
r.addColorStop(0, 'rgba(0,0,0,0)'), r.addColorStop(1, 'rgba(0,0,0,1)');
}
(o.fillStyle = r), o.fillRect(0, 0, t.width, t.height);
}),
e
);
},
createSliderGradient: function () {
var e = { elm: null, draw: null },
t = i.createEl('canvas'),
o = t.getContext('2d');
return (
(e.elm = t),
(e.draw = function (e, n, i, a) {
(t.width = e), (t.height = n), o.clearRect(0, 0, t.width, t.height);
var r = o.createLinearGradient(0, 0, 0, t.height);
r.addColorStop(0, i),
r.addColorStop(1, a),
(o.fillStyle = r),
o.fillRect(0, 0, t.width, t.height);
}),
e
);
},
createASliderGradient: function () {
var e = { elm: null, draw: null },
t = i.createEl('canvas'),
o = t.getContext('2d');
return (
(e.elm = t),
(e.draw = function (e, n, a) {
(t.width = e), (t.height = n), o.clearRect(0, 0, t.width, t.height);
var r = t.width / 2,
l = i.pub.chessboardColor1,
s = i.pub.chessboardColor2;
if (((o.fillStyle = l), o.fillRect(0, 0, t.width, t.height), r > 0))
for (var c = 0; c < t.height; c += 2 * r)
(o.fillStyle = s), o.fillRect(0, c, r, r), o.fillRect(r, c + r, r, r);
var d = o.createLinearGradient(0, 0, 0, t.height);
d.addColorStop(0, a),
d.addColorStop(1, 'rgba(0,0,0,0)'),
(o.fillStyle = d),
o.fillRect(0, 0, t.width, t.height);
}),
e
);
},
BoxShadow:
((t = function (e, t, o, n, i, a) {
(this.hShadow = e),
(this.vShadow = t),
(this.blur = o),
(this.spread = n),
(this.color = i),
(this.inset = !!a);
}),
(t.prototype.toString = function () {
var e = [
Math.round(this.hShadow) + 'px',
Math.round(this.vShadow) + 'px',
Math.round(this.blur) + 'px',
Math.round(this.spread) + 'px',
this.color,
];
return this.inset && e.push('inset'), e.join(' ');
}),
t),
flags: { leaveValue: 1, leaveAlpha: 2, leavePreview: 4 },
enumOpts: {
format: ['auto', 'any', 'hex', 'hexa', 'rgb', 'rgba'],
previewPosition: ['left', 'right'],
mode: ['hsv', 'hvs', 'hs', 'hv'],
position: ['left', 'right', 'top', 'bottom'],
alphaChannel: ['auto', !0, !1],
paletteSetsAlpha: ['auto', !0, !1],
},
deprecatedOpts: {
styleElement: 'previewElement',
onFineChange: 'onInput',
overwriteImportant: 'forceStyle',
closable: 'closeButton',
insetWidth: 'controlBorderWidth',
insetColor: 'controlBorderColor',
refine: null,
},
docsRef: ' See https://jscolor.com/docs/',
pub: function (t, o) {
var n = this;
function a(e, t) {
if ('string' != typeof e)
throw new Error('Invalid value for option name: ' + e);
if (
i.enumOpts.hasOwnProperty(e) &&
('string' == typeof t && (t = t.toLowerCase()),
-1 === i.enumOpts[e].indexOf(t))
)
throw new Error("Option '" + e + "' has invalid value: " + t);
if (i.deprecatedOpts.hasOwnProperty(e)) {
var o = e,
a = i.deprecatedOpts[e];
if (!a) throw new Error("Option '" + e + "' is DEPRECATED");
console.warn(
"Option '%s' is DEPRECATED, using '%s' instead." + i.docsRef,
o,
a,
),
(e = a);
}
var r = 'set__' + e;
if ('function' == typeof n[r]) return n[r](t), !0;
if (e in n) return (n[e] = t), !0;
throw new Error('Unrecognized configuration option: ' + e);
}
function r(e) {
if ('string' != typeof e)
throw new Error('Invalid value for option name: ' + e);
if (i.deprecatedOpts.hasOwnProperty(e)) {
var t = e,
o = i.deprecatedOpts[e];
if (!o) throw new Error("Option '" + e + "' is DEPRECATED");
console.warn(
"Option '%s' is DEPRECATED, using '%s' instead." + i.docsRef,
t,
o,
),
(e = o);
}
var a = 'get__' + e;
if ('function' == typeof n[a]) return n[a](value);
if (e in n) return n[e];
throw new Error('Unrecognized configuration option: ' + e);
}
function l() {
n._processParentElementsInDOM(),
i.picker ||
((i.picker = {
owner: null,
wrap: i.createEl('div'),
box: i.createEl('div'),
boxS: i.createEl('div'),
boxB: i.createEl('div'),
pad: i.createEl('div'),
padB: i.createEl('div'),
padM: i.createEl('div'),
padCanvas: i.createPadCanvas(),
cross: i.createEl('div'),
crossBY: i.createEl('div'),
crossBX: i.createEl('div'),
crossLY: i.createEl('div'),
crossLX: i.createEl('div'),
sld: i.createEl('div'),
sldB: i.createEl('div'),
sldM: i.createEl('div'),
sldGrad: i.createSliderGradient(),
sldPtrS: i.createEl('div'),
sldPtrIB: i.createEl('div'),
sldPtrMB: i.createEl('div'),
sldPtrOB: i.createEl('div'),
asld: i.createEl('div'),
asldB: i.createEl('div'),
asldM: i.createEl('div'),
asldGrad: i.createASliderGradient(),
asldPtrS: i.createEl('div'),
asldPtrIB: i.createEl('div'),
asldPtrMB: i.createEl('div'),
asldPtrOB: i.createEl('div'),
pal: i.createEl('div'),
btn: i.createEl('div'),
btnT: i.createEl('span'),
}),
i.picker.pad.appendChild(i.picker.padCanvas.elm),
i.picker.padB.appendChild(i.picker.pad),
i.picker.cross.appendChild(i.picker.crossBY),
i.picker.cross.appendChild(i.picker.crossBX),
i.picker.cross.appendChild(i.picker.crossLY),
i.picker.cross.appendChild(i.picker.crossLX),
i.picker.padB.appendChild(i.picker.cross),
i.picker.box.appendChild(i.picker.padB),
i.picker.box.appendChild(i.picker.padM),
i.picker.sld.appendChild(i.picker.sldGrad.elm),
i.picker.sldB.appendChild(i.picker.sld),
i.picker.sldB.appendChild(i.picker.sldPtrOB),
i.picker.sldPtrOB.appendChild(i.picker.sldPtrMB),
i.picker.sldPtrMB.appendChild(i.picker.sldPtrIB),
i.picker.sldPtrIB.appendChild(i.picker.sldPtrS),
i.picker.box.appendChild(i.picker.sldB),
i.picker.box.appendChild(i.picker.sldM),
i.picker.asld.appendChild(i.picker.asldGrad.elm),
i.picker.asldB.appendChild(i.picker.asld),
i.picker.asldB.appendChild(i.picker.asldPtrOB),
i.picker.asldPtrOB.appendChild(i.picker.asldPtrMB),
i.picker.asldPtrMB.appendChild(i.picker.asldPtrIB),
i.picker.asldPtrIB.appendChild(i.picker.asldPtrS),
i.picker.box.appendChild(i.picker.asldB),
i.picker.box.appendChild(i.picker.asldM),
i.picker.box.appendChild(i.picker.pal),
i.picker.btn.appendChild(i.picker.btnT),
i.picker.box.appendChild(i.picker.btn),
i.picker.boxB.appendChild(i.picker.box),
i.picker.wrap.appendChild(i.picker.boxS),
i.picker.wrap.appendChild(i.picker.boxB),
i.picker.wrap.addEventListener(
'touchstart',
i.onPickerTouchStart,
!!i.isPassiveEventSupported && { passive: !1 },
));
var t,
o,
a = i.picker,
r = !!i.getSliderChannel(n),
l = n.hasAlphaChannel(),
p = i.getPickerDims(n),
u = 2 * n.pointerBorderWidth + n.pointerThickness + 2 * n.crossSize,
m = i.getControlPadding(n),
h = Math.min(n.borderRadius, Math.round(n.padding * Math.PI));
(a.wrap.className = 'jscolor-picker-wrap'),
(a.wrap.style.clear = 'both'),
(a.wrap.style.width = p.borderW + 'px'),
(a.wrap.style.height = p.borderH + 'px'),
(a.wrap.style.zIndex = n.zIndex),
(a.box.className = 'jscolor-picker'),
(a.box.style.width = p.paddedW + 'px'),
(a.box.style.height = p.paddedH + 'px'),
(a.box.style.position = 'relative'),
(a.boxS.className = 'jscolor-picker-shadow'),
(a.boxS.style.position = 'absolute'),
(a.boxS.style.left = '0'),
(a.boxS.style.top = '0'),
(a.boxS.style.width = '100%'),
(a.boxS.style.height = '100%'),
i.setBorderRadius(a.boxS, h + 'px'),
(a.boxB.className = 'jscolor-picker-border'),
(a.boxB.style.position = 'relative'),
(a.boxB.style.border = n.borderWidth + 'px solid'),
(a.boxB.style.borderColor = n.borderColor),
(a.boxB.style.background = n.backgroundColor),
i.setBorderRadius(a.boxB, h + 'px'),
(a.padM.style.background = 'rgba(255,0,0,.2)'),
(a.sldM.style.background = 'rgba(0,255,0,.2)'),
(a.asldM.style.background = 'rgba(0,0,255,.2)'),
(a.padM.style.opacity = a.sldM.style.opacity = a.asldM.style.opacity = '0'),
(a.pad.style.position = 'relative'),
(a.pad.style.width = n.width + 'px'),
(a.pad.style.height = n.height + 'px'),
a.padCanvas.draw(n.width, n.height, i.getPadYChannel(n)),
(a.padB.style.position = 'absolute'),
(a.padB.style.left = n.padding + 'px'),
(a.padB.style.top = n.padding + 'px'),
(a.padB.style.border = n.controlBorderWidth + 'px solid'),
(a.padB.style.borderColor = n.controlBorderColor),
(a.padM.style.position = 'absolute'),
(a.padM.style.left = '0px'),
(a.padM.style.top = '0px'),
(a.padM.style.width =
n.padding + 2 * n.controlBorderWidth + n.width + m + 'px'),
(a.padM.style.height =
2 * n.controlBorderWidth + 2 * n.padding + n.height + 'px'),
(a.padM.style.cursor = 'crosshair'),
i.setData(a.padM, { instance: n, control: 'pad' }),
(a.cross.style.position = 'absolute'),
(a.cross.style.left = a.cross.style.top = '0'),
(a.cross.style.width = a.cross.style.height = u + 'px'),
(a.crossBY.style.position = a.crossBX.style.position = 'absolute'),
(a.crossBY.style.background = a.crossBX.style.background =
n.pointerBorderColor),
(a.crossBY.style.width = a.crossBX.style.height =
2 * n.pointerBorderWidth + n.pointerThickness + 'px'),
(a.crossBY.style.height = a.crossBX.style.width = u + 'px'),
(a.crossBY.style.left = a.crossBX.style.top =
Math.floor(u / 2) -
Math.floor(n.pointerThickness / 2) -
n.pointerBorderWidth +
'px'),
(a.crossBY.style.top = a.crossBX.style.left = '0'),
(a.crossLY.style.position = a.crossLX.style.position = 'absolute'),
(a.crossLY.style.background = a.crossLX.style.background = n.pointerColor),
(a.crossLY.style.height = a.crossLX.style.width =
u - 2 * n.pointerBorderWidth + 'px'),
(a.crossLY.style.width = a.crossLX.style.height = n.pointerThickness + 'px'),
(a.crossLY.style.left = a.crossLX.style.top =
Math.floor(u / 2) - Math.floor(n.pointerThickness / 2) + 'px'),
(a.crossLY.style.top = a.crossLX.style.left = n.pointerBorderWidth + 'px'),
(a.sld.style.overflow = 'hidden'),
(a.sld.style.width = n.sliderSize + 'px'),
(a.sld.style.height = n.height + 'px'),
a.sldGrad.draw(n.sliderSize, n.height, '#000', '#000'),
(a.sldB.style.display = r ? 'block' : 'none'),
(a.sldB.style.position = 'absolute'),
(a.sldB.style.left =
n.padding + n.width + 2 * n.controlBorderWidth + 2 * m + 'px'),
(a.sldB.style.top = n.padding + 'px'),
(a.sldB.style.border = n.controlBorderWidth + 'px solid'),
(a.sldB.style.borderColor = n.controlBorderColor),
(a.sldM.style.display = r ? 'block' : 'none'),
(a.sldM.style.position = 'absolute'),
(a.sldM.style.left =
n.padding + n.width + 2 * n.controlBorderWidth + m + 'px'),
(a.sldM.style.top = '0px'),
(a.sldM.style.width =
n.sliderSize +
2 * m +
2 * n.controlBorderWidth +
(l ? 0 : Math.max(0, n.padding - m)) +
'px'),
(a.sldM.style.height =
2 * n.controlBorderWidth + 2 * n.padding + n.height + 'px'),
(a.sldM.style.cursor = 'default'),
i.setData(a.sldM, { instance: n, control: 'sld' }),
(a.sldPtrIB.style.border = a.sldPtrOB.style.border =
n.pointerBorderWidth + 'px solid ' + n.pointerBorderColor),
(a.sldPtrOB.style.position = 'absolute'),
(a.sldPtrOB.style.left =
-(2 * n.pointerBorderWidth + n.pointerThickness) + 'px'),
(a.sldPtrOB.style.top = '0'),
(a.sldPtrMB.style.border = n.pointerThickness + 'px solid ' + n.pointerColor),
(a.sldPtrS.style.width = n.sliderSize + 'px'),
(a.sldPtrS.style.height = i.pub.sliderInnerSpace + 'px'),
(a.asld.style.overflow = 'hidden'),
(a.asld.style.width = n.sliderSize + 'px'),
(a.asld.style.height = n.height + 'px'),
a.asldGrad.draw(n.sliderSize, n.height, '#000'),
(a.asldB.style.display = l ? 'block' : 'none'),
(a.asldB.style.position = 'absolute'),
(a.asldB.style.left =
n.padding +
n.width +
2 * n.controlBorderWidth +
m +
(r ? n.sliderSize + 3 * m + 2 * n.controlBorderWidth : 0) +
'px'),
(a.asldB.style.top = n.padding + 'px'),
(a.asldB.style.border = n.controlBorderWidth + 'px solid'),
(a.asldB.style.borderColor = n.controlBorderColor),
(a.asldM.style.display = l ? 'block' : 'none'),
(a.asldM.style.position = 'absolute'),
(a.asldM.style.left =
n.padding +
n.width +
2 * n.controlBorderWidth +
m +
(r ? n.sliderSize + 2 * m + 2 * n.controlBorderWidth : 0) +
'px'),
(a.asldM.style.top = '0px'),
(a.asldM.style.width =
n.sliderSize +
2 * m +
2 * n.controlBorderWidth +
Math.max(0, n.padding - m) +
'px'),
(a.asldM.style.height =
2 * n.controlBorderWidth + 2 * n.padding + n.height + 'px'),
(a.asldM.style.cursor = 'default'),
i.setData(a.asldM, { instance: n, control: 'asld' }),
(a.asldPtrIB.style.border = a.asldPtrOB.style.border =
n.pointerBorderWidth + 'px solid ' + n.pointerBorderColor),
(a.asldPtrOB.style.position = 'absolute'),
(a.asldPtrOB.style.left =
-(2 * n.pointerBorderWidth + n.pointerThickness) + 'px'),
(a.asldPtrOB.style.top = '0'),
(a.asldPtrMB.style.border =
n.pointerThickness + 'px solid ' + n.pointerColor),
(a.asldPtrS.style.width = n.sliderSize + 'px'),
(a.asldPtrS.style.height = i.pub.sliderInnerSpace + 'px'),
(a.pal.className = 'jscolor-palette'),
(a.pal.style.display = p.palette.rows ? 'block' : 'none'),
(a.pal.style.position = 'absolute'),
(a.pal.style.left = n.padding + 'px'),
(a.pal.style.top =
2 * n.controlBorderWidth + 2 * n.padding + n.height + 'px'),
(a.pal.innerHTML = '');
for (
var g = i.genColorPreviewCanvas('rgba(0,0,0,0)'), f = 0, C = 0;
C < p.palette.rows;
C++
)
for (var y = 0; y < p.palette.cols && f < n._palette.length; y++, f++) {
var b = n._palette[f],
k = i.rgbaColor.apply(null, b.rgba),
G = i.createEl('div');
(G.style.width = p.palette.cellW - 2 * n.controlBorderWidth + 'px'),
(G.style.height = p.palette.cellH - 2 * n.controlBorderWidth + 'px'),
(G.style.backgroundColor = k);
var v = i.createEl('div');
(v.className = 'jscolor-palette-sample'),
(v.style.display = 'block'),
(v.style.position = 'absolute'),
(v.style.left =
(p.palette.cols <= 1
? 0
: Math.round(
y * ((p.contentW - p.palette.cellW) / (p.palette.cols - 1)) * 10,
) / 10) + 'px'),
(v.style.top = C * (p.palette.cellH + n.paletteSpacing) + 'px'),
(v.style.border = n.controlBorderWidth + 'px solid'),
(v.style.borderColor = n.controlBorderColor),
(v.style.cursor = 'pointer'),
null !== b.rgba[3] &&
b.rgba[3] < 1 &&
((v.style.backgroundImage = "url('" + g.canvas.toDataURL() + "')"),
(v.style.backgroundRepeat = 'repeat'),
(v.style.backgroundPosition = 'center center')),
i.setData(v, { instance: n, control: 'palette-sample', color: b }),
v.addEventListener('click', i.onPaletteSampleClick, !1),
v.appendChild(G),
a.pal.appendChild(v);
}
(a.btn.className = 'jscolor-btn-close'),
(a.btn.style.display = n.closeButton ? 'block' : 'none'),
(a.btn.style.position = 'absolute'),
(a.btn.style.left = n.padding + 'px'),
(a.btn.style.bottom = n.padding + 'px'),
(a.btn.style.padding = '0 15px'),
(a.btn.style.maxWidth = p.contentW - 2 * n.controlBorderWidth - 30 + 'px'),
(a.btn.style.overflow = 'hidden'),
(a.btn.style.height = n.buttonHeight + 'px'),
(a.btn.style.whiteSpace = 'nowrap'),
(a.btn.style.border = n.controlBorderWidth + 'px solid'),
(o =
(t = n.controlBorderColor.split(/\s+/)).length < 2
? t[0]
: t[1] + ' ' + t[0] + ' ' + t[0] + ' ' + t[1]),
(a.btn.style.borderColor = o),
(a.btn.style.color = n.buttonColor),
(a.btn.style.font = '12px sans-serif'),
(a.btn.style.textAlign = 'center'),
(a.btn.style.cursor = 'pointer'),
(a.btn.onmousedown = function () {
n.hide();
}),
(a.btnT.style.lineHeight = n.buttonHeight + 'px'),
(a.btnT.innerHTML = ''),
a.btnT.appendChild(e.document.createTextNode(n.closeText)),
s(),
c(),
d(),
i.picker.owner &&
i.picker.owner !== n &&
i.removeClass(i.picker.owner.targetElement, i.pub.activeClassName),
(i.picker.owner = n),
n.container === e.document.body
? i.redrawPosition()
: i._drawPosition(n, 0, 0, 'relative', !1),
a.wrap.parentNode !== n.container && n.container.appendChild(a.wrap),
i.addClass(n.targetElement, i.pub.activeClassName);
}
function s() {
var e = i.getPadYChannel(n),
t = Math.round((n.channels.h / 360) * (n.width - 1)),
o = Math.round((1 - n.channels[e] / 100) * (n.height - 1)),
a = 2 * n.pointerBorderWidth + n.pointerThickness + 2 * n.crossSize,
r = -Math.floor(a / 2);
switch (
((i.picker.cross.style.left = t + r + 'px'),
(i.picker.cross.style.top = o + r + 'px'),
i.getSliderChannel(n))
) {
case 's':
var l = i.HSV_RGB(n.channels.h, 100, n.channels.v),
s = i.HSV_RGB(n.channels.h, 0, n.channels.v),
c =
'rgb(' +
Math.round(l[0]) +
',' +
Math.round(l[1]) +
',' +
Math.round(l[2]) +
')',
d =
'rgb(' +
Math.round(s[0]) +
',' +
Math.round(s[1]) +
',' +
Math.round(s[2]) +
')';
i.picker.sldGrad.draw(n.sliderSize, n.height, c, d);
break;
case 'v':
var p = i.HSV_RGB(n.channels.h, n.channels.s, 100);
(c =
'rgb(' +
Math.round(p[0]) +
',' +
Math.round(p[1]) +
',' +
Math.round(p[2]) +
')'),
(d = '#000'),
i.picker.sldGrad.draw(n.sliderSize, n.height, c, d);
}
i.picker.asldGrad.draw(n.sliderSize, n.height, n.toHEXString());
}
function c() {
var e = i.getSliderChannel(n);
if (e) {
var t = Math.round((1 - n.channels[e] / 100) * (n.height - 1));
i.picker.sldPtrOB.style.top =
t -
(2 * n.pointerBorderWidth + n.pointerThickness) -
Math.floor(i.pub.sliderInnerSpace / 2) +
'px';
}
i.picker.asldGrad.draw(n.sliderSize, n.height, n.toHEXString());
}
function d() {
var e = Math.round((1 - n.channels.a) * (n.height - 1));
i.picker.asldPtrOB.style.top =
e -
(2 * n.pointerBorderWidth + n.pointerThickness) -
Math.floor(i.pub.sliderInnerSpace / 2) +
'px';
}
function p() {
return i.picker && i.picker.owner === n;
}
if (
(o || (o = {}),
(this.channels = { r: 255, g: 255, b: 255, h: 0, s: 0, v: 100, a: 1 }),
(this.format = 'auto'),
(this.value = void 0),
(this.alpha = void 0),
(this.onChange = void 0),
(this.onInput = void 0),
(this.valueElement = void 0),
(this.alphaElement = void 0),
(this.previewElement = void 0),
(this.previewPosition = 'left'),
(this.previewSize = 32),
(this.previewPadding = 8),
(this.required = !0),
(this.hash = !0),
(this.uppercase = !0),
(this.forceStyle = !0),
(this.width = 181),
(this.height = 101),
(this.mode = 'HSV'),
(this.alphaChannel = 'auto'),
(this.position = 'bottom'),
(this.smartPosition = !0),
(this.showOnClick = !0),
(this.hideOnLeave = !0),
(this.palette = []),
(this.paletteCols = 10),
(this.paletteSetsAlpha = 'auto'),
(this.paletteHeight = 16),
(this.paletteSpacing = 4),
(this.hideOnPaletteClick = !1),
(this.sliderSize = 16),
(this.crossSize = 8),
(this.closeButton = !1),
(this.closeText = 'Close'),
(this.buttonColor = 'rgba(0,0,0,1)'),
(this.buttonHeight = 18),
(this.padding = 12),
(this.backgroundColor = 'rgba(255,255,255,1)'),
(this.borderWidth = 1),
(this.borderColor = 'rgba(187,187,187,1)'),
(this.borderRadius = 8),
(this.controlBorderWidth = 1),
(this.controlBorderColor = 'rgba(187,187,187,1)'),
(this.shadow = !0),
(this.shadowBlur = 15),
(this.shadowColor = 'rgba(0,0,0,0.2)'),
(this.pointerColor = 'rgba(76,76,76,1)'),
(this.pointerBorderWidth = 1),
(this.pointerBorderColor = 'rgba(255,255,255,1)'),
(this.pointerThickness = 2),
(this.zIndex = 5e3),
(this.container = void 0),
(this.minS = 0),
(this.maxS = 100),
(this.minV = 0),
(this.maxV = 100),
(this.minA = 0),
(this.maxA = 1),
(this.option = function () {
if (!arguments.length) throw new Error('No option specified');
if (1 === arguments.length && 'string' == typeof arguments[0]) {
try {
return r(arguments[0]);
} catch (e) {
console.warn(e);
}
return !1;
}
if (arguments.length >= 2 && 'string' == typeof arguments[0]) {
try {
if (!a(arguments[0], arguments[1])) return !1;
} catch (e) {
return console.warn(e), !1;
}
return this.redraw(), this.exposeColor(), !0;
}
if (1 === arguments.length && 'object' == typeof arguments[0]) {
var e = arguments[0],
t = !0;
for (var o in e)
if (e.hasOwnProperty(o))
try {
a(o, e[o]) || (t = !1);
} catch (e) {
console.warn(e), (t = !1);
}
return this.redraw(), this.exposeColor(), t;
}
throw new Error('Invalid arguments');
}),
(this.channel = function (e, t) {
if ('string' != typeof e)
throw new Error('Invalid value for channel name: ' + e);
if (void 0 === t)
return this.channels.hasOwnProperty(e.toLowerCase())
? this.channels[e.toLowerCase()]
: (console.warn('Getting unknown channel: ' + e), !1);
var o = !1;
switch (e.toLowerCase()) {
case 'r':
o = this.fromRGBA(t, null, null, null);
break;
case 'g':
o = this.fromRGBA(null, t, null, null);
break;
case 'b':
o = this.fromRGBA(null, null, t, null);
break;
case 'h':
o = this.fromHSVA(t, null, null, null);
break;
case 's':
o = this.fromHSVA(null, t, null, null);
break;
case 'v':
o = this.fromHSVA(null, null, t, null);
break;
case 'a':
o = this.fromHSVA(null, null, null, t);
break;
default:
return console.warn('Setting unknown channel: ' + e), !1;
}
return !!o && (this.redraw(), !0);
}),
(this.trigger = function (e) {
for (var t = i.strList(e), o = 0; o < t.length; o += 1) {
var n = t[o].toLowerCase(),
a = null;
switch (n) {
case 'input':
a = 'onInput';
break;
case 'change':
a = 'onChange';
}
a && i.triggerCallback(this, a),
i.triggerInputEvent(this.valueElement, n, !0, !0);
}
}),
(this.fromHSVA = function (e, t, o, n, a) {
if (
(void 0 === e && (e = null),
void 0 === t && (t = null),
void 0 === o && (o = null),
void 0 === n && (n = null),
null !== e)
) {
if (isNaN(e)) return !1;
this.channels.h = Math.max(0, Math.min(360, e));
}
if (null !== t) {
if (isNaN(t)) return !1;
this.channels.s = Math.max(0, Math.min(100, this.maxS, t), this.minS);
}
if (null !== o) {
if (isNaN(o)) return !1;
this.channels.v = Math.max(0, Math.min(100, this.maxV, o), this.minV);
}
if (null !== n) {
if (isNaN(n)) return !1;
this.channels.a = this.hasAlphaChannel()
? Math.max(0, Math.min(1, this.maxA, n), this.minA)
: 1;
}
var r = i.HSV_RGB(this.channels.h, this.channels.s, this.channels.v);
return (
(this.channels.r = r[0]),
(this.channels.g = r[1]),
(this.channels.b = r[2]),
this.exposeColor(a),
!0
);
}),
(this.fromRGBA = function (e, t, o, n, a) {
if (
(void 0 === e && (e = null),
void 0 === t && (t = null),
void 0 === o && (o = null),
void 0 === n && (n = null),
null !== e)
) {
if (isNaN(e)) return !1;
e = Math.max(0, Math.min(255, e));
}
if (null !== t) {
if (isNaN(t)) return !1;
t = Math.max(0, Math.min(255, t));
}
if (null !== o) {
if (isNaN(o)) return !1;
o = Math.max(0, Math.min(255, o));
}
if (null !== n) {
if (isNaN(n)) return !1;
this.channels.a = this.hasAlphaChannel()
? Math.max(0, Math.min(1, this.maxA, n), this.minA)
: 1;
}
var r = i.RGB_HSV(
null === e ? this.channels.r : e,
null === t ? this.channels.g : t,
null === o ? this.channels.b : o,
);
null !== r[0] && (this.channels.h = Math.max(0, Math.min(360, r[0]))),
0 !== r[2] &&
(this.channels.s = Math.max(
0,
this.minS,
Math.min(100, this.maxS, r[1]),
)),
(this.channels.v = Math.max(0, this.minV, Math.min(100, this.maxV, r[2])));
var l = i.HSV_RGB(this.channels.h, this.channels.s, this.channels.v);
return (
(this.channels.r = l[0]),
(this.channels.g = l[1]),
(this.channels.b = l[2]),
this.exposeColor(a),
!0
);
}),
(this.fromHSV = function (e, t, o, n) {
return (
console.warn(
'fromHSV() method is DEPRECATED. Using fromHSVA() instead.' + i.docsRef,
),
this.fromHSVA(e, t, o, null, n)
);
}),
(this.fromRGB = function (e, t, o, n) {
return (
console.warn(
'fromRGB() method is DEPRECATED. Using fromRGBA() instead.' + i.docsRef,
),
this.fromRGBA(e, t, o, null, n)
);
}),
(this.fromString = function (e, t) {
if (!this.required && '' === e.trim())
return this.setPreviewElementBg(null), this.setValueElementValue(''), !0;
var o = i.parseColorString(e);
return (
!!o &&
('any' === this.format.toLowerCase() &&
(this._setFormat(o.format),
i.isAlphaFormat(this.getFormat()) || (o.rgba[3] = 1)),
this.fromRGBA(o.rgba[0], o.rgba[1], o.rgba[2], o.rgba[3], t),
!0)
);
}),
(this.toString = function (e) {
switch ((void 0 === e && (e = this.getFormat()), e.toLowerCase())) {
case 'hex':
return this.toHEXString();
case 'hexa':
return this.toHEXAString();
case 'rgb':
return this.toRGBString();
case 'rgba':
return this.toRGBAString();
}
return !1;
}),
(this.toHEXString = function () {
return i.hexColor(this.channels.r, this.channels.g, this.channels.b);
}),
(this.toHEXAString = function () {
return i.hexaColor(
this.channels.r,
this.channels.g,
this.channels.b,
this.channels.a,
);
}),
(this.toRGBString = function () {
return i.rgbColor(this.channels.r, this.channels.g, this.channels.b);
}),
(this.toRGBAString = function () {
return i.rgbaColor(
this.channels.r,
this.channels.g,
this.channels.b,
this.channels.a,
);
}),
(this.toGrayscale = function () {
return (
0.213 * this.channels.r + 0.715 * this.channels.g + 0.072 * this.channels.b
);
}),
(this.toCanvas = function () {
return i.genColorPreviewCanvas(this.toRGBAString()).canvas;
}),
(this.toDataURL = function () {
return this.toCanvas().toDataURL();
}),
(this.toBackground = function () {
return i.pub.background(this.toRGBAString());
}),
(this.isLight = function () {
return this.toGrayscale() > 127.5;
}),
(this.hide = function () {
p() &&
(i.removeClass(n.targetElement, i.pub.activeClassName),
i.picker.wrap.parentNode.removeChild(i.picker.wrap),
delete i.picker.owner);
}),
(this.show = function () {
l();
}),
(this.redraw = function () {
p() && l();
}),
(this.getFormat = function () {
return this._currentFormat;
}),
(this._setFormat = function (e) {
this._currentFormat = e.toLowerCase();
}),
(this.hasAlphaChannel = function () {
return 'auto' === this.alphaChannel
? 'any' === this.format.toLowerCase() ||
i.isAlphaFormat(this.getFormat()) ||
void 0 !== this.alpha ||
void 0 !== this.alphaElement
: this.alphaChannel;
}),
(this.processValueInput = function (e) {
this.fromString(e) || this.exposeColor();
}),
(this.processAlphaInput = function (e) {
this.fromHSVA(null, null, null, parseFloat(e)) || this.exposeColor();
}),
(this.exposeColor = function (e) {
var t = this.toString(),
o = this.getFormat();
if (
(i.setDataAttr(this.targetElement, 'current-color', t),
e & i.flags.leaveValue ||
!this.valueElement ||
(('hex' !== o && 'hexa' !== o) ||
(this.uppercase || (t = t.toLowerCase()),
this.hash || (t = t.replace(/^#/, ''))),
this.setValueElementValue(t)),
!(e & i.flags.leaveAlpha) && this.alphaElement)
) {
var n = Math.round(100 * this.channels.a) / 100;
this.setAlphaElementValue(n);
}
e & i.flags.leavePreview ||
!this.previewElement ||
((i.isTextInput(this.previewElement) ||
(i.isButton(this.previewElement) &&
!i.isButtonEmpty(this.previewElement))) &&
this.previewPosition,
this.setPreviewElementBg(this.toRGBAString())),
p() && (s(), c(), d());
}),
(this.setPreviewElementBg = function (e) {
if (this.previewElement) {
var t = null,
o = null;
(i.isTextInput(this.previewElement) ||
(i.isButton(this.previewElement) &&
!i.isButtonEmpty(this.previewElement))) &&
((t = this.previewPosition), (o = this.previewSize));
var n = [];
if (e) {
n.push({
image: i.genColorPreviewGradient(
e,
t,
o ? o - i.pub.previewSeparator.length : null,
),
position: 'left top',
size: 'auto',
repeat: t ? 'repeat-y' : 'repeat',
origin: 'padding-box',
});
var a = i.genColorPreviewCanvas(
'rgba(0,0,0,0)',
t ? { left: 'right', right: 'left' }[t] : null,
o,
!0,
);
n.push({
image: "url('" + a.canvas.toDataURL() + "')",
position: (t || 'left') + ' top',
size: a.width + 'px ' + a.height + 'px',
repeat: t ? 'repeat-y' : 'repeat',
origin: 'padding-box',
});
} else
n.push({
image: 'none',
position: 'left top',
size: 'auto',
repeat: 'no-repeat',
origin: 'padding-box',
});
for (
var r = { image: [], position: [], size: [], repeat: [], origin: [] },
l = 0;
l < n.length;
l += 1
)
r.image.push(n[l].image),
r.position.push(n[l].position),
r.size.push(n[l].size),
r.repeat.push(n[l].repeat),
r.origin.push(n[l].origin);
var s = {
'background-image': r.image.join(', '),
'background-position': r.position.join(', '),
'background-size': r.size.join(', '),
'background-repeat': r.repeat.join(', '),
'background-origin': r.origin.join(', '),
};
i.setStyle(this.previewElement, s, this.forceStyle);
var c = { left: null, right: null };
t && (c[t] = this.previewSize + this.previewPadding + 'px'),
(s = { 'padding-left': c.left, 'padding-right': c.right }),
i.setStyle(this.previewElement, s, this.forceStyle, !0);
}
}),
(this.setValueElementValue = function (e) {
this.valueElement &&
('input' === i.nodeName(this.valueElement)
? (this.valueElement.value = e)
: (this.valueElement.innerHTML = e));
}),
(this.setAlphaElementValue = function (e) {
this.alphaElement &&
('input' === i.nodeName(this.alphaElement)
? (this.alphaElement.value = e)
: (this.alphaElement.innerHTML = e));
}),
(this._processParentElementsInDOM = function () {
if (!this._parentElementsProcessed) {
this._parentElementsProcessed = !0;
var e = this.targetElement;
do {
var t = i.getCompStyle(e);
t.position && 'fixed' === t.position.toLowerCase() && (this.fixed = !0),
e !== this.targetElement &&
(i.getData(e, 'hasScrollListener') ||
(e.addEventListener('scroll', i.onParentScroll, !1),
i.setData(e, 'hasScrollListener', !0)));
} while ((e = e.parentNode) && 'body' !== i.nodeName(e));
}
}),
(this.tryHide = function () {
this.hideOnLeave && this.hide();
}),
(this.set__palette = function (e) {
(this.palette = e),
(this._palette = i.parsePaletteValue(e)),
(this._paletteHasTransparency = i.containsTranparentColor(this._palette));
}),
i.pub.options)
)
for (var u in i.pub.options)
if (i.pub.options.hasOwnProperty(u))
try {
a(u, i.pub.options[u]);
} catch (e) {
console.warn(e);
}
var m = [];
o.preset &&
('string' == typeof o.preset
? (m = o.preset.split(/\s+/))
: Array.isArray(o.preset)
? (m = o.preset.slice())
: console.warn('Unrecognized preset value')),
-1 === m.indexOf('default') && m.push('default');
for (var h = m.length - 1; h >= 0; h -= 1) {
var g = m[h];
if (g)
if (i.pub.presets.hasOwnProperty(g)) {
for (var u in i.pub.presets[g])
if (i.pub.presets[g].hasOwnProperty(u))
try {
a(u, i.pub.presets[g][u]);
} catch (e) {
console.warn(e);
}
} else console.warn('Unknown preset: %s', g);
}
var f = ['preset'];
for (var u in o)
if (o.hasOwnProperty(u) && -1 === f.indexOf(u))
try {
a(u, o[u]);
} catch (e) {
console.warn(e);
}
if (
(void 0 === this.container
? (this.container = e.document.body)
: (this.container = i.node(this.container)),
!this.container)
)
throw new Error('Cannot instantiate color picker without a container element');
if (((this.targetElement = i.node(t)), !this.targetElement)) {
if ('string' == typeof t && /^[a-zA-Z][\w:.-]*$/.test(t))
throw new Error(
"If '" +
t +
"' is supposed to be an ID, please use '#" +
t +
"' or any valid CSS selector.",
);
throw new Error('Cannot instantiate color picker without a target element');
}
if (this.targetElement.jscolor && this.targetElement.jscolor instanceof i.pub)
throw new Error('Color picker already installed on this element');
if (
((this.targetElement.jscolor = this),
i.addClass(this.targetElement, i.pub.className),
i.instances.push(this),
i.isButton(this.targetElement) &&
('button' !== this.targetElement.type.toLowerCase() &&
(this.targetElement.type = 'button'),
i.isButtonEmpty(this.targetElement)))
) {
i.removeChildren(this.targetElement),
this.targetElement.appendChild(e.document.createTextNode(' '));
var C = i.getCompStyle(this.targetElement);
(parseFloat(C['min-width']) || 0) < this.previewSize &&
i.setStyle(
this.targetElement,
{ 'min-width': this.previewSize + 'px' },
this.forceStyle,
);
}
if (
(void 0 === this.valueElement
? i.isTextInput(this.targetElement) &&
(this.valueElement = this.targetElement)
: null === this.valueElement ||
(this.valueElement = i.node(this.valueElement)),
this.alphaElement && (this.alphaElement = i.node(this.alphaElement)),
void 0 === this.previewElement
? (this.previewElement = this.targetElement)
: null === this.previewElement ||
(this.previewElement = i.node(this.previewElement)),
this.valueElement && i.isTextInput(this.valueElement))
) {
var y = { onInput: this.valueElement.oninput };
(this.valueElement.oninput = null),
this.valueElement.addEventListener(
'keydown',
function (e) {
'Enter' === i.eventKey(e) &&
(n.valueElement && n.processValueInput(n.valueElement.value),
n.tryHide());
},
!1,
),
this.valueElement.addEventListener(
'change',
function (e) {
if (!i.getData(e, 'internal')) {
var t = n.valueElement.value;
n.processValueInput(n.valueElement.value),
i.triggerCallback(n, 'onChange'),
n.valueElement.value !== t &&
i.triggerInputEvent(n.valueElement, 'change', !0, !0);
}
},
!1,
),
this.valueElement.addEventListener(
'input',
function (e) {
i.getData(e, 'internal') ||
(n.valueElement &&
n.fromString(n.valueElement.value, i.flags.leaveValue),
i.triggerCallback(n, 'onInput'));
},
!1,
),
y.onInput && this.valueElement.addEventListener('input', y.onInput, !1),
this.valueElement.setAttribute('autocomplete', 'off'),
this.valueElement.setAttribute('autocorrect', 'off'),
this.valueElement.setAttribute('autocapitalize', 'off'),
this.valueElement.setAttribute('spellcheck', !1);
}
this.alphaElement &&
i.isTextInput(this.alphaElement) &&
(this.alphaElement.addEventListener(
'keydown',
function (e) {
'Enter' === i.eventKey(e) &&
(n.alphaElement && n.processAlphaInput(n.alphaElement.value),
n.tryHide());
},
!1,
),
this.alphaElement.addEventListener(
'change',
function (e) {
if (!i.getData(e, 'internal')) {
var t = n.alphaElement.value;
n.processAlphaInput(n.alphaElement.value),
i.triggerCallback(n, 'onChange'),
i.triggerInputEvent(n.valueElement, 'change', !0, !0),
n.alphaElement.value !== t &&
i.triggerInputEvent(n.alphaElement, 'change', !0, !0);
}
},
!1,
),
this.alphaElement.addEventListener(
'input',
function (e) {
i.getData(e, 'internal') ||
(n.alphaElement &&
n.fromHSVA(
null,
null,
null,
parseFloat(n.alphaElement.value),
i.flags.leaveAlpha,
),
i.triggerCallback(n, 'onInput'),
i.triggerInputEvent(n.valueElement, 'input', !0, !0));
},
!1,
),
this.alphaElement.setAttribute('autocomplete', 'off'),
this.alphaElement.setAttribute('autocorrect', 'off'),
this.alphaElement.setAttribute('autocapitalize', 'off'),
this.alphaElement.setAttribute('spellcheck', !1));
var b = 'FFFFFF';
void 0 !== this.value
? (b = this.value)
: this.valueElement &&
void 0 !== this.valueElement.value &&
(b = this.valueElement.value);
var k = void 0;
if (
(void 0 !== this.alpha
? (k = '' + this.alpha)
: this.alphaElement &&
void 0 !== this.alphaElement.value &&
(k = this.alphaElement.value),
(this._currentFormat = null),
['auto', 'any'].indexOf(this.format.toLowerCase()) > -1)
) {
var G = i.parseColorString(b);
this._currentFormat = G ? G.format : 'hex';
} else this._currentFormat = this.format.toLowerCase();
this.processValueInput(b), void 0 !== k && this.processAlphaInput(k);
},
}).pub.className = 'jscolor'),
(i.pub.activeClassName = 'jscolor-active'),
(i.pub.looseJSON = !0),
(i.pub.presets = {}),
(i.pub.presets.default = {}),
(i.pub.presets.light = {
backgroundColor: 'rgba(255,255,255,1)',
controlBorderColor: 'rgba(187,187,187,1)',
buttonColor: 'rgba(0,0,0,1)',
}),
(i.pub.presets.dark = {
backgroundColor: 'rgba(51,51,51,1)',
controlBorderColor: 'rgba(153,153,153,1)',
buttonColor: 'rgba(240,240,240,1)',
}),
(i.pub.presets.small = {
width: 101,
height: 101,
padding: 10,
sliderSize: 14,
paletteCols: 8,
}),
(i.pub.presets.medium = {
width: 181,
height: 101,
padding: 12,
sliderSize: 16,
paletteCols: 10,
}),
(i.pub.presets.large = {
width: 271,
height: 151,
padding: 12,
sliderSize: 24,
paletteCols: 15,
}),
(i.pub.presets.thin = {
borderWidth: 1,
controlBorderWidth: 1,
pointerBorderWidth: 1,
}),
(i.pub.presets.thick = {
borderWidth: 2,
controlBorderWidth: 2,
pointerBorderWidth: 2,
}),
(i.pub.sliderInnerSpace = 3),
(i.pub.chessboardSize = 8),
(i.pub.chessboardColor1 = '#666666'),
(i.pub.chessboardColor2 = '#999999'),
(i.pub.previewSeparator = ['rgba(255,255,255,.65)', 'rgba(128,128,128,.65)']),
(i.pub.init = function () {
if (!i.initialized)
for (
e.document.addEventListener('mousedown', i.onDocumentMouseDown, !1),
e.document.addEventListener('keyup', i.onDocumentKeyUp, !1),
e.addEventListener('resize', i.onWindowResize, !1),
e.addEventListener('scroll', i.onWindowScroll, !1),
i.pub.install(),
i.initialized = !0;
i.readyQueue.length;
)
i.readyQueue.shift()();
}),
(i.pub.install = function (e) {
var t = !0;
try {
i.installBySelector('[data-jscolor]', e);
} catch (e) {
(t = !1), console.warn(e);
}
if (i.pub.lookupClass)
try {
i.installBySelector(
'input.' + i.pub.lookupClass + ', button.' + i.pub.lookupClass,
e,
);
} catch (e) {}
return t;
}),
(i.pub.ready = function (e) {
return 'function' != typeof e
? (console.warn('Passed value is not a function'), !1)
: (i.initialized ? e() : i.readyQueue.push(e), !0);
}),
(i.pub.trigger = function (e) {
var t = function () {
i.triggerGlobal(e);
};
i.initialized ? t() : i.pub.ready(t);
}),
(i.pub.hide = function () {
i.picker && i.picker.owner && i.picker.owner.hide();
}),
(i.pub.chessboard = function (e) {
return e || (e = 'rgba(0,0,0,0)'), i.genColorPreviewCanvas(e).canvas.toDataURL();
}),
(i.pub.background = function (e) {
var t = [];
t.push(i.genColorPreviewGradient(e));
var o = i.genColorPreviewCanvas();
return (
t.push(["url('" + o.canvas.toDataURL() + "')", 'left top', 'repeat'].join(' ')),
t.join(', ')
);
}),
(i.pub.options = {}),
(i.pub.lookupClass = 'jscolor'),
(i.pub.installByClassName = function () {
return (
console.error(
'jscolor.installByClassName() is DEPRECATED. Use data-jscolor="" attribute instead of a class name.' +
i.docsRef,
),
!1
);
}),
i.register(),
i.pub);
return void 0 === e.jscolor && (e.jscolor = e.JSColor = a), a;
});
},
},
t = {};
function o(n) {
var i = t[n];
if (void 0 !== i) return i.exports;
var a = (t[n] = { exports: {} });
return e[n].call(a.exports, a, a.exports, o), a.exports;
}
(o.n = (e) => {
var t = e && e.__esModule ? () => e.default : () => e;
return o.d(t, { a: t }), t;
}),
(o.d = (e, t) => {
for (var n in t)
o.o(t, n) && !o.o(e, n) && Object.defineProperty(e, n, { enumerable: !0, get: t[n] });
}),
(o.o = (e, t) => Object.prototype.hasOwnProperty.call(e, t)),
(() => {
'use strict';
let e = {};
function t() {
e.WrinklerButtons && Game.elderWrath
? ((l('PopAllNormalWrinklerButton').style.display = ''),
(l('PopFattestWrinklerButton').style.display = ''))
: ((l('PopAllNormalWrinklerButton').style.display = 'none'),
(l('PopFattestWrinklerButton').style.display = 'none'));
}
const n = ['', '', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y'],
i = [
'',
'',
'M',
'B',
'Tr',
'Quadr',
'Quint',
'Sext',
'Sept',
'Oct',
'Non',
'Dec',
'Undec',
'Duodec',
'Tredec',
'Quattuordec',
'Quindec',
'Sexdec',
'Septendec',
'Octodec',
'Novemdec',
'Vigint',
'Unvigint',
'Duovigint',
'Trevigint',
'Quattuorvigint',
],
a = [
'',
'K',
'M',
'B',
'T',
'Qa',
'Qi',
'Sx',
'Sp',
'Oc',
'No',
'De',
'UDe',
'DDe',
'TDe',
'QaDe',
'QiDe',
'SxDe',
'SpDe',
'ODe',
'NDe',
'Vi',
'UVi',
'DVi',
'TVi',
'QaVi',
'QiVi',
'SxVi',
'SpVi',
'OVi',
'NVi',
'Tr',
'UTr',
'DTr',
'TTr',
'QaTr',
'QiTr',
'SxTr',
'SpTr',
'OTr',
'NTr',
'Qaa',
'UQa',
'DQa',
'TQa',
'QaQa',
'QiQa',
'SxQa',
'SpQa',
'OQa',
'NQa',
'Qia',
'UQi',
'DQi',
'TQi',
'QaQi',
'QiQi',
'SxQi',
'SpQi',
'OQi',
'NQi',
'Sxa',
'USx',
'DSx',
'TSx',
'QaSx',
'QiSx',
'SxSx',
'SpSx',
'OSx',
'NSx',
'Spa',
'USp',
'DSp',
'TSp',
'QaSp',
'QiSp',
'SxSp',
'SpSp',
'OSp',
'NSp',
'Oco',
'UOc',
'DOc',
'TOc',
'QaOc',
'QiOc',
'SxOc',
'SpOc',
'OOc',
'NOc',
'Noa',
'UNo',
'DNo',
'TNo',
'QaNo',
'QiNo',
'SxNo',
'SpNo',
'ONo',
'NNo',
'Ct',
'UCt',
];
let r,
s,
c,
d,
p,
u,
m,
h,
g,
f,
C,
y,
b,
k,
G,
v,
w = [],
x = [],
T = [],
M = {},
S = Date.now(),
B = Date.now();
function P(t, o, r) {
const l = e.ScaleDecimals + 1;
if (t === 1 / 0) return 'Infinity';
if (void 0 === t) return '0';
if (0 === e.Scale) return M.Beautify(t, o);
if (Number.isFinite(t)) {
if (t < 0) return `-${P(Math.abs(t))}`;
let s = '';
if (0 === t) return t.toString();
if (t > 0.001 && t < e.ScaleCutoff)
return (s = e.ScaleSeparator ? t.toLocaleString('nl') : t.toLocaleString('en')), s;
if ((4 === e.Scale && !r) || 4 === r) s = t.toExponential(l).toString().replace('e', 'E');
else {
const o = t.toExponential().toString(),
c = Math.floor(o.slice(o.indexOf('e') + 1) / 3);
(s = (t / Number('1e' + 3 * c)).toFixed(l)),
(1 === e.Scale && !r) || 1 === r
? t >= 0.01 && t < Number('1e' + 3 * n.length)
? (s += ` ${n[c]}`)
: (s = P(t, 0, 4))
: (2 === e.Scale && !r) || 2 === r
? t >= 0.01 && t < Number('1e' + 3 * i.length)
? (s += ` ${i[c]}`)
: (s = P(t, 0, 4))
: (3 === e.Scale && !r) || 3 === r
? t >= 0.01 && t < Number('1e' + 3 * a.length)
? (s += ` ${a[c]}`)
: (s = P(t, 0, 4))
: ((5 === e.Scale && !r) || 5 === r) && (s += 'E' + 3 * c);
}
return (
'' === s &&
(console.log(`Could not beautify number with Cookie Monster Beautify: ${t}`),
(s = M.Beautify(t, o))),
e.ScaleSeparator && (s = s.replace('.', ',')),
s
);
}
return (
console.log(`Could not beautify number with Cookie Monster Beautify: ${t}`),
M.Beautify(t, o)
);
}
let E,
N,
O,
F,
L,
W,
A,
j,
D,
H,
U,
$,
R,
I,
z,
V,
_,
Q,
X,
q,
Y,
K,
J,
Z,
ee,
te,
oe,
ne,
ie,
ae,
re,
le,
se,
ce,
de,
pe,
ue,
me = 0,
he = 0,
ge = 0,
fe = 0,
Ce = 0,
ye = 0,
be = 0,
ke = 0,
Ge = 0,
ve = 0,
we = 0,
xe = 0,
Te = 0,
Me = 0,
Se = 0,
Be = 1,
Pe = 1,
Ee = 1,
Ne = 0,
Oe = 0,
Fe = 0,
Le = 0,
We = {},
Ae = {},
je = {},
De = {},
He = 0,
Ue = 0,
$e = [0, null],
Re = 0,
Ie = 0,
ze = {},
Ve = {},
_e = {},
Qe = {},
Xe = {},
qe = 0,
Ye = 0,
Ke = [],
Je = 0,
Ze = 0,
et = [],
tt = 0,
ot = 0,
nt = [],
it = 0,
at = 0,
rt = [],
lt = 0,
st = 0,
ct = {},
dt = {},
pt = 0,
ut = 0,
mt = [],
ht = {},
gt = 0,
ft = {
0: [0, 0, 0],
1: [0, 0, 0],
2: [0, 0, 0],
3: [0, 0, 0],
4: [0, 0, 0],
5: [0, 0, 0],
6: [0, 0, 0],
7: [0, 0, 0],
8: [0, 0, 0],
9: [0, 0, 0],
10: [0, 0, 0],
},
Ct = [],
yt = [],
bt = [];
function kt(e) {
let t = 0;
return (
(Game.dragonAuras[ne].name !== e && Game.dragonAuras[ie].name !== e) || (t = 1),
('Reality Bending' !== Game.dragonAuras[ne].name &&
'Reality Bending' !== Game.dragonAuras[ie].name) ||
(t += 0.1),
t
);
}
function Gt() {
let e = 0.25;
return (e *= 1 + kt('Earth Shatterer')), e;
}
function vt(e, t) {
return void 0 === ce[e] ? (void 0 === t ? 1 : t) : ce[e];
}
function wt(e) {
const t = yt[e];
return (1 !== Game.ascensionMode || ('prestige' !== t.pool && 'fortune' !== t.tier)) && t
? t.bought
: 0;
}
function xt(e) {
if (Game.hasGod) {
void 0 === Ct.Temple.minigame && (Ct.Temple.minigame = Game.Objects.Temple.minigame);
const t = Ct.Temple.minigame.gods[e];
if (ae === t.id) return 1;
if (re === t.id) return 2;
if (le === t.id) return 3;
}
return !1;
}
function Tt(e, t) {
let o = t;
if (
(wt('Season savings') && (o *= 0.99),
wt("Santa's dominion") && (o *= 0.99),
wt('Faberge egg') && (o *= 0.99),
wt('Divine discount') && (o *= 0.99),
wt('Fortune #100') && (o *= 0.99),
(o *= 1 - 0.02 * kt('Fierce Hoarder')),
Game.hasBuff('Everything must go') && (o *= 0.95),
Game.hasBuff('Crafty pixies') && (o *= 0.98),
Game.hasBuff('Nasty goblins') && (o *= 1.02),
e.fortune && wt(e.fortune.name) && (o *= 0.93),
(o *= vt('buildingCost')),
Ct.Temple.minigameLoaded)
) {
const e = xt('creation');
1 === e ? (o *= 0.93) : 2 === e ? (o *= 0.95) : 3 === e && (o *= 0.98);
}
return o;
}
function Mt(e, t, o, n, i, a) {
const r = void 0 === a ? 0 : a;
let l = i,
s = o,
c = 0;
-1 === i && (l = s), i || (l = Game.buyBulk);
for (let o = 0; o < l; o++) {
let o = t * Game.priceIncrease ** Math.max(0, s - n);
(o = r ? Game.modifyBuildingPrice(e, o) : Tt(e, o)), (o = Math.ceil(o));
const i = r ? e.getSellMultiplier() : Gt();
(o = Math.floor(o * i)), s > 0 && ((c += o), (s -= 1));
}
return c;
}
const St = 'CMText',
Bt = 'CMBack',
Pt = 'Blue',
Et = 'Green',
Nt = 'Yellow',
Ot = 'Orange',
Ft = 'Red',
Lt = 'Purple',
Wt = 'Gray',
At = 'Pink',
jt = 'Brown',
Dt = [Wt, Pt, Et, Nt, Ot, Ft, Lt, At, jt],
Ht = [
['GoldCookTooltipPlaceholder', 'Calculated with Golden Switch off', '200px'],
[
'GoldCookDragonsFortuneTooltipPlaceholder',
'Calculated with Golden Switch off and at least one golden cookie on-screen',
'240px',
],
[
'PrestMaxTooltipPlaceholder',
'The MAX prestige is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg',
'320px',
],
[
'NextPrestTooltipPlaceholder',
'Calculated with cookies gained from wrinklers and Chocolate egg',
'200px',
],
[
'HeavenChipMaxTooltipPlaceholder',
'The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg',
'330px',
],
[
'ResetTooltipPlaceholder',
'The bonus income you would get from new prestige levels unlocked at 100% of its potential and from ascension achievements if you have the same buildings/upgrades after reset',
'370px',
],
[
'ChoEggTooltipPlaceholder',
'The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg',
'300px',
],
['ChainNextLevelPlaceholder', 'Cheated cookies might break this formula', '250px'],
[
'FavouriteSettingPlaceholder',
"Click to set this setting as favourite and show it in 'favourite' settings at the top of the Cookie Monster Settings",
'250px',
],
],
Ut = {};
let $t,
Rt = 0,
It = -1,
zt = [],
Vt = function () {},
_t = 1,
Qt = 1,
Xt = 1;
const qt = [10, 15, 30, 60, 300, 600, 900, 1800],
Yt = [1, 5, 10, 15, 30],
Kt = {
Frenzy: Nt,
'Dragon Harvest': jt,
'Elder frenzy': Et,
Clot: Ft,
'Click frenzy': Pt,
Dragonflight: At,
};
let Jt,
Zt,
eo,
to,
oo,
no,
io,
ao = {},
ro = '',
lo = [];
function so() {
let t = Game.buyBulk;
if (
(1 === Game.buyMode ? (Qt = t) : (t = Qt),
1 === t ? (t = We) : 10 === t ? (t = Ae) : 100 === t && (t = je),
1 === Game.buyMode
? 1 === e.BuildColour
? Object.keys(t).forEach((o) => {
l(`productPrice${Game.Objects[o].id}`).style.color = e[`Colour${t[o].color}`];
})
: Object.keys(Game.Objects).forEach((e) => {
l(`productPrice${Game.Objects[e].id}`).style.removeProperty('color');
})
: -1 === Game.buyMode &&
Object.keys(We).forEach((e) => {
const t = Game.Objects[e];
(l(`productPrice${t.id}`).style.color = ''),
(l(`productPrice${t.id}`).innerHTML = P(
Mt(t, t.basePrice, t.amount, t.free, Game.buyBulk, 1),
));
}),
1 === Game.buyMode && e.SortBuildings)
) {
let o;
1 === e.SortBuildings
? ((o = Object.keys(We).map((e) => {
const t = We[e];
return (t.name = e), (t.id = Game.Objects[e].id), t;
})),
o.sort((e, t) =>
Dt.indexOf(e.color) > Dt.indexOf(t.color)
? 1
: Dt.indexOf(e.color) < Dt.indexOf(t.color) || e.pp < t.pp
? -1
: 0,
))
: 2 === e.SortBuildings &&
((o = Object.keys(t).map((e) => {
const o = t[e];
return (o.name = e), (o.id = Game.Objects[e].id), o;
})),
o.sort((e, t) =>
Dt.indexOf(e.color) > Dt.indexOf(t.color)
? 1
: Dt.indexOf(e.color) < Dt.indexOf(t.color) || e.pp < t.pp
? -1
: 0,
));
for (let e = 0; e < o.length; e++)
Game.Objects[o[e].name].l.style.gridRow = `${e + 2}/${e + 2}`;
} else {
const e = Object.keys(We).map((e) => {
const t = We[e];
return (t.name = e), (t.id = Game.Objects[e].id), t;
});
e.sort((e, t) => e.id - t.id);
for (let t = 0; t < e.length; t++)
Game.Objects[e[t].name].l.style.gridRow = `${t + 2}/${t + 2}`;
}
}
function co() {
Object.values(document.getElementsByClassName('storeSection')).forEach((t) => {
e.UpgradesNeverCollapse || 'products' === t.id
? (t.style.height = 'auto')
: 'vaultUpgrades' === t.id
? ((t.style.height = ''), (t.style.minHeight = '0px'))
: 'upgrades' === t.id
? ((t.style.height = ''),
t.className.includes('hasMenu')
? (t.style.minHeight = '82px')
: (t.style.minHeight = '60px'))
: ((t.style.height = ''), (t.style.minHeight = '60px'));
});
}
function po() {
if (e.UpBarColour > 0) {
let e = 0,
t = 0,
o = 0,
n = 0,
i = 0,
a = 0,
r = 0;
Object.keys(Game.UpgradesInStore).forEach((s) => {
const c = Game.UpgradesInStore[s];
let d = !1;
for (let e = 0; e < l(`upgrade${s}`).childNodes.length; e += 1)
if (-1 !== l(`upgrade${s}`).childNodes[e].className.indexOf(Bt)) {
(l(`upgrade${s}`).childNodes[e].className = Bt + ze[c.name].color), (d = !0);
break;
}
if (!d) {
const e = document.createElement('div');
(e.style.width = '10px'),
(e.style.height = '10px'),
(e.className = Bt + ze[c.name].color),
l(`upgrade${s}`).appendChild(e);
}
ze[c.name].color === Pt
? (e += 1)
: ze[c.name].color === Et
? (t += 1)
: ze[c.name].color === Nt
? (o += 1)
: ze[c.name].color === Ot
? (n += 1)
: ze[c.name].color === Ft
? (i += 1)
: ze[c.name].color === Lt
? (a += 1)
: ze[c.name].color === Wt && (r += 1);
}),
(l('CMUpgradeBarBlue').textContent = e),
(l('CMUpgradeBarGreen').textContent = t),
(l('CMUpgradeBarYellow').textContent = o),
(l('CMUpgradeBarOrange').textContent = n),
(l('CMUpgradeBarRed').textContent = i),
(l('CMUpgradeBarPurple').textContent = a),
(l('CMUpgradeBarGray').textContent = r);
}
const t = [];
for (let e = 0; e < Game.UpgradesInStore.length; e += 1) {
const o = {};
(o.name = Game.UpgradesInStore[e].name),
(o.price = Game.UpgradesInStore[e].basePrice),
(o.pp = ze[o.name].pp),
t.push(o);
}
e.SortUpgrades
? t.sort((e, t) =>
Dt.indexOf(e.color) > Dt.indexOf(t.color)
? 1
: Dt.indexOf(e.color) < Dt.indexOf(t.color) || e.pp < t.pp
? -1
: 0,
)
: t.sort((e, t) => e.price - t.price);
const o = function (e, t) {
return e.findIndex((e) => e.name === t.name);
};
for (let e = 0; e < Game.UpgradesInStore.length; e += 1)
l(`upgrade${e}`).style.order = o(t, Game.UpgradesInStore[e]) + 1;
}
function uo(t, o) {
let n = t;
if (t === 1 / 0) return t;
if (t < 0) return 'Negative time period';
n = Math.ceil(t);
const i = Math.floor(n / 31536e3),
a = Math.floor((n % 31536e3) / 86400),
r = Math.floor(((n % 31536e3) % 86400) / 3600),
l = Math.floor((((n % 31536e3) % 86400) % 3600) / 60),
s = Math.floor((((n % 31536e3) % 86400) % 3600) % 60);
let c = '';
if (e.TimeFormat) {
if (n > 315576e4) return 'XX:XX:XX:XX:XX';
(c += (i < 10 ? '0' : '') + i + ':'),
(c += (a < 10 ? '0' : '') + a + ':'),
(c += (r < 10 ? '0' : '') + r + ':'),
(c += (l < 10 ? '0' : '') + l + ':'),
(c += (s < 10 ? '0' : '') + s);
} else {
if (n > 7776e5) return o ? 'Over 9000 days!' : '>9000d';
(c += i > 0 ? i + (o ? (1 === i ? ' year' : ' years') : 'y') + ', ' : ''),
(c.length > 0 || a > 0) && (c += a + (o ? (1 === a ? ' day' : ' days') : 'd') + ', '),
(c.length > 0 || r > 0) && (c += r + (o ? (1 === r ? ' hour' : ' hours') : 'h') + ', '),
(c.length > 0 || l > 0) &&
(c += l + (o ? (1 === l ? ' minute' : ' minutes') : 'm') + ', '),
(c += s + (o ? (1 === s ? ' second' : ' seconds') : 's'));
}
return c;
}
function mo(t) {
let o, n;
return (
t <= 0
? ((n = e.TimeFormat ? '00:00:00:00:00' : 'Done!'), (o = Et))
: ((n = uo(t)), (o = t > 300 ? Ft : t > 60 ? Ot : Nt)),
{ text: n, color: o }
);
}
function ho() {
return e.CPSMode
? _
: 0 === e.CalcWrink
? Game.cookiesPs * (1 - Game.cpsSucked)
: 1 === e.CalcWrink
? Game.cookiesPs * (Re + (1 - 0.05 * Ie))
: null !== $e[1] && 2 === e.CalcWrink && 1 === Game.wrinklers[$e[1]].type
? Game.cookiesPs * ((3 * Re) / Ie + (1 - 0.05 * Ie))
: Game.cookiesPs * (Re / Ie + (1 - 0.05 * Ie));
}
function go() {
return 1 === e.CalcWrink ? He : 2 === e.CalcWrink ? $e[0] : 0;
}
function fo(e, t, o) {
const n = document.createElement('div');
(n.id = e),
(n.style.height = '12px'),
(n.style.margin = '0px 10px'),
(n.style.position = 'relative');
const i = document.createElement('div');
(i.style.width = '100%'),
(i.style.height = '10px'),
(i.style.margin = 'auto'),
(i.style.position = 'absolute'),
(i.style.left = '0px'),
(i.style.top = '0px'),
(i.style.right = '0px'),
(i.style.bottom = '0px');
const a = document.createElement('span');
(a.style.display = 'inline-block'),
(a.style.textAlign = 'right'),
(a.style.fontSize = '10px'),
(a.style.width = '108px'),
(a.style.marginRight = '5px'),
(a.style.verticalAlign = 'text-top'),
(a.textContent = t),
i.appendChild(a);
for (let e = 0; e < o.length; e++) {
const t = document.createElement('span');
(t.id = o[e].id),
(t.style.display = 'inline-block'),
(t.style.height = '10px'),
(t.style.verticalAlign = 'text-top'),
(t.style.textAlign = 'center'),
o.length - 1 === e &&
((t.style.borderTopRightRadius = '10px'), (t.style.borderBottomRightRadius = '10px')),
void 0 !== o[e].color && (t.className = Bt + o[e].color),
i.appendChild(t);
}
const r = document.createElement('span');
return (
(r.id = `${e}Time`),
(r.style.marginLeft = '5px'),
(r.style.verticalAlign = 'text-top'),
i.appendChild(r),
n.appendChild(i),
n
);
}
function Co(e) {
if (null !== l('CMBotBar')) {
const t = l('CMBotBar').firstChild.firstChild.childNodes[0],
o = l('CMBotBar').firstChild.firstChild.childNodes[1],
n = l('CMBotBar').firstChild.firstChild.childNodes[2],
i = l('CMBotBar').firstChild.firstChild.childNodes[3],
a = e,
r = t.appendChild(document.createElement('td'));
r.appendChild(
document.createTextNode(
`${-1 !== a.indexOf(' ') ? a.substring(0, a.indexOf(' ')) : a} (`,
),
),
(r.appendChild(document.createElement('span')).className = 'CMTextBlue'),
r.appendChild(document.createTextNode(')')),
(t.lastChild.style.paddingLeft = '8px'),
o.appendChild(document.createElement('td')),
(o.lastChild.style.paddingLeft = '8px'),
n.appendChild(document.createElement('td')),
(n.lastChild.style.paddingLeft = '8px'),
i.appendChild(document.createElement('td')),
(i.lastChild.style.paddingLeft = '2px');
}
}
function yo() {
if (1 === e.BotBar && We && 1 === Game.buyMode) {
let t = 0;
Object.keys(We).forEach((o) => {
let n,
i = Game.buyBulk;
1 === Game.buyMode ? (_t = i) : (i = _t),
1 === i && (i = We),
10 === i && (i = Ae),
100 === i && (i = je),
(t += 1),
(l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[
t
].childNodes[1].textContent = Game.Objects[o].amount),
(l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[t].textContent = P(
i[o].bonus,
2,
)),
(l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[t].className =
St + i[o].color),
(n = e.PPDisplayTime ? uo(Math.round(i[o].pp)) : P(Math.round(i[o].pp), 2)),
(l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[t].textContent = n);
const a = mo((Game.Objects[o].bulkPrice - (Game.cookies + go())) / ho());
(l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[t].className =
St + a.color),
'Done!' === a.text && Game.cookies < Game.Objects[o].bulkPrice
? (l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
t
].textContent = `${a.text} (with Wrink)`)
: (l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[t].textContent =
a.text);
});
}
}
function bo() {
(Game.Background.canvas.width = Game.Background.canvas.parentNode.offsetWidth),
(Game.Background.canvas.height = Game.Background.canvas.parentNode.offsetHeight),
(Game.LeftBackground.canvas.width = Game.LeftBackground.canvas.parentNode.offsetWidth),
(Game.LeftBackground.canvas.height = Game.LeftBackground.canvas.parentNode.offsetHeight),
Game.DrawBackground();
}
function ko() {
1 === e.BotBar && 1 === e.TimerBar && 1 === e.TimerBarPos
? ((l('CMBotBar').style.bottom = l('CMTimerBar').style.height),
(l('game').style.bottom = `${
Number(l('CMTimerBar').style.height.replace('px', '')) + 70
}px`))
: 1 === e.BotBar
? ((l('CMBotBar').style.bottom = '0px'), (l('game').style.bottom = '70px'))
: 1 === e.TimerBar && 1 === e.TimerBarPos
? (l('game').style.bottom = l('CMTimerBar').style.height)
: (l('game').style.bottom = '0px'),
1 === e.TimerBar && 0 === e.TimerBarPos
? (l('sectionLeft').style.top = l('CMTimerBar').style.height)
: (l('sectionLeft').style.top = ''),
bo();
}
function Go() {
1 === e.TimerBar
? (l('CMTimerBar').style.display = '')
: (l('CMTimerBar').style.display = 'none'),
ko();
}
function vo() {
(me = Game.dragonAura), (he = Game.dragonAura2);
}
function wo(e) {
const t = Game.Achievements[e],
o = {};
return (o.name = t.name), o;
}
function xo(e) {
let t = 1;
if (
(Object.keys(e.tieredUpgrades).forEach((o) => {
!Game.Tiers[e.tieredUpgrades[o].tier].special &&
wt(e.tieredUpgrades[o].name) &&
(t *= 2);
}),
Object.keys(e.synergies).forEach((o) => {
if (wt(e.synergies[o].name)) {
const n = e.synergies[o];
n.buildingTie1.name === e.name
? (t *= 1 + 0.05 * n.buildingTie2.amount)
: n.buildingTie2.name === e.name && (t *= 1 + 0.001 * n.buildingTie1.amount);
}
}),
e.fortune && wt(e.fortune.name) && (t *= 1.07),
e.grandma && wt(e.grandma.name) && (t *= 1 + 0.01 * Ct.Grandma.amount * (1 / (e.id - 1))),
'object' == typeof e.tieredUpgrades.misfortune &&
1 === e.vanilla &&
wt(e.tieredUpgrades.misfortune.name))
)
switch (Game.elderWrath) {
default:
t *= 1;
break;
case 1:
t *= 1.02;
break;
case 2:
t *= 1.04;
break;
case 3:
t *= 1.06;
}
return t;
}
function To(e) {
const t = Game.Objects[e],
o = {};
return (
'Cursor' === t.name
? (o.cps = function (e) {
let t = 0;
wt('Thousand fingers') && (t += 0.1),
wt('Million fingers') && (t *= 5),
wt('Billion fingers') && (t *= 10),
wt('Trillion fingers') && (t *= 20),
wt('Quadrillion fingers') && (t *= 20),
wt('Quintillion fingers') && (t *= 20),
wt('Sextillion fingers') && (t *= 20),
wt('Septillion fingers') && (t *= 20),
wt('Octillion fingers') && (t *= 20),
wt('Nonillion fingers') && (t *= 20);
let o = 1,
n = 0;
return (
Object.keys(Ct).forEach((e) => {
'Cursor' !== Ct[e].name && (n += Ct[e].amount);
}),
(t *= n),
(o *= xo(e)),
(o *= Game.magicCpS('Cursor')),
(o *= vt('cursorCps')),
Game.ComputeCps(
0.1,
wt('Reinforced index finger') +
wt('Carpal tunnel prevention cream') +
wt('Ambidextrous'),
t,
) * o
);
})
: 'Grandma' === t.name
? (o.cps = function (e) {
let o = 1;
if (
(Object.keys(Game.GrandmaSynergies).forEach((e) => {
wt(Game.GrandmaSynergies[e]) && (o *= 2);
}),
wt('Bingo center/Research facility') && (o *= 4),
wt('Ritual rolling pins') && (o *= 2),
wt('Naughty list') && (o *= 2),
wt('Elderwort biscuits') && (o *= 1.02),
(o *= vt('grandmaCps')),
wt('Cat ladies'))
)
for (let e = 0; e < Game.UpgradesByPool.kitten.length; e++)
wt(Game.UpgradesByPool.kitten[e].name) && (o *= 1.29);
o *= xo(e);
let n = 0;
wt('One mind') && (n += 0.02 * Ct.Grandma.amount),
wt('Communal brainsweep') && (n += 0.02 * Ct.Grandma.amount),
wt('Elder Pact') && (n += 0.05 * Ct.Portal.amount);
let i = 0;
return (
Object.keys(Ct).forEach((e) => {
'Grandma' !== Ct[e].name && (i += Ct[e].amount);
}),
(o *= 1 + 0.01 * kt('Elder Battalion') * i),
(o *= Game.magicCpS(t.name)),
(t.baseCps + n) * o
);
})
: (o.cps = function (e) {
let t = 1;
return (t *= xo(e)), (t *= Game.magicCpS(e.name)), e.baseCPS * t;
}),
(o.baseCps = t.baseCps),
(o.name = t.name),
(o.tieredUpgrades = t.tieredUpgrades),
(o.synergies = t.synergies),
(o.fortune = t.fortune),
(o.grandma = t.grandma),
(o.baseCPS = t.baseCps),
(o.id = t.id),
(o.vanilla = t.vanilla),
o
);
}
function Mo(e) {
const t = Game.Upgrades[e],
o = {};
return (
(o.power = t.power),
'function' == typeof o.power &&
('Sugar crystal cookies' === t.name
? (o.power = function () {
let e = 5;
return (
Object.keys(Ct).forEach((t) => {
Ct[t].level >= 10 && (e += 1);
}),
e
);
})
: (o.power = function () {
let e = 2;
if ((wt('Starlove') && (e = 3), Game.hasGod)) {
const t = xt('seasons');
1 === t ? (e *= 1.3) : 2 === t ? (e *= 1.2) : 3 === t && (e *= 1.1);
}
return e;
})),
(o.pool = t.pool),
(o.name = t.name),
o
);
}
function So() {
(J = Game.UpgradesOwned),
(Z = Game.pledges),
(ee = Game.AchievementsOwned),
(te = Game.heavenlyPower),
(oe = Game.prestige),
Object.keys(Game.Objects).forEach((e) => {
const t = Game.Objects[e];
let o = Ct[e];
void 0 === o && ((Ct[e] = To(e)), (o = Ct[e]), Co(e)),
(o.amount = t.amount),
(o.level = t.level),
(o.totalCookies = t.totalCookies),
(o.basePrice = t.basePrice),
(o.free = t.free),
t.minigameLoaded &&
('Temple' === t.name &&
((ae = t.minigame.slot[0]), (re = t.minigame.slot[1]), (le = t.minigame.slot[2])),
(o.minigameLoaded = t.minigameLoaded),
(o.minigame = t.minigame)),
(Ct[e] = o);
}),
Object.keys(Game.Upgrades).forEach((e) => {
const t = Game.Upgrades[e];
let o = yt[e];
void 0 === o && ((yt[e] = Mo(e)), (o = yt[e])), (o.bought = t.bought), (yt[e] = o);
}),
Object.keys(Game.Achievements).forEach((e) => {
const t = Game.Achievements[e];
let o = bt[e];
void 0 === o && ((bt[e] = wo(e)), (o = bt[e])), (o.won = t.won), (bt[e] = o);
}),
vo(),
(ne = me),
(ie = he);
}
function Bo(e) {
const t = document.createElement('div');
return (
(t.style.fontWeight = 'bold'),
(t.id = `${e}Title`),
(t.className = 'CMTextBlue'),
(t.textContent = e),
t
);
}
function Po(e) {
e.appendChild(Bo('Bonus Income'));
const t = document.createElement('div');
(t.style.marginBottom = '4px'),
(t.style.color = 'white'),
(t.id = 'CMTooltipIncome'),
e.appendChild(t),
e.appendChild(Bo('Bonus Cookies per Click')),
(e.lastChild.style.display = 'none');
const o = document.createElement('div');
(o.style.marginBottom = '4px'),
(o.style.color = 'white'),
(o.style.display = 'none'),
(o.id = 'CMTooltipCookiePerClick'),
e.appendChild(o),
e.appendChild(Bo('Payback Period'));
const n = document.createElement('div');
(n.style.marginBottom = '4px'),
(n.id = 'CMTooltipPP'),
e.appendChild(n),
e.appendChild(Bo('Time Left'));
const i = document.createElement('div');
if (((i.id = 'CMTooltipTime'), e.appendChild(i), 'b' === eo)) {
e.appendChild(Bo('Production left till next achievement')),
(e.lastChild.id = 'CMTooltipProductionLeftHeader');
const t = document.createElement('div');
(t.id = 'CMTooltipProductionLeft'), e.appendChild(t);
}
if ('b' === eo) {
e.appendChild(Bo('Buildings (price / PP) left till next achievement')),
(e.lastChild.id = 'CMTooltipNextAchievementHeader');
const t = document.createElement('div');
(t.id = 'CMTooltipNextAchievement'), e.appendChild(t);
}
}
function Eo(t, o) {
let n = '';
return (
(n =
t.pp <= 0 || t.pp === 1 / 0
? Wt
: t.pp < ut
? Pt
: t.pp === ut
? Et
: t.pp < mt[10][0]
? Nt
: t.pp < mt[20][0]
? Ot
: t.pp < mt[30][0]
? Ft
: Lt),
0 !== Number(e.PPSecondsLowerLimit) &&
o / ho() < Number(e.PPSecondsLowerLimit) &&
(n = Pt),
e.PPOnlyConsiderBuyable && o - Game.cookies > 0 && (n = Ft),
n
);
}
function No() {
let e = 1;
return (
Object.keys(Game.buffs).forEach((t) => {
void 0 !== Game.buffs[t].multCpS && (e *= Game.buffs[t].multCpS);
}),
e
);
}
function Oo(e) {
bt[e] &&
0 === bt[e].won &&
((bt[e].won = 1), 'shadow' !== Game.Achievements[e].pool && (ee += 1));
}
function Fo() {
de = 0;
let e = 1;
const t = {};
Object.keys(Game.Objects).forEach((e) => {
if (Game.Objects[e].minigameLoaded && Game.Objects[e].minigame.effs) {
const o = Game.Objects[e].minigame.effs;
Object.keys(o).forEach((e) => {
t[e] ? (t[e] *= o[e]) : (t[e] = o[e]);
});
}
}),
(ce = t),
1 !== Game.ascensionMode &&
(e +=
0.01 *
parseFloat(oe) *
te *
(function () {
let e = 0;
if (
(wt('Heavenly chip secret') && (e += 0.05),
wt('Heavenly cookie stand') && (e += 0.2),
wt('Heavenly bakery') && (e += 0.25),
wt('Heavenly confectionery') && (e += 0.25),
wt('Heavenly key') && (e += 0.25),
(e *= 1 + 0.05 * kt('Dragon God')),
wt('Lucky digit') && (e *= 1.01),
wt('Lucky number') && (e *= 1.01),
wt('Lucky payout') && (e *= 1.01),
Game.hasGod)
) {
const t = xt('creation');
1 === t ? (e *= 0.7) : 2 === t ? (e *= 0.8) : 3 === t && (e *= 0.9);
}
return e;
})()),
(e *= vt('cps')),
wt('Heralds') && 1 !== Game.ascensionMode && (e *= 1 + 0.01 * Game.heralds),
Object.keys(Game.cookieUpgrades).forEach((t) => {
const o = Game.cookieUpgrades[t];
wt(o.name) &&
('function' == typeof o.power
? (e *= 1 + 0.01 * yt[o.name].power(yt[o.name]))
: (e *= 1 + 0.01 * o.power));
}),
wt('Specialized chocolate chips') && (e *= 1.01),
wt('Designer cocoa beans') && (e *= 1.02),
wt('Underworld ovens') && (e *= 1.03),
wt('Exotic nuts') && (e *= 1.04),
wt('Arcane sugar') && (e *= 1.05),
wt('Increased merriness') && (e *= 1.15),
wt('Improved jolliness') && (e *= 1.15),
wt('A lump of coal') && (e *= 1.01),
wt('An itchy sweater') && (e *= 1.01),
wt("Santa's dominion") && (e *= 1.2),
wt('Fortune #100') && (e *= 1.01),
wt('Fortune #101') && (e *= 1.07),
wt('Dragon scale') && (e *= 1.03);
let o = 1;
if (xt) {
let t = xt('asceticism');
1 === t ? (e *= 1.15) : 2 === t ? (e *= 1.1) : 3 === t && (e *= 1.05),
(t = xt('ages')),
1 === t
? (e *= 1 + 0.15 * Math.sin((S / 1e3 / 10800) * Math.PI * 2))
: 2 === t
? (e *= 1 + 0.15 * Math.sin((S / 1e3 / 43200) * Math.PI * 2))
: 3 === t && (e *= 1 + 0.15 * Math.sin((S / 1e3 / 86400) * Math.PI * 2)),
(t = xt('decadence')),
1 === t ? (o *= 0.93) : 2 === t ? (o *= 0.95) : 3 === t && (o *= 0.98),
(t = xt('industry')),
1 === t ? (o *= 1.1) : 2 === t ? (o *= 1.06) : 3 === t && (o *= 1.03),
(t = xt('labor')),
1 === t ? (o *= 0.97) : 2 === t ? (o *= 0.98) : 3 === t && (o *= 0.99);
}
wt("Santa's legacy") && (e *= 1 + 0.03 * (Game.santaLevel + 1));
const n = ee / 25;
let i = 1;
if (
(wt("Santa's milk and cookies") && (i *= 1.05),
(i *= 1 + 0.05 * kt('Breath of Milk')),
xt)
) {
const e = xt('mother');
1 === e ? (i *= 1.1) : 2 === e ? (i *= 1.05) : 3 === e && (i *= 1.03);
}
i *= vt('milk');
let a = 1;
wt('Kitten helpers') && (a *= 1 + 0.1 * n * i),
wt('Kitten workers') && (a *= 1 + 0.125 * n * i),
wt('Kitten engineers') && (a *= 1 + 0.15 * n * i),
wt('Kitten overseers') && (a *= 1 + 0.175 * n * i),
wt('Kitten managers') && (a *= 1 + 0.2 * n * i),
wt('Kitten accountants') && (a *= 1 + 0.2 * n * i),
wt('Kitten specialists') && (a *= 1 + 0.2 * n * i),
wt('Kitten experts') && (a *= 1 + 0.2 * n * i),
wt('Kitten consultants') && (a *= 1 + 0.2 * n * i),
wt('Kitten assistants to the regional manager') && (a *= 1 + 0.175 * n * i),
wt('Kitten marketeers') && (a *= 1 + 0.15 * n * i),
wt('Kitten analysts') && (a *= 1 + 0.125 * n * i),
wt('Kitten executives') && (a *= 1 + 0.115 * n * i),
wt('Kitten angels') && (a *= 1 + 0.1 * n * i),
wt('Fortune #103') && (a *= 1 + 0.05 * n * i),
Object.keys(Ct).forEach((e) => {
const t = Ct[e];
let a = t.cps(t);
1 !== Game.ascensionMode && (a *= (1 + 0.01 * t.level) * o),
'Grandma' === t.name &&
wt('Milkhelp® lactose intolerance relief tablets') &&
(a *= 1 + 0.05 * n * i),
(de += t.amount * a);
}),
wt('"egg"') && (de += 9),
(e *= a);
let r = 1;
if (
(wt('Chicken egg') && (r *= 1.01),
wt('Duck egg') && (r *= 1.01),
wt('Turkey egg') && (r *= 1.01),
wt('Quail egg') && (r *= 1.01),
wt('Robin egg') && (r *= 1.01),
wt('Ostrich egg') && (r *= 1.01),
wt('Cassowary egg') && (r *= 1.01),
wt('Salmon roe') && (r *= 1.01),
wt('Frogspawn') && (r *= 1.01),
wt('Shark egg') && (r *= 1.01),
wt('Turtle egg') && (r *= 1.01),
wt('Ant larva') && (r *= 1.01),
wt('Century egg'))
) {
let e = (10 * Math.floor((B - Game.startDate) / 1e3 / 10)) / 60 / 60 / 24;
(e = Math.min(e, 100)), (Oe = 1 + 0.1 * (1 - (1 - e / 100) ** 3)), (r *= Oe);
}
(e *= r),
wt('Sugar baking') && (e *= 1 + 0.01 * Math.min(100, Game.lumps)),
(e *= 1 + kt('Radiant Appetite'));
const l = de * e;
Object.keys(Game.CpsAchievements).forEach((e) => {
l >= Game.CpsAchievements[e].threshold && Oo(Game.CpsAchievements[e].name);
}),
(pe = l);
const { n: s } = Game.shimmerTypes.golden,
c = kt("Dragon's Fortune");
for (let t = 0; t < s; t++) e *= 1 + 1.23 * c;
const d = Game.bakeryName.toLowerCase();
if (
('orteil' === d ? (e *= 0.99) : 'ortiel' === d && (e *= 0.98),
wt('Elder Covenant') && (e *= 0.95),
wt('Golden switch [off]'))
) {
let t = 1.5;
if (wt('Residual luck')) {
const e = Game.goldenCookieUpgrades;
Object.keys(e).forEach((o) => {
wt(e[o]) && (t += 0.1);
});
}
e *= t;
}
if (wt('Shimmering veil [off]')) {
let t = 0.5;
wt('Reinforced membrane') && (t += 0.1), (e *= 1 + t);
}
wt('Magic shenanigans') && (e *= 1e3),
wt('Occult obstruction') && (e *= 0),
(de = Game.runModHookOnValue('cps', de)),
(e *= No()),
(de *= e);
}
const Lo = [
'Fortune #001',
'Fortune #002',
'Fortune #003',
'Fortune #004',
'Fortune #005',
'Fortune #006',
'Fortune #007',
'Fortune #008',
'Fortune #009',
'Fortune #010',
'Fortune #011',
'Fortune #012',
'Fortune #013',
'Fortune #014',
'Fortune #015',
'Fortune #016',
'Fortune #017',
'Fortune #018',
'Fortune #100',
'Fortune #101',
'Fortune #102',
'Fortune #103',
'Fortune #104',
],
Wo = [
'Skull cookies',
'Ghost cookies',
'Bat cookies',
'Slime cookies',
'Pumpkin cookies',
'Eyeball cookies',
'Spider cookies',
],
Ao = [
'Christmas tree biscuits',
'Snowflake biscuits',
'Snowman biscuits',
'Holly biscuits',
'Candy cane biscuits',
'Bell biscuits',
'Present biscuits',
],
jo = [
'Pure heart biscuits',
'Ardent heart biscuits',
'Sour heart biscuits',
'Weeping heart biscuits',
'Golden heart biscuits',
'Eternal heart biscuits',
'Prism heart biscuits',
],
Do = [
'Elderwort biscuits',
'Bakeberry cookies',
'Duketater cookies',
'Green yeast digestives',
'Wheat slims',
'Fern tea',
'Ichor syrup',
];
function Ho(e) {
return bt[e] ? bt[e].won : 0;
}
function Uo() {
let e = 0;
Object.keys(Game.GrandmaSynergies).forEach((t) => {
wt(Game.GrandmaSynergies[t]) && (e += 1);
}),
!Ho('Elder') && e >= 7 && Oo('Elder'),
!Ho('Veteran') && e >= 14 && Oo('Veteran');
let t = 0,
o = 1,
n = 1,
i = 1e5;
Object.keys(Ct).forEach((e) => {
(t += Ct[e].amount),
(i = Math.min(Ct[e].amount, i)),
Ho('Mathematician') ||
(Ct[e].amount <
Math.min(128, 2 ** (Game.ObjectsById.length - Game.Objects[e].id - 1)) &&
(o = 0)),
Ho('Base 10') ||
(Ct[e].amount < 10 * (Game.ObjectsById.length - Game.Objects[e].id) && (n = 0));
}),
i >= 1 && Oo('One with everything'),
1 === o && Oo('Mathematician'),
1 === n && Oo('Base 10'),
i >= 100 && Oo('Centennial'),
i >= 150 && Oo('Centennial and a half'),
i >= 200 && Oo('Bicentennial'),
i >= 250 && Oo('Bicentennial and a half'),
i >= 300 && Oo('Tricentennial'),
i >= 350 && Oo('Tricentennial and a half'),
i >= 400 && Oo('Quadricentennial'),
i >= 450 && Oo('Quadricentennial and a half'),
i >= 500 && Oo('Quincentennial'),
i >= 550 && Oo('Quincentennial and a half'),
i >= 600 && Oo('Sexcentennial'),
t >= 100 && Oo('Builder'),
t >= 500 && Oo('Architect'),
t >= 1e3 && Oo('Engineer'),
t >= 2e3 && Oo('Lord of Constructs'),
t >= 4e3 && Oo('Grand design'),
t >= 8e3 && Oo('Ecumenopolis'),
J >= 20 && Oo('Enhancer'),
J >= 50 && Oo('Augmenter'),
J >= 100 && Oo('Upgrader'),
J >= 200 && Oo('Lord of Progress'),
J >= 300 && Oo('The full picture'),
J >= 400 && Oo("When there's nothing left to add"),
t >= 4e3 && J >= 300 && Oo('Polymath'),
t >= 8e3 && J >= 400 && Oo('Renaissance baker'),
Ct.Cursor.amount + Ct.Grandma.amount >= 777 && Oo('The elder scrolls');
let a = !0;
Object.keys(Wo).forEach((e) => {
wt(Wo[e]) || (a = !1);
}),
a && Oo('Spooky cookies');
let r = !0;
if (
(Object.keys(Ao).forEach((e) => {
wt(Ao[e]) || (r = !1);
}),
r && Oo('Let it snow'),
wt('Fortune cookies'))
) {
const e = Game.Tiers.fortune.upgrades;
let t = 0;
Object.keys(e).forEach((o) => {
wt(e[o].name) && (t += 1);
}),
t >= e.length && Oo('O Fortuna');
}
}
function $o(e, t) {
So(), (Ct[e].amount += t);
const o = Ct[e];
'Cursor' === e
? (o.amount >= 1 && Oo('Click'),
o.amount >= 2 && Oo('Double-click'),
o.amount >= 50 && Oo('Mouse wheel'),
o.amount >= 100 && Oo('Of Mice and Men'),
o.amount >= 200 && Oo('The Digital'),
o.amount >= 300 && Oo('Extreme polydactyly'),
o.amount >= 400 && Oo('Dr. T'),
o.amount >= 500 && Oo('Thumbs, phalanges, metacarpals'),
o.amount >= 600 && Oo('With her finger and her thumb'),
o.amount >= 700 && Oo('Gotta hand it to you'),
o.amount >= 800 && Oo("The devil's workshop"))
: Object.keys(Game.Objects[o.name].tieredAchievs).forEach((e) => {
o.amount >= Game.Tiers[Game.Objects[o.name].tieredAchievs[e].tier].achievUnlock &&
Oo(Game.Objects[o.name].tieredAchievs[e].name);
});
const n = ee;
return Fo(), Uo(), n !== ee && Fo(), de - Game.cookiesPs;
}
function Ro(e, t, o) {
let n = e,
i = 0;
for (; n < o; ) (n += 0.002 * Math.max(0.002, (n / Math.max(t, 100)) ** 0.5)), (i += 1);
return i / Game.fps;
}
function Io() {
null !== l('CMDispTooltipWarningParent') &&
(0 === e.ToolWarnPos
? ((l('CMDispTooltipWarningParent').style.top = 'auto'),
(l('CMDispTooltipWarningParent').style.margin = '4px -4px'),
(l('CMDispTooltipWarningParent').style.padding = '3px 4px'))
: ((l('CMDispTooltipWarningParent').style.right = 'auto'),
(l('CMDispTooltipWarningParent').style.margin = '4px'),
(l('CMDispTooltipWarningParent').style.padding = '4px 3px')));
}
function zo() {
if ((So(), 'none' !== l('tooltipAnchor').style.display && l('CMTooltipArea'))) {
l('CMTooltipArea').innerHTML = '';
const t = (function () {
l('tooltip').firstChild.style.paddingBottom = '4px';
const e = document.createElement('div');
return (
(e.style.border = '1px solid'),
(e.style.padding = '4px'),
(e.style.margin = '0px -4px'),
(e.id = 'CMTooltipBorder'),
(e.className = 'CMTextGray'),
e
);
})();
l('CMTooltipArea').appendChild(t),
'b' === eo
? (function () {
if (1 === e.TooltipBuildUpgrade && 1 === Game.buyMode) {
let t;
if (
(Po(l('CMTooltipBorder')),
1 === Game.buyMode ? (Xt = t) : (t = Xt),
1 === Game.buyBulk
? (t = We)
: 10 === Game.buyBulk
? (t = Ae)
: 100 === Game.buyBulk && (t = je),
(Jt = Game.Objects[to].bulkPrice),
(Zt = t[to].bonus),
1 === e.TooltipBuildUpgrade && 1 === Game.buyMode)
) {
l('CMTooltipIncome').textContent = P(Zt, 2);
const o = Math.round((Zt / Game.cookiesPs) * 1e4);
Number.isFinite(o) && 0 !== o
? (l('CMTooltipIncome').textContent += ` (${o / 100}% of income)`)
: (l('CMTooltipIncome').textContent += ` (<0${
e.ScaleSeparator ? ',' : '.'
}01% of income)`),
(l('CMTooltipBorder').className = St + t[to].color),
e.PPDisplayTime
? (l('CMTooltipPP').textContent = uo(t[to].pp))
: (l('CMTooltipPP').textContent = P(t[to].pp, 2)),
(l('CMTooltipPP').className = St + t[to].color);
const n = mo((Jt - (Game.cookies + go())) / ho());
(l('CMTooltipTime').textContent = n.text),
'Done!' === n.text && Game.cookies < t[to].price
? (l('CMTooltipTime').textContent = `${n.text} (with Wrink)`)
: (l('CMTooltipTime').textContent = n.text),
(l('CMTooltipTime').className = St + n.color);
}
(l('CMTooltipProductionLeftHeader').style.display = 'none'),
(l('CMTooltipTime').style.marginBottom = '0px');
for (const e of Object.keys(Game.Objects[to].productionAchievs))
if (!Game.HasAchiev(Game.Objects[to].productionAchievs[e].achiev.name)) {
const t = Game.Objects[to].productionAchievs[e];
(l('CMTooltipTime').style.marginBottom = '4px'),
(l('CMTooltipProductionLeftHeader').style.display = ''),
(l('CMTooltipProductionLeft').className = `ProdAchievement${to}`),
(l('CMTooltipProductionLeft').textContent = P(
t.pow - Ct[to].totalCookies,
15,
)),
(l('CMTooltipProductionLeft').style.color = 'white');
break;
}
const o = De[to];
if (o.AmountNeeded < 101) {
let t;
(l('CMTooltipProductionLeft').style.marginBottom = '4px'),
(l('CMTooltipNextAchievementHeader').style.display = ''),
(t = Game.cookiesPs
? Math.max(o.price - (Game.cookies + go()), 0) / Game.cookiesPs +
o.price / $o(to, o.AmountNeeded)
: o.price / $o(to, o.AmountNeeded)),
(l('CMTooltipNextAchievement').textContent = `${P(o.AmountNeeded)} / ${P(
o.price,
)} / `),
(l('CMTooltipNextAchievement').style.color = 'white');
const n = document.createElement('span');
e.PPDisplayTime ? (n.textContent = uo(t)) : (n.textContent = P(t)),
(n.className = St + Eo({ pp: t }, o.price)),
l('CMTooltipNextAchievement').appendChild(n);
} else
(l('CMTooltipNextAchievementHeader').style.display = 'none'),
(l('CMTooltipProductionLeft').style.marginBottom = '0px');
} else l('CMTooltipArea').style.display = 'none';
})()
: 'u' === eo
? (function () {
if (
(Po(l('CMTooltipBorder')),
(Zt = ze[Game.UpgradesInStore[to].name].bonus),
(Jt = Game.Upgrades[Game.UpgradesInStore[to].name].getPrice()),
(oo = ze[Game.UpgradesInStore[to].name].bonusMouse),
1 === e.TooltipBuildUpgrade)
) {
l('CMTooltipIncome').textContent = P(Zt, 2);
const t = Math.round((Zt / Game.cookiesPs) * 1e4);
'0' !== l('CMTooltipIncome').textContent || ('b' !== eo && 'u' !== eo)
? (Number.isFinite(t) && 0 !== t
? (l('CMTooltipIncome').textContent += ` (${t / 100}% of income)`)
: (l('CMTooltipIncome').textContent += ` (<0${
e.ScaleSeparator ? ',' : '.'
}01% of income)`),
(l('CMTooltipBorder').className =
St + ze[Game.UpgradesInStore[to].name].color),
oo &&
((l('CMTooltipCookiePerClick').textContent = P(oo)),
(l('CMTooltipCookiePerClick').style.display = 'block'),
(l('CMTooltipCookiePerClick').previousSibling.style.display = 'block')),
0 === Zt && oo
? ((l('CMTooltipPP').textContent = `${P(Jt / oo)} Clicks`),
(l('CMTooltipPP').style.color = 'white'))
: (e.PPDisplayTime
? (l('CMTooltipPP').textContent = uo(
ze[Game.UpgradesInStore[to].name].pp,
))
: (l('CMTooltipPP').textContent = P(
ze[Game.UpgradesInStore[to].name].pp,
2,
)),
(l('CMTooltipPP').className =
St + ze[Game.UpgradesInStore[to].name].color)))
: ((l('Bonus IncomeTitle').style.display = 'none'),
(l('CMTooltipIncome').style.display = 'none'),
(l('Payback PeriodTitle').style.display = 'none'),
(l('CMTooltipPP').style.display = 'none'));
const o = mo((Jt - (Game.cookies + go())) / ho());
if (
((l('CMTooltipTime').textContent = o.text),
'Done!' === o.text && Game.cookies < Game.UpgradesInStore[to].getPrice()
? (l('CMTooltipTime').textContent = `${o.text} (with Wrink)`)
: (l('CMTooltipTime').textContent = o.text),
(l('CMTooltipTime').className = St + o.color),
'Chocolate egg' === Game.UpgradesInStore[to].name)
) {
(l('CMTooltipBorder').lastChild.style.marginBottom = '4px'),
l('CMTooltipBorder').appendChild(
Bo('Cookies to be gained (Currently/Max)'),
);
const e = document.createElement('div');
(e.style.color = 'white'),
(e.textContent = `${P(0.05 * Game.cookies)} / ${P(Le)}`),
l('CMTooltipBorder').appendChild(e);
}
} else l('CMTooltipArea').style.display = 'none';
})()
: 's' === eo
? (function () {
if (1 === e.TooltipLump) {
const e = l('CMTooltipBorder');
e.appendChild(Bo('Current Sugar Lump'));
const o = document.createElement('div');
(o.id = 'CMTooltipTime'), e.appendChild(o);
const n =
0 === (t = Game.lumpCurrentType)
? { text: 'Normal', color: Wt }
: 1 === t
? { text: 'Bifurcated', color: Et }
: 2 === t
? { text: 'Golden', color: Nt }
: 3 === t
? { text: 'Meaty', color: Ot }
: 4 === t
? { text: 'Caramelized', color: Lt }
: { text: 'Unknown Sugar Lump', color: Ft };
(o.textContent = n.text), (o.className = St + n.color);
} else l('CMTooltipArea').style.display = 'none';
var t;
})()
: 'g' === eo
? (function () {
const { minigame: t } = Game.Objects['Wizard tower'],
o = t.getSpellCost(t.spellsById[to]);
if (1 === e.TooltipGrim && o <= t.magicM) {
const e = l('CMTooltipBorder');
e.appendChild(Bo('Time Left'));
const n = document.createElement('div');
(n.id = 'CMTooltipTime'), e.appendChild(n);
const i = mo(Ro(t.magic, t.magicM, o));
if (((n.textContent = i.text), (n.className = St + i.color), o <= t.magic)) {
e.appendChild(Bo('Recover Time'));
const n = document.createElement('div');
(n.id = 'CMTooltipRecover'), e.appendChild(n);
const i = mo(Ro(Math.max(0, t.magic - o), t.magicM, t.magic));
(n.textContent = i.text), (n.className = St + i.color);
}
if ('0' === to) {
e.appendChild(Bo('Cookies to be gained/lost'));
const t = document.createElement('div');
(t.id = 'x'), e.appendChild(t);
const o = document.createElement('span');
(o.style.color = '#33FF00'),
(o.textContent = P(
Math.min(0.15 * (Game.cookies + go()), 60 * Se * 30),
2,
)),
t.appendChild(o);
const n = document.createElement('span');
(n.textContent = ' / '), t.appendChild(n);
const i = document.createElement('span');
(i.style.color = 'red'),
(i.textContent = P(60 * Se * 15, 2)),
t.appendChild(i);
}
l('CMTooltipArea').appendChild(e);
} else l('CMTooltipArea').style.display = 'none';
})()
: 'p' === eo
? (function () {
const { minigame: t } = Game.Objects.Farm;
if (e.TooltipPlots && 0 !== t.plot[to[1]][to[0]][0]) {
const e =
t.plot[to[1]][to[0]][1] > t.plantsById[t.plot[to[1]][to[0]][0] - 1].mature,
o = t.plantsById[t.plot[to[1]][to[0]][0] - 1].name;
l('CMTooltipBorder').appendChild(Bo('Reward (Current / Maximum)'));
const n = document.createElement('div');
(n.id = 'CMTooltipPlantReward'),
l('CMTooltipBorder').appendChild(n),
'Bakeberry' === o
? (l('CMTooltipPlantReward').textContent = `${
e ? P(Math.min(0.03 * Game.cookies, 60 * Game.cookiesPs * 30)) : '0'
} / ${P(60 * Game.cookiesPs * 30)}`)
: 'Chocoroot' === o || 'White chocoroot' === o
? (l('CMTooltipPlantReward').textContent = `${
e ? P(Math.min(0.03 * Game.cookies, 60 * Game.cookiesPs * 3)) : '0'
} / ${P(60 * Game.cookiesPs * 3)}`)
: 'Queenbeet' === o
? (l('CMTooltipPlantReward').textContent = `${
e ? P(Math.min(0.04 * Game.cookies, 60 * Game.cookiesPs * 60)) : '0'
} / ${P(60 * Game.cookiesPs * 60)}`)
: 'Duketater' === o
? (l('CMTooltipPlantReward').textContent = `${
e ? P(Math.min(0.08 * Game.cookies, 60 * Game.cookiesPs * 120)) : '0'
} / ${P(60 * Game.cookiesPs * 120)}`)
: (l('CMTooltipArea').style.display = 'none');
} else l('CMTooltipArea').style.display = 'none';
})()
: 'ha' === eo
? (function () {
const { minigame: t } = Game.Objects.Farm;
if (e.TooltipLump) {
l('CMTooltipBorder').appendChild(Bo('Cookies gained from harvesting:'));
let e = 0,
o = 0;
Game.keys[16] && Game.keys[17] && (o = 1);
for (let n = 0; n < 6; n++)
for (let i = 0; i < 6; i++)
if (t.plot[n][i][0] >= 1) {
const a = t.plot[n][i],
r = t.plantsById[a[0] - 1],
l = r.name;
let s = !0;
o && r.immortal && (s = !1),
a[1] < r.matureBase && (s = !1),
s && 'Bakeberry' === l
? (e += Math.min(0.03 * Game.cookies, 60 * Game.cookiesPs * 30))
: (s && 'Chocoroot' === l) || 'White chocoroot' === l
? (e += Math.min(0.03 * Game.cookies, 60 * Game.cookiesPs * 3))
: s && 'Queenbeet' === l
? (e += Math.min(0.04 * Game.cookies, 60 * Game.cookiesPs * 60))
: s &&
'Duketater' === l &&
(e += Math.min(0.08 * Game.cookies, 60 * Game.cookiesPs * 120));
}
l('CMTooltipBorder').appendChild(document.createTextNode(P(e)));
} else l('CMTooltipArea').style.display = 'none';
})()
: 'wb' === eo
? (function () {
(l('tooltip').innerHTML = ''), l('tooltip').appendChild(Bo('Reward:'));
const e = document.createElement('div');
(e.id = 'CMWrinklerReward'),
'PopAll' === to
? (e.textContent = P(He))
: 'PopFattest' === to && (e.textContent = P($e[0])),
l('tooltip').appendChild(e);
})()
: ('pag' === eo || ('pas' === eo && -1 !== to[1])) &&
(function () {
if (1 === e.TooltipPantheon) {
const t = l('CMTooltipBorder');
let o;
(o = 'pas' === eo ? to[1] : to), t.appendChild(Bo('Effect in position 1:'));
const n = document.createElement('div');
if (((n.id = 'CMPantheonTooltipPosition1'), 0 !== ft[o][0])) {
n.textContent = P(ft[o][0]);
const t = Math.round((ft[o][0] / Game.cookiesPs) * 1e4);
Number.isFinite(t) && 0 !== t
? (n.textContent += ` (${t / 100}% of income)`)
: (n.textContent += ` (<0${e.ScaleSeparator ? ',' : '.'}01% of income)`);
} else n.textContent = 'No effect to CPS';
t.appendChild(n), t.appendChild(Bo('Effect in position 2:'));
const i = document.createElement('div');
if (((i.id = 'CMPantheonTooltipPosition2'), 0 !== ft[o][1])) {
i.textContent = P(ft[o][1]);
const t = Math.round((ft[o][1] / Game.cookiesPs) * 1e4);
Number.isFinite(t) && 0 !== t
? (i.textContent += ` (${t / 100}% of income)`)
: (i.textContent += ` (<0${e.ScaleSeparator ? ',' : '.'}01% of income)`);
} else i.textContent = 'No effect to CPS';
t.appendChild(i), t.appendChild(Bo('Effect in position 3:'));
const a = document.createElement('div');
if (((a.id = 'CMPantheonTooltipPosition2'), 0 !== ft[o][2])) {
a.textContent = P(ft[o][2]);
const t = Math.round((ft[o][2] / Game.cookiesPs) * 1e4);
Number.isFinite(t) && 0 !== t
? (a.textContent += ` (${t / 100}% of income)`)
: (a.textContent += ` (<0${e.ScaleSeparator ? ',' : '.'}01% of income)`);
} else a.textContent = 'No effect to CPS';
t.appendChild(a), l('CMTooltipArea').appendChild(t);
} else l('CMTooltipArea').style.display = 'none';
})(),
(function () {
if ('b' === eo || 'u' === eo) {
null === document.getElementById('CMDispTooltipWarningParent') &&
(l('tooltipAnchor').appendChild(
(function () {
const t = document.createElement('div');
(t.style.position = 'absolute'),
(t.style.display = 'block'),
(t.style.left = 'auto'),
(t.style.bottom = 'auto'),
(t.id = 'CMDispTooltipWarningParent');
const o = function (e, t, o, n, i) {
const a = document.createElement('div');
(a.id = e),
(a.style.display = 'none'),
(a.style.transition = 'opacity 0.1s ease-out'),
(a.className = 'CMBorder' + t),
(a.style.padding = '2px'),
(a.style.background = '#000 url(img/darkNoise.png)');
const r = document.createElement('div');
a.appendChild(r);
const l = document.createElement('span');
(l.className = St + t),
(l.style.fontWeight = 'bold'),
(l.textContent = o),
r.appendChild(l),
r.appendChild(document.createTextNode(n));
const s = document.createElement('div');
a.appendChild(s);
const c = document.createElement('span');
return (
(c.id = i),
s.appendChild(document.createTextNode('Deficit: ')),
s.appendChild(c),
a
);
};
return (
t.appendChild(
o(
'CMDispTooltipWarnLucky',
Ft,
'Warning: ',
'Purchase of this item will put you under the number of Cookies required for "Lucky!"',
'CMDispTooltipWarnLuckyText',
),
),
(t.firstChild.style.marginBottom = '4px'),
t.appendChild(
o(
'CMDispTooltipWarnLuckyFrenzy',
Nt,
'Warning: ',
'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)',
'CMDispTooltipWarnLuckyFrenzyText',
),
),
(t.lastChild.style.marginBottom = '4px'),
t.appendChild(
o(
'CMDispTooltipWarnConjure',
Lt,
'Warning: ',
'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"',
'CMDispTooltipWarnConjureText',
),
),
(t.lastChild.style.marginBottom = '4px'),
t.appendChild(
o(
'CMDispTooltipWarnConjureFrenzy',
Lt,
'Warning: ',
'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)',
'CMDispTooltipWarnConjureFrenzyText',
),
),
(t.lastChild.style.marginBottom = '4px'),
t.appendChild(
o(
'CMDispTooltipWarnEdifice',
Lt,
'Warning: ',
'Purchase of this item will put you under the number of Cookies needed for "Spontaneous Edifice" to possibly give you your most expensive building"',
'CMDispTooltipWarnEdificeText',
),
),
(t.lastChild.style.marginBottom = '4px'),
t.appendChild(
o(
'CMDispTooltipWarnUser',
Ft,
'Warning: ',
`Purchase of this item will put you under the number of Cookies equal to ${e.ToolWarnUser} seconds of CPS`,
'CMDispTooltipWarnUserText',
),
),
t
);
})(),
),
Io()),
0 === e.ToolWarnPos
? (l('CMDispTooltipWarningParent').style.right = '0px')
: (l('CMDispTooltipWarningParent').style.top = `${
l('tooltip').offsetHeight
}px`),
(l('CMDispTooltipWarningParent').style.width =
l('tooltip').offsetWidth - 6 + 'px');
const t = Game.cookies + go() - Jt,
o = e.ToolWarnBon ? Zt : 0;
let n = Ce;
if (1 === e.ToolWarnBon) {
let e = Zt;
(e /= No()), (n += (60 * e * 15) / 0.15);
}
if (
(1 === e.ToolWarnLucky && t < n && ('b' !== eo || 1 === Game.buyMode)
? ((l('CMDispTooltipWarnLucky').style.display = ''),
(l('CMDispTooltipWarnLuckyText').textContent = `${P(n - t)} (${uo(
(n - t) / (ho() + o),
)})`))
: (l('CMDispTooltipWarnLucky').style.display = 'none'),
1 === e.ToolWarnLuckyFrenzy)
) {
const e = 7 * n;
t < e && ('b' !== eo || 1 === Game.buyMode)
? ((l('CMDispTooltipWarnLuckyFrenzy').style.display = ''),
(l('CMDispTooltipWarnLuckyFrenzyText').textContent = `${P(e - t)} (${uo(
(e - t) / (ho() + o),
)})`))
: (l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none');
} else l('CMDispTooltipWarnLuckyFrenzy').style.display = 'none';
if (1 === e.ToolWarnConjure) {
const e = 2 * n;
t < e && ('b' !== eo || 1 === Game.buyMode)
? ((l('CMDispTooltipWarnConjure').style.display = ''),
(l('CMDispTooltipWarnConjureText').textContent = `${P(e - t)} (${uo(
(e - t) / (ho() + o),
)})`))
: (l('CMDispTooltipWarnConjure').style.display = 'none');
} else l('CMDispTooltipWarnConjure').style.display = 'none';
if (1 === e.ToolWarnConjureFrenzy) {
const e = 2 * n * 7;
t < e && ('b' !== eo || 1 === Game.buyMode)
? ((l('CMDispTooltipWarnConjureFrenzy').style.display = ''),
(l('CMDispTooltipWarnConjureFrenzyText').textContent = `${P(e - t)} (${uo(
(e - t) / (ho() + o),
)})`))
: (l('CMDispTooltipWarnConjureFrenzy').style.display = 'none');
} else l('CMDispTooltipWarnConjureFrenzy').style.display = 'none';
1 === e.ToolWarnEdifice &&
Game.Objects['Wizard tower'].minigameLoaded &&
Te &&
t < Te &&
('b' !== eo || 1 === Game.buyMode)
? ((l('CMDispTooltipWarnEdifice').style.display = ''),
(l('CMDispTooltipWarnEdificeText').textContent = `${P(Te - t)} (${uo(
(Te - t) / (ho() + o),
)})`))
: (l('CMDispTooltipWarnEdifice').style.display = 'none'),
e.ToolWarnUser > 0 &&
t < e.ToolWarnUser * ho() &&
('b' !== eo || 1 === Game.buyMode)
? ((l('CMDispTooltipWarnUser').style.display = ''),
(l(
'CMDispTooltipWarnUser',
).children[0].textContent = `Purchase of this item will put you under the number of Cookies equal to ${e.ToolWarnUser} seconds of CPS`),
(l('CMDispTooltipWarnUserText').textContent = `${P(
e.ToolWarnUser * ho() - t,
)} (${uo((e.ToolWarnUser * ho() - t) / (ho() + o))})`))
: (l('CMDispTooltipWarnUser').style.display = 'none');
} else
null !== l('CMDispTooltipWarningParent') &&
l('CMDispTooltipWarningParent').remove();
})();
} else
null === l('CMTooltipArea') &&
null !== l('CMDispTooltipWarningParent') &&
l('CMDispTooltipWarningParent').remove();
}
function Vo() {
if (Game.prefs.autosave && Game.drawT % 10 == 0 && 'stats' === Game.onMenu && e.Stats) {
const e = document.getElementById('CMStatsAutosaveTimer');
e && (e.innerText = Game.sayTime(60 * Game.fps - (Game.T % (60 * Game.fps)), 4));
}
if (
(so(),
po(),
co(),
(function () {
if (1 === e.TimerBar) {
const t = l('CMTimerBar').offsetWidth - 163,
o = l('CMTimerBar').offsetWidth - 133;
let n = 0;
0 !== Game.shimmerTypes.golden.spawned || Game.Has('Golden switch [off]')
? (l('CMTimerBarGC').style.display = 'none')
: ((l('CMTimerBarGC').style.display = ''),
(l('CMTimerBarGCMinBar').style.width = `${Math.round(
(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) *
t) /
Game.shimmerTypes.golden.maxTime,
)}px`),
e.TimerBarOverlay >= 1
? (l('CMTimerBarGCMinBar').textContent = Math.ceil(
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) /
Game.fps,
))
: (l('CMTimerBarGCMinBar').textContent = ''),
Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime
? ((l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px'),
(l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px'))
: ((l('CMTimerBarGCMinBar').style.borderTopRightRadius = ''),
(l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '')),
(l('CMTimerBarGCBar').style.width = `${Math.round(
(Math.min(
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time,
) *
t) /
Game.shimmerTypes.golden.maxTime,
)}px`),
e.TimerBarOverlay >= 1
? (l('CMTimerBarGCBar').textContent = Math.ceil(
Math.min(
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time,
) / Game.fps,
))
: (l('CMTimerBarGCBar').textContent = ''),
(l('CMTimerBarGCTime').textContent = Math.ceil(
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps,
)),
(n += 1)),
'christmas' === Game.season && 0 === Game.shimmerTypes.reindeer.spawned
? ((l('CMTimerBarRen').style.display = ''),
(l('CMTimerBarRenMinBar').style.width = `${Math.round(
(Math.max(
0,
Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time,
) *
t) /
Game.shimmerTypes.reindeer.maxTime,
)}px`),
e.TimerBarOverlay >= 1
? (l('CMTimerBarRenMinBar').textContent = Math.ceil(
(Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) /
Game.fps,
))
: (l('CMTimerBarRenMinBar').textContent = ''),
(l('CMTimerBarRenBar').style.width = `${Math.round(
(Math.min(
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
) *
t) /
Game.shimmerTypes.reindeer.maxTime,
)}px`),
e.TimerBarOverlay >= 1
? (l('CMTimerBarRenBar').textContent = Math.ceil(
Math.min(
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime,
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
) / Game.fps,
))
: (l('CMTimerBarRenBar').textContent = ''),
(l('CMTimerBarRenTime').textContent = Math.ceil(
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) /
Game.fps,
)),
(n += 1))
: (l('CMTimerBarRen').style.display = 'none');
const i = {};
(l('CMTimerBarBuffTimers').innerHTML = ''),
Object.keys(Game.buffs).forEach((t) => {
if (Game.buffs[t]) {
const a = fo(Game.buffs[t].name, Game.buffs[t].name, [
{ id: `${Game.buffs[t].name}Bar` },
]);
a.style.display = '';
let r = '';
(r = void 0 !== Kt[Game.buffs[t].name] ? Kt[Game.buffs[t].name] : Lt),
(a.lastChild.children[1].className = Bt + r),
(a.lastChild.children[1].style.color = 'black'),
2 === e.TimerBarOverlay
? (a.lastChild.children[1].textContent = `${Math.round(
(Game.buffs[t].time / Game.buffs[t].maxTime) * 100,
)}%`)
: (a.lastChild.children[1].textContent = ''),
(a.lastChild.children[1].style.width = `${Math.round(
(Game.buffs[t].time *
(o - 8 * Math.ceil(Game.buffs[t].time / Game.fps).toString().length)) /
Game.buffs[t].maxTime,
)}px`),
(a.lastChild.children[2].textContent = Math.ceil(
Game.buffs[t].time / Game.fps,
)),
(n += 1),
(i[Game.buffs[t].name] = a);
}
}),
Object.keys(i).forEach((e) => {
l('CMTimerBarBuffTimers').appendChild(i[e]);
}),
0 !== n && (l('CMTimerBar').style.height = 12 * n + 2 + 'px'),
io !== n && ((io = n), ko());
}
})(),
yo(),
zo(),
(function () {
if (1 === e.TooltipWrink && 1 === Rt) {
let e = !1;
Object.keys(Game.wrinklers).forEach((t) => {
const o = Game.wrinklers[t];
if (o.phase > 0 && o.selected) {
if (((e = !0), 0 === zt[t] || void 0 === zt[t])) {
const e = document.createElement('div'),
o = document.createElement('div');
(o.style.minWidth = '120px'), (o.style.marginBottom = '4px');
const n = document.createElement('div');
(n.style.textAlign = 'center'),
(n.id = 'CMTooltipWrinkler'),
o.appendChild(n),
e.appendChild(o),
Game.tooltip.draw(this, escape(e.innerHTML)),
(It = t),
(zt[t] = 1);
}
} else zt[t] = 0;
}),
e || Game.tooltip.hide();
}
})(),
(function () {
if (1 === e.TooltipWrink && null !== l('CMTooltipWrinkler')) {
let { sucked: e } = Game.wrinklers[It],
t = 1.1;
if (
(Game.Has('Sacrilegious corruption') && (t *= 1.05),
1 === Game.wrinklers[It].type && (t *= 3),
(e *= t),
Game.Has('Wrinklerspawn') && (e *= 1.05),
Ct.Temple.minigameLoaded)
) {
const t = Game.hasGod('scorn');
1 === t ? (e *= 1.15) : 2 === t ? (e *= 1.1) : 3 === t && (e *= 1.05);
}
l('CMTooltipWrinkler').textContent = P(e);
}
})(),
e.UpStats &&
'stats' === Game.onMenu &&
(Game.drawT - 1) % (5 * Game.fps) != 0 &&
(Game.drawT - 1) % Game.fps == 0 &&
Game.UpdateMenu(),
t(),
e.Scale)
) {
let e = l('cookies').innerHTML.replace(/.*(?=
)/i, P(Game.cookies));
Game.prefs.monospace && (e = `${e}`),
(l('cookies').innerHTML = e);
}
}
function _o() {
E.addLatest(Game.computedMouseCps);
}
class Qo {
constructor(e) {
(this.maxLength = e), (this.queue = []);
}
addLatest(e) {
this.queue.push(e) > this.maxLength && this.queue.shift();
}
calcAverage(e) {
let t = e;
t > this.maxLength && (t = this.maxLength),
t > this.queue.length && (t = this.queue.length);
let o = 0;
for (let e = this.queue.length - 1; e >= 0 && e > this.queue.length - 1 - t; e--)
o += this.queue[e];
return 0 === o ? 0 : o / t;
}
calcSum(e) {
let t = e;
return (
t > this.maxLength && (t = this.maxLength),
t > this.queue.length && (t = this.queue.length),
0 === t ? 0 : this.queue.slice(-t).reduce((e, t) => e + t, 0)
);
}
}
function Xo() {
const t = Math.floor(Date.now() / 1e3);
if ((Game.T / Game.fps) % 1 == 0) {
let o = Game.cookies + gt;
Game.cpsSucked > 0 && (o += He), (lt = Math.max(Game.cookiesEarned, o)), (o *= 0.05);
const n = t - j,
i = Math.max(0, Game.cookies - D) / n,
a = Math.max(0, He - H) / n,
r = Math.max(0, $e[0] - U) / n,
l = Math.max(0, o - Le) / n,
s = (Game.cookieClicks - $) / n;
for (let e = 0; e < n; e++)
N.addLatest(i), O.addLatest(a), F.addLatest(r), L.addLatest(l), W.addLatest(s);
(j = t), (D = Game.cookies), (H = He), (U = $e[0]), (Le = o), ($ = Game.cookieClicks);
const c = qt[e.AvgCPSHist];
(R = N.calcAverage(c)),
(I = O.calcAverage(c)),
(z = F.calcAverage(c)),
(V = L.calcAverage(c)),
(_ = R),
1 === e.CalcWrink && (_ += I),
2 === e.CalcWrink && (_ += z);
const d = Game.HasUnlocked('Chocolate egg') && !Game.Has('Chocolate egg');
(st = d || 0 === e.CalcWrink ? R + I + (d ? V : 0) : _),
(Ve = W.calcAverage(Yt[e.AvgClicksHist]));
}
}
function qo(t, o) {
Object.keys(t).forEach((n) => {
if (e.PPRigidelMode && 1 === o) t[n].color = Wt;
else {
t[n].color = Eo(t[n], Game.Objects[n].getSumPrice(o));
for (let o = 0; o < e.PPExcludeTop; o++) t[n].pp === mt[o][0] && (t[n].color = Wt);
}
});
}
function Yo(t, o) {
Object.keys(t).forEach((n) => {
const i = Game.Objects[n].getSumPrice(o);
Game.cookiesPs
? (t[n].pp = Math.max(i - (Game.cookies + go()), 0) / Game.cookiesPs + i / t[n].bonus)
: (t[n].pp = i / t[n].bonus),
(e.PPRigidelMode && 1 === o) || mt.push([t[n].pp, o]);
});
}
function Ko() {
!(function () {
(ut = 1 / 0),
(mt = []),
void 0 === e.PPExcludeTop && (e.PPExcludeTop = 0),
Yo(We, 1),
Yo(Ae, 10),
Yo(je, 100),
mt.sort((e, t) => e[0] - t[0]);
let t = 0;
if (e.PPOnlyConsiderBuyable)
for (; mt[t][1] > Game.cookies && ((t += 1), mt.length !== t + 1); );
(ut = mt[e.PPExcludeTop][t]), qo(We, 1), qo(Ae, 10), qo(je, 100);
})(),
Object.keys(ze).forEach((e) => {
Game.cookiesPs
? (ze[e].pp =
Math.max(Game.Upgrades[e].getPrice() - (Game.cookies + go()), 0) /
Game.cookiesPs +
Game.Upgrades[e].getPrice() / ze[e].bonus)
: (ze[e].pp = Game.Upgrades[e].getPrice() / ze[e].bonus),
Number.isNaN(ze[e].pp) && (ze[e].pp = 1 / 0),
(ze[e].color = Eo(ze[e], Game.Upgrades[e].getPrice()));
});
}
function Jo(e, t, o, n, i) {
let a = o,
r = 0;
for (let o = 0; o < i; o += 1) {
let o = t * Game.priceIncrease ** Math.max(0, a - n);
(o = Game.modifyBuildingPrice(e, o)), (o = Math.ceil(o)), (r += o), (a += 1);
}
return r;
}
function Zo(e) {
const t = {};
return (
Object.keys(Game.Objects).forEach((o) => {
(t[o] = {}), (t[o].bonus = $o(o, e)), 1 !== e && (q = 1);
}),
t
);
}
function en() {
Object.keys(Game.Objects).forEach((e) => {
(We[e].price = Jo(
Game.Objects[e],
Game.Objects[e].basePrice,
Game.Objects[e].amount,
Game.Objects[e].free,
1,
)),
(Ae[e].price = Jo(
Game.Objects[e],
Game.Objects[e].basePrice,
Game.Objects[e].amount,
Game.Objects[e].free,
10,
)),
(je[e].price = Jo(
Game.Objects[e],
Game.Objects[e].basePrice,
Game.Objects[e].amount,
Game.Objects[e].free,
100,
)),
(De[e].price = Jo(
Game.Objects[e],
Game.Objects[e].basePrice,
Game.Objects[e].amount,
Game.Objects[e].free,
De[e].AmountNeeded,
));
});
}
function tn() {
(We = Zo(1)),
(Ae = Zo(10)),
(je = Zo(100)),
(ze = []),
Object.keys(Game.Upgrades).forEach((t) => {
const o = (function (e) {
if (
'toggle' === Game.Upgrades[e].pool ||
(0 === Game.Upgrades[e].bought &&
Game.Upgrades[e].unlocked &&
'prestige' !== Game.Upgrades[e].pool)
) {
So(),
'Shimmering veil [on]' === yt[e].name
? (yt['Shimmering veil [off]'].bought = 0)
: 'Golden switch [on]' === yt[e].name
? (yt['Golden switch [off]'].bought = 0)
: (yt[e].bought = (yt[e].bought + 1) % 2),
Game.CountsAsUpgradeOwned(Game.Upgrades[e].pool) && (J += 1),
'Elder Pledge' === e
? ((Z += 1), Z > 0 && Oo('Elder nap'), Z >= 5 && Oo('Elder slumber'))
: 'Elder Covenant' === e
? Oo('Elder calm')
: 'Prism heart biscuits' === e
? Oo('Lovely cookies')
: 'Heavenly key' === e && Oo('Wholesome');
const t = ee;
Fo(), Uo(), t !== ee && Fo();
const o =
(function () {
let e = 0;
wt('Thousand fingers') && (e += 0.1),
wt('Million fingers') && (e *= 5),
wt('Billion fingers') && (e *= 10),
wt('Trillion fingers') && (e *= 20),
wt('Quadrillion fingers') && (e *= 20),
wt('Quintillion fingers') && (e *= 20),
wt('Sextillion fingers') && (e *= 20),
wt('Septillion fingers') && (e *= 20),
wt('Octillion fingers') && (e *= 20),
wt('Nonillion fingers') && (e *= 20);
let t = 0;
Object.keys(Ct).forEach((e) => {
t += Ct[e].amount;
}),
(t -= Ct.Cursor.amount),
(e *= t),
wt('Plastic mouse') && (e += 0.01 * de),
wt('Iron mouse') && (e += 0.01 * de),
wt('Titanium mouse') && (e += 0.01 * de),
wt('Adamantium mouse') && (e += 0.01 * de),
wt('Unobtainium mouse') && (e += 0.01 * de),
wt('Eludium mouse') && (e += 0.01 * de),
wt('Wishalloy mouse') && (e += 0.01 * de),
wt('Fantasteel mouse') && (e += 0.01 * de),
wt('Nevercrack mouse') && (e += 0.01 * de),
wt('Armythril mouse') && (e += 0.01 * de),
wt('Technobsidian mouse') && (e += 0.01 * de),
wt('Plasmarble mouse') && (e += 0.01 * de),
wt('Miraculite mouse') && (e += 0.01 * de),
wt('Fortune #104') && (e += 0.01 * de);
let o = 1;
if (
(wt("Santa's helpers") && (o *= 1.1),
wt('Cookie egg') && (o *= 1.1),
wt('Halo gloves') && (o *= 1.1),
wt('Dragon claw') && (o *= 1.03),
wt('Aura gloves') &&
(o *=
1 +
0.05 *
Math.min(Game.Objects.Cursor.level, wt('Luminous gloves') ? 20 : 10)),
(o *= vt('click')),
Ct.Temple.minigameLoaded && xt)
) {
const e = xt('labor');
1 === e ? (o *= 1.15) : 2 === e ? (o *= 1.1) : 3 === e && (o *= 1.05);
}
Object.keys(Game.buffs).forEach((e) => {
void 0 !== Game.buffs[e].multClick && (o *= Game.buffs[e].multClick);
}),
(o *= 1 + 0.05 * kt('Dragon Cursor'));
let n =
o *
Game.ComputeCps(
1,
wt('Reinforced index finger') +
wt('Carpal tunnel prevention cream') +
wt('Ambidextrous'),
e,
);
return (
(n = Game.runModHookOnValue('cookiesPerClick', n)),
Game.hasBuff('Cursed finger') && (n = Game.buffs['Cursed finger'].power),
n
);
})() - Game.computedMouseCps;
return o ? [de - Game.cookiesPs, o] : [de - Game.cookiesPs];
}
return [];
})(t);
'Elder Pledge' === t
? ((ze[t] = { bonus: Game.cookiesPs - R }),
1 === e.CalcWrink ? (ze[t].bonus -= I) : 2 === e.CalcWrink && (ze[t].bonus -= z),
Number.isFinite(ze[t].bonus) || (ze[t].bonus = 0))
: ((ze[t] = {}), o[0] && (ze[t].bonus = o[0]), o[1] && (ze[t].bonusMouse = o[1]));
});
}
function on(e, t, o) {
let n = 0,
i = 0,
a = 0,
r = 0,
l = 1 + Math.max(0, Math.ceil(Math.log(Game.cookies) / Math.LN10) - 10);
for (; a < t * o; )
(i = Math.max(e, Math.min(Math.floor((1 / 9) * 10 ** l * e * o), t * o))),
(a = Math.max(e, Math.min(Math.floor((1 / 9) * 10 ** (l + 1) * e * o), t * o))),
(r = Math.floor((1 / 9) * 10 ** (l + 1) * e * o)),
(n += i),
(l += 1);
return [n, i, r];
}
function nn() {
let e = 60 * Se * 60 * 6 * Be;
const t = No();
t > 0 ? (e /= t) : (e = 0),
(Ke = on(7, e, Pe)),
(qe = (2 * Ke[1]) / Pe),
(Ye = Ke[2] / 60 / 60 / 6 / Be),
(et = on(6, e, Ee)),
(Je = (2 * et[1]) / Ee),
(Ze = et[2] / 60 / 60 / 6 / Be),
(nt = on(7, 7 * e, Pe)),
(tt = (2 * nt[1]) / Pe),
(ot = nt[2] / 60 / 60 / 6 / Be),
(rt = on(6, 7 * e, Ee)),
(it = (2 * rt[1]) / Ee),
(at = rt[2] / 60 / 60 / 6 / Be);
}
function an() {
const e = Math.floor(Date.now() / 1e3);
if ((Game.T / Game.fps) % 1 == 0) {
const t = Game.HowMuchPrestige(Game.cookiesReset),
o =
Math.floor(Game.HowMuchPrestige(Game.cookiesReset + Game.cookiesEarned)) -
Math.floor(t),
n = e - Q,
i = Math.max(0, o - X) / n;
for (let e = 0; e < n; e++) A.addLatest(i);
(Q = e), (X = o), (Ne = A.calcAverage(5));
}
}
function rn() {
(_e = ''), (Xe = ''), (Qe = '');
const e = [];
Object.keys(Game.Upgrades).forEach((t) => {
e.push(Game.Upgrades[t]);
}),
e.sort(function (e, t) {
return e.order > t.order ? 1 : e.order < t.order ? -1 : 0;
}),
Object.keys(e).forEach((t) => {
const o = e[t];
if (0 === o.bought) {
let e = '';
(e += (function (e) {
let t = 'crate upgrade missing';
'prestige' === e.pool && (t += ' heavenly');
let o = 0;
Game.prefs.crates || (o = 1), o && (t += ' noFrame');
let { icon: n } = e;
e.iconFunction && (n = e.iconFunction());
const i = `function() {return Game.crateTooltip(Game.UpgradesById[${e.id}], 'stats');}`;
return `