(()=>{"use strict";function e(e){return e.pathname.split("/").filter(Boolean)}function t(e){return(e||"").toLowerCase()}const o=[{type:"phone",schemes:["tel:"]},{type:"email",schemes:["mailto:"]},{type:"sms",schemes:["sms:","smsto:"]},{type:"whatsapp",schemes:["whatsapp:"],hosts:["wa.me","api.whatsapp.com","web.whatsapp.com"],hasRecipient:o=>{if("wa.me"===o.hostname){const[n,i]=e(o);return/^\d+$/.test(n||"")||["message","qr"].includes(t(n))&&!!i}return!!o.searchParams.get("phone")}},{type:"messenger",schemes:["fb-messenger:"],hosts:["m.me","messenger.com"],hasRecipient:o=>{if("m.me"===o.hostname)return e(o).length>0;if("messenger.com"===o.hostname){const[n,i]=e(o);return"t"===t(n)&&!!i}return["user-thread","user"].includes(o.hostname)}},{type:"telegram",schemes:["tg:"],hosts:["t.me","telegram.me"],hasRecipient:o=>{if("tg:"===o.protocol)return"resolve"===o.hostname&&!!o.searchParams.get("domain");const[n]=e(o);return!!n&&!n.startsWith("+")&&!["share","joinchat","addstickers","proxy"].includes(t(n))}},{type:"viber",schemes:["viber:"],hasRecipient:e=>["chat","add","pa"].includes(e.hostname)},{type:"signal",schemes:["sgnl:"],hosts:["signal.me"],hasRecipient:e=>"sgnl:"===e.protocol||e.hash.startsWith("#p/")&&e.hash.length>3},{type:"line",schemes:["line:"],hosts:["line.me","page.line.me"],hasRecipient:o=>{if("page.line.me"===o.hostname)return e(o).length>0;const n="line:"===o.protocol?[o.hostname,...e(o)]:e(o),[i,s,r,a]="r"===t(n[0])?n.slice(1):n;return"ti"===t(i)&&"p"===t(s)&&!!r&&!a}}],n=Object.create(null),i=Object.create(null);o.forEach(e=>{e.schemes?.forEach(t=>{n[t]=e}),e.hosts?.forEach(t=>{i[t]=e})});const s=["sponsored","ugc","nofollow"];function r(e){return"http:"===e.protocol||"https:"===e.protocol?{transport_type:"beacon"}:{}}const a="a.post-page-numbers";function l(e){try{const t=new URL(e.href);for(const e of["page","paged"]){const o=parseInt(t.searchParams.get(e)||"",10);if(o>0)return o}const o=t.pathname.split("/").filter(Boolean).pop()||"";if(/^\d+$/.test(o)){const e=parseInt(o,10);if(e>0)return e}}catch{}const t=parseInt(e.textContent?.trim()||"",10);return t>0?t:1}const c="https://player.vimeo.com/api/player.js",h="data-googlesitekit-vimeo-sdk";function m(){return globalThis.Vimeo}function d(e,t){return new Promise((o,n)=>{let i;function s(e){return(...t)=>{clearTimeout(i),e(...t)}}e.addEventListener("load",s(()=>o()),{once:!0}),e.addEventListener("error",s(()=>n(new Error("Site Kit: failed to load the Vimeo Player SDK script."))),{once:!0}),void 0!==t&&(i=setTimeout(s(()=>n(new Error("Site Kit: timed out waiting for the Vimeo Player SDK script to load."))),t))})}let u=null;const g=[10,25,50,75];function p(e,t){try{e()}catch(e){console.error(...t?[t,e]:[e])}}const f={postID:0,isReadableSinglePost:!1,hasVimeoEmbed:!1,wordCount:0,estimatedReadTimeSeconds:0,isLastPageOfMultiPagePost:!1,readTimeThresholdPercent:85,minimumReadTimeSeconds:5,...globalThis._googlesitekit?.contentEvents||{}};!async function(e){if(!e.hasVimeoEmbed)return;const t=globalThis.document.querySelectorAll('iframe[src*="player.vimeo.com"]');if(t.length)try{const e=await function(){const e=m();return"function"==typeof e?.Player?Promise.resolve(e.Player):(u||(u=async function(){const e=globalThis.document.querySelector(`script[src^="${c}"]`);if(e&&!e.hasAttribute(h))return void await d(e,1e4);e?.remove();const t=globalThis.document.createElement("script");t.src=c,t.setAttribute(h,"");const o=d(t);globalThis.document.head.appendChild(t),await o}().then(()=>{const e=m()?.Player;if("function"!=typeof e)throw new Error("Site Kit: the Vimeo Player SDK script did not expose Vimeo.Player.");return e}).catch(e=>{throw u=null,e})),u)}();await Promise.allSettled(Array.from(t).map(async(t,o)=>{await async function(e,t){const o=Promise.all([e.getVideoTitle(),e.getVideoUrl()]).then(([e,o])=>({video_provider:"vimeo",video_title:e,video_url:o,video_instance_index:t}));function n(e,t){o.then(o=>{globalThis._googlesitekit?.gtagEvent?.(e,{...o,video_percent:t})}).catch(()=>{})}o.catch(e=>{console.error("Site Kit: failed to fetch this Vimeo video’s title/URL; its engagement events will not be tracked.",e)});let i=!1,s=!1;const r=new Set;e.on("play",()=>{i||(i=!0,n("video_start",0))}),e.on("timeupdate",e=>{if(r.size===g.length)return;const t=Math.floor(100*e.percent);g.forEach(e=>{t>=e&&!r.has(e)&&(r.add(e),n("video_progress",e))})}),e.on("ended",()=>{s||(s=!0,n("video_complete",100))}),await o}(new e(t),o)}))}catch(e){console.error("Site Kit: failed to load the Vimeo Player SDK; video engagement events will not be tracked on this page.",e)}}(f),p(()=>function(e){globalThis.document.addEventListener("click",t=>{try{if(!(t.target instanceof Element))return;const o=t.target.closest(`${a}, body.single-topic .bbp-pagination-links a.page-numbers`);if(!o)return;const n=o.matches(a)?"post":"bbpress";globalThis._googlesitekit?.gtagEvent?.("pagination_click",{pagination_type:n,page_number:l(o),post_id:e.postID,transport_type:"beacon"})}catch(e){console.error("Site Kit: failed to track this pagination click.",e)}})}(f),"Site Kit: failed to initialize pagination click tracking."),p(()=>{globalThis.document.addEventListener("click",e=>{try{if(!(e.target instanceof Element))return;const t=e.target.closest("a[href]");if(!t)return;let o;try{o=new URL(t.href)}catch{return}const a=function(e){const t=new URL(e),o="http:"===t.protocol||"https:"===t.protocol;t.hostname=o?t.hostname.replace(/^www\./,""):t.hostname.toLowerCase();const s=o?i[t.hostname]:n[t.protocol];return s?s.hasRecipient?s.hasRecipient(t)?s.type:null:s.type:null}(o);if(a)globalThis._googlesitekit?.gtagEvent?.("contact_link_click",{link_type:a,...r(o)});else{const e=function(e,t){if("http:"!==t.protocol&&"https:"!==t.protocol||t.hostname===globalThis.location.hostname)return null;const o=new Set((e.getAttribute("rel")||"").toLowerCase().split(/[\s,]+/).filter(Boolean));return s.filter(e=>o.has(e)).join(" ")||null}(t,o);e&&globalThis._googlesitekit?.gtagEvent?.("outbound_link_click",{link_rel:e,link_url:o.href,link_domain:o.hostname,...r(o)})}}catch(e){console.error("Site Kit: failed to track this link click.",e)}})},"Site Kit: failed to initialize link click tracking."),p(()=>function(e){const{postID:t,isReadableSinglePost:o,isLastPageOfMultiPagePost:n,wordCount:i,estimatedReadTimeSeconds:s,readTimeThresholdPercent:r,minimumReadTimeSeconds:a}=e;if(!o||!n)return;const l=1e3*Math.max(a,s*r/100);let c=!1,h=!1,m=null,d=null,u=0,g=0;function p(){if(c&&h){try{globalThis._googlesitekit?.gtagEvent?.("read_article",{post_id:t,word_count:i,estimated_read_time_seconds:s})}catch(e){console.error("Site Kit: failed to send the read article event.",e)}f(),T(),globalThis.removeEventListener("blur",y),globalThis.removeEventListener("focus",y),globalThis.document.removeEventListener("visibilitychange",y)}}function f(){m?.disconnect(),m=null,globalThis.removeEventListener("scroll",v)}function b(){c=!0,f(),p()}function v(){(globalThis.scrollY+globalThis.innerHeight)/globalThis.document.documentElement.scrollHeight>=.9&&b()}function T(){null!==d&&(globalThis.clearTimeout(d),d=null,u+=globalThis.performance.now()-g)}function y(){"hidden"!==globalThis.document.visibilityState&&globalThis.document.hasFocus()?h||null!==d||(g=globalThis.performance.now(),d=globalThis.setTimeout(()=>{d=null,h=!0,p()},l-u)):T()}const w=function(){const e=globalThis.document.createTreeWalker(globalThis.document.body,globalThis.NodeFilter.SHOW_COMMENT);for(;e.nextNode();){const t=e.currentNode;if("[googlesitekit-end-of-content]"!==t.data)continue;let o=t.previousElementSibling;for(;o&&0===o.getClientRects().length;)o=o.previousElementSibling;return o||t.parentElement}return null}();w&&"function"==typeof globalThis.IntersectionObserver?(m=new globalThis.IntersectionObserver(e=>{e.some(e=>!e.isIntersecting&&e.rootBounds&&e.boundingClientRect.bottom<=e.rootBounds.top)&&b()},{rootMargin:"-100% 0px 1000000px 0px"}),"complete"===globalThis.document.readyState?m.observe(w):globalThis.addEventListener("load",()=>m?.observe(w),{once:!0})):(globalThis.addEventListener("scroll",v,{passive:!0}),v()),globalThis.addEventListener("blur",y),globalThis.addEventListener("focus",y),globalThis.document.addEventListener("visibilitychange",y),y()}(f),"Site Kit: failed to initialize read article tracking.")})();