3 lines
169 KiB
JavaScript
3 lines
169 KiB
JavaScript
/*! 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 f=0;f<i.pub.previewSeparator.length;f+=1)u.beginPath(),u.strokeStyle=i.pub.previewSeparator[f],u.moveTo(.5+h+f,0),u.lineTo(.5+h+f,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],f=o.fixed?"fixed":"absolute",g=(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,f,g)}},_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(.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 f=i.genColorPreviewCanvas("rgba(0,0,0,0)"),g=0,C=0;C<p.palette.rows;C++)for(var y=0;y<p.palette.cols&&g<n._palette.length;y++,g++){var b=n._palette[g],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('"+f.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.213*this.channels.r+.715*this.channels.g+.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 f=m[h];if(f)if(i.pub.presets.hasOwnProperty(f)){for(var u in i.pub.presets[f])if(i.pub.presets[f].hasOwnProperty(u))try{a(u,i.pub.presets[f][u])}catch(e){console.warn(e)}}else console.warn("Unknown preset: %s",f)}var g=["preset"];for(var u in o)if(o.hasOwnProperty(u)&&-1===g.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){if(t[n])return t[n].exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,o),i.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,t,n,i,a,r,s,c,d,p,u,m,h,f,g,C,y,b,k,G,v,w,x,T,M,S,B,P,E,N,O,F,W={},L=0,A=0,j=0,U=0,D=0,R=0,H=0,$=0,I=0,z=0,V=0,_=0,X=0,Q=0,q=0,Y=1,K=1,J=1,Z=0,ee=0,te=0,oe=0,ne={},ie={},ae={},re=0,le=0,se=[0,null],ce=0,de=0,pe={},ue={},me={},he={},fe={},ge=0,Ce=0,ye=[],be=0,ke=0,Ge=[],ve=0,we=0,xe=[],Te=0,Me=0,Se=[],Be=0,Pe=0,Ee={},Ne={},Oe=0,Fe=0,We=0,Le=0,Ae=[],je={},Ue=0,De=[],Re=[],He=[],$e=Game.startDate,Ie=Game.startDate;function ze(e){let t=0;return Game.dragonAuras[B].name!==e&&Game.dragonAuras[P].name!==e||(t=1),"Reality Bending"!==Game.dragonAuras[B].name&&"Reality Bending"!==Game.dragonAuras[P].name||(t+=.1),t}function Ve(){let e=.25;return e*=1+ze("Earth Shatterer"),e}function _e(e,t){return void 0===N[e]?void 0===t?1:t:N[e]}function Xe(e){const t=Re[e];return(1!==Game.ascensionMode||"prestige"!==t.pool&&"fortune"!==t.tier)&&t?t.bought:0}function Qe(e){if(Game.hasGod){void 0===De.Temple.minigame&&(De.Temple.minigame=Game.Objects.Temple.minigame);const t=De.Temple.minigame.gods[e];for(let e=0;e<3;e++)if(De.Temple.minigame.slot[e]===t.id)return e+1}return!1}function qe(e,t){if(Xe("Season savings")&&(t*=.99),Xe("Santa's dominion")&&(t*=.99),Xe("Faberge egg")&&(t*=.99),Xe("Divine discount")&&(t*=.99),Xe("Fortune #100")&&(t*=.99),t*=1-.02*ze("Fierce Hoarder"),Game.hasBuff("Everything must go")&&(t*=.95),Game.hasBuff("Crafty pixies")&&(t*=.98),Game.hasBuff("Nasty goblins")&&(t*=1.02),e.fortune&&Xe(e.fortune.name)&&(t*=.93),t*=_e("buildingCost"),De.Temple.minigameLoaded){const e=Qe("creation");1===e?t*=.93:2===e?t*=.95:3===e&&(t*=.98)}return t}function Ye(e,t,o,n,i,a){a=void 0===a?0:a;let r=0;-1===i&&(i=o),i||(i=Game.buyBulk);for(let l=0;l<i;l++){let i=t*Game.priceIncrease**Math.max(0,o-n);i=a?Game.modifyBuildingPrice(e,i):qe(e,i),i=Math.ceil(i);const l=a?e.getSellMultiplier():Ve();i=Math.floor(i*l),o>0&&(r+=i,o--)}return r}const Ke=["","","M","G","T","P","E","Z","Y"],Je=["","","M","B","Tr","Quadr","Quint","Sext","Sept","Oct","Non","Dec","Undec","Duodec","Tredec","Quattuordec","Quindec","Sexdec","Septendec","Octodec","Novemdec","Vigint","Unvigint","Duovigint","Trevigint","Quattuorvigint"],Ze=["","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 et,tt,ot,nt,it,at,rt,lt,st,ct,dt,pt,ut,mt,ht,ft,gt,Ct=[],yt=[],bt=[],kt={};const Gt="CMText",vt="CMBack",wt="Blue",xt="Green",Tt="Yellow",Mt="Orange",St="Red",Bt="Purple",Pt="Gray",Et="Pink",Nt="Brown",Ot=[Pt,wt,xt,Tt,Mt,St,Bt,Et,Nt],Ft=[["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"]];let Wt,Lt,At=0,jt=-1,Ut=[],Dt=1,Rt=1,Ht=1;const $t=[10,15,30,60,300,600,900,1800],It=[1,5,10,15,30],zt={Frenzy:Tt,"Dragon Harvest":Nt,"Elder frenzy":xt,Clot:St,"Click frenzy":wt,Dragonflight:Et};let Vt,_t,Xt,Qt,qt,Yt,Kt,Jt={},Zt="";function eo(e,t,o){const n=W.ScaleDecimals+1;if(e===1/0)return"Infinity";if(void 0===e)return"0";if(0===W.Scale)return kt.Beautify(e,t);if(Number.isFinite(e)){let i="";if(0===e)return e.toString();if(e>.001&&e<W.ScaleCutoff){i=e.toFixed(2),W.ScaleSeparator&&(i=i.toLocaleString("nl"));for(let e=0;e<3;e++)"0"!==i[i.length-1]&&"."!==i[i.length-1]||(i=i.slice(0,-1));return i}if(4===W.Scale&&!o||4===o)i=e.toExponential(n).toString().replace("e","E");else{const t=e.toExponential().toString(),a=Math.floor(t.slice(t.indexOf("e")+1)/3);i=(e/Number("1e"+3*a)).toFixed(n),1===W.Scale&&!o||1===o?e>=.01&&e<Number("1e"+3*Ke.length)?i+=` ${Ke[a]}`:i=eo(e,0,4):2===W.Scale&&!o||2===o?e>=.01&&e<Number("1e"+3*Je.length)?i+=` ${Je[a]}`:i=eo(e,0,4):3===W.Scale&&!o||3===o?e>=.01&&e<Number("1e"+3*Ze.length)?i+=` ${Ze[a]}`:i=eo(e,0,4):(5===W.Scale&&!o||5===o)&&(i+="E"+3*a)}return""===i&&(console.log(`Could not beautify number with CM.Disp.Beautify: ${e}`),i=kt.Beautify(e,t)),W.ScaleSeparator&&(i=i.replace(".",",")),i}return console.log(`Could not beautify number with CM.Disp.Beautify: ${e}`),kt.Beautify(e,t)}function to(e,t){if(e===1/0)return e;e=Math.ceil(e);const o=Math.floor(e/31557600),n=Math.floor(e%31557600/86400),i=Math.floor(e%86400/3600),a=Math.floor(e%3600/60),r=Math.floor(e%60);let l="";if(W.TimeFormat){if(e>315576e4)return"XX:XX:XX:XX:XX";l+=(o<10?"0":"")+o+":",l+=(n<10?"0":"")+n+":",l+=(i<10?"0":"")+i+":",l+=(a<10?"0":"")+a+":",l+=(r<10?"0":"")+r}else{if(e>7776e5)return t?"Over 9000 days!":">9000d";l+=o>0?o+(t?1===o?" year":" years":"y")+", ":"",l+=n>0?n+(t?1===n?" day":" days":"d")+", ":"",(l.length>0||i>0)&&(l+=i+(t?1===i?" hour":" hours":"h")+", "),(l.length>0||a>0)&&(l+=a+(t?1===a?" minute":" minutes":"m")+", "),l+=r+(t?1===r?" second":" seconds":"s")}return l}function oo(e){let t,o;return e<=0?(o=W.TimeFormat?"00:00:00:00:00":"Done!",t=xt):(o=to(e),t=e>300?St:e>60?Mt:Tt),{text:o,color:t}}function no(){let e=Game.buyBulk;if(1===Game.buyMode?Rt=e:e=Rt,1===e?e=ne:10===e?e=ie:100===e&&(e=ae),1===Game.buyMode)if(1===W.BuildColor)for(const t of Object.keys(e))l(`productPrice${Game.Objects[t].id}`).style.color=W.Colors[e[t].color];else for(const e of Object.keys(Game.Objects))l(`productPrice${Game.Objects[e].id}`).style.removeProperty("color");else if(-1===Game.buyMode)for(const e of Object.keys(ne)){const t=Game.Objects[e];l(`productPrice${t.id}`).style.color="",l(`productPrice${t.id}`).innerHTML=eo(Ye(t,t.basePrice,t.amount,t.free,Game.buyBulk,1))}if(1===Game.buyMode&&W.SortBuildings){const t=Object.keys(e).map((t=>{const o=e[t];return o.name=t,o.id=Game.Objects[t].id,o}));t.sort((function(e,t){return Ot.indexOf(e.color)>Ot.indexOf(t.color)?1:Ot.indexOf(e.color)<Ot.indexOf(t.color)||e.pp<t.pp?-1:0}));for(let e=0;e<t.length;e++)Game.Objects[t[e].name].l.style.gridRow=`${e+2}/${e+2}`}else{const e=Object.keys(ne).map((e=>{const t=ne[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 io(){if(W.UpBarColor>0){let e=0,t=0,o=0,n=0,i=0,a=0,r=0;for(const s of Object.keys(Game.UpgradesInStore)){const c=Game.UpgradesInStore[s];let d=!1;for(let e=0;e<l(`upgrade${s}`).childNodes.length;e++)if(-1!==l(`upgrade${s}`).childNodes[e].className.indexOf(vt)){l(`upgrade${s}`).childNodes[e].className=vt+pe[c.name].color,d=!0;break}if(!d){const e=document.createElement("div");e.style.width="10px",e.style.height="10px",e.className=vt+pe[c.name].color,l(`upgrade${s}`).appendChild(e)}pe[c.name].color===wt?e++:pe[c.name].color===xt?t++:pe[c.name].color===Tt?o++:pe[c.name].color===Mt?n++:pe[c.name].color===St?i++:pe[c.name].color===Bt?a++:pe[c.name].color===Pt&&r++}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 e=[];for(let t=0;t<Game.UpgradesInStore.length;t++){const o={};o.name=Game.UpgradesInStore[t].name,o.price=Game.UpgradesInStore[t].basePrice,o.pp=pe[o.name].pp,e.push(o)}W.SortUpgrades?e.sort((function(e,t){return Ot.indexOf(e.color)>Ot.indexOf(t.color)?1:Ot.indexOf(e.color)<Ot.indexOf(t.color)||e.pp<t.pp?-1:0})):e.sort(((e,t)=>e.price-t.price));const t=function(e,t){return e.findIndex((e=>e.name===t.name))};for(let o=0;o<Game.UpgradesInStore.length;o++)l(`upgrade${o}`).style.order=t(e,Game.UpgradesInStore[o])+1}function ao(){return W.CPSMode?0:0===W.CalcWrink?Game.cookiesPs*(1-Game.cpsSucked):1===W.CalcWrink?Game.cookiesPs*(ce+(1-.05*de)):2===W.CalcWrink&&1===Game.wrinklers[se[1]].type?Game.cookiesPs*(3*ce/de+(1-.05*de)):Game.cookiesPs*(ce/de+(1-.05*de))}function ro(){return 1===W.CalcWrink?re:2===W.CalcWrink?se[0]:0}function lo(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=vt+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 so(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(")")),o.appendChild(document.createElement("td")),n.appendChild(document.createElement("td")),i.appendChild(document.createElement("td"))}}function co(){if(1===W.BotBar&&ne&&1===Game.buyMode){let e=0;for(const t of Object.keys(ne)){let o=Game.buyBulk;1===Game.buyMode?Dt=o:o=Dt,1===o&&(o=ne),10===o&&(o=ie),100===o&&(o=ae),e++,l("CMBotBar").firstChild.firstChild.childNodes[0].childNodes[e].childNodes[1].textContent=Game.Objects[t].amount,l("CMBotBar").firstChild.firstChild.childNodes[1].childNodes[e].textContent=eo(o[t].bonus,2),l("CMBotBar").firstChild.firstChild.childNodes[2].childNodes[e].className=Gt+o[t].color,l("CMBotBar").firstChild.firstChild.childNodes[2].childNodes[e].textContent=eo(o[t].pp,2);const n=oo((Game.Objects[t].bulkPrice-(Game.cookies+ro()))/ao());l("CMBotBar").firstChild.firstChild.childNodes[3].childNodes[e].className=Gt+n.color,"Done!"===n.text&&Game.cookies<Game.Objects[t].bulkPrice?l("CMBotBar").firstChild.firstChild.childNodes[3].childNodes[e].textContent=`${n.text} (with Wrink)`:l("CMBotBar").firstChild.firstChild.childNodes[3].childNodes[e].textContent=n.text}}}function po(){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}function uo(){1===W.BotBar&&1===W.TimerBar&&1===W.TimerBarPos?(l("CMBotBar").style.bottom=l("CMTimerBar").style.height,l("game").style.bottom=`${Number(l("CMTimerBar").style.height.replace("px",""))+70}px`):1===W.BotBar?(l("CMBotBar").style.bottom="0px",l("game").style.bottom="70px"):1===W.TimerBar&&1===W.TimerBarPos?l("game").style.bottom=l("CMTimerBar").style.height:l("game").style.bottom="0px",1===W.TimerBar&&0===W.TimerBarPos?l("sectionLeft").style.top=l("CMTimerBar").style.height:l("sectionLeft").style.top="",po()}function mo(){1===W.TimerBar?l("CMTimerBar").style.display="":l("CMTimerBar").style.display="none",uo()}function ho(){let e=1;for(const t of Object.keys(Game.buffs))void 0!==Game.buffs[t].multCpS&&(e*=Game.buffs[t].multCpS);return e}function fo(){null!==l("CMDispTooltipWarningParent")&&(0===W.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 go(e,t,o){let n=0;for(;e<o;)e+=.002*Math.max(.002,(e/Math.max(t,100))**.5),n++;return n/Game.fps}function Co(e){const t=document.createElement("div");return t.style.fontWeight="bold",t.id=`${e}Title`,t.className="CMTextBlue",t.textContent=e,t}function yo(e){e.appendChild(Co("Bonus Income"));const t=document.createElement("div");t.style.marginBottom="4px",t.style.color="white",t.id="CMTooltipIncome",e.appendChild(t),e.appendChild(Co("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(Co("Payback Period"));const n=document.createElement("div");n.style.marginBottom="4px",n.id="CMTooltipPP",e.appendChild(n),e.appendChild(Co("Time Left"));const i=document.createElement("div");if(i.id="CMTooltipTime",e.appendChild(i),"b"===Xt){e.appendChild(Co("Production left till next achievement")),e.lastChild.id="CMTooltipProductionHeader";const t=document.createElement("div");t.id="CMTooltipProduction",e.appendChild(t)}}function bo(){L=Game.dragonAura,A=Game.dragonAura2}function ko(e){const t=Game.Achievements[e],o={};return o.name=t.name,o}function Go(e){const t=Game.Objects[e],o={cps:function(e){let t=1;return t*=function(e){let t=1;for(const o in e.tieredUpgrades)!Game.Tiers[e.tieredUpgrades[o].tier].special&&Xe(e.tieredUpgrades[o].name)&&(t*=2);for(const o in e.synergies)if(Xe(e.synergies[o].name)){const n=e.synergies[o];n.buildingTie1.name===e.name?t*=1+.05*n.buildingTie2.amount:n.buildingTie2.name===e.name&&(t*=1+.001*n.buildingTie1.amount)}if(e.fortune&&Xe(e.fortune.name)&&(t*=1.07),e.grandma&&Xe(e.grandma.name)&&(t*=1+.01*De.Grandma.amount*(1/(e.id-1))),"object"==typeof e.tieredUpgrades.misfortune&&1===e.vanilla&&Xe(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}(e),t*=Game.magicCpS(e.name),"function"==typeof e.baseCps?e.baseCps(e)*t:e.baseCPS*t}};return 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 vo(e){const t=Game.Upgrades[e],o={};return o.power=t.power,"function"==typeof t.power&&(t.power=function(){let e=2;if(Xe("Starlove")&&(e=3),Game.hasGod){const t=Qe("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 wo(){w=Game.UpgradesOwned,x=Game.pledges,T=Game.AchievementsOwned,M=Game.heavenlyPower,S=Game.prestige;for(const e of Object.keys(Game.Objects)){const t=Game.Objects[e];let o=De[e];void 0===o&&(De[e]=Go(e),o=De[e],so(e)),o.amount=t.amount,o.level=t.level,o.totalCookies=t.totalCookies,o.basePrice=t.basePrice,o.free=t.free,t.minigameLoaded&&(o.minigameLoaded=t.minigameLoaded,o.minigame=t.minigame),De[e]=o}for(const e of Object.keys(Game.Upgrades)){const t=Game.Upgrades[e];let o=Re[e];void 0===o&&(Re[e]=vo(e),o=Re[e]),o.bought=t.bought,Re[e]=o}for(const e of Object.keys(Game.Achievements)){const t=Game.Achievements[e];let o=He[e];void 0===o&&(He[e]=ko(e),o=He[e]),o.won=t.won,He[e]=o}bo(),B=L,P=A}function xo(e,t,o,n,i){let a=0;for(let r=0;r<i;r++){let i=t*Game.priceIncrease**Math.max(0,o-n);i=Game.modifyBuildingPrice(e,i),i=Math.ceil(i),a+=i,o++}return a}function To(e,t,o){const n=document.createElement("div");n.id=e;const i=document.createElement("div");i.style.minWidth=o,i.style.marginBottom="4px";const a=document.createElement("div");a.style.textAlign="left",a.textContent=t,i.appendChild(a),n.appendChild(i)}function Mo(){if(wo(),"none"!==l("tooltipAnchor").style.display&&l("CMTooltipArea")){l("CMTooltipArea").innerHTML="";const e=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(e),"b"===Xt?function(){if(1===W.TooltipBuildUpgrade&&1===Game.buyMode){let e;if(yo(l("CMTooltipBorder")),1===Game.buyMode?Ht=e:e=Ht,1===Game.buyBulk?e=ne:10===Game.buyBulk?e=ie:100===Game.buyBulk&&(e=ae),Vt=Game.Objects[Qt].bulkPrice,_t=e[Qt].bonus,1===W.TooltipBuildUpgrade&&1===Game.buyMode){l("CMTooltipIncome").textContent=eo(_t,2);const t=Math.round(_t/Game.cookiesPs*1e4);Number.isFinite(t)&&0!==t&&(l("CMTooltipIncome").textContent+=` (${t/100}% of income)`),l("CMTooltipBorder").className=Gt+e[Qt].color,l("CMTooltipPP").textContent=eo(e[Qt].pp,2),l("CMTooltipPP").className=Gt+e[Qt].color;const o=oo((Vt-(Game.cookies+ro()))/ao());l("CMTooltipTime").textContent=o.text,"Done!"===o.text&&Game.cookies<e[Qt].price?l("CMTooltipTime").textContent=`${o.text} (with Wrink)`:l("CMTooltipTime").textContent=o.text,l("CMTooltipTime").className=Gt+o.color}l("CMTooltipProductionHeader").style.display="none",l("CMTooltipTime").style.marginBottom="0px";for(const e of Object.keys(Game.Objects[Qt].productionAchievs))if(!Game.HasAchiev(Game.Objects[Qt].productionAchievs[e].achiev.name)){const t=Game.Objects[Qt].productionAchievs[e];l("CMTooltipTime").style.marginBottom="4px",l("CMTooltipProductionHeader").style.display="",l("CMTooltipProduction").className=`ProdAchievement${Qt}`,l("CMTooltipProduction").textContent=eo(t.pow-De[Qt].totalCookies,15),l("CMTooltipProduction").style.color="white";break}}else l("CMTooltipArea").style.display="none"}():"u"===Xt?function(){if(yo(l("CMTooltipBorder")),_t=pe[Game.UpgradesInStore[Qt].name].bonus,Vt=Game.Upgrades[Game.UpgradesInStore[Qt].name].getPrice(),qt=pe[Game.UpgradesInStore[Qt].name].bonusMouse,1===W.TooltipBuildUpgrade){l("CMTooltipIncome").textContent=eo(_t,2);const e=Math.round(_t/Game.cookiesPs*1e4);"0"!==l("CMTooltipIncome").textContent||"b"!==Xt&&"u"!==Xt?(Number.isFinite(e)&&0!==e&&(l("CMTooltipIncome").textContent+=` (${e/100}% of income)`),l("CMTooltipBorder").className=Gt+pe[Game.UpgradesInStore[Qt].name].color,qt&&(l("CMTooltipCookiePerClick").textContent=eo(qt),l("CMTooltipCookiePerClick").style.display="block",l("CMTooltipCookiePerClick").previousSibling.style.display="block"),0===_t&&qt?(l("CMTooltipPP").textContent=`${eo(Vt/qt)} Clicks`,l("CMTooltipPP").style.color="white"):(l("CMTooltipPP").textContent=eo(pe[Game.UpgradesInStore[Qt].name].pp,2),l("CMTooltipPP").className=Gt+pe[Game.UpgradesInStore[Qt].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 t=oo((Vt-(Game.cookies+ro()))/ao());if(l("CMTooltipTime").textContent=t.text,"Done!"===t.text&&Game.cookies<Game.UpgradesInStore[Qt].getPrice()?l("CMTooltipTime").textContent=`${t.text} (with Wrink)`:l("CMTooltipTime").textContent=t.text,l("CMTooltipTime").className=Gt+t.color,"Chocolate egg"===Game.UpgradesInStore[Qt].name){l("CMTooltipBorder").lastChild.style.marginBottom="4px",l("CMTooltipBorder").appendChild(Co("Cookies to be gained (Currently/Max)"));const e=document.createElement("div");e.style.color="white",e.textContent=`${eo(.05*Game.cookies)} / ${eo(oe)}`,l("CMTooltipBorder").appendChild(e)}}else l("CMTooltipArea").style.display="none"}():"s"===Xt?function(){if(1===W.TooltipLump){const t=l("CMTooltipBorder");t.appendChild(Co("Current Sugar Lump"));const o=document.createElement("div");o.id="CMTooltipTime",t.appendChild(o);const n=0===(e=Game.lumpCurrentType)?{text:"Normal",color:Pt}:1===e?{text:"Bifurcated",color:xt}:2===e?{text:"Golden",color:Tt}:3===e?{text:"Meaty",color:Mt}:4===e?{text:"Caramelized",color:Bt}:{text:"Unknown Sugar Lump",color:St};o.textContent=n.text,o.className=Gt+n.color}else l("CMTooltipArea").style.display="none";var e}():"g"===Xt?function(){const e=Game.Objects["Wizard tower"].minigame,t=e.getSpellCost(e.spellsById[Qt]);if(1===W.TooltipGrim&&t<=e.magicM){const o=l("CMTooltipBorder");o.appendChild(Co("Time Left"));const n=document.createElement("div");n.id="CMTooltipTime",o.appendChild(n);const i=oo(go(e.magic,e.magicM,t));if(n.textContent=i.text,n.className=Gt+i.color,t<=e.magic){o.appendChild(Co("Recover Time"));const n=document.createElement("div");n.id="CMTooltipRecover",o.appendChild(n);const i=oo(go(Math.max(0,e.magic-t),e.magicM,e.magic));n.textContent=i.text,n.className=Gt+i.color}if("0"===Qt){o.appendChild(Co("Cookies to be gained/lost"));const e=document.createElement("div");e.id="x",o.appendChild(e);const t=document.createElement("span");t.style.color="#33FF00",t.textContent=eo(Math.min(.15*(Game.cookies+ro()),60*q*30),2),e.appendChild(t);const n=document.createElement("span");n.textContent=" / ",e.appendChild(n);const i=document.createElement("span");i.style.color="red",i.textContent=eo(60*q*15,2),e.appendChild(i)}l("CMTooltipArea").appendChild(o)}else l("CMTooltipArea").style.display="none"}():"p"===Xt?function(){const e=Game.Objects.Farm.minigame;if(W.TooltipPlots&&0!==e.plot[Qt[1]][Qt[0]][0]){const t=e.plot[Qt[1]][Qt[0]][1]>e.plantsById[e.plot[Qt[1]][Qt[0]][0]-1].matureBase,o=e.plantsById[e.plot[Qt[1]][Qt[0]][0]-1].name;l("CMTooltipBorder").appendChild(Co("Reward (Current / Maximum)"));const n=document.createElement("div");n.id="CMTooltipPlantReward",l("CMTooltipBorder").appendChild(n),"Bakeberry"===o?l("CMTooltipPlantReward").textContent=`${t?eo(Math.min(.03*Game.cookies,60*Game.cookiesPs*30)):"0"} / ${eo(60*Game.cookiesPs*30)}`:"Chocoroot"===o||"White chocoroot"===o?l("CMTooltipPlantReward").textContent=`${t?eo(Math.min(.03*Game.cookies,60*Game.cookiesPs*3)):"0"} / ${eo(60*Game.cookiesPs*3)}`:"Queenbeet"===o?l("CMTooltipPlantReward").textContent=`${t?eo(Math.min(.04*Game.cookies,60*Game.cookiesPs*60)):"0"} / ${eo(60*Game.cookiesPs*60)}`:"Duketater"===o?l("CMTooltipPlantReward").textContent=`${t?eo(Math.min(.08*Game.cookies,60*Game.cookiesPs*120)):"0"} / ${eo(60*Game.cookiesPs*120)}`:l("CMTooltipArea").style.display="none"}else l("CMTooltipArea").style.display="none"}():"ha"===Xt&&function(){const e=Game.Objects.Farm.minigame;if(W.TooltipLump){l("CMTooltipBorder").appendChild(Co("Cookies gained from harvesting:"));let t=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(e.plot[n][i][0]>=1){const a=e.plot[n][i],r=e.plantsById[a[0]-1],l=r.name;let s=!0;o&&r.immortal&&(s=!1),a[1]<r.matureBase&&(s=!1),s&&"Bakeberry"===l?t+=Math.min(.03*Game.cookies,60*Game.cookiesPs*30):s&&"Chocoroot"===l||"White chocoroot"===l?t+=Math.min(.03*Game.cookies,60*Game.cookiesPs*3):s&&"Queenbeet"===l?t+=Math.min(.04*Game.cookies,60*Game.cookiesPs*60):s&&"Duketater"===l&&(t+=Math.min(.08*Game.cookies,60*Game.cookiesPs*120))}l("CMTooltipBorder").appendChild(document.createTextNode(eo(t)))}else l("CMTooltipArea").style.display="none"}(),function(){if("b"===Xt||"u"===Xt){null===document.getElementById("CMDispTooltipWarningParent")&&(l("tooltipAnchor").appendChild(function(){const e=document.createElement("div");e.style.position="absolute",e.style.display="block",e.style.left="auto",e.style.bottom="auto",e.id="CMDispTooltipWarningParent";const t=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=Gt+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 e.appendChild(t("CMDispTooltipWarnLucky",St,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Lucky!"',"CMDispTooltipWarnLuckyText")),e.firstChild.style.marginBottom="4px",e.appendChild(t("CMDispTooltipWarnLuckyFrenzy",Tt,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Lucky!" (Frenzy)',"CMDispTooltipWarnLuckyFrenzyText")),e.lastChild.style.marginBottom="4px",e.appendChild(t("CMDispTooltipWarnConjure",Bt,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods"',"CMDispTooltipWarnConjureText")),e.lastChild.style.marginBottom="4px",e.appendChild(t("CMDispTooltipWarnConjureFrenzy",Bt,"Warning: ",'Purchase of this item will put you under the number of Cookies required for "Conjure Baked Goods" (Frenzy)',"CMDispTooltipWarnConjureFrenzyText")),e.lastChild.style.marginBottom="4px",e.appendChild(t("CMDispTooltipWarnEdifice",Bt,"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")),e.lastChild.style.marginBottom="4px",e.appendChild(t("CMDispTooltipWarnUser",St,"Warning: ",`Purchase of this item will put you under the number of Cookies equal to ${W.ToolWarnUser} seconds of CPS`,"CMDispTooltipWarnUserText")),e}()),fo()),0===W.ToolWarnPos?l("CMDispTooltipWarningParent").style.right="0px":l("CMDispTooltipWarningParent").style.top=`${l("tooltip").offsetHeight}px`,l("CMDispTooltipWarningParent").style.width=l("tooltip").offsetWidth-6+"px";const e=Game.cookies+ro()-Vt,t=W.ToolWarnBon?_t:0;let o=D;if(1===W.ToolWarnBon){let e=_t;e/=ho(),o+=60*e*15/.15}if(1===W.ToolWarnLucky&&e<o&&("b"!==Xt||1===Game.buyMode)?(l("CMDispTooltipWarnLucky").style.display="",l("CMDispTooltipWarnLuckyText").textContent=`${eo(o-e)} (${to((o-e)/(ao()+t))})`):l("CMDispTooltipWarnLucky").style.display="none",1===W.ToolWarnLuckyFrenzy){const n=7*o;e<n&&("b"!==Xt||1===Game.buyMode)?(l("CMDispTooltipWarnLuckyFrenzy").style.display="",l("CMDispTooltipWarnLuckyFrenzyText").textContent=`${eo(n-e)} (${to((n-e)/(ao()+t))})`):l("CMDispTooltipWarnLuckyFrenzy").style.display="none"}else l("CMDispTooltipWarnLuckyFrenzy").style.display="none";if(1===W.ToolWarnConjure){const n=2*o;e<n&&("b"!==Xt||1===Game.buyMode)?(l("CMDispTooltipWarnConjure").style.display="",l("CMDispTooltipWarnConjureText").textContent=`${eo(n-e)} (${to((n-e)/(ao()+t))})`):l("CMDispTooltipWarnConjure").style.display="none"}else l("CMDispTooltipWarnConjure").style.display="none";if(1===W.ToolWarnConjureFrenzy){const n=2*o*7;e<n&&("b"!==Xt||1===Game.buyMode)?(l("CMDispTooltipWarnConjureFrenzy").style.display="",l("CMDispTooltipWarnConjureFrenzyText").textContent=`${eo(n-e)} (${to((n-e)/(ao()+t))})`):l("CMDispTooltipWarnConjureFrenzy").style.display="none"}else l("CMDispTooltipWarnConjureFrenzy").style.display="none";1===W.ToolWarnEdifice&&Game.Objects["Wizard tower"].minigameLoaded&&X&&e<X&&("b"!==Xt||1===Game.buyMode)?(l("CMDispTooltipWarnEdifice").style.display="",l("CMDispTooltipWarnEdificeText").textContent=`${eo(X-e)} (${to((X-e)/(ao()+t))})`):l("CMDispTooltipWarnEdifice").style.display="none",W.ToolWarnUser>0&&e<W.ToolWarnUser*ao()&&("b"!==Xt||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 ${W.ToolWarnUser} seconds of CPS`,l("CMDispTooltipWarnUserText").textContent=`${eo(W.ToolWarnUser*ao()-e)} (${to((W.ToolWarnUser*ao()-e)/(ao()+t))})`):l("CMDispTooltipWarnUser").style.display="none"}else null!==l("CMDispTooltipWarningParent")&&l("CMDispTooltipWarningParent").remove()}()}else null===l("CMTooltipArea")&&null!==l("CMDispTooltipWarningParent")&&l("CMDispTooltipWarningParent").remove()}function So(e,t){if("b"===e){if(l("tooltip").innerHTML=Game.Objects[t].tooltip(),1===W.TooltipAmor){const e=xo(Game.Objects[t],Game.Objects[t].basePrice,0,Game.Objects[t].free,Game.Objects[t].amount),o=e-Game.Objects[t].totalCookies;o>0&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split("so far</div>").join(`so far<br/>• <b>${eo(o)}</b> ${1===Math.floor(o)?"cookie":"cookies"} left to amortize (${oo((e-Game.Objects[t].totalCookies)/(Game.Objects[t].storedTotalCps*Game.globalCpsMult)).text})</div>`))}-1===Game.buyMode&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split(eo(Game.Objects[t].bulkPrice)).join(eo((Game.Objects[t],Game.Objects[t].basePrice,Game.Objects[t].amount,Game.Objects[t].free,Game.buyBulk,1))))}else if("u"===e){if(!Game.UpgradesInStore[t])return"";l("tooltip").innerHTML=Game.crateTooltip(Game.UpgradesInStore[t],"store")}else"s"===e?l("tooltip").innerHTML=Game.lumpTooltip():"g"===e?l("tooltip").innerHTML=Game.Objects["Wizard tower"].minigame.spellTooltip(t)():"p"===e?l("tooltip").innerHTML=Game.ObjectsById[2].minigame.tileTooltip(t[0],t[1])():"ha"===e&&(l("tooltip").innerHTML=Game.ObjectsById[2].minigame.toolTooltip(1)());if("b"===e&&1===Game.buyMode||"u"===e||"s"===e||"g"===e||"p"===e&&!Game.keys[16]||"ha"===e){const e=document.createElement("div");e.id="CMTooltipArea",l("tooltip").appendChild(e)}return Xt=e,Qt=t,Mo(),l("tooltip").innerHTML}function Bo(){if(Game.prefs.autosave&&Game.drawT%10==0&&"stats"===Game.onMenu&&W.Stats){const e=document.getElementById("CMStatsAutosaveTimer");e&&(e.innerText=Game.sayTime(60*Game.fps-Game.T%(60*Game.fps),4))}no(),io(),function(){if(1===W.TimerBar){const e=l("CMTimerBar").offsetWidth-163,t=l("CMTimerBar").offsetWidth-133;let o=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)*e/Game.shimmerTypes.golden.maxTime)}px`,W.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)*e/Game.shimmerTypes.golden.maxTime)}px`,W.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),o++),"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)*e/Game.shimmerTypes.reindeer.maxTime)}px`,W.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)*e/Game.shimmerTypes.reindeer.maxTime)}px`,W.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),o++):l("CMTimerBarRen").style.display="none";const n={};for(const e of Object.keys(Game.buffs))if(Game.buffs[e]){const i=lo(Game.buffs[e].name,Game.buffs[e].name,[{id:`${Game.buffs[e].name}Bar`}]);i.style.display="";let a="";a=void 0!==zt[Game.buffs[e].name]?zt[Game.buffs[e].name]:Bt,i.lastChild.children[1].className=vt+a,i.lastChild.children[1].style.color="black",2===W.TimerBarOverlay?i.lastChild.children[1].textContent=`${Math.round(Game.buffs[e].time/Game.buffs[e].maxTime*100)}%`:i.lastChild.children[1].textContent="",i.lastChild.children[1].style.width=`${Math.round(Game.buffs[e].time*(t-8*Math.ceil(Game.buffs[e].time/Game.fps).toString().length)/Game.buffs[e].maxTime)}px`,i.lastChild.children[2].textContent=Math.ceil(Game.buffs[e].time/Game.fps),o++,n[Game.buffs[e].name]=i}for(const e of Object.keys(n))l("CMTimerBar").appendChild(n[e]);0!==o&&(l("CMTimerBar").style.height=12*o+2+"px"),Kt!==o&&(Kt=o,uo())}}(),co(),Mo(),function(){if(1===W.TooltipWrink&&1===At){let e=!1;for(const t of Object.keys(Game.wrinklers)){const o=Game.wrinklers[t];if(o.phase>0&&o.selected){if(e=!0,0!==Ut[t]&&void 0!==Ut[t])break;{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)),jt=t,Ut[t]=1}}else Ut[t]=0}e||Game.tooltip.hide()}}(),function(){if(1===W.TooltipWrink&&null!==l("CMTooltipWrinkler")){let e=Game.wrinklers[jt].sucked,t=1.1;if(Game.Has("Sacrilegious corruption")&&(t*=1.05),1===Game.wrinklers[jt].type&&(t*=3),e*=t,Game.Has("Wrinklerspawn")&&(e*=1.05),De.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=eo(e)}}(),W.UpStats&&"stats"===Game.onMenu&&(Game.drawT-1)%(5*Game.fps)!=0&&(Game.drawT-1)%Game.fps==0&&Game.UpdateMenu()}class Po{constructor(e){this.maxLength=e,this.queue=[]}addLatest(e){this.queue.push(e)>this.maxLength&&this.queue.shift()}calcAverage(e){e>this.maxLength&&(e=this.maxLength),e>this.queue.length&&(e=this.queue.length);let t=0;for(let o=this.queue.length-1;o>=0&&o>this.queue.length-1-e;o--)t+=this.queue[o];return 0===t?0:t/e}}function Eo(){const o=Math.floor(Date.now()/1e3);if(Game.T/Game.fps%1==0){let r=Game.cookies+Ue;Game.cpsSucked>0&&(r+=re),Be=Math.max(Game.cookiesEarned,r),r*=.05;const l=o-s,y=Math.max(0,Game.cookies-c)/l,b=Math.max(0,re-d)/l,k=Math.max(0,se[0]-p)/l,G=Math.max(0,r-oe)/l,v=(Game.cookieClicks-u)/l;for(let o=0;o<l;o++)e.addLatest(y),t.addLatest(b),n.addLatest(k),i.addLatest(G),a.addLatest(v);s=o,c=Game.cookies,d=re,p=se[0],oe=r,u=Game.cookieClicks;const w=$t[W.AvgCPSHist];m=e.calcAverage(w),h=t.calcAverage(w),f=n.calcAverage(w),g=i.calcAverage(w),C=m,1===W.CalcWrink&&(C+=h),2===W.CalcWrink&&(C+=f);const x=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg");Pe=x||0===W.CalcWrink?m+h+(x?g:0):C,ue=a.calcAverage(It[W.AvgClicksHist])}}function No(e,t){let o="";return o=e.pp<=0||e.pp===1/0?Pt:e.pp<Fe?wt:e.pp===Fe?xt:e.pp===Le?St:e.pp>Le?Bt:e.pp>We?Mt:Tt,0!==Number(W.PPSecondsLowerLimit)&&t/ao()<Number(W.PPSecondsLowerLimit)&&(o=wt),W.PPOnlyConsiderBuyable&&t-Game.cookies>0&&(o=St),o}function Oo(e){for(const t of Object.keys(e))Game.cookiesPs?e[t].pp=Math.max(e[t].price-(Game.cookies+ro()),0)/Game.cookiesPs+e[t].price/e[t].bonus:e[t].pp=e[t].price/e[t].bonus,e[t].color=No(e[t],e[t].price)}function Fo(){!function(){if(Fe=1/0,Le=1,Ae=[],void 0===W.PPExcludeTop&&(W.PPExcludeTop=0),0===W.ColorPPBulkMode&&Game.buyMode>0){for(const e of Object.keys(ne))Game.cookiesPs?ne[e].pp=Math.max(Game.Objects[e].getPrice()-(Game.cookies+ro()),0)/Game.cookiesPs+Game.Objects[e].getPrice()/ne[e].bonus:ne[e].pp=Game.Objects[e].getPrice()/ne[e].bonus,Ae.push([ne[e].pp,Game.Objects[e].getPrice()]);if(Ae.sort(((e,t)=>e[0]-t[0])),W.PPOnlyConsiderBuyable)for(;Ae[0][1]>Game.cookies&&1!==Ae.length;)Ae.shift();Fe=Ae[W.PPExcludeTop][0],Le=Ae[Ae.length-1][0],We=(Le-Fe)/2+Fe;for(const e of Object.keys(ne)){ne[e].color=No(ne[e],Game.Objects[e].getPrice());for(let t=0;t<W.PPExcludeTop;t++)ne[e].pp===Ae[t][0]&&(ne[e].color=Pt)}Oo(ie),Oo(ae)}else if(Game.buyMode>0){let e;1===Game.buyBulk?e=ne:10===Game.buyBulk?e=ie:100===Game.buyBulk&&(e=ae);for(const t of Object.keys(e))Game.cookiesPs?e[t].pp=Math.max(Game.Objects[t].bulkPrice-(Game.cookies+ro()),0)/Game.cookiesPs+Game.Objects[t].bulkPrice/e[t].bonus:e[t].pp=Game.Objects[t].bulkPrice/e[t].bonus,Ae.push([e[t].pp,Game.Objects[t].bulkPrice]);if(Ae.sort(((e,t)=>e[0]-t[0])),W.PPOnlyConsiderBuyable)for(;Ae[0][1]>Game.cookies&&1!==Ae.length;)Ae.shift();Fe=Ae[W.PPExcludeTop][0],Le=Ae[Ae.length-1][0],We=(Le-Fe)/2+Fe;for(const t of Object.keys(ne)){e[t].color=No(e[t],Game.Objects[t].bulkPrice);for(let o=0;o<W.PPExcludeTop;o++)e[t].pp===Ae[o][0]&&(e[t].color=Pt)}}}(),function(){for(const e of Object.keys(pe))Game.cookiesPs?pe[e].pp=Math.max(Game.Upgrades[e].getPrice()-(Game.cookies+ro()),0)/Game.cookiesPs+Game.Upgrades[e].getPrice()/pe[e].bonus:pe[e].pp=Game.Upgrades[e].getPrice()/pe[e].bonus,Number.isNaN(pe[e].pp)&&(pe[e].pp=1/0),pe[e].color=No(pe[e],Game.Upgrades[e].getPrice())}()}function Wo(e){He[e]&&0===He[e].won&&(He[e].won=1,"shadow"!==Game.Achievements[e].pool&&T++)}function Lo(){O=0;let e=1;const t={};for(const e of Object.keys(Game.Objects))if(Game.Objects[e].minigameLoaded&&Game.Objects[e].minigame.effs){const o=Game.Objects[e].minigame.effs;for(const e in o)t[e]?t[e]*=o[e]:t[e]=o[e]}N=t,1!==Game.ascensionMode&&(e+=.01*parseFloat(S)*M*function(){let e=0;if(Xe("Heavenly chip secret")&&(e+=.05),Xe("Heavenly cookie stand")&&(e+=.2),Xe("Heavenly bakery")&&(e+=.25),Xe("Heavenly confectionery")&&(e+=.25),Xe("Heavenly key")&&(e+=.25),e*=1+.05*ze("Dragon God"),Xe("Lucky digit")&&(e*=1.01),Xe("Lucky number")&&(e*=1.01),Xe("Lucky payout")&&(e*=1.01),Game.hasGod){const t=Qe("creation");1===t?e*=.7:2===t?e*=.8:3===t&&(e*=.9)}return e}()),e*=_e("cps"),Xe("Heralds")&&1!==Game.ascensionMode&&(e*=1+.01*Game.heralds);for(const t of Object.keys(Game.cookieUpgrades)){const o=Game.cookieUpgrades[t];Xe(o.name)&&("function"==typeof o.power?e*=1+.01*Re[o.name].power(Re[o.name]):e*=1+.01*o.power)}Xe("Specialized chocolate chips")&&(e*=1.01),Xe("Designer cocoa beans")&&(e*=1.02),Xe("Underworld ovens")&&(e*=1.03),Xe("Exotic nuts")&&(e*=1.04),Xe("Arcane sugar")&&(e*=1.05),Xe("Increased merriness")&&(e*=1.15),Xe("Improved jolliness")&&(e*=1.15),Xe("A lump of coal")&&(e*=1.01),Xe("An itchy sweater")&&(e*=1.01),Xe("Santa's dominion")&&(e*=1.2),Xe("Fortune #100")&&(e*=1.01),Xe("Fortune #101")&&(e*=1.07),Xe("Dragon scale")&&(e*=1.03);let o=1;if(Qe){let t=Qe("asceticism");1===t?e*=1.15:2===t?e*=1.1:3===t&&(e*=1.05),t=Qe("ages"),1===t?e*=1+.15*Math.sin(Ie/1e3/10800*Math.PI*2):2===t?e*=1+.15*Math.sin(Ie/1e3/43200*Math.PI*2):3===t&&(e*=1+.15*Math.sin(Ie/1e3/86400*Math.PI*2)),t=Qe("decadence"),1===t?o*=.93:2===t?o*=.95:3===t&&(o*=.98),t=Qe("industry"),1===t?o*=1.1:2===t?o*=1.06:3===t&&(o*=1.03),t=Qe("labor"),1===t?o*=.97:2===t?o*=.98:3===t&&(o*=.99)}Xe("Santa's legacy")&&(e*=1+.03*(Game.santaLevel+1));const n=T/25;let i=1;if(Xe("Santa's milk and cookies")&&(i*=1.05),i*=1+.05*ze("Breath of Milk"),Qe){const e=Qe("mother");1===e?i*=1.1:2===e?i*=1.05:3===e&&(i*=1.03)}i*=_e("milk");let a=1;Xe("Kitten helpers")&&(a*=1+.1*n*i),Xe("Kitten workers")&&(a*=1+.125*n*i),Xe("Kitten engineers")&&(a*=1+.15*n*i),Xe("Kitten overseers")&&(a*=1+.175*n*i),Xe("Kitten managers")&&(a*=1+.2*n*i),Xe("Kitten accountants")&&(a*=1+.2*n*i),Xe("Kitten specialists")&&(a*=1+.2*n*i),Xe("Kitten experts")&&(a*=1+.2*n*i),Xe("Kitten consultants")&&(a*=1+.2*n*i),Xe("Kitten assistants to the regional manager")&&(a*=1+.175*n*i),Xe("Kitten marketeers")&&(a*=1+.15*n*i),Xe("Kitten analysts")&&(a*=1+.125*n*i),Xe("Kitten executives")&&(a*=1+.115*n*i),Xe("Kitten angels")&&(a*=1+.1*n*i),Xe("Fortune #103")&&(a*=1+.05*n*i);for(const e of Object.keys(De)){const t=De[e];let a=t.cps(t);1!==Game.ascensionMode&&(a*=(1+.01*t.level)*o),"Grandma"===t.name&&Xe("Milkhelp® lactose intolerance relief tablets")&&(a*=1+.05*n*i),O+=t.amount*a}Xe('"egg"')&&(O+=9),e*=a;let r=1;if(Xe("Chicken egg")&&(r*=1.01),Xe("Duck egg")&&(r*=1.01),Xe("Turkey egg")&&(r*=1.01),Xe("Quail egg")&&(r*=1.01),Xe("Robin egg")&&(r*=1.01),Xe("Ostrich egg")&&(r*=1.01),Xe("Cassowary egg")&&(r*=1.01),Xe("Salmon roe")&&(r*=1.01),Xe("Frogspawn")&&(r*=1.01),Xe("Shark egg")&&(r*=1.01),Xe("Turtle egg")&&(r*=1.01),Xe("Ant larva")&&(r*=1.01),Xe("Century egg")){let e=10*Math.floor(($e-Game.startDate)/1e3/10)/60/60/24;e=Math.min(e,100),ee=1+.1*(1-(1-e/100)**3),r*=ee}e*=r,Xe("Sugar baking")&&(e*=1+.01*Math.min(100,Game.lumps)),e*=1+ze("Radiant Appetite");const l=O*e;for(const e of Object.keys(Game.CpsAchievements))l>=Game.CpsAchievements[e].threshold&&Wo(Game.CpsAchievements[e].name);F=l;const s=Game.shimmerTypes.golden.n,c=ze("Dragon's Fortune");for(let t=0;t<s;t++)e*=1+1.23*c;const d=Game.bakeryName.toLowerCase();if("orteil"===d?e*=.99:"ortiel"===d&&(e*=.98),Xe("Elder Covenant")&&(e*=.95),Xe("Golden switch [off]")){let t=1.5;if(Xe("Residual luck")){const e=Game.goldenCookieUpgrades;for(const o of Object.keys(e))Xe(e[o])&&(t+=.1)}e*=t}if(Xe("Shimmering veil [off]")){let t=.5;Xe("Reinforced membrane")&&(t+=.1),e*=1+t}Xe("Magic shenanigans")&&(e*=1e3),Xe("Occult obstruction")&&(e*=0),O=Game.runModHookOnValue("cps",O),e*=ho(),O*=e}const Ao=["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"],jo=["Skull cookies","Ghost cookies","Bat cookies","Slime cookies","Pumpkin cookies","Eyeball cookies","Spider cookies"],Uo=["Christmas tree biscuits","Snowflake biscuits","Snowman biscuits","Holly biscuits","Candy cane biscuits","Bell biscuits","Present biscuits"],Do=["Pure heart biscuits","Ardent heart biscuits","Sour heart biscuits","Weeping heart biscuits","Golden heart biscuits","Eternal heart biscuits","Prism heart biscuits"],Ro=["Elderwort biscuits","Bakeberry cookies","Duketater cookies","Green yeast digestives","Wheat slims","Fern tea","Ichor syrup"];function Ho(e){return He[e]?He[e].won:0}function $o(){let e=0;for(const t of Object.keys(Game.GrandmaSynergies))Xe(Game.GrandmaSynergies[t])&&e++;!Ho("Elder")&&e>=7&&Wo("Elder"),!Ho("Veteran")&&e>=14&&Wo("Veteran");let t=0,o=1,n=1,i=1e5;for(const e of Object.keys(De))t+=De[e].amount,i=Math.min(De[e].amount,i),Ho("Mathematician")||De[e].amount<Math.min(128,2**(Game.ObjectsById.length-Game.Objects[e].id-1))&&(o=0),Ho("Base 10")||De[e].amount<10*(Game.ObjectsById.length-Game.Objects[e].id)&&(n=0);i>=1&&Wo("One with everything"),1===o&&Wo("Mathematician"),1===n&&Wo("Base 10"),i>=100&&Wo("Centennial"),i>=150&&Wo("Centennial and a half"),i>=200&&Wo("Bicentennial"),i>=250&&Wo("Bicentennial and a half"),i>=300&&Wo("Tricentennial"),i>=350&&Wo("Tricentennial and a half"),i>=400&&Wo("Quadricentennial"),i>=450&&Wo("Quadricentennial and a half"),i>=500&&Wo("Quincentennial"),i>=550&&Wo("Quincentennial and a half"),i>=600&&Wo("Sexcentennial"),t>=100&&Wo("Builder"),t>=500&&Wo("Architect"),t>=1e3&&Wo("Engineer"),t>=2e3&&Wo("Lord of Constructs"),t>=4e3&&Wo("Grand design"),t>=8e3&&Wo("Ecumenopolis"),w>=20&&Wo("Enhancer"),w>=50&&Wo("Augmenter"),w>=100&&Wo("Upgrader"),w>=200&&Wo("Lord of Progress"),w>=300&&Wo("The full picture"),w>=400&&Wo("When there's nothing left to add"),t>=4e3&&w>=300&&Wo("Polymath"),t>=8e3&&w>=400&&Wo("Renaissance baker"),De.Cursor.amount+De.Grandma.amount>=777&&Wo("The elder scrolls");let a=!0;for(const e of Object.keys(jo))Xe(jo[e])||(a=!1);a&&Wo("Spooky cookies");let r=!0;for(const e of Object.keys(Uo))Xe(Uo[e])||(r=!1);if(r&&Wo("Let it snow"),Xe("Fortune cookies")){const e=Game.Tiers.fortune.upgrades;let t=0;for(const o of Object.keys(e))Xe(e[o].name)&&t++;t>=e.length&&Wo("O Fortuna")}}function Io(e,t){wo(),De[e].amount+=t;const o=De[e];if("Cursor"===e)o.amount>=1&&Wo("Click"),o.amount>=2&&Wo("Double-click"),o.amount>=50&&Wo("Mouse wheel"),o.amount>=100&&Wo("Of Mice and Men"),o.amount>=200&&Wo("The Digital"),o.amount>=300&&Wo("Extreme polydactyly"),o.amount>=400&&Wo("Dr. T"),o.amount>=500&&Wo("Thumbs, phalanges, metacarpals"),o.amount>=600&&Wo("With her finger and her thumb"),o.amount>=700&&Wo("Gotta hand it to you"),o.amount>=800&&Wo("The devil's workshop");else for(const e in Game.Objects[o.name].tieredAchievs)o.amount>=Game.Tiers[Game.Objects[o.name].tieredAchievs[e].tier].achievUnlock&&Wo(Game.Objects[o.name].tieredAchievs[e].name);const n=T;return Lo(),$o(),n!==T&&Lo(),O-Game.cookiesPs}function zo(e){if("toggle"===Game.Upgrades[e].pool||0===Game.Upgrades[e].bought&&Game.Upgrades[e].unlocked&&"prestige"!==Game.Upgrades[e].pool){wo(),"Shimmering veil [on]"===Re[e].name?Re["Shimmering veil [off]"].bought=0:"Golden switch [on]"===Re[e].name?Re["Golden switch [off]"].bought=0:Re[e].bought=(Re[e].bought+1)%2,Re[e],Game.CountsAsUpgradeOwned(Game.Upgrades[e].pool)&&w++,"Elder Pledge"===e?(x++,x>0&&Wo("Elder nap"),x>=5&&Wo("Elder slumber")):"Elder Covenant"===e?Wo("Elder calm"):"Prism heart biscuits"===e?Wo("Lovely cookies"):"Heavenly key"===e&&Wo("Wholesome");const t=T;Lo(),$o(),t!==T&&Lo();const o=function(){let e=0;Xe("Thousand fingers")&&(e+=.1),Xe("Million fingers")&&(e*=5),Xe("Billion fingers")&&(e*=10),Xe("Trillion fingers")&&(e*=20),Xe("Quadrillion fingers")&&(e*=20),Xe("Quintillion fingers")&&(e*=20),Xe("Sextillion fingers")&&(e*=20),Xe("Septillion fingers")&&(e*=20),Xe("Octillion fingers")&&(e*=20),Xe("Nonillion fingers")&&(e*=20);let t=0;for(const e of Object.keys(De))t+=De[e].amount;t-=De.Cursor.amount,e*=t,Xe("Plastic mouse")&&(e+=.01*O),Xe("Iron mouse")&&(e+=.01*O),Xe("Titanium mouse")&&(e+=.01*O),Xe("Adamantium mouse")&&(e+=.01*O),Xe("Unobtainium mouse")&&(e+=.01*O),Xe("Eludium mouse")&&(e+=.01*O),Xe("Wishalloy mouse")&&(e+=.01*O),Xe("Fantasteel mouse")&&(e+=.01*O),Xe("Nevercrack mouse")&&(e+=.01*O),Xe("Armythril mouse")&&(e+=.01*O),Xe("Technobsidian mouse")&&(e+=.01*O),Xe("Plasmarble mouse")&&(e+=.01*O),Xe("Miraculite mouse")&&(e+=.01*O),Xe("Fortune #104")&&(e+=.01*O);let o=1;if(Xe("Santa's helpers")&&(o*=1.1),Xe("Cookie egg")&&(o*=1.1),Xe("Halo gloves")&&(o*=1.1),Xe("Dragon claw")&&(o*=1.03),Xe("Aura gloves")&&(o*=1+.05*Math.min(Game.Objects.Cursor.level,Xe("Luminous gloves")?20:10)),o*=_e("click"),De.Temple.minigameLoaded&&Qe){const e=Qe("labor");1===e?o*=1.15:2===e?o*=1.1:3===e&&(o*=1.05)}for(const e of Object.keys(Game.buffs))void 0!==Game.buffs[e].multClick&&(o*=Game.buffs[e].multClick);o*=1+.05*ze("Dragon Cursor");let n=o*Game.ComputeCps(1,Xe("Reinforced index finger")+Xe("Carpal tunnel prevention cream")+Xe("Ambidextrous"),e);return n=Game.runModHookOnValue("cookiesPerClick",n),Game.hasBuff("Cursed finger")&&(n=Game.buffs["Cursed finger"].power),n}()-Game.computedMouseCps;return o?[O-Game.cookiesPs,o]:[O-Game.cookiesPs]}return[]}function Vo(e,t){const o=[];for(const t of Object.keys(Game.Objects))o[t]={},o[t].bonus=Io(t,e),1!==e&&(k=1);return o}function _o(){for(const e of Object.keys(Game.Objects))ne[e].price=xo(Game.Objects[e],Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,1),ie[e].price=xo(Game.Objects[e],Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,10),ae[e].price=xo(Game.Objects[e],Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,100)}function Xo(){ne=Vo(1),ie=Vo(10),ae=Vo(100),function(){pe=[];for(const e of Object.keys(Game.Upgrades)){const t=zo(e);pe[e]={},t[0]&&(pe[e].bonus=t[0]),t[1]&&(pe[e].bonusMouse=t[1])}}()}function Qo(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;)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++;return[n,i,r]}function qo(){let e=60*q*60*6*Y;const t=ho();t>0?e/=t:e=0,ye=Qo(7,e,K),ge=2*ye[1]/K,Ce=ye[2]/60/60/6/Y,Ge=Qo(6,e,J),be=2*Ge[1]/J,ke=Ge[2]/60/60/6/Y,xe=Qo(7,7*e,K),ve=2*xe[1]/K,we=xe[2]/60/60/6/Y,Se=Qo(6,7*e,J),Te=2*Se[1]/J,Me=Se[2]/60/60/6/Y}function Yo(){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-y,i=Math.max(0,o-b)/n;for(let e=0;e<n;e++)r.addLatest(i);y=e,b=o,Z=r.calcAverage(5)}}function Ko(e){let t="crate upgrade missing";"prestige"===e.pool&&(t+=" heavenly");let o=0;Game.prefs.crates||(o=1),o&&(t+=" noFrame");let n=e.icon;e.iconFunction&&(n=e.iconFunction());const i=`function() {return Game.crateTooltip(Game.UpgradesById[${e.id}], 'stats');}`;return`<div class="${t}"\n\t${Game.getDynamicTooltip(i,"top",!0)}\n\tstyle = "${n[2]?`background-image: url(${n[2]});`:""}background-position:${48*-n[0]}px ${48*-n[1]}px;">\n\t</div>`}function Jo(){me="",fe="",he="";const e=[];for(const t of Object.keys(Game.Upgrades))e.push(Game.Upgrades[t]);e.sort((function(e,t){return e.order>t.order?1:e.order<t.order?-1:0}));for(const t of Object.keys(e)){const o=e[t];if(0===o.bought){let e="";e+=Ko(o),"prestige"===o.pool?he+=e:"cookie"===o.pool?fe+=e:"toggle"!==o.pool&&"unused"!==o.pool&&"debug"!==o.pool&&(me+=e)}}}function Zo(){if("christmas"===Game.season){let e=60*Game.cookiesPs;Game.hasBuff("Elder frenzy")&&(e*=.5),Game.hasBuff("Frenzy")&&(e*=.75),te=Math.max(25,e),Game.Has("Ho ho ho-flavored frosting")&&(te*=2)}}function en(){D=900*q/.15,D*=Y;const e=ho();e>0?D/=e:D=0,R=K*(.15*D)+13,H=J*(.15*D)+13,$=7*D,I=K*(.15*$)+13,z=J*(.15*$)+13,V=2*D,_=.15*V,X=0;let t=0,o=0;for(const e of Object.keys(Game.Objects))Game.Objects[e].amount>t&&(t=Game.Objects[e].amount),Game.Objects[e].amount>0&&o++;for(const e of Object.keys(Game.Objects))(Game.Objects[e].amount<t||1===o)&&Game.Objects[e].amount<400&&2*Game.Objects[e].price>X&&(X=2*Game.Objects[e].price,Q=e)}function tn(){let e=1,t=1,o=1;Xe("Green yeast digestives")&&(o*=1.01),Xe("Dragon fang")&&(o*=1.03),e*=1+.1*Game.auraMult("Ancestral Metamorphosis"),e*=Game.eff("goldenCookieGain"),t*=1+.1*Game.auraMult("Unholy Dominion"),t*=Game.eff("wrathCookieGain"),K=o*e,J=o*t,Y=1,0===Game.shimmerTypes.golden.n&&(Y*=1+1.23*Game.auraMult("Dragon's Fortune"))}function on(){for(let e=0;e<Game.wrinklers.length;e++){let t=Game.wrinklers[e].sucked,o=1.1;if(Game.Has("Sacrilegious corruption")&&(o*=1.05),1===Game.wrinklers[e].type&&(o*=3),t*=o,Game.Has("Wrinklerspawn")&&(t*=1.05),De.Temple.minigameLoaded){const e=Game.hasGod("scorn");1===e?t*=1.15:2===e?t*=1.1:3===e&&(t*=1.05)}re+=t,0===Game.wrinklers[e].type&&(le+=t,t>se[0]&&(se=[t,e]))}}function nn(){bo(),on(),en(),tn(),qo(),Jo(),Zo(),e=new Po($t[$t.length-1]),t=new Po($t[$t.length-1]),n=new Po($t[$t.length-1]),i=new Po($t[$t.length-1]),a=new Po(It[It.length-1]),r=new Po(5),Yo(),Eo(),Xo(),_o(),Fo()}const an={BotBar:1,TimerBar:1,TimerBarPos:0,TimerBarOverlay:2,BuildColor:1,BulkBuildColor:0,UpBarColor:1,UpgradeBarFixedPos:1,CalcWrink:0,CPSMode:1,AvgCPSHist:3,AvgClicksHist:0,ColorPPBulkMode:1,PPExcludeTop:0,PPSecondsLowerLimit:0,PPOnlyConsiderBuyable:0,ToolWarnBon:0,Title:1,GeneralSound:1,GCNotification:0,GCFlash:1,GCSound:1,GCVolume:100,GCSoundURL:"https://freesound.org/data/previews/66/66717_931655-lq.mp3",FortuneNotification:0,FortuneFlash:1,FortuneSound:1,FortuneVolume:100,FortuneSoundURL:"https://freesound.org/data/previews/174/174027_3242494-lq.mp3",SeaNotification:0,SeaFlash:1,SeaSound:1,SeaVolume:100,SeaSoundURL:"https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3",GardFlash:1,GardSound:1,GardVolume:100,GardSoundURL:"https://freesound.org/data/previews/103/103046_861714-lq.mp3",MagicNotification:0,MagicFlash:1,MagicSound:1,MagicVolume:100,MagicSoundURL:"https://freesound.org/data/previews/221/221683_1015240-lq.mp3",WrinklerNotification:0,WrinklerFlash:1,WrinklerSound:1,WrinklerVolume:100,WrinklerSoundURL:"https://freesound.org/data/previews/124/124186_8043-lq.mp3",WrinklerMaxNotification:0,WrinklerMaxFlash:1,WrinklerMaxSound:1,WrinklerMaxVolume:100,WrinklerMaxSoundURL:"https://freesound.org/data/previews/152/152743_15663-lq.mp3",TooltipBuildUpgrade:1,TooltipAmor:0,ToolWarnLucky:1,ToolWarnLuckyFrenzy:1,ToolWarnConjure:1,ToolWarnConjureFrenzy:1,ToolWarnEdifice:1,ToolWarnUser:0,ToolWarnPos:1,TooltipGrim:1,TooltipWrink:1,TooltipLump:1,TooltipPlots:1,DragonAuraInfo:1,TooltipAscendButton:1,Stats:1,MissingUpgrades:1,UpStats:1,TimeFormat:0,DetailedTime:1,GrimoireBar:1,HeavenlyChipsTarget:1,ShowMissedGC:1,Scale:2,ScaleDecimals:2,ScaleSeparator:0,ScaleCutoff:999999,Colors:{Blue:"#4bb8f0",Green:"#00ff00",Yellow:"#ffff00",Orange:"#ff7f00",Red:"#ff0000",Purple:"#ff00ff",Gray:"#b3b3b3",Pink:"#ff1493",Brown:"#8b4513"},SortBuildings:0,SortUpgrades:0,GCTimer:1,Favicon:1,WrinklerButtons:1,BulkBuyBlock:0,Header:{BarsColors:1,Calculation:1,Notification:1,NotificationGeneral:1,NotificationGC:1,NotificationFC:1,NotificationSea:1,NotificationGard:1,NotificationMagi:1,NotificationWrink:1,NotificationWrinkMax:1,Tooltip:1,Statistics:1,Notation:1,Miscellaneous:1,Lucky:1,Chain:1,Spells:1,Garden:1,Prestige:1,Wrink:1,Sea:1,Misc:1,InfoTab:1}},rn=function(e){if(1===e){const e=function(){try{Notification.requestPermission().then()}catch(e){return!1}return!0};"Notification"in window?e()?Notification.requestPermission().then():Notification.requestPermission():console.log("This browser does not support notifications.")}};function ln(){1===W.BotBar?(l("CMBotBar").style.display="",co()):l("CMBotBar").style.display="none",uo()}function sn(){BeautifyAll(),Game.RefreshStore(),Game.RebuildUpgrades(),co(),no(),io()}function cn(){let e="";for(let t=0;t<Ot.length;t++)e+=`.CMText${Ot[t]} { color: ${W.Colors[Ot[t]]}; }\n`;for(let t=0;t<Ot.length;t++)e+=`.CMBack${Ot[t]} { background-color: ${W.Colors[Ot[t]]}; }\n`;for(let t=0;t<Ot.length;t++)e+=`.CMBorder${Ot[t]} { border: 1px solid ${W.Colors[Ot[t]]}; }\n`;l("CMCSS").textContent=e,no()}function dn(){1===W.Favicon&&pt>0?Ee.wrath?l("CMFavicon").href="https://aktanusa.github.io/CookieMonster/favicon/wrathCookie.ico":l("CMFavicon").href="https://aktanusa.github.io/CookieMonster/favicon/goldenCookie.ico":l("CMFavicon").href="https://orteil.dashnet.org/cookieclicker/favicon.ico"}class pn{constructor(e,t){this.type=e,this.group=t}}class un extends pn{constructor(e,t,o,n,i,a=null){super(e,t),this.label=o,this.desc=n,this.toggle=i,a&&(this.func=a)}}class mn extends pn{constructor(e,t,o,n){super(e,t),this.label=o,this.desc=n;for(let e=0;e<101;e++)this.label[e]=`${e}%`}}class hn extends pn{constructor(e,t,o,n,i,a){super(e,t),this.label=o,this.desc=n,this.min=i,this.max=a}}const fn={BotBar:new un("bool","BarsColors",["Bottom Bar OFF","Bottom Bar ON"],"Building Information",!0,(function(){ln()})),TimerBar:new un("bool","BarsColors",["Timer Bar OFF","Timer Bar ON"],"Timers of Golden Cookie, Season Popup, Frenzy (Normal, Clot, Elder), Click Frenzy",!0,(function(){mo()})),TimerBarPos:new un("bool","BarsColors",["Timer Bar Position (Top Left)","Timer Bar Position (Bottom)"],"Placement of the Timer Bar",!1,(function(){0===W.TimerBarPos?(l("CMTimerBar").style.width="30%",l("CMTimerBar").style.bottom="",l("game").insertBefore(l("CMTimerBar"),l("sectionLeft"))):(l("CMTimerBar").style.width="100%",l("CMTimerBar").style.bottom="0px",l("wrapper").appendChild(l("CMTimerBar"))),uo()})),TimerBarOverlay:new un("bool","BarsColors",["Timer Bar Overlay OFF","Timer Bar Overlay Only Seconds","Timer Bar Overlay Full"],"Overlay on timers displaying seconds and/or percentage left",!0),SortBuildings:new un("bool","BarsColors",["Sort Buildings: Default","Sort Buildings: PP"],"Sort the display of buildings in either default order or by PP",!1,(function(){no()})),SortUpgrades:new un("bool","BarsColors",["Sort Upgrades: Default","Sort Upgrades: PP"],"Sort the display of upgrades in either default order or by PP",!1,(function(){io()})),BuildColor:new un("bool","BarsColors",["Building Colors OFF","Building Colors ON"],"Color code buildings",!0,(function(){no()})),BulkBuildColor:new un("bool","BarsColors",["Bulk Building Colors (Single Building Color)","Bulk Building Colors (Calculated Bulk Color)"],"Color code bulk buildings based on single buildings color or calculated bulk value color",!1,(function(){no()})),UpBarColor:new un("bool","BarsColors",["Upgrade Colors/Bar OFF","Upgrade Colors with Bar ON","Upgrade Colors without Bar ON"],"Color code upgrades and optionally add a counter bar",!1,(function(){1===W.UpBarColor?(l("CMUpgradeBar").style.display="",io()):2===W.UpBarColor?(l("CMUpgradeBar").style.display="none",io()):(l("CMUpgradeBar").style.display="none",Game.RebuildUpgrades())})),Colors:new class extends pn{constructor(e,t,o,n){super(e,t),this.desc=o,this.func=n}}("color","BarsColors",{Blue:"Color Blue. Used to show better than best PP building, for Click Frenzy bar, and for various labels",Green:"Color Green. Used to show best PP building, for Blood Frenzy bar, and for various labels",Yellow:"Color Yellow. Used to show between best and worst PP buildings closer to best, for Frenzy bar, and for various labels",Orange:"Color Orange. Used to show between best and worst PP buildings closer to worst, for Next Reindeer bar, and for various labels",Red:"Color Red. Used to show worst PP building, for Clot bar, and for various labels",Purple:"Color Purple. Used to show worse than worst PP building, for Next Cookie bar, and for various labels",Gray:"Color Gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar",Pink:"Color Pink. Used for Dragonflight bar",Brown:"Color Brown. Used for Dragon Harvest bar"},(function(){cn()})),UpgradeBarFixedPos:new un("bool","BarsColors",["Upgrade Bar Fixed Position OFF","Upgrade Bar Fixed Position ON"],"Lock the upgrade bar at top of the screen to prevent it from moving ofscreen when scrolling",!0,(function(){1===W.UpgradeBarFixedPos?(l("CMUpgradeBar").style.position="sticky",l("CMUpgradeBar").style.top="0px"):l("CMUpgradeBar").style.position=""})),CalcWrink:new un("bool","Calculation",["Calculate with Wrinklers OFF","Calculate with Wrinklers ON","Calculate with Single Fattest Wrinkler ON"],"Calculate times and average Cookies Per Second with (only the single non-shiny fattest) Wrinklers",!0),CPSMode:new un("bool","Calculation",["Current Cookies Per Second","Average Cookies Per Second"],"Calculate times using current Cookies Per Second or average Cookies Per Second",!1),AvgCPSHist:new un("bool","Calculation",["Average CPS for past 10s","Average CPS for past 15s","Average CPS for past 30s","Average CPS for past 1m","Average CPS for past 5m","Average CPS for past 10m","Average CPS for past 15m","Average CPS for past 30m"],"How much time average Cookies Per Second should consider",!1),AvgClicksHist:new un("bool","Calculation",["Average Cookie Clicks for past 1s","Average Cookie Clicks for past 5s","Average Cookie Clicks for past 10s","Average Cookie Clicks for past 15s","Average Cookie Clicks for past 30s"],"How much time average Cookie Clicks should consider",!1),ColorPPBulkMode:new un("bool","Calculation",["Color of PP (Compared to Single)","Color of PP (Compared to Bulk)"],"Color PP-values based on comparison with single purchase or with selected bulk-buy mode",!1,(function(){Fo()})),PPExcludeTop:new un("bool","Calculation",["Don't Ignore Any","Ignore 1st Best","Ignore 1st and 2nd Best","Ignore 1st, 2nd and 3rd Best"],"Makes CookieMonster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values",!0),PPSecondsLowerLimit:new hn("numscale","Calculation","Lower limit for PP (in seconds): ",'If a building or upgrade costs less than the specified seconds of CPS it will also be considered optimal and label it as such ("PP is less than xx seconds of CPS"); setting to 0 ignores this option',0,1/0),PPOnlyConsiderBuyable:new un("bool","Calculation",["Don't Ignore Non-Buyable","Ignore Non-Buyable"],"Makes CookieMonster label buildings and upgrades you can't buy right now red, useful in those situations where you just want to spend your full bank 'most optimally'",!0),ToolWarnBon:new un("bool","Calculation",["Calculate Tooltip Warning With Bonus CPS OFF","Calculate Tooltip Warning With Bonus CPS ON"],"Calculate the warning with or without the bonus CPS you get from buying",!0),Title:new un("bool","NotificationGeneral",["Title OFF","Title ON","Title Pinned Tab Highlight"],'Update title with Golden Cookie/Season Popup timers; pinned tab highlight only changes the title when a Golden Cookie/Season Popup spawns; "!" means that Golden Cookie/Reindeer can spawn',!0),GeneralSound:new un("bool","NotificationGeneral",["Consider Game Volume Setting OFF","Consider Game Volume Setting ON"],'Turning this toggle to "off" makes Cookie Monster no longer consider the volume setting of the base game, allowing mod notifications to play with base game volume turned down',!0),GCNotification:new un("bool","NotificationGC",["Notification OFF","Notification ON"],"Create a notification when Golden Cookie spawns",!0,(function(){rn(W.GCNotification)})),GCFlash:new un("bool","NotificationGC",["Flash OFF","Flash ON"],"Flash screen on Golden Cookie",!0),GCSound:new un("bool","NotificationGC",["Sound OFF","Sound ON"],"Play a sound on Golden Cookie",!0),GCVolume:new mn("vol","NotificationGC",[],"Volume"),GCSoundURL:new un("url","NotificationGC","Sound URL:","URL of the sound to be played when a Golden Cookie spawns"),FortuneNotification:new un("bool","NotificationFC",["Notification OFF","Notification ON"],"Create a notification when Fortune Cookie is on the Ticker",!0,(function(){rn(W.FortuneNotification)})),FortuneFlash:new un("bool","NotificationFC",["Flash OFF","Flash ON"],"Flash screen on Fortune Cookie",!0),FortuneSound:new un("bool","NotificationFC",["Sound OFF","Sound ON"],"Play a sound on Fortune Cookie",!0),FortuneVolume:new mn("vol","NotificationFC",[],"Volume"),FortuneSoundURL:new un("url","NotificationFC","Sound URL:","URL of the sound to be played when the Ticker has a Fortune Cookie"),SeaNotification:new un("bool","NotificationSea",["Notification OFF","Notification ON"],"Create a notification on Season Popup",!0,(function(){rn(W.SeaNotification)})),SeaFlash:new un("bool","NotificationSea",["Flash OFF","Flash ON"],"Flash screen on Season Popup",!0),SeaSound:new un("bool","NotificationSea",["Sound OFF","Sound ON"],"Play a sound on Season Popup",!0),SeaVolume:new mn("vol","NotificationSea",[],"Volume"),SeaSoundURL:new un("url","NotificationSea","Sound URL:","URL of the sound to be played when a Season Special spawns"),GardFlash:new un("bool","NotificationGard",["Garden Tick Flash OFF","Flash ON"],"Flash screen on Garden Tick",!0),GardSound:new un("bool","NotificationGard",["Sound OFF","Sound ON"],"Play a sound on Garden Tick",!0),GardVolume:new mn("vol","NotificationGard",[],"Volume"),GardSoundURL:new un("url","NotificationGard","Garden Tick Sound URL:","URL of the sound to be played when the garden ticks"),MagicNotification:new un("bool","NotificationMagi",["Notification OFF","Notification ON"],"Create a notification when magic reaches maximum",!0,(function(){rn(W.MagicNotification)})),MagicFlash:new un("bool","NotificationMagi",["Flash OFF","Flash ON"],"Flash screen when magic reaches maximum",!0),MagicSound:new un("bool","NotificationMagi",["Sound OFF","Sound ON"],"Play a sound when magic reaches maximum",!0),MagicVolume:new mn("vol","NotificationMagi",[],"Volume"),MagicSoundURL:new un("url","NotificationMagi","Sound URL:","URL of the sound to be played when magic reaches maxium"),WrinklerNotification:new un("bool","NotificationWrink",["Notification OFF","Notification ON"],"Create a notification when a Wrinkler appears",!0,(function(){rn(W.WrinklerNotification)})),WrinklerFlash:new un("bool","NotificationWrink",["Flash OFF","Flash ON"],"Flash screen when a Wrinkler appears",!0),WrinklerSound:new un("bool","NotificationWrink",["Sound OFF","Sound ON"],"Play a sound when a Wrinkler appears",!0),WrinklerVolume:new mn("vol","NotificationWrink",[],"Volume"),WrinklerSoundURL:new un("url","NotificationWrink","Sound URL:","URL of the sound to be played when a Wrinkler appears"),WrinklerMaxNotification:new un("bool","NotificationWrinkMax",["Notification OFF","Notification ON"],"Create a notification when the maximum amount of Wrinklers has appeared",!0,(function(){rn(W.WrinklerMaxNotification)})),WrinklerMaxFlash:new un("bool","NotificationWrinkMax",["Flash OFF","Flash ON"],"Flash screen when the maximum amount of Wrinklers has appeared",!0),WrinklerMaxSound:new un("bool","NotificationWrinkMax",["Sound OFF","Sound ON"],"Play a sound when the maximum amount of Wrinklers has appeared",!0),WrinklerMaxVolume:new mn("vol","NotificationWrinkMax",[],"Volume"),WrinklerMaxSoundURL:new un("url","NotificationWrinkMax","Sound URL:","URL of the sound to be played when the maximum amount of Wrinklers has appeared"),TooltipBuildUpgrade:new un("bool","Tooltip",["Building/Upgrade Tooltip Information OFF","Building/Upgrade Tooltip Information ON"],"Extra information in Building/Upgrade tooltips",!0),TooltipAmor:new un("bool","Tooltip",["Buildings Tooltip Amortization Information OFF","Buildings Tooltip Amortization Information ON"],"Add amortization information to buildings tooltip",!0),ToolWarnLucky:new un("bool","Tooltip",["Tooltip Lucky Warning OFF","Tooltip Lucky Warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Lucky!" rewards',!0),ToolWarnLuckyFrenzy:new un("bool","Tooltip",["Tooltip Lucky Frenzy Warning OFF","Tooltip Lucky Frenzy Warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Lucky!" (Frenzy) rewards',!0),ToolWarnConjure:new un("bool","Tooltip",["Tooltip Conjure Warning OFF","Tooltip Conjure Warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards',!0),ToolWarnConjureFrenzy:new un("bool","Tooltip",["Tooltip Conjure Frenzy Warning OFF","Tooltip Conjure Frenzy Warning ON"],'A warning when buying if it will put the bank under the amount needed for max "Conjure Baked Goods" rewards with Frenzy active',!0),ToolWarnEdifice:new un("bool","Tooltip",["Tooltip Edifice Warning OFF","Tooltip Edifice Warning ON"],'A warning when buying if it will put the bank under the amount needed for "Spontaneous Edifice" to possibly give you your most expensive building',!0),ToolWarnUser:new hn("numscale","Tooltip","Tooltip Warning At x times CPS: ","Use this to show a customized warning if buying it will put the bank under the amount equal to value times cps; setting to 0 disables the function altogether",0,1/0),ToolWarnPos:new un("bool","Tooltip",["Tooltip Warning Position (Left)","Tooltip Warning Position (Bottom)"],"Placement of the warning boxes",!1,(function(){fo()})),TooltipGrim:new un("bool","Tooltip",["Grimoire Tooltip Information OFF","Grimoire Tooltip Information ON"],"Extra information in tooltip for grimoire",!0),TooltipWrink:new un("bool","Tooltip",["Wrinkler Tooltip OFF","Wrinkler Tooltip ON"],"Shows the amount of cookies a wrinkler will give when popping it",!0),TooltipLump:new un("bool","Tooltip",["Sugar Lump Tooltip OFF","Sugar Lump Tooltip ON"],"Shows the current Sugar Lump type in Sugar lump tooltip.",!0),TooltipPlots:new un("bool","Tooltip",["Garden Plots Tooltip OFF","Garden Plots Tooltip ON"],"Shows a tooltip for plants that have a cookie reward.",!0),DragonAuraInfo:new un("bool","Tooltip",["Extra Dragon Aura Info OFF","Extra Dragon Aura Info ON"],"Shows information about changes in CPS and costs in the dragon aura interface.",!0),TooltipAscendButton:new un("bool","Tooltip",["Show Extra Info Ascend Tooltip OFF","Show Extra Info Ascend Tooltip ON"],"Shows additional info in the ascend tooltip",!0),Stats:new un("bool","Statistics",["Statistics OFF","Statistics ON"],"Extra Cookie Monster statistics!",!0),MissingUpgrades:new un("bool","Statistics",["Missing Upgrades OFF","Missing Upgrades ON"],"Shows Missing upgrades in Stats Menu. This feature can be laggy for users with a low amount of unlocked achievements.",!0),UpStats:new un("bool","Statistics",["Statistics Update Rate (Default)","Statistics Update Rate (1s)"],"Default Game rate is once every 5 seconds",!1),TimeFormat:new un("bool","Statistics",["Time XXd, XXh, XXm, XXs","Time XX:XX:XX:XX:XX"],"Change the time format",!1),DetailedTime:new un("bool","Statistics",["Detailed Time OFF","Detailed Time ON"],"Change how time is displayed in certain statistics and tooltips",!0,(function(){1===W.DetailedTime?Game.sayTime=Lt:Game.sayTime=kt.sayTime})),GrimoireBar:new un("bool","Statistics",["Grimoire Magic Meter Timer OFF","Grimoire Magic Meter Timer ON"],"A timer on how long before the Grimoire magic meter is full",!0),HeavenlyChipsTarget:new hn("numscale","Statistics","Heavenly Chips Target: ",'Use this to set a Heavenly Chips target that will be counted towards in the "prestige" statsistics sections',1,1/0),ShowMissedGC:new un("bool","Statistics",["Missed GC OFF","Missed GC ON"],"Show a stat in the statistics screen that counts how many Golden Cookies you have missed",!0),Scale:new un("bool","Notation",["Game's Setting Scale","Metric","Short Scale","Short Scale (Abbreviated)","Scientific Notation","Engineering Notation"],"Change how long numbers are handled",!1,(function(){sn()})),ScaleDecimals:new un("bool","Notation",["1 decimals","2 decimals","3 decimals"],"Set the number of decimals used when applicable",!1,(function(){sn()})),ScaleSeparator:new un("bool","Notation",[". for decimals (Standard)",". for thousands"],"Set the separator used for decimals and thousands",!1,(function(){sn()})),ScaleCutoff:new hn("numscale","Notation","Notation Cut-off Point: ","The number from which CookieMonster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations",1,999999999),GCTimer:new un("bool","Miscellaneous",["Golden Cookie Timer OFF","Golden Cookie Timer ON"],"A timer on the Golden Cookie when it has been spawned",!0,(function(){!function(){if(1===W.GCTimer)for(const e of Object.keys(Jt))Jt[e].style.display="block",Jt[e].style.left=je[e].l.style.left,Jt[e].style.top=je[e].l.style.top;else for(const e of Object.keys(Jt))Jt[e].style.display="none"}()})),Favicon:new un("bool","Miscellaneous",["Favicon OFF","Favicon ON"],"Update favicon with Golden/Wrath Cookie",!0,(function(){dn()})),WrinklerButtons:new un("bool","Miscellaneous",["Extra Buttons OFF","Extra Buttons ON"],"Show buttons for popping wrinklers at bottom of cookie section",!0,(function(){W.WrinklerButtons?(l("PopAllNormalWrinklerButton").style.display="",l("PopFattestWrinklerButton").style.display=""):(l("PopAllNormalWrinklerButton").style.display="none",l("PopFattestWrinklerButton").style.display="none")})),BulkBuyBlock:new un("bool","Miscellaneous",["Block Bulk Buying OFF","Block Bulk Buying ON"],"Block clicking bulk buying when you can't buy all. This prevents buying 7 of a building when you are in buy-10 or buy-100 mode.",!0)};function gn(){return JSON.stringify({settings:W,version:"2.031.5"})}function Cn(){if(j!==Game.dragonLevel||E){if(Game.dragonLevel<25&&Game.dragonLevels[Game.dragonLevel].buy.toString().includes("sacrifice")){let e=Game.dragonLevels[Game.dragonLevel].buy.toString().match(/Objects\[(.*)\]/)[1];const t=Game.dragonLevels[Game.dragonLevel].buy.toString().match(/sacrifice\((.*?)\)/)[1];if("i"!==e)if(e=e.replaceAll("'",""),Game.Objects[e].amount<t)U="Not enough buildings to sell";else{let o=0;wo();for(let n=0;n<t;n++){let t=De[e].basePrice*Game.priceIncrease**Math.max(0,De[e].amount-1-De[e].free);t=Game.modifyBuildingPrice(De[e],t),t=Math.ceil(t),o+=t,De[e].amount--}U=`Cost to rebuy: ${o}`}else{let o=0;wo();for(const n of Object.keys(Game.Objects)){if(e=n,Game.Objects[e].amount<t){U="Not enough buildings to sell";break}for(let n=0;n<t;n++){let t=De[e].basePrice*Game.priceIncrease**Math.max(0,De[e].amount-1-De[e].free);t=Game.modifyBuildingPrice(De[e],t),t=Math.ceil(t),o+=t,De[e].amount--}U=`Cost to rebuy: ${eo(o)}`}}}j=Game.dragonLevel}}function yn(){De=[];for(const e of Object.keys(Game.Objects))De[e]=Go(e);Re=[];for(const e of Object.keys(Game.Upgrades))Re[e]=vo(e);He=[];for(const e of Object.keys(Game.Achievements))He[e]=ko(e);wo()}let bn=!1;function kn(e,t){1===W[t]&&3===e&&!1===bn||1===e?(l("CMWhiteScreen").style.opacity="0.5",3===e?(l("CMWhiteScreen").style.display="inline",setTimeout((function(){kn(2,t)}),1e3/Game.fps)):setTimeout((function(){kn(0,t)}),1e3/Game.fps)):2===e?(l("CMWhiteScreen").style.opacity="1",setTimeout((function(){kn(1,t)}),1e3/Game.fps)):0===e&&(l("CMWhiteScreen").style.display="none")}function Gn(e,t,o){if(1===W[t]&&!1===bn){const t=new realAudio(e);W.GeneralSound?t.volume=W[o]/100*(Game.volume/100):t.volume=W[o]/100,t.play()}}function vn(e){const t=document.createElement("div");t.id=`GCTimer${e.id}`,t.style.width="96px",t.style.height="96px",t.style.position="absolute",t.style.zIndex="10000000001",t.style.textAlign="center",t.style.lineHeight="96px",t.style.fontFamily='"Kavoon", Georgia, serif',t.style.fontSize="35px",t.style.cursor="pointer",t.style.display="block",0===W.GCTimer&&(t.style.display="none"),t.style.left=e.l.style.left,t.style.top=e.l.style.top,t.onclick=function(){e.pop()},t.onmouseover=function(){e.l.style.filter="brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))",e.l.style.webkitFilter="brightness(125%) drop-shadow(0px 0px 3px rgba(255,255,255,1))"},t.onmouseout=function(){e.l.style.filter="",e.l.style.webkitFilter=""},Jt[e.id]=t,l("shimmers").appendChild(t)}function wn(e,t,o){1===W[e]&&"hidden"===document.visibilityState&&!1===bn&&new wn(t,{body:o,badge:"https://orteil.dashnet.org/cookieclicker/favicon.ico"})}function xn(){if(Yt!==Game.OnAscend&&(Yt=Game.OnAscend,Game.OnAscend?(l("game").style.bottom="0px",1===W.BotBar&&(l("CMBotBar").style.display="none"),1===W.TimerBar&&(l("CMTimerBar").style.display="none")):(ln(),mo()),po()),!Game.OnAscend&&0===Game.AscendTimer){et!==Object.keys(Game.mods).length&&(yn(),nn(),et=Object.keys(Game.mods).length),E&&(Xo(),Game.Has("Golden switch [off]")?(wo(),Re["Golden switch [off]"].bought=0,Lo(),q=O):q=Game.cookiesPs,tn(),en(),Jo(),qo(),Cn(),Zo(),function(){let e=0;if(Game.Objects.Bank.minigameLoaded){const t=Game.Objects.Bank.minigame.goods;let o=0;for(const e of Object.keys(t)){const n=t[e];o+=n.stock*n.val}e+=o*Game.cookiesPsRawHighest}e+=function(){let e=0;wo();let t=2;5!==B&&18!==B||--t,5!==P&&18!==P||--t,B=5,P=18;for(let e=0;e<t;++e){let e="Cursor";for(const t in De)De[t].amount>0&&(e=t);De[e].amount--,v--}for(const t of Object.keys(De)){const o=De[t];e+=Ye(Game.Objects[o.name],Game.Objects[t].basePrice,o.amount,Game.Objects[t].free,o.amount)}return e}(),Ue=e}(),E=0);const e=Game.auraMult("Fierce Hoarder")>0;!G&&e?(G=!0,k=1):G&&!e&&(G=!1,k=1),k&&(_o(),k=0),function(){on(),Fo(),function(){ce=0;let e=0;for(const t in Game.wrinklers)2===Game.wrinklers[t].phase&&e++;let t=1;if(De.Temple.minigameLoaded){const e=Game.hasGod("scorn");1===e?t*=1.15:2===e?t*=1.1:3===e&&(t*=1.05)}de=e,ce=e*(.05*e*1.1)*(.05*Game.Has("Sacrilegious corruption")+1)*(.05*Game.Has("Wrinklerspawn")+1)*t}(),Eo(),Yo();const e=Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset);Oe=to(e/ao())}(),function(){!function(){ht=0,je={};for(const e of Object.keys(Game.shimmers))je[Game.shimmers[e].id]=Game.shimmers[e],Game.shimmers[e].spawnLead&&"golden"===Game.shimmers[e].type&&(Ee=Game.shimmers[e],ht+=1)}();for(const e of Object.keys(Jt))void 0===je[e]&&(Jt[e].parentNode.removeChild(Jt[e]),delete Jt[e]);if(pt!==Game.shimmerTypes.golden.n){if(pt=Game.shimmerTypes.golden.n,pt){ut<ht&&(kn(3,"GCFlash"),Gn(W.GCSoundURL,"GCSound","GCVolume"),wn("GCNotification","Golden Cookie Spawned","A Golden Cookie has spawned. Click it now!"));for(const e of Object.keys(Game.shimmers))void 0===Jt[Game.shimmers[e].id]&&vn(Game.shimmers[e])}dn(),ut=ht,0===ht&&(Ee=0)}else if(1===W.GCTimer&&pt)for(const e of Object.keys(Jt))Jt[e].style.opacity=je[e].l.style.opacity,Jt[e].style.transform=je[e].l.style.transform,Jt[e].textContent=Math.ceil(je[e].life/Game.fps)}(),ct!==(Game.TickerEffect&&"fortune"===Game.TickerEffect.type)&&(ct=Game.TickerEffect&&"fortune"===Game.TickerEffect.type,ct&&(kn(3,"FortuneFlash"),Gn(CM.Options.FortuneSoundURL,"FortuneSound","FortuneVolume"),wn("FortuneNotification","Fortune Cookie found","A Fortune Cookie has appeared on the Ticker."))),function(){if(st!==Game.shimmerTypes.reindeer.spawned){st=Game.shimmerTypes.reindeer.spawned;for(const e of Object.keys(Game.shimmers))if(Game.shimmers[e].spawnLead&&"reindeer"===Game.shimmers[e].type){Ne=Game.shimmers[e];break}kn(3,"SeaFlash"),Gn(W.SeaSoundURL,"SeaSound","SeaVolume"),wn("SeaNotification","Reindeer sighted!","A Reindeer has spawned. Click it now!")}}(),Game.Objects.Farm.minigameLoaded&&dt!==Game.Objects.Farm.minigame.nextStep&&(0!==dt&&dt<Date.now()&&(kn(3,"GardFlash"),Gn(W.GardSoundURL,"GardSound","GardVolume")),dt=Game.Objects.Farm.minigame.nextStep),function(){if(Game.Objects["Wizard tower"].minigameLoaded&&1===W.GrimoireBar){const e=Game.Objects["Wizard tower"].minigame;e.magic<e.magicM?mt=!1:mt||(mt=!0,kn(3,"MagicFlash"),Gn(W.MagicSoundURL,"MagicSound","MagicVolume"),wn("MagicNotification","Magic Meter full","Your Magic Meter is full. Cast a spell!"))}}(),function(){if(Game.elderWrath>0){let e=0;for(const t in Game.wrinklers)2===Game.wrinklers[t].phase&&e++;e>ft?(ft=e,e===Game.getWrinklersMax()&&W.WrinklerMaxFlash?kn(3,"WrinklerMaxFlash"):kn(3,"WrinklerFlash"),e===Game.getWrinklersMax()&&W.WrinklerMaxSound?Gn(W.WrinklerMaxSoundURL,"WrinklerMaxSound","WrinklerMaxVolume"):Gn(W.WrinklerSoundURL,"WrinklerSound","WrinklerVolume"),e===Game.getWrinklersMax()&&W.WrinklerMaxNotification?wn("WrinklerMaxNotification","Maximum Wrinklers Reached","You have reached your maximum ammount of wrinklers"):wn("WrinklerNotification","A Wrinkler appeared","A new wrinkler has appeared")):ft=e}}()}}function Tn(){const e=b64_to_utf8(unescape(localStorage.getItem("CookieClickerGame")).split("!END!")[0]),t=e.match(/CookieMonster.*(;|$)/);if(null!==t){const o=e.replace(t[0],`CookieMonster:${gn()}`);localStorage.setItem("CookieClickerGame",escape(`${utf8_to_b64(o)}!END!`))}}function Mn(e){if(void 0!==localStorage.CMConfig&&delete localStorage.CMConfig,void 0!==e){W=e;let t=!1;for(const e in an)if(void 0===W[e])t=!0,W[e]=an[e];else if("Header"!==e&&"Colors"!==e)-1===e.indexOf("SoundURL")?W[e]>-1&&W[e]<fn[e].label.length||(t=!0,W[e]=an[e]):"string"!=typeof W[e]&&(t=!0,W[e]=an[e]);else if("Header"===e)for(const o in an.Header)void 0!==W[e][o]&&W[e][o]>-1&&W[e][o]<2||(t=!0,W[e][o]=an[e][o]);else for(const o in an.Colors)void 0!==W[e][o]&&"string"==typeof W[e][o]||(t=!0,W[e][o]=an[e][o]);t&&Tn(),xn();for(const e in an)"Header"!==e&&void 0!==fn[e].func&&fn[e].func()}else Mn(an)}function Sn(){for(const e of Object.keys(Game.wrinklers))Game.wrinklers[e].sucked>0&&0===Game.wrinklers[e].type&&(Game.wrinklers[e].hp=0)}function Bn(){if(Game.Objects["Wizard tower"].minigameLoaded)for(const e in Game.Objects["Wizard tower"].minigame.spellsById)null!==l(`grimoireSpell${e}`).onmouseover&&(yt[e]=l(`grimoireSpell${e}`).onmouseover,l(`grimoireSpell${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return So("g",`${e}`)}),"this"),Game.tooltip.wobble()})}function Pn(){if(!rt&&Game.Objects["Wizard tower"].minigameLoaded){const e=Game.Objects["Wizard tower"].minigame;it=e.draw,Game.Objects["Wizard tower"].minigame.draw=function(){it(),1===W.GrimoireBar&&e.magic<e.magicM&&(e.magicBarTextL.innerHTML+=` (${to(go(e.magic,e.magicM,e.magicM))})`)},rt=!0}}function En(){!function(){if(!at&&Game.Objects["Wizard tower"].minigameLoaded){const e=Game.Objects["Wizard tower"].minigame;ot=e.launch,nt=new Function(`return ${e.launch.toString().split("=this").join("= Game.Objects['Wizard tower'].minigame")}`),Game.Objects["Wizard tower"].minigame.launch=function(){nt(),Bn(),rt=!1,Pn(),at=!0}}}(),Pn()}var Nn=o(877),On=o.n(Nn);const Fn="CMConfig";function Wn(e){null!==l(`slider${e}`)&&(l(`slider${e}right`).innerHTML=`${l(`slider${e}`).value}%`,W[e]=Math.round(l(`slider${e}`).value)),Tn()}function Ln(e){W.Header[e]++,W.Header[e]>1&&(W.Header[e]=0),Tn()}function An(e,t){const o=document.createElement("div");o.className="title",o.style.padding="0px 16px",o.style.opacity="0.7",o.style.fontSize="17px",o.style.fontFamily='"Kavoon", Georgia, serif',o.appendChild(document.createTextNode(`${e} `));const n=document.createElement("span");return n.style.cursor="pointer",n.style.display="inline-block",n.style.height="14px",n.style.width="14px",n.style.borderRadius="7px",n.style.textAlign="center",n.style.backgroundColor="#C0C0C0",n.style.color="black",n.style.fontSize="13px",n.style.verticalAlign="middle",n.textContent=W.Header[t]?"-":"+",n.onclick=function(){Ln(t),Game.UpdateMenu()},o.appendChild(n),o}function jn(e,t,o,n){const i=document.createElement("div");i.className="listing";const a=document.createElement("b");if(a.textContent=t,i.appendChild(a),"withTooltip"===e){i.className="listing",i.appendChild(document.createTextNode(" "));const e=document.createElement("span");e.onmouseout=function(){Game.tooltip.hide()},e.onmouseover=function(){Game.tooltip.draw(this,escape(Ft[n].innerHTML))},e.style.cursor="default",e.style.display="inline-block",e.style.height="10px",e.style.width="10px",e.style.borderRadius="5px",e.style.textAlign="center",e.style.backgroundColor="#C0C0C0",e.style.color="black",e.style.fontSize="9px",e.style.verticalAlign="bottom",e.textContent="?",i.appendChild(e)}return i.appendChild(document.createTextNode(": ")),i.appendChild(o),i}function Un(e){const t=document.createDocumentFragment();t.appendChild(document.createTextNode(`${e.length} `));const o=document.createElement("span");o.onmouseout=function(){Game.tooltip.hide()};const n=document.createElement("div"),i=document.createElement("div");i.style.minWidth="140px",i.style.marginBottom="4px";const a=document.createElement("div");a.className="name",a.style.marginBottom="4px",a.style.textAlign="center",a.textContent="Missing",i.appendChild(a);for(const t of Object.keys(e)){const o=document.createElement("div");o.style.textAlign="center",o.appendChild(document.createTextNode(e[t])),i.appendChild(o)}return n.appendChild(i),o.onmouseover=function(){Game.tooltip.draw(this,escape(n.innerHTML))},o.style.cursor="default",o.style.display="inline-block",o.style.height="10px",o.style.width="10px",o.style.borderRadius="5px",o.style.textAlign="center",o.style.backgroundColor="#C0C0C0",o.style.color="black",o.style.fontSize="9px",o.style.verticalAlign="bottom",o.textContent="?",t.appendChild(o),t}function Dn(e){const t=document.createElement("div");if(t.className="subsection",t.appendChild(e),t.appendChild(An("Lucky Cookies","Lucky")),W.Header.Lucky&&t.appendChild(function(){const e=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder",t=document.createElement("div");t.className="CMStatsLuckySection";const o=Game.cookies+ro()<D?St:xt,n=Game.cookies+ro()<D?to((D-(Game.cookies+ro()))/ao()):"",i=document.createDocumentFragment(),a=document.createElement("span");if(a.style.fontWeight="bold",a.className=Gt+o,a.textContent=eo(D),i.appendChild(a),""!==n){const e=document.createElement("small");e.textContent=` (${n})`,i.appendChild(e)}t.appendChild(jn("withTooltip",'"Lucky!" Cookies Required',i,e));const r=Game.cookies+ro()<$?St:xt,l=Game.cookies+ro()<$?to(($-(Game.cookies+ro()))/ao()):"",s=document.createDocumentFragment(),c=document.createElement("span");if(c.style.fontWeight="bold",c.className=Gt+r,c.textContent=eo($),s.appendChild(c),""!==l){const e=document.createElement("small");e.textContent=` (${l})`,s.appendChild(e)}t.appendChild(jn("withTooltip",'"Lucky!" Cookies Required (Frenzy)',s,e));const d=R!==H,p=document.createElement("span");p.style.fontWeight="bold",p.className=Gt+R,p.textContent=eo(R)+(d?` / ${eo(H)}`:""),t.appendChild(jn("withTooltip",'"Lucky!" Reward (MAX)'+(d?" (Golden / Wrath)":""),p,e));const u=document.createElement("span");u.style.fontWeight="bold",u.className=Gt+u,u.textContent=eo(I)+(d?` / ${eo(z)}`:""),t.appendChild(jn("withTooltip",'"Lucky!" Reward (MAX) (Frenzy)'+(d?" (Golden / Wrath)":""),u,e));const m=Math.min(.15*(Game.cookies+ro()),q*Y*60*15)+13,h=document.createElement("span");return h.style.fontWeight="bold",h.className=Gt+h,h.textContent=eo(K*m)+(d?` / ${eo(J*m)}`:""),t.appendChild(jn("withTooltip",'"Lucky!" Reward (CUR)'+(d?" (Golden / Wrath)":""),h,e)),t}()),t.appendChild(An("Chain Cookies","Chain")),W.Header.Chain&&t.appendChild(function(){const e=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder",t=document.createElement("div");t.className="CMStatsChainSection";const o=Game.cookies+ro()<ge?St:xt,n=Game.cookies+ro()<ge?to((ge-(Game.cookies+ro()))/ao()):"",i=document.createDocumentFragment(),a=document.createElement("span");if(a.style.fontWeight="bold",a.className=Gt+o,a.textContent=eo(ge),i.appendChild(a),""!==n){const e=document.createElement("small");e.textContent=` (${n})`,i.appendChild(e)}t.appendChild(jn("withTooltip",'"Chain" Cookies Required',i,e));const r=Game.cookies+ro()<be?St:xt,l=Game.cookies+ro()<be?to((be-(Game.cookies+ro()))/ao()):"",s=document.createDocumentFragment(),c=document.createElement("span");if(c.style.fontWeight="bold",c.className=Gt+r,c.textContent=eo(be),s.appendChild(c),""!==l){const e=document.createElement("small");e.textContent=` (${l})`,s.appendChild(e)}t.appendChild(jn("withTooltip",'"Chain" Cookies Required (Wrath)',s,e));const d=Game.cookies+ro()<ve?St:xt,p=Game.cookies+ro()<ve?to((ve-(Game.cookies+ro()))/ao()):"",u=document.createDocumentFragment(),m=document.createElement("span");if(m.style.fontWeight="bold",m.className=Gt+d,m.textContent=eo(ve),u.appendChild(m),""!==p){const e=document.createElement("small");e.textContent=` (${p})`,u.appendChild(e)}t.appendChild(jn("withTooltip",'"Chain" Cookies Required (Frenzy)',u,e));const h=Game.cookies+ro()<Te?St:xt,f=Game.cookies+ro()<Te?to((Te-(Game.cookies+ro()))/ao()):"",g=document.createDocumentFragment(),C=document.createElement("span");if(C.style.fontWeight="bold",C.className=Gt+h,C.textContent=eo(Te),g.appendChild(C),""!==f){const e=document.createElement("small");e.textContent=` (${f})`,g.appendChild(e)}t.appendChild(jn("withTooltip",'"Chain" Cookies Required (Frenzy) (Wrath)',g,e)),t.appendChild(jn("withTooltip",'"Chain" Reward (MAX) (Golden / Wrath)',document.createTextNode(`${eo(ye[0])} / ${eo(Ge[0])}`),e)),t.appendChild(jn("withTooltip",'"Chain" Reward (MAX) (Frenzy) (Golden / Wrath)',document.createTextNode(`${eo(xe[0])} / ${eo(xe[0])}`),e));const y=Math.min(60*Game.cookiesPs*60*6*Y,.5*Game.cookies),b=Qo(7,y,K)[0],k=Qo(6,y,J)[0];return t.appendChild(jn("withTooltip",'"Chain" Reward (CUR) (Golden / Wrath)',document.createTextNode(`${eo(b)} / ${eo(k)}`),e)),t.appendChild(jn("withTooltip","CPS Needed For Next Level (G / W)",document.createTextNode(`${eo(Ce)} / ${eo(ke)}`),"ChainNextLevelPlaceholder")),t.appendChild(jn("withTooltip","CPS Needed For Next Level (Frenzy) (G / W)",document.createTextNode(`${eo(we)} / ${eo(Me)}`),"ChainNextLevelPlaceholder")),t}()),Game.Objects["Wizard tower"].minigameLoaded&&(t.appendChild(An("Spells","Spells")),W.Header.Spells&&t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsSpellsSection";const t=Game.cookies+ro()<V?St:xt,o=Game.cookies+ro()<V?to((V-(Game.cookies+ro()))/ao()):"",n=document.createDocumentFragment(),i=document.createElement("span");if(i.style.fontWeight="bold",i.className=Gt+t,i.textContent=eo(V),n.appendChild(i),""!==o){const e=document.createElement("small");e.textContent=` (${o})`,n.appendChild(e)}e.appendChild(jn("withTooltip",'"Conjure Baked Goods" Cookies Required',n,"GoldCookTooltipPlaceholder")),e.appendChild(jn("withTooltip",'"Conjure Baked Goods" Reward (MAX)',document.createTextNode(eo(_)),"GoldCookTooltipPlaceholder"));const a=Game.cookies+ro()<7*V?St:xt,r=Math.min(.15*(Game.cookies+ro()),60*q*30),l=Game.cookies+ro()<7*V?to((7*V-(Game.cookies+ro()))/ao()):"",s=document.createDocumentFragment(),c=document.createElement("span");if(c.style.fontWeight="bold",c.className=Gt+a,c.textContent=eo(7*V),s.appendChild(c),""!==l){const e=document.createElement("small");e.textContent=` (${l})`,s.appendChild(e)}return e.appendChild(jn("withTooltip",'"Conjure Baked Goods" Cookies Required (Frenzy)',s,"GoldCookTooltipPlaceholder")),e.appendChild(jn("withTooltip",'"Conjure Baked Goods" Reward (MAX) (Frenzy)',document.createTextNode(eo(7*_)),"GoldCookTooltipPlaceholder")),e.appendChild(jn("withTooltip",'"Conjure Baked Goods" Reward (CUR)',document.createTextNode(eo(r)),"GoldCookTooltipPlaceholder")),X&&e.appendChild(jn("withTooltip",'"Spontaneous Edifice" Cookies Required (most expensive building)',document.createTextNode(`${eo(X)} (${Q})`),"GoldCookTooltipPlaceholder")),e}())),Game.Objects.Farm.minigameLoaded&&(t.appendChild(An("Garden","Garden")),W.Header.Garden&&t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsGardenSection";const t=Game.cookies<60*Game.cookiesPs*30?St:xt,o=document.createElement("span");o.style.fontWeight="bold",o.className=Gt+t,o.textContent=eo(60*Game.cookiesPs*30),e.appendChild(jn("basic","Cookies required for max reward of Bakeberry: ",o));const n=Game.cookies<60*Game.cookiesPs*3?St:xt,i=document.createElement("span");i.style.fontWeight="bold",i.className=Gt+n,i.textContent=eo(60*Game.cookiesPs*3),e.appendChild(jn("basic","Cookies required for max reward of Chocoroot: ",i));const a=Game.cookies<60*Game.cookiesPs*60?St:xt,r=document.createElement("span");r.style.fontWeight="bold",r.className=Gt+a,r.textContent=eo(60*Game.cookiesPs*60),e.appendChild(jn("basic","Cookies required for max reward of Queenbeet: ",r));const l=Game.cookies<60*Game.cookiesPs*120?St:xt,s=document.createElement("span");return s.style.fontWeight="bold",s.className=Gt+l,s.textContent=eo(60*Game.cookiesPs*120),e.appendChild(jn("basic","Cookies required for max reward of Duketater: ",s)),e}())),t.appendChild(An("Prestige","Prestige")),W.Header.Prestige&&t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsPrestigeSection";const t=Math.floor(Game.HowMuchPrestige(Be+Game.cookiesReset+re+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")?oe:0)));e.appendChild(jn("withTooltip","Prestige Level (CUR / MAX)",document.createTextNode(`${eo(Game.prestige)} / ${eo(t)}`),"PrestMaxTooltipPlaceholder"));const o=Game.HowManyCookiesReset(t+1)-(Be+Game.cookiesReset+re+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")&&oe?oe:0)),n=document.createDocumentFragment();n.appendChild(document.createTextNode(eo(o)));const i=document.createElement("small");i.textContent=` (${to(o/Pe,1)})`,n.appendChild(i),e.appendChild(jn("withTooltip","Cookies To Next Level",n,"NextPrestTooltipPlaceholder")),e.appendChild(jn("withTooltip","Heavenly Chips (CUR / MAX)",document.createTextNode(`${eo(Game.heavenlyChips)} / ${eo(t-Game.prestige+Game.heavenlyChips)}`),"HeavenChipMaxTooltipPlaceholder")),e.appendChild(jn("basic","Heavenly Chips Per Second (last 5 seconds)",document.createTextNode(eo(Z,2))));const a=Number(W.HeavenlyChipsTarget);if(!Number.isNaN(a)){const t=a-Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));t>0&&(e.appendChild(jn("basic","Heavenly Chips To Target Set In Settings (CUR)",document.createTextNode(eo(t)))),e.appendChild(jn("basic","Time To Target (CUR, Current 5 Second Average)",document.createTextNode(to(t/Z)))))}const r=function(e){let t=Game.cookiesPs;wo(),0===Re["Heavenly key"].bought&&(Re["Heavenly chip secret"].bought=1,Re["Heavenly cookie stand"].bought=1,Re["Heavenly bakery"].bought=1,Re["Heavenly confectionery"].bought=1,Re["Heavenly key"].bought=1,Lo(),t=O,wo()),Be>=1e6&&Wo("Sacrifice"),Be>=1e9&&Wo("Oblivion"),Be>=1e12&&Wo("From scratch"),Be>=1e15&&Wo("Nihilism"),Be>=1e18&&Wo("Dematerialize"),Be>=1e21&&Wo("Nil zero zilch"),Be>=1e24&&Wo("Transcendence"),Be>=1e27&&Wo("Obliterate"),Be>=1e30&&Wo("Negative void"),Be>=1e33&&Wo("To crumbs, you say?"),Be>=1e36&&Wo("You get nothing"),Be>=1e39&&Wo("Humble rebeginnings"),Be>=1e42&&Wo("The end of the world"),Be>=1e45&&Wo("Oh, you're back"),Be>=1e48&&Wo("Lazarus"),Be>=1e51&&Wo("Smurf account"),Be>=1e54&&Wo("If at first you don't succeed"),Re["Heavenly chip secret"].bought=1,Re["Heavenly cookie stand"].bought=1,Re["Heavenly bakery"].bought=1,Re["Heavenly confectionery"].bought=1,Re["Heavenly key"].bought=1,S=e;const o=T;Lo(),$o(),o!==T&&Lo();const n=O-t;return S=Game.prestige,n}(t),l=document.createDocumentFragment();l.appendChild(document.createTextNode(eo(r)));const s=Math.round(r/Game.cookiesPs*1e4);if(Number.isFinite(s)&&0!==s){const e=document.createElement("small");e.textContent=` (${s/100}% of income)`,l.appendChild(e)}e.appendChild(jn("withTooltip","Reset Bonus Income",l,"ResetTooltipPlaceholder"));const c=Math.floor(Game.HowMuchPrestige(Game.cookiesReset)),d=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)),p=d-c;if(!Game.Has("Lucky digit")){let t=7-d%10;t<0&&(t+=10);const o=p+t,n=d+t,i=document.createDocumentFragment();i.appendChild(document.createTextNode(`${n.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(jn("basic",'Next "Lucky Digit" (total / reset)',i))}if(!Game.Has("Lucky number")){let t=777-d%1e3;t<0&&(t+=1e3);const o=p+t,n=d+t,i=document.createDocumentFragment();i.appendChild(document.createTextNode(`${n.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(jn("basic",'Next "Lucky Number" (total / reset)',i))}if(!Game.Has("Lucky payout")){let t=777777-d%1e6;t<0&&(t+=1e6);const o=p+t,n=d+t,i=document.createDocumentFragment();i.appendChild(document.createTextNode(`${n.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(jn("basic",'Next "Lucky Payout" (total / reset)',i))}return e}()),Game.cpsSucked>0&&(t.appendChild(An("Wrinklers","Wrink")),W.Header.Wrink)){const e=document.createDocumentFragment();e.appendChild(document.createTextNode(`${eo(re)} / ${eo(le)} `));const o=document.createElement("a");o.textContent="Pop All Normal",o.className="option",o.onclick=function(){Sn()},e.appendChild(o),t.appendChild(jn("basic","Rewards of Popping (All/Normal)",e));const n=document.createDocumentFragment();n.appendChild(document.createTextNode(`${eo(se[0])} `));const i=document.createElement("a");i.textContent="Pop Single Fattest",i.className="option",i.onclick=function(){null!==se[1]&&(Game.wrinklers[se[1]].hp=0)},n.appendChild(i),t.appendChild(jn("basic",`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${null!==se[1]?se[1]:"None"})`,n))}let o=!1;const n=[];for(const e of Object.keys(jo))Game.Has(jo[e])||(n.push(jo[e]),o=!0);const i=[];for(const e of Object.keys(Uo))Game.Has(Uo[e])||(i.push(Uo[e]),o=!0);const a=[];for(const e of Object.keys(Do))Game.Has(Do[e])||(a.push(Do[e]),o=!0);const r=[];for(const e of Object.keys(Game.eggDrops))Game.HasUnlocked(Game.eggDrops[e])||(r.push(Game.eggDrops[e]),o=!0);const s=[];for(const e of Object.keys(Game.rareEggDrops))Game.HasUnlocked(Game.rareEggDrops[e])||(s.push(Game.rareEggDrops[e]),o=!0);const c=[];for(const e of Object.keys(Ro))Game.HasUnlocked(Ro[e])||(c.push(Ro[e]),o=!0);const d=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg"),p=Game.Has("Century egg");if(("christmas"===Game.season||o||d||p)&&(t.appendChild(An("Season Specials","Sea")),W.Header.Sea&&(0!==n.length&&t.appendChild(jn("basic","Halloween Cookies Left to Buy",Un(n))),0!==i.length&&t.appendChild(jn("basic","Christmas Cookies Left to Buy",Un(i))),0!==a.length&&t.appendChild(jn("basic","Valentine Cookies Left to Buy",Un(a))),0!==r.length&&t.appendChild(jn("basic","Normal Easter Eggs Left to Unlock",Un(r))),0!==s.length&&t.appendChild(jn("basic","Rare Easter Eggs Left to Unlock",Un(s))),0!==c.length&&t.appendChild(jn("basic","Rare Plant Drops Left to Unlock",Un(c))),"christmas"===Game.season&&t.appendChild(jn("basic","Reindeer Reward",document.createTextNode(eo(te)))),d&&t.appendChild(jn("withTooltip","Chocolate Egg Cookies",document.createTextNode(eo(oe)),"ChoEggTooltipPlaceholder")),p&&t.appendChild(jn("basic","Century Egg Multiplier",document.createTextNode(Math.round(1e4*(ee-1))/100+"%"))))),t.appendChild(An("Miscellaneous","Misc")),W.Header.Misc){if(t.appendChild(jn("basic",`Average Cookies Per Second (Past ${$t[W.AvgCPSHist]<60?`${$t[W.AvgCPSHist]} seconds`:$t[W.AvgCPSHist]/60+(3===W.AvgCPSHist?" minute":" minutes")})`,document.createTextNode(eo(ao(),3)))),t.appendChild(jn("basic",`Average Cookie Clicks Per Second (Past ${It[W.AvgClicksHist]}${0===W.AvgClicksHist?" second":" seconds"})`,document.createTextNode(eo(ue,1)))),Game.Has("Fortune cookies")){const e=[];for(const t of Object.keys(Ao))Game.Has(Ao[t])||e.push(Ao[t]);0!==e.length&&t.appendChild(jn("basic","Fortune Upgrades Left to Buy",Un(e)))}if(W.ShowMissedGC&&t.appendChild(jn("basic","Missed Golden Cookies",document.createTextNode(eo(Game.missedGoldenClicks)))),Game.prefs.autosave){const e=document.createElement("span");e.id="CMStatsAutosaveTimer",e.innerText=Game.sayTime(60*Game.fps-(Game.OnAscend?0:Game.T%(60*Game.fps)),4),t.appendChild(jn("basic","Time till autosave",e))}}l("menu").insertBefore(t,l("menu").childNodes[2]),W.MissingUpgrades&&function(){for(const e of l("menu").children)if(e.children[0])if("Prestige"===e.children[0].innerHTML&&he){const t=he.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesPrestigeTitle",o.className="listing";const n=document.createElement("div");n.innerHTML=`<b>Missing Prestige upgrades:</b> ${t}/${Game.PrestigeUpgrades.length} (${Math.floor(t/Game.PrestigeUpgrades.length*100)}%)`,o.appendChild(n),e.appendChild(o);const i=document.createElement("div");i.className="listing crateBox",i.innerHTML=he,e.appendChild(i)}else if("Upgrades"===e.children[0].innerHTML){if(me){const t=me.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesTitle",o.className="listing";const n=document.createElement("div");n.innerHTML=`<b>Missing normal upgrades:</b> ${t}/${Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length} (${Math.floor(t/(Game.UpgradesByPool[""].length+Game.UpgradesByPool.tech.length)*100)}%)`,o.appendChild(n),e.insertBefore(o,e.childNodes[3]);const i=document.createElement("div");i.className="listing crateBox",i.innerHTML=me,e.insertBefore(i,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(fe){const t=fe.match(new RegExp("div","g")||0).length/2,o=document.createElement("div");o.id="CMMissingUpgradesCookiesTitle",o.className="listing";const n=document.createElement("div");n.innerHTML=`<b>Missing Cookie upgrades:</b> ${t}/${Game.UpgradesByPool.cookie.length} (${Math.floor(t/Game.UpgradesByPool.cookie.length*100)}%)`,o.appendChild(n),e.appendChild(o);const i=document.createElement("div");i.className="listing crateBox",i.innerHTML=fe,e.appendChild(i)}}}()}const Rn={BarsColors:"Bars/Colors",Calculation:"Calculation",Notification:"Notification",Tooltip:"Tooltips and additional insights",Statistics:"Statistics",Notation:"Notation",Miscellaneous:"Miscellaneous"},Hn={NotificationGeneral:"General Notifications",NotificationGC:"Golden Cookie",NotificationFC:"Fortune Cookie",NotificationSea:"Season Special",NotificationGard:"Garden Tick",NotificationMagi:"Full Magic Bar",NotificationWrink:"Wrinkler",NotificationWrinkMax:"Maximum Wrinklers"};function $n(e,t){const o=document.createElement("div");o.className="title",o.style.opacity="0.7",o.style.fontSize="17px",o.appendChild(document.createTextNode(`${t} `));const n=document.createElement("span");return n.style.cursor="pointer",n.style.display="inline-block",n.style.height="14px",n.style.width="14px",n.style.borderRadius="7px",n.style.textAlign="center",n.style.backgroundColor="#C0C0C0",n.style.color="black",n.style.fontSize="13px",n.style.verticalAlign="middle",n.textContent=W.Header[e]?"-":"+",n.onclick=function(){Ln(e),Game.UpdateMenu()},o.appendChild(n),o}function In(e){const t=document.createElement("div");if(t.className="listing","bool"===fn[e].type){const o=document.createElement("a");fn[e].toggle&&0===W[e]?o.className="option off":o.className="option",o.id=Fn+e,o.onclick=function(){!function(e){W[e]++,W[e]===fn[e].label.length?(W[e]=0,fn[e].toggle&&(l(Fn+e).className="option off")):l(Fn+e).className="option",void 0!==fn[e].func&&fn[e].func(),l(Fn+e).innerHTML=fn[e].label[W[e]],Tn()}(e)},o.textContent=fn[e].label[W[e]],t.appendChild(o);const n=document.createElement("label");return n.textContent=fn[e].desc,t.appendChild(n),t}if("vol"===fn[e].type){const o=document.createElement("div");o.className="sliderBox";const n=document.createElement("div");n.style.float="left",n.innerHTML=fn[e].desc,o.appendChild(n);const i=document.createElement("div");i.id=`slider${e}right`,i.style.float="right",i.innerHTML=`${W[e]}%`,o.appendChild(i);const a=document.createElement("input");return a.className="slider",a.id=`slider${e}`,a.style.clear="both",a.type="range",a.min="0",a.max="100",a.step="1",a.value=W[e],a.oninput=function(){Wn(e)},a.onchange=function(){Wn(e)},o.appendChild(a),t.appendChild(o),t}if("url"===fn[e].type){const o=document.createElement("span");o.className="option",o.textContent=`${fn[e].label} `,t.appendChild(o);const n=document.createElement("input");n.id=Fn+e,n.className="option",n.type="text",n.readOnly=!0,n.setAttribute("value",W[e]),n.style.width="300px",t.appendChild(n),t.appendChild(document.createTextNode(" "));const i=document.createElement("input");i.id=`${Fn+e}Prompt`,i.className="option",i.type="text",i.setAttribute("value",W[e]);const a=document.createElement("a");a.className="option",a.onclick=function(){Game.Prompt(i.outerHTML,[["Save",function(){W[`${e}`]=l(`CMConfig${e}Prompt`).value,Tn(),Game.ClosePrompt(),Game.UpdateMenu()}],"Cancel"])},a.textContent="Edit",t.appendChild(a);const r=document.createElement("label");return r.textContent=fn[e].desc,t.appendChild(r),t}if("color"===fn[e].type){t.className="";for(let e=0;e<Ot.length;e++){const o=document.createElement("div");o.className="listing";const n=document.createElement("input");n.id=Ot[e],n.style.width="65px",n.setAttribute("value",W.Colors[Ot[e]]),o.appendChild(n),new Nn(n,{hash:!0,position:"right",onInput:function(){W.Colors[this.targetElement.id]=this.toHEXString(),cn(),Tn(),Game.UpdateMenu()}});const i=document.createElement("label");i.textContent=fn.Colors.desc[Ot[e]],o.appendChild(i),t.appendChild(o)}return On().init(),t}if("numscale"===fn[e].type){const o=document.createElement("span");o.className="option",o.textContent=`${fn[e].label} `,t.appendChild(o);const n=document.createElement("input");n.id=Fn+e,n.className="option",n.type="number",n.value=W[e],n.min=fn[e].min,n.max=fn[e].max,n.oninput=function(){this.value>this.max&&console.log("TEST"),W[e]=this.value,Tn(),sn()},t.appendChild(n),t.appendChild(document.createTextNode(" "));const i=document.createElement("label");return i.textContent=fn[e].desc,t.appendChild(i),t}return t}function zn(e){if(1===W.TimerBar&&0===W.TimerBarPos){const t=parseInt(l("CMTimerBar").style.height,10);Game.mouseY-=t,e(),Game.mouseY+=t}else e()}function Vn(){kt.Beautify=Beautify,Beautify=eo,kt.CalculateGains=Game.CalculateGains,Game.CalculateGains=function(){kt.CalculateGains(),E=1,Ie=Date.now(),$e=Date.now()},kt.tooltip={},kt.tooltip.draw=Game.tooltip.draw,kt.tooltip.drawMod=new Function(`return ${Game.tooltip.draw.toString().split("this").join("Game.tooltip")}`)(),Game.tooltip.draw=function(e,t,o){kt.tooltip.drawMod(e,t,o)},kt.tooltip.update=Game.tooltip.update,kt.tooltip.updateMod=new Function(`return ${Game.tooltip.update.toString().split("this.").join("Game.tooltip.")}`)(),Game.tooltip.update=function(){kt.tooltip.updateMod(),function(){if("store"===Game.tooltip.origin){let e=0;1===W.ToolWarnLucky&&1===W.ToolWarnPos&&null!==l("CMDispTooltipWarningParent")&&(e=l("CMDispTooltipWarningParent").clientHeight-4),Game.tooltip.tta.style.top=`${Math.min(parseInt(Game.tooltip.tta.style.top,10),l("game").clientHeight+l("topBar").clientHeight-Game.tooltip.tt.clientHeight-e-46)}px`}}()},kt.UpdateWrinklers=Game.UpdateWrinklers,Game.UpdateWrinklers=function(){zn(kt.UpdateWrinklers)},kt.UpdateSpecial=Game.UpdateSpecial,Game.UpdateSpecial=function(){zn(kt.UpdateSpecial)},l("bigCookie").removeEventListener("click",Game.ClickCookie,!1),l("bigCookie").addEventListener("click",(function(){zn(Game.ClickCookie)}),!1),kt.RebuildUpgrades=Game.RebuildUpgrades,Game.RebuildUpgrades=function(){kt.RebuildUpgrades(),function(){bt=[];for(const e of Object.keys(Game.UpgradesInStore))null!==l(`upgrade${e}`).onmouseover&&(bt[e]=l(`upgrade${e}`).onmouseover,l(`upgrade${e}`).onmouseover=function(){Game.mouseDown||(Game.setOnCrate(this),Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return So("u",`${e}`)}),"store"),Game.tooltip.wobble())})}(),Game.CalculateGains()},kt.ClickProduct=Game.ClickProduct,Game.ClickProduct=function(e){(!W.BulkBuyBlock||Game.ObjectsById[e].bulkPrice<Game.cookies||-1===Game.buyMode)&&kt.ClickProduct(e)},kt.DescribeDragonAura=Game.DescribeDragonAura,Game.DescribeDragonAura=function(e){kt.DescribeDragonAura(e),function(e){if(1===W.DragonAuraInfo){const[t,o]=function(e){wo(),l("promptContent").children[0].innerHTML.includes("secondary")?P=e:B=e;let t=0;if(B!==L||P!==A)for(let e=Game.ObjectsById.length-1;e>-1;--e)if(Game.ObjectsById[e-1].amount>0){const o=De[Game.ObjectsById[e].name].name;De[o].amount-=1,v-=1,t=De[o].basePrice*Game.priceIncrease**Math.max(0,De[o].amount-1-De[o].free),t=Game.modifyBuildingPrice(De[o],t),t=Math.ceil(t);break}const o=T;return Lo(),$o(),o!==T&&Lo(),[O-Game.cookiesPs,t]}(e),n=to(o/(t+Game.cookiesPs)),i=eo(t/Game.cookiesPs);l("dragonAuraInfo").style.minHeight="60px",l("dragonAuraInfo").style.margin="8px",l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";const a=document.createElement("div");a.style.minWidth="200px",a.style.textAlign="center",a.textContent=`Picking this aura will change CPS by ${eo(t)} (${i}% of current CPS).`,l("dragonAuraInfo").appendChild(a);const r=document.createElement("div");r.style.minWidth="200px",r.style.textAlign="center",r.textContent=`It will take ${n} to recover the cost.`,l("dragonAuraInfo").appendChild(r)}}(e)},kt.ToggleSpecialMenu=Game.ToggleSpecialMenu,Game.ToggleSpecialMenu=function(e){kt.ToggleSpecialMenu(e),function(){if(null!==(l("specialPopup").className.match(/onScreen/)&&l("specialPopup").children[0].style.background.match(/dragon/)))for(let e=0;e<l("specialPopup").childNodes.length;e++)"optionBox"===l("specialPopup").childNodes[e].className&&(l("specialPopup").children[e].onmouseover=function(){Cn(),Game.tooltip.dynamic=1,Game.tooltip.draw(l("specialPopup"),`<div style="min-width:200px;text-align:center;">${U}</div>`,"this"),Game.tooltip.wobble()},l("specialPopup").children[e].onmouseout=function(){Game.tooltip.shouldHide=1})}()},kt.UpdateMenu=Game.UpdateMenu,Game.UpdateMenu=function(){void 0!==On().picker&&void 0!==On().picker.owner||(kt.UpdateMenu(),function(){const e=document.createElement("div");e.className="title","prefs"===Game.onMenu?(e.textContent="Cookie Monster Settings",function(e){const t=document.createDocumentFragment();t.appendChild(e);for(const e of Object.keys(Rn)){const o=$n(e,Rn[e]);if(t.appendChild(o),W.Header[e])if("Notification"===e)for(const e of Object.keys(Hn)){const o=$n(e,Hn[e]);if(o.style.fontSize="15px",o.style.opacity="0.5",t.appendChild(o),W.Header[e])for(const o in fn)fn[o].group===e&&t.appendChild(In(o))}else for(const o of Object.keys(fn))fn[o].group===e&&t.appendChild(In(o))}const o=document.createElement("div");o.className="listing";const n=document.createElement("a");n.className="option",n.onclick=function(){Mn(an)},n.textContent="Restore Default",o.appendChild(n),t.appendChild(o),l("menu").childNodes[2].insertBefore(t,l("menu").childNodes[2].childNodes[l("menu").childNodes[2].childNodes.length-1])}(e)):"stats"===Game.onMenu?W.Stats&&(e.textContent="Cookie Monster Statistics",Dn(e)):"log"===Game.onMenu&&(e.textContent="Cookie Monster ",function(e){const t=document.createElement("div");t.className="subsection";const o=document.createElement("span");if(o.style.cursor="pointer",o.style.display="inline-block",o.style.height="14px",o.style.width="14px",o.style.borderRadius="7px",o.style.textAlign="center",o.style.backgroundColor="#C0C0C0",o.style.color="black",o.style.fontSize="13px",o.style.verticalAlign="middle",o.textContent=W.Header.InfoTab?"-":"+",o.onclick=function(){Ln("InfoTab"),Game.UpdateMenu()},e.appendChild(o),t.appendChild(e),W.Header.InfoTab){const e=document.createElement("div");e.innerHTML='<div class="listing">\n <a href="https://github.com/Aktanusa/CookieMonster" target="blank">Cookie Monster</a>\n offers a wide range of tools and statistics to enhance your game experience.\n It is not a cheat interface – although it does offer helpers for golden cookies and such, everything can be toggled off at will to only leave how much information you want.</br>\n Progess on new updates and all previous release notes can be found on the GitHub page linked above!</br>\n Please also report any bugs you may find over there!</br>\n </div>\n ',t.appendChild(e);const o=document.createElement("div");o.innerHTML='<div class="listing">\n <b>The latest update (v 2.031.4) has introduced the following features:</b></br>\n - Added a changelog to the info tab and notification indicating a new version</br>\n - Warnings in tooltips are now based on the income after buying the upgrade</br>\n - A new warning and stat for Conjure Baked Goods in combination with Frenzy has been added</br>\n - User can now set a custom tooltip warning ("x times cps") in the settings</br>\n - Garden plots with plants that give cookies on harvest now display a tooltip with current and maximum reward</br>\n - The Harvest All button in the Garden now has a tooltip displaying the current reward </br>\n - The Ascend button can now display additional info (this can be turned off in the settings) </br>\n - The statistics page now displays the Heavenly Chips per second</br>\n - The statistics page now displays the CPS needed for the next level in Chain Cookies</br>\n - The statistics page now displays the cookies needed for optimal rewards for garden plants</br>\n - You can now set a Heavenly Chips target in the settings which will be counted down to in the statistics page</br>\n - The color picker in the settings has been updated to its latest version</br>\n - The overlay of seconds/percentage of timers is now toggle able and more readable</br>\n - You can now toggle to disable bulk-buying from buying less than the selected amount (i.e., buying 7 of a building by pressing the buy 10 when you don\'t have enough for 10)</br>\n - CookieMonster now uses the Modding API provided by the base game</br>\n - There is a new option that allows the decoupling of the base game volume setting and the volumes of sounds created by the mod</br>\n - The tab title now displays a "!" if a Golden Cookie or Reindeer can spawn</br>\n - PP calculation can now be set to: 1) Exclude the 1st, 2nd or 3rd most optimal building (if you never want to buy that it), 2) Always consider optimal buildings that cost below "xx seconds of CPS" (toggleable in the settings), 3) Ignore any building or upgrade that is not purchasable at the moment</br>\n </br>\n <b>This update fixes the following bugs:</b></br>\n - Minigames with enhanced tooltips will now also show these if the minigames were not loaded when CookieMonster was loaded</br>\n - Sound, Flashes and Notifications will no longer play when the mod is initializing</br>\n - The color picker should now update its display consistently</br>\n - Fixed some typo\'s</br>\n - Fixed a game breaking bug when the player had not purchased any upgrades</br>\n - Fixed a number of console errors thrown by CM</br>\n - Fixed the integration with mods that provide additional content, they should now no longer break CookieMonster</br>\n - The Timer bar will now disappear correctly when the Golden Switch has been activated</br>\n - Fixed errors in the calculation of the Chain Cookies and Wrinkler stats</br>\n - Fixed buy warnings showing incorrectly</br>\n </div>\n ',t.appendChild(o)}const n=l("menu").children[1];n.insertBefore(t,n.children[1])}(e))}())},kt.sayTime=Game.sayTime,Lt=function(e,t){return Number.isNaN(e)||e<=0?kt.sayTime(e,t):to(e/Game.fps,1)},kt.Logic=Game.Logic,Game.Logic=function(){kt.Logic();let e="Cookie Clicker";"fools"===Game.season&&(e="Cookie Baker"),Zt=`${Game.OnAscend?"Ascending! ":""}${eo(Game.cookies)} ${1===Game.cookies?"cookie":"cookies"} - ${e}`,function(){if(Game.OnAscend||0===W.Title)document.title=Zt;else if(1===W.Title){let e,t,o,n=!1,i=!1;e=Ee?Ee.wrath?`[W${Math.ceil(Ee.life/Game.fps)}]`:`[G${Math.ceil(Ee.life/Game.fps)}]`:Game.Has("Golden switch [off]")?"[GS]":`[${Number(l("CMTimerBarGCMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.golden.maxTime-Game.shimmerTypes.golden.time)/Game.fps)}]`,ct&&(n=!0,t="[F]"),"christmas"===Game.season&&(i=!0,o=st?`[R${Math.ceil(Ne.life/Game.fps)}]`:`[${Number(l("CMTimerBarRenMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)}]`);let a=Zt;"["===a.charAt(0)&&(a=a.substring(a.lastIndexOf("]")+1)),document.title=`${e+(n?t:"")+(i?o:"")} ${a}`}else if(2===W.Title){let e="",t=!1;Ee&&(t=!0,Ee.wrath?e+=`[W${Math.ceil(Ee.life/Game.fps)}]`:e+=`[G${Math.ceil(Ee.life/Game.fps)}]`),ct&&(t=!0,e+="[F]"),"christmas"===Game.season&&st&&(e+=`[R${Math.ceil(Ne.life/Game.fps)}]`,t=!0),t&&(e+=" - ");let o="Cookie Clicker";"fools"===Game.season&&(o="Cookie Baker"),e+=o,document.title=e}}(),l("ascendTooltip").innerHTML+=W.TooltipAscendButton?`<div class='line'></div>It takes ${Oe} to reach the next level and you are making ${eo(Z,2)} chips on average in the last 5 seconds.<br>`:""}}function _n(){yn(),en(),nn(),et=Object.keys(Game.mods).length,gt=document.createElement("style"),gt.type="text/css",gt.id="CMCSS",document.head.appendChild(gt),function(){const e=document.createElement("div");e.id="CMBotBar",e.style.height="69px",e.style.width="100%",e.style.position="absolute",e.style.display="none",e.style.backgroundColor="#262224",e.style.backgroundImage="linear-gradient(to bottom, #4d4548, #000000)",e.style.borderTop="1px solid black",e.style.overflow="auto",e.style.textShadow="-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black";const t=e.appendChild(document.createElement("table"));t.style.width="100%",t.style.textAlign="center",t.style.whiteSpace="nowrap";const o=t.appendChild(document.createElement("tbody")),n=function(e,t){const o=document.createElement("td");return o.style.textAlign="right",o.className=Gt+t,o.textContent=e,o},i=o.appendChild(document.createElement("tr"));i.style.fontWeight="bold",i.appendChild(n("CM 2.031.5",Tt)),o.appendChild(document.createElement("tr")).appendChild(n("Bonus Income",wt)),o.appendChild(document.createElement("tr")).appendChild(n("Payback Period",wt)),o.appendChild(document.createElement("tr")).appendChild(n("Time Left",wt)),l("wrapper").appendChild(e);for(const e of Object.keys(Game.Objects))so(e)}(),function(){const e=document.createElement("div");e.id="CMTimerBar",e.style.position="absolute",e.style.display="none",e.style.height="0px",e.style.fontSize="10px",e.style.fontWeight="bold",e.style.backgroundColor="black";const t=lo("CMTimerBarGC","Next Cookie",[{id:"CMTimerBarGCMinBar",color:Pt},{id:"CMTimerBarGCBar",color:Bt}]);e.appendChild(t);const o=lo("CMTimerBarRen","Next Reindeer",[{id:"CMTimerBarRenMinBar",color:Pt},{id:"CMTimerBarRenBar",color:Mt}]);e.appendChild(o),l("wrapper").appendChild(e)}(),function(){const e=document.createElement("div");e.id="CMUpgradeBar",e.style.width="100%",e.style.backgroundColor="black",e.style.textAlign="center",e.style.fontWeight="bold",e.style.display="none",e.style.zIndex="21",e.onmouseout=function(){Game.tooltip.hide()};const t=document.createElement("div");t.appendChild(function(){const e=document.createElement("div");e.style.minWidth="330px",e.style.marginBottom="4px";const t=document.createElement("div");t.className="name",t.style.marginBottom="4px",t.textContent="Legend",e.appendChild(t);const o=function(e,t){const o=document.createElement("div");o.style.verticalAlign="middle";const n=document.createElement("span");return n.className=vt+e,n.style.display="inline-block",n.style.height="10px",n.style.width="10px",n.style.marginRight="4px",o.appendChild(n),o.appendChild(document.createTextNode(t)),o};return e.appendChild(o(wt,"Better than best PP building")),e.appendChild(o(xt,"Same as best PP building")),e.appendChild(o(Tt,"Between best and worst PP buildings closer to best")),e.appendChild(o(Mt,"Between best and worst PP buildings closer to worst")),e.appendChild(o(St,"Same as worst PP building")),e.appendChild(o(Bt,"Worse than worst PP building")),e.appendChild(o(Pt,"Negative or infinity PP")),e}()),e.onmouseover=function(){Game.tooltip.draw(this,escape(t.innerHTML),"store")};const o=function(e,t){const o=document.createElement("span");return o.id=e,o.className=Gt+t,o.style.width="14.28571428571429%",o.style.display="inline-block",o.textContent="0",o};e.appendChild(o("CMUpgradeBarBlue",wt)),e.appendChild(o("CMUpgradeBarGreen",xt)),e.appendChild(o("CMUpgradeBarYellow",Tt)),e.appendChild(o("CMUpgradeBarOrange",Mt)),e.appendChild(o("CMUpgradeBarRed",St)),e.appendChild(o("CMUpgradeBarPurple",Bt)),e.appendChild(o("CMUpgradeBarGray",Pt)),l("upgrades").parentNode.insertBefore(e,l("upgrades").parentNode.childNodes[3])}(),function(){const e=document.createElement("div");e.id="CMWhiteScreen",e.style.width="100%",e.style.height="100%",e.style.backgroundColor="white",e.style.display="none",e.style.zIndex="9999999999",e.style.position="absolute",l("wrapper").appendChild(e)}(),function(){const e=document.createElement("link");e.id="CMFavicon",e.rel="shortcut icon",e.href="https://orteil.dashnet.org/cookieclicker/favicon.ico",document.getElementsByTagName("head")[0].appendChild(e)}();for(const e of Object.keys(Ft))To(Ft[e][0],Ft[e][1],Ft[e][2]);!function(){const e=document.createElement("a");e.id="PopAllNormalWrinklerButton",e.textContent="Pop All Normal",e.className="option",e.onclick=function(){Sn()},l("sectionLeftExtra").children[0].append(e);const t=document.createElement("a");t.id="PopFattestWrinklerButton",t.textContent="Pop Single Fattest",t.className="option",t.onclick=function(){null!==se[1]&&(Game.wrinklers[se[1]].hp=0)},l("sectionLeftExtra").children[0].append(t)}(),l("products").style.display="grid",l("storeBulk").style.gridRow="1/1",l("upgrades").style.display="flex",l("upgrades").style["flex-wrap"]="wrap",function(){for(const e of Object.keys(Game.Objects)){const t=Game.Objects[e];null!==l(`product${t.id}`).onmouseover&&(Ct[e]=l(`product${t.id}`).onmouseover,l(`product${t.id}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return So("b",`${e}`)}),"store"),Game.tooltip.wobble()})}}(),Game.canLumps()&&(tt=l("lumps").onmouseover,l("lumps").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return So("s","Lump")}),"this"),Game.tooltip.wobble()}),lt=Game.LoadMinigames,Game.LoadMinigames=function(){lt(),Game.Objects.Farm.minigameLoaded&&(l("gardenTool-1").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return So("ha","HarvestAllButton")}),"this"),Game.tooltip.wobble()},Array.from(l("gardenPlot").children).forEach((e=>{const t=e.id.slice(-3);e.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(function(){return So("p",[`${t[0]}`,`${t[2]}`])}),"this"),Game.tooltip.wobble()}}))),Bn(),En()},Game.LoadMinigames(),l("backgroundLeftCanvas").onmouseover=function(){At=1},l("backgroundLeftCanvas").onmouseout=function(){At=0,Game.tooltip.hide();for(const e of Object.keys(Game.wrinklers))Ut[e]=0},Vn(),En(),Game.CalculateGains(),Mn(),Wt=Game.OnAscend,Game.prefs.popups?Game.Popup("Cookie Monster version 2.031.5 loaded!"):Game.Notify("Cookie Monster version 2.031.5 loaded!","","",1,1),Game.Win("Third-party")}const Xn={init:function(){bn=!0;let e=!0;Game.version!==Number("2.031")&&(e=confirm("Cookie Monster version 2.031.5 is meant for Game version 2.031. Loading a different version may cause errors. Do you still want to load Cookie Monster?")),e&&(_n(),Game.registerHook("draw",Bo),Game.registerHook("logic",xn),bn=!1)},load:function(e){const t=JSON.parse(e);yn(),Mn(t.settings),"2.031.5"!==t.version&&(Game.prefs.popups?Game.Popup("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!"):Game.Notify("A new version of Cookie Monster has been loaded, check out the release notes in the info tab!","","",0,1))},save:gn};Game.registerMod("CookieMonster",Xn)})()})();
|
||
//# sourceMappingURL=CookieMonster.js.map
|