3 lines
203 KiB
JavaScript
3 lines
203 KiB
JavaScript
/*! For license information please see CookieMonsterDev.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,a,i=((a={initialized:!1,instances:[],readyQueue:[],register:function(){void 0!==e&&e.document&&e.document.addEventListener("DOMContentLoaded",a.pub.init,!1)},installBySelector:function(t,o){if(!(o=o?a.node(o):e.document))throw new Error("Missing root node");for(var n=o.querySelectorAll(t),i=new RegExp("(^|\\s)("+a.pub.lookupClass+")(\\s*(\\{[^}]*\\})|\\s|$)","i"),r=0;r<n.length;r+=1){var s,l;if(!(n[r].jscolor&&n[r].jscolor instanceof a.pub)&&(void 0===n[r].type||"color"!=n[r].type.toLowerCase()||!a.isColorAttrSupported)&&(null!==(s=a.getDataAttr(n[r],"jscolor"))||n[r].className&&(l=n[r].className.match(i)))){var c=n[r],d="";null!==s?d=s:l&&(console.warn('Installation using class name is DEPRECATED. Use data-jscolor="" attribute instead.'+a.docsRef),l[4]&&(d=l[4]));var m=null;if(d.trim())try{m=a.parseOptionsStr(d)}catch(e){console.warn(e+"\n"+d)}try{new a.pub(c,m)}catch(e){console.warn(e)}}}},parseOptionsStr:function(e){var t=null;try{t=JSON.parse(e)}catch(o){if(!a.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<a.instances.length;t+=1)a.instances[t]&&a.instances[t].targetElement&&e.push(a.instances[t]);return e},createEl:function(t){var o=e.document.createElement(t);return a.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 a.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"===a.nodeName(e)&&"text"===e.type.toLowerCase()},isButton:function(e){if(!e)return!1;var t=a.nodeName(e);return"button"===t||"input"===t&&["button","submit","reset"].indexOf(e.type.toLowerCase())>-1},isButtonEmpty:function(e){switch(a.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(a.dataProp)?e[a.dataProp]:e[a.dataProp]={},o=arguments[2];return t[i=arguments[1]]=o,!0}if(2===arguments.length&&"object"==typeof arguments[1]){t=e.hasOwnProperty(a.dataProp)?e[a.dataProp]:e[a.dataProp]={};var n=arguments[1];for(var i in n)n.hasOwnProperty(i)&&(t[i]=n[i]);return!0}throw new Error("Invalid arguments")},removeData:function(){var e=arguments[0];if(!e.hasOwnProperty(a.dataProp))return!0;for(var t=1;t<arguments.length;t+=1){var o=arguments[t];delete e[a.dataProp][o]}return!0},getData:function(e,t,o){if(!e.hasOwnProperty(a.dataProp)){if(void 0===o)return;e[a.dataProp]={}}var n=e[a.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){a._attachedGroupEvents.hasOwnProperty(e)||(a._attachedGroupEvents[e]=[]),a._attachedGroupEvents[e].push([t,o,n]),t.addEventListener(o,n,!1)},detachGroupEvents:function(e){if(a._attachedGroupEvents.hasOwnProperty(e)){for(var t=0;t<a._attachedGroupEvents[e].length;t+=1){var o=a._attachedGroupEvents[e][t];o[0].removeEventListener(o[1],o[2],!1)}delete a._attachedGroupEvents[e]}},preventDefault:function(e){e.preventDefault&&e.preventDefault(),e.returnValue=!1},captureTarget:function(e){e.setCapture&&(a._capturedTarget=e,a._capturedTarget.setCapture())},releaseTarget:function(){a._capturedTarget&&(a._capturedTarget.releaseCapture(),a._capturedTarget=null)},triggerEvent:function(t,o,n,i){if(t){var r=null;return"function"==typeof Event?r=new Event(o,{bubbles:n,cancelable:i}):(r=e.document.createEvent("Event")).initEvent(o,n,i),!!r&&(a.setData(r,"internal",!0),t.dispatchEvent(r),!0)}},triggerInputEvent:function(e,t,o,n){e&&a.isTextInput(e)&&a.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=a.strList(t);if(void 0===e.classList)for(n=0;n<o.length;n+=1)a.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=a.strList(t);if(void 0===e.classList)for(i=0;i<o.length;i+=1){var n=new RegExp("^\\s*"+o[i]+"\\s*|\\s*"+o[i]+"\\s*$|\\s+"+o[i]+"(\\s+)","g");e.className=e.className.replace(n,"$1")}else for(var i=0;i<o.length;i+=1)e.classList.remove(o[i])},getCompStyle:function(t){return(e.getComputedStyle?e.getComputedStyle(t):t.currentStyle)||{}},setStyle:function(e,t,o,n){var i=o?"important":"",r=null;for(var s in t)if(t.hasOwnProperty(s)){var l=null;null===t[s]?(r||(r=a.getData(e,"origStyle")),r&&r.hasOwnProperty(s)&&(l=r[s])):(n&&(r||(r=a.getData(e,"origStyle",{})),r.hasOwnProperty(s)||(r[s]=e.style[s])),l=t[s]),null!==l&&e.style.setProperty(s,l,i)}},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"),a=0;a<o.length;a+=1){var i=o[a]+t,r=i+"(to right, rgba(0,0,0,0), rgba(0,0,0,0))";if(n.style.background=r,n.style.background)return i}return t}(),function(){return o+"("+Array.prototype.join.call(arguments,", ")+")"}),setBorderRadius:function(e,t){a.setStyle(e,{"border-radius":t||"0"})},setBoxShadow:function(e,t){a.setStyle(e,{"box-shadow":t||"none"})},getElementPos:function(e,t){var o=0,n=0,i=e.getBoundingClientRect();if(o=i.left,n=i.top,!t){var r=a.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),a=Math.max(Math.max(e,t),o),i=a-n;if(0===i)return[null,0,100*a];var r=e===n?3+(o-t)/i:t===n?5+(e-o)/i:1+(t-e)/i;return[60*(6===r?0:r),i/a*100,100*a]},HSV_RGB:function(e,t,o){var n=o/100*255;if(null===e)return[n,n,n];e/=60,t/=100;var a=Math.floor(e),i=n*(1-t),r=n*(1-t*(a%2?e-a:1-(e-a)));switch(a){case 6:case 0:return[n,r,i];case 1:return[r,n,i];case 2:return[i,n,r];case 3:return[i,r,n];case 4:return[r,i,n];case 5:return[n,i,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,a,i,r,s=t[1].split(","),l=/^\s*(\d+|\d*\.\d+|\d+\.\d*)\s*$/;if(s.length>=3&&(n=s[0].match(l))&&(a=s[1].match(l))&&(i=s[2].match(l)))return o.format="rgb",o.rgba=[parseFloat(n[1])||0,parseFloat(a[1])||0,parseFloat(i[1])||0,null],s.length>=4&&(r=s[3].match(l))&&(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 i=a.parseColorString(t[n]);i&&o.push(i)}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 i=Math.round(a.pub.previewSeparator.length),r=a.pub.chessboardSize,s=a.pub.chessboardColor1,l=a.pub.chessboardColor2,c=o||2*r,d=2*r,m=a.createEl("canvas"),p=m.getContext("2d");m.width=c,m.height=d,n&&a.scaleCanvasForHighDPR(m),p.fillStyle=s,p.fillRect(0,0,c,d),p.fillStyle=l;for(var u=0;u<c;u+=2*r)p.fillRect(u,0,r,r),p.fillRect(u+r,r,r,r);e&&(p.fillStyle=e,p.fillRect(0,0,c,d));var h=null;switch(t){case"left":h=0,p.clearRect(0,0,i/2,d);break;case"right":h=c-i,p.clearRect(c-i/2,0,i/2,d)}if(null!==h){p.lineWidth=1;for(var g=0;g<a.pub.previewSeparator.length;g+=1)p.beginPath(),p.strokeStyle=a.pub.previewSeparator[g],p.moveTo(.5+h+g,0),p.lineTo(.5+h+g,d),p.stroke()}return{canvas:m,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%"],a.linearGradient.apply(this,n)},redrawPosition:function(){if(a.picker&&a.picker.owner){var e,t,o=a.picker.owner;o.fixed?(e=a.getElementPos(o.targetElement,!0),t=[0,0]):(e=a.getElementPos(o.targetElement),t=a.getViewPos());var n,i,r,s=a.getElementSize(o.targetElement),l=a.getViewSize(),c=a.getPickerDims(o),d=[c.borderW,c.borderH];switch(o.position.toLowerCase()){case"left":n=1,i=0,r=-1;break;case"right":n=1,i=0,r=1;break;case"top":n=0,i=1,r=-1;break;default:n=0,i=1,r=1}var m=(s[i]+d[i])/2;if(o.smartPosition)p=[-t[n]+e[n]+d[n]>l[n]&&-t[n]+e[n]+s[n]/2>l[n]/2&&e[n]+s[n]-d[n]>=0?e[n]+s[n]-d[n]:e[n],-t[i]+e[i]+s[i]+d[i]-m+m*r>l[i]?-t[i]+e[i]+s[i]/2>l[i]/2&&e[i]+s[i]-m-m*r>=0?e[i]+s[i]-m-m*r:e[i]+s[i]-m+m*r:e[i]+s[i]-m+m*r>=0?e[i]+s[i]-m+m*r:e[i]+s[i]-m-m*r];else var p=[e[n],e[i]+s[i]-m+m*r];var u=p[n],h=p[i],g=o.fixed?"fixed":"absolute",f=(p[0]+d[0]>e[0]||p[0]<e[0]+s[0])&&p[1]+d[1]<e[1]+s[1];a._drawPosition(o,u,h,g,f)}},_drawPosition:function(e,t,o,n,i){var r=i?0:e.shadowBlur;a.picker.wrap.style.position=n,a.picker.wrap.style.left=t+"px",a.picker.wrap.style.top=o+"px",a.setBoxShadow(a.picker.boxS,e.shadow?new a.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*a.getControlPadding(e)+e.sliderSize;a.getSliderChannel(e)&&(t+=n),e.hasAlphaChannel()&&(t+=n);var i=a.getPaletteDims(e,t);i.height&&(o+=i.height+e.padding),e.closeButton&&(o+=2*e.controlBorderWidth+e.padding+e.buttonHeight);var r=t+2*e.padding,s=o+2*e.padding;return{contentW:t,contentH:o,paddedW:r,paddedH:s,borderW:r+2*e.borderWidth,borderH:s+2*e.borderWidth,palette:i}},getPaletteDims:function(e,t){var o=0,n=0,a=0,i=0,r=0,s=e._palette?e._palette.length:0;return s&&(n=(o=e.paletteCols)>0?Math.ceil(s/o):0,a=Math.max(1,Math.floor((t-(o-1)*e.paletteSpacing)/o)),i=e.paletteHeight?Math.min(e.paletteHeight,a):a),n&&(r=n*i+(n-1)*e.paletteSpacing),{cols:o,rows:n,cellW:a,cellH:i,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=a.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(a.eventKey(e))&&a.picker&&a.picker.owner&&a.picker.owner.tryHide()},onWindowResize:function(e){a.redrawPosition()},onWindowScroll:function(e){a.redrawPosition()},onParentScroll:function(e){a.picker&&a.picker.owner&&a.picker.owner.tryHide()},onDocumentMouseDown:function(e){var t=e.target||e.srcElement;t.jscolor&&t.jscolor instanceof a.pub?t.jscolor.showOnClick&&!t.disabled&&t.jscolor.show():a.getData(t,"gui")?a.getData(t,"control")&&a.onControlPointerStart(e,t,a.getData(t,"control"),"mouse"):a.picker&&a.picker.owner&&a.picker.owner.tryHide()},onPickerTouchStart:function(e){var t=e.target||e.srcElement;a.getData(t,"control")&&a.onControlPointerStart(e,t,a.getData(t,"control"),"touch")},onControlPointerStart:function(t,o,n,i){var r=a.getData(o,"instance");a.preventDefault(t),a.captureTarget(o);var s=function(e,r){a.attachGroupEvent("drag",e,a._pointerMoveEvent[i],a.onDocumentPointerMove(t,o,n,i,r)),a.attachGroupEvent("drag",e,a._pointerEndEvent[i],a.onDocumentPointerEnd(t,o,n,i))};if(s(e.document,[0,0]),e.parent&&e.frameElement){var l=e.frameElement.getBoundingClientRect(),c=[-l.left,-l.top];s(e.parent.window.document,c)}var d=a.getAbsPointerPos(t),m=a.getRelPointerPos(t);switch(a._pointerOrigin={x:d.x-m.x,y:d.y-m.y},n){case"pad":"v"===a.getSliderChannel(r)&&0===r.channels.v&&r.fromHSVA(null,null,100,null),a.setPad(r,t,0,0);break;case"sld":a.setSld(r,t,0);break;case"asld":a.setASld(r,t,0)}r.trigger("input")},onDocumentPointerMove:function(e,t,o,n,i){return function(e){var n=a.getData(t,"instance");switch(o){case"pad":a.setPad(n,e,i[0],i[1]);break;case"sld":a.setSld(n,e,i[1]);break;case"asld":a.setASld(n,e,i[1])}n.trigger("input")}},onDocumentPointerEnd:function(e,t,o,n){return function(e){var o=a.getData(t,"instance");a.detachGroupEvents("drag"),a.releaseTarget(),o.trigger("input"),o.trigger("change")}},onPaletteSampleClick:function(e){var t=e.currentTarget,o=a.getData(t,"instance"),n=a.getData(t,"color");"any"===o.format.toLowerCase()&&(o._setFormat(n.format),a.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 i=a.getAbsPointerPos(t),r=o+i.x-a._pointerOrigin.x-e.padding-e.controlBorderWidth,s=n+i.y-a._pointerOrigin.y-e.padding-e.controlBorderWidth,l=r*(360/(e.width-1)),c=100-s*(100/(e.height-1));switch(a.getPadYChannel(e)){case"s":e.fromHSVA(l,c,null,null);break;case"v":e.fromHSVA(l,null,c,null)}},setSld:function(e,t,o){var n=100-(o+a.getAbsPointerPos(t).y-a._pointerOrigin.y-e.padding-e.controlBorderWidth)*(100/(e.height-1));switch(a.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+a.getAbsPointerPos(t).y-a._pointerOrigin.y-e.padding-e.controlBorderWidth)*(1/(e.height-1));if(n<1){var i=e.getFormat();"any"!==e.format.toLowerCase()||a.isAlphaFormat(i)||e._setFormat("hex"===i?"hexa":"rgba")}e.fromHSVA(null,null,null,n)},createPadCanvas:function(){var e={elm:null,draw:null},t=a.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 i=o.createLinearGradient(0,0,t.width,0);i.addColorStop(0,"#F00"),i.addColorStop(1/6,"#FF0"),i.addColorStop(2/6,"#0F0"),i.addColorStop(.5,"#0FF"),i.addColorStop(4/6,"#00F"),i.addColorStop(5/6,"#F0F"),i.addColorStop(1,"#F00"),o.fillStyle=i,o.fillRect(0,0,t.width,t.height);var r=o.createLinearGradient(0,0,0,t.height);switch(a.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=a.createEl("canvas"),o=t.getContext("2d");return e.elm=t,e.draw=function(e,n,a,i){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,a),r.addColorStop(1,i),o.fillStyle=r,o.fillRect(0,0,t.width,t.height)},e},createASliderGradient:function(){var e={elm:null,draw:null},t=a.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 r=t.width/2,s=a.pub.chessboardColor1,l=a.pub.chessboardColor2;if(o.fillStyle=s,o.fillRect(0,0,t.width,t.height),r>0)for(var c=0;c<t.height;c+=2*r)o.fillStyle=l,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,i),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,a,i){this.hShadow=e,this.vShadow=t,this.blur=o,this.spread=n,this.color=a,this.inset=!!i},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 i(e,t){if("string"!=typeof e)throw new Error("Invalid value for option name: "+e);if(a.enumOpts.hasOwnProperty(e)&&("string"==typeof t&&(t=t.toLowerCase()),-1===a.enumOpts[e].indexOf(t)))throw new Error("Option '"+e+"' has invalid value: "+t);if(a.deprecatedOpts.hasOwnProperty(e)){var o=e,i=a.deprecatedOpts[e];if(!i)throw new Error("Option '"+e+"' is DEPRECATED");console.warn("Option '%s' is DEPRECATED, using '%s' instead."+a.docsRef,o,i),e=i}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(a.deprecatedOpts.hasOwnProperty(e)){var t=e,o=a.deprecatedOpts[e];if(!o)throw new Error("Option '"+e+"' is DEPRECATED");console.warn("Option '%s' is DEPRECATED, using '%s' instead."+a.docsRef,t,o),e=o}var i="get__"+e;if("function"==typeof n[i])return n[i](value);if(e in n)return n[e];throw new Error("Unrecognized configuration option: "+e)}function s(){n._processParentElementsInDOM(),a.picker||(a.picker={owner:null,wrap:a.createEl("div"),box:a.createEl("div"),boxS:a.createEl("div"),boxB:a.createEl("div"),pad:a.createEl("div"),padB:a.createEl("div"),padM:a.createEl("div"),padCanvas:a.createPadCanvas(),cross:a.createEl("div"),crossBY:a.createEl("div"),crossBX:a.createEl("div"),crossLY:a.createEl("div"),crossLX:a.createEl("div"),sld:a.createEl("div"),sldB:a.createEl("div"),sldM:a.createEl("div"),sldGrad:a.createSliderGradient(),sldPtrS:a.createEl("div"),sldPtrIB:a.createEl("div"),sldPtrMB:a.createEl("div"),sldPtrOB:a.createEl("div"),asld:a.createEl("div"),asldB:a.createEl("div"),asldM:a.createEl("div"),asldGrad:a.createASliderGradient(),asldPtrS:a.createEl("div"),asldPtrIB:a.createEl("div"),asldPtrMB:a.createEl("div"),asldPtrOB:a.createEl("div"),pal:a.createEl("div"),btn:a.createEl("div"),btnT:a.createEl("span")},a.picker.pad.appendChild(a.picker.padCanvas.elm),a.picker.padB.appendChild(a.picker.pad),a.picker.cross.appendChild(a.picker.crossBY),a.picker.cross.appendChild(a.picker.crossBX),a.picker.cross.appendChild(a.picker.crossLY),a.picker.cross.appendChild(a.picker.crossLX),a.picker.padB.appendChild(a.picker.cross),a.picker.box.appendChild(a.picker.padB),a.picker.box.appendChild(a.picker.padM),a.picker.sld.appendChild(a.picker.sldGrad.elm),a.picker.sldB.appendChild(a.picker.sld),a.picker.sldB.appendChild(a.picker.sldPtrOB),a.picker.sldPtrOB.appendChild(a.picker.sldPtrMB),a.picker.sldPtrMB.appendChild(a.picker.sldPtrIB),a.picker.sldPtrIB.appendChild(a.picker.sldPtrS),a.picker.box.appendChild(a.picker.sldB),a.picker.box.appendChild(a.picker.sldM),a.picker.asld.appendChild(a.picker.asldGrad.elm),a.picker.asldB.appendChild(a.picker.asld),a.picker.asldB.appendChild(a.picker.asldPtrOB),a.picker.asldPtrOB.appendChild(a.picker.asldPtrMB),a.picker.asldPtrMB.appendChild(a.picker.asldPtrIB),a.picker.asldPtrIB.appendChild(a.picker.asldPtrS),a.picker.box.appendChild(a.picker.asldB),a.picker.box.appendChild(a.picker.asldM),a.picker.box.appendChild(a.picker.pal),a.picker.btn.appendChild(a.picker.btnT),a.picker.box.appendChild(a.picker.btn),a.picker.boxB.appendChild(a.picker.box),a.picker.wrap.appendChild(a.picker.boxS),a.picker.wrap.appendChild(a.picker.boxB),a.picker.wrap.addEventListener("touchstart",a.onPickerTouchStart,!!a.isPassiveEventSupported&&{passive:!1}));var t,o,i=a.picker,r=!!a.getSliderChannel(n),s=n.hasAlphaChannel(),m=a.getPickerDims(n),p=2*n.pointerBorderWidth+n.pointerThickness+2*n.crossSize,u=a.getControlPadding(n),h=Math.min(n.borderRadius,Math.round(n.padding*Math.PI));i.wrap.className="jscolor-picker-wrap",i.wrap.style.clear="both",i.wrap.style.width=m.borderW+"px",i.wrap.style.height=m.borderH+"px",i.wrap.style.zIndex=n.zIndex,i.box.className="jscolor-picker",i.box.style.width=m.paddedW+"px",i.box.style.height=m.paddedH+"px",i.box.style.position="relative",i.boxS.className="jscolor-picker-shadow",i.boxS.style.position="absolute",i.boxS.style.left="0",i.boxS.style.top="0",i.boxS.style.width="100%",i.boxS.style.height="100%",a.setBorderRadius(i.boxS,h+"px"),i.boxB.className="jscolor-picker-border",i.boxB.style.position="relative",i.boxB.style.border=n.borderWidth+"px solid",i.boxB.style.borderColor=n.borderColor,i.boxB.style.background=n.backgroundColor,a.setBorderRadius(i.boxB,h+"px"),i.padM.style.background="rgba(255,0,0,.2)",i.sldM.style.background="rgba(0,255,0,.2)",i.asldM.style.background="rgba(0,0,255,.2)",i.padM.style.opacity=i.sldM.style.opacity=i.asldM.style.opacity="0",i.pad.style.position="relative",i.pad.style.width=n.width+"px",i.pad.style.height=n.height+"px",i.padCanvas.draw(n.width,n.height,a.getPadYChannel(n)),i.padB.style.position="absolute",i.padB.style.left=n.padding+"px",i.padB.style.top=n.padding+"px",i.padB.style.border=n.controlBorderWidth+"px solid",i.padB.style.borderColor=n.controlBorderColor,i.padM.style.position="absolute",i.padM.style.left="0px",i.padM.style.top="0px",i.padM.style.width=n.padding+2*n.controlBorderWidth+n.width+u+"px",i.padM.style.height=2*n.controlBorderWidth+2*n.padding+n.height+"px",i.padM.style.cursor="crosshair",a.setData(i.padM,{instance:n,control:"pad"}),i.cross.style.position="absolute",i.cross.style.left=i.cross.style.top="0",i.cross.style.width=i.cross.style.height=p+"px",i.crossBY.style.position=i.crossBX.style.position="absolute",i.crossBY.style.background=i.crossBX.style.background=n.pointerBorderColor,i.crossBY.style.width=i.crossBX.style.height=2*n.pointerBorderWidth+n.pointerThickness+"px",i.crossBY.style.height=i.crossBX.style.width=p+"px",i.crossBY.style.left=i.crossBX.style.top=Math.floor(p/2)-Math.floor(n.pointerThickness/2)-n.pointerBorderWidth+"px",i.crossBY.style.top=i.crossBX.style.left="0",i.crossLY.style.position=i.crossLX.style.position="absolute",i.crossLY.style.background=i.crossLX.style.background=n.pointerColor,i.crossLY.style.height=i.crossLX.style.width=p-2*n.pointerBorderWidth+"px",i.crossLY.style.width=i.crossLX.style.height=n.pointerThickness+"px",i.crossLY.style.left=i.crossLX.style.top=Math.floor(p/2)-Math.floor(n.pointerThickness/2)+"px",i.crossLY.style.top=i.crossLX.style.left=n.pointerBorderWidth+"px",i.sld.style.overflow="hidden",i.sld.style.width=n.sliderSize+"px",i.sld.style.height=n.height+"px",i.sldGrad.draw(n.sliderSize,n.height,"#000","#000"),i.sldB.style.display=r?"block":"none",i.sldB.style.position="absolute",i.sldB.style.left=n.padding+n.width+2*n.controlBorderWidth+2*u+"px",i.sldB.style.top=n.padding+"px",i.sldB.style.border=n.controlBorderWidth+"px solid",i.sldB.style.borderColor=n.controlBorderColor,i.sldM.style.display=r?"block":"none",i.sldM.style.position="absolute",i.sldM.style.left=n.padding+n.width+2*n.controlBorderWidth+u+"px",i.sldM.style.top="0px",i.sldM.style.width=n.sliderSize+2*u+2*n.controlBorderWidth+(s?0:Math.max(0,n.padding-u))+"px",i.sldM.style.height=2*n.controlBorderWidth+2*n.padding+n.height+"px",i.sldM.style.cursor="default",a.setData(i.sldM,{instance:n,control:"sld"}),i.sldPtrIB.style.border=i.sldPtrOB.style.border=n.pointerBorderWidth+"px solid "+n.pointerBorderColor,i.sldPtrOB.style.position="absolute",i.sldPtrOB.style.left=-(2*n.pointerBorderWidth+n.pointerThickness)+"px",i.sldPtrOB.style.top="0",i.sldPtrMB.style.border=n.pointerThickness+"px solid "+n.pointerColor,i.sldPtrS.style.width=n.sliderSize+"px",i.sldPtrS.style.height=a.pub.sliderInnerSpace+"px",i.asld.style.overflow="hidden",i.asld.style.width=n.sliderSize+"px",i.asld.style.height=n.height+"px",i.asldGrad.draw(n.sliderSize,n.height,"#000"),i.asldB.style.display=s?"block":"none",i.asldB.style.position="absolute",i.asldB.style.left=n.padding+n.width+2*n.controlBorderWidth+u+(r?n.sliderSize+3*u+2*n.controlBorderWidth:0)+"px",i.asldB.style.top=n.padding+"px",i.asldB.style.border=n.controlBorderWidth+"px solid",i.asldB.style.borderColor=n.controlBorderColor,i.asldM.style.display=s?"block":"none",i.asldM.style.position="absolute",i.asldM.style.left=n.padding+n.width+2*n.controlBorderWidth+u+(r?n.sliderSize+2*u+2*n.controlBorderWidth:0)+"px",i.asldM.style.top="0px",i.asldM.style.width=n.sliderSize+2*u+2*n.controlBorderWidth+Math.max(0,n.padding-u)+"px",i.asldM.style.height=2*n.controlBorderWidth+2*n.padding+n.height+"px",i.asldM.style.cursor="default",a.setData(i.asldM,{instance:n,control:"asld"}),i.asldPtrIB.style.border=i.asldPtrOB.style.border=n.pointerBorderWidth+"px solid "+n.pointerBorderColor,i.asldPtrOB.style.position="absolute",i.asldPtrOB.style.left=-(2*n.pointerBorderWidth+n.pointerThickness)+"px",i.asldPtrOB.style.top="0",i.asldPtrMB.style.border=n.pointerThickness+"px solid "+n.pointerColor,i.asldPtrS.style.width=n.sliderSize+"px",i.asldPtrS.style.height=a.pub.sliderInnerSpace+"px",i.pal.className="jscolor-palette",i.pal.style.display=m.palette.rows?"block":"none",i.pal.style.position="absolute",i.pal.style.left=n.padding+"px",i.pal.style.top=2*n.controlBorderWidth+2*n.padding+n.height+"px",i.pal.innerHTML="";for(var g=a.genColorPreviewCanvas("rgba(0,0,0,0)"),f=0,k=0;k<m.palette.rows;k++)for(var C=0;C<m.palette.cols&&f<n._palette.length;C++,f++){var M=n._palette[f],y=a.rgbaColor.apply(null,M.rgba),b=a.createEl("div");b.style.width=m.palette.cellW-2*n.controlBorderWidth+"px",b.style.height=m.palette.cellH-2*n.controlBorderWidth+"px",b.style.backgroundColor=y;var G=a.createEl("div");G.className="jscolor-palette-sample",G.style.display="block",G.style.position="absolute",G.style.left=(m.palette.cols<=1?0:Math.round(C*((m.contentW-m.palette.cellW)/(m.palette.cols-1))*10)/10)+"px",G.style.top=k*(m.palette.cellH+n.paletteSpacing)+"px",G.style.border=n.controlBorderWidth+"px solid",G.style.borderColor=n.controlBorderColor,G.style.cursor="pointer",null!==M.rgba[3]&&M.rgba[3]<1&&(G.style.backgroundImage="url('"+g.canvas.toDataURL()+"')",G.style.backgroundRepeat="repeat",G.style.backgroundPosition="center center"),a.setData(G,{instance:n,control:"palette-sample",color:M}),G.addEventListener("click",a.onPaletteSampleClick,!1),G.appendChild(b),i.pal.appendChild(G)}i.btn.className="jscolor-btn-close",i.btn.style.display=n.closeButton?"block":"none",i.btn.style.position="absolute",i.btn.style.left=n.padding+"px",i.btn.style.bottom=n.padding+"px",i.btn.style.padding="0 15px",i.btn.style.maxWidth=m.contentW-2*n.controlBorderWidth-30+"px",i.btn.style.overflow="hidden",i.btn.style.height=n.buttonHeight+"px",i.btn.style.whiteSpace="nowrap",i.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],i.btn.style.borderColor=o,i.btn.style.color=n.buttonColor,i.btn.style.font="12px sans-serif",i.btn.style.textAlign="center",i.btn.style.cursor="pointer",i.btn.onmousedown=function(){n.hide()},i.btnT.style.lineHeight=n.buttonHeight+"px",i.btnT.innerHTML="",i.btnT.appendChild(e.document.createTextNode(n.closeText)),l(),c(),d(),a.picker.owner&&a.picker.owner!==n&&a.removeClass(a.picker.owner.targetElement,a.pub.activeClassName),a.picker.owner=n,n.container===e.document.body?a.redrawPosition():a._drawPosition(n,0,0,"relative",!1),i.wrap.parentNode!==n.container&&n.container.appendChild(i.wrap),a.addClass(n.targetElement,a.pub.activeClassName)}function l(){var e=a.getPadYChannel(n),t=Math.round(n.channels.h/360*(n.width-1)),o=Math.round((1-n.channels[e]/100)*(n.height-1)),i=2*n.pointerBorderWidth+n.pointerThickness+2*n.crossSize,r=-Math.floor(i/2);switch(a.picker.cross.style.left=t+r+"px",a.picker.cross.style.top=o+r+"px",a.getSliderChannel(n)){case"s":var s=a.HSV_RGB(n.channels.h,100,n.channels.v),l=a.HSV_RGB(n.channels.h,0,n.channels.v),c="rgb("+Math.round(s[0])+","+Math.round(s[1])+","+Math.round(s[2])+")",d="rgb("+Math.round(l[0])+","+Math.round(l[1])+","+Math.round(l[2])+")";a.picker.sldGrad.draw(n.sliderSize,n.height,c,d);break;case"v":var m=a.HSV_RGB(n.channels.h,n.channels.s,100);c="rgb("+Math.round(m[0])+","+Math.round(m[1])+","+Math.round(m[2])+")",d="#000",a.picker.sldGrad.draw(n.sliderSize,n.height,c,d)}a.picker.asldGrad.draw(n.sliderSize,n.height,n.toHEXString())}function c(){var e=a.getSliderChannel(n);if(e){var t=Math.round((1-n.channels[e]/100)*(n.height-1));a.picker.sldPtrOB.style.top=t-(2*n.pointerBorderWidth+n.pointerThickness)-Math.floor(a.pub.sliderInnerSpace/2)+"px"}a.picker.asldGrad.draw(n.sliderSize,n.height,n.toHEXString())}function d(){var e=Math.round((1-n.channels.a)*(n.height-1));a.picker.asldPtrOB.style.top=e-(2*n.pointerBorderWidth+n.pointerThickness)-Math.floor(a.pub.sliderInnerSpace/2)+"px"}function m(){return a.picker&&a.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(!i(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{i(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=a.strList(e),o=0;o<t.length;o+=1){var n=t[o].toLowerCase(),i=null;switch(n){case"input":i="onInput";break;case"change":i="onChange"}i&&a.triggerCallback(this,i),a.triggerInputEvent(this.valueElement,n,!0,!0)}},this.fromHSVA=function(e,t,o,n,i){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=a.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(i),!0},this.fromRGBA=function(e,t,o,n,i){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=a.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 s=a.HSV_RGB(this.channels.h,this.channels.s,this.channels.v);return this.channels.r=s[0],this.channels.g=s[1],this.channels.b=s[2],this.exposeColor(i),!0},this.fromHSV=function(e,t,o,n){return console.warn("fromHSV() method is DEPRECATED. Using fromHSVA() instead."+a.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."+a.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=a.parseColorString(e);return!!o&&("any"===this.format.toLowerCase()&&(this._setFormat(o.format),a.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 a.hexColor(this.channels.r,this.channels.g,this.channels.b)},this.toHEXAString=function(){return a.hexaColor(this.channels.r,this.channels.g,this.channels.b,this.channels.a)},this.toRGBString=function(){return a.rgbColor(this.channels.r,this.channels.g,this.channels.b)},this.toRGBAString=function(){return a.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 a.genColorPreviewCanvas(this.toRGBAString()).canvas},this.toDataURL=function(){return this.toCanvas().toDataURL()},this.toBackground=function(){return a.pub.background(this.toRGBAString())},this.isLight=function(){return this.toGrayscale()>127.5},this.hide=function(){m()&&(a.removeClass(n.targetElement,a.pub.activeClassName),a.picker.wrap.parentNode.removeChild(a.picker.wrap),delete a.picker.owner)},this.show=function(){s()},this.redraw=function(){m()&&s()},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()||a.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(a.setDataAttr(this.targetElement,"current-color",t),e&a.flags.leaveValue||!this.valueElement||("hex"!==o&&"hexa"!==o||(this.uppercase||(t=t.toLowerCase()),this.hash||(t=t.replace(/^#/,""))),this.setValueElementValue(t)),!(e&a.flags.leaveAlpha)&&this.alphaElement){var n=Math.round(100*this.channels.a)/100;this.setAlphaElementValue(n)}e&a.flags.leavePreview||!this.previewElement||((a.isTextInput(this.previewElement)||a.isButton(this.previewElement)&&!a.isButtonEmpty(this.previewElement))&&this.previewPosition,this.setPreviewElementBg(this.toRGBAString())),m()&&(l(),c(),d())},this.setPreviewElementBg=function(e){if(this.previewElement){var t=null,o=null;(a.isTextInput(this.previewElement)||a.isButton(this.previewElement)&&!a.isButtonEmpty(this.previewElement))&&(t=this.previewPosition,o=this.previewSize);var n=[];if(e){n.push({image:a.genColorPreviewGradient(e,t,o?o-a.pub.previewSeparator.length:null),position:"left top",size:"auto",repeat:t?"repeat-y":"repeat",origin:"padding-box"});var i=a.genColorPreviewCanvas("rgba(0,0,0,0)",t?{left:"right",right:"left"}[t]:null,o,!0);n.push({image:"url('"+i.canvas.toDataURL()+"')",position:(t||"left")+" top",size:i.width+"px "+i.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:[]},s=0;s<n.length;s+=1)r.image.push(n[s].image),r.position.push(n[s].position),r.size.push(n[s].size),r.repeat.push(n[s].repeat),r.origin.push(n[s].origin);var l={"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(", ")};a.setStyle(this.previewElement,l,this.forceStyle);var c={left:null,right:null};t&&(c[t]=this.previewSize+this.previewPadding+"px"),l={"padding-left":c.left,"padding-right":c.right},a.setStyle(this.previewElement,l,this.forceStyle,!0)}},this.setValueElementValue=function(e){this.valueElement&&("input"===a.nodeName(this.valueElement)?this.valueElement.value=e:this.valueElement.innerHTML=e)},this.setAlphaElementValue=function(e){this.alphaElement&&("input"===a.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=a.getCompStyle(e);t.position&&"fixed"===t.position.toLowerCase()&&(this.fixed=!0),e!==this.targetElement&&(a.getData(e,"hasScrollListener")||(e.addEventListener("scroll",a.onParentScroll,!1),a.setData(e,"hasScrollListener",!0)))}while((e=e.parentNode)&&"body"!==a.nodeName(e))}},this.tryHide=function(){this.hideOnLeave&&this.hide()},this.set__palette=function(e){this.palette=e,this._palette=a.parsePaletteValue(e),this._paletteHasTransparency=a.containsTranparentColor(this._palette)},a.pub.options)for(var p in a.pub.options)if(a.pub.options.hasOwnProperty(p))try{i(p,a.pub.options[p])}catch(e){console.warn(e)}var u=[];o.preset&&("string"==typeof o.preset?u=o.preset.split(/\s+/):Array.isArray(o.preset)?u=o.preset.slice():console.warn("Unrecognized preset value")),-1===u.indexOf("default")&&u.push("default");for(var h=u.length-1;h>=0;h-=1){var g=u[h];if(g)if(a.pub.presets.hasOwnProperty(g)){for(var p in a.pub.presets[g])if(a.pub.presets[g].hasOwnProperty(p))try{i(p,a.pub.presets[g][p])}catch(e){console.warn(e)}}else console.warn("Unknown preset: %s",g)}var f=["preset"];for(var p in o)if(o.hasOwnProperty(p)&&-1===f.indexOf(p))try{i(p,o[p])}catch(e){console.warn(e)}if(void 0===this.container?this.container=e.document.body:this.container=a.node(this.container),!this.container)throw new Error("Cannot instantiate color picker without a container element");if(this.targetElement=a.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 a.pub)throw new Error("Color picker already installed on this element");if(this.targetElement.jscolor=this,a.addClass(this.targetElement,a.pub.className),a.instances.push(this),a.isButton(this.targetElement)&&("button"!==this.targetElement.type.toLowerCase()&&(this.targetElement.type="button"),a.isButtonEmpty(this.targetElement))){a.removeChildren(this.targetElement),this.targetElement.appendChild(e.document.createTextNode(" "));var k=a.getCompStyle(this.targetElement);(parseFloat(k["min-width"])||0)<this.previewSize&&a.setStyle(this.targetElement,{"min-width":this.previewSize+"px"},this.forceStyle)}if(void 0===this.valueElement?a.isTextInput(this.targetElement)&&(this.valueElement=this.targetElement):null===this.valueElement||(this.valueElement=a.node(this.valueElement)),this.alphaElement&&(this.alphaElement=a.node(this.alphaElement)),void 0===this.previewElement?this.previewElement=this.targetElement:null===this.previewElement||(this.previewElement=a.node(this.previewElement)),this.valueElement&&a.isTextInput(this.valueElement)){var C={onInput:this.valueElement.oninput};this.valueElement.oninput=null,this.valueElement.addEventListener("keydown",(function(e){"Enter"===a.eventKey(e)&&(n.valueElement&&n.processValueInput(n.valueElement.value),n.tryHide())}),!1),this.valueElement.addEventListener("change",(function(e){if(!a.getData(e,"internal")){var t=n.valueElement.value;n.processValueInput(n.valueElement.value),a.triggerCallback(n,"onChange"),n.valueElement.value!==t&&a.triggerInputEvent(n.valueElement,"change",!0,!0)}}),!1),this.valueElement.addEventListener("input",(function(e){a.getData(e,"internal")||(n.valueElement&&n.fromString(n.valueElement.value,a.flags.leaveValue),a.triggerCallback(n,"onInput"))}),!1),C.onInput&&this.valueElement.addEventListener("input",C.onInput,!1),this.valueElement.setAttribute("autocomplete","off"),this.valueElement.setAttribute("autocorrect","off"),this.valueElement.setAttribute("autocapitalize","off"),this.valueElement.setAttribute("spellcheck",!1)}this.alphaElement&&a.isTextInput(this.alphaElement)&&(this.alphaElement.addEventListener("keydown",(function(e){"Enter"===a.eventKey(e)&&(n.alphaElement&&n.processAlphaInput(n.alphaElement.value),n.tryHide())}),!1),this.alphaElement.addEventListener("change",(function(e){if(!a.getData(e,"internal")){var t=n.alphaElement.value;n.processAlphaInput(n.alphaElement.value),a.triggerCallback(n,"onChange"),a.triggerInputEvent(n.valueElement,"change",!0,!0),n.alphaElement.value!==t&&a.triggerInputEvent(n.alphaElement,"change",!0,!0)}}),!1),this.alphaElement.addEventListener("input",(function(e){a.getData(e,"internal")||(n.alphaElement&&n.fromHSVA(null,null,null,parseFloat(n.alphaElement.value),a.flags.leaveAlpha),a.triggerCallback(n,"onInput"),a.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 M="FFFFFF";void 0!==this.value?M=this.value:this.valueElement&&void 0!==this.valueElement.value&&(M=this.valueElement.value);var y=void 0;if(void 0!==this.alpha?y=""+this.alpha:this.alphaElement&&void 0!==this.alphaElement.value&&(y=this.alphaElement.value),this._currentFormat=null,["auto","any"].indexOf(this.format.toLowerCase())>-1){var b=a.parseColorString(M);this._currentFormat=b?b.format:"hex"}else this._currentFormat=this.format.toLowerCase();this.processValueInput(M),void 0!==y&&this.processAlphaInput(y)}}).pub.className="jscolor",a.pub.activeClassName="jscolor-active",a.pub.looseJSON=!0,a.pub.presets={},a.pub.presets.default={},a.pub.presets.light={backgroundColor:"rgba(255,255,255,1)",controlBorderColor:"rgba(187,187,187,1)",buttonColor:"rgba(0,0,0,1)"},a.pub.presets.dark={backgroundColor:"rgba(51,51,51,1)",controlBorderColor:"rgba(153,153,153,1)",buttonColor:"rgba(240,240,240,1)"},a.pub.presets.small={width:101,height:101,padding:10,sliderSize:14,paletteCols:8},a.pub.presets.medium={width:181,height:101,padding:12,sliderSize:16,paletteCols:10},a.pub.presets.large={width:271,height:151,padding:12,sliderSize:24,paletteCols:15},a.pub.presets.thin={borderWidth:1,controlBorderWidth:1,pointerBorderWidth:1},a.pub.presets.thick={borderWidth:2,controlBorderWidth:2,pointerBorderWidth:2},a.pub.sliderInnerSpace=3,a.pub.chessboardSize=8,a.pub.chessboardColor1="#666666",a.pub.chessboardColor2="#999999",a.pub.previewSeparator=["rgba(255,255,255,.65)","rgba(128,128,128,.65)"],a.pub.init=function(){if(!a.initialized)for(e.document.addEventListener("mousedown",a.onDocumentMouseDown,!1),e.document.addEventListener("keyup",a.onDocumentKeyUp,!1),e.addEventListener("resize",a.onWindowResize,!1),e.addEventListener("scroll",a.onWindowScroll,!1),a.pub.install(),a.initialized=!0;a.readyQueue.length;)a.readyQueue.shift()()},a.pub.install=function(e){var t=!0;try{a.installBySelector("[data-jscolor]",e)}catch(e){t=!1,console.warn(e)}if(a.pub.lookupClass)try{a.installBySelector("input."+a.pub.lookupClass+", button."+a.pub.lookupClass,e)}catch(e){}return t},a.pub.ready=function(e){return"function"!=typeof e?(console.warn("Passed value is not a function"),!1):(a.initialized?e():a.readyQueue.push(e),!0)},a.pub.trigger=function(e){var t=function(){a.triggerGlobal(e)};a.initialized?t():a.pub.ready(t)},a.pub.hide=function(){a.picker&&a.picker.owner&&a.picker.owner.hide()},a.pub.chessboard=function(e){return e||(e="rgba(0,0,0,0)"),a.genColorPreviewCanvas(e).canvas.toDataURL()},a.pub.background=function(e){var t=[];t.push(a.genColorPreviewGradient(e));var o=a.genColorPreviewCanvas();return t.push(["url('"+o.canvas.toDataURL()+"')","left top","repeat"].join(" ")),t.join(", ")},a.pub.options={},a.pub.lookupClass="jscolor",a.pub.installByClassName=function(){return console.error('jscolor.installByClassName() is DEPRECATED. Use data-jscolor="" attribute instead of a class name.'+a.docsRef),!1},a.register(),a.pub);return void 0===e.jscolor&&(e.jscolor=e.JSColor=i),i}))}},t={};function o(n){var a=t[n];if(void 0!==a)return a.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";function e(){}function t(){Object.keys(Game.mods.cookieMonsterFramework.saveData).forEach((e=>{const t=JSON.stringify(Game.mods.cookieMonsterFramework.saveData[e]),o=b64_to_utf8(unescape(localStorage.getItem("CookieClickerGame")).split("!END!")[0]),n=new RegExp(`${e}.*(;|$)`),a=o.match(n);if(null!==a){const n=o.replace(a[0],`${e}:${t}`);localStorage.setItem("CookieClickerGame",escape(`${utf8_to_b64(n)}!END!`))}}))}function n(e,o){switch(void 0===Game.mods.cookieMonsterFramework.saveData[e].headers[o]&&(Game.mods.cookieMonsterFramework.saveData[e].headers[o]=1),Game.mods.cookieMonsterFramework.saveData[e].headers[o]){case 0:Game.mods.cookieMonsterFramework.saveData[e].headers[o]=1;break;default:Game.mods.cookieMonsterFramework.saveData[e].headers[o]=0}t()}function a(e,t){t.disconnect(),"log"===Game.onMenu?function(){const e=l("menu").children[1];if(e.insertBefore(function(){const e=document.createElement("div");e.className="subsection",e.id="cookieMonsterFrameworkMenuSection";const t=document.createElement("div");t.className="title",t.innerHTML="Cookie Monster Mod Family";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=Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu?"-":"+",o.onclick=function(){n("cookieMonsterFramework","infoMenu"),Game.UpdateMenu()},t.appendChild(o),e.appendChild(t),Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu){const t=document.createElement("div");t.className="listing",t.innerHTML='<a href="https://github.com/CookieMonsterTeam" target="blank">Cookie Monster Team</a>\noffers a suite of tools to enhance your game experience.</br>\nOriginally known from our work on the Cookie Monster add-on we are now expanding and working on new tools within the Cookie Monster Mod Family.</br>\nKeep an eye on our GitHub to see future work or use it to report bugs or feature requests!</br>\n',e.appendChild(t)}return e}(),e.children[1]),Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.infoMenu){const e=Game.mods.cookieMonsterFramework.listeners.infoMenu;for(let t=0;t<e.length;t++)l("cookieMonsterFrameworkMenuSection").appendChild(e[t]())}}():"prefs"===Game.onMenu&&function(){const e=document.createElement("div");e.className="subsection",e.id="cookieMonsterOptionsDiv";const t=document.createElement("div");t.className="title",t.innerHTML="Cookie Monster Mod Family";const o=document.createElement("span");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=Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework.headers.optionsMenu?"-":"+",o.onclick=function(){n("cookieMonsterFramework","optionsMenu"),Game.UpdateMenu()},t.appendChild(o),e.appendChild(t);const a=l("menu").children[2].children.length-1;l("menu").children[2].insertBefore(e,l("menu").children[2].children[a])}(),t.observe(document.getElementById("menu"),{attributes:!0,childList:!0,subtree:!0})}function i(e,o,n,a,i){const r=JSON.parse(o);Game.mods.cookieMonsterFramework.saveData[e]=function(e,t,o){const n={},a={};Object.keys(t).forEach((o=>{void 0===e.settings||void 0===e.settings[o]?a[o]=t[o].defaultValue:a[o]=e.settings[o]})),n.settings=a;const i={};return Object.keys(o).forEach((t=>{void 0===e.headers||void 0===e.headers[t]?i[t]=o[t]:i[t]=e.headers[t]})),n.headers=i,Object.keys(e).forEach((t=>{"settings"!==t&&"headers"!==t&&(n[t]=e[t])})),n}(r,n,a),t(),i(),Object.keys(Game.mods.cookieMonsterFramework.saveData[e].settings).forEach((e=>{void 0!==n[e].func&&n[e].func()})),Game.UpdateMenu()}const r={infoMenu:1,optionsMenu:1},s={};function c(){}const d={init:function(){window.cookieMonsterFrameworkData={},new MutationObserver(a).observe(document.getElementById("menu"),{attributes:!0,childList:!0,subtree:!0}),Game.registerHook("draw",e)},load:function(e){i("cookieMonsterFramework",e,s,r,c)},save:function(){return JSON.stringify(Game.mods.cookieMonsterFramework.saveData.cookieMonsterFramework)},listeners:{infoMenu:[]},saveData:{cookieMonsterFramework:{headers:{},settings:{}}}},m=function(){"undefined"==typeof cookieMonsterFrameworkData&&Game.registerMod("cookieMonsterFramework",d)},p=function(e){Game.mods.cookieMonsterFramework.saveData[e]={settings:{},headers:{}}},u=function(e){const t=document.createElement("div");return t.className="listing",t.innerHTML=e,t},h=function(e,t,o){const a=document.createElement("div");a.className="subsection",a.id=`${e}MenuSection`;const i=document.createElement("div");i.className="title",i.style.fontSize="18px",i.innerHTML=t;const r=document.createElement("span");return r.style.cursor="pointer",r.style.display="inline-block",r.style.height="14px",r.style.width="14px",r.style.borderRadius="7px",r.style.textAlign="center",r.style.backgroundColor="#C0C0C0",r.style.color="black",r.style.fontSize="13px",r.style.verticalAlign="middle",r.textContent=Game.mods.cookieMonsterFramework.saveData[e].headers[o]?"-":"+",r.onclick=function(){n(e,o),Game.UpdateMenu()},i.appendChild(r),a.appendChild(i),a};function g(){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerButtons&&Game.elderWrath?(l("PopAllNormalWrinklerButton").style.display="",l("PopFattestWrinklerButton").style.display=""):(l("PopAllNormalWrinklerButton").style.display="none",l("PopFattestWrinklerButton").style.display="none")}const f=["","","M","G","T","P","E","Z","Y"],k=["","","M","B","Tr","Quadr","Quint","Sext","Sept","Oct","Non","Dec","Undec","Duodec","Tredec","Quattuordec","Quindec","Sexdec","Septendec","Octodec","Novemdec","Vigint","Unvigint","Duovigint","Trevigint","Quattuorvigint"],C=["","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 M,y,b,G,w,v,x,T,S,B,E,F,P,N,O,D,A=[],L=[],W=[],j={},H=Date.now(),U=Date.now();function $(e,t,o){const n=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleDecimals+1;if(e===1/0)return"Infinity";if(void 0===e)return"0";if(0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale)return j.Beautify(e,t);if(Number.isFinite(e)){if(e<0)return`-${$(Math.abs(e))}`;let a="";if(0===e)return e.toString();if(e>.001&&e<Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleCutoff)return a=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator?e.toLocaleString("nl"):e.toLocaleString("en"),a;if(4===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale&&!o||4===o)a=e.toExponential(n).toString().replace("e","E");else{const t=e.toExponential().toString(),i=Math.floor(t.slice(t.indexOf("e")+1)/3);a=(e/Number("1e"+3*i)).toFixed(n),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale&&!o||1===o?e>=.01&&e<Number("1e"+3*f.length)?a+=` ${f[i]}`:a=$(e,0,4):2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale&&!o||2===o?e>=.01&&e<Number("1e"+3*k.length)?a+=` ${k[i]}`:a=$(e,0,4):3===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale&&!o||3===o?e>=.01&&e<Number("1e"+3*C.length)?a+=` ${C[i]}`:a=$(e,0,4):(5===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale&&!o||5===o)&&(a+="E"+3*i)}return""===a&&(console.log(`Could not beautify number with Cookie Monster Beautify: ${e}`),a=j.Beautify(e,t)),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator&&(a=a.replace(".",",")),a}return console.log(`Could not beautify number with Cookie Monster Beautify: ${e}`),j.Beautify(e,t)}let R,I,z,V,_,Q,X,q,Y,K,J,Z,ee,te,oe,ne,ae,ie,re,se,le,ce,de,me,pe,ue,he,ge,fe,ke,Ce,Me,ye,be,Ge,we,ve,xe=0,Te=0,Se=0,Be=0,Ee=0,Fe=0,Pe=0,Ne=0,Oe=0,De=0,Ae=0,Le=0,We=0,je=0,He=0,Ue=1,$e=1,Re=1,Ie=0,ze=0,Ve=0,_e=0,Qe={},Xe={},qe={},Ye={},Ke=0,Je=0,Ze=[0,null],et=0,tt=0,ot={},nt={},at={},it={},rt={},st=0,lt=0,ct=[],dt=0,mt=0,pt=[],ut=0,ht=0,gt=[],ft=0,kt=0,Ct=[],Mt=0,yt=0,bt={},Gt={},wt=0,vt=0,xt=0,Tt=[],St={},Bt=0,Et={0:[0,0,0],1:[0,0,0],2:[0,0,0],3:[0,0,0],4:[0,0,0],5:[0,0,0],6:[0,0,0],7:[0,0,0],8:[0,0,0],9:[0,0,0],10:[0,0,0]},Ft=[],Pt=[],Nt=[];function Ot(e){let t=0;return Game.dragonAuras[ge].name!==e&&Game.dragonAuras[fe].name!==e||(t=1),"Reality Bending"!==Game.dragonAuras[ge].name&&"Reality Bending"!==Game.dragonAuras[fe].name||(t+=.1),t}function Dt(){let e=.25;return e*=1+Ot("Earth Shatterer"),e}function At(e,t){return void 0===be[e]?void 0===t?1:t:be[e]}function Lt(e){const t=Pt[e];return(1!==Game.ascensionMode||"prestige"!==t.pool&&"fortune"!==t.tier)&&t?t.bought:0}function Wt(e){if(Game.hasGod){void 0===Ft.Temple.minigame&&(Ft.Temple.minigame=Game.Objects.Temple.minigame);const t=Ft.Temple.minigame.gods[e];if(ke===t.id)return 1;if(Ce===t.id)return 2;if(Me===t.id)return 3}return!1}function jt(e,t){let o=t;if(Lt("Season savings")&&(o*=.99),Lt("Santa's dominion")&&(o*=.99),Lt("Faberge egg")&&(o*=.99),Lt("Divine discount")&&(o*=.99),Lt("Fortune #100")&&(o*=.99),o*=1-.02*Ot("Fierce Hoarder"),Game.hasBuff("Everything must go")&&(o*=.95),Game.hasBuff("Crafty pixies")&&(o*=.98),Game.hasBuff("Nasty goblins")&&(o*=1.02),e.fortune&&Lt(e.fortune.name)&&(o*=.93),o*=At("buildingCost"),Ft.Temple.minigameLoaded){const e=Wt("creation");1===e?o*=.93:2===e?o*=.95:3===e&&(o*=.98)}return o}function Ht(e,t,o,n,a,i){const r=void 0===i?0:i;let s=a,l=o,c=0;-1===a&&(s=l),a||(s=Game.buyBulk);for(let o=0;o<s;o++){let o=t*Game.priceIncrease**Math.max(0,l-n);o=r?Game.modifyBuildingPrice(e,o):jt(e,o),o=Math.ceil(o);const a=r?e.getSellMultiplier():Dt();o=Math.floor(o*a),l>0&&(c+=o,l-=1)}return c}const Ut="CMText",$t="CMBack",Rt="Blue",It="Green",zt="Yellow",Vt="Orange",_t="Red",Qt="Purple",Xt="Gray",qt="Pink",Yt="Brown",Kt=[Rt,It,zt,Vt,_t,Qt,qt,Yt,Xt],Jt=[["GoldCookTooltipPlaceholder","Calculated with Golden Switch off","200px"],["GoldCookDragonsFortuneTooltipPlaceholder","Calculated with Golden Switch off and at least one golden cookie on-screen","240px"],["PrestMaxTooltipPlaceholder","The MAX prestige is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg","320px"],["NextPrestTooltipPlaceholder","Calculated with cookies gained from wrinklers and Chocolate egg","200px"],["HeavenChipMaxTooltipPlaceholder","The MAX heavenly chips is calculated with the cookies gained from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and buying Chocolate egg","330px"],["ResetTooltipPlaceholder","The bonus income you would get from new prestige levels unlocked at 100% of its potential and from ascension achievements if you have the same buildings/upgrades after reset","370px"],["ChoEggTooltipPlaceholder","The amount of cookies you would get from popping all wrinklers with Skruuia god in Diamond slot, selling all stock market goods, selling all buildings with Earth Shatterer and Reality Bending auras, and then buying Chocolate egg","300px"],["ChainNextLevelPlaceholder","Cheated cookies might break this formula","250px"],["FavouriteSettingPlaceholder","Click to set this setting as favourite and show it in 'favourite' settings at the top of the Cookie Monster Settings","250px"]],Zt={};let eo,to=0,oo=-1,no=[],ao=function(){},io=1,ro=1,so=1;const lo=[10,15,30,60,300,600,900,1800],co=[1,5,10,15,30],mo={Frenzy:zt,"Dragon Harvest":Yt,"Elder frenzy":It,Clot:_t,"Click frenzy":Rt,Dragonflight:qt};let po,uo,ho,go,fo,ko,Co,Mo={},yo="",bo=[];function Go(){let e,t=Game.buyBulk;1===Game.buyMode?ro=t:t=ro,1===t?t=Qe:10===t?t=Xe:100===t&&(t=qe),l("storeBulk1").style.removeProperty("color"),l("storeBulk10").style.removeProperty("color"),l("storeBulk100").style.removeProperty("color"),1===Game.buyMode?1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BuildColour?(Object.keys(t).forEach((e=>{l(`productPrice${Game.Objects[e].id}`).style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[`Colour${t[e].color}`]})),l(`storeBulk${xt}`).style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen):Object.keys(Game.Objects).forEach((e=>{l(`productPrice${Game.Objects[e].id}`).style.removeProperty("color")})):-1===Game.buyMode&&Object.keys(Qe).forEach((e=>{const t=Game.Objects[e];l(`productPrice${t.id}`).style.color="",l(`productPrice${t.id}`).innerHTML=$(Ht(t,t.basePrice,t.amount,t.free,Game.buyBulk,1))})),1===Game.buyMode&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?(e=Object.keys(Qe).map((e=>{const t={};return t.name=e,t.pp=Qe[e].pp,t.color=Qe[e].color,t})),e.sort(((e,t)=>Kt.indexOf(e.color)===Kt.indexOf(t.color)?e.pp-t.pp:Kt.indexOf(e.color)-Kt.indexOf(t.color)))):2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings?(e=Object.keys(t).map((e=>{const o={};return o.name=e,o.pp=t[e].pp,o.color=t[e].color,o})),e.sort(((e,t)=>Kt.indexOf(e.color)===Kt.indexOf(t.color)?e.pp-t.pp:Kt.indexOf(e.color)-Kt.indexOf(t.color)))):3===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortBuildings&&(e=Object.keys(Ye).map((e=>{const t={};return t.name=e,t.id=Game.Objects[e].id,t.amountUntilNext=Ye[e].AmountNeeded,t.priceUntilNext=Ye[e].price,t})),e.sort(((e,t)=>e.id-t.id)),e.sort(((e,t)=>(101!==e.amountUntilNext?e.priceUntilNext:1/0)-(101!==t.amountUntilNext?t.priceUntilNext:1/0)))):(e=Object.keys(Qe).map((e=>{const t={};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 wo(){Object.values(document.getElementsByClassName("storeSection")).forEach((e=>{Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradesNeverCollapse||"products"===e.id?e.style.height="auto":"vaultUpgrades"===e.id?(e.style.height="",e.style.minHeight="0px"):"upgrades"===e.id?(e.style.height="",e.className.includes("hasMenu")?e.style.minHeight="82px":e.style.minHeight="60px"):(e.style.height="",e.style.minHeight="60px")}))}function vo(){if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColour>0){let e=0,t=0,o=0,n=0,a=0,i=0,r=0;Object.keys(Game.UpgradesInStore).forEach((s=>{const c=Game.UpgradesInStore[s];let d=!1;for(let e=0;e<l(`upgrade${s}`).childNodes.length;e+=1)if(-1!==l(`upgrade${s}`).childNodes[e].className.indexOf($t)){l(`upgrade${s}`).childNodes[e].className=$t+ot[c.name].color,d=!0;break}if(!d){const e=document.createElement("div");e.style.width="10px",e.style.height="10px",e.className=$t+ot[c.name].color,l(`upgrade${s}`).appendChild(e)}ot[c.name].color===Rt?e+=1:ot[c.name].color===It?t+=1:ot[c.name].color===zt?o+=1:ot[c.name].color===Vt?n+=1:ot[c.name].color===_t?a+=1:ot[c.name].color===Qt?i+=1:ot[c.name].color===Xt&&(r+=1)})),l("CMUpgradeBarBlue").textContent=e,l("CMUpgradeBarGreen").textContent=t,l("CMUpgradeBarYellow").textContent=o,l("CMUpgradeBarOrange").textContent=n,l("CMUpgradeBarRed").textContent=a,l("CMUpgradeBarPurple").textContent=i,l("CMUpgradeBarGray").textContent=r}const e=[];for(let t=0;t<Game.UpgradesInStore.length;t+=1){const o={};o.name=Game.UpgradesInStore[t].name,o.price=Game.UpgradesInStore[t].basePrice,o.pp=ot[o.name].pp,o.color=ot[o.name].color,e.push(o)}Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SortUpgrades?e.sort(((e,t)=>Kt.indexOf(e.color)===Kt.indexOf(t.color)?e.pp-t.pp:Kt.indexOf(e.color)-Kt.indexOf(t.color))):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+=1)l(`upgrade${o}`).style.order=t(e,Game.UpgradesInStore[o])+1}function xo(e,t){let o=e;if(e===1/0)return e;if(e<0)return"Negative time period";o=Math.ceil(e);const n=Math.floor(o/31536e3),a=Math.floor(o%31536e3/86400),i=Math.floor(o%31536e3%86400/3600),r=Math.floor(o%31536e3%86400%3600/60),s=Math.floor(o%31536e3%86400%3600%60);let l="";if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat){if(o>315576e4)return"XX:XX:XX:XX:XX";l+=(n<10?"0":"")+n+":",l+=(a<10?"0":"")+a+":",l+=(i<10?"0":"")+i+":",l+=(r<10?"0":"")+r+":",l+=(s<10?"0":"")+s}else{if(o>7776e5)return t?"Over 9000 days!":">9000d";l+=n>0?n+(t?1===n?" year":" years":"y")+", ":"",(l.length>0||a>0)&&(l+=a+(t?1===a?" day":" days":"d")+", "),(l.length>0||i>0)&&(l+=i+(t?1===i?" hour":" hours":"h")+", "),(l.length>0||r>0)&&(l+=r+(t?1===r?" minute":" minutes":"m")+", "),l+=s+(t?1===s?" second":" seconds":"s")}return l}function To(e){let t,o;return e<=0?(o=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimeFormat?"00:00:00:00:00":"Done!",t=It):(o=xo(e),t=e>300?_t:e>60?Vt:zt),{text:o,color:t}}function So(){return Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CPSMode?ae:0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?Game.cookiesPs*(1-Game.cpsSucked):1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?Game.cookiesPs*(et+(1-.05*tt)):null!==Ze[1]&&2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink&&1===Game.wrinklers[Ze[1]].type?Game.cookiesPs*(3*et/tt+(1-.05*tt)):Game.cookiesPs*(et/tt+(1-.05*tt))}function Bo(){return 1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?Ke:2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?Ze[0]:0}function Eo(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 a=document.createElement("div");a.style.width="100%",a.style.height="10px",a.style.margin="auto",a.style.position="absolute",a.style.left="0px",a.style.top="0px",a.style.right="0px",a.style.bottom="0px";const i=document.createElement("span");i.style.display="inline-block",i.style.textAlign="right",i.style.fontSize="10px",i.style.width="108px",i.style.marginRight="5px",i.style.verticalAlign="text-top",i.textContent=t,a.appendChild(i);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=$t+o[e].color),a.appendChild(t)}const r=document.createElement("span");return r.id=`${e}Time`,r.style.marginLeft="5px",r.style.verticalAlign="text-top",a.appendChild(r),n.appendChild(a),n}function Fo(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],a=l("CMBotBar").firstChild.firstChild.childNodes[3],i=e,r=t.appendChild(document.createElement("td"));r.appendChild(document.createTextNode(`${-1!==i.indexOf(" ")?i.substring(0,i.indexOf(" ")):i} (`)),r.appendChild(document.createElement("span")).className="CMTextBlue",r.appendChild(document.createTextNode(")")),t.lastChild.style.paddingLeft="8px",o.appendChild(document.createElement("td")),o.lastChild.style.paddingLeft="8px",n.appendChild(document.createElement("td")),n.lastChild.style.paddingLeft="8px",a.appendChild(document.createElement("td")),a.lastChild.style.paddingLeft="2px"}}function Po(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar&&Qe&&1===Game.buyMode){let e=0;Object.keys(Qe).forEach((t=>{let o,n=Game.buyBulk;1===Game.buyMode?io=n:n=io,1===n&&(n=Qe),10===n&&(n=Xe),100===n&&(n=qe),e+=1,l("CMBotBar").firstChild.firstChild.childNodes[0].childNodes[e].childNodes[1].textContent=Game.Objects[t].amount,l("CMBotBar").firstChild.firstChild.childNodes[1].childNodes[e].textContent=$(n[t].bonus,2),l("CMBotBar").firstChild.firstChild.childNodes[2].childNodes[e].className=Ut+n[t].color,o=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime?xo(Math.round(n[t].pp)):$(Math.round(n[t].pp),2),l("CMBotBar").firstChild.firstChild.childNodes[2].childNodes[e].textContent=o;const a=To((Game.Objects[t].bulkPrice-(Game.cookies+Bo()))/So());l("CMBotBar").firstChild.firstChild.childNodes[3].childNodes[e].className=Ut+a.color,"Done!"===a.text&&Game.cookies<Game.Objects[t].bulkPrice?l("CMBotBar").firstChild.firstChild.childNodes[3].childNodes[e].textContent=`${a.text} (with Wrink)`:l("CMBotBar").firstChild.firstChild.childNodes[3].childNodes[e].textContent=a.text}))}}function No(){Game.Background.canvas.width=Game.Background.canvas.parentNode.offsetWidth,Game.Background.canvas.height=Game.Background.canvas.parentNode.offsetHeight,Game.LeftBackground.canvas.width=Game.LeftBackground.canvas.parentNode.offsetWidth,Game.LeftBackground.canvas.height=Game.LeftBackground.canvas.parentNode.offsetHeight,Game.DrawBackground()}function Oo(){1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar&&1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos?(l("CMBotBar").style.bottom=l("CMTimerBar").style.height,l("game").style.bottom=`${Number(l("CMTimerBar").style.height.replace("px",""))+70}px`):1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar?(l("CMBotBar").style.bottom="0px",l("game").style.bottom="70px"):1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos?l("game").style.bottom=l("CMTimerBar").style.height:l("game").style.bottom="0px",1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos?l("sectionLeft").style.top=l("CMTimerBar").style.height:l("sectionLeft").style.top="",No()}function Do(){1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar?l("CMTimerBar").style.display="":l("CMTimerBar").style.display="none",Oo()}function Ao(){xe=Game.dragonAura,Te=Game.dragonAura2}function Lo(e){const t=Game.Achievements[e],o={};return o.name=t.name,o}function Wo(e){let t=1;if(Object.keys(e.tieredUpgrades).forEach((o=>{!Game.Tiers[e.tieredUpgrades[o].tier].special&&Lt(e.tieredUpgrades[o].name)&&(t*=2)})),Object.keys(e.synergies).forEach((o=>{if(Lt(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)}})),e.fortune&&Lt(e.fortune.name)&&(t*=1.07),e.grandma&&Lt(e.grandma.name)&&(t*=1+.01*Ft.Grandma.amount*(1/(e.id-1))),"object"==typeof e.tieredUpgrades.misfortune&&1===e.vanilla&&Lt(e.tieredUpgrades.misfortune.name))switch(Game.elderWrath){default:t*=1;break;case 1:t*=1.02;break;case 2:t*=1.04;break;case 3:t*=1.06}return t}function jo(e){const t=Game.Objects[e],o={};return"Cursor"===t.name?o.cps=function(e){let t=0;Lt("Thousand fingers")&&(t+=.1),Lt("Million fingers")&&(t*=5),Lt("Billion fingers")&&(t*=10),Lt("Trillion fingers")&&(t*=20),Lt("Quadrillion fingers")&&(t*=20),Lt("Quintillion fingers")&&(t*=20),Lt("Sextillion fingers")&&(t*=20),Lt("Septillion fingers")&&(t*=20),Lt("Octillion fingers")&&(t*=20),Lt("Nonillion fingers")&&(t*=20);let o=1,n=0;return Object.keys(Ft).forEach((e=>{"Cursor"!==Ft[e].name&&(n+=Ft[e].amount)})),t*=n,o*=Wo(e),o*=Game.magicCpS("Cursor"),o*=At("cursorCps"),Game.ComputeCps(.1,Lt("Reinforced index finger")+Lt("Carpal tunnel prevention cream")+Lt("Ambidextrous"),t)*o}:"Grandma"===t.name?o.cps=function(e){let o=1;if(Object.keys(Game.GrandmaSynergies).forEach((e=>{Lt(Game.GrandmaSynergies[e])&&(o*=2)})),Lt("Bingo center/Research facility")&&(o*=4),Lt("Ritual rolling pins")&&(o*=2),Lt("Naughty list")&&(o*=2),Lt("Elderwort biscuits")&&(o*=1.02),o*=At("grandmaCps"),Lt("Cat ladies"))for(let e=0;e<Game.UpgradesByPool.kitten.length;e++)Lt(Game.UpgradesByPool.kitten[e].name)&&(o*=1.29);o*=Wo(e);let n=0;Lt("One mind")&&(n+=.02*Ft.Grandma.amount),Lt("Communal brainsweep")&&(n+=.02*Ft.Grandma.amount),Lt("Elder Pact")&&(n+=.05*Ft.Portal.amount);let a=0;return Object.keys(Ft).forEach((e=>{"Grandma"!==Ft[e].name&&(a+=Ft[e].amount)})),o*=1+.01*Ot("Elder Battalion")*a,o*=Game.magicCpS(t.name),(t.baseCps+n)*o}:o.cps=function(e){let t=1;return t*=Wo(e),t*=Game.magicCpS(e.name),e.baseCPS*t},o.baseCps=t.baseCps,o.name=t.name,o.tieredUpgrades=t.tieredUpgrades,o.synergies=t.synergies,o.fortune=t.fortune,o.grandma=t.grandma,o.baseCPS=t.baseCps,o.id=t.id,o.vanilla=t.vanilla,o}function Ho(e){const t=Game.Upgrades[e],o={};return o.power=t.power,"function"==typeof o.power&&("Sugar crystal cookies"===t.name?o.power=function(){let e=5;return Object.keys(Ft).forEach((t=>{Ft[t].level>=10&&(e+=1)})),e}:o.power=function(){let e=2;if(Lt("Starlove")&&(e=3),Game.hasGod){const t=Wt("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 Uo(){de=Game.UpgradesOwned,me=Game.pledges,pe=Game.AchievementsOwned,ue=Game.heavenlyPower,he=Game.prestige,Object.keys(Game.Objects).forEach((e=>{const t=Game.Objects[e];let o=Ft[e];void 0===o&&(Ft[e]=jo(e),o=Ft[e],Fo(e)),o.amount=t.amount,o.level=t.level,o.totalCookies=t.totalCookies,o.basePrice=t.basePrice,o.free=t.free,t.minigameLoaded&&("Temple"===t.name&&(ke=t.minigame.slot[0],Ce=t.minigame.slot[1],Me=t.minigame.slot[2]),o.minigameLoaded=t.minigameLoaded,o.minigame=t.minigame),Ft[e]=o})),Object.keys(Game.Upgrades).forEach((e=>{const t=Game.Upgrades[e];let o=Pt[e];void 0===o&&(Pt[e]=Ho(e),o=Pt[e]),o.bought=t.bought,Pt[e]=o})),Object.keys(Game.Achievements).forEach((e=>{const t=Game.Achievements[e];let o=Nt[e];void 0===o&&(Nt[e]=Lo(e),o=Nt[e]),o.won=t.won,Nt[e]=o})),Ao(),ge=xe,fe=Te}function $o(e){const t=document.createElement("div");return t.style.fontWeight="bold",t.id=`${e}Title`,t.className="CMTextBlue",t.textContent=e,t}function Ro(e){e.appendChild($o("Bonus Income"));const t=document.createElement("div");t.style.marginBottom="4px",t.style.color="white",t.id="CMTooltipIncome",e.appendChild(t),e.appendChild($o("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($o("Payback Period"));const n=document.createElement("div");n.style.marginBottom="4px",n.id="CMTooltipPP",e.appendChild(n),e.appendChild($o("Time Left"));const a=document.createElement("div");if(a.id="CMTooltipTime",e.appendChild(a),"b"===ho){e.appendChild($o("Production left till next achievement")),e.lastChild.id="CMTooltipProductionLeftHeader";const t=document.createElement("div");t.id="CMTooltipProductionLeft",e.appendChild(t)}if("b"===ho){e.appendChild($o("Buildings (price / PP) left till next achievement")),e.lastChild.id="CMTooltipNextAchievementHeader";const t=document.createElement("div");t.id="CMTooltipNextAchievement",e.appendChild(t)}}function Io(e,t){let o="";return o=e.pp<=0||e.pp===1/0?Xt:e.pp<vt?Rt:e.pp===vt?It:e.pp<Tt[10][0]?zt:e.pp<Tt[20][0]?Vt:e.pp<Tt[30][0]?_t:Qt,0!==Number(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit)&&t/So()<Number(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPSecondsLowerLimit)&&(o=Rt),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable&&t-Game.cookies>0&&(o=_t),o}function zo(){let e=1;return Object.keys(Game.buffs).forEach((t=>{void 0!==Game.buffs[t].multCpS&&(e*=Game.buffs[t].multCpS)})),e}function Vo(e){Nt[e]&&0===Nt[e].won&&(Nt[e].won=1,"shadow"!==Game.Achievements[e].pool&&(pe+=1))}function _o(){Ge=0;let e=1;const t={};Object.keys(Game.Objects).forEach((e=>{if(Game.Objects[e].minigameLoaded&&Game.Objects[e].minigame.effs){const o=Game.Objects[e].minigame.effs;Object.keys(o).forEach((e=>{t[e]?t[e]*=o[e]:t[e]=o[e]}))}})),be=t,1!==Game.ascensionMode&&(e+=.01*parseFloat(he)*ue*function(){let e=0;if(Lt("Heavenly chip secret")&&(e+=.05),Lt("Heavenly cookie stand")&&(e+=.2),Lt("Heavenly bakery")&&(e+=.25),Lt("Heavenly confectionery")&&(e+=.25),Lt("Heavenly key")&&(e+=.25),e*=1+.05*Ot("Dragon God"),Lt("Lucky digit")&&(e*=1.01),Lt("Lucky number")&&(e*=1.01),Lt("Lucky payout")&&(e*=1.01),Game.hasGod){const t=Wt("creation");1===t?e*=.7:2===t?e*=.8:3===t&&(e*=.9)}return e}()),e*=At("cps"),Lt("Heralds")&&1!==Game.ascensionMode&&(e*=1+.01*Game.heralds),Object.keys(Game.cookieUpgrades).forEach((t=>{const o=Game.cookieUpgrades[t];Lt(o.name)&&("function"==typeof o.power?e*=1+.01*Pt[o.name].power(Pt[o.name]):e*=1+.01*o.power)})),Lt("Specialized chocolate chips")&&(e*=1.01),Lt("Designer cocoa beans")&&(e*=1.02),Lt("Underworld ovens")&&(e*=1.03),Lt("Exotic nuts")&&(e*=1.04),Lt("Arcane sugar")&&(e*=1.05),Lt("Increased merriness")&&(e*=1.15),Lt("Improved jolliness")&&(e*=1.15),Lt("A lump of coal")&&(e*=1.01),Lt("An itchy sweater")&&(e*=1.01),Lt("Santa's dominion")&&(e*=1.2),Lt("Fortune #100")&&(e*=1.01),Lt("Fortune #101")&&(e*=1.07),Lt("Dragon scale")&&(e*=1.03);let o=1;if(Wt){let t=Wt("asceticism");1===t?e*=1.15:2===t?e*=1.1:3===t&&(e*=1.05),t=Wt("ages"),1===t?e*=1+.15*Math.sin(H/1e3/10800*Math.PI*2):2===t?e*=1+.15*Math.sin(H/1e3/43200*Math.PI*2):3===t&&(e*=1+.15*Math.sin(H/1e3/86400*Math.PI*2)),t=Wt("decadence"),1===t?o*=.93:2===t?o*=.95:3===t&&(o*=.98),t=Wt("industry"),1===t?o*=1.1:2===t?o*=1.06:3===t&&(o*=1.03),t=Wt("labor"),1===t?o*=.97:2===t?o*=.98:3===t&&(o*=.99)}Lt("Santa's legacy")&&(e*=1+.03*(Game.santaLevel+1));const n=pe/25;let a=1;if(Lt("Santa's milk and cookies")&&(a*=1.05),a*=1+.05*Ot("Breath of Milk"),Wt){const e=Wt("mother");1===e?a*=1.1:2===e?a*=1.05:3===e&&(a*=1.03)}a*=At("milk");let i=1;Lt("Kitten helpers")&&(i*=1+.1*n*a),Lt("Kitten workers")&&(i*=1+.125*n*a),Lt("Kitten engineers")&&(i*=1+.15*n*a),Lt("Kitten overseers")&&(i*=1+.175*n*a),Lt("Kitten managers")&&(i*=1+.2*n*a),Lt("Kitten accountants")&&(i*=1+.2*n*a),Lt("Kitten specialists")&&(i*=1+.2*n*a),Lt("Kitten experts")&&(i*=1+.2*n*a),Lt("Kitten consultants")&&(i*=1+.2*n*a),Lt("Kitten assistants to the regional manager")&&(i*=1+.175*n*a),Lt("Kitten marketeers")&&(i*=1+.15*n*a),Lt("Kitten analysts")&&(i*=1+.125*n*a),Lt("Kitten executives")&&(i*=1+.115*n*a),Lt("Kitten angels")&&(i*=1+.1*n*a),Lt("Fortune #103")&&(i*=1+.05*n*a),Object.keys(Ft).forEach((e=>{const t=Ft[e];let i=t.cps(t);1!==Game.ascensionMode&&(i*=(1+.01*t.level)*o),"Grandma"===t.name&&Lt("Milkhelp® lactose intolerance relief tablets")&&(i*=1+.05*n*a),Ge+=t.amount*i})),Lt('"egg"')&&(Ge+=9),e*=i;let r=1;if(Lt("Chicken egg")&&(r*=1.01),Lt("Duck egg")&&(r*=1.01),Lt("Turkey egg")&&(r*=1.01),Lt("Quail egg")&&(r*=1.01),Lt("Robin egg")&&(r*=1.01),Lt("Ostrich egg")&&(r*=1.01),Lt("Cassowary egg")&&(r*=1.01),Lt("Salmon roe")&&(r*=1.01),Lt("Frogspawn")&&(r*=1.01),Lt("Shark egg")&&(r*=1.01),Lt("Turtle egg")&&(r*=1.01),Lt("Ant larva")&&(r*=1.01),Lt("Century egg")){let e=10*Math.floor((U-Game.startDate)/1e3/10)/60/60/24;e=Math.min(e,100),ze=1+.1*(1-(1-e/100)**3),r*=ze}e*=r,Lt("Sugar baking")&&(e*=1+.01*Math.min(100,Game.lumps)),e*=1+Ot("Radiant Appetite");const s=Ge*e;Object.keys(Game.CpsAchievements).forEach((e=>{s>=Game.CpsAchievements[e].threshold&&Vo(Game.CpsAchievements[e].name)})),we=s;const{n:l}=Game.shimmerTypes.golden,c=Ot("Dragon's Fortune");for(let t=0;t<l;t++)e*=1+1.23*c;const d=Game.bakeryName.toLowerCase();if("orteil"===d?e*=.99:"ortiel"===d&&(e*=.98),Lt("Elder Covenant")&&(e*=.95),Lt("Golden switch [off]")){let t=1.5;if(Lt("Residual luck")){const e=Game.goldenCookieUpgrades;Object.keys(e).forEach((o=>{Lt(e[o])&&(t+=.1)}))}e*=t}if(Lt("Shimmering veil [off]")){let t=.5;Lt("Reinforced membrane")&&(t+=.1),e*=1+t}Lt("Magic shenanigans")&&(e*=1e3),Lt("Occult obstruction")&&(e*=0),Ge=Game.runModHookOnValue("cps",Ge),e*=zo(),Ge*=e}const Qo=["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"],Xo=["Skull cookies","Ghost cookies","Bat cookies","Slime cookies","Pumpkin cookies","Eyeball cookies","Spider cookies"],qo=["Christmas tree biscuits","Snowflake biscuits","Snowman biscuits","Holly biscuits","Candy cane biscuits","Bell biscuits","Present biscuits"],Yo=["Pure heart biscuits","Ardent heart biscuits","Sour heart biscuits","Weeping heart biscuits","Golden heart biscuits","Eternal heart biscuits","Prism heart biscuits"],Ko=["Elderwort biscuits","Bakeberry cookies","Duketater cookies","Green yeast digestives","Wheat slims","Fern tea","Ichor syrup"];function Jo(e){return Nt[e]?Nt[e].won:0}function Zo(){let e=0;Object.keys(Game.GrandmaSynergies).forEach((t=>{Lt(Game.GrandmaSynergies[t])&&(e+=1)})),!Jo("Elder")&&e>=7&&Vo("Elder"),!Jo("Veteran")&&e>=14&&Vo("Veteran");let t=0,o=1,n=1,a=1e5;Object.keys(Ft).forEach((e=>{t+=Ft[e].amount,a=Math.min(Ft[e].amount,a),Jo("Mathematician")||Ft[e].amount<Math.min(128,2**(Game.ObjectsById.length-Game.Objects[e].id-1))&&(o=0),Jo("Base 10")||Ft[e].amount<10*(Game.ObjectsById.length-Game.Objects[e].id)&&(n=0)})),a>=1&&Vo("One with everything"),1===o&&Vo("Mathematician"),1===n&&Vo("Base 10"),a>=100&&Vo("Centennial"),a>=150&&Vo("Centennial and a half"),a>=200&&Vo("Bicentennial"),a>=250&&Vo("Bicentennial and a half"),a>=300&&Vo("Tricentennial"),a>=350&&Vo("Tricentennial and a half"),a>=400&&Vo("Quadricentennial"),a>=450&&Vo("Quadricentennial and a half"),a>=500&&Vo("Quincentennial"),a>=550&&Vo("Quincentennial and a half"),a>=600&&Vo("Sexcentennial"),t>=100&&Vo("Builder"),t>=500&&Vo("Architect"),t>=1e3&&Vo("Engineer"),t>=2e3&&Vo("Lord of Constructs"),t>=4e3&&Vo("Grand design"),t>=8e3&&Vo("Ecumenopolis"),de>=20&&Vo("Enhancer"),de>=50&&Vo("Augmenter"),de>=100&&Vo("Upgrader"),de>=200&&Vo("Lord of Progress"),de>=300&&Vo("The full picture"),de>=400&&Vo("When there's nothing left to add"),t>=4e3&&de>=300&&Vo("Polymath"),t>=8e3&&de>=400&&Vo("Renaissance baker"),Ft.Cursor.amount+Ft.Grandma.amount>=777&&Vo("The elder scrolls");let i=!0;Object.keys(Xo).forEach((e=>{Lt(Xo[e])||(i=!1)})),i&&Vo("Spooky cookies");let r=!0;if(Object.keys(qo).forEach((e=>{Lt(qo[e])||(r=!1)})),r&&Vo("Let it snow"),Lt("Fortune cookies")){const e=Game.Tiers.fortune.upgrades;let t=0;Object.keys(e).forEach((o=>{Lt(e[o].name)&&(t+=1)})),t>=e.length&&Vo("O Fortuna")}}function en(e,t){Uo(),Ft[e].amount+=t;const o=Ft[e];"Cursor"===e?(o.amount>=1&&Vo("Click"),o.amount>=2&&Vo("Double-click"),o.amount>=50&&Vo("Mouse wheel"),o.amount>=100&&Vo("Of Mice and Men"),o.amount>=200&&Vo("The Digital"),o.amount>=300&&Vo("Extreme polydactyly"),o.amount>=400&&Vo("Dr. T"),o.amount>=500&&Vo("Thumbs, phalanges, metacarpals"),o.amount>=600&&Vo("With her finger and her thumb"),o.amount>=700&&Vo("Gotta hand it to you"),o.amount>=800&&Vo("The devil's workshop")):Object.keys(Game.Objects[o.name].tieredAchievs).forEach((e=>{o.amount>=Game.Tiers[Game.Objects[o.name].tieredAchievs[e].tier].achievUnlock&&Vo(Game.Objects[o.name].tieredAchievs[e].name)}));const n=pe;return _o(),Zo(),n!==pe&&_o(),Ge-Game.cookiesPs}function tn(e,t,o){let n=e,a=0;for(;n<o;)n+=.002*Math.max(.002,(n/Math.max(t,100))**.5),a+=1;return a/Game.fps}function on(){null!==l("CMDispTooltipWarningParent")&&(0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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 nn(){if(Uo(),"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"===ho?function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade&&1===Game.buyMode){let e;if(Ro(l("CMTooltipBorder")),1===Game.buyMode?so=e:e=so,1===Game.buyBulk?e=Qe:10===Game.buyBulk?e=Xe:100===Game.buyBulk&&(e=qe),po=Game.Objects[go].bulkPrice,uo=e[go].bonus,1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade&&1===Game.buyMode){l("CMTooltipIncome").textContent=$(uo,2);const t=Math.round(uo/Game.cookiesPs*1e4);Number.isFinite(t)&&0!==t?l("CMTooltipIncome").textContent+=` (${t/100}% of income)`:l("CMTooltipIncome").textContent+=` (<0${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator?",":"."}01% of income)`,l("CMTooltipBorder").className=Ut+e[go].color,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime?l("CMTooltipPP").textContent=xo(e[go].pp):l("CMTooltipPP").textContent=$(e[go].pp,2),l("CMTooltipPP").className=Ut+e[go].color;const o=To((po-(Game.cookies+Bo()))/So());l("CMTooltipTime").textContent=o.text,"Done!"===o.text&&Game.cookies<e[go].price?l("CMTooltipTime").textContent=`${o.text} (with Wrink)`:l("CMTooltipTime").textContent=o.text,l("CMTooltipTime").className=Ut+o.color}l("CMTooltipProductionLeftHeader").style.display="none",l("CMTooltipTime").style.marginBottom="0px";for(const e of Object.keys(Game.Objects[go].productionAchievs))if(!Game.HasAchiev(Game.Objects[go].productionAchievs[e].achiev.name)){const t=Game.Objects[go].productionAchievs[e];l("CMTooltipTime").style.marginBottom="4px",l("CMTooltipProductionLeftHeader").style.display="",l("CMTooltipProductionLeft").className=`ProdAchievement${go}`,l("CMTooltipProductionLeft").textContent=$(t.pow-Ft[go].totalCookies,15),l("CMTooltipProductionLeft").style.color="white";break}const t=Ye[go];if(t.AmountNeeded<101){let e;l("CMTooltipProductionLeft").style.marginBottom="4px",l("CMTooltipNextAchievementHeader").style.display="",e=Game.cookiesPs?Math.max(t.price-(Game.cookies+Bo()),0)/Game.cookiesPs+t.price/en(go,t.AmountNeeded):t.price/en(go,t.AmountNeeded),l("CMTooltipNextAchievement").textContent=`${$(t.AmountNeeded)} / ${$(t.price)} / `,l("CMTooltipNextAchievement").style.color="white";const o=document.createElement("span");Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime?o.textContent=xo(e):o.textContent=$(e),o.className=Ut+Io({pp:e},t.price),l("CMTooltipNextAchievement").appendChild(o)}else l("CMTooltipNextAchievementHeader").style.display="none",l("CMTooltipProductionLeft").style.marginBottom="0px"}else l("CMTooltipArea").style.display="none"}():"u"===ho?function(){if(Ro(l("CMTooltipBorder")),uo=ot[Game.UpgradesInStore[go].name].bonus,po=Game.Upgrades[Game.UpgradesInStore[go].name].getPrice(),fo=ot[Game.UpgradesInStore[go].name].bonusMouse,1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipBuildUpgrade){l("CMTooltipIncome").textContent=$(uo,2);const e=Math.round(uo/Game.cookiesPs*1e4);"0"===l("CMTooltipIncome").textContent?(l("Bonus IncomeTitle").style.display="none",l("CMTooltipIncome").style.display="none",l("Payback PeriodTitle").style.display="none",l("CMTooltipPP").style.display="none"):(Number.isFinite(e)&&0!==e?l("CMTooltipIncome").textContent+=` (${e/100}% of income)`:l("CMTooltipIncome").textContent+=` (<0${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator?",":"."}01% of income)`,l("CMTooltipBorder").className=Ut+ot[Game.UpgradesInStore[go].name].color),fo&&(l("CMTooltipCookiePerClick").textContent=$(fo),l("CMTooltipCookiePerClick").style.display="block",l("CMTooltipCookiePerClick").previousSibling.style.display="block"),!uo&&fo?(l("CMTooltipPP").textContent=`${$(po/fo)} Clicks`,l("CMTooltipPP").style.color="white",l("Payback PeriodTitle").style.display="block",l("CMTooltipPP").style.display="block"):(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPDisplayTime?l("CMTooltipPP").textContent=xo(ot[Game.UpgradesInStore[go].name].pp):l("CMTooltipPP").textContent=$(ot[Game.UpgradesInStore[go].name].pp,2),l("CMTooltipPP").className=Ut+ot[Game.UpgradesInStore[go].name].color);const t=To((po-(Game.cookies+Bo()))/So());if(l("CMTooltipTime").textContent=t.text,"Done!"===t.text&&Game.cookies<Game.UpgradesInStore[go].getPrice()?l("CMTooltipTime").textContent=`${t.text} (with Wrink)`:l("CMTooltipTime").textContent=t.text,l("CMTooltipTime").className=Ut+t.color,"Chocolate egg"===Game.UpgradesInStore[go].name){l("CMTooltipBorder").lastChild.style.marginBottom="4px",l("CMTooltipBorder").appendChild($o("Cookies to be gained (Currently/Max)"));const e=document.createElement("div");e.style.color="white",e.textContent=`${$(.05*Game.cookies)} / ${$(_e)}`,l("CMTooltipBorder").appendChild(e)}}else l("CMTooltipArea").style.display="none"}():"s"===ho?function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipLump){const t=l("CMTooltipBorder");t.appendChild($o("Current Sugar Lump"));const o=document.createElement("div");o.id="CMTooltipTime",t.appendChild(o);const n=0===(e=Game.lumpCurrentType)?{text:"Normal",color:Xt}:1===e?{text:"Bifurcated",color:It}:2===e?{text:"Golden",color:zt}:3===e?{text:"Meaty",color:Vt}:4===e?{text:"Caramelized",color:Qt}:{text:"Unknown Sugar Lump",color:_t};o.textContent=n.text,o.className=Ut+n.color}else l("CMTooltipArea").style.display="none";var e}():"g"===ho?function(){const{minigame:e}=Game.Objects["Wizard tower"],t=e.getSpellCost(e.spellsById[go]);if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipGrim&&t<=e.magicM){const o=l("CMTooltipBorder");o.appendChild($o("Time Left"));const n=document.createElement("div");n.id="CMTooltipTime",o.appendChild(n);const a=To(tn(e.magic,e.magicM,t));if(n.textContent=a.text,n.className=Ut+a.color,t<=e.magic){o.appendChild($o("Recover Time"));const n=document.createElement("div");n.id="CMTooltipRecover",o.appendChild(n);const a=To(tn(Math.max(0,e.magic-t),e.magicM,e.magic));n.textContent=a.text,n.className=Ut+a.color}if("0"===go){o.appendChild($o("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=$(Math.min(.15*(Game.cookies+Bo()),60*He*30),2),e.appendChild(t);const n=document.createElement("span");n.textContent=" / ",e.appendChild(n);const a=document.createElement("span");a.style.color="red",a.textContent=$(60*He*15,2),e.appendChild(a)}l("CMTooltipArea").appendChild(o)}else l("CMTooltipArea").style.display="none"}():"p"===ho?function(){const{minigame:e}=Game.Objects.Farm;if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipPlots&&0!==e.plot[go[1]][go[0]][0]){const t=e.plot[go[1]][go[0]][1]>e.plantsById[e.plot[go[1]][go[0]][0]-1].mature,o=e.plantsById[e.plot[go[1]][go[0]][0]-1].name;l("CMTooltipBorder").appendChild($o("Reward (Current / Maximum)"));const n=document.createElement("div");n.id="CMTooltipPlantReward",l("CMTooltipBorder").appendChild(n),"Bakeberry"===o?l("CMTooltipPlantReward").textContent=`${t?$(Math.min(.03*Game.cookies,60*Game.cookiesPs*30)):"0"} / ${$(60*Game.cookiesPs*30)}`:"Chocoroot"===o||"White chocoroot"===o?l("CMTooltipPlantReward").textContent=`${t?$(Math.min(.03*Game.cookies,60*Game.cookiesPs*3)):"0"} / ${$(60*Game.cookiesPs*3)}`:"Queenbeet"===o?l("CMTooltipPlantReward").textContent=`${t?$(Math.min(.04*Game.cookies,60*Game.cookiesPs*60)):"0"} / ${$(60*Game.cookiesPs*60)}`:"Duketater"===o?l("CMTooltipPlantReward").textContent=`${t?$(Math.min(.08*Game.cookies,60*Game.cookiesPs*120)):"0"} / ${$(60*Game.cookiesPs*120)}`:l("CMTooltipArea").style.display="none"}else l("CMTooltipArea").style.display="none"}():"ha"===ho?function(){const{minigame:e}=Game.Objects.Farm;if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipLump){l("CMTooltipBorder").appendChild($o("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 a=0;a<6;a++)if(e.plot[n][a][0]>=1){const i=e.plot[n][a],r=e.plantsById[i[0]-1],s=r.name;let l=!0;o&&r.immortal&&(l=!1),i[1]<r.matureBase&&(l=!1),l&&"Bakeberry"===s?t+=Math.min(.03*Game.cookies,60*Game.cookiesPs*30):l&&"Chocoroot"===s||"White chocoroot"===s?t+=Math.min(.03*Game.cookies,60*Game.cookiesPs*3):l&&"Queenbeet"===s?t+=Math.min(.04*Game.cookies,60*Game.cookiesPs*60):l&&"Duketater"===s&&(t+=Math.min(.08*Game.cookies,60*Game.cookiesPs*120))}l("CMTooltipBorder").appendChild(document.createTextNode($(t)))}else l("CMTooltipArea").style.display="none"}():"wb"===ho?function(){l("tooltip").innerHTML="",l("tooltip").appendChild($o("Reward:"));const e=document.createElement("div");e.id="CMWrinklerReward","PopAllNormal"===go?e.textContent=$(Je):"PopFattest"===go&&(e.textContent=$(Ze[0])),l("tooltip").appendChild(e)}():("pag"===ho||"pas"===ho&&-1!==go[1])&&function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipPantheon){const e=l("CMTooltipBorder");let t;t="pas"===ho?go[1]:go,e.appendChild($o("Effect in position 1:"));const o=document.createElement("div");if(o.id="CMPantheonTooltipPosition1",0!==Et[t][0]){o.textContent=$(Et[t][0]);const e=Math.round(Et[t][0]/Game.cookiesPs*1e4);Number.isFinite(e)&&0!==e?o.textContent+=` (${e/100}% of income)`:o.textContent+=` (<0${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator?",":"."}01% of income)`}else o.textContent="No effect to CPS";e.appendChild(o),e.appendChild($o("Effect in position 2:"));const n=document.createElement("div");if(n.id="CMPantheonTooltipPosition2",0!==Et[t][1]){n.textContent=$(Et[t][1]);const e=Math.round(Et[t][1]/Game.cookiesPs*1e4);Number.isFinite(e)&&0!==e?n.textContent+=` (${e/100}% of income)`:n.textContent+=` (<0${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator?",":"."}01% of income)`}else n.textContent="No effect to CPS";e.appendChild(n),e.appendChild($o("Effect in position 3:"));const a=document.createElement("div");if(a.id="CMPantheonTooltipPosition2",0!==Et[t][2]){a.textContent=$(Et[t][2]);const e=Math.round(Et[t][2]/Game.cookiesPs*1e4);Number.isFinite(e)&&0!==e?a.textContent+=` (${e/100}% of income)`:a.textContent+=` (<0${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ScaleSeparator?",":"."}01% of income)`}else a.textContent="No effect to CPS";e.appendChild(a),l("CMTooltipArea").appendChild(e)}else l("CMTooltipArea").style.display="none"}(),function(){if("b"===ho||"u"===ho){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,a){const i=document.createElement("div");i.id=e,i.style.display="none",i.style.transition="opacity 0.1s ease-out",i.className="CMBorder"+t,i.style.padding="2px",i.style.background="#000 url(img/darkNoise.png)";const r=document.createElement("div");i.appendChild(r);const s=document.createElement("span");s.className=Ut+t,s.style.fontWeight="bold",s.textContent=o,r.appendChild(s),r.appendChild(document.createTextNode(n));const l=document.createElement("div");i.appendChild(l);const c=document.createElement("span");return c.id=a,l.appendChild(document.createTextNode("Deficit: ")),l.appendChild(c),i};return e.appendChild(t("CMDispTooltipWarnLucky",_t,"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",zt,"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",Qt,"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",Qt,"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",Qt,"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",_t,"Warning: ",`Purchase of this item will put you under the number of Cookies equal to ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser} seconds of CPS`,"CMDispTooltipWarnUserText")),e}()),on()),0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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+Bo()-po,t=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnBon?uo:0;let o=Ee;if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnBon){let e=uo;e/=zo(),o+=60*e*15/.15}if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLucky&&e<o&&("b"!==ho||1===Game.buyMode)?(l("CMDispTooltipWarnLucky").style.display="",l("CMDispTooltipWarnLuckyText").textContent=`${$(o-e)} (${xo((o-e)/(So()+t))})`):l("CMDispTooltipWarnLucky").style.display="none",1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLuckyFrenzy){const n=7*o;e<n&&("b"!==ho||1===Game.buyMode)?(l("CMDispTooltipWarnLuckyFrenzy").style.display="",l("CMDispTooltipWarnLuckyFrenzyText").textContent=`${$(n-e)} (${xo((n-e)/(So()+t))})`):l("CMDispTooltipWarnLuckyFrenzy").style.display="none"}else l("CMDispTooltipWarnLuckyFrenzy").style.display="none";if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnConjure){const n=2*o;e<n&&("b"!==ho||1===Game.buyMode)?(l("CMDispTooltipWarnConjure").style.display="",l("CMDispTooltipWarnConjureText").textContent=`${$(n-e)} (${xo((n-e)/(So()+t))})`):l("CMDispTooltipWarnConjure").style.display="none"}else l("CMDispTooltipWarnConjure").style.display="none";if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnConjureFrenzy){const n=2*o*7;e<n&&("b"!==ho||1===Game.buyMode)?(l("CMDispTooltipWarnConjureFrenzy").style.display="",l("CMDispTooltipWarnConjureFrenzyText").textContent=`${$(n-e)} (${xo((n-e)/(So()+t))})`):l("CMDispTooltipWarnConjureFrenzy").style.display="none"}else l("CMDispTooltipWarnConjureFrenzy").style.display="none";1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnEdifice&&Game.Objects["Wizard tower"].minigameLoaded&&We&&e<We&&("b"!==ho||1===Game.buyMode)?(l("CMDispTooltipWarnEdifice").style.display="",l("CMDispTooltipWarnEdificeText").textContent=`${$(We-e)} (${xo((We-e)/(So()+t))})`):l("CMDispTooltipWarnEdifice").style.display="none",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser>0&&e<Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser*So()&&("b"!==ho||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 ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser} seconds of CPS`,l("CMDispTooltipWarnUserText").textContent=`${$(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser*So()-e)} (${xo((Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnUser*So()-e)/(So()+t))})`):l("CMDispTooltipWarnUser").style.display="none"}else null!==l("CMDispTooltipWarningParent")&&l("CMDispTooltipWarningParent").remove()}()}else null===l("CMTooltipArea")&&null!==l("CMDispTooltipWarningParent")&&l("CMDispTooltipWarningParent").remove()}function an(){if(Game.prefs.autosave&&Game.drawT%10==0&&"stats"===Game.onMenu&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Stats){const e=document.getElementById("CMStatsAutosaveTimer");e&&(e.innerText=Game.sayTime(60*Game.fps-Game.T%(60*Game.fps),4))}if(Go(),vo(),wo(),function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar){const e=l("CMTimerBar").offsetWidth-163,t=l("CMTimerBar").offsetWidth-133;let o=0;if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AutosaveTimerBar&&Game.prefs.autosave){const e=(60*Game.fps-(Game.OnAscend?0:Game.T%(60*Game.fps)))/Game.fps;l("CMTimerBarAutosave").style.display="",l("CMTimerBarAutosaveBar").style.width=`${Math.round(e*(t-8*Math.ceil(e).toString().length)/60)}px`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay>=1?l("CMTimerBarAutosaveBar").textContent=Math.ceil(e):l("CMTimerBarAutosaveBar").textContent="",l("CMTimerBarAutosaveTime").textContent=Math.ceil(e),o+=1}else l("CMTimerBarAutosave").style.display="none";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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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+=1),"christmas"===Game.season&&0===Game.shimmerTypes.reindeer.spawned?(l("CMTimerBarRen").style.display="",l("CMTimerBarRenMinBar").style.width=`${Math.round(Math.max(0,Game.shimmerTypes.reindeer.minTime-Game.shimmerTypes.reindeer.time)*e/Game.shimmerTypes.reindeer.maxTime)}px`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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+=1):l("CMTimerBarRen").style.display="none";const n={};l("CMTimerBarBuffTimers").innerHTML="",Object.keys(Game.buffs).forEach((e=>{if(Game.buffs[e]){const a=Eo(Game.buffs[e].name,Game.buffs[e].name,[{id:`${Game.buffs[e].name}Bar`}]);a.style.display="";let i="";i=void 0!==mo[Game.buffs[e].name]?mo[Game.buffs[e].name]:Qt,a.lastChild.children[1].className=$t+i,a.lastChild.children[1].style.color="black",2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarOverlay?a.lastChild.children[1].textContent=`${Math.round(Game.buffs[e].time/Game.buffs[e].maxTime*100)}%`:a.lastChild.children[1].textContent="",a.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`,a.lastChild.children[2].textContent=Math.ceil(Game.buffs[e].time/Game.fps),o+=1,n[Game.buffs[e].name]=a}})),Object.keys(n).forEach((e=>{l("CMTimerBarBuffTimers").appendChild(n[e])})),0!==o&&(l("CMTimerBar").style.height=12*o+2+"px"),Co!==o&&(Co=o,Oo())}}(),Po(),nn(),function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipWrink&&1===to){let e=!1;Object.keys(Game.wrinklers).forEach((t=>{const o=Game.wrinklers[t];if(o.phase>0&&o.selected){if(e=!0,0===no[t]||void 0===no[t]){const e=document.createElement("div"),o=document.createElement("div");o.style.minWidth="120px",o.style.marginBottom="4px";const n=document.createElement("div");n.style.textAlign="center",n.id="CMTooltipWrinkler",o.appendChild(n),e.appendChild(o),Game.tooltip.draw(this,escape(e.innerHTML)),oo=t,no[t]=1}}else no[t]=0})),e||Game.tooltip.hide()}}(),function(){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipWrink&&null!==l("CMTooltipWrinkler")){let{sucked:e}=Game.wrinklers[oo],t=1.1;if(Game.Has("Sacrilegious corruption")&&(t*=1.05),1===Game.wrinklers[oo].type&&(t*=3),e*=t,Game.Has("Wrinklerspawn")&&(e*=1.05),Ft.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=$(e)}}(),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpStats&&"stats"===Game.onMenu&&(Game.drawT-1)%(5*Game.fps)!=0&&(Game.drawT-1)%Game.fps==0&&Game.UpdateMenu(),g(),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Scale&&!Game.OnAscend){let e=l("cookies").innerHTML.replace(/.*(?=<br>)/i,$(Game.cookies));Game.prefs.monospace&&(e=`<span class="monospace">${e}</span>`),l("cookies").innerHTML=e}}function rn(){R.addLatest(Game.computedMouseCps)}class sn{constructor(e){this.maxLength=e,this.queue=[]}addLatest(e){this.queue.push(e)>this.maxLength&&this.queue.shift()}calcAverage(e){let t=e;t>this.maxLength&&(t=this.maxLength),t>this.queue.length&&(t=this.queue.length);let o=0;for(let e=this.queue.length-1;e>=0&&e>this.queue.length-1-t;e--)o+=this.queue[e];return 0===o?0:o/t}calcSum(e){let t=e;return t>this.maxLength&&(t=this.maxLength),t>this.queue.length&&(t=this.queue.length),0===t?0:this.queue.slice(-t).reduce(((e,t)=>e+t),0)}}function ln(){const e=Math.floor(Date.now()/1e3);if(Game.T/Game.fps%1==0){let t=Game.cookies+Bt;Game.cpsSucked>0&&(t+=Ke),Mt=Math.max(Game.cookiesEarned,t),t*=.05;const o=e-q,n=Math.max(0,Game.cookies-Y)/o,a=Math.max(0,Ke-K)/o,i=Math.max(0,Ze[0]-J)/o,r=Math.max(0,t-_e)/o,s=(Game.cookieClicks-Z)/o;for(let e=0;e<o;e++)I.addLatest(n),z.addLatest(a),V.addLatest(i),_.addLatest(r),Q.addLatest(s);q=e,Y=Game.cookies,K=Ke,J=Ze[0],_e=t,Z=Game.cookieClicks;const l=lo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist];ee=I.calcAverage(l),te=z.calcAverage(l),oe=V.calcAverage(l),ne=_.calcAverage(l),ae=ee,1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink&&(ae+=te),2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink&&(ae+=oe);const c=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg");yt=c||0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?ee+te+(c?ne:0):ae,nt=Q.calcAverage(co[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist])}}function cn(e,t,o,n,a){let i=0;for(let e=Math.max(0,o);e<Math.max(0,o+a);e++)i+=Game.priceIncrease**Math.max(0,e-n);let r=t*i;return r=Game.modifyBuildingPrice(Game.Objects[e],r),Math.ceil(r)}function dn(e,t){Object.keys(e).forEach((o=>{if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode&&1===t)e[o].color=Xt;else{e[o].color=Io(e[o],cn(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,t));for(let t=0;t<Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;t++)e[o].pp===Tt[t][0]&&(e[o].color=Xt)}}))}function mn(e,t){Object.keys(e).forEach((o=>{const n=cn(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,t);Game.cookiesPs?e[o].pp=Math.max(n-(Game.cookies+Bo()),0)/Game.cookiesPs+n/e[o].bonus:e[o].pp=n/e[o].bonus,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPRigidelMode&&1===t||Tt.push([e[o].pp,t,n])}))}function pn(){!function(){vt=1/0,Tt=[],void 0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop=0),mn(Qe,1),mn(Xe,10),mn(qe,100),Tt.sort(((e,t)=>e[0]-t[0]));let e=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPExcludeTop;if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.PPOnlyConsiderBuyable)for(;Tt[e][2]>Game.cookies&&(e+=1,Tt.length!==e+1););vt=Tt[e][0],xt=Tt[e][1],dn(Qe,1),dn(Xe,10),dn(qe,100)}(),Object.keys(ot).forEach((e=>{Game.cookiesPs?ot[e].pp=Math.max(Game.Upgrades[e].getPrice()-(Game.cookies+Bo()),0)/Game.cookiesPs+Game.Upgrades[e].getPrice()/ot[e].bonus:ot[e].pp=Game.Upgrades[e].getPrice()/ot[e].bonus,Number.isNaN(ot[e].pp)&&(ot[e].pp=1/0),ot[e].color=Io(ot[e],Game.Upgrades[e].getPrice())})),window.CookieMonsterData.Objects1=JSON.parse(JSON.stringify(Qe)),window.CookieMonsterData.Objects10=JSON.parse(JSON.stringify(Xe)),window.CookieMonsterData.Objects100=JSON.parse(JSON.stringify(qe)),window.CookieMonsterData.Upgrades=[],Object.entries(ot).forEach((e=>{window.CookieMonsterData.Upgrades[e[0]]=JSON.parse(JSON.stringify(e[1]))}))}function un(e){if("toggle"===Game.Upgrades[e].pool||0===Game.Upgrades[e].bought&&Game.Upgrades[e].unlocked&&"prestige"!==Game.Upgrades[e].pool){Uo(),"Shimmering veil [on]"===Pt[e].name?Pt["Shimmering veil [off]"].bought=0:"Golden switch [on]"===Pt[e].name?Pt["Golden switch [off]"].bought=0:Pt[e].bought=(Pt[e].bought+1)%2,Game.CountsAsUpgradeOwned(Game.Upgrades[e].pool)&&(de+=1),"Elder Pledge"===e?(me+=1,me>0&&Vo("Elder nap"),me>=5&&Vo("Elder slumber")):"Elder Covenant"===e?Vo("Elder calm"):"Prism heart biscuits"===e?Vo("Lovely cookies"):"Heavenly key"===e&&Vo("Wholesome");const t=pe;_o(),Zo(),t!==pe&&_o();const o=function(){let e=0;Lt("Thousand fingers")&&(e+=.1),Lt("Million fingers")&&(e*=5),Lt("Billion fingers")&&(e*=10),Lt("Trillion fingers")&&(e*=20),Lt("Quadrillion fingers")&&(e*=20),Lt("Quintillion fingers")&&(e*=20),Lt("Sextillion fingers")&&(e*=20),Lt("Septillion fingers")&&(e*=20),Lt("Octillion fingers")&&(e*=20),Lt("Nonillion fingers")&&(e*=20);let t=0;Object.keys(Ft).forEach((e=>{t+=Ft[e].amount})),t-=Ft.Cursor.amount,e*=t,Lt("Plastic mouse")&&(e+=.01*Ge),Lt("Iron mouse")&&(e+=.01*Ge),Lt("Titanium mouse")&&(e+=.01*Ge),Lt("Adamantium mouse")&&(e+=.01*Ge),Lt("Unobtainium mouse")&&(e+=.01*Ge),Lt("Eludium mouse")&&(e+=.01*Ge),Lt("Wishalloy mouse")&&(e+=.01*Ge),Lt("Fantasteel mouse")&&(e+=.01*Ge),Lt("Nevercrack mouse")&&(e+=.01*Ge),Lt("Armythril mouse")&&(e+=.01*Ge),Lt("Technobsidian mouse")&&(e+=.01*Ge),Lt("Plasmarble mouse")&&(e+=.01*Ge),Lt("Miraculite mouse")&&(e+=.01*Ge),Lt("Fortune #104")&&(e+=.01*Ge);let o=1;if(Lt("Santa's helpers")&&(o*=1.1),Lt("Cookie egg")&&(o*=1.1),Lt("Halo gloves")&&(o*=1.1),Lt("Dragon claw")&&(o*=1.03),Lt("Aura gloves")&&(o*=1+.05*Math.min(Game.Objects.Cursor.level,Lt("Luminous gloves")?20:10)),o*=At("click"),Ft.Temple.minigameLoaded&&Wt){const e=Wt("labor");1===e?o*=1.15:2===e?o*=1.1:3===e&&(o*=1.05)}Object.keys(Game.buffs).forEach((e=>{void 0!==Game.buffs[e].multClick&&(o*=Game.buffs[e].multClick)})),o*=1+.05*Ot("Dragon Cursor");let n=o*Game.ComputeCps(1,Lt("Reinforced index finger")+Lt("Carpal tunnel prevention cream")+Lt("Ambidextrous"),e);return n=Game.runModHookOnValue("cookiesPerClick",n),Game.hasBuff("Cursed finger")&&(n=Game.buffs["Cursed finger"].power),n}()-Game.computedMouseCps;return o?[Ge-Game.cookiesPs,o]:[Ge-Game.cookiesPs]}return[]}function hn(e){const t={};return Object.keys(Game.Objects).forEach((o=>{t[o]={},t[o].bonus=en(o,e),1!==e&&(se=1)})),t}function gn(){Object.keys(Game.Objects).forEach((e=>{Qe[e].price=cn(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,1),Xe[e].price=cn(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,10),qe[e].price=cn(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,100),Ye[e].price=cn(e,Game.Objects[e].basePrice,Game.Objects[e].amount,Game.Objects[e].free,Ye[e].AmountNeeded)}))}function fn(){Qe=hn(1),Xe=hn(10),qe=hn(100),function(){ot={};for(let e=0;e<Game.UpgradesInStore.length;e++){const t=Game.UpgradesInStore[e].name,o=un(t);"Elder Pledge"===t?(ot[t]={bonus:Game.cookiesPs-ee},1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink?ot[t].bonus-=te:2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.CalcWrink&&(ot[t].bonus-=oe),Number.isFinite(ot[t].bonus)||(ot[t].bonus=0)):(ot[t]={},o[0]&&(ot[t].bonus=o[0]),o[1]&&(ot[t].bonusMouse=o[1]))}}()}function kn(e,t,o){let n=0,a=0,i=0,r=0,s=1+Math.max(0,Math.ceil(Math.log(Game.cookies)/Math.LN10)-10);for(;i<t*o;)a=Math.max(e,Math.min(Math.floor(1/9*10**s*e*o),t*o)),i=Math.max(e,Math.min(Math.floor(1/9*10**(s+1)*e*o),t*o)),r=Math.floor(1/9*10**(s+1)*e*o),n+=a,s+=1;return[n,a,r]}function Cn(){let e=60*He*60*6*Ue;const t=zo();t>0?e/=t:e=0,ct=kn(7,e,$e),st=2*ct[1]/$e,lt=ct[2]/60/60/6/Ue,pt=kn(6,e,Re),dt=2*pt[1]/Re,mt=pt[2]/60/60/6/Ue,gt=kn(7,7*e,$e),ut=2*gt[1]/$e,ht=gt[2]/60/60/6/Ue,Ct=kn(6,7*e,Re),ft=2*Ct[1]/Re,kt=Ct[2]/60/60/6/Ue}function Mn(){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-ie,a=Math.max(0,o-re)/n;for(let e=0;e<n;e++)X.addLatest(a);ie=e,re=o,Ie=X.calcAverage(5)}}function yn(){at="",rt="",it="";const e=[];Object.keys(Game.Upgrades).forEach((t=>{e.push(Game.Upgrades[t])})),e.sort((function(e,t){return e.order>t.order?1:e.order<t.order?-1:0})),Object.keys(e).forEach((t=>{const o=e[t];if(0===o.bought){let e="";e+=function(e){let t="crate upgrade missing";"prestige"===e.pool&&(t+=" heavenly");let o=0;Game.prefs.crates||(o=1),o&&(t+=" noFrame");let{icon:n}=e;e.iconFunction&&(n=e.iconFunction());const a=`function() {return Game.crateTooltip(Game.UpgradesById[${e.id}], 'stats');}`;return`<div class="${t}"\n\t${Game.getDynamicTooltip(a,"top",!0)}\n\tstyle = "${n[2]?`background-image: url(${n[2]});`:""}background-position:${48*-n[0]}px ${48*-n[1]}px;">\n\t</div>`}(o),"prestige"===o.pool?it+=e:"cookie"===o.pool?rt+=e:"toggle"!==o.pool&&"unused"!==o.pool&&"debug"!==o.pool&&(at+=e)}}))}function bn(){if("christmas"===Game.season){let e=60*Game.cookiesPs;Game.hasBuff("Elder frenzy")&&(e*=.5),Game.hasBuff("Frenzy")&&(e*=.75),Ve=Math.max(25,e),Game.Has("Ho ho ho-flavored frosting")&&(Ve*=2)}}function Gn(){Ee=900*He/.15,Ee*=Ue;const e=zo();e>0?Ee/=e:Ee=0,Fe=$e*(.15*Ee)+13,Pe=Re*(.15*Ee)+13,Ne=7*Ee,Oe=$e*(.15*Ne)+13,De=Re*(.15*Ne)+13,Ae=2*Ee,Le=.15*Ae,We=0;let t=0,o=0;Object.keys(Game.Objects).forEach((e=>{Game.Objects[e].amount>t&&(t=Game.Objects[e].amount),Game.Objects[e].amount>0&&(o+=1)})),Object.keys(Game.Objects).forEach((e=>{(Game.Objects[e].amount<t||1===o)&&Game.Objects[e].amount<400&&2*Game.Objects[e].price>We&&(We=2*Game.Objects[e].price,je=e)}))}function wn(){let e=1,t=1,o=1;Lt("Green yeast digestives")&&(o*=1.01),Lt("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"),$e=o*e,Re=o*t,Ue=1,0===Game.shimmerTypes.golden.n&&(Ue*=1+1.23*Game.auraMult("Dragon's Fortune"))}function vn(e){const t={};Object.keys(Game.Objects).forEach((o=>{if(0!==Object.keys(Ye).length&&Ye[o].TotalNeeded>Game.Objects[o].amount&&!e)t[o]={AmountNeeded:Ye[o].TotalNeeded-Game.Objects[o].amount,TotalNeeded:Ye[o].TotalNeeded,price:cn(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,Ye[o].TotalNeeded-Game.Objects[o].amount)};else{const e=function(e){const t=Game.AchievementsOwned;let o=100,n=100;for(;o>-1;)if(en(e,o),pe>t)n=o,o-=10;else{if(100===o)return 101;for(o+=1;o<=n;){if(en(e,o),pe>t)return o;o+=1}}return 101}(o);t[o]={AmountNeeded:e,TotalNeeded:Game.Objects[o].amount+e,price:cn(o,Game.Objects[o].basePrice,Game.Objects[o].amount,Game.Objects[o].free,e)}}})),Ye=t}function xn(){Ke=0,Je=0,Ze=[0,null];for(let e=0;e<Game.wrinklers.length;e++){let{sucked:t}=Game.wrinklers[e],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),Ft.Temple.minigameLoaded){const e=Game.hasGod("scorn");1===e?t*=1.15:2===e?t*=1.1:3===e&&(t*=1.05)}Ke+=t,0===Game.wrinklers[e].type&&(Je+=t,t>Ze[0]&&(Ze=[t,e]))}}function Tn(){Ao(),xn(),Gn(),wn(),Cn(),yn(),bn(),I=new sn(lo[lo.length-1]),z=new sn(lo[lo.length-1]),V=new sn(lo[lo.length-1]),_=new sn(lo[lo.length-1]),Q=new sn(co[co.length-1]),X=new sn(5),R=new sn(20*co[co.length-1]),Mn(),vn(),ln(),fn(),gn(),pn()}function Sn(){Object.keys(Game.wrinklers).forEach((e=>{Game.wrinklers[e].sucked>0&&0===Game.wrinklers[e].type&&(Game.wrinklers[e].hp=0)}))}function Bn(e,t){if("b"===e){if(l("tooltip").innerHTML=Game.Objects[t].tooltip(),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAmor){const e=cn(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>${$(o)}</b> ${1===Math.floor(o)?"cookie":"cookies"} left to amortize (${To((e-Game.Objects[t].totalCookies)/(Game.Objects[t].storedTotalCps*Game.globalCpsMult)).text})</div>`))}-1===Game.buyMode&&(l("tooltip").innerHTML=l("tooltip").innerHTML.split($(Game.Objects[t].bulkPrice)).join($((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)():"wb"===e?l("tooltip").innerHTML="":"pag"===e?l("tooltip").innerHTML=Game.Objects.Temple.minigame.godTooltip(t)():"pas"===e&&(l("tooltip").innerHTML=Game.Objects.Temple.minigame.slotTooltip(t[0])());if("b"===e&&1===Game.buyMode||"u"===e||"s"===e||"g"===e||"p"===e&&!Game.keys[16]||"ha"===e||"wb"===e||"pag"===e||"pas"===e&&-1!==t[1]){const e=document.createElement("div");e.id="CMTooltipArea",l("tooltip").appendChild(e)}return ho=e,go=t,nn(),l("tooltip").innerHTML}function En(){1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Favicon&&F>0?bt.wrath?l("CMFavicon").href="https://CookieMonsterTeam.github.io/CookieMonster/favicon/wrathCookie.ico":l("CMFavicon").href="https://CookieMonsterTeam.github.io/CookieMonster/favicon/goldenCookie.ico":l("CMFavicon").href="https://orteil.dashnet.org/cookieclicker/favicon.ico"}function Fn(){Ft=[],Object.keys(Game.Objects).forEach((e=>{Ft[e]=jo(e)})),Pt=[],Object.keys(Game.Upgrades).forEach((e=>{Pt[e]=Ho(e)})),Nt=[],Object.keys(Game.Achievements).forEach((e=>{Nt[e]=Lo(e)})),Uo()}function Pn(){Game.Objects["Wizard tower"].minigameLoaded&&Object.keys(Game.Objects["Wizard tower"].minigame.spellsById).forEach((e=>{null!==l(`grimoireSpell${e}`).onmouseover&&(L[e]=l(`grimoireSpell${e}`).onmouseover,l(`grimoireSpell${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("g",`${e}`)),"this"),Game.tooltip.wobble()})}))}function Nn(){if(!x&&Game.Objects["Wizard tower"].minigameLoaded){const{minigame:e}=Game.Objects["Wizard tower"];w=e.draw,Game.Objects["Wizard tower"].minigame.draw=function(){w(),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GrimoireBar&&e.magic<e.magicM&&(e.magicBarTextL.innerHTML+=` (${xo(tn(e.magic,e.magicM,e.magicM))})`)},x=!0}}function On(){!function(){if(!v&&Game.Objects["Wizard tower"].minigameLoaded){const{minigame:e}=Game.Objects["Wizard tower"];b=e.launch,G=new Function(`return ${e.launch.toString().split("=this").join("= Game.Objects['Wizard tower'].minigame")}`),Game.Objects["Wizard tower"].minigame.launch=function(){G(),Pn(),x=!1,Nn(),v=!0}}}(),Nn()}var Dn=o(877),An=o.n(Dn);function Ln(){if(Se!==Game.dragonLevel||ye){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)Be="Not enough buildings to sell";else{let o=0;Uo();for(let n=0;n<t;n++){let t=Ft[e].basePrice*Game.priceIncrease**Math.max(0,Ft[e].amount-1-Ft[e].free);t=Game.modifyBuildingPrice(Ft[e],t),t=Math.ceil(t),o+=t,Ft[e].amount-=1}Be=`Cost to rebuy: ${$(o)}`}else{let o=0;Uo(),Object.keys(Game.Objects).forEach((n=>{if(e=n,Game.Objects[e].amount<t)Be="Not enough buildings to sell";else{for(let n=0;n<t;n++){let t=Ft[e].basePrice*Game.priceIncrease**Math.max(0,Ft[e].amount-1-Ft[e].free);t=Game.modifyBuildingPrice(Ft[e],t),t=Math.ceil(t),o+=t,Ft[e].amount-=1}Be=`Cost to rebuy: ${$(o)}`}}))}}Se=Game.dragonLevel}}const Wn=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 jn(){1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar?(l("CMBotBar").style.display="",Po()):l("CMBotBar").style.display="none",Oo()}function Hn(){BeautifyAll(),Game.RefreshStore(),Game.RebuildUpgrades(),Po(),Go(),vo()}class Un{constructor(e,t,o){this.defaultValue=e,this.type=t,this.group=o}}class $n extends Un{constructor(e,t,o,n){super(e,t,o),this.desc=n}}class Rn extends Un{constructor(e,t,o,n,a,i,r){super(e,t,o),this.label=n,this.desc=a,this.min=i,this.max=r}}class In extends Un{constructor(e,t,o,n,a,i,r){super(e,t,o),this.label=n,this.desc=a,this.toggle=i,void 0!==r&&(this.func=r)}}class zn extends Un{constructor(e,t,o,n,a){super(e,t,o),this.label=n,this.desc=a;for(let e=0;e<101;e++)this.label[e]=`${e}%`}}const Vn={CPSMode:new In(1,"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 In(3,"bool","Calculation",["Average CPS in past 10s","Average CPS in past 15s","Average CPS in past 30s","Average CPS in past 1m","Average CPS in past 5m","Average CPS in past 10m","Average CPS in past 15m","Average CPS in past 30m"],"How much time average Cookies Per Second should consider",!1),AvgClicksHist:new In(0,"bool","Calculation",["Average clicks in past 1s","Average clicks in past 5s","Average clicks in past 10s","Average clicks in past 15s","Average clicks in past 30s"],"How much time average Cookie Clicks should consider",!1),CalcWrink:new In(0,"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,(()=>{ye=!0})),Scale:new In(2,"bool","Notation",["Game's setting scale","Metric","Short scale","Short scale (Abbreviated)","Scientific notation","Engineering notation"],"Change how long numbers are formatted",!1,(()=>{Hn()})),ScaleDecimals:new In(2,"bool","Notation",["1 decimals","2 decimals","3 decimals"],'Set the number of decimals used when applicable. This only works with Cookie Monster scales and not with "Game\'s Setting Scale"',!1,(()=>{Hn()})),ScaleSeparator:new In(0,"bool","Notation",[". for decimals (standard)",". for thousands"],"Set the separator used for decimals and thousands",!1,(()=>{Hn()})),ScaleCutoff:new Rn(999999,"numscale","Notation","Notation cut-off point: ","The number from which Cookie Monster will start formatting numbers based on chosen scale. Standard is 999,999. Setting this above 999,999,999 might break certain notations",1,999999999),TimeFormat:new In(0,"bool","Notation",["Time XXd, XXh, XXm, XXs","Time XX:XX:XX:XX:XX"],"Change the time format",!1),DetailedTime:new In(1,"bool","Notation",["Detailed time OFF","Detailed time ON"],"Change how time is displayed in certain statistics and tooltips",!0,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DetailedTime?Game.sayTime=ao:Game.sayTime=j.sayTime})),PPDisplayTime:new In(0,"bool","Notation",["PP as value (standard)","PP as time unit"],"Display PP as calculated value or as approximate time unit. Note that PP does not translate directly into a time unit and this is therefore only an approximation.",!1),BuildColour:new In(1,"bool","Colours",["Building colours OFF","Building colours ON"],"Colour code buildings",!0,(()=>{Go()})),PPOnlyConsiderBuyable:new In(0,"bool","Colours",["Don't ignore non-buyable","Ignore non-buyable"],"Makes Cookie Monster 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),PPExcludeTop:new In(0,"bool","Colours",["Don't ignore any","Ignore 1st best","Ignore 1st and 2nd best","Ignore 1st, 2nd and 3rd best"],"Makes Cookie Monster ignore the 1st, 2nd or 3rd best buildings in labeling and colouring PP values",!0),PPRigidelMode:new In(0,"bool","Colours",["Rigidel mode OFF","Rigidel mode ON"],'Makes Cookie Monster ignore all "buy 1" options when colouring PP in order to stay at a total building count ending in 10 for pantheon god Rigidel',!0),PPSecondsLowerLimit:new Rn(0,"numscale","Colours","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),ColourBlue:new $n("#4bb8f0","colour","Colours","Standard colour is blue. Used to show upgrades better than best PP building, for Click Frenzy bar, and for various labels"),ColourGreen:new $n("#00ff00","colour","Colours","Standard colour is green. Used to show best PP building, for Blood Frenzy bar, and for various labels"),ColourYellow:new $n("#ffff00","colour","Colours","Standard colour is yellow. Used to show buildings within the top 10 of PP, for Frenzy bar, and for various labels"),ColourOrange:new $n("#ff7f00","colour","Colours","Standard colour is orange. Used to show buildings within the top 20 of PP, for Next Reindeer bar, and for various labels"),ColourRed:new $n("#ff0000","colour","Colours","Standard colour is Red. Used to show buildings within the top 30 of PP, for Clot bar, and for various labels"),ColourPurple:new $n("#ff00ff","colour","Colours","Standard colour is purple. Used to show buildings outside of the top 30 of PP, for Next Cookie bar, and for various labels"),ColourGray:new $n("#b3b3b3","colour","Colours","Standard colour is gray. Used to show negative or infinity PP, and for Next Cookie/Next Reindeer bar"),ColourPink:new $n("#ff1493","colour","Colours","Standard colour is pink. Used for Dragonflight bar"),ColourBrown:new $n("#8b4513","colour","Colours","Standard colour is brown. Used for Dragon Harvest bar"),BotBar:new In(1,"bool","BarsDisplay",["Bottom bar OFF","Bottom bar ON"],"Building information",!0,(()=>{jn()})),TimerBar:new In(1,"bool","BarsDisplay",["Timer bar OFF","Timer bar ON"],"Bar with timers for golden cookie, season popup, Frenzy (Normal, Clot, Elder), Click Frenzy",!0,(()=>{Do()})),TimerBarPos:new In(0,"bool","BarsDisplay",["Timer bar position (top left)","Timer bar position (bottom)"],"Placement of the timer bar",!1,(()=>{0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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"))),Oo()})),TimerBarOverlay:new In(2,"bool","BarsDisplay",["Timer bar overlay OFF","Timer bar overlay only seconds","Timer bar overlay full"],"Overlay on timers displaying seconds and/or percentage left",!0),AutosaveTimerBar:new In(0,"bool","BarsDisplay",["Autosave timer bar OFF","Autosave timer bar ON"],"Show a timer counting down till next autosave in the timer bar",!0),UpBarColour:new In(1,"bool","BarsDisplay",["Upgrade colours/bar OFF","Upgrade colours with bar ON","Upgrade colours without bar ON"],"Colour code upgrades and optionally add a counter bar",!1,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor?(l("CMUpgradeBar").style.display="",vo()):2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpBarColor?(l("CMUpgradeBar").style.display="none",vo()):(l("CMUpgradeBar").style.display="none",Game.RebuildUpgrades())})),UpgradeBarFixedPos:new In(1,"bool","BarsDisplay",["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,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.UpgradeBarFixedPos?(l("CMUpgradeBar").style.position="sticky",l("CMUpgradeBar").style.top="0px"):l("CMUpgradeBar").style.position=""})),SortBuildings:new In(0,"bool","BarsDisplay",["Sort buildings: default","Sort buildings: PP of x1 purchase","Sort buildings: PP of selected bulk mode","Sort buildings: price until next achievement"],"Sort the display of buildings in default order, by PP, or until next achievement",!1,(()=>{Go()})),SortUpgrades:new In(0,"bool","BarsDisplay",["Sort upgrades: default","Sort upgrades: PP"],"Sort the display of upgrades in either default order or by PP",!1,(()=>{vo()})),UpgradesNeverCollapse:new In(0,"bool","BarsDisplay",["Upgrades always expanded OFF","Upgrades always expanded ON"],"Toggle to make the upgrades sections always expanded to the size needed to display all upgrades",!0,(()=>{wo()})),DragonAuraInfo:new In(1,"bool","BarsDisplay",["Extra dragon aura info OFF","Extra dragon aura info ON"],"Shows information about changes in CPS and costs in the dragon aura interface.",!0),GrimoireBar:new In(1,"bool","BarsDisplay",["Grimoire magic meter timer OFF","Grimoire magic meter timer ON"],"A timer overlay showing how long till the Grimoire magic meter is full",!0),GCTimer:new In(1,"bool","BarsDisplay",["Golden cookie timer OFF","Golden cookie timer ON"],"A timer on the golden cookie when it has been spawned",!0,(()=>{1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer?Object.keys(Mo).forEach((e=>{Mo[e].style.display="block",Mo[e].style.left=St[e].l.style.left,Mo[e].style.top=St[e].l.style.top})):Object.keys(Mo).forEach((e=>Mo[e].style.display="none"))})),Favicon:new In(1,"bool","BarsDisplay",["Favicon OFF","Favicon ON"],"Update favicon with golden/wrath cookie",!0,(()=>{En()})),WrinklerButtons:new In(1,"bool","BarsDisplay",["Extra wrinkler buttons OFF","Extra wrinkler buttons ON"],"Show buttons for popping wrinklers at bottom of cookie section",!0,(()=>{g()})),HideSectionsButtons:new In(0,"bool","BarsDisplay",["Hide buildings/upgrades button OFF","Hide buildings/upgrades button ON"],"Show buttons for hiding and showing the buildings and upgrades sections in the right column",!0,(()=>{Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HideSectionsButtons?l("CMSectionHidButtons").style.display="":l("CMSectionHidButtons").style.display="none"})),TooltipBuildUpgrade:new In(1,"bool","Tooltip",["Building/upgrade tooltip information OFF","Building/upgrade tooltip information ON"],"Extra information in building/upgrade tooltips",!0),TooltipAmor:new In(0,"bool","Tooltip",["Buildings tooltip amortization information OFF","Buildings tooltip amortization information ON"],"Add amortization information to buildings tooltip",!0),ToolWarnLucky:new In(1,"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 In(1,"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 In(1,"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 In(1,"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 In(1,"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 Rn(0,"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),ToolWarnBon:new In(1,"bool","Tooltip",["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),ToolWarnPos:new In(1,"bool","Tooltip",["Tooltip warning position (left)","Tooltip warning position (bottom)"],"Placement of the warning boxes",!1,(()=>{on()})),TooltipGrim:new In(1,"bool","Tooltip",["Grimoire tooltip information OFF","Grimoire tooltip information ON"],"Extra information in tooltip for grimoire",!0),TooltipWrink:new In(1,"bool","Tooltip",["Wrinkler tooltip OFF","Wrinkler tooltip ON"],"Shows the amount of cookies a wrinkler will give when popping it",!0),TooltipLump:new In(1,"bool","Tooltip",["Sugar lump tooltip OFF","Sugar lump tooltip ON"],"Shows the current Sugar Lump type in Sugar lump tooltip.",!0),TooltipPlots:new In(1,"bool","Tooltip",["Garden plots tooltip OFF","Garden plots tooltip ON"],"Shows a tooltip for plants that have a cookie reward.",!0),TooltipPantheon:new In(1,"bool","Tooltip",["Pantheon tooltip OFF","Pantheon tooltip ON"],"Shows additional info in the pantheon tooltip",!0),TooltipAscendButton:new In(1,"bool","Tooltip",["Show Extra Info Ascend Tooltip OFF","Show Extra Info Ascend Tooltip ON"],"Shows additional info in the ascend tooltip",!0),Stats:new In(1,"bool","Statistics",["Statistics OFF","Statistics ON"],"Extra Cookie Monster statistics!",!0),MissingUpgrades:new In(1,"bool","Statistics",["Missing upgrades OFF","Missing upgrades ON"],"Shows missing upgrades in statistics menu",!0),MissingAchievements:new In(0,"bool","Statistics",["Missing Achievements OFF","Missing Normal Achievements ON"],"Shows missing normal achievements in statistics menu.",!0),UpStats:new In(1,"bool","Statistics",["Statistics update rate (default)","Statistics update rate (1s)"],"Default rate is once every 5 seconds",!1),HeavenlyChipsTarget:new Rn(1,"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 In(1,"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),Title:new In(1,"bool","NotificationGeneral",["Title OFF","Title ON","Title pinned tab highlight"],'Update title with colden 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 In(1,"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 In(0,"bool","NotificationGC",["Notification OFF","Notification ON"],"Create a notification when golden cookie spawns",!0,(()=>{Wn(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCNotification)})),GCFlash:new In(1,"bool","NotificationGC",["Flash OFF","Flash ON"],"Flash screen on golden cookie",!0),ColourGCFlash:new $n("#ffffff","colour","NotificationGC","The colour of the GC flash, standard colour is white"),GCSound:new In(1,"bool","NotificationGC",["Sound OFF","Sound ON"],"Play a sound on golden cookie",!0),GCVolume:new zn(100,"vol","NotificationGC",[],"Volume"),GCSoundURL:new In("https://freesound.org/data/previews/66/66717_931655-lq.mp3","url","NotificationGC","Sound URL:","URL of the sound to be played when a golden cookie spawns"),FortuneNotification:new In(0,"bool","NotificationFC",["Notification OFF","Notification ON"],"Create a notification when fortune cookie is on the ticker",!0,(()=>{Wn(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneNotification)})),FortuneFlash:new In(1,"bool","NotificationFC",["Flash OFF","Flash ON"],"Flash screen on fortune cookie spawn",!0),ColourFortuneFlash:new $n("#ffffff","colour","NotificationFC","The colour of the fortune flash, standard colour is white"),FortuneSound:new In(1,"bool","NotificationFC",["Sound OFF","Sound ON"],"Play a sound on fortune cookie spawn",!0),FortuneVolume:new zn(100,"vol","NotificationFC",[],"Volume"),FortuneSoundURL:new In("https://freesound.org/data/previews/174/174027_3242494-lq.mp3","url","NotificationFC","Sound URL:","URL of the sound to be played when the ticker has a fortune cookie"),SeaNotification:new In(0,"bool","NotificationSea",["Notification OFF","Notification ON"],"Create a notification on season popup",!0,(()=>{Wn(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaNotification)})),SeaFlash:new In(1,"bool","NotificationSea",["Flash OFF","Flash ON"],"Flash screen on season popup",!0),ColourSeaFlash:new $n("#ffffff","colour","NotificationSea","The colour of the season popup flash, standard colour is white"),SeaSound:new In(1,"bool","NotificationSea",["Sound OFF","Sound ON"],"Play a sound on season popup",!0),SeaVolume:new zn(100,"vol","NotificationSea",[],"Volume"),SeaSoundURL:new In("https://www.freesound.org/data/previews/121/121099_2193266-lq.mp3","url","NotificationSea","Sound URL:","URL of the sound to be played when on season popup spawns"),GardFlash:new In(1,"bool","NotificationGard",["Garden Tick Flash OFF","Flash ON"],"Flash screen on garden tick",!0),ColourGardFlash:new $n("#ffffff","colour","NotificationGard","The colour of the garden flash, standard colour is white"),GardSound:new In(1,"bool","NotificationGard",["Sound OFF","Sound ON"],"Play a sound on garden tick",!0),GardVolume:new zn(100,"vol","NotificationGard",[],"Volume"),GardSoundURL:new In("https://freesound.org/data/previews/103/103046_861714-lq.mp3","url","NotificationGard","Garden Tick Sound URL:","URL of the sound to be played when the garden ticks"),MagicNotification:new In(0,"bool","NotificationMagi",["Notification OFF","Notification ON"],"Create a notification when magic reaches maximum",!0,(()=>{Wn(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicNotification)})),MagicFlash:new In(1,"bool","NotificationMagi",["Flash OFF","Flash ON"],"Flash screen when magic reaches maximum",!0),ColourMagicFlash:new $n("#ffffff","colour","NotificationMagi","The colour of the magic flash, standard colour is white"),MagicSound:new In(1,"bool","NotificationMagi",["Sound OFF","Sound ON"],"Play a sound when magic reaches maximum",!0),MagicVolume:new zn(100,"vol","NotificationMagi",[],"Volume"),MagicSoundURL:new In("https://freesound.org/data/previews/221/221683_1015240-lq.mp3","url","NotificationMagi","Sound URL:","URL of the sound to be played when magic reaches maxium"),WrinklerNotification:new In(0,"bool","NotificationWrink",["Notification OFF","Notification ON"],"Create a notification when a wrinkler appears",!0,(()=>{Wn(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerNotification)})),WrinklerFlash:new In(1,"bool","NotificationWrink",["Flash OFF","Flash ON"],"Flash screen when a wrinkler appears",!0),ColourWrinklerFlash:new $n("#ffffff","colour","NotificationWrink","The colour of the wrinkler flash, standard colour is white"),WrinklerSound:new In(1,"bool","NotificationWrink",["Sound OFF","Sound ON"],"Play a sound when a wrinkler appears",!0),WrinklerVolume:new zn(100,"vol","NotificationWrink",[],"Volume"),WrinklerSoundURL:new In("https://freesound.org/data/previews/124/124186_8043-lq.mp3","url","NotificationWrink","Sound URL:","URL of the sound to be played when a wrinkler appears"),WrinklerMaxNotification:new In(0,"bool","NotificationWrinkMax",["Notification OFF","Notification ON"],"Create a notification when the maximum amount of wrinklers has appeared",!0,(()=>{Wn(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification)})),WrinklerMaxFlash:new In(1,"bool","NotificationWrinkMax",["Flash OFF","Flash ON"],"Flash screen when the maximum amount of Wrinklers has appeared",!0),ColourWrinklerMaxFlash:new $n("#ffffff","colour","NotificationWrinkMax","The colour of the maximum wrinkler flash, standard colour is white"),WrinklerMaxSound:new In(1,"bool","NotificationWrinkMax",["Sound OFF","Sound ON"],"Play a sound when the maximum amount of wrinklers has appeared",!0),WrinklerMaxVolume:new zn(100,"vol","NotificationWrinkMax",[],"Volume"),WrinklerMaxSoundURL:new In("https://freesound.org/data/previews/152/152743_15663-lq.mp3","url","NotificationWrinkMax","Sound URL:","URL of the sound to be played when the maximum amount of wrinklers has appeared"),BulkBuyBlock:new In(1,"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),FavouriteSettings:new In(1,"bool","Miscellaneous",["Favourite settings section OFF","Favourite settings section ON","Favourite settings section ON (Locked)"],"Show stars before each setting which allows selecting it for a 'favourites' section at the top of the Cookie Monster settings. Setting this to Locked removes the stars but shows the 'favourites' section",!0,(()=>{Game.UpdateMenu()}))},_n="CMConfig";function Qn(e){null!==l(`slider${e}`)&&(l(`slider${e}right`).innerHTML=`${l(`slider${e}`).value}%`,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]=Math.round(l(`slider${e}`).value)),t()}function Xn(e){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]+=1,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]>1&&(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]=0),t()}function qn(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=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[t]?"-":"+",n.onclick=function(){Xn(t),Game.UpdateMenu()},o.appendChild(n),o}function Yn(e,t,o,n){const a=document.createElement("div");a.className="listing";const i=document.createElement("b");if(i.textContent=t,a.appendChild(i),"withTooltip"===e){a.className="listing",a.appendChild(document.createTextNode(" "));const e=document.createElement("span");e.onmouseout=function(){Game.tooltip.hide()},e.onmouseover=function(){Game.tooltip.draw(this,escape(Zt[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="?",a.appendChild(e)}return a.appendChild(document.createTextNode(": ")),a.appendChild(o),a}function Kn(e,t,o,n){const a=document.createElement("div");a.className="listing";const i=document.createElement("b");return i.textContent=t,!0===n&&(i.style.color=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ColourGreen),a.appendChild(i),a.appendChild(document.createTextNode(": ")),a.appendChild(o),a}function Jn(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"),a=document.createElement("div");a.style.minWidth="140px",a.style.marginBottom="4px";const i=document.createElement("div");return i.className="name",i.style.marginBottom="4px",i.style.textAlign="center",i.textContent="Missing",a.appendChild(i),Object.keys(e).forEach((t=>{const o=document.createElement("div");o.style.textAlign="center",o.appendChild(document.createTextNode(e[t])),a.appendChild(o)})),n.appendChild(a),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 Zn(e){const t=document.createElement("div");if(t.className="subsection",t.appendChild(e),t.appendChild(qn("Lucky Cookies","Lucky")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Lucky&&t.appendChild(function(){const e=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder",t=document.createElement("div");t.className="CMStatsLuckySection";const o=Game.cookies+Bo()<Ee?_t:It,n=Game.cookies+Bo()<Ee?xo((Ee-(Game.cookies+Bo()))/So()):"",a=document.createDocumentFragment(),i=document.createElement("span");if(i.style.fontWeight="bold",i.className=Ut+o,i.textContent=$(Ee),a.appendChild(i),""!==n){const e=document.createElement("small");e.textContent=` (${n})`,a.appendChild(e)}t.appendChild(Yn("withTooltip",'"Lucky!" cookies required',a,e));const r=Game.cookies+Bo()<Ne?_t:It,s=Game.cookies+Bo()<Ne?xo((Ne-(Game.cookies+Bo()))/So()):"",l=document.createDocumentFragment(),c=document.createElement("span");if(c.style.fontWeight="bold",c.className=Ut+r,c.textContent=$(Ne),l.appendChild(c),""!==s){const e=document.createElement("small");e.textContent=` (${s})`,l.appendChild(e)}t.appendChild(Yn("withTooltip",'"Lucky!" cookies required (frenzy)',l,e));const d=Fe!==Pe,m=document.createElement("span");m.style.fontWeight="bold",m.className=Ut+Fe,m.textContent=$(Fe)+(d?` / ${$(Pe)}`:""),t.appendChild(Yn("withTooltip",'"Lucky!" reward (max)'+(d?" (golden / wrath)":""),m,e));const p=document.createElement("span");p.style.fontWeight="bold",p.className=Ut+p,p.textContent=$(Oe)+(d?` / ${$(De)}`:""),t.appendChild(Yn("withTooltip",'"Lucky!" reward (max) (frenzy)'+(d?" (golden / wrath)":""),p,e));const u=Math.min(.15*(Game.cookies+Bo()),He*Ue*60*15)+13,h=document.createElement("span");return h.style.fontWeight="bold",h.className=Ut+h,h.textContent=$($e*u)+(d?` / ${$(Re*u)}`:""),t.appendChild(Yn("withTooltip",'"Lucky!" reward (cur)'+(d?" (golden / wrath)":""),h,e)),t}()),t.appendChild(qn("Chain Cookies","Chain")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Chain&&t.appendChild(function(){const e=Game.auraMult("Dragon's Fortune")?"GoldCookDragonsFortuneTooltipPlaceholder":"GoldCookTooltipPlaceholder",t=document.createElement("div");t.className="CMStatsChainSection";const o=Game.cookies+Bo()<st?_t:It,n=Game.cookies+Bo()<st?xo((st-(Game.cookies+Bo()))/So()):"",a=document.createDocumentFragment(),i=document.createElement("span");if(i.style.fontWeight="bold",i.className=Ut+o,i.textContent=$(st),a.appendChild(i),""!==n){const e=document.createElement("small");e.textContent=` (${n})`,a.appendChild(e)}t.appendChild(Yn("withTooltip",'"Chain" cookies required',a,e));const r=Game.cookies+Bo()<dt?_t:It,s=Game.cookies+Bo()<dt?xo((dt-(Game.cookies+Bo()))/So()):"",l=document.createDocumentFragment(),c=document.createElement("span");if(c.style.fontWeight="bold",c.className=Ut+r,c.textContent=$(dt),l.appendChild(c),""!==s){const e=document.createElement("small");e.textContent=` (${s})`,l.appendChild(e)}t.appendChild(Yn("withTooltip",'"Chain" cookies required (Wrath)',l,e));const d=Game.cookies+Bo()<ut?_t:It,m=Game.cookies+Bo()<ut?xo((ut-(Game.cookies+Bo()))/So()):"",p=document.createDocumentFragment(),u=document.createElement("span");if(u.style.fontWeight="bold",u.className=Ut+d,u.textContent=$(ut),p.appendChild(u),""!==m){const e=document.createElement("small");e.textContent=` (${m})`,p.appendChild(e)}t.appendChild(Yn("withTooltip",'"Chain" cookies required (Frenzy)',p,e));const h=Game.cookies+Bo()<ft?_t:It,g=Game.cookies+Bo()<ft?xo((ft-(Game.cookies+Bo()))/So()):"",f=document.createDocumentFragment(),k=document.createElement("span");if(k.style.fontWeight="bold",k.className=Ut+h,k.textContent=$(ft),f.appendChild(k),""!==g){const e=document.createElement("small");e.textContent=` (${g})`,f.appendChild(e)}t.appendChild(Yn("withTooltip",'"Chain" cookies required (frenzy) (Wrath)',f,e)),t.appendChild(Yn("withTooltip",'"Chain" reward (max) (golden / wrath)',document.createTextNode(`${$(ct[0])} / ${$(pt[0])}`),e)),t.appendChild(Yn("withTooltip",'"Chain" reward (max) (frenzy) (golden / wrath)',document.createTextNode(`${$(gt[0])} / ${$(gt[0])}`),e));const C=Math.min(60*Game.cookiesPs*60*6*Ue,.5*Game.cookies),M=kn(7,C,$e)[0],y=kn(6,C,Re)[0];return t.appendChild(Yn("withTooltip",'"Chain" reward (cur) (golden / wrath)',document.createTextNode(`${$(M)} / ${$(y)}`),e)),t.appendChild(Yn("withTooltip","CPS needed for next level (g / w)",document.createTextNode(`${$(lt)} / ${$(mt)}`),"ChainNextLevelPlaceholder")),t.appendChild(Yn("withTooltip","CPS needed for next level (frenzy) (g / w)",document.createTextNode(`${$(ht)} / ${$(kt)}`),"ChainNextLevelPlaceholder")),t}()),Game.Objects["Wizard tower"].minigameLoaded&&(t.appendChild(qn("Spells","Spells")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Spells&&t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsSpellsSection";const t=Game.cookies+Bo()<Ae?_t:It,o=Game.cookies+Bo()<Ae?xo((Ae-(Game.cookies+Bo()))/So()):"",n=document.createDocumentFragment(),a=document.createElement("span");if(a.style.fontWeight="bold",a.className=Ut+t,a.textContent=$(Ae),n.appendChild(a),""!==o){const e=document.createElement("small");e.textContent=` (${o})`,n.appendChild(e)}e.appendChild(Yn("withTooltip",'"Conjure Baked Goods" cookies required',n,"GoldCookTooltipPlaceholder")),e.appendChild(Yn("withTooltip",'"Conjure Baked Goods" reward (max)',document.createTextNode($(Le)),"GoldCookTooltipPlaceholder"));const i=Game.cookies+Bo()<7*Ae?_t:It,r=Math.min(.15*(Game.cookies+Bo()),60*He*30),s=Game.cookies+Bo()<7*Ae?xo((7*Ae-(Game.cookies+Bo()))/So()):"",l=document.createDocumentFragment(),c=document.createElement("span");if(c.style.fontWeight="bold",c.className=Ut+i,c.textContent=$(7*Ae),l.appendChild(c),""!==s){const e=document.createElement("small");e.textContent=` (${s})`,l.appendChild(e)}return e.appendChild(Yn("withTooltip",'"Conjure Baked Goods" cookies required (frenzy)',l,"GoldCookTooltipPlaceholder")),e.appendChild(Yn("withTooltip",'"Conjure Baked Goods" reward (max) (frenzy)',document.createTextNode($(7*Le)),"GoldCookTooltipPlaceholder")),e.appendChild(Yn("withTooltip",'"Conjure Baked Goods" reward (cur)',document.createTextNode($(r)),"GoldCookTooltipPlaceholder")),We&&e.appendChild(Yn("withTooltip",'"Spontaneous Edifice" cookies required (most expensive building)',document.createTextNode(`${$(We)} (${je})`),"GoldCookTooltipPlaceholder")),e}())),Game.Objects.Farm.minigameLoaded&&(t.appendChild(qn("Garden","Garden")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Garden&&t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsGardenSection";const t=Game.cookies<60*Game.cookiesPs*10*100?_t:It,o=document.createElement("span");o.style.fontWeight="bold",o.className=Ut+t,o.textContent=$(60*Game.cookiesPs*10*100),e.appendChild(Yn("basic","Cookies required for max reward of Bakeberry: ",o));const n=Game.cookies<60*Game.cookiesPs*100?_t:It,a=document.createElement("span");a.style.fontWeight="bold",a.className=Ut+n,a.textContent=$(60*Game.cookiesPs*100),e.appendChild(Yn("basic","Cookies required for max reward of Chocoroot: ",a));const i=Game.cookies<60*Game.cookiesPs*60*25?_t:It,r=document.createElement("span");r.style.fontWeight="bold",r.className=Ut+i,r.textContent=$(60*Game.cookiesPs*60*25),e.appendChild(Yn("basic","Cookies required for max reward of Queenbeet: ",r));const s=Game.cookies<60*Game.cookiesPs*15*100?_t:It,l=document.createElement("span");l.style.fontWeight="bold",l.className=Ut+s,l.textContent=$(60*Game.cookiesPs*15*100),e.appendChild(Yn("basic","Cookies required for max reward of Duketater: ",l));const c=[];return Object.keys(Ko).forEach((e=>{Game.HasUnlocked(Ko[e])||c.push(Ko[e])})),0!==c.length&&e.appendChild(Yn("basic","Rare plant drops left to unlock",Jn(c))),e}())),t.appendChild(qn("Prestige","Prestige")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Prestige&&t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsPrestigeSection";const t=Math.floor(Game.HowMuchPrestige(Mt+Game.cookiesReset+Ke+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")?_e:0)));e.appendChild(Yn("withTooltip","Prestige level (cur / max)",document.createTextNode(`${$(Game.prestige)} / ${$(t)}`),"PrestMaxTooltipPlaceholder"));const o=Math.max(0,Game.HowManyCookiesReset(t+1)-(Mt+Game.cookiesReset+Ke+(Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg")&&_e?_e:0))),n=document.createDocumentFragment();n.appendChild(document.createTextNode($(o)));const a=document.createElement("small");a.textContent=` (${xo(o/yt,1)})`,n.appendChild(a),e.appendChild(Yn("withTooltip","Cookies to next level",n,"NextPrestTooltipPlaceholder")),e.appendChild(Yn("withTooltip","Heavenly chips (cur / max)",document.createTextNode(`${$(Game.heavenlyChips)} / ${$(t-Game.prestige+Game.heavenlyChips)}`),"HeavenChipMaxTooltipPlaceholder")),e.appendChild(Yn("basic","Heavenly chips per second (last 5 seconds)",document.createTextNode($(Ie,2))));const i=Number(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.HeavenlyChipsTarget);if(!Number.isNaN(i)){const t=i-Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned));t>0&&(e.appendChild(Yn("basic","Heavenly chips to target set in settings (cur)",document.createTextNode($(t)))),e.appendChild(Yn("basic","Time till target (cur, current 5 second average)",document.createTextNode(xo(t/Ie)))))}const r=function(e){let t=Game.cookiesPs;Uo(),0===Pt["Heavenly key"].bought&&(Pt["Heavenly chip secret"].bought=1,Pt["Heavenly cookie stand"].bought=1,Pt["Heavenly bakery"].bought=1,Pt["Heavenly confectionery"].bought=1,Pt["Heavenly key"].bought=1,_o(),t=Ge,Uo()),Mt>=1e6&&Vo("Sacrifice"),Mt>=1e9&&Vo("Oblivion"),Mt>=1e12&&Vo("From scratch"),Mt>=1e15&&Vo("Nihilism"),Mt>=1e18&&Vo("Dematerialize"),Mt>=1e21&&Vo("Nil zero zilch"),Mt>=1e24&&Vo("Transcendence"),Mt>=1e27&&Vo("Obliterate"),Mt>=1e30&&Vo("Negative void"),Mt>=1e33&&Vo("To crumbs, you say?"),Mt>=1e36&&Vo("You get nothing"),Mt>=1e39&&Vo("Humble rebeginnings"),Mt>=1e42&&Vo("The end of the world"),Mt>=1e45&&Vo("Oh, you're back"),Mt>=1e48&&Vo("Lazarus"),Mt>=1e51&&Vo("Smurf account"),Mt>=1e54&&Vo("If at first you don't succeed"),Pt["Heavenly chip secret"].bought=1,Pt["Heavenly cookie stand"].bought=1,Pt["Heavenly bakery"].bought=1,Pt["Heavenly confectionery"].bought=1,Pt["Heavenly key"].bought=1,he=e;const o=pe;_o(),Zo(),o!==pe&&_o();const n=Ge-t;return he=Game.prestige,n}(t),s=document.createDocumentFragment();s.appendChild(document.createTextNode($(r)));const l=Math.round(r/Game.cookiesPs*1e4);if(Number.isFinite(l)&&0!==l){const e=document.createElement("small");e.textContent=` (${l/100}% of income)`,s.appendChild(e)}e.appendChild(Yn("withTooltip","Reset bonus income",s,"ResetTooltipPlaceholder"));const c=Math.floor(Game.HowMuchPrestige(Game.cookiesReset)),d=Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned)),m=d-c;if(!Game.Has("Lucky digit")){let t=7-d%10;t<0&&(t+=10);const o=m+t,n=d+t,a=document.createDocumentFragment();a.appendChild(document.createTextNode(`${n.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(Yn("basic",'Next "Lucky Digit" (total / reset)',a))}if(!Game.Has("Lucky number")){let t=777-d%1e3;t<0&&(t+=1e3);const o=m+t,n=d+t,a=document.createDocumentFragment();a.appendChild(document.createTextNode(`${n.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(Yn("basic",'Next "Lucky Number" (total / reset)',a))}if(!Game.Has("Lucky payout")){let t=777777-d%1e6;t<0&&(t+=1e6);const o=m+t,n=d+t,a=document.createDocumentFragment();a.appendChild(document.createTextNode(`${n.toLocaleString()} / ${o.toLocaleString()} (+${t})`)),e.appendChild(Yn("basic",'Next "Lucky Payout" (total / reset)',a))}return e}()),Game.cpsSucked>0&&(t.appendChild(qn("Wrinklers","Wrink")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Wrink)){const e=document.createDocumentFragment();e.appendChild(document.createTextNode(`${$(Ke)} / ${$(Je)} `));const o=document.createElement("a");o.textContent="Pop All Normal",o.className="option",o.onclick=function(){Sn()},e.appendChild(o),t.appendChild(Yn("basic","Rewards of Popping (All/Normal)",e));const n=document.createDocumentFragment();n.appendChild(document.createTextNode(`${$(Ze[0])} `));const a=document.createElement("a");a.textContent="Pop Single Fattest",a.className="option",a.onclick=function(){null!==Ze[1]&&(Game.wrinklers[Ze[1]].hp=0)},n.appendChild(a),t.appendChild(Yn("basic",`Rewards of Popping Single Fattest Non-Shiny Wrinkler (id: ${null!==Ze[1]?Ze[1]:"None"})`,n))}if(t.appendChild(function(){const e=document.createElement("div");e.className="CMStatsSeasonSection";let t=!1;const o=[];Object.keys(Xo).forEach((e=>{Game.Has(Xo[e])||(o.push(Xo[e]),t=!0)}));const n=[];Object.keys(qo).forEach((e=>{Game.Has(qo[e])||(n.push(qo[e]),t=!0)}));const a=[];Object.keys(Yo).forEach((e=>{Game.Has(Yo[e])||(a.push(Yo[e]),t=!0)}));const i=[];Object.keys(Game.eggDrops).forEach((e=>{Game.HasUnlocked(Game.eggDrops[e])||(i.push(Game.eggDrops[e]),t=!0)}));const r=[];Object.keys(Game.rareEggDrops).forEach((e=>{Game.HasUnlocked(Game.rareEggDrops[e])||(r.push(Game.rareEggDrops[e]),t=!0)}));const s=Game.HasUnlocked("Chocolate egg")&&!Game.Has("Chocolate egg"),l=Game.Has("Century egg");if(("christmas"===Game.season||t||s||l)&&(e.appendChild(qn("Season Specials","Sea")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Sea)){if(0!==o.length){e.appendChild(Kn(0,"Halloween cookies left to buy",Jn(o),"halloween"===Game.season));let t=.95;if(Game.HasAchiev("Spooky cookies")&&(t=.8),Game.Has("Starterror")&&(t*=.9),t*=1/Game.dropRateMult(),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const n=o.length/7;e.appendChild(Kn(0,"Chance of receiving a cookie from wrinkler/shiny wrinkler",document.createTextNode(`${$((1-t)*n*100)}% / ${$((1-.9*t)*n*100)}%`),"halloween"===Game.season))}if(0!==n.length){e.appendChild(Kn(0,"Christmas cookies left to buy",Jn(n),"christmas"===Game.season));let t=.8;if(Game.HasAchiev("Let it snow")&&(t=.6),t*=1/Game.dropRateMult(),Game.Has("Starsnow")&&(t*=.95),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const o=n.length/7;e.appendChild(Kn(0,"Chance of receiving a cookie from reindeer",document.createTextNode(`${$((1-t)*o*100)}%`),"christmas"===Game.season))}0!==a.length&&e.appendChild(Kn(0,"Valentine cookies left to buy",Jn(a),"valentines"===Game.season));const t=function(e){let t=e*(1/Game.dropRateMult());if(Game.HasAchiev("Hide & seek champion")&&(t*=.7),Game.Has("Omelette")&&(t*=.9),Game.Has("Starspawn")&&(t*=.9),Game.hasGod){const e=Game.hasGod("seasons");1===e?t*=.9:2===e?t*=.95:3===e&&(t*=.97)}const o=1-t,n=Game.eggDrops.length-i.length,a=Game.rareEggDrops.length-r.length,s=.9*o*(1-n/Game.eggDrops.length),l=.1*o*(1-a/Game.rareEggDrops.length),c=.9*o*(n/Game.eggDrops.length)+.1*o*(a/Game.rareEggDrops.length);return[s+.9*c*(1-n/Game.eggDrops.length),l+.1*c*(1-a/Game.rareEggDrops.length)]};0!==i.length&&(e.appendChild(Kn(0,"Normal easter eggs left to unlock",Jn(i),"easter"===Game.season)),e.appendChild(Kn(0,"Chance of receiving an egg from wrinkler/golden cookie",document.createTextNode(`${$(100*t(.98)[0])}% / ${$(100*t(.9)[0])}%`),"easter"===Game.season))),0!==r.length&&(e.appendChild(Kn(0,"Rare easter eggs left to unlock",Jn(r),"easter"===Game.season)),e.appendChild(Kn(0,"Chance of receiving a rare egg from wrinkler/golden cookie",document.createTextNode(`${$(100*t(.98)[1])}% / ${$(100*t(.9)[1])}%`),"easter"===Game.season))),"christmas"===Game.season&&e.appendChild(Kn(0,"Reindeer reward",document.createTextNode($(Ve)),!0)),s&&e.appendChild(Yn("withTooltip","Chocolate egg cookies",document.createTextNode($(_e)),"ChoEggTooltipPlaceholder")),l&&e.appendChild(Yn("basic","Century egg multiplier",document.createTextNode(Math.round(1e4*(ze-1))/100+"%")))}return e}()),t.appendChild(qn("Achievements","Achievs")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Achievs&&Object.keys(Game.Objects).forEach((e=>{const o=Ye[e];t.appendChild(Yn("basic",e,o.AmountNeeded<101?document.createTextNode(`Next achievement in ${o.AmountNeeded}, price: ${$(o.price)}`):document.createTextNode("No new achievement for next 100 buildings")))})),t.appendChild(qn("Miscellaneous","Misc")),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.Misc){if(t.appendChild(Yn("basic",`Average cookies per second (past ${lo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]<60?`${lo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]} seconds`:lo[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist]/60+(3===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgCPSHist?" minute":" minutes")})`,document.createTextNode($(So(),3)))),t.appendChild(Yn("basic",`Average cookie clicks per second (past ${co[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]}${0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist?" second":" seconds"})`,document.createTextNode($(nt,1)))),t.appendChild(Yn("basic",`Cookies from clicking (past ${co[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]}${0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist?" second":" seconds"})`,document.createTextNode($(R.calcSum(nt*co[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.AvgClicksHist]))))),Game.Has("Fortune cookies")){const e=[];Object.keys(Qo).forEach((t=>{Game.Has(Qo[t])||e.push(Qo[t])})),0!==e.length&&t.appendChild(Yn("basic","Fortune Upgrades Left to Buy",Jn(e)))}if(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ShowMissedGC&&t.appendChild(Yn("basic","Missed golden cookies",document.createTextNode($(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(Yn("basic","Time till autosave",e))}}l("menu").insertBefore(t,l("menu").childNodes[2]),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingUpgrades&&l("menu").childNodes.forEach((e=>{if(e.children[0])if("Prestige"===e.children[0].innerHTML&&it){const t=it.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 a=document.createElement("div");a.className="listing crateBox",a.innerHTML=it,e.appendChild(a)}else if("Upgrades"===e.children[0].innerHTML){if(at){const t=at.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 a=document.createElement("div");a.className="listing crateBox",a.innerHTML=at,e.insertBefore(a,document.getElementById("CMMissingUpgradesTitle").nextSibling)}if(rt){const t=rt.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 a=document.createElement("div");a.className="listing crateBox",a.innerHTML=rt,e.appendChild(a)}}})),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements&&function(){let e;Object.values(document.querySelectorAll("div.title")).forEach((t=>{t.textContent.includes("Achievements")&&(e=t.parentElement.querySelectorAll("div.listing.crateBox")[0])})),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MissingAchievements&&Object.values(e.children).forEach((e=>{if(!e.className.includes("enabled")){const t=e.onclick.toString().split(/\[(.*)\]/gi)[1],{icon:o}=Game.AchievementsById[t];e.style.backgroundPosition=`${48*-o[0]}px ${48*-o[1]}px`,e.onmouseover=function(){Game.mouseDown||(Game.setOnCrate(this),Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>function(e){const t=[];"shadow"===e.pool?t.push("Shadow Achievement","#9700cf"):t.push("Achievement",0),t.push("Locked",0);let o=0;(Game.Has("Neuromancy")||Game.sesame&&"debug"===e.pool)&&(o=1),o&&0===e.won?t.push("Click to win!","#00c462"):o&&e.won>0&&t.push("Click to lose!","#00c462");let{icon:n}=e;e.iconFunction&&(n=e.iconFunction());let{desc:a}=e;e.descFunc&&(a=e.descFunc("stats"));let i="";for(let e=0;e<t.length;e+=2)e%2==0&&(i+=` <div class="tag" style="color:${0===t[e+1]?"#fff":t[e+1]};">[${t[e]}]</div>`);return i=i.substring(1),`<div style="padding:8px 4px;min-width:350px;opacity:0.5">\n <div class="icon" style="float:left;margin-left:-8px;margin-top:-8px;background-position:${48*-n[0]}px ${48*-n[1]}px;"></div>\n <div class="name">${e.name}</div>\n ${i}<div class="line"></div><div class="description">${a}</div></div>\n ${Game.sesame?`<div style="font-size:9px;">Id : ${e.id} | Order : ${Math.floor(e.order)}${e.tier?` | Tier : ${e.tier}`:""}</div>`:""}`}(Game.AchievementsById[t])),"top"),Game.tooltip.wobble())}}}))}()}const ea={Favourite:"Favourite Settings",Calculation:"Calculation",Notation:"Notation",Colours:"Colours and colour coding",BarsDisplay:"Infobars and visual settings",Tooltip:"Tooltips",Statistics:"Statistics",Notification:"Notifications",Miscellaneous:"Miscellaneous"},ta={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 oa(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=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]?"-":"+",n.onclick=function(){Xn(e),Game.UpdateMenu()},o.appendChild(n),o}function na(){let e="";for(let t=0;t<Kt.length;t++)e+=`.CMText${Kt[t]} { color: ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[`Colour${Kt[t]}`]}; }\n`;for(let t=0;t<Kt.length;t++)e+=`.CMBack${Kt[t]} { background-color: ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[`Colour${Kt[t]}`]}; }\n`;for(let t=0;t<Kt.length;t++)e+=`.CMBorder${Kt[t]} { border: 1px solid ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[`Colour${Kt[t]}`]}; }\n`;l("CMCSS").textContent=e,Go()}let aa=!1;function ia(e,t,o){(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[t]||o)&&3===e&&!1===aa||1===e?(l("CMFlashScreen").style.backgroundColor=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[`Colour${t}`],l("CMFlashScreen").style.opacity="0.5",3===e?(l("CMFlashScreen").style.display="inline",setTimeout((()=>{ia(2,t,!0)}),1e3/Game.fps)):setTimeout((()=>{ia(0,t,!0)}),1e3/Game.fps)):2===e?(l("CMFlashScreen").style.opacity="1",setTimeout((()=>{ia(1,t,!0)}),1e3/Game.fps)):0===e&&(l("CMFlashScreen").style.display="none")}function ra(e,t,o,n){if((1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[t]||n)&&!1===aa){const t=new Audio(e);Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GeneralSound?t.volume=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[o]/100*(Game.volume/100):t.volume=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[o]/100,t.play()}}function sa(e){const o=document.createElement("div");if(o.className="listing",1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FavouriteSettings&&o.appendChild(function(e){const o=document.createElement("a");return bo.includes(e)?(o.innerText="★",o.style.color="yellow"):o.innerText="☆",o.className="option",o.onclick=function(){!function(e){bo.includes(e)?bo=bo.filter((t=>t!==e)):bo.push(e)}(e),t(),Game.UpdateMenu()},o.onmouseover=function(){Game.tooltip.draw(this,escape(Zt.FavouriteSettingPlaceholder.innerHTML))},o.onmouseout=function(){Game.tooltip.hide()},o.appendChild(document.createTextNode(" ")),o}(e)),"bool"===Vn[e].type){const n=document.createElement("a");Vn[e].toggle&&0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]?n.className="option off":n.className="option",n.id=_n+e,n.onclick=function(){!function(e){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]+=1,Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]===Vn[e].label.length?(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]=0,Vn[e].toggle&&(l(_n+e).className="option off")):l(_n+e).className="option",void 0!==Vn[e].func&&Vn[e].func(),t()}(e),Game.UpdateMenu()},n.textContent=Vn[e].label[Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]],o.appendChild(n);const a=document.createElement("label");return a.textContent=Vn[e].desc,a.style.lineHeight="1.6",o.appendChild(a),o}if("vol"===Vn[e].type){const t=document.createElement("div");t.className="sliderBox";const n=document.createElement("div");n.style.float="left",n.innerHTML=Vn[e].desc,t.appendChild(n);const a=document.createElement("div");a.id=`slider${e}right`,a.style.float="right",a.innerHTML=`${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]}%`,t.appendChild(a);const i=document.createElement("input");i.className="slider",i.id=`slider${e}`,i.style.clear="both",i.type="range",i.min="0",i.max="100",i.step="1",i.value=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e],i.oninput=function(){Qn(e),Game.UpdateMenu()},i.onchange=function(){Qn(e),Game.UpdateMenu()},t.appendChild(i),o.appendChild(t);const r=document.createElement("a");return r.className="option",r.onclick=function(){ra(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e.replace("Volume","SoundURL")],e.replace("Volume","Sound"),e,!0)},r.textContent="Test sound",o.appendChild(r),o}if("url"===Vn[e].type){const n=document.createElement("span");n.className="option",n.textContent=`${Vn[e].label} `,n.style.lineHeight="1.6",o.appendChild(n);const a=document.createElement("input");a.id=_n+e,a.className="option",a.type="text",a.readOnly=!0,a.setAttribute("value",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]),a.style.width="300px",o.appendChild(a),o.appendChild(document.createTextNode(" "));const i=document.createElement("input");i.id=`${_n+e}Prompt`,i.className="option",i.type="text",i.setAttribute("value",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]);const r=document.createElement("a");r.className="option",r.onclick=function(){!function(e,t){Game.promptWrapL.className="framed";const o=e;Game.promptL.innerHTML=`${o}<div class="optionBox"></div>`,Object.keys(t).forEach((e=>{const o=document.createElement("a");o.id=`promptOption${e}`,o.className="option",o.onclick=function(){PlaySound("snd/tick.mp3"),t[e][1]()},o.textContent=t[e][0],Game.promptL.children[1].appendChild(o)})),Game.promptAnchorL.style.display="block",Game.darkenL.style.display="block",Game.promptL.focus(),Game.promptOn=1,Game.UpdatePrompt()}(i.outerHTML,[["Save",function(){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]=l(`CMConfig${e}Prompt`).value,t(),Game.ClosePrompt(),Game.UpdateMenu()}],["Cancel",function(){Game.ClosePrompt()}]])},r.textContent="Edit",o.appendChild(r);const s=document.createElement("label");return s.textContent=Vn[e].desc,s.style.lineHeight="1.6",o.appendChild(s),o}if("colour"===Vn[e].type){const n=document.createElement("span");n.className="option";const a=document.createElement("input");a.id=e,a.style.width="65px",a.setAttribute("value",Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]),n.appendChild(a),new Dn(a,{hash:!0,position:"right",onInput:function(){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[this.targetElement.id]=this.toHEXString(),na(),t(),Game.UpdateMenu()}});const i=document.createElement("label");if(i.textContent=Vn[e].desc,i.style.lineHeight="1.6",n.appendChild(i),e.includes("Flash")){const t=document.createElement("a");t.className="option",t.onclick=function(){ia(3,e.replace("Colour",""),!0)},t.textContent="Test flash",n.appendChild(t)}return o.appendChild(n),An().init(),o}if("numscale"===Vn[e].type){const n=document.createElement("span");n.className="option",n.textContent=`${Vn[e].label} `,n.style.lineHeight="1.6",o.appendChild(n);const a=document.createElement("input");a.id=_n+e,a.className="option",a.type="number",a.value=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e],a.min=Vn[e].min,a.max=Vn[e].max,a.oninput=function(){Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]=this.value,t(),Hn(),Game.UpdateMenu()},o.appendChild(a),o.appendChild(document.createTextNode(" "));const i=document.createElement("label");return i.textContent=Vn[e].desc,i.style.lineHeight="1.6",o.appendChild(i),o}return o}function la(e){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBarPos){const t=parseInt(l("CMTimerBar").style.height,10);Game.mouseY-=t,e(),Game.mouseY+=t}else e()}function ca(){j.Beautify=Beautify,Beautify=$,j.CalculateGains=Game.CalculateGains,Game.CalculateGains=function(){j.CalculateGains(),ye=1,H=Date.now(),U=Date.now()},j.tooltip={},j.tooltip.draw=Game.tooltip.draw,j.tooltip.drawMod=new Function(`return ${Game.tooltip.draw.toString().split("this").join("Game.tooltip")}`)(),Game.tooltip.draw=function(e,t,o){j.tooltip.drawMod(e,t,o)},j.tooltip.update=Game.tooltip.update,j.tooltip.updateMod=new Function(`return ${Game.tooltip.update.toString().split("this.").join("Game.tooltip.")}`)(),Game.tooltip.update=function(){j.tooltip.updateMod(),function(){if("store"===Game.tooltip.origin){let e=0;1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.ToolWarnLucky&&1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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`}}()},j.UpdateWrinklers=Game.UpdateWrinklers,Game.UpdateWrinklers=function(){la(j.UpdateWrinklers)},j.UpdateSpecial=Game.UpdateSpecial,Game.UpdateSpecial=function(){la(j.UpdateSpecial)},l("bigCookie").removeEventListener("click",Game.ClickCookie,!1),l("bigCookie").addEventListener("click",(()=>{la(Game.ClickCookie)}),!1),j.RebuildUpgrades=Game.RebuildUpgrades,Game.RebuildUpgrades=function(){j.RebuildUpgrades(),W=[],Object.keys(Game.UpgradesInStore).forEach((e=>{null!==l(`upgrade${e}`).onmouseover&&(W[e]=l(`upgrade${e}`).onmouseover,l(`upgrade${e}`).onmouseover=function(){Game.mouseDown||(Game.setOnCrate(this),Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("u",`${e}`)),"store"),Game.tooltip.wobble())})})),Game.CalculateGains()},j.ClickProduct=Game.ClickProduct,Game.ClickProduct=function(e){(!Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BulkBuyBlock||Game.ObjectsById[e].bulkPrice<Game.cookies||-1===Game.buyMode)&&j.ClickProduct(e)},j.DescribeDragonAura=Game.DescribeDragonAura,Game.DescribeDragonAura=function(e){j.DescribeDragonAura(e),function(e){if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.DragonAuraInfo){const[t,o]=function(e){Uo(),l("promptContent").children[0].innerHTML.includes("secondary")?fe=e:ge=e;let t=0;if(ge!==xe||fe!==Te)for(let e=Game.ObjectsById.length-1;e>-1;--e)if(Game.ObjectsById[e].amount>0){const o=Ft[Game.ObjectsById[e].name].name;Ft[o].amount-=1,ce-=1,t=Ft[o].basePrice*Game.priceIncrease**Math.max(0,Ft[o].amount-1-Ft[o].free),t=Game.modifyBuildingPrice(Ft[o],t),t=Math.ceil(t);break}const o=pe;return _o(),Zo(),o!==pe&&_o(),[Ge-Game.cookiesPs,t]}(e),n=xo(o/(t+Game.cookiesPs));let a;a=0===Game.cookiesPs?$(1/0):$(t/Game.cookiesPs*100),l("dragonAuraInfo").style.minHeight="60px",l("dragonAuraInfo").style.margin="8px",l("dragonAuraInfo").appendChild(document.createElement("div")).className="line";const i=document.createElement("div");i.style.minWidth="200px",i.style.textAlign="center",i.textContent=`Picking this aura will change CPS by ${$(t)} (${a}% of current CPS).`,l("dragonAuraInfo").appendChild(i);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)},j.ToggleSpecialMenu=Game.ToggleSpecialMenu,Game.ToggleSpecialMenu=function(e){j.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(){Ln(),Game.tooltip.dynamic=1,Game.tooltip.draw(l("specialPopup"),`<div style="min-width:200px;text-align:center;">${Be}</div>`,"this"),Game.tooltip.wobble()},l("specialPopup").children[e].onmouseout=function(){Game.tooltip.shouldHide=1})}()},j.UpdateMenu=Game.UpdateMenu,Game.UpdateMenu=function(){void 0!==An().picker&&void 0!==An().picker.owner||(j.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),Object.keys(ea).forEach((e=>{if("Favourite"===e){if(0!==bo.length&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FavouriteSettings>0&&(t.appendChild(oa(e,ea[e])),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]))for(let e=0;e<bo.length;e++)t.appendChild(sa(bo[e]))}else t.appendChild(oa(e,ea[e])),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]&&("Notification"===e?Object.keys(ta).forEach((e=>{const o=oa(e,ta[e]);o.style.fontSize="15px",o.style.opacity="0.5",t.appendChild(o),Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers[e]&&Object.keys(Vn).forEach((o=>{Vn[o].group===e&&t.appendChild(sa(o))}))})):Object.keys(Vn).forEach((o=>{Vn[o].group===e&&t.appendChild(sa(o))})))})),l("menu").childNodes[2].insertBefore(t,l("menu").childNodes[2].childNodes[l("menu").childNodes[2].childNodes.length-1])}(e)):"stats"===Game.onMenu&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Stats&&(e.textContent="Cookie Monster Statistics",Zn(e))}())},j.sayTime=Game.sayTime,ao=function(e,t){return Number.isNaN(e)||e<=0?j.sayTime(e,t):xo(e/Game.fps,1)},j.Logic=Game.Logic,Game.Logic=function(){j.Logic();let e="Cookie Clicker";"fools"===Game.season&&(e="Cookie Baker"),yo=`${Game.OnAscend?"Ascending! ":""}${$(Game.cookies)} ${1===Game.cookies?"cookie":"cookies"} - ${e}`,function(){if(Game.OnAscend||0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title)document.title=yo;else if(1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title){let e,t,o,n=!1,a=!1;e=bt?bt.wrath?`[W${Math.ceil(bt.life/Game.fps)}]`:`[G${Math.ceil(bt.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)}]`,B&&(n=!0,t="[F]"),"christmas"===Game.season&&(a=!0,o=S?`[R${Math.ceil(Gt.life/Game.fps)}]`:`[${Number(l("CMTimerBarRenMinBar").textContent)<0?"!":""}${Math.ceil((Game.shimmerTypes.reindeer.maxTime-Game.shimmerTypes.reindeer.time)/Game.fps)}]`);let i=yo;"["===i.charAt(0)&&(i=i.substring(i.lastIndexOf("]")+1)),document.title=`${e+(n?t:"")+(a?o:"")} ${i}`}else if(2===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.Title){let e="",t=!1;bt&&(t=!0,bt.wrath?e+=`[W${Math.ceil(bt.life/Game.fps)}]`:e+=`[G${Math.ceil(bt.life/Game.fps)}]`),B&&(t=!0,e+="[F]"),"christmas"===Game.season&&S&&(e+=`[R${Math.ceil(Gt.life/Game.fps)}]`,t=!0),t&&(e+=" - ");let o="Cookie Clicker";"fools"===Game.season&&(o="Cookie Baker"),e+=o,document.title=e}}(),function(){const e=Math.max(0,Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset)),t=Game.sayTime((Date.now()-Game.startDate)/1e3*Game.fps,-1);let o=`You've been on this run for <b>${""===t?"not very long":t}</b>.<br>\n <div class="line"></div>`;Game.prestige>0&&(o+=`Your prestige level is currently <b>${$(Game.prestige)}</b>.<br>(CpS +${$(Game.prestige)}%)\n <div class="line"></div>`),o+=re<1?"Ascending now would grant you no prestige.":re<2?"Ascending now would grant you<br><b>1 prestige level</b> (+1% CpS)<br>and <b>1 heavenly chip</b> to spend.":`Ascending now would grant you<br><b>${$(re)} prestige levels</b> (+${$(re)}% CpS)<br>and <b>${$(re)} heavenly chips</b> to spend.`,o+=`<div class="line"></div>\n You need <b>${$(e)} more cookies</b> for the next level.<br>\n ${Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TooltipAscendButton?`<div class='line'></div>It takes ${wt} to reach the next level and you were making ${$(Ie,2)} chips on average in the last 5 seconds.<br>`:""}`,l("ascendTooltip").innerHTML=o}()}}function da(){const e=h("cookieMonsterMod","Cookie Monster","infoMenu");return Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.headers.infoMenu&&(e.appendChild(u('<a href="https://github.com/CookieMonsterTeam/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 ')),e.appendChild(u('This update implements the following functions:</br>\n- HOTFIX: Fixed the possibility of clicking Golden Cookies multiple times with autoclickers</br>\n- For developers: we now expose some data calculated by Cookie Monster to the global scope. You can access it through the CookieMonsterData object</br>\n- The column with the most optimal building now has a green coloured indicator whenever colour coding is turned on</br>\n- The current season in the seasons statistics section is now displayed with green text for easier identification</br>\n- New option to show a timer bar that counts down till next autosave</br>\n- New option to sort buildings based on the "cost till next achievement"</br>\n- Added extra information about achievements in statistics page</br>\n</br>\nThis update fixes the following bugs:</br>\n- Fixed a bug where ignoring certain buildings in rare cases did not create a "most optimal building"</br>\n- Fixed some issues related to "left till achievement"</br>\n- Fixed some cases where upgrades and buildings were not correctly sorted</br>\n- Fixed the tooltip of "Pop all normal wrinklers" displaying an incorrect reward when Shiny\'s are present</br>\n'))),e}function ma(){window.CookieMonsterData={},Game.mods.cookieMonsterFramework.listeners.infoMenu.push(da),Fn(),Gn(),Tn(),M=Object.keys(Game.mods).length,ve=document.createElement("style"),ve.type="text/css",ve.id="CMCSS",document.head.appendChild(ve),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=Ut+t,o.textContent=e,o},a=o.appendChild(document.createElement("tr"));a.style.fontWeight="bold",a.appendChild(n("CM 2.031.9",zt)),o.appendChild(document.createElement("tr")).appendChild(n("Bonus Income",Rt)),o.appendChild(document.createElement("tr")).appendChild(n("Payback Period",Rt)),o.appendChild(document.createElement("tr")).appendChild(n("Time Left",Rt)),l("wrapper").appendChild(e),Object.keys(Game.Objects).forEach((e=>{Fo(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=Eo("CMTimerBarAutosave","Autosave",[{id:"CMTimerBarAutosaveBar",color:Qt}]);e.appendChild(t);const o=Eo("CMTimerBarGC","Next Cookie",[{id:"CMTimerBarGCMinBar",color:Xt},{id:"CMTimerBarGCBar",color:Qt}]);e.appendChild(o);const n=Eo("CMTimerBarRen","Next Reindeer",[{id:"CMTimerBarRenMinBar",color:Xt},{id:"CMTimerBarRenBar",color:Vt}]);e.appendChild(n);const a=document.createElement("div");a.id="CMTimerBarBuffTimers",e.appendChild(a),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=$t+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(Rt,"Better than the best PP of a building option")),e.appendChild(o(It,"Same as the best PP building option")),e.appendChild(o(zt,"Within the top 10 of PP for buildings")),e.appendChild(o(Vt,"Within the top 20 of PP for buildings")),e.appendChild(o(_t,"Within the top 30 of PP for buildings")),e.appendChild(o(Qt,"Outside of the top 30 of PP for buildings")),e.appendChild(o(Xt,"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=Ut+t,o.style.width="14.28571428571429%",o.style.display="inline-block",o.textContent="0",o};e.appendChild(o("CMUpgradeBarBlue",Rt)),e.appendChild(o("CMUpgradeBarGreen",It)),e.appendChild(o("CMUpgradeBarYellow",zt)),e.appendChild(o("CMUpgradeBarOrange",Vt)),e.appendChild(o("CMUpgradeBarRed",_t)),e.appendChild(o("CMUpgradeBarPurple",Qt)),e.appendChild(o("CMUpgradeBarGray",Xt)),l("upgrades").parentNode.insertBefore(e,l("upgrades").parentNode.childNodes[3])}(),function(){const e=document.createElement("div");e.id="CMFlashScreen",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("div");e.id="CMSectionHidButtons",e.style.textAlign="center";const t=document.createElement("a");t.className="option",t.onclick=function(){"flex"===l("upgrades").style.display?(l("upgrades").style.display="none",l("toggleUpgrades").style.display="none",l("techUpgrades").style.display="none",l("vaultUpgrades").style.display="none"):(l("upgrades").style.display="flex",0!==l("toggleUpgrades").children.length&&(l("toggleUpgrades").style.display="block"),0!==l("techUpgrades").children.length&&(l("techUpgrades").style.display="block"),0!==l("vaultUpgrades").children.length&&(l("vaultUpgrades").style.display="block"))},t.textContent="Hide/Show Upgrades",e.appendChild(t);const o=document.createElement("a");o.className="option",o.onclick=function(){"grid"===l("products").style.display?l("products").style.display="none":l("products").style.display="grid"},o.textContent="Hide/Show Buildings",e.appendChild(o),l("store").insertBefore(e,l("store").childNodes[2])}(),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)}(),Object.keys(Jt).forEach((e=>{!function(e,t,o){const n=document.createElement("div");n.id=e;const a=document.createElement("div");a.style.minWidth=o,a.style.marginBottom="4px";const i=document.createElement("div");i.style.textAlign="left",i.textContent=t,a.appendChild(i),n.appendChild(a),Zt[e]=n}(Jt[e][0],Jt[e][1],Jt[e][2])})),function(){const e=document.createElement("a");e.id="PopAllNormalWrinklerButton",e.textContent="Pop All Normal",e.className="option",e.onclick=function(){Sn()},e.onmouseout=function(){Game.tooltip.shouldHide=1},e.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("wb","PopAllNormal")),"this"),Game.tooltip.wobble()},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!==Ze[1]&&(Game.wrinklers[Ze[1]].hp=0)},t.onmouseout=function(){Game.tooltip.shouldHide=1},t.onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("wb","PopFattest")),"this"),Game.tooltip.wobble()},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",Object.keys(l("rows").children).forEach((e=>{const t=l("rows").children[e].children[1],o=document.createElement("div");o.id=`productLock${Number(e)+1}`,o.className="productButton",o.innerHTML="Unlocked",o.onclick=function(){!function(e){"Unlocked"===l(`productLock${e}`).innerHTML?(l(`productLock${e}`).innerHTML="Locked",l(`row${e}`).children[3].style.pointerEvents="none"):(l(`productLock${e}`).innerHTML="Unlocked",l(`row${e}`).children[3].style.pointerEvents="auto")}(Number(e)+1)},t.appendChild(o)})),Object.keys(Game.Objects).forEach((e=>{const t=Game.Objects[e];null!==l(`product${t.id}`).onmouseover&&(A[e]=l(`product${t.id}`).onmouseover,l(`product${t.id}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("b",`${e}`)),"store"),Game.tooltip.wobble()})})),Game.canLumps()&&(y=l("lumps").onmouseover,l("lumps").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("s","Lump")),"this"),Game.tooltip.wobble()}),T=Game.LoadMinigames,Game.LoadMinigames=function(){T(),Game.Objects.Farm.minigameLoaded&&(l("gardenTool-1").onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("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,(()=>Bn("p",[`${t[0]}`,`${t[2]}`])),"this"),Game.tooltip.wobble()}}))),Pn(),function(){if(Game.Objects.Temple.minigameLoaded){for(let e=0;e<11;e+=1)l(`templeGod${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("pag",e)),"this"),Game.tooltip.wobble()};for(let e=0;e<3;e+=1)l(`templeSlot${e}`).onmouseover=function(){Game.tooltip.dynamic=1,Game.tooltip.draw(this,(()=>Bn("pas",[e,Game.Objects.Temple.minigame.slot[e]])),"this"),Game.tooltip.wobble()}}}(),On()},Game.LoadMinigames(),l("backgroundLeftCanvas").onmouseover=function(){to=1},l("backgroundLeftCanvas").onmouseout=function(){to=0,Game.tooltip.hide(),Object.keys(Game.wrinklers).forEach((e=>{no[e]=0}))},ca(),On(),Game.CalculateGains(),eo=Game.OnAscend,Game.prefs.popups?Game.Popup("Cookie Monster version 2.031.9 loaded!"):Game.Notify("Cookie Monster version 2.031.9 loaded!","","",1,1),Game.Win("Third-party")}function pa(e,t){if(!Game.Objects.Temple.minigameLoaded)return 0;Uo();const{minigame:o}=Game.Objects.Temple,n=o.godsById[e].slot;"0"===n?ke=o.slot[t]:"1"===n?Ce=o.slot[t]:"2"===n&&(Me=o.slot[t]),0===t?ke=e:1===t?Ce=e:2===t&&(Me=e);const a=pe;return _o(),Zo(),a!==pe&&_o(),Ge-Game.cookiesPs}function ua(e,t,o){1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings[e]&&"hidden"===document.visibilityState&&!1===aa&&new Notification(t,{body:o,badge:"https://orteil.dashnet.org/cookieclicker/favicon.ico"})}function ha(){if(ko!==Game.OnAscend&&(ko=Game.OnAscend,Game.OnAscend?(l("game").style.bottom="0px",1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.BotBar&&(l("CMBotBar").style.display="none"),1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.TimerBar&&(l("CMTimerBar").style.display="none")):(jn(),Do()),No()),!Game.OnAscend&&0===Game.AscendTimer){M!==Object.keys(Game.mods).length&&(Fn(),Tn(),M=Object.keys(Game.mods).length),ye&&(vn(!0),fn(),Game.Has("Golden switch [off]")?(Uo(),Pt["Golden switch [off]"].bought=0,_o(),He=Ge):He=Game.cookiesPs,wn(),Gn(),yn(),Cn(),Ln(),function(){for(let e=0;e<11;e+=1)for(let t=0;t<3;t+=1)Et[e][t]=pa(e,t)}(),bn(),function(){let e=0;if(Game.Objects.Bank.minigameLoaded){const t=Game.Objects.Bank.minigame.goods;let o=0;Object.keys(t).forEach((e=>{const n=t[e];o+=n.stock*n.val})),e+=o*Game.cookiesPsRawHighest}e+=function(){let e=0;Uo();let t=2;5!==ge&&18!==ge||(t-=1),5!==fe&&18!==fe||(t-=1),ge=5,fe=18;for(let e=0;e<t;++e){let e="Cursor";Object.keys(Ft).forEach((t=>{Ft[t].amount>0&&(e=t)})),Ft[e].amount-=1,ce-=1}return Object.keys(Ft).forEach((t=>{const o=Ft[t];e+=Ht(Game.Objects[o.name],Game.Objects[t].basePrice,o.amount,Game.Objects[t].free,o.amount)})),e}(),Bt=e}(),ye=0);const e=Game.auraMult("Fierce Hoarder")>0;!le&&e?(le=!0,se=1):le&&!e&&(le=!1,se=1),se&&(gn(),se=0),function(){xn(),pn(),vn(!1),function(){et=0;let e=0;Object.keys(Game.wrinklers).forEach((t=>{2===Game.wrinklers[t].phase&&(e+=1)}));let t=1;if(Ft.Temple.minigameLoaded){const e=Game.hasGod("scorn");1===e?t*=1.15:2===e?t*=1.1:3===e&&(t*=1.05)}tt=e,et=e*(.05*e*1.1)*(.05*Game.Has("Sacrilegious corruption")+1)*(.05*Game.Has("Wrinklerspawn")+1)*t}(),ln(),Mn();const e=Game.HowManyCookiesReset(Math.floor(Game.HowMuchPrestige(Game.cookiesReset+Game.cookiesEarned))+1)-(Game.cookiesEarned+Game.cookiesReset);wt=xo(e/So())}(),B!==(Game.TickerEffect&&"fortune"===Game.TickerEffect.type)&&(B=Game.TickerEffect&&"fortune"===Game.TickerEffect.type,B&&(ia(3,"FortuneFlash",!1),ra(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.FortuneSoundURL,"FortuneSound","FortuneVolume",!1),ua("FortuneNotification","Fortune Cookie found","A Fortune Cookie has appeared on the Ticker."))),S!==Game.shimmerTypes.reindeer.spawned&&(S=Game.shimmerTypes.reindeer.spawned,Object.keys(Game.shimmers).forEach((e=>{Game.shimmers[e].spawnLead&&"reindeer"===Game.shimmers[e].type&&(Gt=Game.shimmers[e])})),ia(3,"SeaFlash",!1),ra(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.SeaSoundURL,"SeaSound","SeaVolume",!1),ua("SeaNotification","Reindeer sighted!","A Reindeer has spawned. Click it now!")),Game.Objects.Farm.minigameLoaded&&E!==Game.Objects.Farm.minigame.nextStep&&(0!==E&&E<Date.now()&&(ia(3,"GardFlash",!1),ra(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GardSoundURL,"GardSound","GardVolume",!1)),E=Game.Objects.Farm.minigame.nextStep),function(){if(Game.Objects["Wizard tower"].minigameLoaded&&1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GrimoireBar){const{minigame:e}=Game.Objects["Wizard tower"];e.magic<e.magicM?N=!1:N||(N=!0,ia(3,"MagicFlash",!1),ra(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.MagicSoundURL,"MagicSound","MagicVolume",!1),ua("MagicNotification","Magic Meter full","Your Magic Meter is full. Cast a spell!"))}}(),function(){if(Game.elderWrath>0){let e=0;Object.keys(Game.wrinklers).forEach((t=>{2===Game.wrinklers[t].phase&&(e+=1)})),e>D?(D=e,e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxFlash?ia(3,"WrinklerMaxFlash",!1):ia(3,"WrinklerFlash",!1),e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSound?ra(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxSoundURL,"WrinklerMaxSound","WrinklerMaxVolume",!1):ra(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerSoundURL,"WrinklerSound","WrinklerVolume",!1),e===Game.getWrinklersMax()&&Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.WrinklerMaxNotification?ua("WrinklerMaxNotification","Maximum Wrinklers Reached","You have reached your maximum ammount of wrinklers"):ua("WrinklerNotification","A Wrinkler appeared","A new wrinkler has appeared")):D=e}}()}O=0,St={},Object.keys(Game.shimmers).forEach((e=>{St[Game.shimmers[e].id]=Game.shimmers[e],Game.shimmers[e].spawnLead&&"golden"===Game.shimmers[e].type&&(bt=Game.shimmers[e],O+=1)})),Object.keys(Mo).forEach((e=>{void 0===St[e]&&(Mo[e].parentNode.removeChild(Mo[e]),delete Mo[e])})),F!==Game.shimmerTypes.golden.n?(F=Game.shimmerTypes.golden.n,F&&(P<O&&(ia(3,"GCFlash",!1),ra(Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCSoundURL,"GCSound","GCVolume",!1),ua("GCNotification","Golden Cookie Spawned","A Golden Cookie has spawned. Click it now!")),Object.keys(Game.shimmers).forEach((e=>{void 0===Mo[Game.shimmers[e].id]&&function(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",t.style.pointerEvents="none",0===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.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=""},Mo[e.id]=t,l("shimmers").appendChild(t)}(Game.shimmers[e])}))),En(),P=O,0===O&&(bt=0)):1===Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.settings.GCTimer&&F&&Object.keys(Mo).forEach((e=>{Mo[e].style.opacity=St[e].l.style.opacity,Mo[e].style.transform=St[e].l.style.transform,Mo[e].textContent=Math.ceil(St[e].life/Game.fps)}))}const ga={Favourite:1,Calculation:1,Notation:1,Colours:1,BarsDisplay:1,Tooltip:1,Statistics:1,Notification:1,NotificationGeneral:1,NotificationGC:1,NotificationFC:1,NotificationSea:1,NotificationGard:1,NotificationMagi:1,NotificationWrink:1,NotificationWrinkMax:1,Miscellaneous:1,Lucky:1,Chain:1,Spells:1,Garden:1,Prestige:1,Wrink:1,Sea:1,Achievs:1,Misc:1,infoMenu:1,optionsMenu:1},fa={init:function(){aa=!0;let e=!0;m(),p("cookieMonsterMod"),Game.version!==Number("2.031")&&(e=confirm("Cookie Monster version 2.031.9 is meant for Game version 2.031. Loading a different version may cause errors. Do you still want to load Cookie Monster?")),e&&(ma(),Game.registerHook("click",rn),Game.registerHook("draw",an),Game.registerHook("logic",ha),aa=!1)},load:function(e){Fn(),i("cookieMonsterMod",e,Vn,ga,ha),na(),"2.031.9"!==Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod.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:function(){const e=Game.mods.cookieMonsterFramework.saveData.cookieMonsterMod;return e.version="2.031.9",JSON.stringify(e)}};Game.registerMod("CookieMonster",fa)})()})();
|
||
//# sourceMappingURL=https://cookiemonsterteam.github.io/CookieMonster/dist/CookieMonsterDev.js.map
|