!function(){"use strict";function t(t){if(!t)return{};const e=["auto","instant","lazy","manual"];let a=t.dataset.hrStrategy;a&&(e.includes(a)||(console.warn("Happy React:",`Cannot find strategy ${a}. "auto" strategy applied. Learn more here: https://happyreact.com/docs/configuration/strategy`),a="auto"));let o={};if(t.dataset.hrClasses||t.dataset.hrStyles)try{o=JSON.parse(t.dataset.hrClasses||t.dataset.hrStyles)}catch(t){console.warn("Happy React:",`Cannot parse styles. ${t}`)}return{token:t.dataset.hrToken,resourceId:String(t.dataset.hrResource).replace(/\//g,"-"),strategy:a??"auto",styles:o}}let e=window.HappyReact;const a=()=>{if(!e.isScriptAttached)try{e.isScriptAttached=!0;const t=document.createElement("link");t.rel="stylesheet",t.href="proxy.php?url=https://app.happyreact.com/widget/bundle.css";const a=document.createElement("script");a.src="proxy.php?url=https://app.happyreact.com/widget/bundle.js",a.defer=!0,document.body.append(a,t),"function"==typeof e.onLoad&&e.onLoad()}catch(t){e.isScriptAttached=!1,"function"==typeof e.onError&&e.onError(),console.error("Cannot attach script. Learn more here: ")}},o=()=>{try{const t=new IntersectionObserver((([t])=>{t.isIntersecting&&a()}),{root:null,rootMargin:"50px",threshold:.1});t.observe(e.element),window.onunload=()=>{window.removeEventListener("DOMContentLoaded",o),e.element&&t.unobserve(e.element)}}catch(t){throw new Error("Cannot attach observer.")}},n=(a={})=>{const o=document.querySelector("[data-hr-token]");window.HappyReact={element:o,init:n,config:t(o),isScriptAttached:!1,isLoaded:!1,onLoad:a.onLoad??void 0,onError:a.onError??void 0,onReactionsLimitReached:a.onReactionsLimitReached??void 0,onReaction:a.onReaction??void 0},e=window.HappyReact,r(window.HappyReact.config.strategy)},r=t=>{switch(t){case"auto":try{o()}catch(t){"requestIdleCallback"in window?requestIdleCallback(a):a()}break;case"instant":a();break;case"lazy":try{o()}catch(t){a()}}};n()}();