(()=>{"use strict";var e={d:(o,n)=>{for(var t in n)e.o(n,t)&&!e.o(o,t)&&Object.defineProperty(o,t,{enumerable:!0,get:n[t]})},o:(e,o)=>Object.prototype.hasOwnProperty.call(e,o),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},o={};e.r(o),e.d(o,{pmcPiano:()=>v});const n="PMC: Piano: ",t=()=>{var e,o;return null===(o=null===(e=window.location)||void 0===e?void 0:e.search)||void 0===o?void 0:o.includes("pianoDebug")},i=e=>{let o=e.name.replace("bound","").trim();return o||(o="Anonymous"),o},a=e=>e.origin.endsWith(".tinypass.com")||e.origin.endsWith("https://tinypass.com")||e.origin.endsWith(".piano.io")||e.origin.endsWith("https://piano.io");var l=function(e,o,n,t){return new(n||(n=Promise))(function(i,a){function l(e){try{r(t.next(e))}catch(e){a(e)}}function s(e){try{r(t.throw(e))}catch(e){a(e)}}function r(e){var o;e.done?i(e.value):(o=e.value,o instanceof n?o:new n(function(e){e(o)})).then(l,s)}r((t=t.apply(e,o||[])).next())})};const s={callApi:(e,...o)=>l(void 0,[e,...o],void 0,function*(e,o={}){return yield new Promise(n=>{window.tp.api.callApi(e,o,n)}).then(i=>(t()&&console.log(n,"pmcPianoApi.callApi",e,o,i),i)).catch(i=>{t()&&console.error(n,"pmcPianoApi.callApi",e,o,i)})}),callProtectedApi:function(e){return l(this,void 0,void 0,function*(){var o;const i=`${null===(o=window.pmcPianoData)||void 0===o?void 0:o.wordPressRestApiUri}${e}`;return yield fetch(i,{credentials:"include"}).then(e=>e.headers.get("content-type").includes("application/json")?e.json():e.text()).then(e=>(t()&&console.log(n,"pmcPianoApi.callProtectedApi",i,e),e)).catch(e=>{t()&&console.error(n,"pmcPianoApi.callProtectedApi",i,e)})})},getLicenseeData:e=>l(void 0,void 0,void 0,function*(){return yield s.callProtectedApi(`/licensee/${e}`)}),getUserCustomFields:e=>l(void 0,void 0,void 0,function*(){return yield s.callProtectedApi(`/user/custom-fields/${e}`)}),getAccessList:()=>l(void 0,void 0,void 0,function*(){return yield s.callApi("/access/list").then(({data:e})=>e)}),getConversionList:()=>l(void 0,void 0,void 0,function*(){return yield s.callApi("/conversion/list").then(({conversions:e})=>e)})},r=(e={})=>{void 0!==e.knownUser&&window.tp.user.isUserValid()&&(t()&&console.log(n,"init","Firing known user callback",i(e.knownUser)),e.knownUser()),void 0===e.unknownUser||window.tp.user.isUserValid()||(t()&&console.log(n,"init","Firing unknown user callback",i(e.unknownUser)),e.unknownUser())},d=(e,o)=>{t()&&console.log(n,"loginSuccess","Firing callback",i(e),o),e(o)},c=e=>{t()&&console.log(n,"logout","Firing callback",i(e)),e()},u=(e,o)=>{t()&&console.log(n,"registrationSuccess","Firing callback",i(e),o),e(o)};var p=function(e,o,n,t){return new(n||(n=Promise))(function(i,a){function l(e){try{r(t.next(e))}catch(e){a(e)}}function s(e){try{r(t.throw(e))}catch(e){a(e)}}function r(e){var o;e.done?i(e.value):(o=e.value,o instanceof n?o:new n(function(e){e(o)})).then(l,s)}r((t=t.apply(e,o||[])).next())})};let w,m="";const v={api:s,callbacks:{onInit:e=>(window.tp=window.tp||[],window.tp.push(["init",r.bind(void 0,e)]),window.pmcPiano.callbacks),onKnownIP:e=>{var o;return null===(o=window.pmcPiano.ipAuth)||void 0===o||o.onKnownIP(e),window.pmcPiano.callbacks},onLogin:e=>(window.tp=window.tp||[],window.tp.push(["addHandler","loginSuccess",d.bind(void 0,e)]),window.pmcPiano.callbacks),onLogout:e=>(window.tp=window.tp||[],window.tp.push(["addHandler","logout",c.bind(void 0,e)]),window.pmcPiano.callbacks),onRegistration:e=>(window.tp=window.tp||[],window.tp.push(["addHandler","registrationSuccess",u.bind(void 0,e)]),window.pmcPiano.callbacks)},ipAuth:{callbacks:[],doCallbacks:function(){this.callbacks.forEach(e=>{t()&&console.log(n,"Running known IP callback",i(e)),e()})},hasKnownIP:!1,onKnownIP:function(e){this.hasKnownIP?e():this.callbacks.push(e)},setKnownIP:function(){t()&&console.log(n,"User has a known IP Address"),this.hasKnownIP=!0,this.doCallbacks()}},piano:{loadSDK:function(){var e;if(!(null===(e=window.pmcPianoData)||void 0===e?void 0:e.sdkUri))return void console.error(n,"window.pmcPianoData.sdkUri not defined",window.pmcPianoData);const o=document.createElement("script");o.type="text/javascript",o.async=!0,o.src=window.pmcPianoData.sdkUri,document.head.appendChild(o)},prime:function(){var e,o,i,a,l,s,r,d,c,u,p,w,m,v,g;if(window.tp=window.tp||[],!(null===(e=window.pmcPianoData)||void 0===e?void 0:e.aid))return void console.error(n,"window.pmcPianoData.aid not defined",window.pmcPianoData);window.tp.push(["setAid",null===(o=window.pmcPianoData)||void 0===o?void 0:o.aid]),(null===(i=window.pmcPianoData)||void 0===i?void 0:i.whitelabelingDomainComposer)&&(t()&&console.log(n,"tp.push: [setComposerHost="+window.pmcPianoData.whitelabelingDomainComposer+"]"),window.tp.push(["setComposerHost","https://"+window.pmcPianoData.whitelabelingDomainComposer])),(null===(a=window.pmcPianoData)||void 0===a?void 0:a.whitelabelingDomainId)&&(t()&&console.log(n,"tp.push: [setPianoIdUrl="+window.pmcPianoData.whitelabelingDomainId+"]"),window.tp.push(["setPianoIdUrl","https://"+window.pmcPianoData.whitelabelingDomainId])),(null===(l=window.pmcPianoData)||void 0===l?void 0:l.whitelabelingDomainVx)&&(t()&&console.log(n,"tp.push: [setEndpoint="+window.pmcPianoData.whitelabelingDomainVx+"]"),window.tp.push(["setEndpoint","https://"+window.pmcPianoData.whitelabelingDomainVx])),(null===(s=window.pmcPianoData)||void 0===s?void 0:s.whitelabelingDomainStatic)&&(t()&&console.log(n,"tp.push: [setStatic="+window.pmcPianoData.whitelabelingDomainStatic+"]"),window.tp.push(["setStaticDomain","https://"+window.pmcPianoData.whitelabelingDomainStatic])),(null===(r=window.pmcPianoData)||void 0===r?void 0:r.cxSiteId)&&(t()&&console.log(n,"tp.push: [setCxenseSiteID="+window.pmcPianoData.cxSiteId+"]"),window.tp.push(["setCxenseSiteId",window.pmcPianoData.cxSiteId])),(null===(d=window.pmcPianoData)||void 0===d?void 0:d.whitelabelingDomainVx)||window.tp.push(["setSandbox",!!(null===(c=window.pmcPianoData)||void 0===c?void 0:c.isSandboxMode)]),window.tp.push(["setDebug",t()]),window.tp.push(["setUsePianoIdUserProvider",!0]),Object.entries(null!==(p=null===(u=window.pmcPianoData)||void 0===u?void 0:u.customVariables)&&void 0!==p?p:{}).forEach(([e,o])=>{t()&&console.log(n,"tp.push: [setCustomVariable, "+e+"="+o+"]"),window.tp.push(["setCustomVariable",e,o])});const h=window.pmc.tracking.get_properties();if(window.tp.push(["setPageURL",window.location.href]),h.forEach(function(e){t()&&console.log(n,"tp.push: [setCustomVariable, pmc-"+e.name+"="+e.value+"]"),window.tp.push(["setCustomVariable","pmc-"+e.name,e.value])}),null===(w=window.pmcPianoData)||void 0===w?void 0:w.author){const e=[].concat(window.pmcPianoData.author).join(",");t()&&console.log(n,"tp.push: [setContentAuthor="+e+"]"),window.tp.push(["setContentAuthor",e])}(null===(m=window.pmcPianoData)||void 0===m?void 0:m.tags)&&0<(null===(v=window.pmcPianoData.tags)||void 0===v?void 0:v.length)&&(t()&&console.log(n,"tp.push: [setTags=]",window.pmcPianoData.tags),window.tp.push(["setTags",null!==(g=window.pmcPianoData.tags)&&void 0!==g?g:[]])),window.tp.push(["addHandler","customEvent",function(e){var o,i;if("template-redirect"===e.eventName){const a=(()=>{try{return JSON.parse(e.params.params)}catch(e){return t()&&console.error(n,e),{}}})(),l=encodeURIComponent(null!==(i=null!==(o=e.params.trackingId)&&void 0!==o?o:a.trackingId)&&void 0!==i?i:""),s=`${e.params.url}${e.params.url.includes("?")?"&":"?"}_ptid=${l}`;t()&&console.log(n,"custom event template-redirect",e,a,l,s);const r={last_viewed_url:window.location.href,aid:null==a?void 0:a.aid,experienceId:null==a?void 0:a.experienceId,offerId:null==a?void 0:a.offerId,templateId:null==a?void 0:a.templateId,templateVariantId:null==a?void 0:a.templateVariantId,trackingId:null==a?void 0:a.trackingId,experienceActionId:null==a?void 0:a.experienceActionId,tags:null==a?void 0:a.tags,url:null==a?void 0:a.url,event_callback:()=>{t()&&console.log("GA4 Event Subscribed Click Callback",s,r),window.location.href=s}};window.gtag("event","subscribe_click",r),setTimeout(()=>{t()&&console.log("GA4 Event Subscribed Click Callback",s,r),window.location.href=s},500)}}])},setCallbacks:function(){var e,o;const n=()=>{window.pmcPiano.piano.setGA4Config(),window.tp.experience.execute()};null===(o=null===(e=window.pmcPiano)||void 0===e?void 0:e.callbacks)||void 0===o||o.onInit({knownUser:n,unknownUser:n}).onLogin(e=>{"PIANOID"===e.source&&!0!==e.registration&&window.pmcPiano.piano.reRenderExperiences()}).onLogout(this.reRenderExperiences.bind(this))},setGA4Config:function(){var e,o,i,a;const l=null===(e=window.tp.pianoId.getUser())||void 0===e?void 0:e.uid,s=null===(a=null===(i=null===(o=window.pmcPianoData)||void 0===o?void 0:o.trackingPixels)||void 0===i?void 0:i.ga)||void 0===a?void 0:a.measurement_id;if(!s)return void console.error(n,"GA4 measurement_id is undefined.",window.pmcPianoData);const r={send_page_view:!1,page_location:document.URL,page_title:document.title};l&&(r.user_id=l),window.tp.setGA4Config({measurementId:s,eventParameters:r}),t()&&console.log(n,"tp.setGA4Config measurement id",window.tp.ga4Service.getMeasurementId())},reRenderExperiences:function(){t()&&console.log(n,"Re-rendering Experiences"),window.tp.offer.close(),window.tp.offer.closeInline("#piano-paywall"),window.tp.offer.closeInline("#piano-right-rail"),window.tp.offer.closeInline("#piano-mid-river"),window.tp.offer.closeInline("#piano-sticky-footer"),window.tp.offer.closeInline("#piano-fly-out"),window.tp.offer.closeInline("#piano-module-header-link-vy"),window.tp.offer.closeInline("#piano-header-subscribe-button"),window.tp.offer.closeInline("#piano-header-sub-button");const e=document.querySelector(".pmc-paywall");e&&(e.classList.remove("a-article-cropped"),e.classList.remove("piano-truncate-content")),window.tp.experience.execute()}},reportingCookie:{cookieLabel:"pmc_piano_reporting",reporting:{entitlements:"",user_type:"ANONYMOUS",acct_id:null,acct_type:null,org_id:null,org_name:null,paywall_logged_in:!1},initialize:function(){var e;const o=this;t()&&console.log(n,"Initializing Piano Reporting Cookie"),null===(e=window.pmcPiano)||void 0===e||e.callbacks.onInit({knownUser:()=>{o.setDataForAuthUser()},unknownUser:()=>p(this,void 0,void 0,function*(){o.hasReportingCookie()||(yield o.set(JSON.stringify(o.reporting)))})}).onKnownIP(function(){o.reporting.acct_type="ip",o.reporting.user_type="KNOWN",o.set(JSON.stringify(o.reporting))}).onLogin(()=>{o.setDataForAuthUser()}).onLogout(o.delete.bind(o))},set:function(e){return p(this,void 0,void 0,function*(){t()&&console.log(n,"Setting pmc_piano_reporting cookie",e),yield function(e){return o=this,n=arguments,i=function*(e,o=100){for(;!e();)yield new Promise(e=>setTimeout(e,o))},new((t=void 0)||(t=Promise))(function(e,a){function l(e){try{r(i.next(e))}catch(e){a(e)}}function s(e){try{r(i.throw(e))}catch(e){a(e)}}function r(o){var n;o.done?e(o.value):(n=o.value,n instanceof t?n:new t(function(e){e(n)})).then(l,s)}r((i=i.apply(o,n||[])).next())});var o,n,t,i}(()=>void 0!==window.OptanonActiveGroups),window.pmc.cookie.set(this.cookieLabel,e,604800,"/","targeting",this.tld())})},delete:function(){t()&&console.log(n,"Deleting pmc_piano_reporting cookie"),window.pmc.cookie.expire(this.cookieLabel,"/",this.tld())},getDataForAuthUser:function(){return p(this,void 0,void 0,function*(){var e,o,i,a,l;let s=null!==(e=yield window.pmcPiano.api.getConversionList())&&void 0!==e?e:[];const r=null!==(o=s.sort((e,o)=>o.create_date-e.create_date)[0])&&void 0!==o?o:void 0;s=s.filter(e=>{var o;return null===(o=null==e?void 0:e.user_access)||void 0===o?void 0:o.granted}),s=0>=s.length?[r]:(e=>{let o=[];return 1>=e.length?e:(["( |^)shared","( |^)corporate","( |^)education","( |^)partner","( |^)agent","( |^)billboard member","( |^)employee","( |^)comp","( |^)(limited|registration)"].forEach(n=>{var t,i,a;let l=0;for(;l{var i,a;const l=e=>{var o,n;const t=null===(n=null===(o=null==e?void 0:e.term)||void 0===o?void 0:o.resource.name)||void 0===n?void 0:n.toLocaleLowerCase();return(null==t?void 0:t.match(/( |^)shared/))?"shared":(null==t?void 0:t.match(/( |^)agent/))?"agent":(null==t?void 0:t.match(/( |^)(corporate|education|employee|partner)/))?"site_license":"individual"},s=l(e);if(1>=o.length)return s;const r=o.slice(1).map(e=>l(e)),d="individual"===s,c="shared"===s,u=r.includes("agent"),p=r.includes("site_license");return(d||c)&&u&&p?(d?"individual":"shared")+"|site_license|agent":(d||c)&&p&&!u?(d?"individual":"shared")+"|site_license":(d||c)&&u&&!p?(d?"individual":"shared")+"|agent":"site_license"===s&&u?"site_license|agent":(t()&&console.log(n,`User might have duplicate resources. userId: ${null===(a=null===(i=null==e?void 0:e.user_access)||void 0===i?void 0:i.user)||void 0===a?void 0:a.uid} accountType: ${s}`),s)})(s[0],s),c=e=>e&&("email_domain_contract"===(null==e?void 0:e.type)||"specific_email_addresses_contract"===(null==e?void 0:e.type)),u=Array.from(new Set(s.map(e=>{var o;return null===(o=null==e?void 0:e.term)||void 0===o?void 0:o.resource.name}))).join("|")||void 0,p=Array.from(new Set(s.map(e=>{var o;return null===(o=null==e?void 0:e.term)||void 0===o?void 0:o.name}))).join("|")||void 0,w=Array.from(new Set(s.map(e=>(null==e?void 0:e.user_access)||(null==e?void 0:e.term)?((e={})=>{const o=null==e?void 0:e.user_access,n=null==e?void 0:e.term,t=null==n?void 0:n.resource;return(null==t?void 0:t.name)&&""!==t.name?(null==o?void 0:o.granted)&&(/registration/i.exec(null==n?void 0:n.name)||"registration"===(null==n?void 0:n.type))?"REGISTERED":(null==o?void 0:o.granted)?"SUBSCRIBER":void 0:"KNOWN"})(e):void 0))).sort((e,o)=>e.localeCompare(o)).join("|")||void 0,m=[];for(const e of s)(null===(i=null==e?void 0:e.term)||void 0===i?void 0:i.term_id)&&c(null==e?void 0:e.term)&&m.push(yield window.pmcPiano.api.getLicenseeData(e.term.term_id));const v=Array.from(new Set(m.map(e=>null==e?void 0:e.id))).join("|")||void 0,g=Array.from(new Set(m.map(e=>null==e?void 0:e.name))).join("|")||void 0;return{accessGrantedStatus:null!==(l=null===(a=s[0])||void 0===a?void 0:a.user_access.granted)&&void 0!==l&&l,accountTermType:d,resourceName:u,termName:p,orgId:v,orgName:g,userType:w}})},setDataForAuthUser:function(){return p(this,void 0,void 0,function*(){const e=this,o=window.tp.pianoId.getUser(),n=e.hasReportingCookie();if((null==n?void 0:n.acct_id)===o.uid)return Promise.resolve();const t=yield this.getDataForAuthUser(),i={acct_id:o.uid,acct_type:t.accountTermType,entitlements:t.resourceName,paywall_logged_in:t.accessGrantedStatus,user_type:t.userType,org_id:t.orgId||null,org_name:t.orgName||null};return this.reporting=Object.assign(Object.assign({},e.reporting),i),yield e.set(JSON.stringify(this.reporting)),Promise.resolve()})},hasReportingCookie:function(){try{return JSON.parse(window.pmc.cookie.get("pmc_piano_reporting")||null)}catch(e){return t()&&console.log(n,"No reporting cookie",e.toString()),!1}},tld:function(){return new URL(window.location.href).hostname.split(/\./).slice(-2).join(".")}},wordPressThemes:{targetElements:{subscriptionFlyout:".a-subscription-banner"},hookIntoPmcPiano:function(){var e,o,n,t;const i=this;null===(o=null===(e=window.pmcPiano)||void 0===e?void 0:e.callbacks)||void 0===o||o.onInit({knownUser:()=>{i.setAuthenticatedUserId(),i.maybeRenderMyAccountPage(),i.maybeRenderPasswordResetPage()},unknownUser:()=>{i.maybeRenderMyAccountPage(),i.maybeRenderPasswordResetPage()}}).onLogin(()=>{i.setAuthenticatedUserId(),i.maybeRenderMyAccountPage(),i.maybeRenderPasswordResetPage()}).onLogout(i.maybeRenderMyAccountPage.bind(i)).onRegistration(i.onRegistration.bind(i)),null===(n=window.tp)||void 0===n||n.push(["addHandler","checkoutComplete",function(){/reader_id=amp/gi.exec(window.location.search)&&window.close()}]),null===(t=window.tp)||void 0===t||t.push(["addHandler","externalCheckoutComplete",function(){location.reload()}]),window.addEventListener("message",i.reloadOfferModal.bind(i)),window.addEventListener("message",i.registerPostMessageListener.bind(i)),document.addEventListener("keydown",function(e){"Escape"===e.key&&i.closePianoModal()}),i.clickShield.set()},closePianoModal:function(){const e=document.querySelector(".tp-modal:last-child")||document.querySelector(".tp-modal"),o=null==e?void 0:e.querySelector(".tp-close");e&&o&&o.click()},registerPostMessageListener:function(e){const o=window.pmcPiano.wordPressThemes;if(!a(e)||"string"!=typeof e.type)return!1;switch(e.data.type){case"piano_subscription_flyout_focus_change":const n=e.data.focused,t=document.querySelector(o.targetElements.subscriptionFlyout);n?null==t||t.classList.remove("lrv-a-hidden"):null==t||t.classList.add("lrv-a-hidden");break;case"piano_mode_close":this.closePianoModal()}},maybeRenderMyAccountPage:function(){const e=()=>{const e=".js-subscription-my-account-component";document.querySelector(e)&&(window.tp.myaccount.show({displayMode:"inline",containerSelector:e}),console.log(n,"Rendered My Account component"))};"complete"!==document.readyState?window.addEventListener("load",e):e()},maybeRenderPasswordResetPage:function(){if(!document.querySelector(".js-subscription-password-reset-component"))return"password reset element missing";const e=window.location.search.match(/reset_token=([A-Za-z0-9]+)/);if(!e)return"invalid token";window.addEventListener("message",this.redirectHomeOnClosedMessage.bind(this)),window.tp.pianoId.show({resetPasswordToken:e[1],loggedIn:function(){window.location="/"}})},onRegistration:()=>{let e=!1;window.tp.push(["addHandler","checkoutClose",function(){e||(e=!0,window.pmcPiano.piano.reRenderExperiences())}])},redirectHomeOnClosedMessage:function(e){if(!a(e))return!1;let o;try{o=JSON.parse(e.data)}catch(e){return!1}return!!(o.sender&&o.event&&o.sender.startsWith("piano-id")&&"closed"===o.event)&&(window.location="/",!0)},setAuthenticatedUserId:function(){const e=window.tp.pianoId.getUser(),o=window.blogherads||{};t()&&console.log(n,"wordPressThemes.setAuthenticatedUserId",e.uid),o.adq=o.adq||[],o.adq.push(function(){try{o.setAuthenticatedUserId(e.uid,"piano")}catch(e){}})},registerStickyFooter:e=>{var o,n;const t=window.pmcPiano.wordPressThemes;null===(n=null===(o=window.pmcPiano)||void 0===o?void 0:o.callbacks)||void 0===n||n.onInit({unknownUser:(()=>{const o=document.querySelector(e.className||".js-subscription-sticky-footer");if(!o)return;const n=document.getElementsByClassName(e.targetClassName||"footer"),i=()=>{const e=()=>{const e=window.scrollY,t=window.innerHeight,i=n[0].offsetTop;return e+t+("static"===o.style.position?o.clientHeight:0)>i};setTimeout(function(){this.stickyFooterPrevTime=this.stickyFooterPrevTime||Date.now(),this.stickyFooterPrevTime&&500>Date.now()-this.stickyFooterPrevTime||(this.stickyFooterPrevTime=Date.now(),e()||"fixed"===o.style.position?e()&&"static"!==o.style.position&&(o.style.position="static"):(o.style.position="fixed",o.style.bottom="0px"))}.bind(t),500)};i(),window.addEventListener("load",i),window.addEventListener("scroll",i),window.addEventListener("resize",i)}).bind(t)})},reloadOfferModal:function(e){var o,n,t,i,l;if(!a(e)||!(null===(n=null===(o=window.location)||void 0===o?void 0:o.pathname)||void 0===n?void 0:n.match(/^\/subscribe/))||!(null===(i=null===(t=window.location)||void 0===t?void 0:t.search)||void 0===i?void 0:i.match(/contractId=/)))return!1;let s;try{s=JSON.parse(e.data)}catch(e){return!1}return!(!(null===(l=null==s?void 0:s.sender)||void 0===l?void 0:l.startsWith("piano-id"))||"closed"!==(null==s?void 0:s.event)||window.tp.pianoId.isUserValid()||(window.tp.offer.reloadAll(),0))},clickShieldEnabled:!0,clickShield:{targetClassname:"piano-click-shield-content",shieldClassname:"piano-click-shield",execute:function(){const e=window.pmcPiano.wordPressThemes,o=e.clickShield;if(!e.clickShieldEnabled)return;const i=o.targetClassname,a=o.shieldClassname,l=document.querySelectorAll(`.${i}`);if((null==l?void 0:l.length)||!(0>=l.length))for(const[e,o]of Array.from(l).entries()){const l=o;if(l.querySelector(`.${a}`)){t()&&console.log(n,`Element ${e} with class '${i}' already has an overlay, skipping`);continue}t()&&console.log(n,`Processing overlay for element ${e} with class '${i}':`,l),l.style.position="relative";const s=document.createElement("div");s.classList.add(a),s.style.position="absolute",s.style.top="0",s.style.left="0",s.style.width="100%",s.style.height="100%",s.style.backgroundColor="transparent",s.style.cursor="not-allowed",l.appendChild(s)}},dismiss:function(){const e=window.pmcPiano.wordPressThemes,o=e.clickShield,n=o.targetClassname,t=o.shieldClassname;e.clickShieldEnabled=!1;const i=document.querySelectorAll(`.${t}`);if((null==i?void 0:i.length)||!(0>=i.length))for(const e of Array.from(i)){const o=e.closest(`.${n}`);o&&o.removeChild(e)}},set:function(){const e=window.pmcPiano.wordPressThemes.clickShield,o=()=>{const o=new MutationObserver(e.execute.bind(e)),n=new ResizeObserver(e.execute.bind(e));o.observe(document.body,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["class"]}),n.observe(document.body)};document.body&&o(),t()&&(console.log(n,"DOM not yet ready, waiting to subscribe to mutations"),document.addEventListener("DOMContentLoaded",o))}}},newsletterForm:{initialized:!1,setDataForNewsletter:!1,targetElements:{paywall:".pmc-paywall",paywallFade:"a-article-nl-fade",overlay:"div[id=piano-paywall] .tp-container-inner"},enablePaywallFade:!0,signupURLs:{aia:"https://cloud.email.artnews.com/aia-api/",artforum:"https://cloud.email.artforum.com/api/",artnews:"https://cloud.email.artnews.com/artnews-api/",billboard:"https://cloud.email.billboard.com/api/",deadline:"https://cloud.email.deadline.com/api/",goldderby:"https://cloud.email.goldderby.com/api",robbreport:"https://cloud.email.robbreport.com/api/",rollingstone:"https://cloud.email.rollingstone.com/signup-api/",sourcingjournal:"https://cloud.email.sourcingjournal.com/api/",sportico:"https://cloud.email.sportico.com/api/",thr:"https://cloud.email.hollywoodreporter.com/api/",variety:"https://cloud.email.variety.com/api/",wwd:"https://cloud.email.wwd.com/api/"},modal:!0,emailInputFocused:!1,prepareExactTargetFormData:e=>{const o=Object.assign({__contextName:["aia","artnews","deadline"].includes(m)?"FormPost":"NewsletterFormPost",__executionContext:"Post"},e.data.formData),n=new FormData;for(const[e,t]of Object.entries(o))n.append(e,t);return n},sendSignupDataToExactTarget:e=>{const o=window.pmcPiano.newsletterForm,i=o.signupURLs[m];i||console.error(n,"Invaild brand for newsletter form submission",{brand:m,signupURLs:o.signupURLs}),fetch(i,{method:"POST",mode:"no-cors",body:e}).then(e=>{t()&&console.log(n,"POST request to ExactTarget successful:",e)}).catch(e=>{console.error(n,"Error sending formData to ExtactTarget:",e)})},calculateTopOffset:()=>{var e,o,n,t,i,a,l,s,r;const d=(null===(e=document.querySelector("header"))||void 0===e?void 0:e.offsetHeight)||0,c=(null===(o=document.querySelector(".js-Header-contents"))||void 0===o?void 0:o.offsetHeight)||0;let u=Math.min(Math.max(d,c)+20,100);const p=(null===(n=document.querySelector('[data-component="header-sticky"]'))||void 0===n?void 0:n.offsetHeight)||0,w=(null===(t=document.querySelector('[data-component="header-mobile"]'))||void 0===t?void 0:t.offsetHeight)||0;(w||p)&&(u=p>0?p+20:w+45),u=(null===(a=null===(i=null===window||void 0===window?void 0:window.pmc)||void 0===i?void 0:i.hooks)||void 0===a?void 0:a.apply_filters("pmc_piano_regwall_header_height",u,{header:d,headerInnerWrapper:c}))||u;const m=null===(l=document.querySelector("#pmc-gallery-list-nav-bar-container"))||void 0===l?void 0:l.offsetHeight,v=null===(s=document.querySelector(".pmc-paywall > .jw-state-playing"))||void 0===s?void 0:s.offsetHeight,g=null===(r=document.querySelector(".live-event-banner > .banner-regular"))||void 0===r?void 0:r.offsetHeight;if(window.innerWidth<768){if(m>0)return u+m-10;if(v>0)return u+v;if(g>0)return u+g}return u},stickyDismissableRegwall:()=>{const e=window.pmcPiano.newsletterForm,o=document.querySelector(e.targetElements.paywall),n=document.querySelector(`${e.targetElements.overlay} iframe`);if(!o||!n)return void setTimeout(e.stickyDismissableRegwall);!0===e.enablePaywallFade&&o.classList.add(e.targetElements.paywallFade);const t=()=>{var n;const t=document.querySelector(e.targetElements.overlay),i=null==t?void 0:t.getBoundingClientRect(),a=o.getBoundingClientRect(),l=document.querySelector("#piano-paywall"),s=null==l?void 0:l.getBoundingClientRect(),r=e.calculateTopOffset();t.style.position="absolute",t.style.top="0px",t.style.zIndex=window.pmcPianoData.isNovaTheme?"10000":"1000",0>=s.top-i.height/2?t.style.position="static":a.top<=r&&(t.style.position="fixed",t.style.top=`${r}px`);const d=null===(n=null==t?void 0:t.parentElement)||void 0===n?void 0:n.parentElement;d&&"relative"!==getComputedStyle(d).position&&(d.style.position="relative")};window.addEventListener("scroll",()=>{t()}),setTimeout(t,100)},registerPostMessageListener:()=>{const e=window.pmcPiano.newsletterForm;window.addEventListener("message",o=>{var i,l;if(a(o)&&"string"==typeof o.type)switch(o.data.type){case"piano_template_newsletter_close_button_clicked":e.enablePaywallFade&&(null===(i=document.querySelector(e.targetElements.paywall))||void 0===i||i.classList.remove(e.targetElements.paywallFade));const a=document.querySelector(e.targetElements.overlay);a&&(window.pmcPianoData.isNovaTheme?a.style.display="none":a.classList.add("lrv-a-hidden"));const s=document.querySelector("#piano-paywall");s&&(s.style.background="transparent"),null===(l=window.pmcPiano.wordPressThemes.clickShield)||void 0===l||l.dismiss();break;case"piano_template_newsletter_email_input":e.emailInputFocused=o.data.focused,window.dispatchEvent(new Event("scroll",{bubbles:!0}));break;case"piano_template_newsletter_submit_button_clicked":m=o.data.brand,w=e.prepareExactTargetFormData(o),e.sendSignupDataToExactTarget(w);break;case"piano_regwall_register_button_clicked":m=o.data.brand,w=e.prepareExactTargetFormData(o),e.setDataForNewsletter=!0,t()&&console.log(n,"Data Stored for Registration",w)}})},registrationSuccess:function(e){const o=e.user.email;o&&this.setDataForNewsletter&&(this.setDataForNewsletter=!1,t()&&console.log(n,"Registration success",e),w.set("EmailAddress",o),setTimeout(this.sendSignupDataToExactTarget(w),1e3))},initialize:()=>{const e=window.pmcPiano.newsletterForm;e.initialized?t()&&console.log(n,"Newsletter Form is already initialized"):(t()&&console.log(n,"Initializing Newsletter Form"),e.modal&&e.stickyDismissableRegwall(),e.registerPostMessageListener(),window.pmcPiano.callbacks.onRegistration(e.registrationSuccess.bind(e)),e.initialized=!0)}}};window.tp=window.tp||[],v.piano.prime(),v.piano.loadSDK(),window.tp.push(["init",()=>{const e=window.pmcPiano;t()&&console.log(n,"PMC: Piano: Initializing Piano"),e.piano.setCallbacks(),e.reportingCookie.initialize(),e.wordPressThemes.hookIntoPmcPiano()}]);var g=window;for(var h in o)g[h]=o[h];o.__esModule&&Object.defineProperty(g,"__esModule",{value:!0})})();