1!function(){function t(t,n={}){const i=Math.floor(Date.now()/1e3-t),e=Math.floor(i/60),s=Math.floor(e/60);return n.hide_exact_time_enabled&&n.hide_exact_time_after_hours&&s>n.hide_exact_time_after_hours?"recently":i<60?i<=10?"just now":`${i} seconds ago`:e<60?1===e?"1 minute ago":`${e} minutes ago`:s<24?1===s?"1 hour ago":`${s} hours ago`:n.hide_exact_time_enabled?"recently":new Date(1e3*t).toLocaleDateString()}function n(n,i){let e;e=n.image_url?`<img src="${n.image_url}" alt="Booster image" />`:i.map_image_url&&n.show_map_icon?`<img src="${i.map_image_url}" alt="Location map" />`:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path fill-rule="evenodd" d="M11.54 22.351l.07.04.028.016a.76.76 0 00.723 0l.028-.015.071-.041a16.975 16.975 0 001.144-.742 19.58 19.58 0 002.683-2.282c1.944-1.99 3.963-4.98 3.963-8.827a8.25 8.25 0 00-16.5 0c0 3.846 2.02 6.837 3.963 8.827a19.58 19.58 0 002.682 2.282 16.975 16.975 0 001.145.742z" clip-rule="evenodd" />\n </svg>';let s=n.show_as_anonymous?"Someone":i.name.trim();if(s.includes(" ")){const t=s.split(" "),n=t.pop();s=[...t,`${n.charAt(0)}.`].join(" ")}const o=i.location&&"somewhere"!==i.location?`${s} from ${i.location}`:s,a=n.message?n.message.replace(/<(\/?(?:b|strong))>/g,"<$1>"):"Signed up",r="square"===n.notification_theme,c=n.title_color||"#15803d";return`\n <div class="cfcb-notification-card" style="--notification-radius: ${r?"0.5rem":"9999px"}; --icon-radius: ${r?"0.5rem":"9999px"}; --title-color: ${c}; --icon-bg-color: ${c+"1A"};">\n <div class="${i.image_url||i.map_image_url&&n.show_map_icon?"cfcb-flex-shrink-0":"cfcb-location-icon"}" style="align-self: center;">\n ${e}\n </div>\n <div class="cfcb-notification-content">\n <div class="cfcb-notification-title">\n ${o}\n </div>\n <div class="cfcb-notification-subtitle">\n <div class="cfcb-notification-subtitle-text">\n <span class="cfcb-message">${a}</span>\n </div>\n <div class="cfcb-verified-status-line">\n <span class="cfcb-time-ago">${t(i.timestamp,n)}</span>\n ${i.verified?'\n <div class="cfcb-verified-badge">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path fill-rule="evenodd" d="M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.007 6.387a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" />\n </svg>\n verified\n </div>\n ':""}\n </div>\n </div>\n </div>\n <button class="cfcb-close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z" clip-rule="evenodd" />\n </svg>\n </button>\n </div>\n `}function i(n,i){return`\n <div class="notification-card">\n <div class="w-12 h-12">\n <span class="text-pink-500">\n ${i.visitor_count}\n </span>\n </div>\n <div class="notification-content">\n <div class="notification-title">\n ${i.visitor_count} ${n.visitor_alias||"people"}\n </div>\n <div class="notification-subtitle">\n <div class="notification-subtitle-text">\n <span class="message">are viewing ${n.show_for_full_domain?"this site":"this page"}</span>\n </div>\n <div class="verified-status-line">\n ${t(i.timestamp,n)}\n ${i.verified?'\n <div class="verified-badge">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path fill-rule="evenodd" d="M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75
1a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.007 6.387a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" />\n </svg>\n verified\n </div>\n ':""}\n </div>\n </div>\n </div>\n <button class="close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z" clip-rule="evenodd" />\n </svg>\n </button>\n </div>\n `}function e(n,i){return`\n <div class="cfcb-notification-card">\n <div class="cfcb-large-icon-container">\n ${n.image_url?`\n <img src="${n.image_url}" alt="Booster image" style="width: 100%; height: 100%; object-fit: cover; border-radius: inherit;">\n `:'\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" style="width: 2rem; height: 2rem;">\n <path fill-rule="evenodd" d="M1.5 6a2.25 2.25 0 012.25-2.25h16.5A2.25 2.25 0 0122.5 6v12a2.25 2.25 0 01-2.25 2.25H3.75A2.25 2.25 0 011.5 18V6zM3 16.06V18c0 .414.336.75.75.75h16.5A.75.75 0 0021 18v-1.94l-2.69-2.689a1.5 1.5 0 00-2.12 0l-.88.879.97.97a.75.75 0 11-1.06 1.06l-5.16-5.159a1.5 1.5 0 00-2.12 0L3 16.061zm10.125-7.81a1.125 1.125 0 112.25 0 1.125 1.125 0 01-2.25 0z" clip-rule="evenodd" />\n </svg>\n '}\n </div>\n <div class="cfcb-notification-content">\n <div class="cfcb-notification-title">${i.view_count} views</div>\n ${n.button_text&&n.button_url?`\n <a href="${n.button_url}" class="cfcb-booster-button">\n ${n.button_text}\n </a>\n `:""}\n <div class="cfcb-verified-status-line">\n <span class="cfcb-time-ago">${t(i.timestamp,n)}</span>\n ${i.verified?'\n <div class="cfcb-verified-badge">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path fill-rule="evenodd" d="M8.603 3.799A4.49 4.49 0 0112 2.25c1.357 0 2.573.6 3.397 1.549a4.49 4.49 0 013.498 1.307 4.491 4.491 0 011.307 3.497A4.49 4.49 0 0121.75 12a4.49 4.49 0 01-1.549 3.397 4.491 4.491 0 01-1.307 3.497 4.491 4.491 0 01-3.497 1.307A4.49 4.49 0 0112 21.75a4.49 4.49 0 01-3.397-1.549 4.49 4.49 0 01-3.498-1.306 4.491 4.491 0 01-1.307-3.498A4.49 4.49 0 012.25 12c0-1.357.6-2.573 1.549-3.397a4.49 4.49 0 011.307-3.497 4.49 4.49 0 013.497-1.307zm7.007 6.387a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" />\n </svg>\n verified\n </div>\n ':""}\n </div>\n </div>\n <button class="cfcb-close-button">\n <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor">\n <path fill-rule="evenodd" d="M5.47 5.47a.75.75 0 011.06 0L12 10.94l5.47-5.47a.75.75 0 111.06 1.06L13.06 12l5.47 5.47a.75.75 0 11-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 01-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 010-1.06z" clip-rule="evenodd" />\n </svg>\n </button>\n </div>\n `}function s(){window.boosterConfig&&(window.boosterInstances||(window.boosterInstances=new Map),window.boosterConfig.isPreview?window.boosterInstances.set(window.boosterConfig.boosterId,new h(window.boosterConfig)):o())}async function o(){const t=window.location.href,n=window.boosterConfig;try{await d();const i=n.baseUrl.replace(/\/$/,""),e=n.urlMatchPath.replace(/\/$/,""),s=`${i}/${e}?workspace_id=${n.workspaceId}&url=${encodeURIComponent(t)}`,o=await fetch(s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);const a=await o.json();
1if(a.matches&&a.boosters)for(const[t,i]of a.boosters.entries()){const e=Number(i.settings?.delay_for_seconds)||1,s=a.boosters.length>1?2*t:0,o={...n.settings,...i.settings,delay_for_seconds:e+s},r={...n,isPreview:!1,boosterId:i.id,settings:o},c=new h(r,{id:i.id,type:i.type,settings:o});window.boosterInstances.set(i.id,c)}}catch(t){console.error("Error checking workspace boosters:",t)}}const a='\n .cfcb-notification-container {\n position: fixed;\n z-index: 9999;\n max-width: 400px;\n width: 100%;\n padding: 1rem;\n transition: all 0.3s ease;\n display: none;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;\n line-height: normal;\n text-align: left;\n box-sizing: border-box;\n }\n\n .cfcb-notification-container * {\n box-sizing: border-box;\n line-height: normal;\n }\n\n /* Desktop positioning */\n .cfcb-position-right {\n right: 1rem;\n bottom: 1rem;\n }\n\n .cfcb-position-left {\n left: 1rem;\n bottom: 1rem;\n }\n\n /* Mobile styles */\n .cfcb-mobile {\n left: 50%;\n transform: translateX(-50%);\n width: calc(100% - 2rem);\n max-width: 100%;\n }\n\n .cfcb-mobile-small {\n max-width: 300px;\n }\n\n .cfcb-mobile-top {\n top: 1rem;\n bottom: auto;\n }\n\n .cfcb-mobile-bottom {\n bottom: 1rem;\n top: auto;\n }\n\n .cfcb-mobile-hidden {\n display: none !important;\n }\n\n .cfcb-notification-card {\n position: relative;\n display: flex;\n align-items: center;\n gap: 0.875rem;\n padding: 1rem 1.25rem;\n background: white;\n border-radius: var(--notification-radius, 1.25rem);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n min-width: 20rem;\n max-width: min(calc(100vw - 2rem), 32rem);\n animation: cfcb-slideIn 0.5s ease-out;\n margin: 0;\n box-sizing: border-box;\n }\n\n .cfcb-flex-shrink-0 {\n flex-shrink: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .cfcb-location-icon {\n flex: 0 0 3.5rem;\n width: 3.5rem;\n height: 3.5rem;\n margin: 3px;\n background: var(--icon-bg-color, rgba(21, 128, 61, 0.1));\n border-radius: var(--icon-radius, 9999px);\n display: flex;\n align-items: center;\n justify-content: center;\n color: var(--title-color, #15803d);\n padding: 0;\n }\n\n .cfcb-location-icon svg,\n .cfcb-flex-shrink-0 svg {\n width: 1.5rem;\n height: 1.5rem;\n flex: 0 0 auto;\n }\n\n .cfcb-location-icon img,\n .cfcb-flex-shrink-0 img {\n width: 3.5rem !important;\n height: 3.5rem !important;\n border-radius: var(--icon-radius, 9999px) !important;\n object-fit: cover !important;\n }\n\n .cfcb-notification-content {\n display: flex !important;\n flex-direction: column !important;\n justify-content: center !important;\n flex: 1 !important;\n padding-left: 0.125rem !important;\n padding-right: 0.75rem !important;\n min-width: 0 !important;\n }\n\n .cfcb-notification-title {\n font-size: 1rem;\n font-weight: 500;\n color: var(--title-color, #15803d);\n margin: 0;\n padding: 0;\n line-height: 1.25;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .cfcb-notification-subtitle {\n display: flex !important;\n flex-direction: column !important;\n gap: 0.25rem !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n\n .cfcb-notification-subtitle-text {\n font-size: 0.9375rem !important;\n color: #1f2937 !important;\n line-height: 1.25 !important;\n margin: 0 !important;\n padding: 0 !important;\n }\n\n .cfcb-message {\n display: block;\n overflow: hidden;\n text-overflow: ellipsis;\n color: #1f2937;\n margin: 0;\n padding: 0;\n padding-top: 0.125rem;\n line-height: 1.25;\n }\n\n .cfcb-verified-status-line {\n display: flex !important;\n align-items: center !important;\n gap: 0.5rem !important;\n margin: 0 !important;\n padding: 0 !important;\n color: #94a3b8 !important;\n font-size: 0.875rem !important;\n line-height: 1 !important;\n }\n\n .cfcb-time-ago {\n color: #94a3b8;\n font-size: 0.875rem;\n margin: 0;\n padding: 0;\n line-height: 1;\n }\n\n .cfcb-verified-badge {\n display: flex;\n align-items: center;\n gap: 0.25rem;\n color: #3b82f6;\n font-size: 0.75rem;\n font-weight: 500;\n letter-spacing: 0.025em;\n margin: 0;\n padding: 0;\n line-height: 1;\n }\n\n .cfcb-verified-badge svg {\n width: 1rem;\n height: 1rem;\n flex: 0 0 auto;\n }\n\n .cfcb-close-button {\n position: absolute;\n top: 0.75rem;\n right: 0.75rem;\n width: 1.5rem;\n height: 1.5rem;\n border: none;\n background: #f1f5f9;\n color: #94a3b8;\n cursor: pointer;\n border-radius: 9999px;\n display: none;\n align-items: center;\n justify-content: center;\n padding: 0;\n margin: 0;\n outline: none;\n flex: 0 0 auto;\n }\n\n .cfcb-close-button svg {\n width: 0.75rem;\n height: 0.75rem;\n flex: 0 0 auto;\n }\n\n .cfcb-booster-button {\n display: inline-block;\n margin: 0.5rem 0 0 0;\n padding: 0.5rem 1rem;\n background: #2563EB;\n color: white;\n border-radius: 0.375rem;\n font-size: 0.875rem;\n text-decoration: none;\n text-align: center;\n border: none;\n line-height: 1.25;\n }\n\n .cfcb-icon-container {\n flex: 0 0 3.5rem;\n width: 3.5rem;\n height: 3.5rem;\n border-radius: var(--icon-radius) !important;\n background: var(--icon-bg-color) !important;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0;\n padding: 0;\n }\n\n .cfcb-icon-container .cfcb-count {\n color: var(--title-color) !important;\n font-weight: 600;\n font-size: 1.25rem;\n line-height: 1;\n }\n\n .cfcb-large-icon-container {\n flex: 0 0 4rem;\n width: 4rem;\n height: 4rem;\n border-radius: var(--notification-radius) !important;\n background: var(--icon-bg-color) !important;\n display: flex;\n align-items: center;\n justify-content: center;\n margin: 0;\n padding: 0;\n overflow: hidden;\n }\n\n .cfcb-large-icon-container img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n }\n\n .cfcb-large-icon-container svg {\n width: 2rem;\n height: 2rem;\n flex: 0 0 auto;\n color: var(--title-color) !important;\n }\n\n @keyframes cfcb-slideIn {\n from { \n transform: translateY(100%); \n opacity: 0; \n }\n to { \n transform: translateY(0); \n opacity: 1; \n }\n }\n\n .cfcb-notification-card:hover .cfcb-close-button {\n display: flex;\n }\n\n @media (max-width: 768px) {\n .cfcb-notification-container {\n max-width: calc(100% - 2rem);\n }\n \n .cfcb-mobile-small {\n max-width: 300px;\n }\n\n .cfcb-notification-card {\n min-width: auto;\n }\n }\n ',r=document.createElement("style");r.textContent=a,document.head.appendChild(r);const c=t=>new Promise(((n,i)=>{if(document.querySelector(`script[src="${t}"]`))return void n();const e=document.createElement("script");e.src=t,e.onload=n,e.onerror=i,document.head.appendChild(e)})),l=async()=>{const t=window.boosterConfig.baseUrl.replace(/\/$/,""),n=await fetch(`${t}/public/conversion_boosters/firebase_config.json`);if(!n.ok)return console.error("Failed to fetch Firebase config:",n.statusText),null;return await n.json()},d=async()=>{try{if(window.firebase?.apps?.length)return window.firebase;const t=await l();
1await Promise.all([c("https://www.gstatic.com/firebasejs/9.22.0/firebase-app-compat.js"),c("https://www.gstatic.com/firebasejs/9.22.0/firebase-database-compat.js"),c("https://www.gstatic.com/firebasejs/9.22.0/firebase-auth-compat.js")]);const n=window.firebase.initializeApp(t),i=window.firebase.database(n);try{await i.goOnline()}catch(t){console.warn("Firebase storage persistence disabled:",t)}return window.firebase}catch(t){return console.error("Error initializing Firebase:",t),null}};class h{constructor(t,n=null){if(this.config=t,this.previewTimeouts=[],this.eventIndex=0,this.urlMatchCache=new Map,!this.config.isPreview){const i=`cfcb-notification-dismissed-${t.boosterId||n?.id}`;if(sessionStorage.getItem(i))return}this.settings={...t.settings,delay_for_seconds:Number(t.settings?.delay_for_seconds||1),display_for_seconds:Number(t.settings?.display_for_seconds||5),seconds_between_display:Number(t.settings?.seconds_between_display||1),position:t.settings?.position_on_right?"right":"left",mobile_size:t.settings?.mobile_size||"small",mobile_position:t.settings?.mobile_position||"bottom",title_color:t.settings?.title_color||"#15803d"},n?this.initializeWithBooster(n):this.config.isPreview&&this.config.boosterId?this.initializeWithBooster({id:this.config.boosterId,type:"RecentActivityBooster",settings:this.settings}):this.checkWorkspaceBoosters(),window.addEventListener("resize",(()=>{this.container&&this.updateContainerPosition()}))}async checkSingleBooster(){const t=window.location.href;try{const n=`${this.config.baseUrl.replace(/\/$/,"")}/public/conversion_boosters/check_url_match.json?booster_id=${this.config.boosterId}&url=${encodeURIComponent(t)}&workspace_id=${this.config.workspaceId}`,i=await fetch(n);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);return await i.json()}catch(t){return console.error("Error checking single booster:",t),{matches:!1}}}async checkWorkspaceBoosters(){const t=window.location.href;try{await d();const n=`${this.config.baseUrl.replace(/\/$/,"")}/public/conversion_boosters/check_url_match.json?workspace_id=${this.config.workspaceId}&url=${encodeURIComponent(t)}`,i=await fetch(n);if(!i.ok)throw new Error(`HTTP error! status: ${i.status}`);const e=await i.json();if(e.matches&&e.boosters)for(const[t,n]of e.boosters.entries()){const i=Number(n.settings?.delay_for_seconds)||1,s=e.boosters.length>1?2*t:0,o={...this.config.settings,...n.settings,delay_for_seconds:i+s},a={...this.config,isPreview:!1,boosterId:n.id,settings:o},r=new h(a,{id:n.id,type:n.type,settings:o});window.boosterInstances.set(n.id,r)}}catch(t){console.error("Error checking workspace boosters:",t)}}initializeContainer(){this.container||(this.container=document.createElement("div"),this.container.id=`cfcb-notification-container-${this.boosterId}`,this.container.className="cfcb-notification-container",document.body.appendChild(this.container),this.updateContainerPosition())}updateContainerPosition(){if(!this.container)return;const t=window.innerWidth<=768,n=this.settings.position||"right";if(this.container.className="cfcb-notification-container",this.container.style.cssText="",t){if("hide"===this.settings.mobile_size||"none"===this.settings.mobile_size)return this.container.classList.add("cfcb-mobile-hidden"),void(this.container.style.display="none");this.container.classList.add("cfcb-mobile"),"small"===this.settings.mobile_size&&this.container.classList.add("cfcb-mobile-small"),"top"===this.settings.mobile_position?(this.container.classList.add("cfcb-mobile-top"),this.container.style.top="1rem",this.container.style.bottom="auto"):(this.container.classList.add("cfcb-mobile-bottom"),this.container.style.bottom="1rem",this.container.style.top="auto"),this.container.style.left="50%",this.container.style.transform="translateX(-50%)"}else"left"===n?(this.container.classList.add("cfcb-position-left"),this.container.style.left="1rem",this.container.style.right="auto"):(this.container.classList.add("cfcb-position-right"),this.container.style.right="1rem",this.container.style.left="auto"),this.container.style.bottom="1rem"}initializeWithBooster(t){this.boosterId=t.id,this.boosterType=t.type,this.settings={...this.settings,...t.settings,mobileTopOfPage:Boolean(t.settings?.mobile_top_of_page),mobileSize:t.settings?.mobile_size||"small",position:t.settings?.position_on_right?"right":"left"},this.initializeContainer(),this.updateContainerPosition();(!(window.innerWidth<=768)||"hide"!==this.settings.mobile_size&&"none"!==this.settings.mobile_size)&&(this.initializeFirebase(),this.config.isPreview&&this.renderNoEvents())}async initializeFirebase(){try{const t=await d();this.startListening(t)}catch(t){console.error("Error initializing Firebase:",t)}}startListening(t){const{workspaceId:n,eventsPath:i}=this.config,e=t.database().ref(`${i}/${n}/${this.boosterId}/events`).orderByChild("timestamp").limitToLast(20);this.isDisplaying=!1,this.lastKnownEventTimestamp=0,this.pausedIndex=null,this.previousEventsLength=0,this.newEventsToShow=[],this.isFirstLoad=!0;const s=`cfcb-last-position-${this.boosterId}`,o=sessionStorage.getItem(s);e.on("value",(t=>{const n=t.val()||{},i=Object.entries(n).sort((([,t],[,n])=>n.timestamp-t.timestamp)).map((([,t])=>t)),e=this.filterEvents(i),s=Number(this.settings.min_display)||0;if(s>0&&e.length<s)return void this.renderNoEvents();if(0===e.length)return void this.renderNoEvents();this.events=e;const a=this.isFirstLoad?[]:e.filter((t=>t.timestamp>this.lastKnownEventTimestamp)),r=a.length>0;if(this.isFirstLoad){if(this.lastKnownEventTimestamp=e[0].timestamp,this.settings.always_show)this.eventIndex=0;else if(o){const t=parseInt(o,10);this.eventIndex=Math.min(t,e.length-1)}else this.eventIndex=e.length-1;this.isFirstLoad=!1,this.showNextEvent(e)}else r?(this.lastKnownEventTimestamp=e[0].timestamp,this.previewTimeouts.forEac
1h((t=>clearTimeout(t))),this.previewTimeouts=[],this.container.style.display="none",this.isDisplaying=!1,this.pausedIndex=this.eventIndex+a.length,this.eventIndex=0,this.showNextEvent(e)):this.isDisplaying||(this.eventIndex>=e.length?this.settings.loop_notifications?(this.eventIndex=this.eventIndex%e.length,this.showNextEvent(e)):this.isDisplaying=!1:this.showNextEvent(e));this.previousEventsLength=e.length}))}showNextNewEvent(){if(this.newEventsToShow.length>0){const t=this.newEventsToShow.pop();if(this.validateEventData(t)){const n=this.renderBooster(t);this.displayNotification(n)}else this.showNextNewEvent()}else null!==this.pausedIndex&&(this.eventIndex=Math.min(this.pausedIndex,this.events.length-1),this.pausedIndex=null,this.isDisplaying=!1,this.showNextEvent(this.events))}filterEvents(t){let n=[...t],i=[...t];if(this.settings.display_last&&(n=n.slice(0,this.settings.display_last)),this.settings.last_n_days){const t=Date.now()/1e3-24*this.settings.last_n_days*60*60;n=n.filter((n=>n.timestamp>=t))}if(this.settings.display_events_from_last_x_minutes){const t=Date.now()/1e3-60*this.settings.display_events_from_last_x_minutes;n=n.filter((n=>n.timestamp>=t))}"RecentActivityBooster"===this.boosterType&&this.settings.hide_anonymous&&(n=n.filter((t=>{const n=t.name?.toLowerCase()||"";return"anonymous"!==n&&"someone"!==n})));const e=Number(this.settings.min_display)||0;return e>0&&n.length<e&&i.length>=e&&(n=i.slice(0,e)),n}showNextEvent(t){if(this.eventIndex>=t.length){if(!this.settings.loop_notifications)return void(this.isDisplaying=!1);this.eventIndex=0}const n=t[this.eventIndex];if(n&&this.validateEventData(n)){const t=this.renderBooster(n);this.displayNotification(t),this.eventIndex++}else this.eventIndex++,this.showNextEvent(t)}showSingleEvent(t,n){const i=t[n];if(i&&this.validateEventData(i)){const t=this.renderBooster(i);this.isDisplaying=!0;const e=setTimeout((()=>{this.container.innerHTML=t,this.container.style.display="block";const i=this.container.querySelector(".cfcb-close-button");i&&i.addEventListener("click",(t=>{t.preventDefault(),this.container.style.display="none";const i=`cfcb-notification-closed-${this.boosterType}-${n}`;localStorage.setItem(i,"true"),this.isDisplaying=!1}))}),1e3*(this.config.settings.delay_for_seconds||0));this.previewTimeouts.push(e)}else this.isDisplaying=!1}validateEventData(t){if(!t)return!1;let n=!1;switch(this.boosterType){case"RecentActivityBooster":n=Boolean(t?.name),n&&!t.location&&(t.location="somewhere");break;case"LiveCountBooster":n="number"==typeof t?.visitor_count&&t.visitor_count>=(this.settings?.min_active_visitors||0);break;case"CardBooster":n="number"==typeof t?.view_count;break;default:n=!1}return n}displayNotification(t){const n=1e3*Number(this.settings.display_for_seconds||5),i=1e3*Number(this.settings.delay_for_seconds||1),e=1e3*Number(this.settings.seconds_between_display||1);if(!this.isDisplaying){this.isDisplaying=!0;const s=setTimeout((()=>{if(this.container){this.container.innerHTML=t,this.container.style.display="block";const i=this.container.querySelector(".cfcb-close-button");if(i&&i.addEventListener("click",(t=>{if(t.preventDefault(),this.container.style.display="none",!this.config.isPreview){const t=`cfcb-notification-dismissed-${this.boosterId}`;sessionStorage.setItem(t,"true")}this.isDisplaying=!1})),n>0){const t=setTimeout((()=>{if(!this.config.isPreview){const t=`cfcb-notification-dismissed-${this.boosterId}`;if(sessionStorage.getItem(t))return}if(this.container&&"none"!==this.container.style.display){if(this.container.style.display="none",this.isDisplaying=!1,!this.config.isPreview){const t=`cfcb-last-position-${this.boosterId}`;sessionStorage.setItem(t,this.eventIndex.toString())}setTimeout((()=>{null!==this.pausedIndex?(this.eventIndex=Math.min(this.pausedIndex,this.events.length-1),this.pausedIndex=null,this.showNextEvent(this.events)):this.showNextEvent(this.events)}),e)}}),n);this.previewTimeouts.push(t)}}}),i);this.previewTimeouts.push(s)}}renderBooster(t){switch(this.boosterType){case"RecentActivityBooster":return n(this.settings,t);case"LiveCountBooster":return i(this.settings,t);case"CardBooster":return e(this.settings,t);default:return""}}renderNoEvents(){this.config.isPreview?(this.container||this.initializeContainer(),this.container.innerHTML=`\n <div class="cfcb-notification-card" style="--title-color: ${this.settings?.title_color||"#15803d"}; --icon-bg-color: ${this.settings?.title_color||"#15803d"}1A; --notification-radius: 0.5rem; --icon-radius: 0.5rem;">\n <div class="cfcb-notification-content">\n <div class="cfcb-notification-title" style="color: var(--title-color)">No events yet</div>\n <div class="cfcb-notification-subtitle">Waiting for activity...</div>\n </div>\n </div>\n `,this.container.style.display="block"):this.container&&(this.container.style.display="none")}
1cleanup(){this.previewTimeouts.forEach((t=>clearTimeout(t)))}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",s):s(),window.addEventListener("beforeunload",(()=>{window.boosterInstances&&window.boosterInstances.forEach((t=>{"function"==typeof t.cleanup&&t.cleanup()}))}))}();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.