(()=>{"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 s=function(e,o,n,t){return new(n||(n=Promise))(function(i,a){function s(e){try{l(t.next(e))}catch(e){a(e)}}function r(e){try{l(t.throw(e))}catch(e){a(e)}}function l(e){var o;e.done?i(e.value):(o=e.value,o instanceof n?o:new n(function(e){e(o)})).then(s,r)}l((t=t.apply(e,o||[])).next())})};const r={callApi:(e,...o)=>s(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 s(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=>s(void 0,void 0,void 0,function*(){return yield r.callProtectedApi(`/licensee/${e}`)}),getUserCustomFields:e=>s(void 0,void 0,void 0,function*(){return yield r.callProtectedApi(`/user/custom-fields/${e}`)}),getAccessList:()=>s(void 0,void 0,void 0,function*(){return yield r.callApi("/access/list").then(({data:e})=>e)}),getConversionList:()=>s(void 0,void 0,void 0,function*(){return yield r.callApi("/conversion/list").then(({conversions:e})=>e)})},l=(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 s(e){try{l(t.next(e))}catch(e){a(e)}}function r(e){try{l(t.throw(e))}catch(e){a(e)}}function l(e){var o;e.done?i(e.value):(o=e.value,o instanceof n?o:new n(function(e){e(o)})).then(s,r)}l((t=t.apply(e,o||[])).next())})};let w,m="";const v={api:r,callbacks:{onInit:e=>(window.tp=window.tp||[],window.tp.push(["init",l.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,s,r,l,d,c,u;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.cxSiteId)&&(t()&&console.log(n,"tp.push: [setCxenseSiteID="+window.pmcPianoData.cxSiteId+"]"),window.tp.push(["setCxenseSiteId",window.pmcPianoData.cxSiteId])),window.tp.push(["setSandbox",!!(null===(a=window.pmcPianoData)||void 0===a?void 0:a.isSandboxMode)]),window.tp.push(["setDebug",t()]),window.tp.push(["setUsePianoIdUserProvider",!0]),Object.entries(null!==(r=null===(s=window.pmcPianoData)||void 0===s?void 0:s.customVariables)&&void 0!==r?r:{}).forEach(([e,o])=>{t()&&console.log(n,"tp.push: [setCustomVariable, "+e+"="+o+"]"),window.tp.push(["setCustomVariable",e,o])});const p=window.pmc.tracking.get_properties();if(window.tp.push(["setPageURL",window.location.href]),p.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===(l=window.pmcPianoData)||void 0===l?void 0:l.author){const e=[].concat(window.pmcPianoData.author).join(",");t()&&console.log(n,"tp.push: [setContentAuthor="+e+"]"),window.tp.push(["setContentAuthor",e])}(null===(d=window.pmcPianoData)||void 0===d?void 0:d.tags)&&0<(null===(c=window.pmcPianoData.tags)||void 0===c?void 0:c.length)&&(t()&&console.log(n,"tp.push: [setTags=]",window.pmcPianoData.tags),window.tp.push(["setTags",null!==(u=window.pmcPianoData.tags)&&void 0!==u?u:[]])),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),{}}})(),s=encodeURIComponent(null!==(i=null!==(o=e.params.trackingId)&&void 0!==o?o:a.trackingId)&&void 0!==i?i:""),r=`${e.params.url}${e.params.url.includes("?")?"&":"?"}_ptid=${s}`;t()&&console.log(n,"custom event template-redirect",e,a,s,r),window.location.href=r}}])},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 s=null===(e=window.tp.pianoId.getUser())||void 0===e?void 0:e.uid,r=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(!r)return void console.error(n,"GA4 measurement_id is undefined.",window.pmcPianoData);const l={send_page_view:!1,page_location:document.URL,page_title:document.title};s&&(l.user_id=s),window.tp.setGA4Config({measurementId:r,eventParameters:l}),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 s(e){try{l(i.next(e))}catch(e){a(e)}}function r(e){try{l(i.throw(e))}catch(e){a(e)}}function l(o){var n;o.done?e(o.value):(n=o.value,n instanceof t?n:new t(function(e){e(n)})).then(s,r)}l((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,s;let r=null!==(e=yield window.pmcPiano.api.getConversionList())&&void 0!==e?e:[];const l=null!==(o=r.sort((e,o)=>o.create_date-e.create_date)[0])&&void 0!==o?o:void 0;r=r.filter(e=>{var o;return null===(o=null==e?void 0:e.user_access)||void 0===o?void 0:o.granted}),r=0>=r.length?[l]:(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 s=0;for(;s{var i,a;const s=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"},r=s(e);if(1>=o.length)return r;const l=o.slice(1).map(e=>s(e)),d="individual"===r,c="shared"===r,u=l.includes("agent"),p=l.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"===r&&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: ${r}`),r)})(r[0],r),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(r.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(r.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(r.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 r)(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!==(s=null===(a=r[0])||void 0===a?void 0:a.user_access.granted)&&void 0!==s&&s,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,s;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 r;try{r=JSON.parse(e.data)}catch(e){return!1}return!(!(null===(s=null==r?void 0:r.sender)||void 0===s?void 0:s.startsWith("piano-id"))||"closed"!==(null==r?void 0:r.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,s=document.querySelectorAll(`.${i}`);if((null==s?void 0:s.length)||!(0>=s.length))for(const[e,o]of Array.from(s).entries()){const s=o;if(s.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}':`,s),s.style.position="relative";const r=document.createElement("div");r.classList.add(a),r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.width="100%",r.style.height="100%",r.style.backgroundColor="transparent",r.style.cursor="not-allowed",s.appendChild(r)}},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/",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,s,r,l;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===(s=document.querySelector("#pmc-gallery-list-nav-bar-container"))||void 0===s?void 0:s.offsetHeight,v=null===(r=document.querySelector(".pmc-paywall > .jw-state-playing"))||void 0===r?void 0:r.offsetHeight,g=null===(l=document.querySelector(".live-event-banner > .banner-regular"))||void 0===l?void 0:l.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(),s=document.querySelector("#piano-paywall"),r=null==s?void 0:s.getBoundingClientRect(),l=e.calculateTopOffset();t.style.position="absolute",t.style.top="0px",t.style.zIndex=window.pmcPianoData.isNovaTheme?"10000":"1000",0>=r.top-i.height/2?t.style.position="static":a.top<=l&&(t.style.position="fixed",t.style.top=`${l}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,s;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 r=document.querySelector("#piano-paywall");r&&(r.style.background="transparent"),null===(s=window.pmcPiano.wordPressThemes.clickShield)||void 0===s||s.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})})();