(()=>{var t={14:(t,e,i)=>{"use strict";i.d(e,{Z:()=>u});var n=i(191),o=i.n(n),s=i(261),d=i.n(s),r=i(160),a=i.n(r),l=new URL(i(240),i.b),c=d()(o()),h=a()(l);c.push([t.id,`.wordads-ad-wrapper {\n position: static;\n font: 11px Arial, sans-serif;\n letter-spacing: 1px;\n text-decoration: none;\n max-width: 100%;\n margin: 25px auto;\n padding: 0;\n display: flex;\n justify-content: center;\n}\n\n.wordads-ad-wrapper--sidebar,\n.wordads-ad-wrapper--gutenberg_skyscraper,\n.wordads-ad-wrapper--gutenberg_mobile_leaderboard {\n font-size: 8px;\n}\n\n.wordads-ad-title {\n margin: 0 auto 5px\n}\n\n.wordads-ad-controls {\n margin: 5px auto 0;\n text-align: right\n}\n\n/* Hide title and controls initially */\n.wordads-ad-title,\n.wordads-ad-controls {\n visibility: hidden;\n}\n\n.wordads-ad-controls span {\n cursor: pointer\n}\n\n.wordads-ad {\n margin: 0 auto;\n width: fit-content;\n max-width: 100%;\n overflow: hidden;\n}\n\n.wordads-ad iframe {\n margin: 0;\n padding: 0\n}\n\n.wordads-ad.wordads-ad-responsive {\n width: 100%;\n max-width: unset\n}\n\n.wordads-ad-sticky-wrapper {\n display: flex;\n align-items: center;\n justify-content: center;\n margin: auto;\n position: fixed;\n transition: transform .2s ease-in-out;\n user-select: none;\n padding: 5px 0;\n z-index: 49999\n}\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-sticky-wrapper {\n right: 0;\n left: 0;\n bottom: 0;\n background: transparent;\n transform: translate(0, 0);\n}\n\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-sticky-wrapper.ad-slot-filled {\n background: #f1f1f1;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right.wordads-ad-sticky-wrapper {\n width: fit-content;\n min-width: 120px;\n top: max(calc(var(--wp-admin--admin-bar--height, 0px) + 24px), 10%);\n right: 20px;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right .wordads-ad-content {\n border: 1px solid #f1f1f1;\n margin-left: -1px;\n}\n\n.wordads-ad-sticky-close-btn {\n width: 28px;\n height: 28px;\n position: absolute;\n box-sizing: content-box;\n cursor: pointer;\n overflow: hidden;\n background-size: 28px;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(${h})\n}\n\n.wordads-ad-wrapper--bottom_sticky .wordads-ad-sticky-close-btn {\n top: -14px;\n left: .75rem;\n}\n\n.wordads-ad-wrapper--sidebar_sticky_right .wordads-ad-sticky-close-btn {\n top: -14px;\n right: 0;\n}\n\n.wordads-ad-sticky {\n width: auto;\n max-width: initial;\n max-height: inherit;\n}\n\n.wordads-ad-sticky .wordads-ad-title,\n.wordads-ad-sticky .wordads-ad-controls {\n color: #333\n}\n\n.wordads-ad-hidden {\n\tvisibility: hidden !important;\n\tposition: absolute !important;\n\tpointer-events: none !important;\n\twidth: 0 !important;\n\theight: 0 !important;\n\toverflow: hidden !important;\n\tclip: rect(0 0 0 0) !important;\n}\n\n.wordads-ad-wrapper--bottom_sticky.wordads-ad-hidden {\n transform: translate(0, 1000px);\n}\n\n.google-auto-placed {\n height: 0px !important;\n}\n\nins.adsbygoogle::before,\nins.adsbygoogle::after {\n visibility: hidden !important;\n}\n\nins.adsbygoogle {\n background: transparent;\n padding: 0 !important;\n}`,""]);const u=c},261:t=>{"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",n=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),n&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),n&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,n,o,s){"string"==typeof t&&(t=[[null,t,void 0]]);var d={};if(n)for(var r=0;r0?" ".concat(c[5]):""," {").concat(c[1],"}")),c[5]=s),i&&(c[2]?(c[1]="@media ".concat(c[2]," {").concat(c[1],"}"),c[2]=i):c[2]=i),o&&(c[4]?(c[1]="@supports (".concat(c[4],") {").concat(c[1],"}"),c[4]=o):c[4]="".concat(o)),e.push(c))}},e}},160:t=>{"use strict";t.exports=function(t,e){return e||(e={}),t?(t=String(t.__esModule?t.default:t),/^['"].*['"]$/.test(t)&&(t=t.slice(1,-1)),e.hash&&(t+=e.hash),/["'() \t\n]|(%20)/.test(t)||e.needQuotes?'"'.concat(t.replace(/"/g,'\\"').replace(/\n/g,"\\n"),'"'):t):t}},191:t=>{"use strict";t.exports=function(t){return t[1]}},546:function(t){t.exports=function(){"use strict";function t(t){for(var e=1;e{"use strict";i.r(e),i.d(e,{default:()=>w});var n=i(157),o=i.n(n),s=i(869),d=i.n(s),r=i(318),a=i.n(r),l=i(825),c=i.n(l),h=i(597),u=i.n(h),g=i(770),p=i.n(g),m=i(14),f={};f.styleTagTransform=p(),f.setAttributes=c(),f.insert=a().bind(null,"head"),f.domAPI=d(),f.insertStyleElement=u(),o()(m.Z,f);const w=m.Z&&m.Z.locals?m.Z.locals:void 0},157:t=>{"use strict";var e=[];function i(t){for(var i=-1,n=0;n{"use strict";var e={};t.exports=function(t,i){var n=function(t){if(void 0===e[t]){var i=document.querySelector(t);if(window.HTMLIFrameElement&&i instanceof window.HTMLIFrameElement)try{i=i.contentDocument.head}catch(t){i=null}e[t]=i}return e[t]}(t);if(!n)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");n.appendChild(i)}},597:t=>{"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},825:(t,e,i)=>{"use strict";t.exports=function(t){var e=i.nc;e&&t.setAttribute("nonce",e)}},869:t=>{"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(i){!function(t,e,i){var n="";i.supports&&(n+="@supports (".concat(i.supports,") {")),i.media&&(n+="@media ".concat(i.media," {"));var o=void 0!==i.layer;o&&(n+="@layer".concat(i.layer.length>0?" ".concat(i.layer):""," {")),n+=i.css,o&&(n+="}"),i.media&&(n+="}"),i.supports&&(n+="}");var s=i.sourceMap;s&&"undefined"!=typeof btoa&&(n+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(s))))," */")),e.styleTagTransform(n,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},770:t=>{"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},858:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=i(639),s=n(i(539)),d=i(444),r=i(501);class a extends s.default{constructor(t,e){super(t,e),this.config={},this.adSenseLibraryLoaded=!1,this.adFlowUrl="https://af.pubmine.com?api_version=2"}insertAdBefore(t,e,i){if(!this.shouldShowInlineAds())return;this.log(`Inserting ad before element: ${t.id} of type: ${e}`);const n=this.getRandomTagId(),o=this.createAdSnippet(n,i),s=this.wrapSnippet(o,e);t.insertAdjacentElement("beforebegin",s),this.slots.push({tagId:n,type:e,sizes:i,element:s,isLazy:!0}),this.trackStat("render_inline")}getAdFlowRequestBody(t){const{maxHeight:e,maxWidth:i}=(0,d.getMaxSlotDimension)(t.sizes),n={site:{id:String(this.config.blog_id),is_wordads:this.config.is_wordads,page:window.location.href,language:this.config.blog_language},ad:{tag:t.tagId,format:t.type,max_width:i,max_height:e},user:{uid:this.consent.getOrCreateUID(),gdpr:!1}};return this.consent.usPrivacy&&(n.user.us_privacy=this.consent.usPrivacy),this.consent.tcData&&(n.user.gdpr=!0,n.user.gdpr_consent=this.consent.tcData.tcString),n}shouldShowInlineAds(){var t,e;if(!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.inline)){const t=document.getElementsByTagName("body")[0];(t.classList.contains("single-post")||t.classList.contains("wp-singular"))&&(this.config.enabled_formats||(this.config.enabled_formats={}),this.config.enabled_formats.inline=!0)}return!!(null===(e=this.config.enabled_formats)||void 0===e?void 0:e.inline)}getMaxSlots(){return r.MAX_INLINE_SLOTS}getMaxBlazeSlots(){return r.MAX_INLINE_BLAZE_SLOTS}shouldShowBottomStickyAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.bottom_sticky)}shouldShowSidebarStickyRightAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.sidebar_sticky_right)}shouldShowTopAds(){var t;return!!(null===(t=this.config.enabled_formats)||void 0===t?void 0:t.top)}isSlotTypeEnabled(t){var e;return!!(null===(e=this.config)||void 0===e?void 0:e.formats.includes(t))}getSlotFormatId(t){}getBottomStickySlots(){return(0,r.getSortedSlotSizes)(o.SlotType.BOTTOM_STICKY)}convertFormatsToObject(t){return t.reduce(((t,e)=>(t[e]=!0,t)),{})}initAdNetwork(){this.initDynamicAdSlots(),this.initAditude()}mergeConfig(){var t;window.isWatlV1=!1;const e=this.getServerConfig();e&&(this.config=this.deepMerge(e,this.config)),this.config.enabled_formats=this.convertFormatsToObject(this.config.formats),this.log("Merged config:"),this.log(null!==(t=this.config)&&void 0!==t?t:{})}handleAdResponse(t,e){const i=!!this.config.afp_account_id,n=t.content.indexOf("window.tude")>-1;if(!(t.content.indexOf("var sas = sas")>-1)&&n&&this.forceAfpAds&&i)return void this.renderGoogleAfpAd(e.tagId);const o=!!(null==t?void 0:t.content),s=!!(null==t?void 0:t.pixel);if(o){const e=document.createElement("script");e.type="application/javascript",e.innerHTML=t.content,document.body.appendChild(e)}if(s){const e=new XMLHttpRequest;e.open("GET",t.pixel),e.send()}this.trackAdFlowRequestLatency(o,e.tagId,e.type)}tryUsingIponwebSlots(){var t;window.__ATA=window.__ATA||{cmd:[]},window.__ATA.cmd=window.__ATA.cmd||[];const e=this;window.__ATA.initSlot=function(t,i){var n;const s=document.getElementById(t);if(s&&(0===s.children.length||"SCRIPT"===(null===(n=s.children[0])||void 0===n?void 0:n.tagName))){const n=(0,r.getFormatBySizes)(i.width,i.height);if(!n)return;const d=s.getBoundingClientRect();d.width=300&&o<970&&window.__ATA.initSlot(t.id,{width:300,height:250})}},window.__ATA.initVideoSlot=function(t){window.__ATA.initDynamicSlot({id:t})};const i=null!==(t=window.__ATA.cmd.push)&&void 0!==t?t:()=>{};for(const t of window.__ATA.cmd)"function"==typeof t&&t!==i&&t()}initDynamicAdSlots(){var t,e,i,n,s,d;this.log("Initializing Gutenberg ad slots"),window.tudeMappings=window.tudeMappings||[],this.tryUsingIponwebSlots();for(const a of window.tudeMappings){(null==a?void 0:a.width)&&(null==a?void 0:a.height)||([a.width,a.height]=null!==(t=(0,r.getFilteredSlotSizesByWidthAndHeight)(a.format,728,250)[0])&&void 0!==t?t:[300,250]);const{divId:l,format:c,width:h,height:u}=a,g=document.getElementById(l);if(g){if((null===(i=null===(e=null==g?void 0:g.parentElement)||void 0===e?void 0:e.parentElement)||void 0===i?void 0:i.classList.contains("inline"))&&(null===(s=null===(n=g.parentElement.parentElement)||void 0===n?void 0:n.parentElement)||void 0===s?void 0:s.classList.contains("wpa"))&&(null===(d=g.parentElement.parentElement.parentElement.parentElement)||void 0===d?void 0:d.classList.contains("wpcnt"))){const t=g.getBoundingClientRect();t.width{if(window.tude&&"function"==typeof window.tude.setPageTargeting){const t={param1:String(this.config.blog_id),param2:String(this.config.is_wordads),param3:String(this.config.hosting_type),param4:this.config.theme};window.tude.setPageTargeting(t),this.log("Aditude debug: custom dimensions set "+JSON.stringify(t))}})),window.tude.cmd.push((()=>{window.tude.events.addEventListener("tude_ad_filled",(t=>{this.log("aditude debug event: tude_ad_filled "+JSON.stringify(t)),this.handleAd({tagId:t.detail.id,adNetwork:"Aditude"})})),window.tude.events.addEventListener("tude_ad_unfilled",(t=>{this.log(`Aditude debug event: tude_ad_unfilled (${t.detail.id})`),this.handleNoAd({tagId:t.detail.id,adNetwork:"Aditude"})})),window.tude.events.addEventListener("tude_no_ad_sizes",(t=>{this.log(`Aditude debug event: tude_no_ad_sizes ${t.detail.id}`),this.handleNoAd({tagId:t.detail.id,adNetwork:"Aditude"})}))}))}getLibrariesToFetch(){return{prebid:{loaded:!1,url:"https://dn0qt3r0xannq.cloudfront.net/wordpress-2Pvwql52OT/wordpress-longform/prebid-load.js",isInitialized:()=>void 0!==window.tude,init:()=>{window.tude=window.tude||{cmd:[]}}}}}getServerConfig(){const t=super.getServerConfig();if(void 0!==window.wa_smart&&!0===window.isWatlV1){let[,e]=window.wa_smart.target.split(";");e=e.replace("language=","").split("_")[0];const i=[];for(const t of Object.values(o.SlotType)){const e=window.wa_smart[t];(null==e?void 0:e.enabled)&&i.push(t)}return Object.assign(Object.assign({},t),{blog_language:e,hosting_type:2,theme:window.wa_smart.theme,formats:i})}return t}setAdContainerVisibility(t,e){var i,n,s,d,r,a,l,c,h,u,g;const p=this.slots.find((e=>e.tagId===t));if(!p)return void this.log(`Ad container not found: ${t}`);const m=[o.SlotType.GUTENBERG_LEADERBOARD,o.SlotType.GUTENBERG_RECTANGLE,o.SlotType.GUTENBERG_MOBILE_LEADERBOARD,o.SlotType.GUTENBERG_SKYSCRAPER].includes(p.type);let f=null;if(m&&!(null===(i=window.iponwebTags)||void 0===i?void 0:i.includes(t))){const e=(null===(r=null===(d=null===(s=null===(n=p.element)||void 0===n?void 0:n.parentElement)||void 0===s?void 0:s.parentElement)||void 0===d?void 0:d.parentElement)||void 0===r?void 0:r.parentElement)||null;f=null!==e&&e.classList.contains("wpcnt")?e:null===(l=null===(a=document.getElementById(t))||void 0===a?void 0:a.parentElement)||void 0===l?void 0:l.parentElement}else f=m&&(null===(c=window.iponwebTags)||void 0===c?void 0:c.includes(t))?null===(h=p.element.parentElement)||void 0===h?void 0:h.parentElement:p.element;if(null===(u=p.element.parentElement)||void 0===u||u.querySelectorAll(".wordads-ad-title, .wordads-ad-controls").forEach((t=>{t instanceof HTMLElement&&(t.style.visibility=e?"visible":"hidden")})),f){if(f.classList.toggle("wordads-ad-hidden",!e),!e){const e=document.getElementById(t),i=null===(g=null==e?void 0:e.parentElement)||void 0===g?void 0:g.parentElement;i&&(null==i?void 0:i.classList.contains("ad-slot-filled"))&&i.classList.remove("ad-slot-filled")}}else this.log(`Ad container element not found: ${t}`)}showAdContainer(t){this.setAdContainerVisibility(t,!0)}hideAdContainer(t){this.setAdContainerVisibility(t,!1)}handleAd(t){super.handleAd(t),this.showAdContainer(t.tagId)}handleNoAd(t){this.config.afp_account_id?this.renderGoogleAfpAd(t.tagId):(this.log("Google AFP account is missing"),super.handleNoAd(t),this.hideAdContainer(t.tagId))}renderGoogleAfpAd(t){this.slots.filter((t=>t.type===o.SlotType.TOP)).length>1&&t.indexOf("atatags-dynamic-top-")>-1||this.tryLoadAdsenseLib(t,(()=>{var e;const i=this.config.afp_host_id,n=this.config.afp_account_id;if(!i||!n)return void this.log("Ad host or client ID is missing.");const o=document.getElementById(t);if(!o)return void this.log(`AFP Ad container not found: ${t}`);this.configureGoogleAdContainer(o,t);let s=this.getSlotDimensions(o,t);const d=o.getBoundingClientRect();d.widtht.tagId===e));if(!i){const e=parseInt(t.getAttribute("data-ad-width")||"0",10),i=parseInt(t.getAttribute("data-ad-height")||"0",10);return{minWidth:Math.min(e,300),minHeight:Math.min(i,250)}}const n=i.sizes[i.sizes.length-1],o=(0,d.getCompatibleGoogleAdSizes)(n[0],n[1]),[s,r]=[300,250];return o?{minWidth:o[0],minHeight:o[1]}:{minWidth:s,minHeight:r}}getSlot(t){return this.slots.find((e=>e.tagId===t.id))}configureGoogleAdContainer(t,e){var i;const{minWidth:n,minHeight:s}=this.getSlotDimensions(t,e),d=null===(i=t.parentElement)||void 0===i?void 0:i.parentElement;if(!d)return;const r=this.getSlot(t);if((null==r?void 0:r.type)===o.SlotType.BOTTOM_STICKY){let t=s+20;for(const e of[".wordads-ad-title",".wordads-ad-controls"]){const i=d.querySelector(e);i&&(t+=i.offsetHeight||0)}d.style.maxHeight=`${String(t)}px`}else d.style.margin="40px auto","absolute"===window.getComputedStyle(d).position&&(d.style.position="static"),t.style.width=`${n}px`,t.style.height=`${s}px`}createGoogleAdElement(t,e,i,n,s){const d=this.slots.find((t=>t.tagId===s));let r=!1,a=null;(null==d?void 0:d.type)===o.SlotType.BOTTOM_STICKY||[728,970].includes(i)&&90===n?a=7415555587:(null==d?void 0:d.type)===o.SlotType.INLINE||300===i&&250===n?(a=2877544770,r=!0):(null==d?void 0:d.type)===o.SlotType.SIDEBAR_STICKY_RIGHT||120===i&&600===n?a=9195541113:(null==d?void 0:d.type)===o.SlotType.GUTENBERG_MOBILE_LEADERBOARD||320===i&&50===n?a=4785522812:(null==d?void 0:d.type)===o.SlotType.GUTENBERG_SKYSCRAPER||160===i&&600===n?a=5523889413:300===i&&250===n&&(a=6074553751),this.log(`Creating Google AFP ad element for #${s} (${i}x${n}px)`+(null!==a?`, slotId: ${a}`:""));let l=r?'data-ad-format="auto" data-full-width-responsive="true"':`data-ad-width="${i}" data-ad-height="${n}"`;return null!==a&&(l+=` data-ad-slot="${a}"`),`\n\t\t\t\n\t\t\t\n\t\t`}setupGoogleAdStatusObserver(t,e){if(!e)return;let i=null;const n=t.id,o=this.slots.findIndex((t=>t.tagId===n));-1!==o&&void 0!==this.slots[o]&&(this.slots[o].isProcessed=!1);const s=new MutationObserver((e=>{var n;for(const d of e)if("attributes"===d.type&&"data-ad-status"===d.attributeName){const e=d.target.getAttribute("data-ad-status");let r=null!==(n=d.target.parentElement)&&void 0!==n?n:t;if("filled"===e){this.showAdContainer(r.id),this.log(`Google AFP rendered. Div: ${r.id} Status: ${e}`);const t=this.getSlot(r);(null==t?void 0:t.onAd)&&t.onAd()}else this.hideAdContainer(r.id),this.log(`Google AFP rendered. Div: ${r.id}. Status: ${e}`);null!==i&&clearTimeout(i),-1!==o&&void 0!==this.slots[o]&&(this.slots[o].isProcessed=!0),s.disconnect()}})),d=t.querySelector(".adsbygoogle");d&&(s.observe(d,{attributes:!0,attributeFilter:["data-ad-status"]}),i=setTimeout((()=>{var t;-1!==o&&this.slots[o]&&!1===(null!==(t=this.slots[o].isProcessed)&&void 0!==t&&t)&&(this.hideAdContainer(n),this.slots[o].isProcessed=!0,s.disconnect(),this.log("Time limit for processing Google AFP is exceeded for #"+n))}),5e3)),this.initializeAdsbyGoogle()}initializeAdsbyGoogle(){if(void 0===window.adsbygoogle){const t=setInterval((()=>{void 0!==window.adsbygoogle&&(clearInterval(t),this.initAdsByGoogle(),this.log("Google AFP initialized"))}),100);setTimeout((()=>clearInterval(t)),1e3)}else this.initAdsByGoogle()}initAdsByGoogle(){try{(window.adsbygoogle||[]).push({})}catch(t){let e="Failed to render Google AFP";t instanceof Error&&(e+=": "+t.message),this.log(e)}}tryLoadAdsenseLib(t,e){if(this.adSenseLibraryLoaded)return this.log("Adsense library already loaded"),void e();let i=`https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-${String(this.config.afp_account_id)}`;if(document.querySelector(`script[src="${i}"]`)){let i=0;const n=setInterval((()=>{if(++i,100*i/1e3>=5)return clearInterval(n),void this.hideAdContainer(t);this.adSenseLibraryLoaded&&(e(),clearInterval(n))}),100)}else{const n=document.createElement("script");n.src=i,n.async=!0;const o=setTimeout((()=>{this.log("Adsense library load timeout exceeded"),this.hideAdContainer(t)}),5e3);n.onload=()=>{clearTimeout(o),this.log("Adsense library loaded"),this.adSenseLibraryLoaded=!0,e()},n.onerror=()=>{this.log("Failed to load Adsense library"),this.hideAdContainer(t)},document.head.appendChild(n)}}}e.default=a},12:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(202));i(462),e.default=class{constructor(){this.listenersController=new AbortController,this.signal=this.listenersController.signal,this.consent=new o.default}getConsent(){return this.consent}getListenersController(){return this.listenersController}init(t){t.preInit(),this.signal.onabort=()=>t.log("Event listeners removed"),document.addEventListener("scroll",t.throttle((()=>{t.processAds()}),250),{signal:this.signal}),document.addEventListener("resize",t.throttle((()=>{t.processAds()}),250),{signal:this.signal}),window.addEventListener("message",(e=>{t.handlePostMessage(e)}),{signal:this.signal})}}},501:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getSortedSlotSizes=e.getFormatBySizes=e.getFilteredSlotSizesByWidthAndHeight=e.getFilteredSlotSizesByWidth=e.MAX_INLINE_BLAZE_SLOTS=e.MAX_INLINE_SLOTS=void 0;const n=i(639);e.MAX_INLINE_SLOTS=40,e.MAX_INLINE_BLAZE_SLOTS=20,e.getFilteredSlotSizesByWidth=(t,e)=>(s[t]||[]).filter((([t])=>t<=e)),e.getFilteredSlotSizesByWidthAndHeight=(t,e,i)=>(s[t]||[]).filter((([t,n])=>t<=e&&n<=i));const o=document.documentElement.clientWidth<800,s=Object.freeze({[n.SlotType.TOP]:o?[[320,50]]:[[970,250],[970,90],[728,90]],[n.SlotType.INLINE]:o?[[300,250],[320,50]]:[[970,250],[728,90],[300,250]],[n.SlotType.BELOW_POST]:o?[[300,250]]:[[300,250],[728,90]],[n.SlotType.BOTTOM_STICKY]:o?[[320,50],[468,60]]:[[728,90],[970,90]],[n.SlotType.SIDEBAR]:o?[[120,600],[160,600],[300,250],[300,400],[300,600]]:[[120,600],[160,600],[300,600]],[n.SlotType.SIDEBAR_STICKY_RIGHT]:o?[]:[[120,600],[160,600],[300,250],[300,600],[400,600]],[n.SlotType.GUTENBERG_RECTANGLE]:[[300,250]],[n.SlotType.GUTENBERG_LEADERBOARD]:[[728,90]],[n.SlotType.GUTENBERG_MOBILE_LEADERBOARD]:[[320,50]],[n.SlotType.GUTENBERG_SKYSCRAPER]:[[160,600]],[n.SlotType.SIDEBAR_WIDGET_MEDIUMRECTANGLE]:[[300,250]],[n.SlotType.SIDEBAR_WIDGET_LEADERBOARD]:[[728,90]],[n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER]:[[160,600]],[n.SlotType.SHORTCODE]:[[300,250]]});e.getFormatBySizes=(t,e)=>{for(const[i,o]of Object.entries(s))if(![n.SlotType.TOP,n.SlotType.BOTTOM_STICKY,n.SlotType.SIDEBAR,n.SlotType.SIDEBAR_STICKY_RIGHT,n.SlotType.SIDEBAR_WIDGET_MEDIUMRECTANGLE,n.SlotType.SIDEBAR_WIDGET_LEADERBOARD,n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER,n.SlotType.SIDEBAR_WIDGET_WIDESKYSCRAPER,n.SlotType.INLINE,n.SlotType.SHORTCODE,n.SlotType.BELOW_POST].includes(i)&&o.some((([i,n])=>i===t&&n===e)))return i;return null},e.getSortedSlotSizes=t=>s[t].sort(((t,e)=>{const i=e[0]-t[0];return 0!==i?i:e[1]-t[1]}))},586:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.SMART_NETWORK_ID=void 0,e.SMART_NETWORK_ID=3905},506:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(12)),s=n(i(858)),d=new o.default,r=new s.default(d.getConsent(),d.getListenersController());d.init(r)},313:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.ScrollDirection=void 0,function(t){t.UP="up",t.DOWN="down"}(i||(e.ScrollDirection=i={}))},639:(t,e)=>{"use strict";var i;Object.defineProperty(e,"__esModule",{value:!0}),e.StickySlotTypes=e.SlotType=void 0,function(t){t.TOP="top",t.INLINE="inline",t.BELOW_POST="belowpost",t.BOTTOM_STICKY="bottom_sticky",t.SIDEBAR="sidebar",t.SIDEBAR_STICKY_RIGHT="sidebar_sticky_right",t.GUTENBERG_RECTANGLE="gutenberg_rectangle",t.GUTENBERG_LEADERBOARD="gutenberg_leaderboard",t.GUTENBERG_MOBILE_LEADERBOARD="gutenberg_mobile_leaderboard",t.GUTENBERG_SKYSCRAPER="gutenberg_skyscraper",t.SIDEBAR_WIDGET_MEDIUMRECTANGLE="sidebar_widget_mediumrectangle",t.SIDEBAR_WIDGET_LEADERBOARD="sidebar_widget_leaderboard",t.SIDEBAR_WIDGET_WIDESKYSCRAPER="sidebar_widget_wideskyscraper",t.SHORTCODE="shortcode"}(i||(e.SlotType=i={})),e.StickySlotTypes=[i.BOTTOM_STICKY,i.SIDEBAR_STICKY_RIGHT]},202:function(t,e,i){"use strict";var n=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0});const o=n(i(546)),s=i(586);e.default=class{constructor(){this.logging=!1,this.tcData=null,this.usPrivacy=null,this.uid=null}setLogging(t){this.logging=t}log(t){this.logging&&console.log(t)}init(){this.log("Initializing consent..."),window.__uspapi?(this.log("Querying USP API..."),window.__uspapi("getUSPData",1,((t,e)=>{e&&t.uspString&&(this.usPrivacy=t.uspString,this.log("USP API data found. Setting consent: "+this.usPrivacy))}))):this.log("USP API not found"),window.__tcfapi?(this.log("Querying TCF API..."),window.__tcfapi("addEventListener",2,((t,e)=>{var i;e&&t.gdprApplies?(this.tcData=t,this.log("TCF API data found. Setting consent: "+(null===(i=this.tcData)||void 0===i?void 0:i.tcString)),this.initCookieSync()):this.log("TCF API data found. GDPR does not apply")}))):this.log("TCF API not found")}createUIDFromCookies(t,e,i){const n={expires:e,domain:i||window.location.hostname};this.log(`Created UID from Cookies on ${n.domain}`);const s=o.default.withAttributes(n),d=this.generateUIDValue();return s.set(t,d),d}generateUIDValue(){return Math.random().toString(36).substring(2,10)+(new Date).getTime().toString()}getOrCreateUIDFromLocalStorage(t,e){this.log("UID from localStorage");const i=(localStorage.getItem(t)||"").split(":");let n=i[0];const o=(new Date).getTime();let s=parseInt(i[1]);return(!n||o>s)&&(n=this.generateUIDValue(),s=o+24*e*60*60*1e3,localStorage.setItem(t,n+":"+s)),n}getOrCreateUID(){if(null!==this.uid)return this.uid;if(!this.hasUserConsent())return this.uid="",this.uid;const t="wordads_uid",e=o.default.get(t);if(e)return this.log(`Reused UID value ${e}`),this.uid=e,this.uid;const i=this.getCookiesSharedDomain(t,window.location.hostname);return window.localStorage&&!i||(this.uid=this.createUIDFromCookies(t,30,i)),this.uid=this.uid||this.getOrCreateUIDFromLocalStorage(t,30),this.log(`UID value: ${this.uid}`),this.uid}getCookiesSharedDomain(t,e){const i=e.split(".");if(i.length<=2)return null;let n=null,s=0;for(const d of i){if(s+=d.length,n=e.substring(s),s>=e.length)return null;const i=o.default.withAttributes({domain:n});if(i.set(t,"1")&&i.get(t))return i.remove(t),n;s++}return null}hasUserConsent(){return!this.tcData||!0===this.tcData.vendor.consents[496]&&!0===this.tcData.purpose.consents[1]}initCookieSync(){this.log("Initializing Cookie Sync");let t=`https://sync.smartadserver.com/getuid?nwid=${s.SMART_NETWORK_ID}&url=https://af.pubmine.com/user-sync?pid=[sas_uid]`;this.tcData&&(t+=`&gdpr=1&gdpr_consent=${this.tcData.tcString}`),document.createElement("img").src=t}}},444:(t,e)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.getCompatibleGoogleAdSizes=e.convertFormatsToObject=e.getMaxSlotDimension=void 0;const i=[[970,250],[970,90],[728,90],[336,280],[320,100],[300,600],[300,250],[250,250],[200,200],[320,50],[300,50],[468,60],[160,600],[120,600]];e.getMaxSlotDimension=t=>{let e=0,i=0;return t.forEach((([t,n])=>{t>e&&(e=t),n>i&&(i=n)})),{maxWidth:e,maxHeight:i}},e.convertFormatsToObject=t=>t.reduce(((t,e)=>(t[e]=!0,t)),{}),e.getCompatibleGoogleAdSizes=(t,e)=>{const n=i.find((([i,n])=>i<=t&&n<=e));return null!=n?n:null}},539:(t,e,i)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});const n=i(501),o=i(639),s=i(313),d=i(444),r=["BLOCKQUOTE","DIV","FIGURE","FORM","H1","H2","H3","H4","H5","H6","P","UL"];e.default=class{constructor(t,e){this.logging="function"==typeof URLSearchParams&&"true"===new URLSearchParams(window.location.search).get("wordads-logging"),this.consent=t,this.consent.setLogging(this.logging),this.adFlowUrl="https://af.pubmine.com",this.slots=[],this.initialized=!1,this.config={},this.scroll={lastDirection:s.ScrollDirection.DOWN,lastY:window.scrollY},this.listenersController=e,this.forceAfpAds="function"==typeof URLSearchParams&&"1"===new URLSearchParams(window.location.search).get("afp_test")}log(t){this.logging&&console.log(t)}logSlot(t,e){if(!this.logging)return;const i=t.sizes.map((([t,e])=>t+"x"+e)).join(","),n=[t.type,t.tagId,i].join("|");this.log(`[${n}] ${e}`)}trackStat(t){window._stq=window._stq||[],window._stq.push(["extra",{x_wordads_smart:t}])}recordTracksEvent(t,e){e=e||{},window._tkq=window._tkq||[],window._tkq.push(["recordEvent",t,e])}getServerConfig(){var t,e;const i=document.getElementById("adflow-configuration"),n=i?JSON.parse(i.innerText):{},o=null!==(e=null===(t=null===window||void 0===window?void 0:window.wa_client)||void 0===t?void 0:t.config)&&void 0!==e?e:null===window||void 0===window?void 0:window.wa_smart;return this.deepMerge(n,o)}createAdSnippet(t,e){let i=document.createElement("div"),n=document.createElement("div"),o=document.createElement("div"),s=document.createElement("div");if(i.classList.add("wordads-ad"),n.classList.add("wordads-ad-title"),o.classList.add("wordads-ad-content"),s.classList.add("wordads-ad-controls"),n.innerText=this.config._.title,o.id=t,e){const{maxHeight:t,maxWidth:i}=(0,d.getMaxSlotDimension)(e);o.setAttribute("data-ad-height",t.toString()),o.setAttribute("data-ad-width",i.toString())}return s.innerHTML=this.consent.tcData?`${this.config._.privacy_settings}`:"",i.appendChild(n),i.appendChild(o),i.appendChild(s),i}getBottomStickySlots(){}createBottomStickyAdSnippet(t){const e=this.getBottomStickySlots(),i=this.createAdSnippet(t,e);i.classList.add("wordads-ad-sticky");const n=this.wrapSnippet(i,o.SlotType.BOTTOM_STICKY);n.classList.add("wordads-ad-sticky-wrapper");const d=()=>{this.toggleVisibility(n,s.ScrollDirection.DOWN)},r=document.createElement("div");return r.classList.add("wordads-ad-sticky-close-btn"),r.onclick=function(){n.remove(),document.removeEventListener("scroll",d)},n.insertBefore(r,i),{event:d,snippet:n}}createSidebarStickyAdSnippet(t,e){const i=this.createAdSnippet(t);i.classList.add("wordads-ad-sticky");const n=this.wrapSnippet(i,e);n.classList.add("wordads-ad-sticky-wrapper");const o=this.throttle((()=>{this.updateSidebarStickyVisibility(n)}),150),s=document.createElement("div");return s.classList.add("wordads-ad-sticky-close-btn"),s.onclick=function(){n.remove(),window.removeEventListener("resize",o),document.removeEventListener("scroll",o)},n.insertBefore(s,i),{event:o,snippet:n,adContent:i.querySelector(".wordads-ad-content")}}toggleVisibility(t,e){const i=window.scrollY>this.scroll.lastY?s.ScrollDirection.DOWN:s.ScrollDirection.UP,n=this.scroll.lastDirection===i;if(this.scroll.lastDirection=i,this.scroll.lastY=window.scrollY,n)return;const o="wordads-ad-hidden";e===i?t.classList.remove(o):t.classList.add(o)}wrapSnippet(t,e){const i=document.createElement("div");return i.classList.add("wordads-ad-wrapper"),i.classList.add(`wordads-ad-wrapper--${e}`),i.appendChild(t),i}checkBrandSafety(t,e){}handleNotOkayResponse(t,e){var i;if(this.log(`Site unable to show ads: ${e.tagId}`),204===t){const t=document.getElementById(e.tagId),n=null===(i=null==t?void 0:t.parentElement)||void 0===i?void 0:i.parentElement;t&&(null==n?void 0:n.classList.contains("wordads-ad-wrapper"))&&n.classList.add("wordads-ad-hidden"),this.listenersController.abort()}}callAdFlow(t){this.logSlot(t,"calling AdFlow");const e=new XMLHttpRequest;e.onreadystatechange=()=>{if(XMLHttpRequest.DONE===e.readyState){if(performance.mark(`${t.tagId}-end`),200!==e.status)return void this.handleNotOkayResponse(e.status,t);const i=JSON.parse(e.response);this.handleAdResponse(i,t)}},e.open("POST",this.adFlowUrl),e.setRequestHeader("Accept","application/json"),e.withCredentials=!0,performance.mark(`${t.tagId}-start`);const i=this.getAdFlowRequestBody(t);e.send(JSON.stringify(i))}trackAdFlowRequestLatency(t,e,i){let n=performance.measure(`${e}-duration`,`${e}-start`,`${e}-end`),o={has_ad:t,ad_type:i,request_time:Math.round(n.duration),theme:this.config.theme};navigator.connection&&(o.connection_effective_type=navigator.connection.effectiveType,o.connection_downlink=navigator.connection.downlink),this.recordTracksEvent("wpcom_wordads_adflow",o)}insertFallbackAd(t,e){let i=(window.sas_fallback||[]).filter((function(t){return t.type===e}));if(0===i.length)return t.remove(),void this.log(`No fallback found for ${e}, snippet removed`);let n=i[0].tag.replaceAll("{{unique_id}}",Math.trunc(1e6*Math.random())),o=document.createElement("div");o.innerHTML=n,n=o.childNodes[0].nodeValue;let s=document.createElement("div");s.innerHTML=n,t.style.position="relative",t.style.visibility="visible",t.innerHTML=s.innerHTML,s.querySelectorAll("script").forEach((function(t){t.parentNode&&t.parentNode.removeChild(t);let e=document.createElement("script");t.src?e.src=t.src:t.textContent?e.textContent=t.textContent:t.innerText&&(e.innerText=t.innerText),document.body.appendChild(e)})),this.trackStat("fallback_"+e)}getPostItems(t){let e=[];for(let i=0;i=this.getFontSize(t)}isPostItemValid(t,e=!1){if(!t||!r.includes(t.nodeName))return!1;if(e&&"DIV"===t.nodeName){let e=!1;const i=4,n=t=>{var e;return!(null===(e=document.evaluate('//div[contains(@class, "wpcnt")]/div[contains(@class, "wpa")]/div/div/div[starts-with(@id, "atatags-")]',t,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue)||void 0===e||!e)},o=t=>{var e;return!(null===(e=document.evaluate('//div[contains(@class, "wordads-ad-wrapper")]',t,null,XPathResult.ANY_UNORDERED_NODE_TYPE,null).singleNodeValue)||void 0===e||!e)},s=(t,e)=>{if(e>i)return!1;for(let i=0;i{let e=this.getElementGlobalPosition(t);i.bottome.bottom||i.righte.left||(n=!0)})),n}getInlineFormatId(){}initInlineAds(){if(!this.shouldShowInlineAds())return;this.log(`Initializing ${o.SlotType.INLINE}`);let t=document.getElementById("wordads-inline-marker");if(!t)return void this.trackStat("inline_no_marker");let e=t.parentElement;if(!e)return;const i=this.getAvailableWidth(e),s=(0,n.getFilteredSlotSizesByWidth)(o.SlotType.INLINE,i);t.remove();let d=this.getMaxSlots(),r=0;const a=window.innerHeight,l=Math.ceil(1.1*a),c=Math.ceil(1.2*a);let h=e.getBoundingClientRect().top+window.scrollY+l;const u=this.getPostItems(e),g=this.getFloatingElements(e);if(u.length>0)for(let t=0;t0?u[t-1]:null,i=th,p=e&&this.isPostItemValid(e,!0),m=this.isPostItemValid(n,!0),f=null===i||i&&this.isPostItemValid(i,!0),w=this.collidesWithElements(n,g);l&&r{this.updateSidebarStickyVisibility(d),window.addEventListener("resize",s,{passive:!0}),document.addEventListener("scroll",s,{passive:!0})}},u?{formatId:u}:{}))}appendTopTag(){const t=this.getRandomTagId(),e=document.createElement("div");e.id=t;const i=document.documentElement.clientWidth,s=(0,n.getFilteredSlotSizesByWidth)(o.SlotType.TOP,i),d=this.createAdSnippet(t,s),r=this.wrapSnippet(d,o.SlotType.TOP);return document.body.insertBefore(e,document.body.firstChild),e.insertAdjacentElement("beforebegin",r),e.remove(),this.slots.push({tagId:t,type:o.SlotType.TOP,sizes:s,element:r,isLazy:!0}),e}initTop(){if(!this.shouldShowTopAds())return;this.log(`Initializing ${o.SlotType.TOP}`);const t=Array.from(document.getElementsByClassName("wordads-tag"));let[e]=t.filter((t=>t.dataset.slotType===o.SlotType.TOP));e&&e.remove(),e=this.appendTopTag()}updateSidebarStickyVisibility(t){const e=t.offsetHeight;this.isWithinViewportHeight(e)&&!this.checkIfAdIsOverlappingContent(t)?(this.log("sidebar_sticky_right: ad slot can fit"),t.classList.remove("wordads-ad-hidden")):(this.log("sidebar_sticky_right: ad slot CANNOT fit"),t.classList.add("wordads-ad-hidden"))}isWithinViewportHeight(t){return t<=.8*window.innerHeight}getOverlappingElements(t,e,i){return t=Math.round(t),e=Math.round(e),document.elementsFromPoint(t,e).filter((t=>{return!((e=t)===i||i.contains(e)||e.contains(i));var e}))}isElementAboveSnippet(t,e){const i=e.getBoundingClientRect(),n=[[i.left+1,i.top+1],[i.right-1,i.top+1],[i.left+1,i.bottom-1],[i.right-1,i.bottom-1],[i.left+i.width/2,i.top+i.height/2]];for(const[i,o]of n){const n=document.elementsFromPoint(i,o);if(n.indexOf(t)t.classList.contains("wordads-ad-wrapper")&&t.querySelector(".wordads-ad-content")||t)),n=[];for(const t of i){const i=t.getBoundingClientRect();if(!(Math.round(e.right)<=Math.round(i.left)||Math.round(e.left)>=Math.round(i.right)||Math.round(e.bottom)<=Math.round(i.top)||Math.round(e.top)>=Math.round(i.bottom))){const e=window.getComputedStyle(t);"none"!==e.display&&"hidden"!==e.visibility&&"0"!==e.opacity&&n.push(t)}}return n.some((e=>this.isElementAboveSnippet(e,t)))}getMaxAvailableSidebarStickySize(t){const e=(0,n.getSortedSlotSizes)(o.SlotType.SIDEBAR_STICKY_RIGHT);for(const[i,n]of e){t.style.width=`${i}px`,t.style.height=`${n}px`;const e=this.checkIfAdIsOverlappingContent(t);if(t.style.width="",t.style.height="",!e&&this.isWithinViewportHeight(n))return this.log(`sidebar_sticky_right: max available size without overlap, [${i}, ${n}]`),{maxWidth:i,maxHeight:n}}return this.log("sidebar_sticky_right: no slot size fits available space"),{maxWidth:0,maxHeight:0}}initAdTags(){var t;this.log("Initializing ad tags");const e=Array.from(document.getElementsByClassName("wordads-tag"));for(let i=0;i-1?e.element.style.position="fixed":e.element.style.position="relative",e.element.style.visibility="visible",e.onAd&&e.onAd(),this.trackStat("ad_"+e.type)):this.log(`Ad: no slot found for tag id: ${t.tagId}, format: ${this.getFormat(t)}`)}handlePostMessage(t){if("object"!=typeof t.data)return;if("wa-inline-frame"!==t.data.type)return;const e=t;let i=document.getElementsByTagName("iframe");for(let t=0;t{t.style.maxWidth=e.data.maxWidth})));break}}getSlotByTagId(t){return this.slots.find((e=>e.tagId===t))}getRandomTagId(){return"wordads-ad-"+Math.trunc(1e6*Math.random())}throttle(t,e){let i=!1;return(...n)=>{i||(t(...n),i=!0,setTimeout((()=>{i=!1}),e))}}isElementInLazyViewport(t){let e=window.innerHeight,i=window.scrollY,n=i-e,o=i+2*e,s=this.getElementGlobalPosition(t);return!(s.bottom<=n||s.top>=o)}processAds(){this.log("processAds: "+this.slots.length),0!==this.slots.length&&this.slots.forEach((t=>{if(t.isLoaded)return;const e=!t.isLazy||this.isElementInLazyViewport(t.element),i=this.checkIfAdIsOverlappingContent(t.element);i&&t.type===o.SlotType.TOP&&(this.logSlot(t,"Top overlaps with other elements, we have to remove it from slots"),this.slots=this.slots.filter((e=>e!==t)),t.element.remove()),!e||i&&t.type!==o.SlotType.BOTTOM_STICKY||(this.logSlot(t,"in view"),t.isLoaded=!0,this.callAdFlow(t))}))}tryInit(t){const e=Object.values(t).map((t=>t.loaded&&t.isInitialized())).filter(Boolean);Object.keys(t).length===e.length&&(this.log("All scripts loaded, initializing..."),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",(()=>{this.init()})):this.init())}preInit(){this.log("Running Pre Init");const t=this.getLibrariesToFetch();for(const[e,i]of Object.entries(t)){if(i.isInitialized())continue;this.log(`Fetching ${e} script`),i.init();const n=document.createElement("script");n.src=i.url,n.async=!0,n.addEventListener("load",(()=>{this.log(`${e} is loaded`),t[e]=Object.assign(Object.assign({},i),{loaded:!0}),this.tryInit(t)})),document.head.appendChild(n)}}init(){this.log("Init..."),this.mergeConfig(),this.consent.init(),this.initAdNetwork(),this.consent.initCookieSync(),this.initAds()}initAds(){this.initialized||(this.initialized=!0,this.initInlineAds(),this.initTop(),this.initBottomSticky(),this.initSidebarStickyRight(),this.initAdTags(),this.processAds())}deepMerge(t,e){for(let i in e)e.hasOwnProperty(i)&&(e[i]instanceof Object&&t[i]instanceof Object?t[i]=this.deepMerge(t[i],e[i]):t[i]=e[i]);return t}}},240:t=>{"use strict";t.exports="data:image/svg+xml,%3Csvg width=%2730%27 height=%2730%27 viewBox=%270 0 30 30%27 fill=%27none%27 xmlns=%27http://www.w3.org/2000/svg%27%3E%3Crect x=%270.5%27 y=%270.5%27 width=%2729%27 height=%2729%27 rx=%2714.5%27 fill=%27white%27/%3E%3Crect x=%270.5%27 y=%270.5%27 width=%2729%27 height=%2729%27 rx=%2714.5%27 stroke=%27%23DDDDDF%27/%3E%3Cpath d=%27M19 11L15 15L19 19%27 stroke=%27%237C7F83%27 stroke-width=%271.5%27/%3E%3Cpath d=%27M11 19L15 15L11 11%27 stroke=%27%237C7F83%27 stroke-width=%271.5%27/%3E%3C/svg%3E"}},e={};function i(n){var o=e[n];if(void 0!==o)return o.exports;var s=e[n]={id:n,exports:{}};return t[n].call(s.exports,s,s.exports,i),s.exports}i.m=t,i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.b=document.baseURI||self.location.href,i.nc=void 0,i(506)})();; /* global wpcom_reblog */ var jetpackLikesWidgetBatch = []; var jetpackLikesMasterReady = false; // Due to performance problems on pages with a large number of widget iframes that need to be loaded, // we are limiting the processing at any instant to unloaded widgets that are currently in viewport, // plus this constant that will allow processing of widgets above and bellow the current fold. // This aim of it is to improve the UX and hide the transition from unloaded to loaded state from users. var jetpackLikesLookAhead = 2000; // pixels // Keeps track of loaded comment likes widget so we can unload them when they are scrolled out of view. var jetpackCommentLikesLoadedWidgets = []; var jetpackLikesDocReadyPromise = new Promise( resolve => { if ( document.readyState !== 'loading' ) { resolve(); } else { window.addEventListener( 'DOMContentLoaded', () => resolve() ); } } ); function JetpackLikesPostMessage( message, target ) { if ( typeof message === 'string' ) { try { message = JSON.parse( message ); } catch ( e ) { return; } } if ( target && typeof target.postMessage === 'function' ) { try { target.postMessage( JSON.stringify( { type: 'likesMessage', data: message, } ), '*' ); } catch ( e ) { return; } } } function JetpackLikesBatchHandler() { const requests = []; document.querySelectorAll( 'div.jetpack-likes-widget-unloaded' ).forEach( widget => { if ( jetpackLikesWidgetBatch.indexOf( widget.id ) > -1 ) { return; } if ( ! jetpackIsScrolledIntoView( widget ) ) { return; } jetpackLikesWidgetBatch.push( widget.id ); var regex = /like-(post|comment)-wrapper-(\d+)-(\d+)-(\w+)/, match = regex.exec( widget.id ), info; if ( ! match || match.length !== 5 ) { return; } info = { blog_id: match[ 2 ], width: widget.width, }; if ( 'post' === match[ 1 ] ) { info.post_id = match[ 3 ]; } else if ( 'comment' === match[ 1 ] ) { info.comment_id = match[ 3 ]; } info.obj_id = match[ 4 ]; requests.push( info ); } ); if ( requests.length > 0 ) { JetpackLikesPostMessage( { event: 'initialBatch', requests: requests }, window.frames[ 'likes-master' ] ); } } function JetpackLikesMessageListener( event ) { let message = event && event.data; if ( typeof message === 'string' ) { try { message = JSON.parse( message ); } catch ( err ) { return; } } const type = message && message.type; const data = message && message.data; if ( type !== 'likesMessage' || typeof data.event === 'undefined' ) { return; } // We only allow messages from one origin const allowedOrigin = 'https://widgets.wp.com'; if ( allowedOrigin !== event.origin ) { return; } switch ( data.event ) { case 'masterReady': jetpackLikesDocReadyPromise.then( () => { jetpackLikesMasterReady = true; const stylesData = { event: 'injectStyles', }; const sdTextColor = document.querySelector( '.sd-text-color' ); const sdLinkColor = document.querySelector( '.sd-link-color' ); const sdTextColorStyles = ( sdTextColor && getComputedStyle( sdTextColor ) ) || {}; const sdLinkColorStyles = ( sdLinkColor && getComputedStyle( sdLinkColor ) ) || {}; // enable reblogs if they are enabled for the page if ( document.body.classList.contains( 'jetpack-reblog-enabled' ) ) { JetpackLikesPostMessage( { event: 'reblogsEnabled' }, window.frames[ 'likes-master' ] ); } stylesData.textStyles = { color: sdTextColorStyles[ 'color' ], fontFamily: sdTextColorStyles[ 'font-family' ], fontSize: sdTextColorStyles[ 'font-size' ], direction: sdTextColorStyles[ 'direction' ], fontWeight: sdTextColorStyles[ 'font-weight' ], fontStyle: sdTextColorStyles[ 'font-style' ], textDecoration: sdTextColorStyles[ 'text-decoration' ], }; stylesData.linkStyles = { color: sdLinkColorStyles[ 'color' ], fontFamily: sdLinkColorStyles[ 'font-family' ], fontSize: sdLinkColorStyles[ 'font-size' ], textDecoration: sdLinkColorStyles[ 'text-decoration' ], fontWeight: sdLinkColorStyles[ 'font-weight' ], fontStyle: sdLinkColorStyles[ 'font-style' ], }; JetpackLikesPostMessage( stylesData, window.frames[ 'likes-master' ] ); JetpackLikesBatchHandler(); } ); break; // We're keeping this for planned future follow ups. // @see: https://github.com/Automattic/jetpack/pull/42361#discussion_r1995338815 case 'showLikeWidget': break; // We're keeping this for planned future follow ups. // @see: https://github.com/Automattic/jetpack/pull/42361#discussion_r1995338815 case 'showCommentLikeWidget': break; case 'killCommentLikes': // If kill switch for comment likes is enabled remove all widgets wrappers and `Loading...` placeholders. document .querySelectorAll( '.jetpack-comment-likes-widget-wrapper' ) .forEach( wrapper => wrapper.remove() ); break; case 'clickReblogFlair': if ( wpcom_reblog && typeof wpcom_reblog.toggle_reblog_box_flair === 'function' ) { wpcom_reblog.toggle_reblog_box_flair( data.obj_id, data.post_id ); } break; case 'hideOtherGravatars': { hideLikersPopover(); break; } case 'showOtherGravatars': { const container = document.querySelector( '#likes-other-gravatars' ); if ( ! container ) { break; } const list = container.querySelector( 'ul' ); container.style.display = 'none'; list.innerHTML = ''; container .querySelectorAll( '.likes-text span' ) .forEach( item => ( item.textContent = data.totalLikesLabel ) ); ( data.likers || [] ).forEach( async ( liker, index ) => { if ( liker.profile_URL.substr( 0, 4 ) !== 'http' ) { // We only display gravatars with http or https schema return; } const element = document.createElement( 'li' ); list.append( element ); element.innerHTML = ` `; // Add some extra attributes through native methods, to ensure strings are sanitized. element.classList.add( liker.css_class ); element.querySelector( 'img' ).alt = data.avatarAltTitle.replace( '%s', liker.name ); element.querySelector( 'span' ).innerText = liker.name; if ( index === data.likers.length - 1 ) { element.addEventListener( 'keydown', ( e ) => { if ( e.key === 'Tab' && ! e.shiftKey ) { e.preventDefault(); hideLikersPopover(); JetpackLikesPostMessage( { event: 'focusLikesCount', parent: data.parent }, window.frames[ 'likes-master' ] ); } } ); } } ); const positionPopup = function() { const containerStyle = getComputedStyle(container); const isRtl = containerStyle.direction === 'rtl'; const el = document.querySelector( `*[name='${ data.parent }']` ); const rect = el.getBoundingClientRect(); const win = el.ownerDocument.defaultView; const offset = { top: rect.top + win.pageYOffset, left: rect.left + win.pageXOffset, }; // don't display yet or we get skewed window.innerWidth later container.style.display = 'none'; let containerLeft = 0; container.style.top = offset.top + data.position.top - 1 + 'px'; if ( isRtl ) { const visibleAvatarsCount = data && data.likers ? Math.min( data.likers.length, 5 ) : 0; // 24px is the width of the avatar + 4px is the padding between avatars containerLeft = offset.left + data.position.left + 24 * visibleAvatarsCount + 4; container.style.transform = 'translateX(-100%)'; } else { containerLeft = offset.left + data.position.left; } container.style.left = containerLeft + 'px'; // Container width - padding const initContainerWidth = data.width - 20; const rowLength = Math.floor( initContainerWidth / 37 ); // # of rows + (avatar + avatar padding) + text above + container padding let height = Math.ceil( data.likers.length / rowLength ) * 37 + 17 + 22; if ( height > 204 ) { height = 204; } // If the popup is overflows viewport width, we should show it on the next line // Push it offscreen to calculated rendered width const windowWidth = win.innerWidth; container.style.left = '-9999px'; container.style.display = 'block'; // If the popup exceeds the viewport width, // flip the position of the popup. const containerWidth = container.offsetWidth; const containerRight = containerLeft + containerWidth; if ( containerRight > windowWidth && ! isRtl) { containerLeft = rect.left + rect.width - containerWidth; } else if ( containerLeft - containerWidth < 0 && isRtl ) { container.style.transform = 'none'; containerLeft = rect.left; } // Set the container left container.style.left = containerLeft + 'px'; container.setAttribute( 'aria-hidden', 'false' ); } positionPopup(); container.focus(); const debounce = function( func, wait ) { var timeout; return function() { var context = this; var args = arguments; clearTimeout( timeout ); timeout = setTimeout( function() { func.apply( context, args ); }, wait ); }; }; const debouncedPositionPopup = debounce( positionPopup, 100 ); // Keep a reference of this function in the element itself // so that we can destroy it later container.__resizeHandler = debouncedPositionPopup; // When window is resized, resize the popup. window.addEventListener( "resize", debouncedPositionPopup ); } } } window.addEventListener( 'message', JetpackLikesMessageListener ); function hideLikersPopover() { const container = document.querySelector( '#likes-other-gravatars' ); if ( container ) { container.style.display = 'none'; container.setAttribute( 'aria-hidden', 'true' ); // Remove the resize event listener and cleanup. const resizeHandler = container.__resizeHandler; if ( resizeHandler ) { window.removeEventListener( "resize", resizeHandler ); delete container.__resizeHandler; } } } document.addEventListener( 'click', hideLikersPopover ); function JetpackLikesWidgetQueueHandler() { var wrapperID; if ( ! jetpackLikesMasterReady ) { setTimeout( JetpackLikesWidgetQueueHandler, 500 ); return; } // Restore widgets to initial unloaded state when they are scrolled out of view. jetpackUnloadScrolledOutWidgets(); var unloadedWidgetsInView = jetpackGetUnloadedWidgetsInView(); if ( unloadedWidgetsInView.length > 0 ) { // Grab any unloaded widgets for a batch request JetpackLikesBatchHandler(); } for ( var i = 0, length = unloadedWidgetsInView.length; i <= length - 1; i++ ) { wrapperID = unloadedWidgetsInView[ i ].id; if ( ! wrapperID ) { continue; } jetpackLoadLikeWidgetIframe( wrapperID ); } } function jetpackLoadLikeWidgetIframe( wrapperID ) { if ( typeof wrapperID === 'undefined' ) { return; } const wrapper = document.querySelector( '#' + wrapperID ); wrapper.querySelectorAll( 'iframe' ).forEach( iFrame => iFrame.remove() ); const placeholder = wrapper.querySelector( '.likes-widget-placeholder' ); // Post like iframe if ( placeholder && placeholder.classList.contains( 'post-likes-widget-placeholder' ) ) { const postLikesFrame = document.createElement( 'iframe' ); postLikesFrame.classList.add( 'post-likes-widget', 'jetpack-likes-widget' ); postLikesFrame.name = wrapper.dataset.name; postLikesFrame.src = wrapper.dataset.src; postLikesFrame.height = '55px'; postLikesFrame.width = '100%'; postLikesFrame.frameBorder = '0'; postLikesFrame.scrolling = 'no'; postLikesFrame.title = wrapper.dataset.title; placeholder.after( postLikesFrame ); } // Comment like iframe if ( placeholder.classList.contains( 'comment-likes-widget-placeholder' ) ) { const commentLikesFrame = document.createElement( 'iframe' ); commentLikesFrame.class = 'comment-likes-widget-frame jetpack-likes-widget-frame'; commentLikesFrame.name = wrapper.dataset.name; commentLikesFrame.src = wrapper.dataset.src; commentLikesFrame.height = '18px'; commentLikesFrame.width = '100%'; commentLikesFrame.frameBorder = '0'; commentLikesFrame.scrolling = 'no'; wrapper.querySelector( '.comment-like-feedback' ).after( commentLikesFrame ); jetpackCommentLikesLoadedWidgets.push( commentLikesFrame ); } wrapper.classList.remove( 'jetpack-likes-widget-unloaded' ); wrapper.classList.add( 'jetpack-likes-widget-loading' ); wrapper.querySelector( 'iframe' ).addEventListener( 'load', e => { JetpackLikesPostMessage( { event: 'loadLikeWidget', name: e.target.name, width: e.target.width }, window.frames[ 'likes-master' ] ); wrapper.classList.remove( 'jetpack-likes-widget-loading' ); wrapper.classList.add( 'jetpack-likes-widget-loaded' ); } ); } function jetpackGetUnloadedWidgetsInView() { const unloadedWidgets = document.querySelectorAll( 'div.jetpack-likes-widget-unloaded' ); return [ ...unloadedWidgets ].filter( item => jetpackIsScrolledIntoView( item ) ); } function jetpackIsScrolledIntoView( element ) { const top = element.getBoundingClientRect().top; const bottom = element.getBoundingClientRect().bottom; // Allow some slack above and bellow the fold with jetpackLikesLookAhead, // with the aim of hiding the transition from unloaded to loaded widget from users. return top + jetpackLikesLookAhead >= 0 && bottom <= window.innerHeight + jetpackLikesLookAhead; } function jetpackUnloadScrolledOutWidgets() { for ( let i = jetpackCommentLikesLoadedWidgets.length - 1; i >= 0; i-- ) { const currentWidgetIframe = jetpackCommentLikesLoadedWidgets[ i ]; if ( ! jetpackIsScrolledIntoView( currentWidgetIframe ) ) { const widgetWrapper = currentWidgetIframe && currentWidgetIframe.parentElement && currentWidgetIframe.parentElement.parentElement; // Restore parent class to 'unloaded' so this widget can be picked up by queue manager again if needed. widgetWrapper.classList.remove( 'jetpack-likes-widget-loaded' ); widgetWrapper.classList.remove( 'jetpack-likes-widget-loading' ); widgetWrapper.classList.add( 'jetpack-likes-widget-unloaded' ); // Bring back the loading placeholder into view. widgetWrapper .querySelectorAll( '.comment-likes-widget-placeholder' ) .forEach( item => ( item.style.display = 'block' ) ); // Remove it from the list of loaded widgets. jetpackCommentLikesLoadedWidgets.splice( i, 1 ); // Remove comment like widget iFrame. currentWidgetIframe.remove(); } } } var jetpackWidgetsDelayedExec = function ( after, fn ) { var timer; return function () { clearTimeout( timer ); timer = setTimeout( fn, after ); }; }; var jetpackOnScrollStopped = jetpackWidgetsDelayedExec( 250, JetpackLikesWidgetQueueHandler ); // Load initial batch of widgets, prior to any scrolling events. JetpackLikesWidgetQueueHandler(); // Add event listener to execute queue handler after scroll. window.addEventListener( 'scroll', jetpackOnScrollStopped, true ); ; !function(){"use strict";var e,t={noop:function(){},texturize:function(e){return(e=(e=(e=(e+="").replace(/'/g,"’").replace(/'/g,"’")).replace(/"/g,"”").replace(/"/g,"”").replace(/"/g,"”").replace(/[\u201D]/g,"”")).replace(/([\w]+)=&#[\d]+;(.+?)&#[\d]+;/g,'$1="$2"')).trim()},applyReplacements:function(e,t){if(e)return t?e.replace(/{(\d+)}/g,function(e,r){return void 0!==t[r]?t[r]:e}):e},getBackgroundImage:function(e){var t=document.createElement("canvas"),r=t.getContext&&t.getContext("2d");if(e){r.filter="blur(20px) ",r.drawImage(e,0,0);var o=t.toDataURL("image/png");return t=null,o}}},r=function(){function e(e,t){return Element.prototype.matches?e.matches(t):Element.prototype.msMatchesSelector?e.msMatchesSelector(t):void 0}function r(e,t,r,o){if(!e)return o();e.style.removeProperty("display"),e.style.opacity=t,e.style.pointerEvents="none";var a=function(i,n){var l=(performance.now()-i)/n;l<1?(e.style.opacity=t+(r-t)*l,requestAnimationFrame(()=>a(i,n))):(e.style.opacity=r,e.style.removeProperty("pointer-events"),o())};requestAnimationFrame(function(){requestAnimationFrame(function(){a(performance.now(),200)})})}return{closest:function(t,r){if(t.closest)return t.closest(r);var o=t;do{if(e(o,r))return o;o=o.parentElement||o.parentNode}while(null!==o&&1===o.nodeType);return null},matches:e,hide:function(e){e&&(e.style.display="none")},show:function(e){e&&(e.style.display="block")},fadeIn:function(e,o){r(e,0,1,o=o||t.noop)},fadeOut:function(e,o){o=o||t.noop,r(e,1,0,function(){e&&(e.style.display="none"),o()})},scrollToElement:function(e,t,r){if(!e||!t)return r?r():void 0;var o=t.querySelector(".jp-carousel-info-extra");o&&(o.style.minHeight=window.innerHeight-64+"px");var a=!0,i=Date.now(),n=t.scrollTop,l=Math.max(0,e.offsetTop-Math.max(0,window.innerHeight-function(e){var t=e.querySelector(".jp-carousel-info-footer"),r=e.querySelector(".jp-carousel-info-extra"),o=e.querySelector(".jp-carousel-info-content-wrapper");if(t&&r&&o){var a=window.getComputedStyle(r),i=parseInt(a.paddingTop,10)+parseInt(a.paddingBottom,10);return i=isNaN(i)?0:i,o.offsetHeight+t.offsetHeight+i}return 0}(t)))-t.scrollTop;function s(){a=!1}l=Math.min(l,t.scrollHeight-window.innerHeight),t.addEventListener("wheel",s),function e(){var c,u=Date.now(),d=(c=(u-i)/300)<.5?2*c*c:1-Math.pow(-2*c+2,2)/2,p=(d=d>1?1:d)*l;if(t.scrollTop=n+p,u<=i+300&&a)return requestAnimationFrame(e);r&&r(),o&&(o.style.minHeight=""),a=!1,t.removeEventListener("wheel",s)}()},getJSONAttribute:function(e,t){if(e&&e.hasAttribute(t))try{return JSON.parse(e.getAttribute(t))}catch{return}},convertToPlainText:function(e){var t=document.createElement("div");return t.textContent=e,t.innerHTML},stripHTML:function(e){var t=document.createElement("div");return t.innerHTML=e.replace(/<[^>]*>?/gm,""),t.textContent},emitEvent:function(e,t,r){var o;try{o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:r||null})}catch{(o=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,r||null)}e.dispatchEvent(o)},isTouch:function(){return"ontouchstart"in window||window.DocumentTouch&&document instanceof DocumentTouch}}}();function o(){var o,a,i,n,l="",s=!1,c="div.gallery, div.tiled-gallery, ul.wp-block-gallery, ul.blocks-gallery-grid, figure.wp-block-gallery.has-nested-images, div.wp-block-jetpack-tiled-gallery, a.single-image-gallery",u=".gallery-item, .tiled-gallery-item, .blocks-gallery-item, .tiled-gallery__item",d=u+", .wp-block-image",p={},m="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.stat?wpcom.carousel.stat:t.noop,g="undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.pageview?wpcom.carousel.pageview:t.noop;function h(t){if(!s)switch(t.which){case 38:t.preventDefault(),p.overlay.scrollTop-=100;break;case 40:t.preventDefault(),p.overlay.scrollTop+=100;break;case 39:t.preventDefault(),e.slideNext();break;case 37:case 8:t.preventDefault(),e.slidePrev();break;case 27:t.preventDefault(),k()}}function f(){s=!0}function v(){s=!1}function y(e){e.role="button",e.tabIndex=0,e.ariaLabel=jetpackCarouselStrings.image_label}function w(){p.overlay||(p.overlay=document.querySelector(".jp-carousel-overlay"),p.container=p.overlay.querySelector(".jp-carousel-wrap"),p.gallery=p.container.querySelector(".jp-carousel"),p.info=p.overlay.querySelector(".jp-carousel-info"),p.caption=p.info.querySelector(".jp-carousel-caption"),p.commentField=p.overlay.querySelector("#jp-carousel-comment-form-comment-field"),p.emailField=p.overlay.querySelector("#jp-carousel-comment-form-email-field"),p.authorField=p.overlay.querySelector("#jp-carousel-comment-form-author-field"),p.urlField=p.overlay.querySelector("#jp-carousel-comment-form-url-field"),window.innerWidth<=760&&Math.round(window.innerWidth/760*110)<40&&r.isTouch(),[p.commentField,p.emailField,p.authorField,p.urlField].forEach(function(e){e&&(e.addEventListener("focus",f),e.addEventListener("blur",v))}),p.overlay.addEventListener("click",function(e){var t,o,a=e.target,i=!!r.closest(a,".jp-carousel-close-hint"),n=!!window.matchMedia("(max-device-width: 760px)").matches;a===p.overlay?n||k():i?k():a.classList.contains("jp-carousel-image-download")?m("download_original_click"):a.classList.contains("jp-carousel-comment-login")?(t=p.currentSlide,o=t?t.attrs.attachmentId:"0",window.location.href=jetpackCarouselStrings.login_url+"%23jp-carousel-"+o):r.closest(a,"#jp-carousel-comment-form-container")?function(e){var t=e.target,o=r.getJSONAttribute(p.container,"data-carousel-extra")||{},a=p.currentSlide.attrs.attachmentId,i=document.querySelector("#jp-carousel-comment-form-submit-and-info-wrapper"),n=document.querySelector("#jp-carousel-comment-form-spinner"),l=document.querySelector("#jp-carousel-comment-form-button-submit"),s=document.querySelector("#jp-carousel-comment-form");if(p.commentField&&p.commentField.getAttribute("id")===t.getAttribute("id"))f(),r.show(i);else if(r.matches(t,'input[type="submit"]')){e.preventDefault(),e.stopPropagation(),r.show(n),s.classList.add("jp-carousel-is-disabled");var c={action:"post_attachment_comment",nonce:jetpackCarouselStrings.nonce,blog_id:o.blog_id,id:a,comment:p.commentField.value};if(!c.comment.length)return void j(jetpackCarouselStrings.no_comment_text,!1);if(1!==Number(jetpackCarouselStrings.is_logged_in)&&(c.email=p.emailField.value,c.author=p.authorField.value,c.url=p.urlField.value,1===Number(jetpackCarouselStrings.require_name_email))){if(!c.email.length||!c.email.match("@"))return void j(jetpackCarouselStrings.no_comment_email,!1);if(!c.author.length)return void j(jetpackCarouselStrings.no_comment_author,!1)}var u=new XMLHttpRequest;u.open("POST",jetpackCarouselStrings.ajaxurl,!0),u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),u.onreadystatechange=function(){if(this.readyState===XMLHttpRequest.DONE&&this.status>=200&&this.status<300){var e;try{e=JSON.parse(this.response)}catch{return void j(jetpackCarouselStrings.comment_post_error,!1)}"approved"===e.comment_status?j(jetpackCarouselStrings.comment_approved,!0):"unapproved"===e.comment_status?j(jetpackCarouselStrings.comment_unapproved,!0):j(jetpackCarouselStrings.comment_post_error,!1),T(),E(a),l.value=jetpackCarouselStrings.post_comment,r.hide(n),s.classList.remove("jp-carousel-is-disabled")}else j(jetpackCarouselStrings.comment_post_error,!1)};var d=[];for(var m in c)if(m){var g=encodeURIComponent(m)+"="+encodeURIComponent(c[m]);d.push(g.replace(/%20/g,"+"))}var h=d.join("&");u.send(h)}}(e):(r.closest(a,".jp-carousel-photo-icons-container")||a.classList.contains("jp-carousel-photo-title"))&&function(e){e.preventDefault();var t=e.target,o=p.info.querySelector(".jp-carousel-info-extra"),a=p.info.querySelector(".jp-carousel-image-meta"),i=p.info.querySelector(".jp-carousel-comments-wrapper"),n=p.info.querySelector(".jp-carousel-icon-info"),l=p.info.querySelector(".jp-carousel-icon-comments");function s(){l&&l.classList.remove("jp-carousel-selected"),n.classList.toggle("jp-carousel-selected"),i&&i.classList.remove("jp-carousel-show"),a&&(a.classList.toggle("jp-carousel-show"),a.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}function c(){n&&n.classList.remove("jp-carousel-selected"),l.classList.toggle("jp-carousel-selected"),a&&a.classList.remove("jp-carousel-show"),i&&(i.classList.toggle("jp-carousel-show"),i.classList.contains("jp-carousel-show")?o.classList.add("jp-carousel-show"):o.classList.remove("jp-carousel-show"))}(r.closest(t,".jp-carousel-icon-info")||t.classList.contains("jp-carousel-photo-title"))&&(a&&a.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,s):(s(),r.scrollToElement(p.info,p.overlay))),r.closest(t,".jp-carousel-icon-comments")&&(i&&i.classList.contains("jp-carousel-show")?r.scrollToElement(p.overlay,p.overlay,c):(c(),r.scrollToElement(p.info,p.overlay)))}(e)}),window.addEventListener("keydown",h),p.overlay.addEventListener("jp_carousel.afterOpen",function(){v(),p.slides.length<=1||(p.slides.length<=5?r.show(p.info.querySelector(".jp-swiper-pagination")):r.show(p.info.querySelector(".jp-carousel-pagination")))}),p.overlay.addEventListener("jp_carousel.beforeClose",function(){f(),document.documentElement.style.removeProperty("height"),e&&e.enable(),r.hide(p.info.querySelector(".jp-swiper-pagination")),r.hide(p.info.querySelector(".jp-carousel-pagination"))}),p.overlay.addEventListener("jp_carousel.afterClose",function(){window.history.pushState?history.pushState("",document.title,window.location.pathname+window.location.search):window.location.href="",l="",p.isOpen=!1}),p.overlay.addEventListener("touchstart",function(e){e.touches.length>1&&e.preventDefault()}))}function j(e,t){var o=p.overlay.querySelector("#jp-carousel-comment-post-results"),a="jp-carousel-comment-post-"+(t?"success":"error");o.innerHTML=''+e+"",r.hide(p.overlay.querySelector("#jp-carousel-comment-form-spinner")),p.overlay.querySelector("#jp-carousel-comment-form").classList.remove("jp-carousel-is-disabled"),r.show(o)}function b(){var e=document.querySelectorAll("a img[data-attachment-id]");Array.prototype.forEach.call(e,function(e){var t=e.parentElement,o=t.parentElement;if(!o.classList.contains("gallery-icon")&&!r.closest(o,u)&&t.hasAttribute("href")){var a=!1;t.getAttribute("href").split("?")[0]===e.getAttribute("data-orig-file").split("?")[0]&&1===Number(jetpackCarouselStrings.single_image_gallery_media_file)&&(a=!0),t.getAttribute("href")===e.getAttribute("data-permalink")&&(a=!0),a&&(y(e),t.classList.add("single-image-gallery"),t.setAttribute("data-carousel-extra",JSON.stringify({blog_id:Number(jetpackCarouselStrings.blog_id)})))}})}function S(t,r){p.isOpen?(L(r),e.slideTo(r+1)):M(t,{startIndex:r})}function L(e){(!e||e<0||e>p.slides.length)&&(e=0),p.currentSlide=p.slides[e];var o,a,i=p.currentSlide,n=i.attrs.attachmentId;C(p.slides[e]),function(e){var t=[],r=p.slides.length;if(r>1){var o=e>0?e-1:r-1;t.push(o);var a=e

##### "+jetpackCarouselStrings[o]+"

"+a+""}}t.innerHTML=r,t.style.removeProperty("display")}(p.slides[e].attrs.imageMeta),function(e){if(!e)return!1;var r,o=[e.attrs.origWidth,e.attrs.origHeight],a=document.createElement("a");a.href=e.attrs.src.replace(/\?.+$/,""),r=null!==a.hostname.match(/^i[\d]{1}\.wp\.com$/i)?a.href:e.attrs.origFile.replace(/\?.+$/,"");var i=p.info.querySelector(".jp-carousel-download-text"),n=p.info.querySelector(".jp-carousel-image-download");i.innerHTML=t.applyReplacements(jetpackCarouselStrings.download_original,o),n.setAttribute("href",r),n.style.removeProperty("display")}(i),1===Number(jetpackCarouselStrings.display_comments)&&(o=p.slides[e].attrs.commentsOpened,a=p.info.querySelector("#jp-carousel-comment-form-container"),1===parseInt(o,10)?r.fadeIn(a):r.fadeOut(a),E(n),r.hide(p.info.querySelector("#jp-carousel-comment-post-results")));var s=p.info.querySelector(".jp-carousel-pagination");if(s&&p.slides.length>5){var c=e+1;s.innerHTML=""+c+" / "+p.slides.length+""}jetpackCarouselStrings.stats&&p.isOpen&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+jetpackCarouselStrings.stats+"&post="+encodeURIComponent(n)+"&rand="+Math.random()),p.isOpen&&g(n),l="#jp-carousel-"+n,window.location.hash=l}function k(){document.body.style.overflow=a,document.documentElement.style.overflow=i,T(),f(),r.emitEvent(p.overlay,"jp_carousel.beforeClose"),window.scrollTo(window.scrollX||window.pageXOffset||0,n||0),p.isOpen=!1,e.destroy(),p.slides=[],p.currentSlide=void 0,p.gallery.innerHTML="",r.fadeOut(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterClose")})}function x(e){if("object"!=typeof e&&(e={}),void 0===e.origFile)return"";if(void 0===e.origWidth||void 0===e.maxWidth)return e.origFile;if(void 0===e.largeFile)return e.origFile;var t=document.createElement("a");t.href=e.largeFile;var r=/^i[0-2]\.wp\.com$/i.test(t.hostname),o=function(e,t,r){var o,a=r?e.replace(/.*=([\d]+%2C[\d]+).*$/,"$1"):e.replace(/.*-([\d]+x[\d]+)\..+$/,"$1");return"9999"===(o=a!==e?r?a.split("%2C"):a.split("x"):[t,0])[0]&&(o[0]="0"),"9999"===o[1]&&(o[1]="0"),o}(e.largeFile,e.origWidth,r),a=parseInt(o[0],10),i=parseInt(o[1],10);if(e.origMaxWidth=e.maxWidth,e.origMaxHeight=e.maxHeight,void 0!==window.devicePixelRatio&&window.devicePixelRatio>1&&(e.maxWidth=e.maxWidth*window.devicePixelRatio,e.maxHeight=e.maxHeight*window.devicePixelRatio),a>=e.maxWidth||i>=e.maxHeight)return e.largeFile;if(r){if(-1===e.largeFile.lastIndexOf("?"))return e.largeFile;var n=function(e){var t;try{t=new URL(e)}catch(t){return e}var r=["quality","ssl","filter","brightness","contrast","colorize","smooth"],o=Array.from(t.searchParams.entries());return t.search="",o.forEach(([e,o])=>{r.includes(e)&&t.searchParams.append(e,o)}),t}(e.largeFile);return(e.origWidth>e.maxWidth||e.origHeight>e.maxHeight)&&(e.origMaxWidth=2*e.maxWidth,e.origMaxHeight=2*e.maxHeight,n.searchParams.set("fit",e.origMaxWidth+","+e.origMaxHeight)),n.toString()}return e.origFile}function q(e){return e>=1?Math.round(10*e)/10+"s":"1/"+Math.round(1/e)+"s"}function A(e){return!e.match(" ")&&e.match("_")?"":e}function E(e,t){var a=void 0===t,i=p.info.querySelector(".jp-carousel-icon-comments .jp-carousel-has-comments-indicator");if(i.classList.remove("jp-carousel-show"),clearInterval(o),e){(!t||t<1)&&(t=0);var n=p.info.querySelector(".jp-carousel-comments"),l=p.info.querySelector("#jp-carousel-comments-loading");r.show(l),a&&(r.hide(n),n.innerHTML="");var s=new XMLHttpRequest,c=jetpackCarouselStrings.ajaxurl+"?action=get_attachment_comments&nonce="+jetpackCarouselStrings.nonce+"&id="+e+"&offset="+t;s.open("GET",c),s.setRequestHeader("X-Requested-With","XMLHttpRequest");var u=function(){r.fadeIn(n),r.fadeOut(l)};s.onload=function(){if(p.currentSlide&&p.currentSlide.attrs.attachmentId===e){var c,d=s.status>=200&&s.status<300;try{c=JSON.parse(s.responseText)}catch{}if(!d||!c||!Array.isArray(c))return u();a&&(n.innerHTML="");for(var m=0;m'+g.gravatar_markup+'
'+g.author_markup+'
'+g.date_gmt+"
"+g.content+"
",n.appendChild(h),clearInterval(o),o=setInterval(function(){p.container.scrollTop+150>window.innerHeight&&(E(e,t+10),clearInterval(o))},300)}c.length>0&&(r.show(n),i.innerText=c.length,i.classList.add("jp-carousel-show")),r.hide(l)}},s.onerror=u,s.send()}}function C(e){var t=e.el,r=e.attrs,o=t.querySelector("img");if(!o.hasAttribute("data-loaded")){var a=!!r.previewImage,i=r.thumbSize;!a||i&&t.offsetWidth>i.width?o.src=r.src:o.src=r.previewImage,o.setAttribute("itemprop","image"),o.setAttribute("data-loaded",1)}}function _(t){var r=t.el;e&&e.slides&&(r=e.slides[e.activeIndex]);var o=t.attrs.originalElement;o.complete&&0!==o.naturalHeight?H(t,r,o):o.onload=function(){H(t,r,o)}}function H(e,r,o){var a=t.getBackgroundImage(o);e.backgroundImage=a,r.style.backgroundImage="url("+a+")",r.style.backgroundSize="cover"}function T(){p.commentField&&(p.commentField.value="")}function I(e,o){p.slides=[];var a={width:window.innerWidth,height:window.innerHeight-64};0!==o&&null!==e[o].getAttribute("data-gallery-src")&&((new Image).src=e[o].getAttribute("data-gallery-src"));var i=!!r.closest(e[0],".tiled-gallery.type-rectangular");Array.prototype.forEach.call(e,function(e,o){var n=r.closest(e,"a"),l=e.getAttribute("data-orig-file")||e.getAttribute("src-orig"),s=e.getAttribute("data-attachment-id")||e.getAttribute("data-id")||"0",c=document.querySelector('img[data-attachment-id="'+s+'"] + figcaption');c=c?c.innerHTML:e.getAttribute("data-image-caption");var u={originalElement:e,attachmentId:s,commentsOpened:e.getAttribute("data-comments-opened")||"0",imageMeta:r.getJSONAttribute(e,"data-image-meta")||{},title:e.getAttribute("data-image-title")||"",desc:e.getAttribute("data-image-description")||"",largeFile:e.getAttribute("data-large-file")||"",origFile:l||"",thumbSize:{width:e.naturalWidth,height:e.naturalHeight},caption:c||"",permalink:n&&n.getAttribute("href"),src:l||e.getAttribute("src")||""},d=r.closest(e,".tiled-gallery-item"),m=d&&d.querySelector(".tiled-gallery-caption"),g=m&&m.innerHTML;g&&(u.caption=g);var h=function(e){var t=e.getAttribute("data-orig-size")||"";if(t){var r=t.split(",");return{width:parseInt(r[0],10),height:parseInt(r[1],10)}}return{width:e.getAttribute("data-original-width")||e.getAttribute("width")||void 0,height:e.getAttribute("data-original-height")||e.getAttribute("height")||void 0}}(e);if(u.origWidth=h.width||u.thumbSize.width,u.origHeight=h.height||u.thumbSize.height,"undefined"!=typeof wpcom&&wpcom.carousel&&wpcom.carousel.generateImgSrc?u.src=wpcom.carousel.generateImgSrc(e,a):u.src=x({origFile:u.src,origWidth:u.origWidth,origHeight:u.origHeight,maxWidth:a.width,maxHeight:a.height,largeFile:u.largeFile}),e.setAttribute("data-gallery-src",u.src),"0"!==u.attachmentId){u.title=t.texturize(u.title),u.desc=t.texturize(u.desc),u.caption=t.texturize(u.caption);var f=new Image,v=document.createElement("div");v.classList.add("swiper-slide"),v.setAttribute("itemprop","associatedMedia"),v.setAttribute("itemscope",""),v.setAttribute("itemtype","https://schema.org/ImageObject");var y=document.createElement("div");y.classList.add("swiper-zoom-container"),p.gallery.appendChild(v),v.appendChild(y),y.appendChild(f),v.setAttribute("data-attachment-id",u.attachmentId),v.setAttribute("data-permalink",u.permalink),v.setAttribute("data-orig-file",u.origFile),i&&(u.previewImage=u.src);var w={el:v,attrs:u,index:o};p.slides.push(w)}})}function M(e,t){if(!window.JetpackSwiper){var o=document.querySelector("#jp-carousel-loading-overlay");r.show(o);var a=document.createElement("script");return a.id="jetpack-carousel-swiper-js",a.src=window.jetpackSwiperLibraryPath.url,a.async=!0,a.onload=function(){r.hide(o),F(e,t)},a.onerror=function(){r.hide(o)},void document.head.appendChild(a)}F(e,t)}function F(t,o){var l,s={imgSelector:".gallery-item [data-attachment-id], .tiled-gallery-item [data-attachment-id], img[data-attachment-id], img[data-id]",startIndex:0},c=r.getJSONAttribute(t,"data-carousel-extra");if(!c)return;const u=t.querySelectorAll(s.imgSelector);if(u.length&&(w(),!p.isOpen)){for(var d in p.isOpen=!0,a=getComputedStyle(document.body).overflow,document.body.style.overflow="hidden",i=getComputedStyle(document.documentElement).overflow,document.documentElement.style.overflow="hidden",n=window.scrollY||window.pageYOffset||0,p.container.setAttribute("data-carousel-extra",JSON.stringify(c)),m(["open","view_image"]),o||{})s[d]=o[d];-1===s.startIndex&&(s.startIndex=0),r.emitEvent(p.overlay,"jp_carousel.beforeOpen"),p.gallery.innerHTML="",p.overlay.style.opacity=1,p.overlay.style.display="block",I(u,s.startIndex),(e=new window.JetpackSwiper(".jp-carousel-swiper-container",{centeredSlides:!0,zoom:!0,loop:p.slides.length>1,enabled:p.slides.length>1,pagination:{el:".jp-swiper-pagination",clickable:!0},navigation:{nextEl:".jp-swiper-button-next",prevEl:".jp-swiper-button-prev"},initialSlide:s.startIndex,on:{init:function(){L(s.startIndex)}},preventClicks:!1,preventClicksPropagation:!1,preventInteractionOnTransition:!r.isTouch(),threshold:5})).on("slideChange",function(e){p.isOpen&&(L(e.realIndex),p.overlay.classList.remove("jp-carousel-hide-controls"))}),e.on("zoomChange",function(e,t){t>1&&p.overlay.classList.add("jp-carousel-hide-controls"),1===t&&p.overlay.classList.remove("jp-carousel-hide-controls")}),e.on("doubleTap",function(e){if(clearTimeout(l),1===e.zoom.scale)var t=setTimeout(function(){p.overlay.classList.remove("jp-carousel-hide-controls"),clearTimeout(t)},150)}),e.on("tap",function(){e.zoom.scale>1&&(l=setTimeout(function(){p.overlay.classList.toggle("jp-carousel-hide-controls")},150))}),r.fadeIn(p.overlay,function(){r.emitEvent(p.overlay,"jp_carousel.afterOpen")})}}function O(e){if("click"!==e.type){if("keydown"===e.type){const t=document.activeElement.parentElement,r=t&&t.classList.contains("tiled-gallery__item");" "!==e.key&&"Enter"!==e.key||!r||N(e)}}else N(e)}function W(e){var t=e.parentElement,o=t.parentElement,a=null;return o&&o.classList.contains("wp-block-image")?a=t.getAttribute("href"):t&&t.classList.contains("wp-block-image")&&t.querySelector(":scope > a")&&(a=t.querySelector(":scope > a").getAttribute("href")),!(a&&a.split("?")[0]!==e.getAttribute("data-orig-file").split("?")[0]&&a!==e.getAttribute("data-permalink")||t.classList.contains("gallery-caption")||r.matches(t,"figcaption"))}function N(e){if(window.CSS&&window.CSS.supports&&window.CSS.supports("display","grid")){var t,o=e.target,a=r.closest(o,c);if(a){if(!(t=a)||!t.getAttribute("data-carousel-extra"))return;if(!W(o))return;document.documentElement.style.height="auto",e.preventDefault(),e.stopPropagation();var i=r.closest(o,d),n=Array.prototype.indexOf.call(a.querySelectorAll(d),i);M(a,{startIndex:n})}}}document.body.addEventListener("click",O),document.body.addEventListener("keydown",O),document.querySelectorAll(u+"img").forEach(function(e){W(e)&&y(e)}),1===Number(jetpackCarouselStrings.single_image_gallery)&&(b(),document.body.addEventListener("is.post-load",function(){b()})),window.addEventListener("hashchange",function(){var e=/jp-carousel-(\d+)/;if(window.location.hash&&e.test(window.location.hash)){if(window.location.hash!==l||!p.isOpen)if(window.location.hash&&p.gallery&&!p.isOpen&&history.back)history.back();else{l=window.location.hash;for(var t=window.location.hash.match(e),r=parseInt(t[1],10),o=document.querySelectorAll(c),a=0;a