1(()=>{"use strict";function e(e,t=!1){const n=e.querySelectorAll('button, [href], input:not([type="hidden"]), select, textarea, [tabindex]:not([tabindex="-1"])');if(0===n.length)return!1;const o=n?.[0];let c;o.focus(),t?(document.addEventListener("keydown",function(e){if(("Tab"===e.key||9===e.keyCode)&&e.shiftKey&&document.activeElement===o){const n=t.contentWindow.document,o=n.getElementById("checkout-after-success");c=null!==o?o:n.getElementById("checkout_cancel"),c.focus(),e.preventDefault()}}),document.getElementById("newspack-a11y-last-element").addEventListener("focus",()=>{o.focus()})):(c=n[n.length-1],document.addEventListener("keydown",function(e){("Tab"===e.key||9===e.keyCode)&&(e.shiftKey?document.activeElement===o&&(c.focus(),e.preventDefault()):document.activeElement===c&&(o.focus(),e.preventDefault()))}))}const t=(e,t={})=>({...t,action:e}),n=["action","action_type","amount","currency","product_id","product_type","quantity","variation_id","variation_ids","is_variable","is_grouped","child_ids","price_summary","newspack_popup_id","prompt_title","gate_post_id","contextual_prompt_post_id","contextual_prompt_placement","contextual_prompt_condition","recurrence","referrer"],o=(e,t="np_modal_checkout_interaction")=>{if("function"==typeof window.gtag&&e){const o={};for(const t of n)e[t]&&("boolean"==typeof e[t]?e[t]=e[t]?"yes":"no":"true"===e[t]?e[t]="yes":"false"===e[t]&&(e[t]="no"),o[t]=e[t].toString());window.gtag("event",t,o)}},c=e=>{if("function"!=typeof window.gtag)return;let n="opened";const{amount:c="",is_variable:r="",is_grouped:a="",price:i="",variation_id:s=""}=e,u={...e};(c||i)&&(u.amount=c||i),r&&!s&&(n="opened_variations"),a&&(n="opened_grouped");const l=t(n,u);o(l)};function r(e,t=null){const n=document.createElement("input");return n.type="hidden",n.name=e,t&&(n.value=t),n}function a(e){e.requestSubmit(e.querySelector('button[type="submit"]'))}function i(e){const t="string"==typeof e?document.getElementById(e):e;if(!t)return console.warn("No container found for checkout data"),{};let n={};if("FORM"===t.tagName){const e=new FormData(t);n=Object.fromEntries(e)}const o=t.dataset.checkout;if(!o)return console.warn("No checkout data found"),n;try{n={...n,...JSON.parse(o)}}catch(e){console.warn("Error parsing checkout data")}const c=new URL(t.ownerDocument.defaultView.location.href);return c.searchParams.get("action_type")&&(n.action_type=c.searchParams.get("action_type")),n}const s=e=>{if("function"!=typeof window.gtag)return;e=e||i("newspack_modal_checkout");const n=t("dismissed",e);o(n)};function u(e){const t=e&&e.dataset?e.dataset.checkout:null;if(!t)return null;try{return JSON.parse(t)}catch(e){return null}}const l=e=>Boolean(e.closest(".newspack-blocks__url-triggered-checkout"));function d(e,t,n=null,o={}){const{synthesized:c=null}=o,r=e.querySelectorAll(".wp-block-newspack-blocks-checkout-button"),a=null!=n&&""!==String(n);let i=null;return r.forEach(e=>{if(i)return;if(null!==c&&l(e)!==c)return;const o=e.querySelector("form"),r=u(o);r&&String(r.product_id)===String(t)&&(a&&String(r.variation_id)!==String(n)||!a&&r.variation_id||(i=o))}),i}function p(e,t,n={}){const{synthesized:o=null}=n,c=e.querySelectorAll(".wp-block-newspack-blocks-checkout-button");let r=null,a=null;return c.forEach(e=>{if(a)return;if(null!==o&&l(e)!==o)return;const n=e.querySelector("form"),c=u(n);c&&String(c.product_id)===String(t)&&(c.variation_id?r=r||n:a=n)}),a||r}function m(e,t,n,o={}){const{variationModalClassPrefix:c,iframeName:r}=o,a=[...e.querySelectorAll(`.${c}`)].find(e=>String(e.dataset.productId)===String(t));if(!a)return null;const i=a.querySelectorAll("form"),s=r?[...i].find(e=>e.getAttribute("target")===r):i[0];if(!s)return null;const u=[...s.querySelectorAll('input[type="radio"][name="product_id"]')].find(e=>String(e.value)===String(n));return u?(u.checked=!0,s):null}const h=["after_success_behavior","after_success_url","after_success_button_label","after_success_token","gate_post_id","newspack_popup_id","prompt_title","contextual_prompt_post_id","contextual_prompt_placement","contextual_prompt_condition","coupon","quantity"];function f(e,t,n=h){if(!e||!t)return;const o=t.ownerDocument,c=new FormData(e);
1n.forEach(e=>{if(t.querySelector(`input[name="${e}"]`))return;const n=c.getAll(e).filter(e=>"string"==typeof e&&e);if(!n.length)return;const r=o.createElement("input");r.type="hidden",r.name=e,r.value=n[n.length-1],t.prepend(r)})}const y=["coupon","after_success_behavior","after_success_url","after_success_button_label"],_=["tiered","frequency","untiered"],w=["once","month","year"];const k={gate:"gate_post_id",prompt:"newspack_popup_id"};const g=newspackBlocksModal.newspack_class_prefix,v="newspack_modal_checkout_iframe",b="newspack_modal_checkout_container",S=`${g}__modal`,E="newspack-blocks__modal-variation",q=`${g}__processing-payment-text`,A=newspackBlocksModal.processing_payment_messages;let L=!1,$=newspackBlocksModal.labels.checkout_modal_title,R=null;const M=e=>{e.overlayId&&window.newspackReaderActivation?.overlays&&window.newspackReaderActivation?.overlays.remove(e.overlayId),e.setAttribute("data-state","closed"),document.body.style.overflow="auto"};window.onpageshow=e=>{e.persisted&&(document.querySelectorAll(".modal-processing").forEach(e=>e.classList.remove("modal-processing")),document.querySelectorAll(".non-modal-checkout-loading").forEach(e=>e.classList.remove("non-modal-checkout-loading")),document.querySelectorAll(`.${S}-container`).forEach(e=>M(e)))};const C=new CustomEvent("checkout-closed");var x;window.newspackRAS=window.newspackRAS||[],x=()=>{const t=document.querySelector("#newspack_modal_checkout");if(!t)return;const n=t.querySelector(`.${S}__content`),o=r("modal_checkout","1"),l=n.querySelector(`.${g}__spinner`);let x=document.querySelector(".newspack-reader__account-link")?.[0];const B="600px",T=document.createElement("iframe");T.name=v,T.style.height=B,T.style.visibility="hidden";const P=e=>{j.observe(e),"none"!==l.style.display&&(l.style.display="none"),"visible"!==T.style.visibility&&(T.style.visibility="visible"),T._ready=!0};!function(e,t,n){e._ready=!1,e._readyTimer&&clearTimeout(e._readyTimer);let o=!1,c="";function r(){o||(o=!0,clearTimeout(e._readyTimer),t.call(this))}function a(){"complete"===this.readyState&&r.call(this)}function i(){e._ready=!1,n&&n(),e._readyTimer&&clearTimeout(e._readyTimer);const t=e.contentDocument||e.contentWindow?.document;t&&(t.removeEventListener("DOMContentLoaded",r),t.removeEventListener("readystatechange",a))}function s(){if(e._ready)return void i();const t=e.contentDocument||e.contentWindow?.document;t&&0!==t.URL.indexOf("about:")?"complete"===t?.readyState?r.call(t):(t.addEventListener("DOMContentLoaded",r),t.addEventListener("readystatechange",a)):e._readyTimer=setTimeout(s,10)}e._observer||(e._observer=new MutationObserver(e=>{e.forEach(e=>{"attributes"===e.type&&"src"===e.attributeName&&(o=!1,i(),s())})}),e._observer.observe(e,{attributes:!0})),e._locationObserver||(e._locationObserver=setInterval(function(){const t=e.contentDocument||e.contentWindow?.document;t&&t.URL!==c&&(c=t.URL,o=!1,i(),s())},50)),s()}(T,function(){const n=T.contentWindow?.location;if(window.newspackReaderActivation&&n?.href?.includes("order-received")){const e=window.newspackReaderActivation,t=new Proxy(new URLSearchParams(n.search),{get:(e,t)=>e.get(t)});t.email&&(e.setReaderEmail(t.email),e.setAuthenticated(!0))}const o=T?.contentDocument?.querySelector(`#${b}`);if(!o)return;const c=i(o.querySelector("#modal-checkout-product-details")),r=document.createElement("p");r.classList.add(q);let a=[];const s=()=>{a.forEach(e=>clearTimeout(e)),a=[]},u=()=>{l.style.display="none",s(),l.querySelectorAll(`.${q}`).forEach(e=>e.remove())};!function(e,t){e.checkoutCancel?t():e.addEventListener("checkout-cancel",t)}(o,()=>{z()}),function(e,t){e.checkoutPlaceOrderStart?t():e.addEventListener("checkout-place-order-start",t)}(o,e=>{l.querySelectorAll(`.${q}`).forEach(e=>e.remove()),l.style.display="flex",s(),r.textContent=A[0]?.text??"",A.slice(1).forEach(({text:t,delay:n})=>{const o=setTimeout(()=>{e.target.dispatchEvent(new CustomEvent("checkout-place-order-processing")),r.textContent=t},n);a.push(o)}),l.appendChild(r)}),function(e,t){e.checkoutPlaceOrderError?t():e.addEventListener("checkout-place-order-error",t)}(o,u),function(e,t){e.checkoutReady?t():e.addEventListener("checkout-ready",t)}(o,()=>{if(t.initialErrors){const e=document.createElement("div");e.classList.add("woocommerce-error"),e.textContent=t.initialErrors,o.prepend(e),delete t.initialErrors}J(),H($),T.contentWindow?.newspackBlocksModalCheckout?.checkout_nonce&&(t.checkout_nonce=T.contentWindow.newsp
1ackBlocksModalCheckout.checkout_nonce),P(o)}),function(e,t){e.checkoutComplete?t():e.addEventListener("checkout-complete",t)}(o,()=>{window.newspackRAS.push(["checkout_completed",c]),window?.newspackReaderActivation?.refreshNewslettersSignupModal&&window?.newspackReaderActivation?.getReader()?.email&&window.newspackReaderActivation.refreshNewslettersSignupModal(window.newspackReaderActivation.getReader().email),J("small"),H(newspackBlocksModal.labels.thankyou_modal_title),P(o),e(t.querySelector(`.${S}`)),u()}),function(e,t){e.checkoutPlaceOrderCriticalError?t():e.addEventListener("checkout-place-order-critical-error",t)}(o,()=>{var e;(e=R)&&(z(),l.style.display="none",t.initialErrors=newspackBlocksModal.labels.critical_error,e.requestSubmit(e.querySelector('button[type="submit"]')),u())})},()=>{l.style.display="flex"});const D=e=>new Promise((t,n)=>{const o=new URLSearchParams(e);o.append("action","modal_checkout_request"),fetch(newspackBlocksModal.ajax_url+"?"+o.toString()).then(e=>{e.ok||n(e),e.json().then(e=>{t(e.url)}).catch(n)}).catch(n)}),I=()=>"undefined"!=typeof newspack_ras_config&&!newspack_ras_config?.is_logged_in&&!window?.newspackReaderActivation?.getReader?.()?.authenticated&&newspackBlocksModal?.is_registration_required&&window?.newspackReaderActivation?.openAuthModal,N=function(e){const t={};return new URLSearchParams(e).forEach((e,n)=>{n.startsWith("utm")&&e&&(t[n]=e)}),t}(window.location.search),O=t=>{const n=!newspackBlocksModal.has_unsupported_payment_gateway;n||t.preventDefault();const o=t.target;o.classList.add("modal-processing"),function(e){if(!e||"function"!=typeof e.querySelector)return!1;if(e.closest(".newspack-content-gate__gate"))return!1;const t=function(){let e,t;try{e=window.sessionStorage.getItem("newspack_cta_attribution")}catch(e){return null}if(!e)return null;try{t=JSON.parse(e)}catch(e){return null}return t&&1===t.v&&k[t.type]&&t.id?"number"!=typeof t.ts||Date.now()-t.ts>18e5?null:t:null}();if(!t)return!1;const n=k[t.type];if(e.querySelector(`input[name="${n}"]`))return!1;const o=document.createElement("input");o.type="hidden",o.name=n,o.value=t.id,e.prepend(o)}(o),function(e,t){if(!e||!t)return;const n=e.ownerDocument;Object.keys(t).forEach(o=>{if(!t[o]||e.elements.namedItem(o))return;const c=n.createElement("input");c.type="hidden",c.name=o,c.value=t[o],e.prepend(c)})}(o,N);const l=i(o);if(l.newspack_donate){const e=l.donation_frequency,t=[...o.querySelectorAll(`.donation-tier__${e}, .donation-frequency__${e}`)],n=l.donation_tier_index;let c,r;n?(c=t[n],r=l[`donation_value_${e}`]):(c=t[0],l[`donation_value_${e}_untiered`]?r=l[`donation_value_${e}_untiered`]:(r=l[`donation_value_${e}`],"other"===r&&(r=l[`donation_value_${e}_other`])));const a=i(c);for(const e in a)l[e]=a[e];l.amount=r,l.price_summary=l.summary_template.replace("{{PRICE}}",function(e,t="USD"){return parseFloat(e).toLocaleString(document.documentElement.lang,{style:"currency",currency:t,currencyDisplay:"narrowSymbol"})}(l.amount,l.currency))}l&&Object.keys(l).forEach(e=>{0===o.querySelectorAll('input[name="'+e+'"]').length&&o.prepend(r(e,l[e]))}),l.variation_id||(x=t.submitter);const d=document.querySelectorAll(`.${E}`);if(d.forEach(e=>{(I()||n)&&M(e)}),l.is_grouped||l.is_variable&&!l.variation_id){const n=[...d].find(e=>e.dataset.productId===l.product_id);if(n)return n.querySelectorAll(`form[target="${v}"]`).forEach(e=>{!function(e,t,n=h){if(!e||!t)return;const o=e.ownerDocument;n.forEach(n=>{if(e.querySelectorAll(`input[type="hidden"][name="${n}"]`).forEach(e=>e.remove()),function(e,t){return!!e.querySelector(`input[name="${t}"]:not([type="hidden"])`)}(e,n))return;const c=t[n],r=null==c?"":String(c);if(!r)return;const a=o.createElement("input");a.type="hidden",a.name=n,a.value=r,e.prepend(a)})}(e,l);const t=u(e);t&&Object.keys(t).forEach(n=>{0===e.querySelectorAll('input[name="'+n+'"]').length&&e.prepend(r(n,t[n]))})}),t.preventDefault(),o.classList.remove("modal-processing"),F(n),e(n,!1),L||c(l),void document.getElementById("newspack_modal_checkout").setAttribute("data-checkout",JSON.stringify(l))}if(n||I()){if(o.classList.remove("modal-processing"),L||c(l),L=!0,I()){t.preventDefault();const e=D(l);e.then(e=>
1{window.newspackReaderActivation?.setPendingCheckout?.(e)}),window.newspackReaderActivation.openAuthModal({title:newspackBlocksModal.labels.auth_modal_title,onSuccess:(t,o)=>{e.then(e=>{o?.registered&&n&&(e+=`&${newspackBlocksModal.checkout_registration_flag}=1`),n?a(U(e)):D(l).then(window.location.href=e)}).catch(e=>{console.warn("Unable to generate cart:",e),z()})},onError:()=>{z()},onDismiss:()=>{s(l),L=!1,document.getElementById("newspack_modal_checkout").removeAttribute("data-checkout")},skipSuccess:!0,skipNewslettersSignup:!0,labels:{signin:{title:newspackBlocksModal.labels.signin_modal_title},register:{title:newspackBlocksModal.labels.register_modal_title}},trigger:t.submitter,closeOnSuccess:n})}else W(),document.getElementById("newspack_modal_checkout").setAttribute("data-checkout",JSON.stringify(l));R=o}else D(l).then(e=>{window.location.href=e}),(!l.is_variable||l.variation_id)&&o.querySelectorAll("button[type=submit]:focus").forEach(e=>{e.classList.add("non-modal-checkout-loading");const t=e.innerHTML;e.innerHTML="<span>"+t+"</span>"})},U=e=>{const t=document.createElement("form");t.method="POST",t.action=e,t.target=v,t.style.display="none";const n=document.createElement("button");return n.setAttribute("type","submit"),t.appendChild(n),document.body.appendChild(t),t.addEventListener("submit",O),t},j=new ResizeObserver(e=>{if(!e||!e.length)return;if(!T.contentDocument)return;const o=e[0].contentRect;if(o){const e=.01*Math.max(document.documentElement.clientHeight,window.innerHeight||0)*90-(t.querySelector(`.${S}__header`)?.offsetHeight||0),c=o.top+o.bottom,r=Math.min(c,e);if(0===r)return void(T.style.visibility="hidden");n.style.height=r+"px",T.style.height=r+"px"}}),z=()=>{const e=T?.contentDocument?.querySelector(`#${b}`),o=e?.querySelector('input[name="after_success_url"]'),c=e?.querySelector('input[name="after_success_behavior"]'),r=document?.querySelector(".newspack-newsletters-signup-modal"),a=i(e?.querySelector("#modal-checkout-product-details"));e?.checkoutComplete||(async()=>{const e=new FormData;newspackBlocksModal.has_unsupported_payment_gateway||e.append("modal_checkout","1"),e.append("action","abandon_modal_checkout"),e.append("_wpnonce",t.checkout_nonce),t.checkout_nonce=null;try{await fetch(newspackBlocksModal.ajax_url,{method:"POST",body:e})}catch(e){console.warn("Unable to empty cart:",e)}})();const u=!(T.contentDocument&&o&&c&&e?.checkoutComplete);if((u||r)&&(l.style.display="flex",T&&n.contains(T)&&(T._ready=!1,T.src="about:blank",T.style.height=B,T.style.visibility="hidden",n.style.height=B,n.removeChild(T)),j&&j.disconnect(),document.querySelectorAll(`.${S}-container`).forEach(e=>M(e)),x&&x.focus(),document.dispatchEvent(C)),e?.checkoutComplete){const e=()=>{if(o&&c){const e=o.getAttribute("value"),t=c.getAttribute("value");if("custom"===t)window.location.href=e;else if("referrer"===t){const e=document.referrer;let t=!1;if(e)try{new URL(e).origin===window.location.origin&&(window.location.href=e,t=!0)}catch(e){}t||window.history.back()}}window?.newspackReaderActivation?.setPendingCheckout?.(),L=!1};"subscription_switch"!==a.action_type&&window?.newspackReaderActivation?.openNewslettersSignupModal?window.newspackReaderActivation.openNewslettersSignupModal({onSuccess:e,onError:e,closeOnSuccess:u}):e(),u&&($=newspackBlocksModal.labels.checkout_modal_title,J(),H($))}else window?.newspackReaderActivation?.setPendingCheckout?.(),s(),L=!1,document.getElementById("newspack_modal_checkout").removeAttribute("data-checkout");document.removeEventListener("keydown",K)},W=o=>{o&&(T.src=o),l.style.display="flex",F(t),n.appendChild(T),t.addEventListener("click",e=>{e.target===t&&z()}),e(t,T),document.addEventListener("keydown",K)},F=e=>{window.newspackReaderActivation?.overlays&&(e.overlayId=window.newspackReaderActivation?.overlays.add()),e.setAttribute("data-state","open"),document.body.style.overflow="hidden"},H=e=>{const n=t.querySelector(`.${S}__header h2`);n&&(n.innerText=e)},J=(e="default")=>{const n=t.querySelector(`.${S}`);n&&("small"===e?n.classList.add(`${S}--small`):n.classList.remove(`${S}--small`))};t.querySelectorAll(`.${S}
1__close`).forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),z()})}),document.querySelectorAll(".newspack-blocks__modal-variation").forEach(e=>{e.addEventListener("click",t=>{t.target===e&&z()}),e.querySelectorAll(`.${S}__close`).forEach(e=>{e.addEventListener("click",e=>{e.preventDefault(),z()})})});const K=e=>{"Escape"===e.key&&z()};document.querySelectorAll(".wpbnbd.wpbnbd--platform-wc, .wp-block-newspack-blocks-checkout-button, .newspack-blocks__modal-variation").forEach(e=>{e.querySelectorAll("form").forEach(e=>{newspackBlocksModal.has_unsupported_payment_gateway||e.prepend(o.cloneNode()),e.target=v,e.addEventListener("submit",O)})});const V=["checkout","type","layout","frequency","amount","other","product_id","variation_id"],G=()=>{const e=new URL(window.location.href);V.forEach(t=>e.searchParams.delete(t)),window.history.replaceState(null,null,e.href)},Q=(e,t,n,o=null)=>{const c=function(e,{layout:t,frequency:n,amount:o}){if(!function(e,t,n){return!(!_.includes(e)||!w.includes(t))&&("other"===n?"frequency"===e:/^\d+(\.\d+)?$/.test(n))}(t,n,o))return{status:"invalid-params"};let c=null;for(const r of e.querySelectorAll(".wpbnbd.wpbnbd--platform-wc form")){const e=r.closest(".wpbnbd--tiers-based");if("tiered"===t){if(!e)continue;const t=r.querySelector(`.wpbnbd__tiers__amount [data-frequency-slug="${n}"][data-amount="${o}"]`);if(!t)continue;const a=parseInt(t.getAttribute("data-tier-index"));if(isNaN(a))continue;const i=r.querySelector(`button[data-frequency-slug="${n}"]`);if(!i&&!r.querySelector(`input[name="donation_frequency"][value="${n}"]`))continue;if(!e.hasAttribute("data-tiers-based-ready")){c||(c=r);continue}return{status:"tiered",form:r,frequencyButton:i,tierIndex:a}}if(e)continue;const a=r.querySelector(`input[name="donation_frequency"][value="${n}"]`);if(!a)continue;const i="untiered"===t?r.querySelector(`input[name="donation_value_${n}_untiered"]`):r.querySelector(`input[name="donation_value_${n}"][value="${o}"]`);if(i)return{status:t,form:r,frequencyInput:a,amountInput:i}}return c?{status:"not-ready",form:c}:{status:"no-match"}}(document,{layout:e,frequency:t,amount:n}),r=`layout "${e}", frequency "${t}" and amount "${n}"`;if("invalid-params"===c.status)return console.warn(`Newspack modal checkout: invalid donate trigger parameters (${r}). The checkout was not triggered.`),!1;if("no-match"===c.status)return console.warn(`Newspack modal checkout: no donate form matches ${r}. The checkout was not triggered.`),!1;if("not-ready"===c.status){const c=setTimeout(()=>{console.warn(`Newspack modal checkout: the donate form matching ${r} never finished initializing. The checkout was not triggered; the URL params were kept so a reload can retry.`)},5e3);return document.addEventListener("newspack-tiers-based-ready",()=>{clearTimeout(c),Q(e,t,n,o)&&G()},{once:!0}),!1}const{form:i}=c;if("tiered"===c.status){c.frequencyButton&&c.frequencyButton.click();const e=i.querySelector(`button[type="submit"][data-tier-index="${c.tierIndex}"]`);return e?(e.click(),!0):(console.warn(`Newspack modal checkout: no tier submit button matches ${r}. The checkout was not triggered.`),!1)}if(c.frequencyInput.checked=!0,"untiered"===c.status)c.amountInput.value=n;else if("other"===n){c.amountInput.click();const e=i.querySelector(`input[name="donation_value_${t}_other"]`);e&&o&&(e.value=o)}else c.amountInput.checked=!0;return i.checkValidity()?(a(i),!0):(console.warn(`Newspack modal checkout: the donate form rejected the values for ${r}. The checkout was not triggered.`),!1)};(function(e){const{readyState:t}=document;"complete"===t||"interactive"===t&&function(){const[e]=window.performance?.getEntriesByType?.("navigation")||[];return!e||e.domContentLoadedEventStart>0}()?e():document.addEventListener("DOMContentLoaded",e,{once:!0})})(()=>{const e=new URLSearchParams(window.location.search);if(!e.has("checkout"))return;let t=!0;const n=e.get("type");if("donate"===n){const n=e.get("layout"),o=e.get("frequency"),c=e.get("amount"),r=e.get("other");n&&o&&c?t=Q(n,o,c,r):(t=!1,console.warn("Newspack modal checkout: donate trigger is missing layout, frequency or amount. The checkout was not triggered."))}else if("checkout_button"===n){const n=e.get("product_id"),o=e.get("variation_id");n?t=((e,t=null)=>{const n=function(e,t,n,o={}){if(null==n||""===String(n))return d(e,t,null,{synthesized:!1})||d(e,t,null,{synthesized:!0});const c=d(e,t,n,{synthesized:!1});if(c)return c;const r=p(e,t,{synthesized:!1});if(r){const c=m(e,t,n,o);if(c)return f(r,c),c}const a=d(e,t,n,{synthesized:!0});if(a)return a;const i=m(e,t,n,o);return i?(f(p(e,t),i),i):null}(document,e,t,{variationModalClassPrefix:E,iframeName:v});if(n){const e=function(e,t){const n=new URLSearchParams(t);return y.filter(t=>n.get(t)&&!(e&&e.elements.namedItem(t)))}(n,window.location.search);return e.length&&console.warn(`Newspack modal checkout: the resolved checkout form does not carry ${e.join(", ")} from the URL. The page block's own settings apply instead.`),a(n),!0}const o=`Newspack modal checkout: no checkout form found for product_id "${e}"`+(t?` and variation_id "${t}"`:"")+". The checkout was not triggered.";return console.warn(o),!1})(n,o):(t=!1,console.warn("Newspack modal checkout: checkout_button trigger is missing product_id. The checkout was not triggered."))}
1else{const e=window.newspackReaderActivation?.getPendingCheckout?.();e&&a(U(e))}t&&G()}),window.newspackOpenModalCheckout=({url:e=null,title:t=null,actionType:n=null,afterSuccess:o={},quantity:c=null,onCheckoutComplete:r=null,onClose:a=null})=>{if($=t||newspackBlocksModal.labels.checkout_modal_title,H($),(e=new URL(e||newspackBlocksModal.checkout_url)).searchParams.has("my_account_checkout")&&e.searchParams.delete("my_account_checkout"),e.searchParams.has("modal_checkout")||e.searchParams.set("modal_checkout","1"),n&&e.searchParams.set("action_type",n),c&&parseInt(c,10)>1&&e.searchParams.set("quantity",String(parseInt(c,10))),o?.url&&e.searchParams.set("after_success_url",o.url),(o?.behavior||o?.url)&&e.searchParams.set("after_success_behavior",o.behavior||"custom"),o?.buttonLabel&&e.searchParams.set("after_success_button_label",o.buttonLabel),r){const e=({detail:{action:e,data:t}})=>{"checkout_completed"===e&&r(t)};window.newspackRAS.push(t=>{t.on("activity",e);const n=()=>{t.off("activity",e),document.removeEventListener("checkout-closed",n)};document.addEventListener("checkout-closed",n)})}if(a){const e=()=>{a(),document.removeEventListener("checkout-closed",e)};document.addEventListener("checkout-closed",e)}W(e.toString())},window.newspackCloseModalCheckout=z},"undefined"!=typeof document&&("complete"!==document.readyState&&"interactive"!==document.readyState?document.addEventListener("DOMContentLoaded",x):x())})();
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.