1var WPRecipeMaker;(self.webpackChunkWPRecipeMakerPublicSplit=self.webpackChunkWPRecipeMakerPublicSplit||[]).push([[488,546],{4876:(e,t,r)=>{"use strict";r.r(t);r(640);let n=!1;const i=(e,t=document)=>{const r=window.WPRecipeMaker&&window.WPRecipeMaker.publicLoader;return r&&r.has?r.has(e,t):!!t&&(!(t===document||!t.matches||!t.matches(e))||!(!t.querySelector||!t.querySelector(e)))},a=(e=document)=>{((e=document)=>{const t=window.wprmp_public&&wprmp_public.settings?wprmp_public.settings:{};if(i(".wprm-unit-conversion, .wprm-unit-conversion-checkbox, .wprm-unit-conversion-dropdown",e))return!0;if(t.unit_conversion_enabled&&t.unit_conversion_remember)try{return!!localStorage.getItem("wprm-unit-system")&&i("*[data-recipe-id]",e)}catch(r){return!1}return!1})(e)&&(()=>{if(n)return n;const e=window.WPRecipeMaker&&window.WPRecipeMaker.premiumLoader,t=e&&e.load?e.load("managerPremiumIngredients"):Promise.resolve();n=Promise.all([t,r.e(864).then(r.bind(r,9467))]).catch((e=>{n=!1,console.error("WP Recipe Maker Pro could not load the unit conversion feature.",e)}))})()},s=new Set;let o=!1;const c=(e=document)=>{s.add(e||document),o||(o=!0,window.setTimeout((()=>{o=!1;const e=Array.from(s);s.clear();for(const t of e)a(t)}),0))},d=()=>{if(!window.MutationObserver||!document.body)return;new MutationObserver((e=>{for(const t of e)for(const e of t.addedNodes)if(1===e.nodeType){c(t.target);break}})).observe(document.body,{childList:!0,subtree:!0})};"loading"!==document.readyState?(a(),d()):document.addEventListener("DOMContentLoaded",(()=>{a(),d()})),document.addEventListener("wprmRecipeInit",(()=>c()))},640:(e,t,r)=>{"use strict";var n,i=r(4181),a=r(9707);window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.advancedServings={load(){document.addEventListener("wprm-recipe-change",(e=>{"servings"===e.detail.type&&window.WPRecipeMaker.manager.getRecipe(e.detail.id).then((e=>{e&&WPRecipeMaker.advancedServings.adjustedServingsDirectly(e)})),"advancedServings"===e.detail.type&&window.WPRecipeMaker.manager.getRecipe(e.detail.id).then((e=>{e&&WPRecipeMaker.advancedServings.updateAdvancedServingsDisplay(e)})),"unitSystem"===e.detail.type&&window.WPRecipeMaker.manager.getRecipe(e.detail.id).then((e=>{e&&WPRecipeMaker.advancedServings.updateUnitOnUnitSystemChange(e)}))})),window.WPRecipeMaker.advancedServings.init()},init(){if(!document.querySelector("body").classList.contains("wprm-print")){const e=document.querySelectorAll("span.wprm-recipe-advanced-servings-input");for(let t of e){let e=document.createElement("a");e.innerHTML=t.innerHTML,e.setAttribute("href","#"),e.setAttribute("role","button");const r=[...t.attributes].reduce(((e,t)=>(e[t.name]=t.value,e)),{});for(let t of Object.keys(r))e.setAttribute(t,r[t]);t.parentNode.replaceChild(e,t),e.onclick=e=>{e.preventDefault(),WPRecipeMaker.advancedServings.onClickInput(e.target)},r.hasOwnProperty("aria-label")&&(0,i.Ay)(e,{theme:"wprm",content:r["aria-label"]})}}},onClickInput(e){e.classList.contains("wprm-recipe-advanced-servings-input-shape")?WPRecipeMaker.advancedServings.toggleShape(e):e.classList.contains("wprm-recipe-advanced-servings-input-unit")?WPRecipeMaker.advancedServings.toggleUnit(e):WPRecipeMaker.advancedServings.changeNumber(e)},changeNumber(e){WPRecipeMaker.advancedServings.getRecipeFromElem(e).then((t=>{if(t){const r=e.getAttribute("aria-label"),n=e.innerText,i=prompt(`${r}:`,n);if(i){const r=WPRecipeMaker.advancedServings.parse(i);if(r&&0<r){let n={};n[e.dataset.type]=r,t.setAdvancedServings(n)}}}}))},toggleShape(e){WPRecipeMaker.advancedServings.getRecipeFromElem(e).then((e=>{if(e){const t="round"===e.data.currentAdvancedServings.shape?"rectangle":"round";e.setAdvancedServings({shape:t})}}))},toggleUnit(e){WPRecipeMaker.advancedServings.getRecipeFromElem(e).then((e=>{if(e){const t="cm"===e.data.currentAdvancedServings.unit?"inch":"cm";e.setAdvancedServings({unit:t})}}))},adjustedServingsDirectly(e){const t=WPRecipeMaker.advancedServings.getServingsFromAdvancedServings(e),r=e.data.currentServingsParsed;r!==t&&(r===e.data.originalServingsParsed?e.setAdvancedServings(e.data.originalAdvancedServings):e.setAdvancedServings({diameter:"?",width:"?",length:"?"}))},getRecipeFromElem(e){let t=!1;for(var r=e.parentNode;r&&r!=document;r=r.parentNode)if(r.matches(".wprm-recipe-advanced-servings-container")){t=r;break}return t?window.WPRecipeMaker.manager.getRecipe(t.dataset.recipe):Promise.resolve(!1)},updateUnitOnUnitSystemChange(e){if(wprmp_public.settings.unit_conversion_advanced_servings_conversion){const t=wprmp_public.settings[`unit_conversion_system_${e.data.currentSystem}_length_unit`];t!==e.data.currentAdvancedServings.unit&&e.setAdvancedServings({unit:t})}},updateAdvancedServingsDisplay(e){const t=document.querySelectorAll(`.wprm-recipe-advanced-servings-${e.id}-container`),r=e.data.currentAdvancedServings;for(let i of t){const e=i.querySelector(".wprm-recipe-advanced-servings-input-shape");e.innerHTML=e.dataset[`shape${r.shape[0].toUpperCase()+r.shape.slice(1)}`],"round"===r.shape?(i.querySelector(".wprm-recipe-advanced-servings-round").style.display="",i.querySelector(".wprm-recipe-advanced-servings-rectangle").style.display="none"):(i.querySelector(".wprm-recipe-advanced-servings-rectangle").style.display="",i.querySelector(".wprm-recipe-advanced-servings-round").style.display="none");const t=i.querySelectorAll(".wprm-recipe-advanced-servings-input-unit");for(let n of t)n.innerHTML=n.dataset[`unit${r.unit[0].toUpperCase()+r.unit.slice(1)}`];i.querySelector(".wprm-recipe-advanced-servings-input-diameter").innerHTML=WPRecipeMaker.advancedServings.format(r.diameter),i.querySelector(".wprm-recipe-advanced-servings-input-width").innerHTML=WPRecipeMaker.advancedServings.format(r.width),i.querySelector(".wprm-recipe-advanced-servings-input-length").innerHTML=WPRecipeMaker.advancedServings.format(r.length),r.height&&(i.querySelector(".wprm-recipe-advanced-servings-input-height").innerHTML=WPRecipeMaker.advancedServings.format(r.height))}const n=WPRecipeMaker.advancedServings.getServingsFromAdvancedServings(e);n&&e.setServings(n)},getServingsFromAdvancedServings(e){if(e){const t=e.data.currentAdvancedServings,r=e.data.originalAdvancedServings;if("?"===t.height)return!1;if("round"===t.shape){if("?"===t.diameter)return!1}else if("?"===t.width||"?"===t.length)return!1;const n=0<r.height;let i=WPRecipeMaker.advancedServings.getArea(r),a=WPRecipeMaker.advancedServings.getArea(t);
1if(n){i*="inch"===r.unit?2.54*r.height:r.height,a*="inch"===t.unit?2.54*t.height:t.height}const s=a/i;return e.data.originalServingsParsed*s}return!1},getArea(e){let t=e.diameter/2,r=e.width,n=e.length;return"inch"===e.unit&&(t*=2.54,r*=2.54,n*=2.54),"round"===e.shape?Math.PI*t*t:r*n},parse:e=>(0,a.L)(e),format(e){const t=(0,a.V)(e,wprmp_public.settings.adjustable_servings_round_to_decimals);return isNaN(t)?e:t}},n=()=>{window.WPRecipeMaker.advancedServings.load()},"loading"!=document.readyState?n():document.addEventListener("DOMContentLoaded",n);r(4123);window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.cookMode={currentModalElement:null,currentModalUid:null,currentScreen:"overview",currentStepIndex:0,visibleStepIndex:-1,totalSteps:0,completedSteps:new Set,currentRecipeId:null,savedProgress:{},touchStartX:0,touchStartY:0,touchEndX:0,touchEndY:0,eventHandlers:[],init(){document.addEventListener("wprm-modal-open",(e=>{"cook-mode"===e.detail.type&&window.WPRecipeMaker.cookMode.opened(e.detail.uid,e.detail.modal,e.detail.data)})),document.addEventListener("wprm-modal-close",(e=>{"cook-mode"===e.detail.type&&window.WPRecipeMaker.cookMode.closed(e.detail.uid,e.detail.modal,e.detail.data)})),document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-recipe-cook-mode");if(t){e.preventDefault();const r=t.dataset.modalUid;let n=t.dataset.recipeId;n=parseInt(n),r&&n&&window.WPRecipeMaker.modal.open(r,{recipe:n})}}),!1)},async opened(e,t,r){const n=r.recipe;if(!n)return;const i=document.getElementById("wprm-popup-modal-"+e);if(!i)return;if(!i.querySelector(".wprm-cook-mode"))return;this.currentModalElement=i,this.currentModalUid=e,this.currentRecipeId=n,this.visibleStepIndex=-1,window.WPRecipeMaker.timer&&(window.WPRecipeMaker.timer.clearCookModeTimers(i),window.WPRecipeMaker.timer.bindTimers(i));const a=i.querySelectorAll(".wprm-cook-mode-instruction-step");this.totalSteps=a.length;const s=this.savedProgress[n];if(s){this.currentScreen=s.screen||"overview";const e=s.stepIndex||0;this.currentStepIndex=Math.min(e,this.totalSteps>0?this.totalSteps-1:0),this.completedSteps=new Set(s.completedSteps||[])}else this.currentScreen="overview",this.currentStepIndex=0,this.completedSteps.clear();try{const e=await window.WPRecipeMaker.manager.getRecipe(n);if(e&&e.data){const t=e.data.currentServingsParsed,r=e.data.currentSystem;if(null!=t){const e=i.querySelector(".wprm-cook-mode-servings-input");e&&(e.value=t);const r=i.querySelector(".wprm-cook-mode-servings-decrease"),n=i.querySelector(".wprm-cook-mode-servings-increase");r&&n&&this.updateServingsButtons(r,n,t)}if(null!=r){i.querySelectorAll(".wprm-cook-mode-unit-button").forEach((e=>{parseInt(e.dataset.system)===r?e.classList.add("active"):e.classList.remove("active")}))}window.WPRecipeMaker.managerPremiumIngredients&&(window.WPRecipeMaker.managerPremiumIngredients.scheduleIngredientsDisplayUpdate?window.WPRecipeMaker.managerPremiumIngredients.scheduleIngredientsDisplayUpdate(e):window.WPRecipeMaker.managerPremiumIngredients.updateIngredientsDisplay&&window.WPRecipeMaker.managerPremiumIngredients.updateIngredientsDisplay(e))}}catch(o){console.error("Error getting recipe data:",o)}if(s)if("cooking"===s.screen){const e=i.querySelector(".wprm-cook-mode-screen-overview"),t=i.querySelector(".wprm-cook-mode-screen-cooking");e&&(e.style.display="none"),t&&(t.style.display="flex");const r=i.querySelector(".wprm-cook-mode-start-button"),n=i.querySelector(".wprm-cook-mode-cooking-footer");r&&(r.style.display="none"),n&&(n.style.display="block")}else"thank-you"===s.screen&&this.showThankYouScreen();this.setupEventListeners(),this.setupBeforeUnloadWarning(),this.updateStepDisplay(),this.updateProgress()},closed(e,t,r){this.currentRecipeId&&(this.savedProgress[this.currentRecipeId]={screen:this.currentScreen,stepIndex:this.currentStepIndex,completedSteps:Array.from(this.completedSteps)}),this.cleanupEventListeners(),this.removeBeforeUnloadWarning(),window.WPRecipeMaker.timer&&window.WPRecipeMaker.timer.clearCookModeTimers(this.currentModalElement),window.WPRecipeMaker.preventSleep&&window.WPRecipeMaker.preventSleep.unlock(),this.currentModalElement=null,this.currentModalUid=null,this.currentRecipeId=null,this.currentScreen="overview",this.currentStepIndex=0,this.visibleStepIndex=-1,this.totalSteps=0,this.completedSteps.clear()},setupEventListeners(){if(!this.currentModalElement)return;this.cleanupEventListeners();const e=this.currentModalElement.querySelector(".wprm-cook-mode-servings-decrease"),t=this.currentModalElement.querySelector(".wprm-cook-mode-servings-increase"),r=this.currentModalElement.querySelector(".wprm-cook-mode-servings-input");if(e){const n=()=>{const n=parseFloat(r.value)||1,i=Math.max(1,n-1);r.value=i,this.updateServings(i),this.updateServingsButtons(e,t,i)};e.addEventListener("click",n),this.eventHandlers.push({element:e,event:"click",handler:n})}if(t){const n=()=>{const n=(parseFloat(r.value)||1)+1;r.value=n,this.updateServings(n),this.updateServingsButtons(e,t,n)};t.addEventListener("click",n),this.eventHandlers.push({element:t,event:"click",handler:n})}if(r){const n=()=>{const n=parseFloat(r.value)||1;this.updateServings(n),this.updateServingsButtons(e,t,n)};if(r.addEventListener("change",n),this.eventHandlers.push({element:r,event:"change",handler:n}),e&&t){const n=parseFloat(r.value)||1;this.updateServingsButtons(e,t,n)}}this.currentModalElement.querySelectorAll(".wprm-cook-mode-unit-button").forEach((e=>{const t=()=>{const t=parseInt(e.dataset.system);this.updateUnitSystem(t)};e.addEventListener("click",t),this.eventHandlers.push({element:e,event:"click",handler:t})}));const n=this.currentModalElement.querySelector(".wprm-cook-mode-start-button");if(n){const e=()=>{this.startCooking()};n.addEventListener("click",e),this.eventHandlers.push({element:n,event:"click",handler:e})}const i=this.currentModalElement.querySelector(".wprm-cook-mode-nav-prev"),a=this.currentModalElement.querySelector(".wprm-cook-mode-nav-next");if(i){const e=()=>{this.goToPreviousStep()};i.addEventListener("click",e),this.eventHandlers.push({element:i,event:"click",handler:e})}if(a){const e=()=>{this.goToNextStep()};a.addEventListener("click",e),this.eventHandlers.push({element:a,event:"click",handler:e})}const s=this.currentModalElement.querySelector(".wprm-cook-mode-nav-close");if(s){const e=()=>{this.closeModal()};s.addEventListener("click",e),this.eventHandlers.push({element:s,event:"click",handler:e})}const o=this.currentModalElement.querySelector(".wprm-popup-modal__close, [data-micromodal-close]");if(o){const e=e=>{e.preventDefault(),e.stopPropagation(),this.closeModal()};o.addEventListener("click",e,!0),this.eventHandlers.push({element:o,event:"click",handler:e,options:!0})}this.setupSwipeSupport(),this.setupKeyboardSupport()},setupSwipeSupport(){const e=this.currentModalElement.querySelector(".wprm-cook-mode-screen-overview");if(e){const t=e=>{this.touchStartX=e.changedTouches[0].screenX,this.touchStartY=e.changedTouches[0].screenY},r=e=>{this.touchEndX=e.changedTouches[0].screenX,this.touchEndY=e.changedTouches[0].screenY,this.handleSwipe()},n={passive:!0};e.addEventListener("touchstart",t,n),e.addEventListener("touchend",r,n),this.eventHandlers.push({element:e,event:"touchstart",handler:t,options:n}),this.eventHandlers.push({element:e,event:"touchend",handler:r,options:n})}const t=this.currentModalElement.querySelector(".wprm-cook-mode-instructions-container");if(t){const e=e=>{this.touchStartX=e.changedTouches[0].screenX,this.touchStartY=e.changedTouches[0].screenY},r=e=>{this.touchEndX=e.changedTouches[0].screenX,this.touchEndY=e.changedTouches[0].screenY,this.handleSwipe()},n={passive:!0};t.addEventListener("touchstart",e,n),t.addEventListener("touchend",r,n),this.eventHandlers.push({element:t,event:"touchstart",handler:e,options:n}),this.eventHandlers.push({element:t,event:"touchend",handler:r,options:n})}},setupKeyboardSupport(){const e=e=>{if(!this.currentModalElement)return;if("Escape"===e.key){if(this.hasRunningTimers()){e.preventDefault(),e.stopPropagation();return void(window.confirm("You have running timers. Closing cook mode will stop all timers. Do you want to continue?")&&this.closeModal(!0))}return}const t=document.activeElement;if(!t||"INPUT"!==t.tagName&&"TEXTAREA"!==t.tagName&&!t.isContentEditable)if("overview"===this.currentScreen){const r=t===this.currentModalElement.querySelector(".wprm-cook-mode-start-button")||t===document.body||t===this.currentModalElement||!t;"ArrowRight"===e.key&&r&&(e.preventDefault(),this.startCooking())}else if("cooking"===this.currentScreen){if(t&&t!==document.body&&t!==this.currentModalElement){if("BUTTON"===t.tagName||"A"===t.tagName||t.hasAttribute("tabindex")||"button"===t.getAttribute("role"))return}"ArrowLeft"===e.key?(e.preventDefault(),this.goToPreviousStep()):"ArrowRight"===e.key&&(e.preventDefault(),this.goToNextStep())}else"thank-you"===this.currentScreen&&"ArrowLeft"===e.key&&(e.preventDefault(),this.goToPreviousStep())};document.addEventListener("keydown",e,!0),this.eventHandlers.push({element:document,event:"keydown",handler:e,options:!0})}
1,cleanupEventListeners(){this.eventHandlers.forEach((({element:e,event:t,handler:r,options:n})=>{e&&e.removeEventListener&&e.removeEventListener(t,r,n)})),this.eventHandlers=[]},setupBeforeUnloadWarning(){const e=e=>{if(this.currentModalElement)return e.preventDefault(),e.returnValue="",""};window.addEventListener("beforeunload",e),this.eventHandlers.push({element:window,event:"beforeunload",handler:e})},removeBeforeUnloadWarning(){},handleSwipe(){const e=this.touchEndX-this.touchStartX,t=this.touchEndY-this.touchStartY;Math.abs(e)>Math.abs(t)&&Math.abs(e)>50&&("overview"===this.currentScreen?e<0&&this.startCooking():e>0?this.goToPreviousStep():this.goToNextStep())},updateServingsButtons(e,t,r){e&&(e.disabled=r<=1)},async updateServings(e){if(!this.currentModalElement)return;const t=this.currentModalElement.querySelector(".wprm-cook-mode");if(!t)return;const r=parseInt(t.getAttribute("data-recipe-id"));if(r){window.WPRecipeMaker.hasOwnProperty("analytics")&&window.WPRecipeMaker.analytics.registerActionOnce(r,wprm_public.post_id,"adjust-servings",{type:"cook-mode"});try{const t=await window.WPRecipeMaker.manager.getRecipe(r);t&&t.setServings&&t.setServings(e)}catch(n){console.error("Error updating servings:",n)}this.saveProgress()}},updateUnitSystem(e){if(!this.currentModalElement)return;const t=this.currentModalElement.querySelector(".wprm-cook-mode");if(!t)return;const r=parseInt(t.getAttribute("data-recipe-id"));if(!r)return;window.WPRecipeMaker.hasOwnProperty("analytics")&&window.WPRecipeMaker.analytics.registerActionOnce(r,wprm_public.post_id,"unit-conversion",{type:"cook-mode"});this.currentModalElement.querySelectorAll(".wprm-cook-mode-unit-button").forEach((t=>{parseInt(t.dataset.system)===e?t.classList.add("active"):t.classList.remove("active")})),window.WPRecipeMaker.manager.getRecipe(r).then((t=>{t&&t.setUnitSystem&&t.setUnitSystem(e)})).catch((e=>{console.error("Error updating unit system:",e)})),this.saveProgress()},startCooking(){if(0===this.totalSteps)return;window.WPRecipeMaker.preventSleep&&window.WPRecipeMaker.preventSleep.wakeLockApi&&window.WPRecipeMaker.preventSleep.lock();const e=this.currentModalElement.querySelector(".wprm-cook-mode-screen-overview"),t=this.currentModalElement.querySelector(".wprm-cook-mode-screen-cooking");e&&(e.style.display="none"),t&&(t.style.display="flex");const r=this.currentModalElement.querySelector(".wprm-cook-mode-start-button"),n=this.currentModalElement.querySelector(".wprm-cook-mode-cooking-footer");r&&(r.style.display="none"),n&&(n.style.display="block"),this.currentScreen="cooking",this.currentStepIndex=0,this.completedSteps.clear(),this.updateStepDisplay(),this.updateProgress(),this.saveProgress()},goBackToOverview(){const e=this.currentModalElement.querySelector(".wprm-cook-mode-screen-overview"),t=this.currentModalElement.querySelector(".wprm-cook-mode-screen-cooking");e&&(e.style.display="flex"),t&&(t.style.display="none");const r=this.currentModalElement.querySelector(".wprm-cook-mode-start-button"),n=this.currentModalElement.querySelector(".wprm-cook-mode-cooking-footer");r&&(r.style.display="block"),n&&(n.style.display="none"),this.currentScreen="overview",this.currentStepIndex=0,this.completedSteps.clear(),this.updateProgress(),this.saveProgress()},goToPreviousStep(){if("thank-you"===this.currentScreen)this.currentScreen="cooking",this.currentStepIndex=this.totalSteps-1,this.hideThankYouScreen(),this.updateStepDisplay(),this.saveProgress();else if(this.currentStepIndex>0){for(let e=this.currentStepIndex;e<this.totalSteps;e++)this.completedSteps.delete(e);this.currentStepIndex--,this.updateStepDisplay(),this.saveProgress()}else 0===this.currentStepIndex&&this.goBackToOverview()},goToNextStep(){this.currentStepIndex<this.totalSteps-1?(this.completedSteps.add(this.currentStepIndex),this.currentStepIndex++,this.updateStepDisplay(),this.saveProgress()):this.currentStepIndex===this.totalSteps-1&&(this.completedSteps.add(this.currentStepIndex),this.showThankYouScreen(),this.saveProgress())},updateStepDisplay(){if(!this.currentModalElement)return;const e=this.currentModalElement.querySelectorAll(".wprm-cook-mode-instruction-step");-1===this.visibleStepIndex?e.forEach(((e,t)=>{t===this.currentStepIndex?e.style.display="block":e.style.display="none"})):this.visibleStepIndex!==this.currentStepIndex&&(e[this.visibleStepIndex]&&(e[this.visibleStepIndex].style.display="none"),e[this.currentStepIndex]&&(e[this.currentStepIndex].style.display="block")),this.visibleStepIndex=this.currentStepIndex;this.currentModalElement.querySelector(".wprm-cook-mode-nav-prev"),this.currentModalElement.querySelector(".wprm-cook-mode-nav-next");const t=this.currentModalElement.querySelector(".wprm-cook-mode-step-current");t&&(t.textContent=this.currentStepIndex+1),this.updateProgress()},updateProgress(){if(!this.currentModalElement)return;const e=this.currentModalElement.querySelectorAll(".wprm-cook-mode-progress-step-current"),t=this.currentModalElement.querySelectorAll(".wprm-cook-mode-progress-bar-fill");if(e.forEach((e=>{e.textContent=this.currentStepIndex+1})),t.length>0&&this.totalSteps>0){const e=(this.currentStepIndex+1)/this.totalSteps*100;t.forEach((t=>{t.style.width=e+"%"}))}},showThankYouScreen(){if(!this.currentModalElement)return;const e=this.currentModalElement.querySelector(".wprm-cook-mode-screen-cooking");e&&(e.style.display="none");const t=this.currentModalElement.querySelector(".wprm-cook-mode-screen-thank-you");t&&(t.style.display="flex");const r=this.currentModalElement.querySelector(".wprm-cook-mode-progress"),n=this.currentModalElement.querySelector(".wprm-cook-mode-nav-next"),i=this.currentModalElement.querySelector(".wprm-cook-mode-nav-close");this.currentModalElement.querySelector(".wprm-cook-mode-nav-prev");r&&(r.style.display="none"),n&&(n.style.display="none"),i&&(i.style.display="block"),this.currentScreen="thank-you"},hideThankYouScreen(){if(!this.currentModalElement)return;const e=this.currentModalElement.querySelector(".wprm-cook-mode-screen-thank-you");e&&(e.style.display="none");const t=this.currentModalElement.querySelector(".wprm-cook-mode-screen-cooking");t&&(t.style.display="flex");const r=this.currentModalElement.querySelector(".wprm-cook-mode-progress"),n=this.currentModalElement.querySelector(".wprm-cook-mode-nav-next"),i=this.currentModalElement.querySelector(".wprm-cook-mode-nav-close");r&&(r.style.display="block"),n&&(n.style.display="block"),i&&(i.style.display="none")},hasRunningTimers(){if(!window.WPRecipeMaker.timer||!this.currentModalElement)return!1;let e=!1;
1return window.WPRecipeMaker.timer.cookModeTimers.forEach((t=>{t.cookModeModal===this.currentModalElement&&t.interval&&!t.finished&&(e=!0)})),e},closeModal(e=!1){if(this.currentModalUid&&window.WPRecipeMaker&&window.WPRecipeMaker.modal){if(!e&&this.hasRunningTimers()){if(!window.confirm("You have running timers. Closing cook mode will stop all timers. Do you want to continue?"))return}window.WPRecipeMaker.modal.close(this.currentModalUid)}},saveProgress(){this.currentRecipeId&&(this.savedProgress[this.currentRecipeId]={screen:this.currentScreen,stepIndex:this.currentStepIndex,completedSteps:Array.from(this.completedSteps)})}},function(e){"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)}((()=>{window.WPRecipeMaker.cookMode.init()}));r(4141);window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.managerPremiumIngredients={pendingDisplayUpdates:{},displayUpdateScheduled:!1,load(){document.addEventListener("wprm-recipe-change",(e=>{"servings"!==e.detail.type&&"unitSystem"!==e.detail.type||window.WPRecipeMaker.manager.getRecipe(e.detail.id).then((e=>{e&&WPRecipeMaker.managerPremiumIngredients.scheduleIngredientsDisplayUpdate(e,{refreshAdjustables:!0})}))}))},getContainerId:e=>e.data.hasOwnProperty("overrideContainerId")&&!1!==e.data.overrideContainerId?e.data.overrideContainerId:e.id,getDisplayUpdateKey(e){const t=this.getContainerId(e);return e.id+":"+t},scheduleIngredientsDisplayUpdate(e,t={}){if(!e||!e.data)return;e.data.hasOwnProperty("ingredientsElements")||this.findIngredientsElements(e);const r=this.getDisplayUpdateKey(e),n=!!this.pendingDisplayUpdates.hasOwnProperty(r)&&this.pendingDisplayUpdates[r];if(this.pendingDisplayUpdates[r]={recipe:e,refreshAdjustables:!!t.refreshAdjustables||!(!n||!n.refreshAdjustables)},this.displayUpdateScheduled)return;this.displayUpdateScheduled=!0;const i=()=>{window.setTimeout((()=>{this.displayUpdateScheduled=!1,this.flushIngredientsDisplayUpdates()}),0)};window.requestAnimationFrame?window.requestAnimationFrame(i):window.setTimeout(i,16)},flushIngredientsDisplayUpdates(){const e=this.pendingDisplayUpdates;this.pendingDisplayUpdates={};for(let t of Object.keys(e)){const r=e[t];r&&r.recipe&&(this.updateIngredientsDisplay(r.recipe),r.refreshAdjustables&&window.WPRecipeMaker.quantities&&window.WPRecipeMaker.quantities.updateAdjustables&&window.WPRecipeMaker.quantities.updateAdjustables(r.recipe))}},parseAdjustableShortcodes:(e="")=>String(e).replace(/\[adjustable\]([\s\S]*?)\[\/adjustable\]/gi,'<span class="wprm-dynamic-quantity">$1</span>').replace(/\[\/?adjustable\]/gi,""),applyAdjustableNamePrefix(e="",t=""){if(!t||/\[adjustable\]/i.test(t)||!/\[adjustable\]/i.test(e))return t;const r=String(e).match(/^\s*((?:\[adjustable\][\s\S]*?\[\/adjustable\]\s*)+)/i);return r?r[1]+t:t},appendHtml(e,t){const r=document.createElement("span");r.innerHTML=t,e.append(...Array.from(r.childNodes))},setHtmlIfChanged(e,t){t=null==t?"":`${t}`,e&&e.innerHTML!==t&&(e.innerHTML=t)},setTextIfChanged(e,t){t=null==t?"":`${t}`,e&&e.textContent!==t&&(e.textContent=t)},setIngredientNameHtml(e,t){const r=e.matches("a")?e:e.querySelector("a");r?this.setHtmlIfChanged(r,t):this.setHtmlIfChanged(e,t)},replaceLinkedIngredientTrailingName(e,t){const r=e.querySelector(".wprm-recipe-ingredient-name");if(r)return void this.setIngredientNameHtml(r,t);let n=" ";e.querySelector(".wprm-recipe-ingredient-connector")&&(n="");const i=n+t;if(e._wprmLinkedIngredientNameHtml===i)return;if(e._wprmLinkedIngredientNameNodes)for(let o of e._wprmLinkedIngredientNameNodes)o.parentNode===e&&o.remove();else{const t=Array.from(e.childNodes).filter((e=>Node.TEXT_NODE===e.nodeType));if(0<t.length){const e=t[t.length-1];this.setTextIfChanged(e,"")}}const a=document.createElement("span");a.innerHTML=i;const s=Array.from(a.childNodes);e.append(...s),e._wprmLinkedIngredientNameNodes=s,e._wprmLinkedIngredientNameHtml=i},parseBooleanDataValue(e,t=!0){if(null==e||""===e)return t;const r=`${e}`.toLowerCase();return!!["1","true","yes","on"].includes(r)||!["0","false","no","off"].includes(r)&&t},getConnectorSpacing(e="space-both"){switch(e){case"space-before":return{before:" ",after:""};case"space-after":return{before:"",after:" "};case"no-space":return{before:"",after:""};default:return{before:" ",after:" "}}},getConnectorElisionSettings:()=>(window.wprm_public&&window.wprm_public.settings?window.wprm_public.settings:{}).ingredient_unit_connector_elision||{},normalizeConnectorWord(e=""){let t=String(e).trim().toLowerCase();return t.normalize&&(t=t.normalize("NFD").replace(/[\u0300-\u036f]/g,"")),t.replace(/Å/g,"oe").replace(/æ/g,"ae")},getFirstIngredientWord(e=""){const t=this.parseAdjustableShortcodes(e).replace(/<[^>]*>/g,"").replace(/^[^A-Za-zÃ-ÃÃ-öø-ÿÅÅÃæ]+/,"").match(/^[A-Za-zÃ-ÃÃ-öø-ÿÅÅÃæ']+/);return t?t[0]:""},shouldElideConnector(e={},t=""){if(!e.unit_connector)return!1;const r=this.getConnectorElisionSettings();if(!r.language)return!1;const n=String(e.unit_connector).trim().toLowerCase();if(!(r.connectors&&"object"==typeof r.connectors?r.connectors:{})[n])return!1;const i=this.getFirstIngredientWord(t);if(!i)return!1;const a=this.normalizeConnectorWord(i),s=Array.isArray(r.h_aspire_words)?r.h_aspire_words:[];if("fr"===r.language&&s.includes(a))return!1;if((Array.isArray(r.elision_words)?r.elision_words:[]).includes(a))return!0;
1const o="string"==typeof r.elision_vowels?r.elision_vowels:"aeiouy";if(o.includes(a.charAt(0)))return!0;const c=a.charAt(1);return!!c&&r.allow_h_elision&&"h"===a.charAt(0)&&o.includes(c)},resolveConnectorDataForName(e=!1,t=""){if(!e||!e.unit_connector||!this.shouldElideConnector(e,t))return e;const r=this.getConnectorElisionSettings(),n=String(e.unit_connector).trim().toLowerCase(),i=r.connectors&&"object"==typeof r.connectors?r.connectors:{};return{...e,unit_connector:i[n]||"d'",unit_connector_spacing:"space-before"}},shouldPluralizeIngredientForSystem:e=>!e||!e.unit_connector||!!e.unit_connector_pluralizes_ingredient,joinAmountUnitAndName(e,t,r=!1,n=!0){if(e=null==e?"":`${e}`.trim(),t=null==t?"":`${t}`.trim(),!e||!t)return e+t;if(n&&r&&r.unit_connector){const n=this.resolveConnectorDataForName(r,t),i=this.getConnectorSpacing(n.unit_connector_spacing);return e+i.before+n.unit_connector+i.after+t}return e+" "+t},shouldSuppressConnectorBeforeSpacing:e=>!(!e||!e.closest)&&!!e.closest(".wprm-ingredient-style-table-2, .wprm-ingredient-style-table-2-align, .wprm-ingredient-style-table-3, .wprm-ingredient-style-table-3-align"),getConnectorDisplayText(e,t=!1,r=""){if(!e||!e.unit_connector)return"";const n=this.resolveConnectorDataForName(e,r),i=this.getConnectorSpacing(n.unit_connector_spacing);return(this.shouldSuppressConnectorBeforeSpacing(t)?"":i.before).replace(/ /g,"Â ")+n.unit_connector+i.after.replace(/ /g,"Â ")},getBothUnitsStyleForLinkedIngredient(e){const t=e.dataset.hasOwnProperty("bothUnitsStyle")?e.dataset.bothUnitsStyle:"";return"parentheses"===t||"slash"===t?t:""},shouldShowIdenticalBothUnits(e){return!e.dataset.hasOwnProperty("bothUnitsShowIdentical")||this.parseBooleanDataValue(e.dataset.bothUnitsShowIdentical,!0)},shouldShowBothUnitsForLinkedIngredient(e,t){return e.dataset.hasOwnProperty("bothUnits")?this.parseBooleanDataValue(e.dataset.bothUnits,!1):!(!e.dataset.hasOwnProperty("bothUnitsStyle")&&!e.dataset.hasOwnProperty("bothUnitsShowIdentical"))||t&&t.length>1},shouldShowConnectorForLinkedIngredient(e){return!e.dataset.hasOwnProperty("showConnector")||this.parseBooleanDataValue(e.dataset.showConnector,!0)},getAllowFractionsForSystem(e){let t=wprmp_public.settings.fractions_enabled;return wprmp_public.settings.unit_conversion_enabled&&window.WPRecipeMaker.hasOwnProperty("conversion")&&(t=!wprmp_public.settings.hasOwnProperty(`unit_conversion_system_${e}_fractions`)||wprmp_public.settings[`unit_conversion_system_${e}_fractions`]),t},getParsedAmountForSystemValues(e){if(!e)return null;if(e.amountParsed&&!isNaN(e.amountParsed)&&e.amountParsed>0)return e.amountParsed;if(e.amount){const t=(0,a.L)(e.amount);if(t&&!isNaN(t)&&t>0)return t}return null},getLinkedIngredientsByUid(e){const t={},r="wprm-inline-ingredient-"+e+"-",n="wprm-recipe-instruction-ingredient-"+e+"-",i=document.querySelectorAll('[class*="'+r+'"], [class*="'+n+'"]'),a=(e,r)=>{e&&(t.hasOwnProperty(e)||(t[e]=[]),t[e].includes(r)||t[e].push(r))};for(let s of i)for(let e of s.classList)0===e.indexOf(r)?a(e.substring(r.length),s):0===e.indexOf(n)&&a(e.substring(n.length),s);return t},getSplitDataByParentUid(e){const t={};for(let r of e)if(r.splits&&Array.isArray(r.splits)&&r.splits.length>=2){const e=`${r.uid}`,n={splits:r.splits,uidKeys:[],percentagesById:{}};for(let t of r.splits)if(void 0!==t.percentage&&null!==t.percentage){n.uidKeys.push(r.uid+"-"+t.id);const e=parseInt(t.id,10),i=parseFloat(t.percentage);isNaN(e)||isNaN(i)||(n.percentagesById[e]=i)}t[e]=n}return t},getLinkedIngredientsForIngredient(e,t,r){const n=[],i=t=>{if(t=`${t}`,e.hasOwnProperty(t))for(let r of e[t])n.includes(r)||n.push(r)};i(t.uid);const a=!!r.hasOwnProperty(t.uid)&&r[t.uid];if(a)for(let s of a.uidKeys)i(s);return n},getSplitPercentageForId(e,t,r){if(null===r||isNaN(r))return null;const n=!!e.hasOwnProperty(t.uid)&&e[t.uid];return n&&n.percentagesById.hasOwnProperty(r)?n.percentagesById[r]:null},updateCloneAdjustablesFromSource(e,t,r){if(!e||!e.data||e.data.currentServingsParsed===e.data.originalServingsParsed)return;const n=e.data.hasOwnProperty("adjustables")&&Array.isArray(e.data.adjustables)?e.data.adjustables:[];if(0===n.length)return;const i=t.querySelectorAll(".wprm-adjustable"),s=r.querySelectorAll(".wprm-adjustable");for(let o=0;o<i.length;o++){const t=i[o],r=s[o];if(!r)continue;const c=n.find((e=>e.elem===t));if(!c||!c.unitQuantity||isNaN(c.unitQuantity))continue;const d=e.data.currentServingsParsed*c.unitQuantity;if(!d||isNaN(d))continue;let p=!0;if(wprmp_public.settings.unit_conversion_enabled&&window.WPRecipeMaker.hasOwnProperty("conversion")){const t=e.data.hasOwnProperty("currentSystem")?e.data.currentSystem:1;p=!wprmp_public.settings.hasOwnProperty(`unit_conversion_system_${t}_fractions`)||wprmp_public.settings[`unit_conversion_system_${t}_fractions`]}
1r.textContent=(0,a.V)(d,wprmp_public.settings.adjustable_servings_round_to_decimals,p)}},getLinkedIngredientSource(e,t){let r="",n="";for(let i of t){const t=document.createElement("div");t.innerHTML=i.elem.innerHTML,this.updateCloneAdjustablesFromSource(e,i.elem,t),Array.from(t.childNodes).forEach((e=>{e.nodeType===Node.TEXT_NODE&&(e.textContent=e.textContent.replace(/[,-]/g,""))}));const a=t.querySelector(".wprm-recipe-ingredient-notes, .wprm-cook-mode-ingredient-notes");a&&(n=a.innerText,a.remove());const s=t.querySelector(".wprm-checkbox-container");s&&s.remove();const o=t.querySelector(".wprm-recipe-ingredient-image");if(o&&o.remove(),r=t.innerText,r=r.replace(/\s\s+/g," "),r=r.trim(),r)break}return{ingredientString:r,notesString:n}},appendLinkedIngredientNotes(e,t,r){if(!t)return e;const n=!!r.dataset.hasOwnProperty("notesSeparator")&&r.dataset.notesSeparator;if(!1===n)return e;let i=t;switch(i.startsWith("(")&&i.endsWith(")")&&(i=i.substring(1,i.length-1)),n){case"comma":return e+", "+i;case"dash":return e+" - "+i;case"parentheses":return e+" ("+i+")";default:return e+" "+i}},getCurrentIngredients(e){e.data.hasOwnProperty("ingredientsElements")||window.WPRecipeMaker.managerPremiumIngredients.findIngredientsElements(e);let t=[];const r=e.data.currentServingsParsed===e.data.originalServingsParsed&&e.data.currentSystem===e.data.originalSystem;for(let n=0;n<e.data.ingredients.length;n++){const i=e.data.ingredients[n];let a={};for(let t=1;t<=2;t++){let n,s;i.unit_systems.hasOwnProperty("unit-system-"+t)?(n=i.unit_systems["unit-system-"+t],s=!1):(n=i.unit_systems["unit-system-"+(t%2+1)],s=!0);let o=wprmp_public.settings.fractions_enabled;wprmp_public.settings.unit_conversion_enabled&&window.WPRecipeMaker.hasOwnProperty("conversion")&&(o=!wprmp_public.settings.hasOwnProperty(`unit_conversion_system_${t}_fractions`)||wprmp_public.settings[`unit_conversion_system_${t}_fractions`]);let c=n.amount,d=n.amountString,p=!1,l=!1;for(let t=0;t<n.amountParts.length;t++){const r=n.amountParts[t].numberUnitQuantity*e.data.currentServingsParsed;!isNaN(r)&&0<r&&(0===t&&(l=r<=1,p=r),d=d.replace(`%wprm${t}%`,this.format(r,o)))}!1===/%wprm\d+%/g.test(d)&&(c=d),r?c=n.amount:e.data.currentServingsParsed!==e.data.originalServingsParsed||s||(c=n.amount);let u=n.unitParsed;if(!r)if(e.data.currentServingsParsed!==e.data.originalServingsParsed||s){const e=!!n.hasOwnProperty("unit_singular")&&n.unit_singular,t=!!n.hasOwnProperty("unit_plural")&&n.unit_plural;u=n.unitParsed,e&&t&&(u=l?e:t)}else u=n.unitParsed;let m=i.name,w=!1;if(!r){const e=n.hasOwnProperty("name_singular")?n.name_singular:!!i.hasOwnProperty("name_singular")&&i.name_singular,t=n.hasOwnProperty("name_plural")?n.name_plural:!!i.hasOwnProperty("name_plural")&&i.name_plural;e&&t&&(w=!0,m=l||!this.shouldPluralizeIngredientForSystem(n)?e:t,m=this.applyAdjustableNamePrefix(i.name,m))}a["unit-system-"+t]={amount:c,amountParsed:p,amountIsSingular:l,unit:u,name:m,needsNameChange:w,name_singular:n.hasOwnProperty("name_singular")?n.name_singular:!!i.hasOwnProperty("name_singular")&&i.name_singular,name_plural:n.hasOwnProperty("name_plural")?n.name_plural:!!i.hasOwnProperty("name_plural")&&i.name_plural,unit_connector:n.hasOwnProperty("unit_connector")?n.unit_connector:"",unit_connector_spacing:n.hasOwnProperty("unit_connector_spacing")?n.unit_connector_spacing:"space-both",unit_connector_pluralizes_ingredient:!n.hasOwnProperty("unit_connector_pluralizes_ingredient")||n.unit_connector_pluralizes_ingredient}}t.push(a)}return t},updateIngredientsDisplay(e){e.data.hasOwnProperty("ingredientsElements")||window.WPRecipeMaker.managerPremiumIngredients.findIngredientsElements(e);const t=this.getContainerId(e),r=e.data.currentServingsParsed===e.data.originalServingsParsed&&e.data.currentSystem===e.data.originalSystem,n=window.WPRecipeMaker.managerPremiumIngredients.getCurrentIngredients(e),i=this.getSplitDataByParentUid(e.data.ingredients),a=this.getLinkedIngredientsByUid(t);for(let s=0;s<e.data.ingredients.length;s++){const t=e.data.ingredients[s],o=e.data.ingredientsElements[s]||[],c=n[s];if(!c)continue;const d=(r,n=t.name||"",i=e.data.currentSystem)=>{let a=n;const s=c["unit-system-"+i],o=s&&s.hasOwnProperty("name_singular")?s.name_singular:!!t.hasOwnProperty("name_singular")&&t.name_singular,d=s&&s.hasOwnProperty("name_plural")?s.name_plural:!!t.hasOwnProperty("name_plural")&&t.name_plural;return o&&d&&r&&!isNaN(r)&&r>0&&(a=r<=1||!this.shouldPluralizeIngredientForSystem(s)?o:d,a=this.applyAdjustableNamePrefix(n,a)),this.parseAdjustableShortcodes(a)},p=Object.keys(t.unit_systems||{}).map((e=>{const t=e.match(/^unit-system-(\d+)$/);return!!t&&parseInt(t[1],10)})).filter((e=>!1!==e&&!isNaN(e))).sort(((e,t)=>e-t)),l=(e,r,n="")=>{let i=n;const a="unit-system-"+e;let s=!(!t.unit_systems||!t.unit_systems.hasOwnProperty(a))&&t.unit_systems[a];if(!s&&p.length>0){const e="unit-system-"+p[0];s=!(!t.unit_systems||!t.unit_systems.hasOwnProperty(e))&&t.unit_systems[e]}if(s){const e=!!s.hasOwnProperty("unit_singular")&&s.unit_singular,t=!!s.hasOwnProperty("unit_plural")&&s.unit_plural;e&&t&&r&&!isNaN(r)&&r>0&&(i=r<=1?e:t)}return i};for(let n of o){for(let t=0;t<n.amounts.length;t++){const i=n.amounts[t];let a=e.data.currentSystem;n.showingBothUnitSystems&&1===t&&(a=a%2+1);const s=c["unit-system-"+a],o=r?i.original:s.amount;if(this.setHtmlIfChanged(i.elem,o),n.units.hasOwnProperty(t)){const e=r?n.units[t].original:s.unit;this.setHtmlIfChanged(n.units[t].elem,e)}}if(n.name){const i=c["unit-system-"+e.data.currentSystem],a=i&&i.needsNameChange?i.name:t.name;if(n.connector){const e=this.resolveConnectorDataForName(i,a)||{},t=r?n.connector.original:this.getConnectorDisplayText(i,n.connector.elem,a);this.setHtmlIfChanged(n.connector.elem,t),r||(n.connector.elem.dataset.spacing=e.unit_connector_spacing||"space-both")}i.needsNameChange?this.setIngredientNameHtml(n.name.elem,this.parseAdjustableShortcodes(i.name)):this.setHtmlIfChanged(n.name.elem,n.name.original)}}if(!1!==t.uid&&1<=o.length){const r=this.getLinkedIngredientsForIngredient(a,t,i);if(0<r.length){let n=!1;const a=()=>(!1===n&&(n=this.getLinkedIngredientSource(e,o)),n);for(let s of r){let r="",n=!1,o=null,u=null;if(s.dataset.hasOwnProperty("splitId")&&""!==s.dataset.splitId){const e=parseInt(s.dataset.splitId,10);isNaN(e)||(u=e)}if(s.dataset.hasOwnProperty("splitPercentage")&&""!==s.dataset.splitPercentage){const e=parseFloat(s.dataset.splitPercentage);isNaN(e)||(o=e)}if(null===u){const e=parseInt(t.uid,10);if(!isNaN(e)&&e>=0){const t=s.className.split(" ");for(let r of t){if(r.includes("-"+e+":")){const t=r.match(new RegExp("-"+e+":(\\d+)"));t&&t[1]&&(u=parseInt(t[1],10))}else if(r.includes("-"+e+"-")){const t=r.match(new RegExp("-"+e+"-(\\d+)$"));t&&t[1]&&(u=parseInt(t[1],10))}if(null!==u&&!isNaN(u))break}}}null!==o&&!isNaN(o)||null===u||(o=this.getSplitPercentageForId(i,t,u)),null!==o&&!isNaN(o)&&o>=0&&o<=100&&(n=!0);const m=s.querySelectorAll(".wprm-recipe-ingredient-unit-system"),w=this.shouldShowBothUnitsForLinkedIngredient(s,m),g=this.shouldShowConnectorForLinkedIngredient(s);if(m.length>=1){let r=!1;for(let e=0;e<m.length;e++){const t=m[e];if(!t.textContent||""===t.textContent.trim())continue;let i=e+1;const a=t.className||"",s=a.match(/wprm-recipe-ingredient-unit-system-2\b/),d=a.match(/wprm-recipe-ingredient-unit-system-1\b/);s?i=2:d&&(i=1);const p=c["unit-system-"+i];if(p){let e=this.getParsedAmountForSystemValues(p);if(e&&!isNaN(e)&&e>0&&(n&&null!==o&&!isNaN(o)&&o>=0&&o<=100&&(e=e*o/100),e&&!isNaN(e)&&e>0)){const a=this.getAllowFractionsForSystem(i),s=this.format(e,a),o=n?l(i,e,p.unit):p.unit,c=t.querySelector(".wprm-recipe-ingredient-amount");if(c){this.setTextIfChanged(c,s),r=!0;const e=t.querySelector(".wprm-recipe-ingredient-unit");e&&o&&this.setTextIfChanged(e,o)}else{let e=s;o&&(e=s+" "+o),this.setTextIfChanged(t,e),r=!0}}}}if(r){let r=this.parseAdjustableShortcodes(t.name||"");const i=c["unit-system-"+e.data.currentSystem],p=s.querySelector(".wprm-recipe-ingredient-connector");if(n&&null!==o&&!isNaN(o)&&o>=0&&o<=100){const n=this.getParsedAmountForSystemValues(i);if(n&&!isNaN(n)&&n>0){r=d(n*o/100,t.name||"",e.data.currentSystem)}}else r=this.parseAdjustableShortcodes(i&&i.needsNameChange?i.name:t.name);if(p&&i){const e=this.resolveConnectorDataForName(i,r)||{};this.setTextIfChanged(p,this.getConnectorDisplayText(i,p,r)),p.dataset.spacing=e.unit_connector_spacing||"space-both"}if(s.dataset.hasOwnProperty("notesSeparator")){const e=a();r=this.appendLinkedIngredientNotes(r,e.notesString,s)}s.dataset.hasOwnProperty("separator")&&(r+=s.dataset.separator),this.replaceLinkedIngredientTrailingName(s,r);continue}}else if(!n&&w){const n=[];for(let e of p){const t=c["unit-system-"+e];if(t&&t.amount){let e=t.amount;t.unit&&(e+=" "+t.unit),n.push(e)}}let i=this.parseAdjustableShortcodes(t.name||"");const a=c["unit-system-"+e.data.currentSystem];if(a&&a.needsNameChange&&(i=this.parseAdjustableShortcodes(a.name)),n.length>0){const e=this.shouldShowIdenticalBothUnits(s),t=this.getBothUnitsStyleForLinkedIngredient(s);let o=n.filter((e=>!!e));!e&&1<o.length&&o.every((e=>o[0]===e))&&(o=[o[0]]);let c=o.join(" ");1<o.length&&("parentheses"===t?c=o[0]+" ("+o.slice(1).join(" ")+")":"slash"===t&&(c=o[0]+" / "+o.slice(1).join(" "))),r=this.joinAmountUnitAndName(c,i,a,g)}}else if(n||w){if(n&&null!==o&&!isNaN(o)&&o>=0&&o<=100&&w){const n=[];for(let e of p){const t=c["unit-system-"+e];if(t&&t.amountParsed&&!isNaN(t.amountParsed)&&t.amountParsed>0){const r=t.amountParsed*o/100;if(r&&!isNaN(r)){const i=this.getAllowFractionsForSystem(e),a=this.format(r,i),s=l(e,r,t.unit),o=s?a+" "+s:a;n.push(o)}}}let i=this.parseAdjustableShortcodes(t.name||"");const a=c["unit-system-"+e.data.currentSystem];if(a){const t=this.getParsedAmountForSystemValues(a);if(t&&!isNaN(t)&&t>0){i=d(t*o/100,i,e.data.currentSystem)}}if(n.length>0){const e=this.shouldShowIdenticalBothUnits(s),t=this.getBothUnitsStyleForLinkedIngredient(s);let o=n.filter((e=>!!e));!e&&1<o.length&&o.every((e=>o[0]===e))&&(o=[o[0]]);let c=o.join(" ");1<o.length&&("parentheses"===t?c=o[0]+" ("+o.slice(1).join(" ")+")":"slash"===t&&(c=o[0]+" / "+o.slice(1).join(" "))),r=this.joinAmountUnitAndName(c,i,a,g)}}else if(n&&null!==o&&!isNaN(o)&&o>=0&&o<=100){const n=e.data.hasOwnProperty("currentSystem")?e.data.currentSystem:1,i=c["unit-system-"+n];if(i&&i.amountParsed&&!isNaN(i.amountParsed)&&i.amountParsed>0){const e=i.amountParsed*o/100;if(e&&!isNaN(e)){const a=this.getAllowFractionsForSystem(n),s=this.format(e,a),o=d(e,t.name||"",n),c=l(n,e,i.unit);let p=s;c&&(p+=" "+c),r=this.joinAmountUnitAndName(p,o,i,g)}}}}else{const n=e.data.hasOwnProperty("currentSystem")?e.data.currentSystem:1,i=c["unit-system-"+n];if(i){const e=[];i.amount&&e.push(i.amount),i.unit&&e.push(i.unit);const n=this.parseAdjustableShortcodes(i.needsNameChange?i.name:t.name);r=this.joinAmountUnitAndName(e.join(" "),n,i,g)}}if(!r&&0===m.length){r=a().ingredientString}if(r&&s.dataset.hasOwnProperty("notesSeparator")){const e=a();r=this.appendLinkedIngredientNotes(r,e.notesString,s)}r&&s.dataset.hasOwnProperty("separator")&&(r+=s.dataset.separator),r&&0===m.length&&this.setHtmlIfChanged(s,r)}}}}window.WPRecipeMaker.quantities.findAdjustables(e)},findIngredientsElements(e){let t=[];for(let i=0;i<e.data.ingredients.length;i++){const r=e.data.ingredients[i];for(let t of Object.keys(r.unit_systems)){const n=r.unit_systems[t],a=window.WPRecipeMaker.managerPremiumIngredients.parseAmountString(n.amount,e.data.originalServingsParsed);e.data.ingredients[i].unit_systems[t]={...e.data.ingredients[i].unit_systems[t],...a}}t[i]=[]}const r=this.getContainerId(e),n=document.querySelectorAll(`#wprm-recipe-container-${r}, .wprm-recipe-roundup-item-${r}, .wprm-print-recipe-${r}, .wprm-recipe-${r}-ingredients-container, .wprm-recipe-${r}-instructions-container, .wprm-cook-mode-${r}`);for(let i of n){const r=[".wprm-recipe-ingredient",".wprm-cook-mode-ingredient"],n=i.querySelectorAll(r.join(","));for(let i=0;i<n.length;i++){const s=n[i];if(!s.dataset.hasOwnProperty("wprmParsed")){let n={elem:s,showingBothUnitSystems:!1,amounts:[],units:[],connector:!1,name:!1,notes:!1};s.querySelector(".wprm-recipe-ingredient-unit-system")&&(n.showingBothUnitSystems=!0);const o=s.querySelectorAll(r.map((e=>e+"-amount")).join(","));for(let t of o)n.amounts.push({elem:t,original:t.innerHTML,unitQuantity:(0,a.L)(t.innerText)/e.data.originalServingsParsed});const c=s.querySelectorAll(r.map((e=>e+"-unit")).join(","));for(let e of c)n.units.push({elem:e,original:e.innerHTML});const d=s.querySelector(".wprm-recipe-ingredient-connector");d&&(n.connector={elem:d,original:d.innerHTML});const p=s.querySelector(r.map((e=>e+"-name")).join(","));p&&(n.name={elem:p,original:p.innerHTML});const l=s.querySelector(r.map((e=>e+"-notes")).join(","));l&&(n.notes={elem:l,original:l.innerHTML}),s.dataset.wprmParsed=!0,t.hasOwnProperty(i)&&t[i].push(n)}}}window.WPRecipeMaker.manager.changeRecipeData(e.id,{ingredientsElements:t})},parseAmountString(e,t){e=(e=(e=e.replace(/"/g,'"')).replace(/'/g,"'")).replace(/&/g,"&");let r=!1;if(/^\.\d+\s*$/.test(e))r=[e];else{const t="¼½¾â
â
â
â
â
â
â
â
â
â
â
â
â
â
â
",n="[\\d"+t+"]([\\d"+t+".,\\/\\s]*[\\d"+t+"])?",i=e.match(new RegExp(n,"g"));i&&(r=i)}let n=[];if(r){for(let i=0;i<r.length;i++){const s=r[i];e=e.replace(s,"%wprmtemporaryplaceholder%");const o=(0,a.L)(s);n.push({number:s,numberParsed:o,numberUnitQuantity:o/t})}for(let t=0;t<r.length;t++)e=e.replace("%wprmtemporaryplaceholder%",`%wprm${t}%`)}return{amountString:e,amountParts:n}},format:(e,t=!0)=>(0,a.V)(e,wprmp_public.settings.adjustable_servings_round_to_decimals,t)},function(e){"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)}((()=>{window.WPRecipeMaker.managerPremiumIngredients.load()})),window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.managerPremium={loadRecipeObject:(e,t)=>
1({...t,data:{...t.data},addRating:t=>(window.WPRecipeMaker.hasOwnProperty("analytics")&&window.WPRecipeMaker.analytics.registerAction(e,wprm_public.post_id,"user-rating",{rating:t.rating}),window.WPRecipeMaker.userRating.addRatingForRecipe(t,e).then((t=>!1!==t&&(window.WPRecipeMaker.manager.changeRecipeData(e,{rating:t}),window.WPRecipeMaker.manager.triggerChangeEvent(e,"rating"),!0)))),setServings:(r,n=!1)=>{const i=(0,a.L)(r),s=wprmp_public.settings.servings_display_fractions||!1,o=(0,a.V)(i,wprmp_public.settings.adjustable_servings_round_to_decimals,s),c=i/t.data.originalServingsParsed;window.WPRecipeMaker.manager.changeRecipeData(e,{currentServings:r,currentServingsParsed:i,currentServingsFormatted:o,currentServingsMultiplier:c,overrideContainerId:n}),window.WPRecipeMaker.manager.triggerChangeEvent(e,"servings")},setAdvancedServings:t=>{window.WPRecipeMaker.manager.getRecipe(e).then((r=>{if(t.hasOwnProperty("unit")&&t.unit!==r.data.currentAdvancedServings.unit){const e=2.54,n="cm"===t.unit?e:1/e;"?"!==r.data.currentAdvancedServings.diameter&&(t.diameter=Math.round(r.data.currentAdvancedServings.diameter*n)),"?"!==r.data.currentAdvancedServings.width&&(t.width=Math.round(r.data.currentAdvancedServings.width*n)),"?"!==r.data.currentAdvancedServings.length&&(t.length=Math.round(r.data.currentAdvancedServings.length*n)),"?"!==r.data.currentAdvancedServings.height&&(t.height=Math.round(r.data.currentAdvancedServings.height*n))}window.WPRecipeMaker.manager.changeRecipeData(e,{currentAdvancedServings:{...r.data.currentAdvancedServings,...t}}),window.WPRecipeMaker.manager.triggerChangeEvent(e,"advancedServings")}))},setUnitSystem:r=>{r=parseInt(r),t.data.unitSystems.includes(r)&&(window.WPRecipeMaker.manager.changeRecipeData(e,{currentSystem:r}),window.WPRecipeMaker.manager.triggerChangeEvent(e,"unitSystem"))}})};r(4096),r(5095),r(9055);var s=r(942);window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.quantities={load(){if(document.addEventListener("input",(function(e){e.target.matches("input.wprm-recipe-servings")&&WPRecipeMaker.quantities.inputChange(e.target)}),!1),document.addEventListener("change",(function(e){e.target.matches("input.wprm-recipe-servings")&&WPRecipeMaker.quantities.inputChange(e.target)}),!1),document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-recipe-servings-change, .wprm-recipe-adjustable-servings");t&&(t.matches(".wprm-recipe-servings-change")?WPRecipeMaker.quantities.changeClick(t):t.matches(".wprm-recipe-adjustable-servings")&&WPRecipeMaker.quantities.multiplierClick(t))}),!1),document.addEventListener("keypress",(function(e){if(e.target.matches(".wprm-recipe-servings-change")){const t=e.which||e.keyCode||0;13!==t&&32!==t||(WPRecipeMaker.quantities.changeClick(e.target),e.preventDefault())}}),!1),document.addEventListener("wprm-recipe-change",(e=>{"servings"===e.detail.type&&window.WPRecipeMaker.manager.getRecipe(e.detail.id).then((e=>{e&&(WPRecipeMaker.quantities.updateServingsDisplay(e),WPRecipeMaker.quantities.updateAdjustables(e),document.dispatchEvent(new CustomEvent("wprmAdjustedServings",{detail:e.id})))})),"unitSystem"===e.detail.type&&window.WPRecipeMaker.manager.getRecipe(e.detail.id).then((e=>{e&&WPRecipeMaker.quantities.updateAdjustables(e)}))})),window.WPRecipeMaker.quantities.init(),wprmp_public.settings.adjustable_servings_url){const e=wprmp_public.settings.adjustable_servings_url_param;if(e){const t=new URLSearchParams(window.location.search),r=parseFloat(t.get(e));if(!isNaN(r)&&0<r){const e=window.WPRecipeMaker.manager.findRecipesOnPage();for(let t of e)window.WPRecipeMaker.manager.getRecipe(t).then((e=>{e.setServings(r)}))}}}},init(){const e=document.querySelectorAll(".wprm-recipe-servings");for(let t of e)if(!t.dataset.hasOwnProperty("servings")){const e=this.parse(t.innerText);0<e&&(t.dataset.servings=e,t.dataset.originalServings=e,document.querySelector("body").classList.contains("wprm-print")||("modern"===wprmp_public.settings.recipe_template_mode?t.classList.contains("wprm-recipe-servings-adjustable-tooltip")?this.initTooltipSlider(t):t.classList.contains("wprm-recipe-servings-adjustable-text")?this.initTextInput(t):t.classList.contains("wprm-recipe-servings-adjustable-text-buttons")&&this.initTextButtonsInput(t):wprmp_public.settings.features_adjustable_servings&&("text_field"===wprmp_public.settings.servings_changer_display?this.initTextInput(t):this.initTooltipSlider(t))))}},getRecipeIdFromElem(e){let t=e.dataset.recipe;if(!t)for(var r=e.parentNode;r&&r!=document;r=r.parentNode)if(r.matches(".wprm-recipe-container")){t=r.dataset.recipeId;break}return t},initTextInput(e){let t=e.dataset.servings,r=this.getRecipeIdFromElem(e),n=e.getAttribute("aria-label");if(r){const i='<input type="number" class="wprm-recipe-servings wprm-recipe-servings-'+r+'" min="0" step="any" value="'+t+'" data-recipe="'+r+'" aria-label="'+n+'" />';e.outerHTML=i}},initTextButtonsInput(e){let t=e.dataset.servings,r=this.getRecipeIdFromElem(e),n=e.getAttribute("aria-label");if(r){let i="";
1i+="background-color: "+e.dataset.buttonBackground+";",i+="border-color: "+e.dataset.buttonBackground+";",i+="color: "+e.dataset.buttonAccent+";",i+="border-radius: "+e.dataset.buttonRadius+";";let a="";a+="border-color: "+e.dataset.buttonBackground+";";const o='<span class="wprm-recipe-servings-decrement wprm-recipe-servings-change" style="'+i+'" role="button" tabindex="0" aria-label="'+(0,s.f)("Decrease serving size by 1")+'">â</span>',c='<input type="text" class="wprm-recipe-servings wprm-recipe-servings-'+r+'" min="0" step="any" value="'+t+'" data-recipe="'+r+'" aria-label="'+n+'" style="'+a+'"/>',d='<span class="wprm-recipe-servings-increment wprm-recipe-servings-change" style="'+i+'" role="button" tabindex="0" aria-label="'+(0,s.f)("Increase serving size by 1")+'">+</span>';e.outerHTML='<span class="wprm-recipe-servings-text-buttons-container">'+o+c+d+"</span>"}},initTooltipSlider(e){let t=this.getRecipeIdFromElem(e),r=e.getAttribute("aria-label");if(t){let n=document.createElement("a");n.href="#",n.classList.add("wprm-recipe-servings-link"),n.setAttribute("aria-label",r),e.parentNode.insertBefore(n,e),n.appendChild(e);const a=(0,i.Ay)(n,{theme:"wprm",content:"",onShow(e){window.WPRecipeMaker.manager.getRecipe(t).then((n=>{if(!n)return!1;{const i=n.data.currentServingsParsed,a=20<2*i?2*i:20,s=function(e){const t=e.toString().split(".");return t.length>1?t[1].length:0}(i),o=1/Math.pow(10,s);e.setContent(`<input id="wprm-recipe-servings-slider-input" type="range" min="1" max="${a}" step="${o}" value="${i}" data-recipe="${t}" class="wprm-recipe-servings-slider wprm-recipe-servings-${t}" aria-label="${r}" oninput="WPRecipeMaker.quantities.inputChange(this)" onchange="WPRecipeMaker.quantities.inputChange(this)"></input>`)}}))},allowHTML:!0,interactive:!0,delay:[0,250]});n.onclick=e=>{e.preventDefault(),a.show(),setTimeout((()=>{const e=document.getElementById("wprm-recipe-servings-slider-input");e&&e.focus()}),250)}}},inputChange(e){let t=e.value,r=e.dataset.recipe;if(t){const n=e.classList.contains("wprm-recipe-servings-slider")?"slider":"input";window.WPRecipeMaker.analytics.registerActionOnce(r,wprm_public.post_id,"adjust-servings",{type:n}),this.setServings(r,t)}},changeClick(e){const t=e.closest(".wprm-recipe-servings-text-buttons-container");if(t){const r=t.querySelector("input"),n=this.parse(r.value);let i=n;e.classList.contains("wprm-recipe-servings-decrement")&&n>1?i--:e.classList.contains("wprm-recipe-servings-increment")&&i++,i!==n&&(r.value=i,this.inputChange(r))}},multiplierClick(e){if(!e.classList.contains("wprm-toggle-active")||"?"===e.dataset.multiplier){const t=e.dataset.multiplier,r=e.dataset.recipe,n=e.dataset.servings;let i=!1;"?"===t?(i=prompt(e.getAttribute("aria-label")),i&&(i=this.parse(i))):i=this.parse(n)*this.parse(t),i&&(window.WPRecipeMaker.analytics.registerActionOnce(r,wprm_public.post_id,"adjust-servings",{type:"button"}),this.setServings(r,i))}},setServings(e,t){window.WPRecipeMaker.manager.getRecipe(e).then((e=>{e&&e.setServings(t)}))},updateServingsDisplay(e){const t=e.data.hasOwnProperty("overrideContainerId")&&!1!==e.data.overrideContainerId?e.data.overrideContainerId:e.id,r=document.querySelectorAll(".wprm-recipe-servings-"+t);for(let i of r)i.textContent=e.data.currentServingsFormatted,i.dataset.servings=e.data.currentServingsParsed,"input"===i.tagName.toLowerCase()&&("string"==typeof e.data.currentServings||e.data.currentServings instanceof String)?i.value=e.data.currentServings:i.value=e.data.currentServingsParsed;const n=document.querySelectorAll(".wprm-recipe-adjustable-servings-"+t+"-container");for(let i of n){const t=i.querySelectorAll(".wprm-recipe-adjustable-servings");let r=!1;for(let n of t)n.classList.remove("wprm-toggle-active"),(0,a.L)(n.dataset.multiplier)===e.data.currentServingsMultiplier?(r=!0,n.classList.add("wprm-toggle-active")):"?"!==n.dataset.multiplier||r||n.classList.add("wprm-toggle-active")}},updateAdjustables(e){e.data.hasOwnProperty("adjustables")||window.WPRecipeMaker.quantities.findAdjustables(e);for(let t of e.data.adjustables)if(e.data.currentServingsParsed===e.data.originalServingsParsed)t.elem.textContent=t.original;else{const r=e.data.currentServingsParsed*t.unitQuantity;if(!isNaN(r)){let n=!0;if(wprmp_public.settings.unit_conversion_enabled&&window.WPRecipeMaker.hasOwnProperty("conversion")){const t=e.data.hasOwnProperty("currentSystem")?e.data.currentSystem:1;n=!wprmp_public.settings.hasOwnProperty(`unit_conversion_system_${t}_fractions`)||wprmp_public.settings[`unit_conversion_system_${t}_fractions`]}t.elem.textContent=this.format(r,n)}}},findAdjustables(e){let t=e.data.hasOwnProperty("adjustables")?e.data.adjustables:[];for(let n=t.length-1;n>=0;n--)document.body.contains(t[n].elem)||t.splice(n,1);const r=document.querySelectorAll(`#wprm-recipe-container-${e.id}, .wprm-recipe-roundup-item-${e.id}, .wprm-print-recipe-${e.id}, .wprm-recipe-${e.id}-ingredients-container, .wprm-recipe-${e.id}
1-instructions-container, .wprm-cook-mode-${e.id}`);for(let n of r){const r=n.querySelectorAll(".wprm-dynamic-quantity");for(let e of r)if(0===e.querySelectorAll(".wprm-adjustable").length){let t=e.innerText;if(/^\.\d+\s*$/.test(t))e.innerHTML='<span class="wprm-adjustable">'+t+"</span>";else{const r="¼½¾â
â
â
â
â
â
â
â
â
â
â
â
â
â
â
",n="[\\d"+r+"]([\\d"+r+".,\\/\\s]*[\\d"+r+"])?",i='<span class="wprm-adjustable">$&</span>';t=t.replace(new RegExp(n,"g"),i),e.innerHTML=t}}const i=n.querySelectorAll(".wpurp-adjustable-quantity");for(let e of i)e.classList.add("wprm-adjustable");const s=n.querySelectorAll(".wprm-adjustable");for(let n of s)-1===t.findIndex((e=>e.elem===n))&&t.push({elem:n,original:n.innerText,unitQuantity:(0,a.L)(n.innerText)/e.data.originalServingsParsed})}window.WPRecipeMaker.manager.changeRecipeData(e.id,{adjustables:t})},parse:e=>(0,a.L)(e),format:(e,t=!0)=>(0,a.V)(e,wprmp_public.settings.adjustable_servings_round_to_decimals,t)},function(e){"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)}((()=>{window.WPRecipeMaker.quantities.load()})),window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.shareOptionsPopup={init:()=>{document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-recipe-share-options-popup");t&&window.WPRecipeMaker.shareOptionsPopup.click(t,e)}),!1)},click:(e,t)=>{t.preventDefault();const r=e._tippy;r&&r.destroy();const n=e.previousElementSibling;if(n&&n.classList&&n.classList.contains("wprm-recipe-share-options-popup-container")){e.role="button";let t="#333333";n.dataset.hasOwnProperty("color")&&(t=n.dataset.color),(0,i.Ay)(e,{theme:"wprm-variable",content:n.innerHTML,allowHTML:!0,interactive:!0,trigger:"click",onMount(e){e.popper.querySelector(".tippy-box").style.setProperty("--wprm-tippy-background",t)},onCreate(e){e.show()}})}}},function(e){"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)}((()=>{window.WPRecipeMaker.shareOptionsPopup.init()})),window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.timer={cookModeTimers:new Map,cookModeTimerId:0,runningTimer:!1,runningTotal:0,runningRemaining:0,lastUpdated:0,init:()=>{const e=document.querySelector("body");e&&e.classList.contains("wprm-print")||window.WPRecipeMaker.timer.bindTimers()},bindTimers:(e=document)=>{if(!e||!e.querySelectorAll)return;const t=e.querySelectorAll(".wprm-timer");for(const r of t){const e=parseFloat(r.dataset.seconds);if(!e||e<=0)continue;let t=r.parentNode;t&&t.classList&&t.classList.contains("wprm-timer-link")||(t=document.createElement("a"),t.href="#",t.classList.add("wprm-timer-link"),r.parentNode&&r.parentNode.insertBefore(t,r),t.appendChild(r),(0,i.Ay)(t,{theme:"wprm",content:wprmp_public.timer.text.start_timer,plugins:[i.DX],inlinePositioning:!0})),t.dataset.timerBound||(t.dataset.timerBound="1",t.addEventListener("click",(t=>{t.preventDefault(),t.stopPropagation();const n=r.closest(".wprm-cook-mode"),i=n?n.closest(".wprm-popup-modal"):null,a=r.dataset.label?r.dataset.label.trim():r.textContent.trim();window.WPRecipeMaker.timer.start(e,{context:n?"cook-mode":"global",cookModeModal:i,label:a})})))}},update:()=>{const e=Date.now()-window.WPRecipeMaker.timer.lastUpdated;window.WPRecipeMaker.timer.runningRemaining-=e,window.WPRecipeMaker.timer.lastUpdated=Date.now();const t=window.WPRecipeMaker.timer.runningTotal;let r=window.WPRecipeMaker.timer.runningRemaining;r<=0&&(r=0,window.WPRecipeMaker.timer.finished()),window.WPRecipeMaker.timer.showTime(Math.round(r/1e3));const n=t>0?100*(t-r)/t:0,i=document.querySelector("#wprm-timer-bar-elapsed");i&&(i.style.width=Math.max(0,Math.min(100,n))+"%")},start:(e,t={})=>{"cook-mode"===(t.context||"global")&&t.cookModeModal?window.WPRecipeMaker.timer.startCookModeTimer(e,t):window.WPRecipeMaker.timer.startGlobalTimer(e)},startGlobalTimer:e=>{window.WPRecipeMaker.timer.stop((()=>{window.WPRecipeMaker.timer.createContainer(),window.WPRecipeMaker.timer.runningTotal=1e3*e,window.WPRecipeMaker.timer.runningRemaining=1e3*e,window.WPRecipeMaker.timer.showTime(e),window.WPRecipeMaker.timer.play()}))},play:()=>{const e=document.querySelector("#wprm-timer-play"),t=document.querySelector("#wprm-timer-pause");e&&(e.style.display="none"),t&&(t.style.display=""),window.WPRecipeMaker.timer.interval&&clearInterval(window.WPRecipeMaker.timer.interval),window.WPRecipeMaker.timer.interval=setInterval(window.WPRecipeMaker.timer.update,1e3),window.WPRecipeMaker.timer.lastUpdated=Date.now()},pauze:()=>{const e=document.querySelector("#wprm-timer-play"),t=document.querySelector("#wprm-timer-pause");e&&(e.style.display=""),t&&(t.style.display="none"),window.WPRecipeMaker.timer.interval&&clearInterval(window.WPRecipeMaker.timer.interval)},stop:(e=!1)=>{window.WPRecipeMaker.timer.interval&&clearInterval(window.WPRecipeMaker.timer.interval);const t=document.querySelector("#wprm-timer-container");t&&t.parentNode&&t.parentNode.removeChild(t),e&&e()},finished:()=>{window.WPRecipeMaker.timer.pauze();try{new Audio(wprmp_public.timer.sound_file).play()}catch(t){}const e=document.querySelector("#wprm-timer-container");e&&e.classList.add("wprm-timer-finished")},createContainer:()=>{const e=document.createElement("div");e.id="wprm-timer-container",e.innerHTML='<span id="wprm-timer-play" class="wprm-timer-icon" onclick="window.WPRecipeMaker.timer.play()">'+wprmp_public.timer.icons.play+"</span>",e.innerHTML+='<span id="wprm-timer-pause" class="wprm-timer-icon" onclick="window.WPRecipeMaker.timer.pauze()">'+wprmp_public.timer.icons.pause+"</span>",e.innerHTML+='<span id="wprm-timer-remaining"></span>',e.innerHTML+='<span id="wprm-timer-bar-container"><span id="wprm-timer-bar"><span id="wprm-timer-bar-elapsed"></span></span></span>',e.innerHTML+='<span id="wprm-timer-close" class="wprm-timer-icon" onclick="window.WPRecipeMaker.timer.stop()">'+wprmp_public.timer.icons.close+"</span>",document.querySelector("body").appendChild(e)},showTime:e=>{const t=document.querySelector("#wprm-timer-remaining");t&&(t.textContent=window.WPRecipeMaker.timer.formatTime(e))},formatTime:e=>{let t=Math.max(0,parseInt(e,10)||0);const r=Math.floor(t/3600);t-=3600*r;const n=Math.floor(t/60);t-=60*n;const i=e=>e<10?"0"+e:""+e;return r>0?i(r)+":"+i(n)+":"+i(t):i(n)+":"+i(t)},startCookModeTimer:(e,t={})=>{const r=t.cookModeModal;if(!r||!r.querySelector)return void window.WPRecipeMaker.timer.startGlobalTimer(e);const n=r.querySelector(".wprm-cook-mode-timers");if(!n)return void window.WPRecipeMaker.timer.startGlobalTimer(e);const i=t.label&&t.label.length?t.label:wprmp_public.timer.text.start_timer,a="cook-mode-timer-"+ ++window.WPRecipeMaker.timer.cookModeTimerId,s=1e3*e,o={id:a,total:s,remaining:s,lastUpdated:Date.now(),interval:null,label:i,cookModeModal:r,finished:!1,alarmPlayed:!1}
1;o.elements=window.WPRecipeMaker.timer.createCookModeTimerElement(o),n.appendChild(o.elements.container),window.WPRecipeMaker.timer.cookModeTimers.set(a,o),window.WPRecipeMaker.timer.updateCookModeTimerDisplay(o),window.WPRecipeMaker.timer.playCookModeTimer(a)},createCookModeTimerElement:e=>{const t=document.createElement("div");t.className="wprm-cook-mode-timer",t.dataset.timerId=e.id;const r=document.createElement("div");r.className="wprm-cook-mode-timer-top";const n=document.createElement("span");n.className="wprm-cook-mode-timer-label",n.textContent=e.label,r.appendChild(n);const i=document.createElement("span");i.className="wprm-cook-mode-timer-remaining",r.appendChild(i);const a=document.createElement("div");a.className="wprm-cook-mode-timer-controls";const s=wprmp_public.timer.text.start_timer||"Start timer",o=document.createElement("button");o.type="button",o.className="wprm-cook-mode-timer-button wprm-cook-mode-timer-play",o.innerHTML=wprmp_public.timer.icons.play,o.setAttribute("aria-label",s),o.setAttribute("title",s),o.addEventListener("click",(t=>{t.preventDefault(),window.WPRecipeMaker.timer.playCookModeTimer(e.id)})),a.appendChild(o);const c=document.createElement("button");c.type="button",c.className="wprm-cook-mode-timer-button wprm-cook-mode-timer-pause",c.innerHTML=wprmp_public.timer.icons.pause,c.setAttribute("aria-label","Pause timer"),c.setAttribute("title","Pause timer"),c.addEventListener("click",(t=>{t.preventDefault(),window.WPRecipeMaker.timer.pauseCookModeTimer(e.id)})),a.appendChild(c);const d=document.createElement("button");d.type="button",d.className="wprm-cook-mode-timer-button wprm-cook-mode-timer-close",d.innerHTML=wprmp_public.timer.icons.close,d.setAttribute("aria-label","Remove timer"),d.setAttribute("title","Remove timer"),d.addEventListener("click",(t=>{t.preventDefault(),window.WPRecipeMaker.timer.stopCookModeTimer(e.id)})),a.appendChild(d),r.appendChild(a),t.appendChild(r);const p=document.createElement("div");p.className="wprm-cook-mode-timer-bar";const l=document.createElement("div");return l.className="wprm-cook-mode-timer-bar-fill",p.appendChild(l),t.appendChild(p),c.style.display="none",{container:t,remaining:i,bar:l,playButton:o,pauseButton:c,closeButton:d}},updateCookModeTimerDisplay:e=>{if(!e||!e.elements)return;const t=window.WPRecipeMaker.timer.formatTime(Math.round(e.remaining/1e3));if(e.elements.remaining&&(e.elements.remaining.textContent=t),e.elements.bar){const t=e.total>0?(e.total-e.remaining)/e.total*100:0;e.elements.bar.style.width=Math.max(0,Math.min(100,t))+"%"}},playCookModeTimer:e=>{const t=window.WPRecipeMaker.timer.cookModeTimers.get(e);t&&t.elements&&(t.interval&&clearInterval(t.interval),(t.remaining<=0||t.finished)&&(t.remaining=t.total,t.finished=!1,t.alarmPlayed=!1,t.elements.container&&t.elements.container.classList.remove("wprm-cook-mode-timer-finished")),t.elements.playButton&&(t.elements.playButton.style.display="none"),t.elements.pauseButton&&(t.elements.pauseButton.style.display=""),t.lastUpdated=Date.now(),t.interval=setInterval((()=>{window.WPRecipeMaker.timer.updateCookModeTimer(e)}),1e3),window.WPRecipeMaker.timer.updateCookModeTimerDisplay(t))},pauseCookModeTimer:e=>{const t=window.WPRecipeMaker.timer.cookModeTimers.get(e);t&&t.elements&&(t.interval&&(clearInterval(t.interval),t.interval=null),t.elements.playButton&&(t.elements.playButton.style.display=""),t.elements.pauseButton&&(t.elements.pauseButton.style.display="none"))},stopCookModeTimer:e=>{const t=window.WPRecipeMaker.timer.cookModeTimers.get(e);t&&(window.WPRecipeMaker.timer.pauseCookModeTimer(e),t.elements&&t.elements.container&&t.elements.container.parentNode&&t.elements.container.parentNode.removeChild(t.elements.container),window.WPRecipeMaker.timer.cookModeTimers.delete(e))},updateCookModeTimer:e=>{const t=window.WPRecipeMaker.timer.cookModeTimers.get(e);if(!t)return;const r=Date.now()-t.lastUpdated;t.remaining-=r,t.lastUpdated=Date.now(),t.remaining<=0&&(t.remaining=0,window.WPRecipeMaker.timer.finishCookModeTimer(e)),window.WPRecipeMaker.timer.updateCookModeTimerDisplay(t)},finishCookModeTimer:e=>{const t=window.WPRecipeMaker.timer.cookModeTimers.get(e);if(t&&(window.WPRecipeMaker.timer.pauseCookModeTimer(e),t.finished=!0,t.elements&&t.elements.container&&t.elements.container.classList.add("wprm-cook-mode-timer-finished"),!t.alarmPlayed)){try{new Audio(wprmp_public.timer.sound_file).play()}catch(r){}t.alarmPlayed=!0}},clearCookModeTimers:(e=null)=>{const t=[];
1window.WPRecipeMaker.timer.cookModeTimers.forEach(((r,n)=>{e&&r.cookModeModal!==e||t.push(n)})),t.forEach((e=>window.WPRecipeMaker.timer.stopCookModeTimer(e)))}},function(e){"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)}((()=>{window.WPRecipeMaker.timer.init()}));r(2359);var o=r(5266);window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.userRating={init(){document.addEventListener("wprm-recipe-change",(e=>{if("rating"===e.detail.type){const t=e.detail.id;window.WPRecipeMaker.manager.getRecipe(t).then((e=>{e&&window.WPRecipeMaker.userRating.updateRatingDisplay(t,e.data.rating)}))}}))},settings:{color:wprmp_public.settings.template_color_icon},enter(e){e.parentNode.classList.add("wprm-user-rating-voting");let t=window.WPRecipeMaker.userRating.settings.color;"modern"===wprmp_public.settings.recipe_template_mode&&e.dataset.color&&(t=e.dataset.color);let r=e;for(;r;){r.classList.add("wprm-rating-star-selecting-filled");const e=r.querySelectorAll("polygon, path");for(let r of e)r.style.fill=t;r=r.previousSibling}let n=e.nextSibling;for(;n;){n.classList.add("wprm-rating-star-selecting-empty");const e=n.querySelectorAll("polygon, path");for(let t of e)t.style.fill="none";n=n.nextSibling}},leave(e){e.parentNode.classList.remove("wprm-user-rating-voting");let t=e.parentNode.firstChild;for(;t;){t.classList.remove("wprm-rating-star-selecting-filled"),t.classList.remove("wprm-rating-star-selecting-empty");const e=t.querySelectorAll("polygon, path");for(let t of e)t.style.fill="";t=t.nextSibling}},click(e,t){const r=t.which||t.keyCode||0;if("click"===t.type||13===r||32===r){t.preventDefault();const r=e.parentNode;let i=parseInt(e.dataset.rating),a=parseInt(r.dataset.recipe);if(!a)for(var n=e.parentNode;n&&n!=document;n=n.parentNode)if(n.matches(".wprm-recipe-container")){a=parseInt(n.dataset.recipeId);break}if("scroll"===wprmp_public.settings.user_ratings_type&&window.WPRecipeMaker.userRating.canJumpToComments()){const e=r.closest(".wprm-popup-modal"),t=window.WPRecipeMaker.modal&&window.WPRecipeMaker.modal.currentOpenUid;if(e&&t){const e=()=>{window.WPRecipeMaker.userRating.jumpToCommentRating(i)};document.addEventListener("wprm-modal-close",(function t(){document.removeEventListener("wprm-modal-close",t),e()})),window.WPRecipeMaker.modal.close(t)}else window.WPRecipeMaker.userRating.jumpToCommentRating(i)}else{const e=r.dataset.modalUid;window.WPRecipeMaker.modal.open(e,{recipe:a,rating:i})}}},updateRatingDisplay(e,t){const r=document.querySelectorAll(".wprm-recipe-rating-recipe-"+e);for(let n of r){let e=n.dataset.hasOwnProperty("decimals")?parseInt(n.dataset.decimals):2;e=0<=e?e:2,t.roundedAverage=Number(t.average.toFixed(e)),t.formattedAverage=(0,a.V)(t.average,e);const r=n.querySelector(".wprm-recipe-rating-details");if(r)r.innerHTML=window.WPRecipeMaker.userRating.getRatingDetailsText(t);else{const e=n.querySelector(".wprm-recipe-rating-average"),r=n.querySelector(".wprm-recipe-rating-count");e&&(e.innerText=t.formattedAverage),r&&(r.innerText=t.count)}const i=t.roundedAverage;for(let t=1;t<=5;t++){let e=n.querySelector(".wprm-rating-star-"+t);if(e)if(e.classList.remove("wprm-rating-star-full"),e.classList.remove("wprm-rating-star-empty"),e.classList.remove("wprm-rating-star-33"),e.classList.remove("wprm-rating-star-50"),e.classList.remove("wprm-rating-star-66"),t<=i)e.classList.add("wprm-rating-star-full");else{const r=0+i-t+1;0<r&&r<=.33?e.classList.add("wprm-rating-star-33"):0<r&&r<=.5?e.classList.add("wprm-rating-star-50"):0<r&&r<=.66?e.classList.add("wprm-rating-star-66"):0<r&&r<=1?e.classList.add("wprm-rating-star-full"):e.classList.add("wprm-rating-star-empty")}}n.classList.contains("wprm-user-rating")&&(0<t.user?(n.classList.remove("wprm-user-rating-not-voted"),n.classList.add("wprm-user-rating-has-voted")):(n.classList.add("wprm-user-rating-not-voted"),n.classList.remove("wprm-user-rating-has-voted")))}},getRatingDetailsText(e){let t="",r="";if(r=0===e.count?wprmp_public.settings.rating_details_zero:1===e.count?wprmp_public.settings.rating_details_one:wprmp_public.settings.rating_details_multiple,0<e.user){const e=wprmp_public.settings.rating_details_user_voted;r=r.replace("%not_voted%",""),r=r.replace("%voted%",e)}else{const e=wprmp_public.settings.rating_details_user_not_voted;r=r.replace("%voted%",""),r=r.replace("%not_voted%",e)}return r=r.replace("%average%",'<span class="wprm-recipe-rating-average">'+e.formattedAverage+"</span>"),r=r.replace("%votes%",'<span class="wprm-recipe-rating-count">'+e.count+"</span>"),r=r.replace("%user%",'<span class="wprm-recipe-rating-user">'+e.user+"</span>"),t=r.trim(),t},addRatingForRecipe(e,t){let r={Accept:"application/json","Content-Type":"application/json"};return 0<parseInt(wprmp_public.user)&&(r["X-WP-Nonce"]=wprm_public.api_nonce),fetch(`${wprmp_public.endpoints.user_rating}/${t}`,{method:"POST",headers:r,credentials:"same-origin",body:JSON.stringify({data:e})}).then((r=>r.ok?r.json():window.WPRecipeMaker.userRating.addRatingForRecipeThroughAjax(e,t))).then((e=>e))},addRatingForRecipeThroughAjax:(e,t)=>fetch(wprm_public.ajax_url,{method:"POST",credentials:"same-origin",body:"action=wprm_user_rate_recipe&security="+encodeURIComponent(wprm_public.nonce)+"&recipe_id="+encodeURIComponent(t)+"&data="+encodeURIComponent(JSON.stringify(e)),headers:{Accept:"application/json, text/plain, */*","Content-Type":"application/x-www-form-urlencoded; charset=utf-8"}}).then((e=>!!e.ok&&e.json())).then((e=>!!e.success&&e.data)),getCommentContainerElement(){let e=[".comment-form-wprm-rating","#llc_comments"];wprmp_public.settings.user_ratings_force_comment_scroll_to&&e.unshift(wprmp_public.settings.user_ratings_force_comment_scroll_to);for(let t of e){const e=document.querySelector(t);if(e)return e}return!1},canJumpToComments:()=>!!wprmp_public.settings.features_comment_ratings&&!!window.WPRecipeMaker.userRating.getCommentContainerElement(),jumpToCommentRating(e){let t=window.WPRecipeMaker.userRating.getCommentContainerElement();if(t){const r=()=>{const t=document.querySelector(".comment-form-wprm-rating");if(t){const r=t.querySelectorAll("input");for(let t of r)if(e===parseInt(t.value)){t.click();break}}const r=document.getElementById("comment");r&&r.focus()};!!wprmp_public.settings.user_ratings_force_comment_scroll_to_smooth?(0,o.A)(t,{verticalOffset:-100,speed:250}).then(r):(t.scrollIntoView({behavior:"instant"}),r())}}},function(e){"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)}((()=>
1{window.WPRecipeMaker.userRating.init()})),window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.premiumLoader={detect:()=>{},load:()=>Promise.resolve()}},4123:()=>{var e;window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.checkboxes={initModern:()=>{document.addEventListener("change",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-checkbox");t&&window.WPRecipeMaker.checkboxes.toggle(t,e)}),!1)},toggle:(e,t)=>{t.preventDefault();for(var r=e.parentNode;r&&r!=document;r=r.parentNode)if(r.matches("li")){r.classList.toggle("wprm-checkbox-is-checked");break}},initLegacy:()=>{let e="";e="checkbox"==wprmp_public.settings.template_ingredient_list_style&&"checkbox"==wprmp_public.settings.template_instruction_list_style?"li.wprm-recipe-ingredient, li.wprm-recipe-instruction:not(.wprm-recipe-instruction-tip)":"checkbox"==wprmp_public.settings.template_ingredient_list_style?"li.wprm-recipe-ingredient":"li.wprm-recipe-instruction:not(.wprm-recipe-instruction-tip)";const t=document.querySelectorAll(e);for(let r of t){r.classList.add("wprm-list-checkbox-container");let e=document.createElement("span");e.classList.add("wprm-list-checkbox"),r.insertBefore(e,r.firstChild)}document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-list-checkbox");t&&window.WPRecipeMaker.checkboxes.click(t,e)}),!1)},click:(e,t)=>{t.preventDefault();for(var r=e.parentNode;r&&r!=document;r=r.parentNode)if(r.matches(".wprm-list-checkbox-container")){e.classList.toggle("wprm-list-checkbox-checked"),r.classList.toggle("wprm-list-checkbox-checked");break}}},e=()=>{"legacy"!==wprmp_public.settings.recipe_template_mode||"checkbox"!=wprmp_public.settings.template_ingredient_list_style&&"checkbox"!=wprmp_public.settings.template_instruction_list_style||window.WPRecipeMaker.checkboxes.initLegacy(),"modern"===wprmp_public.settings.recipe_template_mode&&window.WPRecipeMaker.checkboxes.initModern()},"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)},4141:()=>{var e;window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.favorites={favorites:!1,data:!1,readyPromise:!1,renderTimeout:!1,getStorageKey:()=>wprmp_public.favorites.storage_key||"wprm-recipe-favorites",getMergeSessionKey:()=>wprmp_public.favorites.merge_session_key||`${window.WPRecipeMaker.favorites.getStorageKey()}-merged`,isLoggedIn:()=>0<parseInt(wprmp_public.user),init(){document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-recipe-favorite[data-recipe-id]");t&&window.WPRecipeMaker.favorites.onClickFavorite(t,e)}),!1),document.addEventListener("wprm-favorites-changed",(()=>{window.WPRecipeMaker.favorites.refreshButtons(),window.WPRecipeMaker.favorites.scheduleRenderFavoriteLists()})),window.WPRecipeMaker.favorites.ensureReady().then((()=>{window.WPRecipeMaker.favorites.refreshButtons(),window.WPRecipeMaker.favorites.renderFavoriteLists()}))},getFavoriteEntryId:e=>e&&"object"==typeof e&&e.hasOwnProperty("id")?parseInt(e.id):parseInt(e),getFavoriteEntryData(e){if(!e||"object"!=typeof e||Array.isArray(e))return{};const t=e.data&&"object"==typeof e.data&&!Array.isArray(e.data)?{...e.data}:{...e};return delete t.id,delete t.data,t},normalizeFavorites(e){if(e&&"object"==typeof e&&Array.isArray(e.favorites)&&(e=e.favorites),!Array.isArray(e))return[];const t=[];for(let r of e)r=window.WPRecipeMaker.favorites.getFavoriteEntryId(r),r&&!t.includes(r)&&t.push(r);return t},normalizeFavoritesData(e,t){if(!e||"object"!=typeof e||Array.isArray(e))return{};t=window.WPRecipeMaker.favorites.normalizeFavorites(t);const r={};return Object.keys(e).forEach((n=>{if(!(n=parseInt(n))||!t.includes(n)||!e[n]||"object"!=typeof e[n])return;const i={};e[n].hasOwnProperty("servings")&&0<=parseFloat(e[n].servings)&&(i.servings=parseFloat(e[n].servings)),e[n].hasOwnProperty("inShoppingList")&&"boolean"==typeof e[n].inShoppingList&&(i.inShoppingList=e[n].inShoppingList),Object.keys(i).length&&(r[n]=i)})),r},normalizeFavoritesStorage(e){const t=e&&"object"==typeof e&&Array.isArray(e.favorites)?e.favorites:e,r=window.WPRecipeMaker.favorites.normalizeFavorites(t),n=e&&"object"==typeof e&&e.hasOwnProperty("data")?window.WPRecipeMaker.favorites.normalizeFavoritesData(e.data,r):{};return Array.isArray(t)&&t.forEach((e=>{const t=window.WPRecipeMaker.favorites.getFavoriteEntryId(e),i=window.WPRecipeMaker.favorites.normalizeFavoritesData({[t]:window.WPRecipeMaker.favorites.getFavoriteEntryD
1ata(e)},r);t&&!n.hasOwnProperty(t)&&i.hasOwnProperty(t)&&(n[t]=i[t])})),{favorites:r,data:n}},getLocalFavoritesStorage(){try{const e=localStorage.getItem(window.WPRecipeMaker.favorites.getStorageKey());if(e)return window.WPRecipeMaker.favorites.normalizeFavoritesStorage(JSON.parse(e))}catch(e){}return{favorites:[],data:{}}},getLocalFavorites:()=>window.WPRecipeMaker.favorites.getLocalFavoritesStorage().favorites,storeFavorites(e){const t=window.WPRecipeMaker.favorites.getFavoritesStorage();t.favorites=e,window.WPRecipeMaker.favorites.storeFavoritesStorage(t)},storeFavoritesStorage(e){const t=(e=window.WPRecipeMaker.favorites.normalizeFavoritesStorage(e)).favorites.map((t=>e.data.hasOwnProperty(t)?{id:t,...e.data[t]}:t));try{const e=window.WPRecipeMaker.favorites.getStorageKey();t.length?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e)}catch(r){}},hasMergedThisSession(){try{return"1"===sessionStorage.getItem(window.WPRecipeMaker.favorites.getMergeSessionKey())}catch(e){return!1}},markMergedThisSession(){try{sessionStorage.setItem(window.WPRecipeMaker.favorites.getMergeSessionKey(),"1")}catch(e){}},getFavorites:()=>Array.isArray(window.WPRecipeMaker.favorites.favorites)?window.WPRecipeMaker.favorites.favorites:window.WPRecipeMaker.favorites.getLocalFavorites(),getFavoritesStorage:()=>({favorites:window.WPRecipeMaker.favorites.getFavorites(),data:window.WPRecipeMaker.favorites.data&&"object"==typeof window.WPRecipeMaker.favorites.data?window.WPRecipeMaker.favorites.data:window.WPRecipeMaker.favorites.getLocalFavoritesStorage().data}),getFavoriteData(e){if(!(e=parseInt(e)))return{};const t=window.WPRecipeMaker.favorites.getFavoritesStorage();return t.data.hasOwnProperty(e)?t.data[e]:{}},isFavorited:e=>!!(e=parseInt(e))&&window.WPRecipeMaker.favorites.getFavorites().includes(e),buildHeaders(e=!1){const t={Accept:"application/json"};return e&&(t["Content-Type"]="application/json"),window.WPRecipeMaker.favorites.isLoggedIn()&&(t["X-WP-Nonce"]=wprm_public.api_nonce),t},request(e,t="GET",r=!1){const n={method:t,headers:window.WPRecipeMaker.favorites.buildHeaders(!1!==r),credentials:"same-origin"};
1return!1!==r&&(n.body=JSON.stringify(r)),fetch(e,n).then((e=>!!e.ok&&e.json())).catch((()=>!1))},ensureReady:()=>(window.WPRecipeMaker.favorites.readyPromise||(window.WPRecipeMaker.favorites.readyPromise=window.WPRecipeMaker.favorites.bootstrapFavorites()),window.WPRecipeMaker.favorites.readyPromise),bootstrapFavorites:()=>new Promise((async e=>{let t=window.WPRecipeMaker.favorites.getLocalFavoritesStorage(),r=!1;if(window.WPRecipeMaker.favorites.isLoggedIn()&&t.favorites.length&&!window.WPRecipeMaker.favorites.hasMergedThisSession()){const e=await window.WPRecipeMaker.favorites.request(`${wprmp_public.endpoints.favorites}/merge`,"POST",{favorites:t});e&&Object.prototype.hasOwnProperty.call(e,"favorites")?(t=window.WPRecipeMaker.favorites.normalizeFavoritesStorage(e),window.WPRecipeMaker.favorites.markMergedThisSession()):r=!0}if(window.WPRecipeMaker.favorites.isLoggedIn()&&!r){const e=await window.WPRecipeMaker.favorites.request(wprmp_public.endpoints.favorites);e&&Object.prototype.hasOwnProperty.call(e,"favorites")&&(t=window.WPRecipeMaker.favorites.normalizeFavoritesStorage(e))}window.WPRecipeMaker.favorites.setFavoritesStorage(t,!0),e(t.favorites)})),setFavorites(e,t=!1,r=!1){const n=window.WPRecipeMaker.favorites.getFavoritesStorage();n.favorites=e,!1!==r&&(n.data=r),window.WPRecipeMaker.favorites.setFavoritesStorage(n,t)},setFavoritesStorage(e,t=!1){e=window.WPRecipeMaker.favorites.normalizeFavoritesStorage(e),window.WPRecipeMaker.favorites.favorites=e.favorites,window.WPRecipeMaker.favorites.data=e.data,window.WPRecipeMaker.favorites.storeFavoritesStorage(e),window.WPRecipeMaker.favorites.syncLoadedRecipeData(),t||document.dispatchEvent(new CustomEvent("wprm-favorites-changed",{detail:e}))},syncLoadedRecipeData(){window.WPRecipeMaker.hasOwnProperty("manager")&&window.WPRecipeMaker.manager.hasOwnProperty("recipes")&&Object.keys(window.WPRecipeMaker.manager.recipes).forEach((e=>{const t=window.WPRecipeMaker.manager.recipes[e];t&&t.id&&window.WPRecipeMaker.manager.changeRecipeData(t.id,{favorite:window.WPRecipeMaker.favorites.isFavorited(t.id)})}))},onClickFavorite(e,t){t.preventDefault();const r=parseInt(e.dataset.recipeId);r&&window.WPRecipeMaker.favorites.ensureReady().then((()=>{window.WPRecipeMaker.favorites.setFavorite(r,!window.WPRecipeMaker.favorites.isFavorited(r))}))},setFavorite(e,t){const r=window.WPRecipeMaker.favorites.getFavoritesStorage(),n={favorites:r.favorites.slice(),data:{...r.data}};if(t)n.favorites.includes(e)||n.favorites.push(e);else{const t=n.favorites.indexOf(e);0<=t&&n.favorites.splice(t,1),delete n.data[e]}window.WPRecipeMaker.favorites.setFavoritesStorage(n),window.WPRecipeMaker.favorites.isLoggedIn()&&window.WPRecipeMaker.favorites.request(`${wprmp_public.endpoints.favorites}/${e}`,"POST",{favorite:t,favorites:n}).then((e=>{e&&Object.prototype.hasOwnProperty.call(e,"favorites")?window.WPRecipeMaker.favorites.setFavoritesStorage(e):window.WPRecipeMaker.favorites.setFavoritesStorage(r)}))}
1,setFavoriteData(e,t){if(!(e=parseInt(e))||!window.WPRecipeMaker.favorites.isFavorited(e))return;const r=window.WPRecipeMaker.favorites.getFavoritesStorage(),n={favorites:r.favorites.slice(),data:{...r.data,[e]:{...r.data.hasOwnProperty(e)?r.data[e]:{},...t}}};window.WPRecipeMaker.favorites.setFavoritesStorage(n),window.WPRecipeMaker.favorites.isLoggedIn()&&window.WPRecipeMaker.favorites.request(`${wprmp_public.endpoints.favorites}/${e}/data`,"POST",{data:n.data[e],favorites:n}).then((e=>{e&&Object.prototype.hasOwnProperty.call(e,"favorites")?window.WPRecipeMaker.favorites.setFavoritesStorage(e):window.WPRecipeMaker.favorites.setFavoritesStorage(r)}))},refreshButtons(e=document){const t=window.WPRecipeMaker.favorites.getFavorites(),r=e.querySelectorAll(".wprm-recipe-favorite-inactive[data-recipe-id], .wprm-recipe-favorite-active[data-recipe-id]");for(let n of r){const e=parseInt(n.dataset.recipeId),r=t.includes(e),i=n.closest(".wprm-recipe-favorite-wrapper");n.classList.contains("wprm-recipe-favorite-inactive")?n.style.display=r?"none":"":n.classList.contains("wprm-recipe-favorite-active")&&(n.style.display=r?"":"none"),i&&i.classList.toggle("wprm-recipe-favorite-wrapper-active",r)}},scheduleRenderFavoriteLists(){clearTimeout(window.WPRecipeMaker.favorites.renderTimeout),window.WPRecipeMaker.favorites.renderTimeout=setTimeout((()=>{window.WPRecipeMaker.favorites.renderFavoriteLists()}),100)},renderFavoriteLists(){const e=document.querySelectorAll(".wprm-favorite-recipes-container");e.length&&window.WPRecipeMaker.favorites.ensureReady().then((()=>{window.WPRecipeMaker.favorites.request(`${wprmp_public.endpoints.favorites}/render`,"POST",{favorites:window.WPRecipeMaker.favorites.getFavorites()}).then((t=>{if(t&&Object.prototype.hasOwnProperty.call(t,"html"))for(let r of e)r.innerHTML=t.html,window.WPRecipeMaker.favorites.refreshButtons(r),window.WPRecipeMaker.hasOwnProperty("tooltip")&&window.WPRecipeMaker.tooltip.addTooltips(r)}))}))}},e=()=>{window.WPRecipeMaker.favorites.init()},"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)},4096:()=>{var e;window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.preventSleep={wakeLockApi:!1,wakeLock:!1,init(){if("wakeLock"in navigator&&"request"in navigator.wakeLock&&(this.wakeLockApi=navigator.wakeLock),this.wakeLockApi){const e=document.querySelectorAll(".wprm-prevent-sleep");if(0<e.length)for(let t of e){t.style.display="";t.querySelector(".wprm-prevent-sleep-checkbox").addEventListener("change",(function(e){WPRecipeMaker.preventSleep.checkboxChange(e.target)}),!1)}}},checkboxChange(e){e.checked?this.lock():this.unlock()},setCheckboxesState(e){const t=document.querySelectorAll(".wprm-prevent-sleep-checkbox");for(let r of t)r.checked=e},async lock(){try{this.wakeLock=await this.wakeLockApi.request("screen"),this.wakeLock.addEventListener("release",(e=>{this.wakeLock=!1,this.setCheckboxesState(!1)})),this.setCheckboxesState(!0)}catch(e){this.setCheckboxesState(!1)}},unlock(){this.wakeLock&&(this.wakeLock.release(),this.wakeLock=!1),this.setCheckboxesState(!1)}},e=()=>{window.WPRecipeMaker.preventSleep.init()},"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)},9055:()=>{var e;window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.print=void 0===window.WPRecipeMaker.print?{}:window.WPRecipeMaker.print,"function"!=typeof window.WPRecipeMaker.print.hasAccess&&(window.WPRecipeMaker.print.hasAccess=()=>{if(wprm_public.settings.hasOwnProperty("print_access_allowed"))return!!wprm_public.settings.print_access_allowed;const e=wprm_public.settings.hasOwnProperty("print_access")?wprm_public.settings.print_access:"everyone";return"disabled"!==e&&!("logged_in"===e&&0>=parseInt(wprm_public.user))}),window.WPRecipeMaker.premiumPrint={init:()=>{document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-recipe-download-pdf");t&&window.WPRecipeMaker.premiumPrint.onClick(t,e)}),!1)},onClick:(e,t)=>{if(!window.WPRecipeMaker.print.hasAccess())return void t.preventDefault();let r=e.dataset.recipeId;if(!r){const t=e.closest(".wprm-recipe-container");t&&(r=t.dataset.recipeId)}
1if(r){t.preventDefault(),r=parseInt(r);const n=e.dataset.hasOwnProperty("template")?e.dataset.template:"";let i="other";const a=e.closest(".wprm-recipe");a&&(i=a.classList.contains("wprm-recipe-snippet")?"snippet":a.classList.contains("wprm-recipe-roundup-item")?"roundup":"recipe"),window.WPRecipeMaker.analytics.registerAction(r,wprm_public.post_id,"print",{location:i}),window.WPRecipeMaker.premiumPrint.recipeAsIs(r,n)}},recipeAsIs:(e,t="")=>{let r=!1,n=1,i=!1;window.WPRecipeMaker.manager.getRecipe(e).then((a=>{a&&(a.data.hasOwnProperty("currentSystem")&&(n=a.data.currentSystem),a.data.currentServingsParsed!==a.data.originalServingsParsed&&(r=a.data.currentServingsParsed),i=a.data.currentAdvancedServings);const s=window.WPRecipeMaker.premiumPrint.normalizePrintArgs({servings:r,system:n,advancedServings:i});window.WPRecipeMaker.premiumPrint.recipePdf(e,s.servings,s.system,s.advancedServings,t)}))},normalizePrintArgs:(e={})=>{let t=!1;if(!1!==e.servings&&null!==e.servings&&""!==e.servings){const r=parseFloat(e.servings);t=!(isNaN(r)||r<=0)&&r}let r=parseInt(e.system);return r=isNaN(r)||r<0?1:r,{servings:t,system:r,advancedServings:!!e.hasOwnProperty("advancedServings")&&e.advancedServings}},recipePdf:async(e,t=!1,r=1,n=!1,i="")=>{if(!wprm_public.settings.pdf_download_enabled||!window.WPRecipeMaker.print.hasAccess())return;const a=window.WPRecipeMaker.premiumPrint.normalizePrintArgs({servings:t,system:r,advancedServings:n}),s=wprm_public.settings.print_new_tab?"_blank":"_self",o={id:e,system:a.system,servings:a.servings,advancedServings:a.advancedServings,output:"pdf"};localStorage.setItem("wprmPrintArgs",JSON.stringify(o));const c=window.WPRecipeMaker.premiumPrint.openPdfDownloadPlaceholder(s),d=await window.WPRecipeMaker.premiumPrint.getPdfDownloadUrl(e,i);if(d)if("_blank"===s&&c&&!c.closed)c.location=d,c.focus();else if("_blank"===s){window.open(d,"_blank")||(window.location=d)}else window.open(d,"_self");else window.WPRecipeMaker.premiumPrint.showPdfDownloadError(c)},openPdfDownloadPlaceholder:(e="_blank")=>{if("_blank"!==e)return!1;const t=window.open("","_blank");if(!t||t.closed)return!1;try{t.document.title="Preparing PDF",t.document.body.innerHTML='<div style="min-height:100vh;display:flex;align-items:center;justify-content:center;font-family:sans-serif;padding:20px;text-align:center;">Preparing PDF Download...</div>'}catch(r){}return t},showPdfDownloadError:(e=!1)=>{if(e&&!e.closed)try{e.document.title="PDF Download",e.document.body.innerHTML='<div style="min-height:100vh;display:flex;align-items:center;justify-content:center;font-family:sans-serif;padding:20px;text-align:center;">Could not generate the PDF download URL. Please try again.</div>'}catch(t){}},getPdfDownloadUrl:async(e,t="")=>{let r={Accept:"application/json","Content-Type":"application/json"};0<parseInt(wprm_public.user)&&(r["X-WP-Nonce"]=wprm_public.api_nonce);const n={recipeId:e,nonce:wprm_public.nonce};t&&(n.template=t);try{const e=await fetch(`${wprm_public.endpoints.utilities}/pdf-download-url`,{method:"POST",headers:r,credentials:"same-origin",body:JSON.stringify(n)});if(!e.ok)return!1;const t=await e.json();return!(!t||!t.url)&&t.url}catch(i){return!1}}},e=()=>{window.WPRecipeMaker&&window.WPRecipeMaker.print&&window.WPRecipeMaker.premiumPrint.init()},"loading"!==document.readyState?e():document.addEventListener("DOMContentLoaded",e)},5095:()=>{var e;window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.privateNotes={load:()=>{document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-private-notes-container:not(.wprm-private-notes-container-disabled)");t&&window.WPRecipeMaker.privateNotes.click(t,e)}),!1),window.WPRecipeMaker.privateNotes.init()},init:()=>{const e=document.querySelectorAll(".wprm-private-notes-container");for(let t of e)window.WPRecipeMaker.privateNotes.showNotes(t)},currentlyEditing:!1,click:(e,t)=>{t.preventDefault(),window.WPRecipeMaker.privateNotes.startEditing(e)},startEditing:e=>{if(parseInt(e.dataset.recipe)&&!window.WPRecipeMaker.privateNotes.currentlyEditing){window.WPRecipeMaker.privateNotes.currentlyEditing=!0,e.classList.add("wprm-private-notes-editing");const t=e.querySelector("textarea"),r=t.scrollHeight<100?100:t.scrollHeight;t.style.height=r+"px",window.onbeforeunload=()=>{window.WPRecipeMaker.privateNotes.stopEditing(e)},t.addEventListener("blur",(()=>{window.WPRecipeMaker.privateNotes.stopEditing(e)}),!1),t.addEventListener("input",(()=>{const e=t.scrollHeight<100?100:t.scrollHeight;t.style.height=e+"px"}),!1),t.focus(),t.setSelectionRange(t.value.length,t.value.length)}},stopEditing:e=>{window.WPRecipeMaker.privateNotes.currentlyEditing=!1;const t=e.querySelector("textarea"),r=t.value.trim(),n=t.cloneNode(!0);t.parentNode.replaceChild(n,t),e.classList.remove("wprm-private-notes-editing");const i=parseInt(e.dataset.recipe);window.WPRecipeMaker.privateNotes.saveNotes(i,r),window.WPRecipeMaker.privateNotes.showNotes(e)},showNotes:e=>{const t=parseInt(e.dataset.recipe);if(t){const r=window.WPRecipeMaker.privateNotes.getNotes(t,e),n=e.querySelector("textarea");n&&(n.value=r),r?e.classList.add("wprm-private-notes-has-notes"):e.classList.remove("wprm-private-notes-has-notes");const i=e.querySelector(".wprm-private-notes-user");i&&(i.innerHTML=r)}},recipeNotes:{},getNotes:(e,t=!1)=>{let r="";if(window.WPRecipeMaker.privateNotes.recipeNotes.hasOwnProperty(`recipe-${e}`))return r=window.WPRecipeMaker.privateNotes.recipeNotes[`recipe-${e}`],r;if(t){const e=t.querySelector("textarea");e&&(r=e.value)}if(!r){const t=localStorage.getItem(`wprm-recipe-private-notes-${e}`);t&&(r=t)}return r},saveNotes:(e,t)=>{e&&(window.WPRecipeMaker.privateNotes.recipeNotes[`recipe-${e}`]=t,0<parseInt(wprmp_public.user)?fetch(`${wprmp_public.endpoints.private_notes}/${e}`,{method:"POST",headers:{"X-WP-Nonce":wprm_public.api_nonce,Accept:"application/json","Content-Type":"application/json"},credentials:"same-origin",body:JSON.stringify({notes:t})}).then((e=>!!e.ok&&e.json())).then((r=>{!1===r?window.WPRecipeMaker.privateNotes.saveNotesInLocalStorage(e,t):window.WPRecipeMaker.privateNotes.saveNotesInLocalStorage(e,!1)})):window.WPRecipeMaker.privateNotes.saveNotesInLocalStorage(e,t))},saveNotesInLocalStorage:(e,t)=>
1{t?localStorage.setItem(`wprm-recipe-private-notes-${e}`,t):localStorage.removeItem(`wprm-recipe-private-notes-${e}`)},hideEmpty:()=>{const e=document.querySelectorAll(".wprm-private-notes-container");for(let t of e){const e=parseInt(t.dataset.recipe);if(e){if(!window.WPRecipeMaker.privateNotes.getNotes(e,t)){const e=t.previousElementSibling;e&&e.classList.contains("wprm-recipe-private-notes-header")&&e.remove(),t.remove()}}}}},e=()=>{window.WPRecipeMaker.privateNotes.load()},"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)},2359:()=>{var e;window.WPRecipeMaker=void 0===window.WPRecipeMaker?{}:window.WPRecipeMaker,window.WPRecipeMaker.userRatingModal={init(){if(wprmp_public.settings.user_ratings_open_url_parameter){if(new URLSearchParams(window.location.search).has(wprmp_public.settings.user_ratings_open_url_parameter)){const e=document.querySelectorAll(".wprm-user-rating, .wprm-recipe-user-ratings-modal");for(let t of e)if(t.dataset.hasOwnProperty("modalUid")&&t.dataset.hasOwnProperty("recipe")){const e=t.dataset.modalUid;let r=t.dataset.recipe;r=parseInt(r),r&&setTimeout((()=>{window.WPRecipeMaker.modal.open(e,{recipe:r,rating:0})}));break}}}document.addEventListener("wprm-modal-open",(e=>{"user-rating"===e.detail.type&&window.WPRecipeMaker.userRatingModal.opened(e.detail.uid,e.detail.modal,e.detail.data)})),document.addEventListener("wprm-modal-close",(e=>{"user-rating"===e.detail.type&&window.WPRecipeMaker.userRatingModal.closed(e.detail.uid,e.detail.modal,e.detail.data)})),document.addEventListener("wprm-comment-rating-change",(e=>{e.detail.hasOwnProperty("container")&&e.detail.container.classList.contains("wprm-user-ratings-modal-stars")&&window.WPRecipeMaker.userRatingModal.ratingChange(e.detail.rating)})),document.addEventListener("click",(function(e){const t=!!e.target.closest&&e.target.closest(".wprm-cta-rating-modal, .wprm-recipe-user-ratings-modal, .wprm-user-rating-modal-comment-suggestion, .wprm-user-rating-summary-details-no-comments");if(t)if(t.matches(".wprm-cta-rating-modal")||t.matches(".wprm-recipe-user-ratings-modal")){e.preventDefault();const r=t.dataset.modalUid;let n=t.dataset.recipe;n=parseInt(n),n&&window.WPRecipeMaker.modal.open(r,{recipe:n,rating:0})}else if(t.matches(".wprm-user-rating-modal-comment-suggestion")){e.preventDefault();const r=t.innerText,n=document.querySelector(".wprm-user-rating-modal-comment");r&&n&&(n.value=r,window.WPRecipeMaker.userRatingModal.checkFields())}else t.matches(".wprm-user-rating-summary-details-no-comments")&&(e.preventDefault(),window.WPRecipeMaker.userRatingModal.ratingsWithoutCommentsPopup(t))}),!1)},modalUid:!1,currentRecipe:!1,currentCommentForRecipe:{},opened(e,t,r){window.WPRecipeMaker.userRatingModal.modalUid=e,window.WPRecipeMaker.userRatingModal.setTitle(wprmp_public.settings.user_ratings_modal_title),window.WPRecipeMaker.userRatingModal.displayMessage('<div class="wprm-loader"></div>');const n=t.querySelector(".wprm-user-ratings-modal-stars-container").querySelectorAll("input");if(n[0].click(),r.hasOwnProperty("rating")){const e=parseInt(r.rating);for(let t of n)if(e===parseInt(t.value)){t.click();break}}const i=t.querySelector('input[name="wprm-user-rating-recipe-id"]');i.value=r.hasOwnProperty("recipe")?r.recipe:0,window.WPRecipeMaker.manager.getRecipe(i.value).then((e=>{window.WPRecipeMaker.userRatingModal.currentRecipe=e,window.WPRecipeMaker.userRatingModal.displayMessage(!1);const r=t.querySelector(".wprm-user-rating-modal-comment");r.value="",e&&window.WPRecipeMaker.userRatingModal.currentCommentForRecipe.hasOwnProperty(e.id)&&(r.value=window.WPRecipeMaker.userRatingModal.currentCommentForRecipe[e.id]),window.WPRecipeMaker.userRatingModal.checkFields(),window.WPRecipeMaker.userRatingModal.displayError(!1),window.WPRecipeMaker.userRatingModal.displayWaiting(!1);t.querySelector(".wprm-user-ratings-modal-recipe-name").innerHTML=e?e.data.name:""}))},ratingChange(e){window.WPRecipeMaker.userRatingModal.checkFields()},checkFields(){const e=document.querySelector(".wprm-popup-modal-user-rating"),t=0<parseInt(wprmp_public.user);t&&e.classList.add("wprm-user-rating-modal-logged-in");const r=e.querySelector(".wprm-user-rating-modal-comment"),n=e.querySelector('input[name="wprm-user-rating-name"]'),i=e.querySelector('input[name="wprm-user-rating-email"]');r.required=wprmp_public.settings.user_ratings_require_comment,n.required=!t&&wprmp_public.settings.user_ratings_require_name,i.required=!t&&wprmp_public.settings.user_ratings_require_email;const a=new FormData(r.form),s=Object.fromEntries(a),o=parseInt(s["wprm-user-rating-stars"]),c=e.querySelector(".wprm-user-rating-modal-comment-suggestions-container");if(c&&(c.style.display=window.WPRecipeMaker.userRatingModal.shouldSuggestionsShow(o)?"block":"none"),!wprmp_public.settings.user_ratings_require_comment){const t=e.querySelector(".wprm-user-rating-modal-submit-comment"),n=e.querySelector(".wprm-user-rating-modal-submit-no-comment");r.value?(t.style.display="block",n.style.display="none"):(t.style.display="none",n.style.display="block")}}
1,shouldSuggestionsShow(e){if("never"!==wprmp_public.settings.user_ratings_comment_suggestions_enabled){const t={always:1,"2_star":2,"3_star":3,"4_star":4,"5_star":5};if(t.hasOwnProperty(wprmp_public.settings.user_ratings_comment_suggestions_enabled)&&e>=t[wprmp_public.settings.user_ratings_comment_suggestions_enabled])return!0}return!1},submit(e){const t=new FormData(e),r=Object.fromEntries(t),n=parseInt(r["wprm-user-rating-recipe-id"]),i=parseInt(r["wprm-user-rating-stars"]),a=r["wprm-user-rating-comment"].trim(),s=r["wprm-user-rating-name"].trim(),o=r["wprm-user-rating-email"].trim();if(i<=0||i>5)return window.WPRecipeMaker.userRatingModal.displayError("rating"),!1;if(0===parseInt(wprmp_public.user)){if(!s&&wprmp_public.settings.user_ratings_require_name)return window.WPRecipeMaker.userRatingModal.displayError("name"),!1;if(!o&&wprmp_public.settings.user_ratings_require_email)return window.WPRecipeMaker.userRatingModal.displayError("email"),!1}window.WPRecipeMaker.userRatingModal.displayError(!1),window.WPRecipeMaker.userRatingModal.displayWaiting(!0);const c={post_id:wprm_public.post_id,rating:i,comment:a,name:s,email:o};window.WPRecipeMaker.manager.getRecipe(n).then((e=>{const t=e=>{let t="";t=!1===e?wprmp_public.settings.user_ratings_problem_message:wprmp_public.settings.user_ratings_thank_you_message_with_comment,t?(window.WPRecipeMaker.userRatingModal.setTitle(wprmp_public.settings.user_ratings_thank_you_title),window.WPRecipeMaker.userRatingModal.displayMessage(t)):window.WPRecipeMaker.modal.close(window.WPRecipeMaker.userRatingModal.modalUid)};e?e.addRating(c).then((e=>{window.WPRecipeMaker.userRatingModal.displayWaiting(!1),t(e)})):t(!1)}))},displayError(e){const t=document.querySelector("#wprm-user-rating-modal-errors");t&&t.querySelectorAll("div").forEach((t=>{e&&t.id==="wprm-user-rating-modal-error-"+e?t.style.display="block":t.style.display=""}))},displayWaiting(e){const t=document.querySelector("#wprm-user-rating-modal-waiting");t&&(t.style.display=e?"inline-block":"");const r=document.querySelectorAll(".wprm-user-rating-modal-submit-rating, .wprm-user-rating-modal-submit-comment");for(let n of r)n.disabled=e},displayMessage(e){const t=document.querySelector("#wprm-user-ratings-modal-stars-form"),r=document.querySelector("#wprm-user-ratings-modal-message");!1===e?(t.style.display="block",r.style.display="none"):(t.style.display="none",r.innerHTML=e,r.style.display="block")},setTitle(e){const t=document.querySelector("#wprm-popup-modal-user-rating-title");t&&e&&(t.innerHTML=e)},closed(e,t,r){const n=window.WPRecipeMaker.userRatingModal.currentRecipe;if(n){let e="";if("none"!==document.querySelector("#wprm-user-ratings-modal-stars-form").style.display){e=t.querySelector(".wprm-user-rating-modal-comment").value}window.WPRecipeMaker.userRatingModal.currentCommentForRecipe[n.id]=e}window.WPRecipeMaker.userRatingModal.currentRecipe=!1,window.WPRecipeMaker.userRatingModal.modalUid=!1},ratingsWithoutCommentsPopup(e){const t=e.dataset.modalUid;if(t){const r=document.getElementById("wprm-popup-modal-"+t);window.WPRecipeMaker.modal.open(t);const n=r.querySelector(".wprm-loader"),i=r.querySelector(".wprm-popup-modal-user-rating-summary-error"),a=r.querySelector(".wprm-popup-modal-user-rating-summary-ratings");n.style.display="block",i.style.display="none",a.innerHTML="";const s=e.dataset.recipeId,o=e.dataset.postId;let c={Accept:"application/json","Content-Type":"application/json"};return 0<parseInt(wprmp_public.user)&&(c["X-WP-Nonce"]=wprm_public.api_nonce),fetch(`${wprmp_public.endpoints.user_rating}/summary-popup`,{method:"POST",headers:c,credentials:"same-origin",body:JSON.stringify({recipeId:s,postId:o})}).then((e=>!!e.ok&&e.json())).then((e=>{n.style.display="none",e&&e.html?a.innerHTML=e.html:i.style.display="block"}))}}},e=()=>{window.WPRecipeMaker.userRatingModal.init()},"loading"!=document.readyState?e():document.addEventListener("DOMContentLoaded",e)},9707:(e,t,r)=>{"use strict";r.d(t,{L:()=>c,V:()=>o});var n=r(2667),i=r.n(n);const a={"¼":"1/4","½":"1/2","¾":"3/4","â
":"1/7","â
":"1/9","â
":"1/10","â
":"1/3","â
":"2/3","â
":"1/5","â
":"2/5","â
":"3/5","â
":"4/5","â
":"1/6","â
":"5/6","â
":"1/8","â
":"3/8","â
":"5/8","â
":"7/8"};function s(){if("undefined"==typeof window)return{};const e=[window.wprmp_public,window.wprmprc_public,window.wprm_public,window.wprmp_admin,window.wprm_admin];for(const t of e)if(t&&t.settings)return t.settings;return{}}function o(e,t=2,r=!1){const n=s(),o=n.decimal_separator,c="comma"===o?",":".",d="comma"===o?".":",";let p=e,l=!1;if(r){if(n.fractions_enabled){const t=n.fractions_use_mixed,r=n.fractions_use_symbols;let s=parseInt(n.fractions_max_denominator);s=s>1?s:8;const o=i()(e,s,t);if(o&&3===o.length&&!isNaN(o[0])&&!isNaN(o[1])&&!isNaN(o[2])){let e="";if(0<o[0]&&(e+=`${o[0]} `,e=e.replace(/\B(?=(\d{3})+(?!\d))/g,d)),0<o[1]?0<o[2]&&(e+=1===o[2]?o[1]:`${o[1]}/${o[2]}`):0===o[0]&&(e+=`1/${s}`),e){if(r){e=" "+e+" ";for(let t of Object.keys(a)){const r=a[t];e=e.replace(` ${r} `,` ${t} `)}}p=e.trim(),l=!0}}}}if(!l){t=parseInt(t),(isNaN(t)||t<0)&&(t=0);do{if(p=parseFloat(parseFloat(e).toFixed(t)),3<++t)break}while(0==p);p=""+p,"comma"===o&&(p=p.replace(".",","));const r=p.split(c);r[0]=r[0].replace(/\B(?=(\d{3})+(?!\d))/g,d),p=r.join(c)}return p}function c(e){const t="number"==typeof e;if(e=""+e,!t){if("comma"===s().decimal_separator){const t=e.indexOf(".");if(-1!==t&&e.length-t>3){const r=e.substr(0,t);0!==parseInt(r)&&(e=e.replace(".",""))}}else{const t=e.indexOf(",");if(-1!==t&&e.length-t>3){const r=e.substr(0,t);0!==parseInt(r)&&(e=e.replace(",",""))}}}
1var r=(e=(e=(e=(e=(e=((e=(e=(e=(e=(e=e.replace(",",".")).replace(" to ","-")).replace("â","-")).replace("â","-")).replace(" - ","-"))+"").replace(/(\u00BC|\u00BD|\u00BE|\u2150|\u2151|\u2152|\u2153|\u2154|\u2155|\u2156|\u2157|\u2158|\u2159|\u215A|\u215B|\u215C|\u215D|\u215E)/,(function(e,t){return" "+a[t]+" "}))).replace(/(<([^>]+)>)/gi,"")).replace(/(\[([^\]]+)\])/gi,"")).replace(/[^\d\s\.\/-]/gi,"")).trim()).split(" "),n=!1;if(""!==e){n=0;for(var i=0;i<r.length;i++)if(""!==r[i].trim()){var o=r[i].split("/",2),c=parseFloat(o[0]);if(void 0!==o[1]){var d=parseFloat(o[1]);0!==d&&(c/=d)}isNaN(c)||(n+=c)}}return n}},2667:e=>{var t=function(e,t,r){var n=Math.floor(e),i=1,a=n+1,s=1;if(e!==n)for(;i<=t&&s<=t;){var o=(n+a)/(i+s);if(e===o){i+s<=t?(i+=s,n+=a,s=t+1):i>s?s=t+1:i=t+1;break}e<o?(a=n+a,s=i+s):(n+=a,i+=s)}if(i>t&&(i=s,n=a),!r)return[0,n,i];var c=Math.floor(n/i);return[c,n-c*i,i]};t.cont=function(e,t,r){for(var n=e<0?-1:1,i=e*n,a=0,s=1,o=0,c=1,d=0,p=0,l=Math.floor(i);d<t&&(o=(l=Math.floor(i))*s+a,p=l*d+c,!(i-l<5e-8));)i=1/(i-l),a=s,s=o,c=d,d=p;if(p>t&&(d>t?(p=c,o=a):(p=d,o=s)),!r)return[0,n*o,p];var u=Math.floor(n*o/p);return[u,n*o-u*p,p]},"undefined"==typeof DO_NOT_EXPORT_FRAC&&(e.exports=t)}},e=>{var t,r=(t=4876,e(e.s=t));(WPRecipeMaker=void 0===WPRecipeMaker?{}:WPRecipeMaker)["../../wp-recipe-maker-premium/dist/public-pro-split"]=r}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.