@v-tilt/browser 1.12.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.chat.js +2 -0
- package/dist/array.chat.js.map +1 -0
- package/dist/array.chat.no-external.js +2 -0
- package/dist/array.chat.no-external.js.map +1 -0
- package/dist/array.full.chat.js +2 -0
- package/dist/array.full.chat.js.map +1 -0
- package/dist/array.full.chat.no-external.js +2 -0
- package/dist/array.full.chat.no-external.js.map +1 -0
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- package/dist/array.full.no-external.js +2 -0
- package/dist/array.full.no-external.js.map +1 -0
- package/dist/array.js +1 -1
- package/dist/array.js.map +1 -1
- package/dist/array.no-external.js +1 -1
- package/dist/array.no-external.js.map +1 -1
- package/dist/chat.js +1 -1
- package/dist/chat.js.map +1 -1
- package/dist/entrypoints/all-external-dependencies.d.ts +10 -3
- package/dist/entrypoints/array.chat.d.ts +10 -0
- package/dist/entrypoints/array.chat.no-external.d.ts +6 -0
- package/dist/entrypoints/array.full.chat.d.ts +13 -0
- package/dist/entrypoints/array.full.chat.no-external.d.ts +7 -0
- package/dist/entrypoints/array.full.d.ts +5 -9
- package/dist/entrypoints/array.full.no-external.d.ts +12 -0
- package/dist/entrypoints/module.chat.es.d.ts +7 -0
- package/dist/entrypoints/module.full.chat.es.d.ts +12 -0
- package/dist/entrypoints/module.full.es.d.ts +12 -0
- package/dist/entrypoints/module.no-external.es.d.ts +1 -0
- package/dist/extensions/chat/bubble-drag.d.ts +20 -5
- package/dist/extensions/chat/chat-wrapper.d.ts +8 -2
- package/dist/extensions/chat/chat.d.ts +21 -221
- package/dist/extensions/chat/controller/__tests__/fakes/ably-realtime-fake.d.ts +84 -0
- package/dist/extensions/chat/controller/ably-client.d.ts +160 -0
- package/dist/extensions/chat/controller/ably-handlers.d.ts +95 -0
- package/dist/extensions/chat/controller/ably-token.d.ts +67 -0
- package/dist/extensions/chat/controller/chat-controller.d.ts +194 -0
- package/dist/extensions/chat/controller/message-delivery-status.d.ts +6 -0
- package/dist/extensions/chat/controller/message-order.d.ts +12 -0
- package/dist/extensions/chat/controller/message-stream.d.ts +49 -0
- package/dist/extensions/chat/lib/bubble-offset.d.ts +18 -0
- package/dist/extensions/chat/lib/merge-chat-config.d.ts +3 -0
- package/dist/extensions/chat/normalize-send-content.d.ts +2 -0
- package/dist/extensions/chat/outbox/message-delivery.d.ts +17 -0
- package/dist/extensions/chat/outbox/message-outbox.d.ts +57 -0
- package/dist/extensions/chat/store/chat-store.d.ts +122 -0
- package/dist/extensions/chat/types.d.ts +1 -19
- package/dist/extensions/chat/ui/ChannelItem.d.ts +12 -0
- package/dist/extensions/chat/ui/ChannelListView.d.ts +14 -0
- package/dist/extensions/chat/ui/ChatBubble.d.ts +14 -0
- package/dist/extensions/chat/ui/ChatHeader.d.ts +13 -0
- package/dist/extensions/chat/ui/ChatPanel.d.ts +14 -0
- package/dist/extensions/chat/ui/ChatRoot.d.ts +31 -0
- package/dist/extensions/chat/ui/ClosedBanner.d.ts +7 -0
- package/dist/extensions/chat/ui/ConnectionBanner.d.ts +32 -0
- package/dist/extensions/chat/ui/ConversationView.d.ts +14 -0
- package/dist/extensions/chat/ui/MessageBubble.d.ts +25 -0
- package/dist/extensions/chat/ui/MessageInput.d.ts +14 -0
- package/dist/extensions/chat/ui/MessageList.d.ts +19 -0
- package/dist/extensions/chat/ui/NewMessagesPill.d.ts +13 -0
- package/dist/extensions/chat/ui/Skeletons.d.ts +14 -0
- package/dist/extensions/chat/ui/TypingBubble.d.ts +23 -0
- package/dist/extensions/chat/ui/TypingIndicator.d.ts +12 -0
- package/dist/extensions/chat/ui/WidgetSlot.d.ts +20 -0
- package/dist/extensions/chat/ui/hooks/use-auto-mark-read.d.ts +18 -0
- package/dist/extensions/chat/ui/hooks/use-scroll-preservation.d.ts +33 -0
- package/dist/extensions/chat/ui/icons.d.ts +18 -0
- package/dist/extensions/chat/ui/message-render.d.ts +18 -0
- package/dist/extensions/chat/ui/shadow-styles.d.ts +13 -0
- package/dist/extensions/chat/ui/utils/mobile-body-scroll-lock.d.ts +14 -0
- package/dist/extensions/chat/widget-registry.d.ts +21 -5
- package/dist/extensions/chat/widgets/collect-email.d.ts +4 -2
- package/dist/extensions/chat/widgets/escalate-to-human.d.ts +2 -1
- package/dist/external-scripts-loader.js +1 -1
- package/dist/external-scripts-loader.js.map +1 -1
- package/dist/feature.d.ts +1 -0
- package/dist/lib/merge-vtilt-config.d.ts +9 -0
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.chat.d.ts +1788 -0
- package/dist/module.chat.js +2 -0
- package/dist/module.chat.js.map +1 -0
- package/dist/module.d.ts +48 -3
- package/dist/module.full.chat.d.ts +1792 -0
- package/dist/module.full.chat.js +2 -0
- package/dist/module.full.chat.js.map +1 -0
- package/dist/module.full.d.ts +1793 -0
- package/dist/module.full.js +2 -0
- package/dist/module.full.js.map +1 -0
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.d.ts +48 -3
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/snippet-stub-methods.d.ts +14 -0
- package/dist/utils/globals.d.ts +53 -27
- package/dist/utils/index.d.ts +8 -0
- package/dist/vtilt.d.ts +6 -1
- package/dist/web-vitals.js.map +1 -1
- package/package.json +4 -1
- package/dist/extensions/chat/chat-styles.d.ts +0 -27
- package/dist/extensions/chat/message-content-styles.d.ts +0 -1
- package/dist/extensions/chat/message-html.d.ts +0 -6
- package/dist/extensions/chat/message-markdown.d.ts +0 -8
- package/dist/extensions/ga4-proxy.d.ts +0 -59
- package/dist/utils/type-utils.d.ts +0 -4
- package/dist/web-vitals.d.ts +0 -81
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e,t,i,r,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void i(e)}o.done?t(l):Promise.resolve(l).then(r,n)}function t(t){return function(){var i=this,r=arguments;return new Promise(function(n,a){var s=t.apply(i,r);function o(t){e(s,n,a,o,l,"next",t)}function l(t){e(s,n,a,o,l,"throw",t)}o(void 0)})}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},i.apply(null,arguments)}var r="1.12.0",n="__vt_session",a="__vt_window_id",s="__vt_primary_window",o="__vt_user_state",l="__vt_device_id",d="__vt_anonymous_id",u="__vt_remote_config",c="__vt_distinct_id",h="__vt_user_properties",v="localStorage",_="localStorage+cookie",g="sessionStorage",p="memory",f="$initial_person_info",m="$pageview",b="$pageleave",y="$identify",w="$alias",C="$set",S="$performance_event",k="$autocapture",x="$scroll_depth",E="$snapshot",I="$snapshot_items",M="$$client_ingestion_warning",L="$current_url",A="$pathname",T="$prev_pageview_duration",P="$prev_pageview_pathname",R="$prev_pageview_url",D="$scroll_depth_pct",O="$scroll_depth_max_pct",$="$prev_pageview_scroll_depth_pct",U="undefined"!=typeof window?window:void 0,N="undefined"!=typeof globalThis?globalThis:U,B=null==N?void 0:N.navigator,H=null==N?void 0:N.document,q=null==N?void 0:N.location,F=null==N?void 0:N.fetch;U&&H&&H.createElement,null==N||N.XMLHttpRequest,null==N||N.AbortController;var z=null==B?void 0:B.userAgent,j=null!=U?U:{};class W{constructor(e){void 0===e&&(e={}),this.config=this.parseConfigFromScript(e)}parseConfigFromScript(e){if(!(null==H?void 0:H.currentScript))return i({token:e.token||""},e);var t=H.currentScript,r=i({token:""},e);r.api_host=t.getAttribute("data-api-host")||t.getAttribute("data-host")||e.api_host,r.script_host=t.getAttribute("data-script-host")||e.script_host,r.token=t.getAttribute("data-token")||e.token||"",r.domain=t.getAttribute("data-domain")||e.domain,r.storage=t.getAttribute("data-storage")||e.storage,r.stringifyPayload="false"!==t.getAttribute("data-stringify-payload");var n="true"===t.getAttribute("data-capture-performance");for(var a of(r.capture_performance=!!n||e.capture_performance,r.globalAttributes=i({},e.globalAttributes),Array.from(t.attributes)))a.name.startsWith("data-vt-")&&(r.globalAttributes[a.name.slice(8).replace(/-/g,"_")]=a.value);return r}getConfig(){return i({},this.config)}updateConfig(e){this.config=i({},this.config,e)}}function V(e){return"string"==typeof e}function K(e){return void 0===e}function G(e){return null==e}function J(e){return Array.isArray(e)}function Q(e){return"function"==typeof e}var X={none:0,error:1,warn:2,info:3,debug:4},Z="[vTilt]",Y=new Set(["none","error","warn","info","debug"]);function ee(){return"undefined"!=typeof console}function te(e){var t=e.length>0&&"string"==typeof e[0]?e[0]:"",i=t?e.slice(1):e;return[t?Z+":"+t:Z,...i]}var ie="warn",re=!1;var ne=null;function ae(){return ne||(ne={setLevel(e,t){void 0===t&&(t=!1),ie=e,t&&(re=!0)},setLevelFromRemote(e){re||e&&Y.has(e)&&(ie=e)},getLevel:()=>ie,isLockedByInit:()=>re,debug(){if(!(X[ie]<X.debug)&&ee()){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.log(...te(t))}},info(){if(!(X[ie]<X.info)&&ee()){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.log(...te(t))}},warn(){if(!(X[ie]<X.warn)&&ee()){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.warn(...te(t))}},error(){if(!(X[ie]<X.error)&&ee()){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.error(...te(t))}}}),ne}function se(e,t){void 0===t&&(t=!0);var i=void 0!==e.log_level||!!e.debug,r=function(e){return e.log_level&&Y.has(e.log_level)?e.log_level:e.debug?"debug":"warn"}(e);return ae().setLevel(r,t&&i),r}function oe(e,t){try{return e()}catch(e){return t}}var le="x-api-key";function de(e,t,i){void 0===i&&(i={});var{api_host:r,token:n}=e,a=""+(r?r.replace(/\/+$/gm,""):"")+t;if(i.includeTokenQuery&&n){var s=a.includes("?")?"&":"?";a=""+a+s+"token="+n}return a}function ue(e){return e.token?{[le]:e.token}:{}}class ce{constructor(){this._events=new Map,this._onceEvents=new Map}on(e,t){return this._events.has(e)||this._events.set(e,new Set),this._events.get(e).add(t),()=>{var i;null===(i=this._events.get(e))||void 0===i||i.delete(t)}}once(e,t){return this._onceEvents.has(e)||this._onceEvents.set(e,new Set),this._onceEvents.get(e).add(t),()=>{var i;null===(i=this._onceEvents.get(e))||void 0===i||i.delete(t)}}emit(e,t){var i,r;null===(i=this._events.get(e))||void 0===i||i.forEach(i=>{try{i(t)}catch(t){ae().error("emitter",'error in event listener for "'+e+'":',t)}});var n=this._onceEvents.get(e);n&&(n.forEach(i=>{try{i(t)}catch(t){ae().error("emitter",'error in once listener for "'+e+'":',t)}}),this._onceEvents.delete(e)),null===(r=this._events.get("*"))||void 0===r||r.forEach(i=>{try{i({event:e,payload:t})}catch(e){ae().error("emitter","error in wildcard listener:",e)}})}off(e){e?(this._events.delete(e),this._onceEvents.delete(e)):(this._events.clear(),this._onceEvents.clear())}listenerCount(e){var t,i,r,n;return(null!==(i=null===(t=this._events.get(e))||void 0===t?void 0:t.size)&&void 0!==i?i:0)+(null!==(n=null===(r=this._onceEvents.get(e))||void 0===r?void 0:r.size)&&void 0!==n?n:0)}hasListeners(e){return this.listenerCount(e)>0}}var he="sdk:initialized",ve="sdk:config_updated",_e="sdk:remote_config_loaded",ge="consent:updated",pe="event:captured",fe="recording:started",me="recording:stopped",be=0,ye=!1,we=!1;function Ce(e){(be+=1)<2||(ye=!0,we||(we=!0,ae().warn(e,"vTilt network requests are being cancelled before reaching the server (likely an ad blocker, privacy extension, or DNS-level filter). Further retries and snapshots have been suspended for this page. Route SDK traffic through your own domain to avoid this — see https://www.vtilt.com/docs/browser/reverse-proxy.")))}function Se(){be=0}function ke(){return ye}var xe="23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function Ee(e){for(var t=(2<<31-Math.clz32(57))-1,i=Math.ceil(1.6*t*e/57),r="";r.length<e;)for(var n=crypto.getRandomValues(new Uint8Array(i)),a=0;a<i&&r.length<e;a++){var s=n[a]&t;s<57&&(r+=xe[s])}return r}var Ie=1048576;function Me(e,t,i){if(e)if(Array.isArray(e))e.forEach((e,r)=>{t.call(i,e,r)});else for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(i,e[r],r)}function Le(e,t,i,r){var{capture:n=!1,passive:a=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:n,passive:a})}function Ae(e,t){if(!t)return e;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}function Te(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n of i)for(var a of n)e.push(a);return e}function Pe(e){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=e[i];null!=r&&""!==r&&(t[i]=r)}return t}var Re=[d,l,c,o],De=31536e3,Oe=["herokuapp.com","vercel.app","netlify.app"];function $e(e){var t;if(!e||"undefined"==typeof document)return"";var i=null===(t=document.location)||void 0===t?void 0:t.hostname;if(!i)return"";var r=i.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return r?"."+r[0]:""}class Ue{constructor(e){var t,i,r;this.memoryStorage=new Map,this._localStorageSupported=null,this.method=e.method,this.cross_subdomain=null!==(t=e.cross_subdomain)&&void 0!==t?t:function(){var e;if("undefined"==typeof document)return!1;var t=null===(e=document.location)||void 0===e?void 0:e.hostname;if(!t)return!1;var i=t.split(".").slice(-2).join(".");return!Oe.includes(i)}(),this.sameSite=null!==(i=e.sameSite)&&void 0!==i?i:"Lax",this.secure=null!==(r=e.secure)&&void 0!==r?r:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this._localStorageSupported)return this._localStorageSupported;if(void 0===U||!U.localStorage)return this._localStorageSupported=!1,!1;try{var e="__vt_ls_test__";U.localStorage.setItem(e,"1");var t="1"===U.localStorage.getItem(e);return U.localStorage.removeItem(e),this._localStorageSupported=t,t||ae().warn("storage","localStorage unavailable, using cookies"),t}catch(e){return this._localStorageSupported=!1,ae().warn("storage","localStorage unavailable, using cookies"),!1}}isCriticalProperty(e){return Re.includes(e)}get(e){var t;try{switch(this.method){case p:return null!==(t=this.memoryStorage.get(e))&&void 0!==t?t:null;case _:return this.getLocalStoragePlusCookie(e);case v:return this.getLocalStorage(e);case g:return this.readFromSessionStorage(e);default:return this.getCookie(e)}}catch(t){return ae().warn("storage",'get error for "'+e+'":',t),null}}set(e,t,i){try{switch(this.method){case p:this.memoryStorage.set(e,t);break;case _:this.setLocalStoragePlusCookie(e,t,i);break;case v:this.setLocalStorage(e,t);break;case g:this.writeToSessionStorage(e,t);break;default:this.setCookie(e,t,null!=i?i:De)}}catch(t){ae().warn("storage",'set error for "'+e+'":',t)}}remove(e){try{switch(this.method){case p:this.memoryStorage.delete(e);break;case _:this.removeLocalStoragePlusCookie(e);break;case v:this.removeLocalStorage(e);break;case g:this.removeFromSessionStorage(e);break;default:this.removeCookie(e)}}catch(t){ae().warn("storage",'remove error for "'+e+'":',t)}}getLocalStoragePlusCookie(e){if(this.isCriticalProperty(e)){var t=this.getCookie(e),i=this.getLocalStorage(e);if(null!==t){if(i!==t&&this.isLocalStorageSupported())try{null==U||U.localStorage.setItem(e,t)}catch(e){}return t}return null!==i?i:this.readFromSessionStorage(e)}return this.getLocalStorage(e)}setLocalStoragePlusCookie(e,t,i){this.setLocalStorage(e,t),this.isCriticalProperty(e)&&(this.setCookie(e,t,null!=i?i:De),this.writeToSessionStorage(e,t))}removeLocalStoragePlusCookie(e){this.removeLocalStorage(e),this.isCriticalProperty(e)&&(this.removeCookie(e),this.removeFromSessionStorage(e))}getLocalStorage(e){var t;if(!this.isLocalStorageSupported())return null;try{return null!==(t=null==U?void 0:U.localStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}setLocalStorage(e,t){if(this.isLocalStorageSupported())try{null==U||U.localStorage.setItem(e,t)}catch(e){ae().warn("storage","localStorage write error:",e)}}removeLocalStorage(e){if(this.isLocalStorageSupported())try{null==U||U.localStorage.removeItem(e)}catch(e){}}readFromSessionStorage(e){var t;try{return null!==(t=null==U?void 0:U.sessionStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}writeToSessionStorage(e,t){try{null==U||U.sessionStorage.setItem(e,t)}catch(e){ae().warn("storage","sessionStorage write error:",e)}}removeFromSessionStorage(e){try{null==U||U.sessionStorage.removeItem(e)}catch(e){}}getCookie(e){if("undefined"==typeof document)return null;var t=e+"=";for(var i of document.cookie.split(";")){var r=i.trim();if(r.startsWith(t))try{return decodeURIComponent(r.slice(t.length))}catch(e){return r.slice(t.length)}}return null}setCookie(e,t,i){if("undefined"!=typeof document){var r=$e(this.cross_subdomain),n=e+"="+encodeURIComponent(t)+"; Max-Age="+i+"; path=/; SameSite="+this.sameSite;this.secure&&(n+="; Secure"),r&&(n+="; domain="+r),document.cookie=n}}removeCookie(e){if("undefined"!=typeof document){var t=$e(this.cross_subdomain);document.cookie=e+"=; Max-Age=0; path=/"+(t?"; domain="+t:""),document.cookie=e+"=; Max-Age=0; path=/"}}getWithExpiry(e){var t=this.get(e);if(!t)return null;try{var i=JSON.parse(t);return i.expiry&&Date.now()>i.expiry?(this.remove(e),null):i.value}catch(e){return null}}setWithExpiry(e,t,r){var n=i({value:t},r?{expiry:Date.now()+r}:{});this.set(e,JSON.stringify(n))}getJSON(e){var t=this.get(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return null}}setJSON(e,t,i){this.set(e,JSON.stringify(t),i)}canUseSessionStorage(){if(void 0===U||!(null==U?void 0:U.sessionStorage))return!1;try{var e="__vt_ss_test__";return U.sessionStorage.setItem(e,"1"),U.sessionStorage.removeItem(e),!0}catch(e){return!1}}getSessionStorage(){var e;return this.canUseSessionStorage()&&null!==(e=null==U?void 0:U.sessionStorage)&&void 0!==e?e:null}setMethod(e){this.method=e}getMethod(){return this.method}}class Ne{constructor(e,t){void 0===e&&(e="cookie"),this._isNewSession=!1,this.storage=new Ue({method:e,cross_subdomain:t,sameSite:"Lax"}),this._windowId=void 0,ae().debug("session","ctor")}hydrateFromStorage(){ae().debug("session","hydrate"),this._initializeWindowId()}getSessionId(){var e=this._getSessionIdRaw();return e||(e=Ee(16),this._storeSessionId(e),this._isNewSession=!0),e}setSessionId(){var e=this._getSessionIdRaw(),t=e||Ee(16);return e||(this._isNewSession=!0),this._storeSessionId(t),t}resetSessionId(){this._clearSessionId(),this._isNewSession=!0,this.setSessionId(),this._setWindowId(Ee(16))}consumeSessionStart(){return!!this._isNewSession&&(this._isNewSession=!1,!0)}_getSessionIdRaw(){return this.storage.get(n)}_storeSessionId(e){this.storage.set(n,e,1800)}_clearSessionId(){this.storage.remove(n)}getWindowId(){if(this._windowId)return this._windowId;var e=this.storage.getSessionStorage();if(e){var t=e.getItem(a);if(t)return this._windowId=t,t}var i=Ee(16);return this._setWindowId(i),i}_setWindowId(e){if(e!==this._windowId){this._windowId=e;var t=this.storage.getSessionStorage();t&&t.setItem(a,e)}}_initializeWindowId(){var e=this.storage.getSessionStorage();if(e){var t=e.getItem(s),i=e.getItem(a);i&&!t?this._windowId=i:(i&&e.removeItem(a),this._setWindowId(Ee(16))),e.setItem(s,"true"),this._listenToUnload()}else this._windowId=Ee(16)}_listenToUnload(){var e=this.storage.getSessionStorage();U&&e&&Le(U,"beforeunload",()=>{var e=this.storage.getSessionStorage();e&&e.removeItem(s)},{capture:!1})}updateStorageMethod(e,t){this.storage=new Ue({method:e,cross_subdomain:t,sameSite:"Lax"})}}function Be(e){if(!H)return null;var t=H.createElement("a");return t.href=e,t}function He(e){try{return decodeURIComponent(e).replace(/\+/g," ")}catch(t){return e.replace(/\+/g," ")}}function qe(e){for(var t={},i=function(e){return((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"")}(e).split("&"),r=0;r<i.length;r++){var n=i[r];if(n){var a=n.indexOf("="),s=-1===a?n:n.slice(0,a);if(s){var o=He(s),l=-1===a?"":n.slice(a+1);t[o]=He(l)}}}return t}function Fe(e,t){var i;return null!==(i=qe(e)[t])&&void 0!==i?i:""}function ze(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),n=r[0]||"",a=r[1],s=n.split("?"),o=s[1],l=s[0],d=(o||"").split("&"),u=[],c=0;c<d.length;c++){var h=d[c].split("="),v=h[0],_=h.slice(1).join("=");-1!==t.indexOf(v)?u.push(v+"="+i):v&&u.push(v+(_?"="+_:""))}var g=u.join("&");return l+(g?"?"+g:"")+(a?"#"+a:"")}var je="_fbp",We="_fbc",Ve=15552e3,Ke=7776e3;function Ge(){void 0!==H&&(function(){if(Je(je))return;var e=Date.now(),t=Math.floor(1e9+9e9*Math.random());Qe(je,"fb.1."+e+"."+t,Ve)}(),function(){if(!(null==q?void 0:q.search))return;try{var e=new URL(q.href).searchParams.get("fbclid");if(!(null==e?void 0:e.trim()))return;var t="fb.1."+Date.now()+"."+e.trim();Qe(We,t,Ke)}catch(e){}}())}function Je(e){if(void 0===H||!(null==H?void 0:H.cookie))return null;var t=e+"=";for(var i of H.cookie.split(";")){var r=i.trim();if(r.startsWith(t))try{return decodeURIComponent(r.slice(t.length))}catch(e){return r.slice(t.length)}}return null}function Qe(e,t,i){if(void 0!==H){var r=void 0!==q&&"https:"===q.protocol?"; Secure":"";H.cookie=e+"="+encodeURIComponent(t)+"; Max-Age="+i+"; path=/; SameSite=Lax"+r}}var Xe="Mobile",Ze="iOS",Ye="Android",et="Tablet",tt=Ye+" "+et,it="iPad",rt="Apple",nt=rt+" Watch",at="Safari",st="BlackBerry",ot="Samsung",lt=ot+"Browser",dt=ot+" Internet",ut="Chrome",ct=ut+" OS",ht=ut+" "+Ze,vt="Internet Explorer",_t=vt+" "+Xe,gt="Opera",pt=gt+" Mini",ft="Edge",mt="Microsoft "+ft,bt="Firefox",yt=bt+" "+Ze,wt="Nintendo",Ct="PlayStation",St="Xbox",kt=Ye+" "+Xe,xt=Xe+" "+at,Et="Windows",It=Et+" Phone",Mt="Nokia",Lt="Ouya",At="Generic",Tt=At+" "+Xe.toLowerCase(),Pt=At+" "+et.toLowerCase(),Rt="Konqueror",Dt="(\\d+(\\.\\d+)?)",Ot=new RegExp("Version/"+Dt),$t=new RegExp(St,"i"),Ut=new RegExp(Ct+" \\w+","i"),Nt=new RegExp(wt+" \\w+","i"),Bt=new RegExp(st+"|PlayBook|BB10","i"),Ht={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};function qt(e,t){return e.toLowerCase().includes(t.toLowerCase())}var Ft=(e,t)=>t&&qt(t,rt)||function(e){return qt(e,at)&&!qt(e,ut)&&!qt(e,Ye)}(e),zt=function(e,t){return t=t||"",qt(e," OPR/")&&qt(e,"Mini")?pt:qt(e," OPR/")?gt:Bt.test(e)?st:qt(e,"IE"+Xe)||qt(e,"WPDesktop")?_t:qt(e,lt)?dt:qt(e,ft)||qt(e,"Edg/")?mt:qt(e,"FBIOS")?"Facebook "+Xe:qt(e,"UCWEB")||qt(e,"UCBrowser")?"UC Browser":qt(e,"CriOS")?ht:qt(e,"CrMo")||qt(e,ut)?ut:qt(e,Ye)&&qt(e,at)?kt:qt(e,"FxiOS")?yt:qt(e.toLowerCase(),Rt.toLowerCase())?Rt:Ft(e,t)?qt(e,Xe)?xt:at:qt(e,bt)?bt:qt(e,"MSIE")||qt(e,"Trident/")?vt:qt(e,"Gecko")?bt:""},jt={[_t]:[new RegExp("rv:"+Dt)],[mt]:[new RegExp(ft+"?\\/"+Dt)],[ut]:[new RegExp("("+ut+"|CrMo)\\/"+Dt)],[ht]:[new RegExp("CriOS\\/"+Dt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Dt)],[at]:[Ot],[xt]:[Ot],[gt]:[new RegExp("(Opera|OPR)\\/"+Dt)],[bt]:[new RegExp(bt+"\\/"+Dt)],[yt]:[new RegExp("FxiOS\\/"+Dt)],[Rt]:[new RegExp("Konqueror[:/]?"+Dt,"i")],[st]:[new RegExp(st+" "+Dt),Ot],[kt]:[new RegExp("android\\s"+Dt,"i")],[dt]:[new RegExp(lt+"\\/"+Dt)],[vt]:[new RegExp("(rv:|MSIE )"+Dt)],Mozilla:[new RegExp("rv:"+Dt)]},Wt=function(e,t){var i=zt(e,t),r=jt[i];if(void 0===r)return null;for(var n=0;n<r.length;n++){var a=r[n],s=e.match(a);if(s)return parseFloat(s[s.length-2])}return null},Vt=[[new RegExp(St+"; "+St+" (.*?)[);]","i"),e=>[St,e&&e[1]||""]],[new RegExp(wt,"i"),[wt,""]],[new RegExp(Ct,"i"),[Ct,""]],[Bt,[st,""]],[new RegExp(Et,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[It,""];if(new RegExp(Xe).test(t)&&!/IEMobile\b/.test(t))return[Et+" "+Xe,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],n=Ht[r]||"";return/arm/i.test(t)&&(n="RT"),[Et,n]}return[Et,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[Ze,t.join(".")]}return[Ze,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=void 0===e[2]?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+Ye+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+Ye+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[Ye,t.join(".")]}return[Ye,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ct,""]],[/Linux|debian/i,["Linux",""]]],Kt=function(e){return Nt.test(e)?wt:Ut.test(e)?Ct:$t.test(e)?St:new RegExp(Lt,"i").test(e)?Lt:new RegExp("("+It+"|WPDesktop)","i").test(e)?It:/iPad/.test(e)?it:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?nt:Bt.test(e)?st:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Mt,"i").test(e)?Mt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(Xe).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?Ye:tt:Ye:new RegExp("(pda|"+Xe+")","i").test(e)?Tt:new RegExp(et,"i").test(e)&&!new RegExp(et+" pc","i").test(e)?Pt:""},Gt="https?://(.*)",Jt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Qt=Te(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Jt),Xt="<masked>";function Zt(e,t){var i=Qt.concat([]),r=Ae({},function(e){var t={};return Me(qe(e),function(e,i){"string"==typeof i&&i.startsWith("utm_")&&e&&(t[i]=e)}),t}(e));return Me(i,function(t){if(t.startsWith("utm_")){if(!(t in r)){var i=Fe(e,t);r[t]=i||null}}else{var n=Fe(e,t);r[t]=n||null}}),r}function Yt(e){var t=function(e){return e?0===e.search(Gt+"google.([^/?]*)")?"google":0===e.search(Gt+"bing.com")?"bing":0===e.search(Gt+"yahoo.com")?"yahoo":0===e.search(Gt+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!==t?"q":"p",r={};if(!function(e){return null===e}(t)){r.$search_engine=t;var n=H?Fe(H.referrer,i):"";n.length&&(r.ph_keyword=n)}return r}function ei(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function ti(){return(null==H?void 0:H.referrer)||"$direct"}function ii(){var e;return(null==H?void 0:H.referrer)&&(null===(e=Be(H.referrer))||void 0===e?void 0:e.host)||"$direct"}function ri(e){var t=function(e){var t,{r:i,u:r}=e,n={$referrer:i,$referring_domain:null==i?void 0:"$direct"===i?"$direct":null===(t=Be(i))||void 0===t?void 0:t.host};if(r){n.$current_url=r;var a=Be(r);n.$host=null==a?void 0:a.host,n.$pathname=null==a?void 0:a.pathname,Ae(n,Zt(r))}return i&&Ae(n,Yt(i)),n}(e),i={};return Me(t,function(e,t){var r;i["$initial_"+(r=String(t),r.startsWith("$")?r.substring(1):r)]=e}),i}function ni(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function ai(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function si(e,t){if(!z)return{};var i,n,a,s=e?Te([],Jt,t||[]):[],[o,l]=function(e){for(var t=0;t<Vt.length;t++){var[i,r]=Vt[t],n=i.exec(e);if(n){var a="function"==typeof r?r(n,e):r;if(a)return a}}return["",""]}(z),d=Je(je)||void 0,u=Je(We)||void 0;return Ae(Pe({$os:o,$os_version:l,$browser:zt(z,navigator.vendor),$device:Kt(z),$device_type:(n=z,a=Kt(n),a===it||a===tt||"Kobo"===a||"Kindle Fire"===a||a===Pt?et:a===wt||a===St||a===Ct||a===Lt?"Console":a===nt?"Wearable":a?Xe:"Desktop"),$timezone:ni(),$timezone_offset:ai(),$fb_browser_id:d,$fb_click_id:u}),{$current_url:ze(null==q?void 0:q.href,s,Xt),$host:null==q?void 0:q.host,$pathname:null==q?void 0:q.pathname,$raw_user_agent:z.length>1e3?z.substring(0,997)+"...":z,$browser_version:Wt(z,navigator.vendor),$browser_language:ei(),$browser_language_prefix:(i=ei(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==U?void 0:U.screen.height,$screen_width:null==U?void 0:U.screen.width,$viewport_height:null==U?void 0:U.innerHeight,$viewport_width:null==U?void 0:U.innerWidth,$lib:"web",$lib_version:r,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10)})}class oi{constructor(e,t){void 0===e&&(e="localStorage"),this._isFirstVisit=!1,this.storage=new Ue({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.generateEphemeralIdentity(),ae().debug("user","ctor","ephemeral identity only")}hydrateFromStorage(){ae().debug("user","hydrate start"),this.userIdentity=this.loadUserIdentity();var e=this.userIdentity.anonymous_id,t=this.userIdentity.distinct_id;ae().debug("user","hydrate done","anonymous_id",e?e.slice(0,12)+"...":"n/a","distinct_id",t?t.slice(0,12)+"...":"null")}generateEphemeralIdentity(){return{distinct_id:null,anonymous_id:this.generateAnonymousId(),device_id:this.generateDeviceId(),properties:{},user_state:"anonymous"}}getUserIdentity(){return i({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){var e=this.userIdentity.anonymous_id;return e||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(d,this.userIdentity.anonymous_id,De),ae().debug("user","getAnonymousId generated (was missing)",this.userIdentity.anonymous_id.slice(0,12)+"..."),this.userIdentity.anonymous_id)}getUserProperties(){return i({},this.userIdentity.properties)}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}consumeFirstVisit(){return!!this._isFirstVisit&&(this._isFirstVisit=!1,!0)}applyUpdate(e){if(void 0!==e.distinct_id&&(this.userIdentity.distinct_id=e.distinct_id),void 0!==e.user_state&&(this.userIdentity.user_state=e.user_state),void 0!==e.device_id&&(this.userIdentity.device_id=e.device_id),e.properties_set&&(this.userIdentity.properties=i({},this.userIdentity.properties,e.properties_set)),e.properties_set_once)for(var t of Object.keys(e.properties_set_once))t in this.userIdentity.properties||(this.userIdentity.properties[t]=e.properties_set_once[t]);this.saveUserIdentity()}reset(e){this.userIdentity={distinct_id:null,anonymous_id:this.generateAnonymousId(),device_id:e?this.generateDeviceId():this.userIdentity.device_id,properties:{$last_vtilt_reset:(new Date).toISOString()},user_state:"anonymous"},this.saveUserIdentity()}set_initial_person_info(e,t){if(!this.getStoredUserProperties()[f]){var i=function(e,t){var i=e?Te([],Jt,t||[]):[],r=null==q?void 0:q.href.substring(0,1e3);return{r:ti().substring(0,1e3),u:r?ze(r,i,Xt):void 0}}(e,t);this.register_once({[f]:i},void 0)}}get_initial_props(){var e=this.getStoredUserProperties()[f];return e?ri(e):{}}update_referrer_info(){var e={$referrer:ti(),$referring_domain:ii()};this.register_once(e,void 0)}loadUserIdentity(){var e=this.storage.get(d),t=this.storage.get(l),i=this.storage.get(c),r=this.storage.get(o),n=this.getStoredUserProperties(),a=e||this.generateAnonymousId(),s=t||this.generateDeviceId(),u=i||null,h=r||"anonymous";e?ae().debug("user","hydrate","loaded from storage",e.slice(0,12)+"..."):(this._isFirstVisit=!0,ae().debug("user","hydrate","generated new anonymous_id"));var v=a||this.generateAnonymousId();return e||this.storage.set(d,v,De),t||this.storage.set(l,s,De),r||this.storage.set(o,h,De),{distinct_id:u,anonymous_id:v,device_id:s,properties:n,user_state:h}}saveUserIdentity(){this.storage.set(d,this.userIdentity.anonymous_id,De),this.storage.set(l,this.userIdentity.device_id,De),this.storage.set(o,this.userIdentity.user_state,De),this.userIdentity.distinct_id?this.storage.set(c,this.userIdentity.distinct_id,De):this.storage.remove(c),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(h)||{}}setStoredUserProperties(e){this.storage.setJSON(h,e,De)}register_once(e,t){var i=this.getStoredUserProperties(),r=!1;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(n in i||(i[n]=e[n],r=!0));if(t)for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(a in i||(i[a]=t[a],r=!0));r&&this.setStoredUserProperties(i)}generateAnonymousId(){return"anon_"+Ee(16)}generateDeviceId(){return"device_"+Ee(16)}updateStorageMethod(e,t){this.storage=new Ue({method:e,cross_subdomain:t,sameSite:"Lax"})}}var li=["LCP","CLS","FCP","INP","TTFB"],di=["LCP","CLS","FCP","INP"];class ui{constructor(e,t){this._isStarted=!1,this._isLoading=!1,this._apiReady=!1,this._deferredCalls=[],this._instance=e,this._config=t}get isEnabled(){return!1!==this._config.enabled}get isStarted(){return this._isStarted}get isLoaded(){return!!this._loaded}_ensureLoaded(e){var t;if(this._loaded)e(this._loaded);else if(!this._isLoading){this._isLoading=!0;var i=null===(t=j.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;if(!i)return ae().error("feature",this.name,"loadExternalDependency not available"),void(this._isLoading=!1);i(this._instance,this.scriptName,t=>{this._isLoading=!1,t?ae().error("feature",this.name,"could not load "+this.scriptName+":",t):(this._loaded||(this._loaded=this._createLoaded()),e(this._loaded))})}}startIfEnabled(){this.isEnabled&&!this._isStarted&&(this._isStarted=!0,this._ensureLoaded(e=>this._onLoaded(e)))}_onLoaded(e){}stop(){this._isStarted=!1}updateConfig(e){this._config=i({},this._config,e)}_deferCall(e){this._apiReady?e():this._deferredCalls.push(e)}_markApiReady(){if(!this._apiReady){this._apiReady=!0;var e=this._deferredCalls;for(var t of(this._deferredCalls=[],e))try{t()}catch(e){ae().error("feature",this.name,"deferred call error:",e)}}}_resetDeferral(){this._apiReady=!1,this._deferredCalls=[]}}class ci extends ui{startIfEnabledOrStop(e){if(this.isEnabled){if(this._isStarted&&this._loaded)return;this._isStarted=!0,this._ensureLoaded(e=>this._onLoaded(e))}else this.stop()}}var hi=9e5,vi="web-vitals";class _i extends ui{static extractConfig(e){var t=e.capture_performance;return"boolean"==typeof t?{web_vitals:t}:"object"==typeof t&&null!==t?t:{web_vitals:!1}}constructor(e,t){super(e,null!=t?t:_i.extractConfig(e.getConfig())),this.name="WebVitals",this.scriptName="web-vitals",this._buffer=this._createEmptyBuffer()}get isEnabled(){var e=null==q?void 0:q.protocol;return("http:"===e||"https:"===e)&&!0===this._config.web_vitals}startIfEnabled(){if(this.isEnabled&&!this._isStarted&&U){var e=this._getWebVitalsCallbacks();e?(this._isStarted=!0,this._loaded=e,this._startCapturing(e)):(this._isStarted=!0,this._ensureLoaded(e=>this._onLoaded(e)))}}stop(){this._isStarted&&(this._flush(),this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0),this._isStarted=!1)}onConfigUpdate(e){var t=_i.extractConfig(e),i=this.isEnabled;this._config=t,i||!this.isEnabled||this._isStarted?i&&!this.isEnabled&&this._isStarted&&this.stop():this.startIfEnabled()}_createLoaded(){var e=this._getWebVitalsCallbacks();if(!e)throw new Error("[vTilt:web-vitals] web-vitals loaded but callbacks not registered");return e}_onLoaded(e){this._startCapturing(e)}get allowedMetrics(){return this._config.web_vitals_allowed_metrics||di}get flushTimeoutMs(){return this._config.web_vitals_delayed_flush_ms||5e3}get maxAllowedValue(){var e=this._config.__web_vitals_max_value;return void 0===e?hi:0===e?0:e<6e4?hi:e}_createEmptyBuffer(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}_getWebVitalsCallbacks(){var e;return null===(e=j.__VTiltExtensions__)||void 0===e?void 0:e.webVitalsCallbacks}_startCapturing(e){var t=this.allowedMetrics,i=this._addToBuffer.bind(this);t.includes("LCP")&&e.onLCP&&e.onLCP(i),t.includes("CLS")&&e.onCLS&&e.onCLS(i,{reportAllChanges:!0}),t.includes("FCP")&&e.onFCP&&e.onFCP(i),t.includes("INP")&&e.onINP&&e.onINP(i),t.includes("TTFB")&&e.onTTFB&&e.onTTFB(i)}_getCurrentUrl(){var e;return null===(e=null==U?void 0:U.location)||void 0===e?void 0:e.href}_getCurrentPathname(){return null==q?void 0:q.pathname}_addToBuffer(e){var t,r,n;try{if(!U||!H||!q)return;if(!(null==e?void 0:e.name)||void 0===(null==e?void 0:e.value))return void ae().warn(vi,"invalid metric received",e);if(this.maxAllowedValue>0&&e.value>=this.maxAllowedValue&&"CLS"!==e.name)return void ae().warn(vi,"ignoring "+e.name+" with value >= "+this.maxAllowedValue+"ms");var a=this._getCurrentUrl(),s=this._getCurrentPathname();if(!a)return void ae().warn(vi,"could not determine current URL");this._buffer.url&&this._buffer.url!==a&&this._flush(),this._buffer.url||(this._buffer.url=a,this._buffer.pathname=s),this._buffer.firstMetricTimestamp||(this._buffer.firstMetricTimestamp=Date.now());var o=this._cleanAttribution(e.attribution),l=null!==(n=null===(r=(t=this._instance).getSessionId)||void 0===r?void 0:r.call(t))&&void 0!==n?n:null,d=this._getWindowId(),u=i({},e,{attribution:o,timestamp:Date.now(),$current_url:a,$session_id:l,$window_id:d}),c=this._buffer.metrics.findIndex(t=>t.name===e.name);c>=0?this._buffer.metrics[c]=u:this._buffer.metrics.push(u),this._scheduleFlush(),this._buffer.metrics.length>=this.allowedMetrics.length&&this._flush()}catch(e){ae().error(vi,"error adding metric to buffer:",e)}}_cleanAttribution(e){if(e){var t=i({},e);return"interactionTargetElement"in t&&delete t.interactionTargetElement,t}}_getWindowId(){var e;try{return(null===(e=this._instance.sessionManager)||void 0===e?void 0:e.getWindowId())||null}catch(e){return null}}_scheduleFlush(){this._flushTimer&&clearTimeout(this._flushTimer),this._flushTimer=setTimeout(()=>{this._flush()},this.flushTimeoutMs)}_flush(){if(this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0),0!==this._buffer.metrics.length){try{var e={$pathname:this._buffer.pathname,$current_url:this._buffer.url};for(var t of this._buffer.metrics)e["$web_vitals_"+t.name+"_value"]=t.value,e["$web_vitals_"+t.name+"_event"]={name:t.name,value:t.value,delta:t.delta,rating:t.rating,id:t.id,navigationType:t.navigationType,attribution:t.attribution,$session_id:t.$session_id,$window_id:t.$window_id};this._instance.capture("$web_vitals",e)}catch(e){ae().error(vi,"error flushing metrics:",e)}this._buffer=this._createEmptyBuffer()}}}function gi(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],n=i(r);return Q(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),e[t]=n,()=>{e[t]=r}}catch(e){return()=>{}}}class pi{constructor(e,t){var i;this.name="HistoryAutocapture",this._isStarted=!1,this._instance=e,this._config=t||pi.extractConfig(e.getConfig()),this._lastPathname=(null===(i=null==U?void 0:U.location)||void 0===i?void 0:i.pathname)||""}static extractConfig(e){return{enabled:!1!==e.capture_pageview}}get isEnabled(){return!1!==this._config.enabled&&!1!==this._instance.getConfig().capture_pageview}get isStarted(){return this._isStarted}startIfEnabled(){this.isEnabled&&!this._isStarted&&this._start()}stop(){this._isStarted&&(this._popstateListener&&(this._popstateListener(),this._popstateListener=void 0),this._isStarted=!1)}onConfigUpdate(e){this._config=pi.extractConfig(e),this.isEnabled&&!this._isStarted?this._start():!this.isEnabled&&this._isStarted&&this.stop()}_start(){U&&q&&(this._lastPathname=q.pathname||"",this._patchHistoryMethods(),this._setupPopstateListener(),this._isStarted=!0,ae().info("history-autocapture","started"))}_patchHistoryMethods(){var e,t;if(null==U?void 0:U.history){var i=this;(null===(e=U.history.pushState)||void 0===e?void 0:e.__vtilt_wrapped__)||gi(U.history,"pushState",e=>function(t,r,n){i._emitPageleaveIfPathWillChange(n),e.call(this,t,r,n),i._capturePageview("pushState")}),(null===(t=U.history.replaceState)||void 0===t?void 0:t.__vtilt_wrapped__)||gi(U.history,"replaceState",e=>function(t,r,n){i._emitPageleaveIfPathWillChange(n),e.call(this,t,r,n),i._capturePageview("replaceState")})}}_emitPageleaveIfPathWillChange(e){var t;if(q){var i=q.pathname||"",r=null!==(t=function(e){if(!q)return null;if(null==e||""===e)return q.pathname||null;try{return new URL(String(e),q.href).pathname}catch(e){return null}}(e))&&void 0!==t?t:i;r!==i&&this._instance.tryCapturePageleave("spa_transition")}}_setupPopstateListener(){if(!this._popstateListener&&U){var e=()=>{this._capturePageview("popstate")};Le(U,"popstate",e),this._popstateListener=()=>{null==U||U.removeEventListener("popstate",e)}}}_capturePageview(e){this.isEnabled&&this._isStarted&&oe(()=>{var t,i=null===(t=null==U?void 0:U.location)||void 0===t?void 0:t.pathname;if(i&&q&&H)if(i!==this._lastPathname){ae().debug("history-autocapture",e,i),this._lastPathname=i;var r={navigation_type:e};this._instance.capture(m,r)}else this._lastPathname=i})}}var fi=["a","button","form","input","select","textarea","label"],mi="$copy_autocapture",bi=['[id*="cookie" i]','[class*="cookie" i]','[id*="consent" i]','[class*="consent" i]','[id*="gdpr" i]','[class*="gdpr" i]','[id*="privacy-banner" i]','[class*="privacy-banner" i]','[id*="cookie-banner" i]','[class*="cookie-banner" i]','[id*="cookie-notice" i]','[class*="cookie-notice" i]',"#CybotCookiebotDialog",'[class^="CybotCookiebotDialog"]','[id^="onetrust"]','[class^="onetrust"]','[id^="cc-"]',".cc-banner",".cc-window",".cc-revoke",'[id^="cookieconsent"]','[class^="cookieconsent"]','[id^="gdpr-cookie"]','[id^="qc-cmp"]',"#termly-code-snippet-support",'[id^="iubenda"]','[id^="truste"]','[class^="truste"]',"#consent_blackbar",'[id^="didomi"]','[id^="usercentrics"]',"#uc-center-container",".klaro","#klaro","#cookiescript_injected",".cky-consent-container","#cky-consent","#cmplz-cookiebanner-container","#gdpr-cookie-message",'[class*="fs-cc"]','[class*="fc-cc"]',"[fs-cc]","[fs-cc-checkbox]",'[class*="cookie-preferences"]',"#cookie-preferences",'[role="dialog"][aria-label*="cookie" i]','[role="dialog"][aria-label*="consent" i]','[aria-describedby*="cookie" i]','[aria-label*="Cookie Preferences" i]'];function yi(e){return e.replace(/^\s+|\s+$/g,"")}function wi(e,t){return e.indexOf(t)>-1}function Ci(e){return 1===(null==e?void 0:e.nodeType)}function Si(e){return 3===(null==e?void 0:e.nodeType)}function ki(e,t){var i;return(null===(i=null==e?void 0:e.tagName)||void 0===i?void 0:i.toLowerCase())===t}function xi(e){return 11===(null==e?void 0:e.nodeType)}function Ei(e){return e?yi(e).split(/\s+/):[]}function Ii(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className&&"string"==typeof e.className.baseVal?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ei(t)}function Mi(e){return G(e)?null:yi(e).split(/(\s+)/).filter(e=>qi(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Li(e){var t,i="";if(zi(e)&&!ji(e)&&e.childNodes&&e.childNodes.length)for(var r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];Si(n)&&n.textContent&&(i+=null!==(t=Mi(n.textContent))&&void 0!==t?t:"")}return yi(i)}function Ai(e){var t,i="";if(e&&e.childNodes&&e.childNodes.length)for(var r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(n&&"span"===(null===(t=n.tagName)||void 0===t?void 0:t.toLowerCase()))try{i=(i+" "+Li(n)).trim(),n.childNodes&&n.childNodes.length&&(i=(i+" "+Ai(n)).trim())}catch(e){}}return i}function Ti(e){var t=Li(e);return qi(t=(t+" "+Ai(e)).trim())?t:""}function Pi(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Ci(t));return t}function Ri(e){var t=e.parentNode;return!(!t||!Ci(t))&&t}function Di(e){var t=null==U?void 0:U.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}var Oi="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",$i=new RegExp("^(?:"+Oi+")$"),Ui=new RegExp(Oi),Ni="\\d{3}-?\\d{2}-?\\d{4}",Bi=new RegExp("^("+Ni+")$"),Hi=new RegExp("("+Ni+")");function qi(e,t){if(void 0===t&&(t=!0),G(e))return!1;if(V(e)){if(e=yi(e),(t?$i:Ui).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Bi:Hi).test(e))return!1}return!0}function Fi(e){return!!V(e)&&("_ngcontent"===e.substring(0,10)||"_nghost"===e.substring(0,7))}function zi(e){for(var t=e;t&&t.parentNode&&!ki(t,"body");t=t.parentNode){var i=Ii(t);if(wi(i,"vt-sensitive")||wi(i,"vt-no-capture"))return!1}if(wi(Ii(e),"vt-include"))return!0;var r=e.type||"";if(V(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var n=e.name||e.id||"";if(V(n)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function ji(e){return!!(ki(e,"input")&&!["button","checkbox","submit","reset","radio"].includes(e.type)||ki(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function Wi(e){if(!zi(e))return null;if(ki(e,"input")){var t=e,i=(t.type||"text").toLowerCase();if("password"===i||"hidden"===i)return null;if("checkbox"===i||"radio"===i){var r={$el_value:t.checked?"true":"false"},n=function(e){var t=e.closest("label");if(t){var i=yi(t.textContent||"");if(i&&qi(i))return Mi(i)||null}if(e.id)try{var r=null===document||void 0===document?void 0:document.querySelector('label[for="'+e.id+'"]');if(r){var n=yi(r.textContent||"");if(n&&qi(n))return Mi(n)||null}}catch(e){}return null}(t);return n?r.$selected_text=n:t.value&&qi(t.value)&&(r.$selected_text=t.value),r}var a=t.value;if(a&&qi(a)){var s=Mi(a);if(s)return{$el_value:s}}return null}if(ki(e,"select")){var o=e,l=o.selectedIndex;if(l>=0&&o.options[l]){var d=o.options[l],u={};d.value&&qi(d.value)&&(u.$el_value=d.value);var c=d.text;if(c&&qi(c)){var h=Mi(c);h&&(u.$selected_text=h)}if(u.$el_value||u.$selected_text)return u}return null}return ki(e,"textarea"),null}function Vi(e,t,i,r,n){if(void 0===i&&(i=void 0),!U)return{capture:!1,reason:"no_window"};if(!e)return{capture:!1,reason:"no_element"};if(ki(e,"html")||!Ci(e))return{capture:!1,reason:"html_element"};if((null==i?void 0:i.url_allowlist)&&!Di(i.url_allowlist))return{capture:!1,reason:"url_allowlist_miss"};if((null==i?void 0:i.url_ignorelist)&&Di(i.url_ignorelist))return{capture:!1,reason:"url_ignorelist_hit"};if(null==i?void 0:i.dom_event_allowlist){var a=i.dom_event_allowlist;if(a&&!a.some(e=>t.type===e))return{capture:!1,reason:"dom_event_not_allowed"}}for(var s=!1,o=[e],l=!0,d=e;d.parentNode&&!ki(d,"body");)if(xi(d.parentNode))o.push(d.parentNode.host),d=d.parentNode.host;else{if(!(l=Ri(d)))break;if(r||fi.indexOf(l.tagName.toLowerCase())>-1)s=!0;else{var u=U.getComputedStyle(l);u&&"pointer"===u.getPropertyValue("cursor")&&(s=!0)}o.push(l),d=l}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(K(i))return!0;var r,n=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var a of e)if(r=n(a))return r.v;return!1}(o,i))return{capture:!1,reason:"element_allowlist_miss"};if(!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if(K(i))return!0;var r,n=function(e){if(i.some(t=>e.matches(t)))return{v:!0}};for(var a of e)if(r=n(a))return r.v;return!1}(o,i))return{capture:!1,reason:"css_selector_allowlist_miss"};if(function(e,t){var i=null==t?void 0:t.css_selector_ignorelist,r=void 0===i?bi:i;if(0===r.length)return!1;for(var n of e)for(var a of r)try{if(n.matches(a))return!0}catch(e){}return!1}(o,i))return{capture:!1,reason:"css_selector_ignorelist_hit"};var c=U.getComputedStyle(e);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===t.type)return{capture:!0};var h=e.tagName.toLowerCase();switch(h){case"html":return{capture:!1,reason:"tag_html"};case"form":return(n||["submit"]).indexOf(t.type)>=0?{capture:!0}:{capture:!1,reason:"form_event_not_allowed"};case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0?{capture:!0}:{capture:!1,reason:"input_event_not_allowed"};default:return s?(n||["click"]).indexOf(t.type)>=0?{capture:!0}:{capture:!1,reason:"dom_event_not_allowed"}:(n||["click"]).indexOf(t.type)>=0&&(fi.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))?{capture:!0}:{capture:!1,reason:"tag_not_capturable"}}}function Ki(e,t){return t.length>e?t.slice(0,e)+"...":t}function Gi(e,t,i,r){var n=e.tagName.toLowerCase(),a={tag_name:n};fi.indexOf(n)>-1&&!i&&(a.$el_text=Ki(1024,"a"===n||"button"===n?Ti(e):Li(e)));var s=Ii(e);s.length>0&&(a.classes=s.filter(e=>""!==e));for(var o=0;o<e.attributes.length;o++){var l=e.attributes[o];if((!ji(e)||-1!==["name","id","class","aria-label"].indexOf(l.name))&&(!(null==r?void 0:r.includes(l.name))&&!t&&qi(l.value)&&!Fi(l.name))){var d=l.value;"class"===l.name&&(d=Ei(d).join(" ")),a["attr__"+l.name]=Ki(1024,d)}}for(var u=1,c=1,h=e;h=Pi(h);)u++,h.tagName===e.tagName&&c++;return a.nth_child=u,a.nth_of_type=c,a}function Ji(e){if(!zi(e))return{};for(var t={},i=0;i<e.attributes.length;i++){var r=e.attributes[i];if(r.name&&0===r.name.indexOf("data-vt-capture-attribute")){var n=r.name.replace("data-vt-capture-attribute-",""),a=r.value;n&&a&&qi(a)&&(t[n]=a)}}return t}function Qi(e){return e.replace(/"|\\"/g,'\\"')}function Xi(e){var t=e.attr__class;return t?J(t)?t:Ei(t):void 0}function Zi(e){return function(e){var t=e.map(e=>{var t,r,n="";if(e.tag_name&&(n+=e.tag_name),e.attr_class)for(var a of(e.attr_class.sort(),e.attr_class))n+="."+a.replace(/"/g,"");var s=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Object.entries(s).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[Qi(t.toString())]=Qi(String(i))}),(n+=":")+Object.entries(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")});return t.join(";")}(function(e){return e.map(e=>{var t,i,r={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Xi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Object.entries(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r})}(e))}var Yi=[25,50,75,100];function er(e){var t;if(!e)return null;var i=e.milestones,r=!0===i||"object"==typeof i&&null!==i,n="object"==typeof i&&null!==i&&(null===(t=i.thresholds)||void 0===t?void 0:t.length)?[...i.thresholds].sort((e,t)=>e-t):[...Yi],a=!0===e.pageleave;return r||a?{milestones:r,thresholds:n,pageleave:a,scroll_root_selector:e.scroll_root_selector}:null}class tr{constructor(e){this._options=e,this._maxPctSeen=0,this._firedThresholds=new Set,this._scrollHandler=null,this._scrollTarget=null,this._rafId=null,this._pageviewUnsub=null}start(){this.stop(),this._scrollTarget=function(e){if(!U)return null;if(e){var t=Array.isArray(e)?e:[e];for(var i of t){var r=null==H?void 0:H.querySelector(i);if(r instanceof Element)return r}}return U}(this._options.scroll_root_selector),this._scrollTarget&&(this._scrollHandler=()=>this._scheduleScrollUpdate(),Le(this._scrollTarget,"scroll",this._scrollHandler,{passive:!0}),this._onScroll(),this._pageviewUnsub=this._options.onPageview(()=>this.reset()))}stop(){this._pageviewUnsub&&(this._pageviewUnsub(),this._pageviewUnsub=null),null!=this._rafId&&U&&(U.cancelAnimationFrame(this._rafId),this._rafId=null),this._scrollHandler&&this._scrollTarget&&(this._scrollTarget.removeEventListener("scroll",this._scrollHandler,{passive:!0}),this._scrollHandler=null,this._scrollTarget=null)}reset(){this._maxPctSeen=0,this._firedThresholds.clear(),this._onScroll()}getMaxPct(){return this._maxPctSeen}_scheduleScrollUpdate(){U&&null==this._rafId&&(this._rafId=U.requestAnimationFrame(()=>{this._rafId=null,this._onScroll()}))}_onScroll(){if(this._scrollTarget){var e=function(e){var t,i,r,n,a,s;if(!e)return 0;if(e===U){var o=null!==(t=U.scrollY)&&void 0!==t?t:0,l=null!==(i=U.innerHeight)&&void 0!==i?i:0,d=null==H?void 0:H.documentElement,u=null==H?void 0:H.body,c=Math.max(null!==(r=null==d?void 0:d.scrollHeight)&&void 0!==r?r:0,null!==(n=null==u?void 0:u.scrollHeight)&&void 0!==n?n:0,null!==(a=null==d?void 0:d.offsetHeight)&&void 0!==a?a:0,null!==(s=null==u?void 0:u.offsetHeight)&&void 0!==s?s:0)-l;return c<=0?100:Math.round(Math.min(100,o/c*100))}var h=e,v=h.scrollHeight-h.clientHeight;return v<=0?100:Math.round(Math.min(100,h.scrollTop/v*100))}(this._scrollTarget);if(e>this._maxPctSeen&&(this._maxPctSeen=e),this._options.milestones&&this._options.isUrlAllowed())for(var t of this._options.thresholds)this._maxPctSeen>=t&&!this._firedThresholds.has(t)&&(this._firedThresholds.add(t),this._options.capture(x,{[D]:t,[O]:this._maxPctSeen}))}}}function ir(e,t){return e.indexOf(t)>-1}class rr{constructor(){this.clicks=[],this.RAGE_CLICK_THRESHOLD_PX=30,this.RAGE_CLICK_TIMEOUT_MS=1e3,this.RAGE_CLICK_CLICK_COUNT=3}isRageClick(e,t,i){if(this.clicks=this.clicks.filter(e=>i-e.timestamp<this.RAGE_CLICK_TIMEOUT_MS),this.clicks.length>0){var r=this.clicks[this.clicks.length-1];Math.sqrt(Math.pow(e-r.x,2)+Math.pow(t-r.y,2))>this.RAGE_CLICK_THRESHOLD_PX&&(this.clicks=[])}return this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length>=this.RAGE_CLICK_CLICK_COUNT}}function nr(e,t){for(var i,r,n,a,{e:s,maskAllElementAttributes:o,maskAllText:l,elementAttributeIgnoreList:d,elementsChainAsString:u,captureElementValues:c}=t,h=[e],v=e;v.parentNode&&!ki(v,"body");)xi(v.parentNode)?(h.push(v.parentNode.host),v=v.parentNode.host):(h.push(v.parentNode),v=v.parentNode);var _,g=[],p={},f=!1,m=!1;for(var b of h){var y=zi(b);if("a"===b.tagName.toLowerCase()){var w=b.getAttribute("href");f=!!(y&&w&&qi(w))&&w}ir(Ii(b),"vt-no-capture")&&(m=!0),g.push(Gi(b,o,l,d));var C=Ji(b);Object.assign(p,C)}if(m)return{props:{},explicitNoCapture:m};if(l||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?g[0].$el_text=Ti(e):g[0].$el_text=Li(e)),"change"===s.type&&c){var S=Wi(e);S&&(S.$el_value&&(g[0].$el_value=S.$el_value),S.$selected_text&&(g[0].$selected_text=S.$selected_text))}if(f){g[0].attr__href=f;var k=null===(i=Be(f))||void 0===i?void 0:i.host,x=null===(r=null==U?void 0:U.location)||void 0===r?void 0:r.host;k&&x&&k!==x&&(_=f)}var E=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Object.assign({},...t)}({$event_type:s.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:Zi(g)},(null===(n=g[0])||void 0===n?void 0:n.$el_text)?{$el_text:null===(a=g[0])||void 0===a?void 0:a.$el_text}:{},_&&"click"===s.type?{$external_click_url:_}:{},p);return{props:E}}var ar=["copy","cut"];class sr{static extractConfig(e){return{enabled:!1!==e.autocapture}}constructor(e,t){this.name="Autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._userOverride=null,this._elementSelectors=null,this._rageclicks=new rr,this._elementsChainAsString=!0,this._cachedConfig=null,this._cachedConfigSource=null,this._domHandler=null,this._copyHandler=null,this._copyHandlerAttached=!1,this._scrollDepthTracker=null,this._pageviewUnsubscribe=null,this._instance=e}get _config(){var e=this._instance.getConfig().autocapture;if(e===this._cachedConfigSource&&this._cachedConfig)return this._cachedConfig;this._cachedConfigSource=e;var t=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(e)?e:{};return t.url_allowlist&&(t.url_allowlist=t.url_allowlist.map(e=>"string"==typeof e?new RegExp(e):e)),t.url_ignorelist&&(t.url_ignorelist=t.url_ignorelist.map(e=>"string"==typeof e?new RegExp(e):e)),this._cachedConfig=t,t}get isEnabled(){return this._evaluateEnabled().enabled}get isStarted(){return this._initialized}startIfEnabled(){var{enabled:e,reason:t}=this._evaluateEnabled();e?this._initialized?(this._syncCopyHandler(),this._syncScrollDepthHandler()):(this._addDomEventHandlers(),this._initialized=!0,ae().info("autocapture","started; listening for click/change/submit events")):this._initialized?(ae().info("autocapture","stopping; reason:",null!=t?t:"unknown"),this._removeDomEventHandlers(),this._initialized=!1):(ae().debug("autocapture","not started; reason:",null!=t?t:"unknown"),this._teardownScrollDepth())}stop(){this._initialized&&(this._removeDomEventHandlers(),this._initialized=!1,ae().info("autocapture","stopped (DOM listeners detached)")),this._teardownScrollDepth()}getMaxScrollDepthPctForPageleave(){var e=er(this._config.scroll_depth);return(null==e?void 0:e.pageleave)&&this._scrollDepthTracker?this._scrollDepthTracker.getMaxPct():null}onConfigUpdate(e){var t=e;"boolean"==typeof t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),void 0!==t.autocapture_opt_out&&(this._isDisabledServerSide=!!t.autocapture_opt_out),this.startIfEnabled()}updateConfig(e){void 0!==e.enabled&&(this._userOverride=e.enabled,e.enabled&&(this._isDisabledServerSide=!1),this.startIfEnabled())}getDiagnostics(){var e,t,i,{enabled:r,reason:n}=this._evaluateEnabled(),a=er(this._config.scroll_depth);return{isEnabled:r,isStarted:this._initialized,disabledReason:r?null:n,inputs:{configAutocapture:this._instance.getConfig().autocapture,isDisabledServerSide:null!==(e=this._isDisabledServerSide)&&void 0!==e&&e,userOverride:this._userOverride,elementsChainAsString:this._elementsChainAsString,captureCopiedText:!!this._config.capture_copied_text,scrollDepthMilestones:null!==(t=null==a?void 0:a.milestones)&&void 0!==t&&t,scrollDepthPageleave:null!==(i=null==a?void 0:a.pageleave)&&void 0!==i&&i,scrollDepthListenerAttached:null!==this._scrollDepthTracker}}}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach(t=>{var r=null==H?void 0:H.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&i.push(t)})}),i}_evaluateEnabled(){if(!1===this._userOverride)return{enabled:!1,reason:"user_stop_called"};if(this._isDisabledServerSide)return{enabled:!1,reason:"server_opt_out"};if(!0===this._userOverride)return{enabled:!0,reason:null};var e=this._instance.getConfig().autocapture;return!1===e?{enabled:!1,reason:"config_autocapture_false"}:null==e?{enabled:!1,reason:"config_autocapture_undefined"}:{enabled:!0,reason:null}}_addDomEventHandlers(){this._isBrowserSupported()?U&&H&&(this._domHandler=e=>{var t=e||(null==U?void 0:U.event);if(t)try{this._captureEvent(t)}catch(e){ae().error("autocapture","capture handler threw",e)}},Le(H,"submit",this._domHandler,{capture:!0}),Le(H,"change",this._domHandler,{capture:!0}),Le(H,"click",this._domHandler,{capture:!0}),this._syncCopyHandler(),this._syncScrollDepthHandler()):ae().warn("autocapture","browser unsupported (no querySelectorAll)")}_removeDomEventHandlers(){H&&(this._domHandler&&(H.removeEventListener("submit",this._domHandler,!0),H.removeEventListener("change",this._domHandler,!0),H.removeEventListener("click",this._domHandler,!0),this._domHandler=null),this._copyHandler&&this._copyHandlerAttached&&(H.removeEventListener("copy",this._copyHandler,!0),H.removeEventListener("cut",this._copyHandler,!0),this._copyHandlerAttached=!1,this._copyHandler=null),this._teardownScrollDepth())}_syncScrollDepthHandler(){var e,t=er(this._config.scroll_depth),i=this.isEnabled&&null!==t&&null!==er(null==(e=this._config)?void 0:e.scroll_depth);i&&!this._scrollDepthTracker?(this._scrollDepthTracker=new tr({milestones:t.milestones,pageleave:t.pageleave,thresholds:t.thresholds,scroll_root_selector:t.scroll_root_selector,capture:(e,t)=>this._instance.capture(e,t),isUrlAllowed:()=>{return e=this._config,!(!U||(null==e?void 0:e.url_allowlist)&&!Di(e.url_allowlist)||(null==e?void 0:e.url_ignorelist)&&Di(e.url_ignorelist));var e},onPageview:e=>(this._pageviewUnsubscribe&&this._pageviewUnsubscribe(),this._pageviewUnsubscribe=this._instance.on(pe,t=>{(null==t?void 0:t.event)===m&&e()}),()=>{var e;null===(e=this._pageviewUnsubscribe)||void 0===e||e.call(this),this._pageviewUnsubscribe=null})}),this._scrollDepthTracker.start(),ae().info("autocapture","scroll depth tracking started",{milestones:t.milestones,pageleave:t.pageleave})):i||this._teardownScrollDepth()}_teardownScrollDepth(){this._scrollDepthTracker&&(this._scrollDepthTracker.stop(),this._scrollDepthTracker=null,ae().info("autocapture","scroll depth tracking stopped")),this._pageviewUnsubscribe&&(this._pageviewUnsubscribe(),this._pageviewUnsubscribe=null)}_syncCopyHandler(){if(H){var e=!!this._config.capture_copied_text;e&&!this._copyHandlerAttached?(this._copyHandler=e=>{var t=e||(null==U?void 0:U.event);if(t)try{this._captureEvent(t,mi)}catch(e){ae().error("autocapture","copy handler threw",e)}},Le(H,"copy",this._copyHandler,{capture:!0}),Le(H,"cut",this._copyHandler,{capture:!0}),this._copyHandlerAttached=!0):!e&&this._copyHandlerAttached&&this._copyHandler&&(H.removeEventListener("copy",this._copyHandler,!0),H.removeEventListener("cut",this._copyHandler,!0),this._copyHandlerAttached=!1,this._copyHandler=null)}}_captureEvent(e,t){var i,r,n,a,s,o,l,d;if(void 0===t&&(t="$autocapture"),this.isEnabled)if(e.isTrusted){var u=function(e){var t;return K(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}(e);if(Si(u)&&(u=u.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent)this._instance.getConfig().rageclick&&(null===(i=this._rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&(ae().info("autocapture","$rageclick detected"),this._captureEvent(e,"$rageclick"));var c=t===mi;if(u){var h=Vi(u,e,this._config,c,c?[...ar]:void 0);if(h.capture){var v=this._instance.getConfig(),{props:_,explicitNoCapture:g}=nr(u,{e:e,maskAllElementAttributes:null!==(a=v.mask_all_element_attributes)&&void 0!==a&&a,maskAllText:null!==(s=v.mask_all_text)&&void 0!==s&&s,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,captureElementValues:null!==(o=this._config.capture_element_values)&&void 0!==o&&o});if(g)return ae().debug("autocapture","skip: vt-no-capture class on element chain",{tag:null===(l=u.tagName)||void 0===l?void 0:l.toLowerCase()}),!1;var p=this.getElementSelectors(u);if(p&&p.length>0&&(_.$element_selectors=p),t===mi){var f=Mi(null===(d=null==U?void 0:U.getSelection())||void 0===d?void 0:d.toString()),m=e.type||"clipboard";if(!f)return ae().debug("autocapture","skip copy: empty selection"),!1;_.$selected_content=f,_.$copy_type=m}return this._instance.capture(t,_),!0}ae().debug("autocapture","skip:",null!==(r=h.reason)&&void 0!==r?r:"unknown",{type:e.type,tag:null===(n=u.tagName)||void 0===n?void 0:n.toLowerCase()})}else ae().debug("autocapture","skip: no event target",{type:e.type})}else ae().debug("autocapture","skip: synthetic event (isTrusted=false)",{type:e.type})}_isBrowserSupported(){return Q(null==H?void 0:H.querySelectorAll)}}var or="replay";class lr extends ci{constructor(e,t){super(e,t||lr.extractConfig(e.getConfig())),this.name="SessionRecording",this.scriptName="recorder"}static extractConfig(e){var t,i,r,n=e.session_recording||{};return{enabled:null!==(t=n.enabled)&&void 0!==t&&t,sampleRate:n.sampleRate,minimumDurationMs:n.minimumDurationMs,sessionIdleThresholdMs:n.sessionIdleThresholdMs,fullSnapshotIntervalMs:n.fullSnapshotIntervalMs,captureConsole:null!==(i=n.captureConsole)&&void 0!==i&&i,captureNetwork:null!==(r=n.captureNetwork)&&void 0!==r&&r,captureCanvas:n.captureCanvas,blockClass:n.blockClass,blockSelector:n.blockSelector,skipDefaultInvisibleBlocking:n.skipDefaultInvisibleBlocking,ignoreClass:n.ignoreClass,maskTextClass:n.maskTextClass,maskTextSelector:n.maskTextSelector,maskAllInputs:n.maskAllInputs,maskInputOptions:n.maskInputOptions,masking:n.masking,recordHeaders:n.recordHeaders,recordBody:n.recordBody,compressEvents:n.compressEvents,__mutationThrottlerRefillRate:n.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:n.__mutationThrottlerBucketSize}}get isEnabled(){var e,t=this._instance.getConfig(),i=null!==(e=this._config.enabled)&&void 0!==e&&e,r=!t.disable_session_recording;return!!U&&i&&r}get isStarted(){var e;return this._isStarted&&!!(null===(e=this._loaded)||void 0===e?void 0:e.isStarted)}startIfEnabled(){this.startIfEnabledOrStop("recording_initialized")}startIfEnabledOrStop(e){var t;if(!this.isEnabled||!(null===(t=this._loaded)||void 0===t?void 0:t.isStarted)){var i=void 0!==Object.assign&&void 0!==Array.from;this.isEnabled&&i?(this._isStarted=!0,this._ensureLoaded(t=>this._onLoaded(t,e)),ae().info(or,"starting")):this.stop()}}stop(){oe(()=>{var e;null===(e=this._loaded)||void 0===e||e.stop(),this._isStarted=!1})}onConfigUpdate(e){var t;this._config=lr.extractConfig(e),null===(t=this._loaded)||void 0===t||t.updateConfig(this._config),this.startIfEnabledOrStop("config_updated")}_createLoaded(){var e,t=null===(e=j.__VTiltExtensions__)||void 0===e?void 0:e.initSessionRecording;if(!t)throw new Error("[vTilt:replay] initSessionRecording not available after script load");return t(this._instance,this._config)}_onLoaded(e,t){e.start(t)}get started(){return this.isStarted}get status(){var e;return(null===(e=this._loaded)||void 0===e?void 0:e.status)||"lazy_loading"}get sessionId(){var e;return(null===(e=this._loaded)||void 0===e?void 0:e.sessionId)||""}stopRecording(){this.stop()}log(e,t){var i;void 0===t&&(t="log"),(null===(i=this._loaded)||void 0===i?void 0:i.log)?this._loaded.log(e,t):ae().warn(or,"log called before recorder was ready")}updateConfig(e){var t;this._config=i({},this._config,e),null===(t=this._loaded)||void 0===t||t.updateConfig(this._config)}}var dr=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(dr||{});dr.MouseMove,dr.MouseInteraction,dr.Scroll,dr.ViewportResize,dr.Input,dr.TouchMove,dr.MediaInteraction,dr.Drag;var ur=Uint8Array,cr=Uint16Array,hr=Int32Array,vr=new ur([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),_r=new ur([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),gr=new ur([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pr=function(e,t){for(var i=new cr(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var n=new hr(i[30]);for(r=1;r<30;++r)for(var a=i[r];a<i[r+1];++a)n[a]=a-i[r]<<5|r;return{b:i,r:n}},fr=pr(vr,2),mr=fr.b,br=fr.r;mr[28]=258,br[258]=28;for(var yr=pr(_r,0).r,wr=new cr(32768),Cr=0;Cr<32768;++Cr){var Sr=(43690&Cr)>>1|(21845&Cr)<<1;Sr=(61680&(Sr=(52428&Sr)>>2|(13107&Sr)<<2))>>4|(3855&Sr)<<4,wr[Cr]=((65280&Sr)>>8|(255&Sr)<<8)>>1}var kr=function(e,t,i){for(var r=e.length,n=0,a=new cr(t);n<r;++n)e[n]&&++a[e[n]-1];var s,o=new cr(t);for(n=1;n<t;++n)o[n]=o[n-1]+a[n-1]<<1;if(i){s=new cr(1<<t);var l=15-t;for(n=0;n<r;++n)if(e[n])for(var d=n<<4|e[n],u=t-e[n],c=o[e[n]-1]++<<u,h=c|(1<<u)-1;c<=h;++c)s[wr[c]>>l]=d}else for(s=new cr(r),n=0;n<r;++n)e[n]&&(s[n]=wr[o[e[n]-1]++]>>15-e[n]);return s},xr=new ur(288);for(Cr=0;Cr<144;++Cr)xr[Cr]=8;for(Cr=144;Cr<256;++Cr)xr[Cr]=9;for(Cr=256;Cr<280;++Cr)xr[Cr]=7;for(Cr=280;Cr<288;++Cr)xr[Cr]=8;var Er=new ur(32);for(Cr=0;Cr<32;++Cr)Er[Cr]=5;var Ir=kr(xr,9,0),Mr=kr(Er,5,0),Lr=function(e){return(e+7)/8|0},Ar=function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new ur(e.subarray(t,i))},Tr=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8},Pr=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8,e[r+2]|=i>>16},Rr=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var n=i.length,a=i.slice();if(!n)return{t:Hr,l:0};if(1==n){var s=new ur(i[0].s+1);return s[i[0].s]=1,{t:s,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],l=i[1],d=0,u=1,c=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=n-1;)o=i[i[d].f<i[c].f?d++:c++],l=i[d!=u&&i[d].f<i[c].f?d++:c++],i[u++]={s:-1,f:o.f+l.f,l:o,r:l};var h=a[0].s;for(r=1;r<n;++r)a[r].s>h&&(h=a[r].s);var v=new cr(h+1),_=Dr(i[u-1],v,0);if(_>t){r=0;var g=0,p=_-t,f=1<<p;for(a.sort(function(e,t){return v[t.s]-v[e.s]||e.f-t.f});r<n;++r){var m=a[r].s;if(!(v[m]>t))break;g+=f-(1<<_-v[m]),v[m]=t}for(g>>=p;g>0;){var b=a[r].s;v[b]<t?g-=1<<t-v[b]++-1:++r}for(;r>=0&&g;--r){var y=a[r].s;v[y]==t&&(--v[y],++g)}_=t}return{t:new ur(v),l:_}},Dr=function(e,t,i){return-1==e.s?Math.max(Dr(e.l,t,i+1),Dr(e.r,t,i+1)):t[e.s]=i},Or=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new cr(++t),r=0,n=e[0],a=1,s=function(e){i[r++]=e},o=1;o<=t;++o)if(e[o]==n&&o!=t)++a;else{if(!n&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(n),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(n);a=1,n=e[o]}return{c:i.subarray(0,r),n:t}},$r=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},Ur=function(e,t,i){var r=i.length,n=Lr(t+2);e[n]=255&r,e[n+1]=r>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var a=0;a<r;++a)e[n+a+4]=i[a];return 8*(n+4+r)},Nr=function(e,t,i,r,n,a,s,o,l,d,u){Tr(t,u++,i),++n[256];for(var c=Rr(n,15),h=c.t,v=c.l,_=Rr(a,15),g=_.t,p=_.l,f=Or(h),m=f.c,b=f.n,y=Or(g),w=y.c,C=y.n,S=new cr(19),k=0;k<m.length;++k)++S[31&m[k]];for(k=0;k<w.length;++k)++S[31&w[k]];for(var x=Rr(S,7),E=x.t,I=x.l,M=19;M>4&&!E[gr[M-1]];--M);var L,A,T,P,R=d+5<<3,D=$r(n,xr)+$r(a,Er)+s,O=$r(n,h)+$r(a,g)+s+14+3*M+$r(S,E)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&R<=D&&R<=O)return Ur(t,u,e.subarray(l,l+d));if(Tr(t,u,1+(O<D)),u+=2,O<D){L=kr(h,v,0),A=h,T=kr(g,p,0),P=g;var $=kr(E,I,0);Tr(t,u,b-257),Tr(t,u+5,C-1),Tr(t,u+10,M-4),u+=14;for(k=0;k<M;++k)Tr(t,u+3*k,E[gr[k]]);u+=3*M;for(var U=[m,w],N=0;N<2;++N){var B=U[N];for(k=0;k<B.length;++k){var H=31&B[k];Tr(t,u,$[H]),u+=E[H],H>15&&(Tr(t,u,B[k]>>5&127),u+=B[k]>>12)}}}else L=Ir,A=xr,T=Mr,P=Er;for(k=0;k<o;++k){var q=r[k];if(q>255){Pr(t,u,L[(H=q>>18&31)+257]),u+=A[H+257],H>7&&(Tr(t,u,q>>23&31),u+=vr[H]);var F=31&q;Pr(t,u,T[F]),u+=P[F],F>3&&(Pr(t,u,q>>5&8191),u+=_r[F])}else Pr(t,u,L[q]),u+=A[q]}return Pr(t,u,L[256]),u+A[256]},Br=new hr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Hr=new ur(0),qr=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),Fr=function(e,t,i,r,n){if(!n&&(n={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),s=new ur(a.length+e.length);s.set(a),s.set(e,a.length),e=s,n.w=a.length}return function(e,t,i,r,n,a){var s=a.z||e.length,o=new ur(r+s+5*(1+Math.ceil(s/7e3))+n),l=o.subarray(r,o.length-n),d=a.l,u=7&(a.r||0);if(t){u&&(l[0]=a.r>>3);for(var c=Br[t-1],h=c>>13,v=8191&c,_=(1<<i)-1,g=a.p||new cr(32768),p=a.h||new cr(_+1),f=Math.ceil(i/3),m=2*f,b=function(t){return(e[t]^e[t+1]<<f^e[t+2]<<m)&_},y=new hr(25e3),w=new cr(288),C=new cr(32),S=0,k=0,x=a.i||0,E=0,I=a.w||0,M=0;x+2<s;++x){var L=b(x),A=32767&x,T=p[L];if(g[A]=T,p[L]=A,I<=x){var P=s-x;if((S>7e3||E>24576)&&(P>423||!d)){u=Nr(e,l,0,y,w,C,k,E,M,x-M,u),E=S=k=0,M=x;for(var R=0;R<286;++R)w[R]=0;for(R=0;R<30;++R)C[R]=0}var D=2,O=0,$=v,U=A-T&32767;if(P>2&&L==b(x-U))for(var N=Math.min(h,P)-1,B=Math.min(32767,x),H=Math.min(258,P);U<=B&&--$&&A!=T;){if(e[x+D]==e[x+D-U]){for(var q=0;q<H&&e[x+q]==e[x+q-U];++q);if(q>D){if(D=q,O=U,q>N)break;var F=Math.min(U,q-2),z=0;for(R=0;R<F;++R){var j=x-U+R&32767,W=j-g[j]&32767;W>z&&(z=W,T=j)}}}U+=(A=T)-(T=g[A])&32767}if(O){y[E++]=268435456|br[D]<<18|yr[O];var V=31&br[D],K=31&yr[O];k+=vr[V]+_r[K],++w[257+V],++C[K],I=x+D,++S}else y[E++]=e[x],++w[e[x]]}}for(x=Math.max(x,I);x<s;++x)y[E++]=e[x],++w[e[x]];u=Nr(e,l,d,y,w,C,k,E,M,x-M,u),d||(a.r=7&u|l[u/8|0]<<3,u-=7,a.h=p,a.p=g,a.i=x,a.w=I)}else{for(x=a.w||0;x<s+d;x+=65535){var G=x+65535;G>=s&&(l[u/8|0]=d,G=s),u=Ur(l,u+1,e.subarray(x,G))}a.i=s}return Ar(o,0,r+Lr(u)+n)}(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,r,n)},zr=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function jr(e,t){t||(t={});var i=function(){var e=-1;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=qr[255&i^t[r]]^i>>>8;e=i},d:function(){return~e}}}(),r=e.length;i.p(e);var n,a=Fr(e,t,10+((n=t).filename?n.filename.length+1:0),8),s=a.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&zr(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(a,t),zr(a,s-8,i.d()),zr(a,s-4,r),a}var Wr="undefined"!=typeof TextEncoder&&new TextEncoder,Vr="undefined"!=typeof TextDecoder&&new TextDecoder;try{Vr.decode(Hr,{stream:!0})}catch(e){}var Kr="vtilt-bubble-pos";function Gr(e,t,i){var r=e.getBoundingClientRect(),n=r.left-t,a=r.top-i,s=window.innerWidth-e.offsetWidth-n,o=-n,l=window.innerHeight-e.offsetHeight-a,d=-a;return{x:Math.min(Math.max(t,o),s),y:Math.min(Math.max(i,d),l)}}function Jr(e,t,i){e.style.transform="translate3d("+t+"px, "+i+"px, 0)"}function Qr(e,t){var i=e,r=0,n=0,a=0,s=0,o=0,l=0,d=!1,u=!1,c=function(){try{var e=localStorage.getItem(Kr);if(!e)return null;var t=JSON.parse(e);if("number"==typeof t.x&&"number"==typeof t.y)return t}catch(e){}return null}();if(c){r=c.x,n=c.y;var h=e.style.transition;e.style.transition="none",Jr(e,r,n);var v=Gr(e,r,n);r=v.x,n=v.y,Jr(e,r,n),e.offsetHeight,e.style.transition=h}i.style.cursor="grab",i.style.touchAction="none";var _=t=>{0===t.button&&(d=!0,u=!1,a=t.clientX,s=t.clientY,o=r,l=n,i.setPointerCapture(t.pointerId),i.style.cursor="grabbing",e.style.transition="none")},g=t=>{if(d){var i=t.clientX-a,c=t.clientY-s;if(!(!u&&Math.abs(i)<5&&Math.abs(c)<5)){u=!0;var h={x:o+i,y:l+c},v=Gr(e,h.x,h.y);r=v.x,n=v.y,Jr(e,r,n)}}},p=()=>{d&&(d=!1,i.style.cursor="grab",e.style.transition="",u&&function(e){try{localStorage.setItem(Kr,JSON.stringify(e))}catch(e){}}({x:r,y:n}))},f=e=>{u&&(e.stopPropagation(),e.preventDefault(),u=!1)},m=()=>{var t=Gr(e,r,n);r=t.x,n=t.y,Jr(e,r,n)};return i.addEventListener("pointerdown",_),i.addEventListener("pointermove",g),i.addEventListener("pointerup",p),i.addEventListener("pointercancel",p),i.addEventListener("click",f,!0),window.addEventListener("resize",m),{destroy(){i.removeEventListener("pointerdown",_),i.removeEventListener("pointermove",g),i.removeEventListener("pointerup",p),i.removeEventListener("pointercancel",p),i.removeEventListener("click",f,!0),window.removeEventListener("resize",m)}}}var Xr="chat";class Zr extends ui{constructor(e,t){super(e,t||Zr.extractConfig(e.getConfig())),this.name="Chat",this.scriptName="chat",this._serverConfig=null,this._configFetched=!1,this._loadError=null,this._bubbleDragHandle=null,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[],this._bubbleExplicitShow=!1,this._onVisibilityChange=()=>{"visible"===document.visibilityState&&this._fetchUnreadForBubble()}}static extractConfig(e){var t,i=e.chat||{};return{enabled:i.enabled,autoConfig:null===(t=i.autoConfig)||void 0===t||t,position:i.position,greeting:i.greeting,color:i.color,aiMode:i.aiMode,aiGreeting:i.aiGreeting,preload:i.preload,offlineMessage:i.offlineMessage,collectEmailOffline:i.collectEmailOffline,bubble:i.bubble}}get isEnabled(){var e;return!1!==this._config.enabled&&(!0===this._config.enabled||!this._instance.getConfig().disable_chat&&!0===(null===(e=this._serverConfig)||void 0===e?void 0:e.enabled))}startIfEnabled(){ae().debug(Xr,"startIfEnabled"),this._startAsync().catch(e=>{ae().error(Xr,"error starting:",e)})}stop(){this.destroy(),this._isStarted=!1}onConfigUpdate(e){var t,i;this._config=Zr.extractConfig(e),this._loaded&&(null===(i=(t=this._loaded).updateConfig)||void 0===i||i.call(t,this.getMergedConfig()))}_createLoaded(){var e,t,i,r=null===(e=j.__VTiltExtensions__)||void 0===e?void 0:e.initChat;if(!r)throw new Error("[vTilt:chat] initChat not available after script load");var n=this.getMergedConfig(),a=r(this._instance,n);this._bubbleExplicitShow&&a.show(),this._messageCallbacks.forEach(e=>a.onMessage(e)),this._typingCallbacks.forEach(e=>a.onTyping(e)),this._connectionCallbacks.forEach(e=>a.onConnectionChange(e)),null===(t=this._bubbleDragHandle)||void 0===t||t.destroy(),this._bubbleDragHandle=null;var s=null===(i=null==U?void 0:U.document)||void 0===i?void 0:i.getElementById("vtilt-chat-bubble");return s&&!s.closest("#vtilt-chat-container")&&s.remove(),a}_onLoaded(e){this._pendingCallbacks.forEach(e=>e()),this._pendingCallbacks=[],ae().info(Xr,"loaded and ready")}_startAsync(){var e=this;return t(function*(){var t,i,r,n,a;try{if(!1===e._config.enabled)return void ae().info(Xr,"disabled by code config");if(e._instance.getConfig().disable_chat)return void ae().info(Xr,"disabled by disable_chat config");if(!1!==e._config.autoConfig&&(yield e._fetchServerSettings()),!e.isEnabled)return void ae().info(Xr,"not enabled (check dashboard settings)");ae().debug(Xr,"startIfEnabled enabled"),e._isStarted=!0,null!==(r=null!==(t=e._config.preload)&&void 0!==t?t:null===(i=e._serverConfig)||void 0===i?void 0:i.enabled)&&void 0!==r&&r&&e._schedulePreload();var s=e.getMergedConfig();(null===(n=e._serverConfig)||void 0===n?void 0:n.enabled)&&!1!==(null===(a=s.bubble)||void 0===a?void 0:a.visible)&&e._showBubble(),ae().info(Xr,"ready (lazy-load on demand)")}finally{e._markApiReady()}})()}get isOpen(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.isOpen)&&void 0!==t&&t}get isConnected(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.isConnected)&&void 0!==t&&t}get isLoading(){var e,t;return this._isLoading||null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.isLoading)&&void 0!==t&&t}get unreadCount(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.unreadCount)&&void 0!==t?t:0}get channel(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.channel)&&void 0!==t?t:null}get channels(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.channels)&&void 0!==t?t:[]}get currentView(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.currentView)&&void 0!==t?t:"list"}open(){this._deferCall(()=>{this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.open()})})}close(){this._deferCall(()=>{this._loaded?this._loaded.close():this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.close()})})}toggle(){this._deferCall(()=>{this._loaded?this._loaded.toggle():this.open()})}show(){this._deferCall(()=>{this._bubbleExplicitShow=!0,this._loaded?this._loaded.show():this._isStarted&&this._showBubble()})}hide(){this._deferCall(()=>{var e;if(this._bubbleExplicitShow=!1,this._loaded)this._loaded.hide();else{var t=null===(e=null==U?void 0:U.document)||void 0===e?void 0:e.getElementById("vtilt-chat-bubble");t&&(t.style.display="none")}})}getChannels(){this._deferCall(()=>{this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.getChannels()})})}selectChannel(e){this._deferCall(()=>{this._lazyLoadAndThen(()=>{var t;return null===(t=this._loaded)||void 0===t?void 0:t.selectChannel(e)})})}createChannel(){this._deferCall(()=>{this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.createChannel()})})}goToChannelList(){this._deferCall(()=>{this._loaded?this._loaded.goToChannelList():this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.goToChannelList()})})}sendMessage(e,t){this._deferCall(()=>{this._loaded?this._loaded.sendMessage(e,t):(this._pendingMessages.push({content:e,options:t}),this._lazyLoadAndThen(()=>{this._pendingMessages.forEach(e=>{var t,{content:i,options:r}=e;null===(t=this._loaded)||void 0===t||t.sendMessage(i,r)}),this._pendingMessages=[]}))})}markAsRead(){this._deferCall(()=>{this._loaded?this._loaded.markAsRead():this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.markAsRead()})})}registerWidget(e){this._deferCall(()=>{var t,i;this._loaded?null===(i=(t=this._loaded).registerWidget)||void 0===i||i.call(t,e):this._lazyLoadAndThen(()=>{var t,i;null===(i=null===(t=this._loaded)||void 0===t?void 0:t.registerWidget)||void 0===i||i.call(t,e)})})}onMessage(e){return this._messageCallbacks.push(e),this._loaded?this._loaded.onMessage(e):()=>{var t=this._messageCallbacks.indexOf(e);t>-1&&this._messageCallbacks.splice(t,1)}}onTyping(e){return this._typingCallbacks.push(e),this._loaded?this._loaded.onTyping(e):()=>{var t=this._typingCallbacks.indexOf(e);t>-1&&this._typingCallbacks.splice(t,1)}}onConnectionChange(e){return this._connectionCallbacks.push(e),this._loaded?this._loaded.onConnectionChange(e):()=>{var t=this._connectionCallbacks.indexOf(e);t>-1&&this._connectionCallbacks.splice(t,1)}}updateConfig(e){var t,r;this._config=i({},this._config,e),this._loaded&&(null===(r=(t=this._loaded).updateConfig)||void 0===r||r.call(t,this.getMergedConfig()))}getMergedConfig(){var e,t,i,r,n,a,s,o,l,d,u,c,h,v,_,g,p,f,m,b,y,w,C,S,k=this._serverConfig,x=this._config;return{enabled:null!==(t=null!==(e=x.enabled)&&void 0!==e?e:null==k?void 0:k.enabled)&&void 0!==t&&t,autoConfig:null===(i=x.autoConfig)||void 0===i||i,position:null!==(n=null!==(r=x.position)&&void 0!==r?r:null==k?void 0:k.position)&&void 0!==n?n:"bottom-right",greeting:null!==(a=x.greeting)&&void 0!==a?a:null==k?void 0:k.greeting,color:null!==(o=null!==(s=x.color)&&void 0!==s?s:null==k?void 0:k.color)&&void 0!==o?o:"#6366f1",aiMode:null===(d=null!==(l=x.aiMode)&&void 0!==l?l:null==k?void 0:k.ai_enabled)||void 0===d||d,aiGreeting:null!==(u=x.aiGreeting)&&void 0!==u?u:null==k?void 0:k.ai_greeting,preload:null!==(c=x.preload)&&void 0!==c&&c,theme:null!==(h=x.theme)&&void 0!==h?h:{primaryColor:null!==(_=null!==(v=x.color)&&void 0!==v?v:null==k?void 0:k.color)&&void 0!==_?_:"#6366f1"},offlineMessage:null!==(g=x.offlineMessage)&&void 0!==g?g:null==k?void 0:k.offline_message,collectEmailOffline:null===(f=null!==(p=x.collectEmailOffline)&&void 0!==p?p:null==k?void 0:k.collect_email_offline)||void 0===f||f,bubble:{draggable:null!==(y=null!==(b=null===(m=x.bubble)||void 0===m?void 0:m.draggable)&&void 0!==b?b:null==k?void 0:k.bubble_draggable)&&void 0!==y&&y,visible:null===(S=null!==(C=null===(w=x.bubble)||void 0===w?void 0:w.visible)&&void 0!==C?C:null==k?void 0:k.bubble_visible)||void 0===S||S}}}destroy(){oe(()=>{var e,t,i;document.removeEventListener("visibilitychange",this._onVisibilityChange),null===(e=this._loaded)||void 0===e||e.destroy(),this._loaded=void 0,this._bubbleExplicitShow=!1,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[],this._resetDeferral(),null===(t=this._bubbleDragHandle)||void 0===t||t.destroy(),this._bubbleDragHandle=null;var r=null===(i=null==U?void 0:U.document)||void 0===i?void 0:i.getElementById("vtilt-chat-bubble");r&&r.remove()})}_fetchServerSettings(){var e=this;return t(function*(){if(!e._configFetched){var t=e._instance.getConfig();if(!t.token)return ae().warn(Xr,"cannot fetch settings: missing token"),void(e._configFetched=!0);try{var i=de(t,"/api/chat/settings"),r=yield fetch(i,{headers:ue(t)});if(!r.ok)return ae().warn(Xr,"failed to fetch settings: "+r.status),void(e._configFetched=!0);e._serverConfig=yield r.json(),e._configFetched=!0,ae().info(Xr,"loaded settings from dashboard")}catch(t){ae().warn(Xr,"error fetching settings:",t),e._configFetched=!0}}})()}_fetchUnreadForBubble(){var e=this;return t(function*(){var t,i,r,n,a=e._instance.getConfig(),s=a.token,o=null!==(r=null===(i=(t=e._instance).getDistinctId)||void 0===i?void 0:i.call(t))&&void 0!==r?r:"";if(ae().debug("chat","fetchUnread","distinctId",o?o.slice(0,12)+"...":"empty"),s&&o)try{var l=de(a,"/api/chat/widget/unread"),d=l.includes("?")?"&":"?",u=""+l+d+"distinct_id="+encodeURIComponent(o),c=yield fetch(u,{headers:ue(a)});if(!c.ok)return;var h=yield c.json(),v=Number(null!==(n=h.unread_count)&&void 0!==n?n:0),_=document.getElementById("vtilt-chat-bubble");if(!_)return;var g=_.querySelector(".vtilt-chat-bubble-badge");if(!g)return;v>0?(g.style.display="flex",g.textContent=v>99?"99+":String(v)):g.style.display="none"}catch(e){}else{var p=s?"missing distinctId":"missing token";ae().debug("chat","fetchUnread skip","reason",p)}})()}_showBubble(){var e,t;if(null==U?void 0:U.document){var i=document.getElementById("vtilt-chat-bubble");if(i)i.style.display="flex";else{var r=this.getMergedConfig(),n=r.position||"bottom-right",a=r.color||"#6366f1",s=document.createElement("div");s.id="vtilt-chat-bubble",s.setAttribute("style",("\n position: fixed;\n bottom: 20px;\n "+("bottom-right"===n?"right: 20px;":"left: 20px;")+"\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+a+";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n transition: transform 0.2s, box-shadow 0.2s;\n z-index: 999999;\n ").trim()),s.innerHTML='\n <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">\n <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>\n </svg>\n <div class="vtilt-chat-bubble-badge" style="\n display: none;\n position: absolute;\n top: -4px;\n right: -4px;\n background: #E53935;\n color: white;\n font-size: 11px;\n font-weight: 700;\n min-width: 20px;\n height: 20px;\n border-radius: 10px;\n align-items: center;\n justify-content: center;\n padding: 0 6px;\n box-sizing: border-box;\n border: 2px solid white;\n ">0</div>\n ';var o=!0===(null===(e=r.bubble)||void 0===e?void 0:e.draggable);o||(s.addEventListener("mouseenter",()=>{s.style.transform="scale(1.05)",s.style.boxShadow="0 6px 16px rgba(0, 0, 0, 0.2)"}),s.addEventListener("mouseleave",()=>{s.style.transform="scale(1)",s.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"})),s.addEventListener("click",()=>{this.open()}),document.body.appendChild(s),o&&(null===(t=this._bubbleDragHandle)||void 0===t||t.destroy(),this._bubbleDragHandle=Qr(s)),this._fetchUnreadForBubble(),document.addEventListener("visibilitychange",this._onVisibilityChange)}}}_schedulePreload(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this._ensureLoaded(()=>{}),{timeout:5e3}):setTimeout(()=>this._ensureLoaded(()=>{}),3e3)}_lazyLoadAndThen(e){this._loaded?e():(this._pendingCallbacks.push(e),this._ensureLoaded(e=>this._onLoaded(e)))}}function Yr(e,t){e("js",new Date);var{tagIds:r,configParams:n,sendPageView:a,debugMode:s,conversionLinker:o,linkerDomains:l}=t,d=i({},n||{});for(var u of(!1===a&&(d.send_page_view=!1),s&&(d.debug_mode=!0),!1===o&&(d.conversion_linker=!1),l&&l.length>0&&(d.linker={domains:l,decorate_forms:!0}),r))u&&e("config",u,d)}function en(e,t){var i,r=(e.tagIds||[]).filter(e=>!!e);if(0===r.length)return null;var n,a,s,o=null!==(i=e.proxyMode)&&void 0!==i?i:"proxied";if("direct"===o)n=rn,a=rn,s="";else{var l=function(e){var t,i=void 0!==U&&(null===(t=null==U?void 0:U.location)||void 0===t?void 0:t.origin)?U.location.origin:"";if(!e)return i?{base:i,absoluteBase:i}:null;var r=e.replace(/\/+$/g,"");if(!r)return i?{base:i,absoluteBase:i}:null;try{var n=new URL(r),a=n.pathname.replace(/\/$/,""),s=""+n.origin+a;return{base:s,absoluteBase:s}}catch(e){}if(r.startsWith("/"))return{base:r,absoluteBase:i?""+i+r:r};return i?{base:i,absoluteBase:i}:null}(t);if(!l)return null;n=l.base,a=l.absoluteBase,s=tn}var d={};if("direct"!==o){var u=function(e){if(!e)return"";var t=e.startsWith("/")?e:"/"+e;return t.replace(/\/$/,"")}(s);d.transport_url=""+a.replace(/\/$/,"")+u}return{origin:n,gatewayPath:s,primaryTagId:r.find(e=>e.startsWith("G-"))||r[0]||"",tagIds:r,configParams:d,sendPageView:!1!==e.capturePageview,debugMode:!!e.debugMode,conversionLinker:!1!==e.conversionLinker,linkerDomains:e.linkerDomains}}var tn="/gt",rn="https://www.googletagmanager.com";function nn(e,t){var r=!0===e.advertising,n={ad_storage:r?"granted":"denied",ad_user_data:r?"granted":"denied",ad_personalization:r?"granted":"denied",analytics_storage:!0===e.analytics?"granted":"denied"};if(!t)return n;var a=i({},n);return Object.keys(n).forEach(i=>{var r=t[i];void 0!==r&&(a[i]=function(e,t){return"granted"===t?"granted":"denied"===t?"denied":"follow_advertising"===t?!0===e.advertising?"granted":"denied":"follow_analytics"===t&&!0===e.analytics?"granted":"denied"}(e,r))}),a}function an(e){if(null==e)return null;var t=String(e).trim().toLowerCase();return t||null}function sn(e,t){if(e&&t){var i=t.split("."),r=e;for(var n of i){if(null==r||"object"!=typeof r)return;r=r[n]}return r}}function on(e){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e&&""!==e.trim()){var t=Number(e);if(Number.isFinite(t))return t}}function ln(e){if(null!=e)return"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):void 0}function dn(e){var{mapping:t,payload:i}=e,r={send_to:t.send_to},n=t.value_param_path||"value",a=t.currency_param_path||"currency",s=on(sn(i,n));void 0!==s&&(r.value=s);var o=ln(sn(i,a))||t.default_currency||void 0;if(o&&(r.currency=o),!1!==t.send_transaction_id){var l=ln(sn(i,t.transaction_id_param_path||"transaction_id"));l&&(r.transaction_id=l)}return{send_to:t.send_to,params:r}}var un=[{source:"$pageview",destination:"page_view",buildParams:e=>{var t,i={},r=ln(e.$current_url);r&&(i.page_location=r);var n=ln(e.$pathname);n&&(i.page_path=n);var a=null!==(t=ln(e.title))&&void 0!==t?t:ln(e.$title);a&&(i.page_title=a);var s=ln(e.$referrer);return s&&(i.page_referrer=s),i}},{source:"$pageleave",destination:"user_engagement",buildParams:e=>{var t,i,r={},n=on(null!==(i=null!==(t=e.$dwell_time_ms)&&void 0!==t?t:e.engagement_time_msec)&&void 0!==i?i:e.$time_on_page_ms);return void 0!==n&&(r.engagement_time_msec=Math.round(n)),r}}];function cn(e,t,i){var r=t.split(".").filter(Boolean);if(0!==r.length)if(1!==r.length){for(var n=e,a=0;a<r.length-1;a++){var s=r[a],o=r[a+1];if(null==n||"object"!=typeof n||Array.isArray(n))return;var l=n;if(/^\d+$/.test(o)){var d=Array.isArray(l[s])?l[s]:[];Array.isArray(l[s])||(l[s]=d);for(var u=parseInt(o,10);d.length<=u;)d.push({});if(a+1===r.length-1)return void(d[u]=i);var c=d[u];c&&"object"==typeof c&&!Array.isArray(c)||(c={},d[u]=c),n=c,a++}else{var h=l[s];h&&"object"==typeof h&&!Array.isArray(h)||(h={},l[s]=h),n=h}}var v=r[r.length-1];n&&"object"==typeof n&&!Array.isArray(n)&&(n[v]=i)}else e[r[0]]=i}var hn=new Set(["client_id","user_id","first_visit","session_start"]);function vn(e,t,i,r){if(!function(e,t){return!(t&&(Array.isArray(t.exclude)&&t.exclude.includes(e)||Array.isArray(t.include)&&t.include.length>0&&!t.include.includes(e)))}(t,r.eventFilter))return{fired:!1};var n=(r.eventMappings||[]).find(e=>(null==e?void 0:e.source)===t);if(n&&n.destination){var{name:a,params:s}=function(e,t){var i={},r=Array.isArray(e.param_mappings)?e.param_mappings:[];for(var n of r){var a=null==n?void 0:n.source,s=null==n?void 0:n.destination;if(a&&s){var o=sn(t,a);void 0!==o&&(s.includes(".")?cn(i,s,o):i[s]=o)}}return{name:e.destination,params:i}}(n,i);return e("event",a,s),{fired:!0,eventName:a,params:s,source:"mapping"}}if(!1===r.autoForward)return{fired:!1};var o=un.find(e=>e.source===t);if(o){var l=o.buildParams(i);return e("event",o.destination,l),{fired:!0,eventName:o.destination,params:l,source:"preset"}}if(t.startsWith("$"))return{fired:!1};var d=function(e){var t={};for(var[i,r]of Object.entries(e))i.startsWith("$")||hn.has(i)||void 0!==r&&(t[i]=r);return t}(i);return e("event",t,d),{fired:!0,eventName:t,params:d,source:"auto"}}function _n(){var e=null,t=[],i=[];return{call:function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];if((e=>{i.push(e),i.length>50&&i.shift()})(n),e)try{e(...n)}catch(e){}else t.push(n)},flush(i){for(e=i;t.length;){var r=t.shift();try{i(...r)}catch(e){}}},getRecentCalls:()=>i.slice()}}function gn(e){return pn.apply(this,arguments)}function pn(){return(pn=t(function*(e){try{var t="undefined"!=typeof crypto&&crypto.subtle?crypto.subtle:null;if(!t)return null;var i=(new TextEncoder).encode(e),r=yield t.digest("SHA-256",i);return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return null}})).apply(this,arguments)}function fn(){return(fn=t(function*(e){var t={},i=function(e){if(!e)return null;var t=String(e).trim().toLowerCase();if(!t)return null;if(!t.includes("@"))return null;var[i,r]=t.split("@");if(!i||!r)return null;if("gmail.com"===r||"googlemail.com"===r){var n=i.split("+")[0].replace(/\./g,"");return n?n+"@"+r:null}return i+"@"+r}(e.email),r=function(e){if(!e)return null;var t=String(e).trim();if(!t)return null;if(t.startsWith("+")){var i=t.slice(1).replace(/\D/g,"");return i?"+"+i:null}return null}(e.phone),n=an(e.first_name),a=an(e.last_name),s=an(e.street),o=an(e.city),l=an(e.region),d=function(e){if(!e)return null;var t=String(e).trim().toUpperCase().replace(/\s+/g,"");return t||null}(e.postal_code),u=an(e.country);if(i){var c=yield gn(i);c&&(t.sha256_email_address=c)}if(r){var h=yield gn(r);h&&(t.sha256_phone_number=h)}var v={};if(n){var _=yield gn(n);_&&(v.sha256_first_name=_)}if(a){var g=yield gn(a);g&&(v.sha256_last_name=g)}if(s){var p=yield gn(s);p&&(v.sha256_street=p)}return o&&(v.city=o),l&&(v.region=l),d&&(v.postal_code=d),u&&(v.country=u),Object.keys(v).length>0&&(t.address=v),0===Object.keys(t).length?null:t})).apply(this,arguments)}class mn{constructor(e){void 0===e&&(e=Number.POSITIVE_INFINITY),this._maxItems=e,this._items=[]}get length(){return this._items.length}enqueue(e){return!(this._items.length>=this._maxItems)&&(this._items.push(e),!0)}takeAll(){if(0===this._items.length)return[];var e=this._items;return this._items=[],e}clear(){this._items=[]}}var bn="google-tag";class yn{constructor(e,t){this.name="GoogleTagGateway",this._isStarted=!1,this._scriptInjected=!1,this._scriptLoaded=!1,this._consentDefaultsPushed=!1,this._gtag=null,this._loaderOptions=null,this._unsubscribeCaptured=null,this._unsubscribeConsent=null,this._deliveryLog=[],this._maxDeliveryLog=100,this._pendingCaptures=new mn(100),this._instance=e,this._config=t||yn.extractConfig(e.getConfig()),this._publicApi=_n(),this._subscribeCaptured()}static extractConfig(e){if(e.disable_google_tag)return{enabled:!1};var t=e.google_tag;return t?{enabled:(t.tagIds||[]).some(e=>!!e),remote:t}:{enabled:!1}}get isEnabled(){return!1!==this._config.enabled&&!!this._config.remote}get isStarted(){return this._isStarted}get gtag(){return this._publicApi.call}get deliveryLog(){return this._deliveryLog.slice()}startIfEnabled(){this._isStarted||this.isEnabled&&this._instance.getConfig().__remote_config_loaded&&this._start()}stop(){var e;this._isStarted&&(null===(e=this._unsubscribeConsent)||void 0===e||e.call(this),this._unsubscribeConsent=null,this._isStarted=!1)}onConfigUpdate(e){var t=yn.extractConfig(e),i=this.isEnabled;this._config=t;var r=!0===e.__remote_config_loaded;if(i&&!this.isEnabled)this.stop();else if(this._isStarted&&t.remote&&this._loaderOptions){var n=en(t.remote,this._instance.getConfig().api_host);n&&(this._loaderOptions=n,Yr(this._gtag,n))}r&&!this.isEnabled&&this._pendingCaptures.clear(),r&&this.isEnabled&&!this._isStarted&&this.startIfEnabled()}setUserData(e){var i=this;return t(function*(){var t=i._config.remote;if(t&&t.enhancedConversions){var r=yield function(e){return fn.apply(this,arguments)}(e);r&&i._publicApi.call("set","user_data",r)}})()}getRecentPublicCalls(){return this._publicApi.getRecentCalls()}_start(){var e=this._config.remote;if(e){var t=en(e,this._instance.getConfig().api_host);if(t){this._loaderOptions=t;var{gtag:i}=function(){var e,t,i=j,r=null!==(e=(t=i).dataLayer)&&void 0!==e?e:t.dataLayer=[],n=i.gtag;if(n)return{gtag:n,dataLayer:r};var a=function(){r.push(arguments)};return i.gtag=a,{gtag:a,dataLayer:r}}();this._gtag=i,this._publicApi.flush(i),this._pushConsentDefaultsOnce(),Yr(i,t),this._scriptInjected||(this._scriptInjected=!0,function(e,t,i){var r=null==U?void 0:U.document;if(!r)return null;var{origin:n,gatewayPath:a,primaryTagId:s}=e;if(!n||!s)return null;var o=""+n.replace(/\/$/,"")+(a?a.startsWith("/")?a.replace(/\/$/,""):"/"+a.replace(/\/$/,""):"")+"/gtag/js?id="+encodeURIComponent(s)+"&l=dataLayer",l=r.querySelector('script[data-vtilt-gtag-loader="'+s+'"]');if(l)return l;var d=r.createElement("script");d.async=!0,d.src=o,d.setAttribute("data-vtilt-gtag-loader",s),d.onload=()=>null==t?void 0:t(),d.onerror=()=>{var e=new Error("[GoogleTagGateway] failed to load "+o);null==i||i(e)},(r.head||r.body||r.documentElement).appendChild(d)}(t,()=>{this._scriptLoaded=!0},e=>{ae().warn(bn,e.message)})),this._subscribeConsent(),this._isStarted=!0,this._drainPending()}else ae().warn(bn,"skipped — missing tag_ids or resolvable origin")}}_drainPending(){for(var e of this._pendingCaptures.takeAll())this._handleCaptured(e.event,e.payload)}_pushConsentDefaultsOnce(){var e;if(!this._consentDefaultsPushed&&this._gtag){var t=oe(()=>this._instance.consentManager.getConsent());!function(e,t,r){e("consent","default",i({},nn(t,r),{wait_for_update:500}))}(this._gtag,t||{},null===(e=this._config.remote)||void 0===e?void 0:e.consentOverride),this._consentDefaultsPushed=!0}}_subscribeCaptured(){if(!this._unsubscribeCaptured){this._unsubscribeCaptured=this._instance._emitter.on(pe,e=>{var t=e;t&&"string"==typeof t.event&&this._handleCaptured(t.event,t.payload||{})})}}_handleCaptured(e,t){var i=this._instance.getConfig();if(!i.disable_google_tag)if(i.__remote_config_loaded){if(this.isEnabled&&(this._isStarted||this.startIfEnabled(),this._gtag&&this._config.remote&&this._isStarted)){var r=this._config.remote,n=r.tagIds||[],a=vn(this._gtag,e,t,r);if(a.fired&&a.eventName&&this._record({ts:Date.now(),tag_ids:n,event_name:e,send_to:"ga4:"+a.eventName,status:"fired",reason:a.source}),!1!==r.sendAdsConversions){var s=function(e,t,i,r){var n=(r.conversions||[]).filter(e=>e.event_name===t);if(0===n.length)return[];var a=[];for(var s of n){var o=dn({mapping:s,payload:i});e("event","conversion",o.params),a.push(o)}return a}(this._gtag,e,t,r);for(var o of s)this._record({ts:Date.now(),tag_ids:n,event_name:e,send_to:o.send_to,status:"fired"})}}}else this._pendingCaptures.enqueue({event:e,payload:t})}_subscribeConsent(){if(!this._unsubscribeConsent){this._unsubscribeConsent=this._instance._emitter.on(ge,e=>{var t;if(this._gtag){var i,r,n,a=e;i=this._gtag,r=a.consent||{},n=null===(t=this._config.remote)||void 0===t?void 0:t.consentOverride,i("consent","update",nn(r,n))}})}}_record(e){this._deliveryLog.push(e),this._deliveryLog.length>this._maxDeliveryLog&&this._deliveryLog.shift()}}var wn="vtd-overlay";class Cn{constructor(e,t){this.name="VtdOverlay",this._isStarted=!1,this._destinationUrl=null,this._originalUrl=null,this._isLoading=!0,this._container=null,this._iframe=null,this._loadingEl=null,this._instance=e,this._config=t||Cn.extractConfig(e.getConfig())}static extractConfig(e){return{enabled:!1!==e.vtd_overlay}}get isEnabled(){return!1!==this._config.enabled}get isStarted(){return this._isStarted}startIfEnabled(){}stop(){this._isStarted&&oe(()=>{this._destroyOverlay(),this._isStarted=!1})}onConfigUpdate(e){this._config=Cn.extractConfig(e),!this.isEnabled&&this._isStarted&&this.stop()}setDestinationUrl(e){var t;if(this.isEnabled)if(null==e?void 0:e.trim()){var i=e;try{i=decodeURIComponent(e)}catch(t){i=e}if(this._isValidUrl(i)){var r=this._toEmbedUrl(i);this._originalUrl=i,this._destinationUrl=r,this._isLoading=!0,this._showOverlay(),this._isStarted=!0,this._instance.capture("$vtd_view",{$vtd_url:i,$vtd_embed_url:r!==i?r:void 0,$current_url:null===(t=null==U?void 0:U.location)||void 0===t?void 0:t.href})}else ae().warn(wn,"invalid URL: "+i)}else ae().warn(wn,"empty URL provided");else ae().warn(wn,"feature is disabled")}getDestinationUrl(){return this._destinationUrl}close(){this._instance.capture("$vtd_close",{$vtd_url:this._originalUrl}),this._container?(this._container.classList.add("vtilt-vtd-closing"),setTimeout(()=>{this._destroyOverlay(),this._isStarted=!1,this._destinationUrl=null,this._originalUrl=null},200)):(this._destroyOverlay(),this._isStarted=!1,this._destinationUrl=null,this._originalUrl=null)}_isValidUrl(e){try{var t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch(e){return!1}}_toEmbedUrl(e){try{var t=new URL(e),i=t.hostname.toLowerCase();if("youtube.com"===i||"www.youtube.com"===i||"m.youtube.com"===i){var r=t.searchParams.get("v");if(r){var n=t.searchParams.get("t"),a="https://www.youtube.com/embed/"+r+"?autoplay=1";return n&&(a+="&start="+n.replace("s","")),a}}if("youtu.be"===i){var s=t.pathname.slice(1);if(s){var o=t.searchParams.get("t"),l="https://www.youtube.com/embed/"+s+"?autoplay=1";return o&&(l+="&start="+o.replace("s","")),l}}if("vimeo.com"===i||"www.vimeo.com"===i){var d=t.pathname.match(/^\/(\d+)/);if(d)return"https://player.vimeo.com/video/"+d[1]+"?autoplay=1"}if("loom.com"===i||"www.loom.com"===i){var u=t.pathname.match(/^\/share\/([a-zA-Z0-9]+)/);if(u)return"https://www.loom.com/embed/"+u[1]+"?autoplay=1"}if(i.endsWith("wistia.com")){var c=t.pathname.match(/^\/medias\/([a-zA-Z0-9]+)/);if(c)return"https://fast.wistia.net/embed/iframe/"+c[1]+"?autoplay=1"}if("dailymotion.com"===i||"www.dailymotion.com"===i){var h=t.pathname.match(/^\/video\/([a-zA-Z0-9]+)/);if(h)return"https://www.dailymotion.com/embed/video/"+h[1]+"?autoplay=1"}if("open.spotify.com"===i){var v=t.pathname.match(/^\/(track|album|playlist|episode|show)\/([a-zA-Z0-9]+)/);if(v)return"https://open.spotify.com/embed/"+v[1]+"/"+v[2]}return"drive.google.com"===i&&t.pathname.includes("/view")?e.replace("/view","/preview"):e}catch(t){return e}}_getHostname(e){try{return new URL(e).hostname}catch(t){return e}}_getFaviconUrl(e){try{return"https://www.google.com/s2/favicons?domain="+new URL(e).hostname+"&sz=32"}catch(e){return""}}_showOverlay(){if(H&&this._destinationUrl){this._destroyOverlay(),this._container=H.createElement("div"),this._container.id="vtilt-vtd-overlay",this._container.className="vtilt-vtd-opening",this._container.setAttribute("style",this._getBackdropStyles());var e=H.createElement("div");e.className="vtilt-vtd-modal",e.setAttribute("style",this._getModalStyles());var t=H.createElement("div");t.className="vtilt-vtd-header",t.setAttribute("style",this._getHeaderStyles()),t.innerHTML=this._getHeaderHTML(),e.appendChild(t);var i=H.createElement("div");i.className="vtilt-vtd-iframe-wrapper",i.setAttribute("style",this._getIframeWrapperStyles()),this._loadingEl=H.createElement("div"),this._loadingEl.className="vtilt-vtd-loading",this._loadingEl.setAttribute("style",this._getLoadingStyles()),this._loadingEl.innerHTML=this._getLoadingHTML(),i.appendChild(this._loadingEl),this._iframe=H.createElement("iframe"),this._iframe.id="vtilt-vtd-iframe",this._iframe.className="vtilt-vtd-iframe",this._iframe.setAttribute("style",this._getIframeStyles()),this._iframe.setAttribute("frameborder","0"),this._iframe.setAttribute("allowfullscreen","true"),this._iframe.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share");var r=()=>{this._isLoading=!1,this._loadingEl&&(this._loadingEl.style.opacity="0",setTimeout(()=>{var e;(null===(e=this._loadingEl)||void 0===e?void 0:e.parentNode)&&(this._loadingEl.style.display="none")},300)),this._iframe&&(this._iframe.style.opacity="1")};this._iframe.onload=r,this._iframe.onerror=r,setTimeout(()=>{this._isLoading&&r()},5e3),i.appendChild(this._iframe),this._iframe.src=this._destinationUrl,e.appendChild(i),this._container.appendChild(e);var n=H.createElement("style");n.id="vtilt-vtd-styles",n.textContent=this._getGlobalStyles(),H.head.appendChild(n),H.body.appendChild(this._container),this._attachEventListeners(),H.body.style.overflow="hidden"}}_destroyOverlay(){var e;(null===(e=this._container)||void 0===e?void 0:e.parentNode)&&(this._container.parentNode.removeChild(this._container),this._container=null,this._iframe=null,this._loadingEl=null);var t=null==H?void 0:H.getElementById("vtilt-vtd-styles");(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t),(null==H?void 0:H.body)&&(H.body.style.overflow="")}_attachEventListeners(){var e,t,i,r=null===(e=this._container)||void 0===e?void 0:e.querySelector(".vtilt-vtd-close");null==r||r.addEventListener("click",()=>this.close());var n=null===(t=this._container)||void 0===t?void 0:t.querySelector(".vtilt-vtd-open");null==n||n.addEventListener("click",()=>{this._originalUrl&&(null==U||U.open(this._originalUrl,"_blank"))}),null===(i=this._container)||void 0===i||i.addEventListener("click",e=>{e.target===this._container&&this.close()});var a=e=>{"Escape"===e.key&&(this.close(),null==H||H.removeEventListener("keydown",a))};null==H||H.addEventListener("keydown",a)}_getBackdropStyles(){return'\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 2147483647;\n background: rgba(0, 0, 0, 0.85);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n '}_getModalStyles(){return"\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background: #0a0a0a;\n overflow: hidden;\n "}_getHeaderStyles(){return"\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 16px;\n height: 56px;\n background: linear-gradient(180deg, rgba(20, 20, 20, 1) 0%, rgba(15, 15, 15, 1) 100%);\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n flex-shrink: 0;\n gap: 16px;\n "}_getHeaderHTML(){var e=this._originalUrl||this._destinationUrl,t=e?this._getHostname(e):"";return'\n <div style="display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;">\n <img \n src="'+(e?this._getFaviconUrl(e):"")+'" \n alt="" \n style="width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;"\n onerror="this.style.display=\'none\'"\n />\n <div style="\n display: flex;\n flex-direction: column;\n min-width: 0;\n gap: 2px;\n ">\n <div style="\n color: rgba(255, 255, 255, 0.95);\n font-size: 14px;\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.2;\n ">'+this._escapeHtml(t)+'</div>\n <div style="\n color: rgba(255, 255, 255, 0.45);\n font-size: 12px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.2;\n ">'+this._escapeHtml(this._truncateUrl(e||"",50))+'</div>\n </div>\n </div>\n <div style="display: flex; align-items: center; gap: 8px; flex-shrink: 0;">\n <button class="vtilt-vtd-open vtilt-vtd-btn" title="Open in new tab">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>\n <polyline points="15 3 21 3 21 9"></polyline>\n <line x1="10" y1="14" x2="21" y2="3"></line>\n </svg>\n <span class="vtilt-vtd-btn-text">Open</span>\n </button>\n <button class="vtilt-vtd-close vtilt-vtd-btn vtilt-vtd-btn-primary" title="Close (Esc)">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n <span class="vtilt-vtd-btn-text">Close</span>\n </button>\n </div>\n '}_getIframeWrapperStyles(){return"\n flex: 1;\n position: relative;\n background: #000;\n overflow: hidden;\n "}_getLoadingStyles(){return"\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: #0a0a0a;\n z-index: 1;\n transition: opacity 0.3s ease;\n "}_getLoadingHTML(){var e=this._originalUrl||this._destinationUrl,t=e?this._getHostname(e):"";return'\n <div class="vtilt-vtd-spinner"></div>\n <div style="\n margin-top: 20px;\n color: rgba(255, 255, 255, 0.7);\n font-size: 14px;\n font-weight: 500;\n ">Loading '+this._escapeHtml(t)+'...</div>\n <div style="\n margin-top: 8px;\n color: rgba(255, 255, 255, 0.35);\n font-size: 12px;\n ">Press <kbd style="\n display: inline-block;\n padding: 2px 6px;\n background: rgba(255, 255, 255, 0.1);\n border-radius: 4px;\n font-family: inherit;\n font-size: 11px;\n ">Esc</kbd> to close</div>\n '}_getIframeStyles(){return"\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: none;\n background: white;\n opacity: 0;\n transition: opacity 0.3s ease;\n "}_getGlobalStyles(){return"\n /* Animations */\n @keyframes vtilt-vtd-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n @keyframes vtilt-vtd-fade-out {\n from { opacity: 1; }\n to { opacity: 0; }\n }\n \n @keyframes vtilt-vtd-scale-in {\n from { opacity: 0; transform: scale(0.96); }\n to { opacity: 1; transform: scale(1); }\n }\n \n @keyframes vtilt-vtd-spin {\n to { transform: rotate(360deg); }\n }\n \n /* Container animations */\n #vtilt-vtd-overlay.vtilt-vtd-opening {\n animation: vtilt-vtd-fade-in 0.2s ease-out forwards;\n }\n \n #vtilt-vtd-overlay.vtilt-vtd-opening .vtilt-vtd-modal {\n animation: vtilt-vtd-scale-in 0.25s ease-out forwards;\n }\n \n #vtilt-vtd-overlay.vtilt-vtd-closing {\n animation: vtilt-vtd-fade-out 0.2s ease-in forwards;\n }\n \n /* Loading spinner */\n .vtilt-vtd-spinner {\n width: 40px;\n height: 40px;\n border: 3px solid rgba(255, 255, 255, 0.1);\n border-top-color: rgba(255, 255, 255, 0.8);\n border-radius: 50%;\n animation: vtilt-vtd-spin 0.8s linear infinite;\n }\n \n /* Button base styles */\n .vtilt-vtd-btn {\n background: rgba(255, 255, 255, 0.08);\n border: 1px solid rgba(255, 255, 255, 0.1);\n color: rgba(255, 255, 255, 0.9);\n padding: 8px 14px;\n border-radius: 8px;\n cursor: pointer;\n font-size: 13px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 6px;\n transition: all 0.15s ease;\n -webkit-tap-highlight-color: transparent;\n outline: none;\n }\n \n .vtilt-vtd-btn:hover {\n background: rgba(255, 255, 255, 0.14);\n border-color: rgba(255, 255, 255, 0.18);\n }\n \n .vtilt-vtd-btn:active {\n background: rgba(255, 255, 255, 0.18);\n transform: scale(0.98);\n }\n \n .vtilt-vtd-btn:focus-visible {\n box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);\n }\n \n /* Primary button variant */\n .vtilt-vtd-btn-primary {\n background: rgba(255, 255, 255, 0.95);\n border-color: transparent;\n color: #0a0a0a;\n }\n \n .vtilt-vtd-btn-primary:hover {\n background: rgba(255, 255, 255, 1);\n border-color: transparent;\n }\n \n .vtilt-vtd-btn-primary:active {\n background: rgba(255, 255, 255, 0.85);\n }\n \n /* Desktop responsive - modal with margin */\n @media (min-width: 768px) {\n #vtilt-vtd-overlay {\n padding: 32px;\n }\n \n .vtilt-vtd-modal {\n max-width: 1200px;\n max-height: 90vh;\n width: 100%;\n height: auto;\n min-height: 500px;\n border-radius: 16px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);\n }\n \n .vtilt-vtd-header {\n border-radius: 16px 16px 0 0;\n }\n \n .vtilt-vtd-iframe-wrapper {\n border-radius: 0 0 16px 16px;\n min-height: 400px;\n }\n }\n \n /* Large desktop - bigger modal */\n @media (min-width: 1400px) {\n #vtilt-vtd-overlay {\n padding: 48px;\n }\n \n .vtilt-vtd-modal {\n max-width: 1400px;\n max-height: 85vh;\n }\n }\n \n /* Tablet */\n @media (min-width: 768px) and (max-width: 1024px) {\n #vtilt-vtd-overlay {\n padding: 24px;\n }\n \n .vtilt-vtd-modal {\n max-width: 95%;\n max-height: 90vh;\n }\n }\n \n /* Mobile - fullscreen */\n @media (max-width: 767px) {\n #vtilt-vtd-overlay {\n padding: 0 !important;\n background: #0a0a0a !important;\n }\n \n .vtilt-vtd-modal {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n max-height: none !important;\n border-radius: 0 !important;\n }\n \n .vtilt-vtd-header {\n border-radius: 0 !important;\n padding: 0 12px !important;\n height: 52px !important;\n }\n \n .vtilt-vtd-btn {\n padding: 8px 10px !important;\n }\n \n .vtilt-vtd-btn-text {\n display: none !important;\n }\n \n .vtilt-vtd-iframe-wrapper {\n border-radius: 0 !important;\n }\n }\n \n /* Reduced motion */\n @media (prefers-reduced-motion: reduce) {\n #vtilt-vtd-overlay,\n #vtilt-vtd-overlay *,\n .vtilt-vtd-spinner {\n animation-duration: 0.01ms !important;\n transition-duration: 0.01ms !important;\n }\n }\n "}_truncateUrl(e,t){return e.length<=t?e:e.substring(0,t-3)+"..."}_escapeHtml(e){if(void 0===H)return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");var t=H.createElement("div");return t.textContent=e,t.innerHTML}}var Sn,kn="text/plain",xn=61440;!function(e){e.GZipJS="gzip-js",e.Base64="base64",e.None="none"}(Sn||(Sn={}));var En=function(e,t){void 0===t&&(t="binary");var{data:i,compression:r}=e;if(i){var n=(e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t))(i),a=new Blob([n]).size;if(r===Sn.GZipJS&&a>=1024)try{var s=jr(function(e,t){if(Wr)return Wr.encode(e);for(var i=e.length,r=new ur(e.length+(e.length>>1)),n=0,a=function(e){r[n++]=e},s=0;s<i;++s){if(n+5>r.length){var o=new ur(n+8+(i-s<<1));o.set(r),r=o}var l=e.charCodeAt(s);l<128||t?a(l):l<2048?(a(192|l>>6),a(128|63&l)):l>55295&&l<57344?(a(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++s))>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|63&l)):(a(224|l>>12),a(128|l>>6&63),a(128|63&l))}return Ar(r,0,n)}(n),{mtime:0});if("text-base64"===t){var o=function(e){if("undefined"==typeof btoa)throw new Error("btoa is not available in this environment");for(var t="",i=0;i<e.length;i+=32768){var r=Math.min(i+32768,e.length),n=e.subarray(i,r);t+=String.fromCharCode.apply(null,n)}return btoa(t)}(s);if(o.length>0&&o.length<.95*a)return{contentType:kn,body:o,estimatedSize:o.length,compressionApplied:Sn.Base64}}else{var l=new Blob([s],{type:kn});if(l.size>0&&l.size<.95*a)return{contentType:kn,body:l,estimatedSize:l.size,compressionApplied:Sn.GZipJS}}}catch(e){}return{contentType:"application/json",body:n,estimatedSize:a,compressionApplied:null}}};function In(e,t){return t.compressionApplied?(i=e.url,r=t.compressionApplied,n=i.includes("?")?"&":"?",""+i+n+"compression="+r):e.url;var i,r,n}function Mn(e,t){var i={};return t&&(i["Content-Type"]=t),e.headers&&Object.assign(i,e.headers),e.projectToken&&(i[le]=e.projectToken),i}var Ln=[{name:"fetch",isAvailable:()=>"undefined"!=typeof fetch,method:e=>{var i=En(e,"binary");if(i){var{contentType:r,body:n,estimatedSize:a}=i,s=In(e,i),o=Mn(e,r),l=new AbortController,d=e.timeout?setTimeout(()=>l.abort(),e.timeout):null;fetch(s,{method:e.method||"POST",headers:o,body:n,keepalive:a<xn,signal:l.signal}).then(function(){var i=t(function*(t){var i,r=yield t.text(),n={statusCode:t.status,text:r};if(200===t.status){Se();try{n.json=JSON.parse(r)}catch(e){}}null===(i=e.callback)||void 0===i||i.call(e,n)});return function(e){return i.apply(this,arguments)}}()).catch(()=>{var t;Ce("capture"),null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})}).finally(()=>{d&&clearTimeout(d)})}}},{name:"XHR",isAvailable:()=>"undefined"!=typeof XMLHttpRequest,method:e=>{var t=En(e,"binary");if(t){var{contentType:i,body:r}=t,n=In(e,t),a=Mn(e,i),s=new XMLHttpRequest;for(var[o,l]of(s.open(e.method||"POST",n,!0),Object.entries(a)))s.setRequestHeader(o,l);e.timeout&&(s.timeout=e.timeout),s.onreadystatechange=()=>{var t;if(4===s.readyState){var i={statusCode:s.status,text:s.responseText};if(200===s.status){Se();try{i.json=JSON.parse(s.responseText)}catch(e){}}null===(t=e.callback)||void 0===t||t.call(e,i)}},s.onerror=()=>{var t;Ce("capture"),null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})},s.send(r)}}},{name:"sendBeacon",isAvailable:()=>"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:e=>{var t=En(e,"text-base64");if(t){var{contentType:r,body:n,estimatedSize:a}=t;if(0!==a){var s=In(e,t),o=e.projectToken?function(e,t){if(!t||/[?&]token=/.test(e))return e;var i=e.includes("?")?"&":"?";return""+e+i+"token="+t}(s,e.projectToken):s;if(a<=xn)try{var l="string"==typeof n?new Blob([n],{type:r}):n;if("undefined"!=typeof navigator&&navigator.sendBeacon)if(navigator.sendBeacon(o,l))return}catch(e){}try{var d="string"==typeof n?new Blob([n],{type:r}):n,u=i({"Content-Type":r},e.headers||{});fetch(o,{method:e.method||"POST",headers:u,body:d,keepalive:a<xn}).catch(()=>{})}catch(e){}}}}}],An=e=>{var t,i;if(ke())null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0});else{var r=e.transport||"fetch",n=Ln.find(e=>e.name===r&&e.isAvailable())||Ln.find(e=>e.isAvailable());if(!n)return ae().error("request","no available transport method"),void(null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0}));n.method(e)}};class Tn{constructor(e,t){var i,r,n,a;this._isPaused=!0,this._queue=[],this._flushTimeoutMs=(i=(null==t?void 0:t.flush_interval_ms)||3e3,r=250,n=5e3,a=3e3,"number"!=typeof i||isNaN(i)?a:Math.min(Math.max(i,r),n)),this._sendRequest=e}get length(){return this._queue.length}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){if(this._clearFlushTimeout(),0!==this._queue.length){var e=this._formatQueue();for(var t in e){var r=e[t];this._sendRequest(i({},r,{transport:"sendBeacon"}))}}}enable(){this._isPaused=!1,this._setFlushTimeout()}pause(){this._isPaused=!0,this._clearFlushTimeout()}flush(){this._clearFlushTimeout(),this._flushNow(),this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{this._clearFlushTimeout(),this._flushNow(),this._queue.length>0&&this._setFlushTimeout()},this._flushTimeoutMs))}_clearFlushTimeout(){this._flushTimeout&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0)}_flushNow(){if(0!==this._queue.length){var e=this._formatQueue(),t=Date.now();for(var i in e){var r=e[i];r.events.forEach(e=>{var i=new Date(e.timestamp).getTime();e.$offset=Math.abs(i-t)}),this._sendRequest(r)}}}_formatQueue(){var e={};return this._queue.forEach(t=>{var i=t.batchKey||t.url;e[i]||(e[i]={url:t.url,events:[],batchKey:t.batchKey}),e[i].events.push(t.event)}),this._queue=[],e}}class Pn{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._areWeOnline=!0,this._sendRequest=e.sendRequest,this._sendBeacon=e.sendBeacon,U&&void 0!==B&&"onLine"in B&&(this._areWeOnline=B.onLine,Le(U,"online",()=>{this._areWeOnline=!0,this._flush()}),Le(U,"offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}enqueue(e,t){if(void 0===t&&(t=0),t>=10)ae().error("retry","request failed after 10 retries, giving up");else if(!ke()){var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),n=(Math.random()-.5)*(r-i);return Math.ceil(r+n)}(t),r=Date.now()+i;this._queue.push({retryAt:r,request:e,retriesPerformedSoFar:t+1});var n="enqueued failed request for retry in "+Math.round(i/1e3)+"s";this._areWeOnline||(n+=" (browser is offline)"),ae().warn("retry",n),this._isPolling||(this._isPolling=!0,this._poll())}}retriableRequest(e){var i=this;return t(function*(){try{var t=yield i._sendRequest(e);200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&i.enqueue(e,0)}catch(t){i.enqueue(e,0)}})()}_poll(){this._poller&&clearTimeout(this._poller),this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._queue.length>0?this._poll():this._isPolling=!1},this._pollIntervalMs)}_flush(){var e=this,i=Date.now(),r=[],n=[];this._queue.forEach(e=>{e.retryAt<i?n.push(e):r.push(e)}),this._queue=r,n.forEach(function(){var i=t(function*(t){var{request:i,retriesPerformedSoFar:r}=t;try{var n=yield e._sendRequest(i);200!==n.statusCode&&(n.statusCode<400||n.statusCode>=500)&&e.enqueue(i,r)}catch(t){e.enqueue(i,r)}});return function(e){return i.apply(this,arguments)}}())}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._queue.forEach(e=>{var{request:t}=e;try{this._sendBeacon(t)}catch(e){ae().error("retry","failed to send beacon on unload",e)}}),this._queue=[]}}var Rn="vt_rate_limit";class Dn{constructor(e){var t,i;void 0===e&&(e={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(t=e.eventsPerSecond)&&void 0!==t?t:10,this.eventsBurstLimit=Math.max(null!==(i=e.eventsBurstLimit)&&void 0!==i?i:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=e.persistence,this.captureWarning=e.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(e){var t,i,r,n;void 0===e&&(e=!1);var a=Date.now(),s=null!==(i=null===(t=this.persistence)||void 0===t?void 0:t.get(Rn))&&void 0!==i?i:{tokens:this.eventsBurstLimit,last:a},o=(a-s.last)/1e3;s.tokens+=o*this.eventsPerSecond,s.last=a,s.tokens>this.eventsBurstLimit&&(s.tokens=this.eventsBurstLimit);var l=s.tokens<1;return l||e||(s.tokens=Math.max(0,s.tokens-1)),!l||this.lastEventRateLimited||e||null===(r=this.captureWarning)||void 0===r||r.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=l,null===(n=this.persistence)||void 0===n||n.set(Rn,s),{isRateLimited:l,remainingTokens:s.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class On{constructor(e){this._remoteConfig=null,this._initConfig=null,this._host=e}get config(){return this._remoteConfig}onApply(e){this._onApply=e}onLoad(e){this._onLoad=e}load(){var e,t=this._host.getConfig();if(t.token){if(this._initConfig||(this._initConfig=i({},t)),null===(e=t.bootstrap)||void 0===e?void 0:e.remoteConfig)return this._remoteConfig=t.bootstrap.remoteConfig,this._apply(this._remoteConfig),void this._fetch();var r=oe(()=>U.__VTILT_BOOTSTRAP__);if(null==r?void 0:r.remoteConfig)return this._remoteConfig=r.remoteConfig,this._apply(this._remoteConfig),void this._fetch();oe(()=>{var e=localStorage.getItem(u+"_"+t.token);e&&(this._remoteConfig=JSON.parse(e),this._apply(this._remoteConfig,!0))}),this._fetch()}}_fetch(){var e=this._host.getConfig();if(e.token)if(ke())this._host.updateConfig({__remote_config_loaded:!0});else{var t=this._host.buildEndpointUrl("/api/d"),r=new AbortController,n=setTimeout(()=>r.abort(),3e3);(F||fetch)(t,{method:"GET",signal:r.signal,headers:i({Accept:"application/json"},ue(e))}).then(e=>e.json()).then(t=>{var i;clearTimeout(n),Se(),this._remoteConfig=t,oe(()=>{localStorage.setItem(u+"_"+e.token,JSON.stringify(t))}),this._apply(t),null===(i=this._onLoad)||void 0===i||i.call(this,t)}).catch(()=>{clearTimeout(n),Ce("config"),this._host.updateConfig({__remote_config_loaded:!0})})}}_apply(e,t){var r,n,a,s;void 0===t&&(t=!1);var o=this._initConfig||this._host.getConfig(),l={};for(var[,d]of this._host.featureManager.getDescriptors())if(d.remoteConfig&&d.configKey){var u=e[d.remoteConfig.key];u&&void 0===o[d.configKey]&&(l[d.configKey]=d.remoteConfig.map(u))}if(e.analytics&&!t&&(void 0!==e.analytics.capturePageview&&void 0===o.capture_pageview&&(l.capture_pageview=e.analytics.capturePageview),void 0!==e.analytics.capturePageleave&&void 0===o.capture_pageleave&&(l.capture_pageleave=!!e.analytics.capturePageleave),void 0!==e.analytics.capturePerformance&&void 0===o.capture_performance&&(l.capture_performance=e.analytics.capturePerformance),void 0===o.autocapture)){var c=e.analytics.autocapture,h=e.analytics.scrollDepthMilestones,v=e.analytics.scrollDepthPageleave;void 0!==c&&(l.autocapture=c&&(h||v)?{scroll_depth:i({},h?{milestones:!0}:{},v?{pageleave:!0}:{})}:c)}t||(l.__remote_config_loaded=!0),void 0!==(null===(r=e.privacy)||void 0===r?void 0:r.respectDnt)&&void 0===o.respect_dnt&&(l.respect_dnt=e.privacy.respectDnt),void 0!==(null===(n=e.privacy)||void 0===n?void 0:n.requireConsent)&&void 0===o.require_consent&&(l.require_consent=e.privacy.requireConsent),void 0!==e.autocapture_opt_out&&(l.autocapture_opt_out=e.autocapture_opt_out),void 0!==e.elementsChainAsString&&(l.elementsChainAsString=e.elementsChainAsString),(null===(a=e.diagnostics)||void 0===a?void 0:a.defaultLogLevel)&&ae().setLevelFromRemote(e.diagnostics.defaultLogLevel),Object.keys(l).length>0&&this._host.updateConfig(l),null===(s=this._onApply)||void 0===s||s.call(this,e)}}var $n=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"];function Un(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return[...$n,...t].some(e=>-1!==i.indexOf(e.toLowerCase()))}function Nn(e,t){var i;if(void 0===t&&(t=[]),!e)return!1;var r=e.userAgent;if(r&&Un(r,t))return!0;try{var n=e.userAgentData;if(null===(i=null==n?void 0:n.brands)||void 0===i?void 0:i.some(e=>Un(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver}var Bn=36e5;function Hn(){var e,t,i;return null!==(i=null===(t=null===(e=null==U?void 0:U.performance)||void 0===e?void 0:e.now)||void 0===t?void 0:t.call(e))&&void 0!==i?i:Date.now()}class qn{constructor(){this._pageEnterPerf=Hn(),this._lastCapturePerf=null,this._bootPerf=Hn(),this._prevUrl="",this._prevPathname="",this._prevTitle="",this._leaveEmittedForPageKey=""}onAfterPageview(){var e=Hn();this._pageEnterPerf=e,this._lastCapturePerf=e,this._leaveEmittedForPageKey="",q&&(this._prevUrl=q.href||"",this._prevPathname=q.pathname||""),H&&(this._prevTitle=H.title||"")}peekEngagementSinceLastCaptureMs(){var e,t=Hn(),i=null!==(e=this._lastCapturePerf)&&void 0!==e?e:this._bootPerf,r=Math.round(t-i);return r<1&&(r=1),r>Bn&&(r=Bn),r}commitCaptureClock(){this._lastCapturePerf=Hn()}_pageKey(){return this._prevUrl+"\0"+this._prevPathname}clearLeaveDedupe(){this._leaveEmittedForPageKey=""}tryCapturePageleave(e,t,i,r){if(function(e){var t=e.capture_pageleave;return!1!==t&&(!0===t||!1!==e.capture_pageview)}(e)){var n=this._pageKey();if((this._prevUrl||this._prevPathname)&&n&&this._leaveEmittedForPageKey!==n){this._leaveEmittedForPageKey=n;var a=Hn(),s=Math.round(a-this._pageEnterPerf);s<1&&(s=1),s>Bn&&(s=Bn);var o={navigation_type:i,engagement_time_msec:s,[L]:this._prevUrl,[A]:this._prevPathname,[T]:Math.round(s/1e3),[P]:this._prevPathname,[R]:this._prevUrl},l=this._prevUrl?function(e){try{return new URL(e).host}catch(e){return""}}(this._prevUrl):"";l&&(o.$host=l),this._prevTitle&&(o.title=this._prevTitle),r&&Object.assign(o,r),t(b,o,{skip_engagement:!0})}}}}var Fn=[y,w,C,b,E,I,S,M],zn=new Set([y,w,C]),jn=new Set([b,M,E,I,S]);class Wn{constructor(e){this._set_once_properties_sent=!1,this._initial_pageview_captured=!1,this._visibility_state_listener=null,this._vt_person_id=null,this._pageLifecycle=new qn,this._host=e}setVtPersonId(e){this._vt_person_id=e}capture(e,t,r){var n,a,s;this._host.sessionManager.setSessionId();var o=this._host.getConfig();if(o.opt_out_useragent_filter||!Nn(B,null!==(n=o.custom_blocked_useragents)&&void 0!==n?n:[]))if((null==B?void 0:B.userAgent)&&function(e){return!(e&&"string"==typeof e&&e.length>500)}(B.userAgent))if((null==r?void 0:r.skip_client_rate_limiting)||Fn.includes(e)||this._host.rateLimiter.shouldAllowEvent())if(!this._host.getConfig().require_consent||zn.has(e)||(null===(a=this._host.consentManager)||void 0===a?void 0:a.hasConsent())){var l=this._host.buildUrl(),d=!0===(null==r?void 0:r.skip_engagement)||jn.has(e),u=i({},t);d||"number"==typeof u.engagement_time_msec||(u=i({},u,{engagement_time_msec:this._pageLifecycle.peekEngagementSinceLastCaptureMs()}));var c=i({},this._buildEventPayload(e,u),o.globalAttributes),h=JSON.stringify(c);if(!(v=h)||"string"!=typeof v||v.length<2||v.length>Ie)ae().debug("capture","dropped",e,{reason:"payload_invalid_size",bytes:h.length,limitBytes:Ie,hint:e===k?"Trim global / event properties; $elements is already off by default in compact mode.":"Trim event properties; payload exceeded the runaway-guard cap."});else{var v,_=e===y?this._host.userManager.getAnonymousId():null!==(s=this._host.userManager.getDistinctId())&&void 0!==s?s:this._host.userManager.getAnonymousId(),g={timestamp:(new Date).toISOString(),event:e,payload:c,distinct_id:_,anonymous_id:this._host.userManager.getAnonymousId()};this._host.bufferEvent(e,l,g),ae().debug("capture","enqueued",e,i({distinct_id:_,$current_url:c.$current_url,$session_id:c.$session_id,$debug:c.$debug},e===k&&"object"==typeof c&&null!==c?{$event_type:c.$event_type}:{})),this._vt_person_id&&(this._vt_person_id=null),e===m?this._pageLifecycle.onAfterPageview():this._pageLifecycle.commitCaptureClock()}}else ae().debug("capture","dropped",e,{reason:"require_consent_and_no_consent"});else ae().debug("capture","dropped",e,{reason:"client_rate_limited",hint:"Token bucket (~10/s, burst ~100). $autocapture counts toward the same limit as custom events."});else ae().debug("capture","dropped",e,{reason:"invalid_or_missing_user_agent"});else ae().debug("capture","dropped",e,{reason:"bot"})}captureInternal(e,t){this.capture(e,t,{skip_client_rate_limiting:!0})}captureInitialPageview(){H&&("visible"===H.visibilityState?this._initial_pageview_captured||(this._initial_pageview_captured=!0,setTimeout(()=>{H&&q&&!1!==this._host.getConfig().capture_pageview&&this.capture(m,{navigation_type:"initial_load"})},300),this._visibility_state_listener&&(H.removeEventListener("visibilitychange",this._visibility_state_listener),this._visibility_state_listener=null)):this._visibility_state_listener||(this._visibility_state_listener=()=>this.captureInitialPageview(),Le(H,"visibilitychange",this._visibility_state_listener)))}tryCapturePageleave(e,t){this._pageLifecycle.tryCapturePageleave(this._host.getConfig(),(e,t,i)=>this.capture(e,t,i),e,t)}resetPageleaveDedupe(){this._pageLifecycle.clearLeaveDedupe()}_isDebugMode(){if(this._host.getConfig().debug)return!0;try{if(null==q?void 0:q.search)if("1"===new URLSearchParams(q.search).get("vtilt_debug"))return!0}catch(e){}return!1}_buildEventPayload(e,t){var r,n,a=this._host.getConfig(),s=a.mask_personal_data_properties,o=a.custom_personal_data_properties,l=si(s,o),d=Pe(function(e,t,i){if(!H)return{};var r=t?Te([],Jt,i||[]):[];return Ae({},Zt(ze(H.URL,r,Xt)))}(0,s,o)),u=this._host.userManager.getUserProperties(),c=this._host.userManager.get_initial_props(),h=this._host.sessionManager.getSessionId(),v=this._host.sessionManager.getWindowId(),_={};!this._set_once_properties_sent&&Object.keys(c).length>0&&Object.assign(_,c),t.$set_once&&Object.assign(_,t.$set_once);var g=i({},l,d,u,null!==(n=null===(r=this._host.consentManager)||void 0===r?void 0:r.getConsentProperties())&&void 0!==n?n:{},{$session_id:h,$window_id:v},this._vt_person_id?{$vt:this._vt_person_id}:{},Object.keys(_).length>0?{$set_once:_}:{},t.$set?{$set:t.$set}:{},t);!this._set_once_properties_sent&&Object.keys(c).length>0&&(this._set_once_properties_sent=!0),e===m&&H&&(g.title=H.title),this._isDebugMode()&&(g.$debug=!0);var p=this._host.sessionManager.consumeSessionStart(),f=this._host.userManager.consumeFirstVisit();return p&&(g.$session_start=!0),f&&(g.$first_visit=!0),g}}var Vn=["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"];function Kn(e){return!(!e||"string"!=typeof e)&&Vn.includes(e.toLowerCase().trim())}class Gn{constructor(e){this._lastIdentifyHash=null,this._lastSetPropertiesHash=null,this._host=e}identify(e,t,r){var n;if("number"==typeof e&&(e=String(e),ae().warn("identify","first argument should be a string, not a number")),e)if(Kn(e))ae().error("identify",'"'+e+'" appears to be a hardcoded string');else if("COOKIELESS_SENTINEL_VALUE"!==e){var a=JSON.stringify([e,t,r]);if(this._lastIdentifyHash!==a){var s=this._host.userManager,o=s.getDistinctId(),l=s.getAnonymousId(),d=s.getDeviceId();if(!("identified"===s.getUserState())&&l!==e||e!==o){this._host.capture(y,{distinct_id:e,$set:t||{},$set_once:r||{}});var u={user_state:"identified",distinct_id:e,properties_set:t,properties_set_once:r};if(!d){var c=o||l;u.device_id=c,u.properties_set=i({$had_persisted_distinct_id:!0,$device_id:c},u.properties_set||{})}s.applyUpdate(u),null===(n=this._host._emitter)||void 0===n||n.emit("user:identified",{distinctId:e})}else(t||r)&&this.setUserProperties(t,r);this._lastIdentifyHash=a}}else ae().error("identify","cannot use sentinel value as distinct_id");else ae().error("identify","unique user id is required")}setUserProperties(e,t){var i,r;if(e||t){var n=this._host.userManager,a=JSON.stringify([null!==(i=n.getDistinctId())&&void 0!==i?i:n.getAnonymousId(),e,t]);this._lastSetPropertiesHash!==a&&(n.applyUpdate({properties_set:e,properties_set_once:t}),this._host.capture(C,{$set:e||{},$set_once:t||{}}),null===(r=this._host._emitter)||void 0===r||r.emit("user:properties_set",{properties:e}),this._lastSetPropertiesHash=a)}}resetUser(e){var t;this._host.sessionManager.resetSessionId(),this._host.userManager.reset(e),this._lastIdentifyHash=null,this._lastSetPropertiesHash=null,null===(t=this._host._emitter)||void 0===t||t.emit("user:reset")}alias(e,t){var i;if(e&&!Kn(e)){var r=this._host.userManager,n=null!==(i=null!=t?t:r.getDistinctId())&&void 0!==i?i:r.getAnonymousId();n&&!Kn(n)?e!==n?this._host.capture(w,{$original_id:n,$alias_id:e}):this.identify(e):ae().warn("alias","invalid original distinct ID")}else ae().warn("alias","invalid alias")}getUserIdentity(){return this._host.userManager.getUserIdentity()}getDeviceId(){return this._host.userManager.getDeviceId()}getUserState(){return this._host.userManager.getUserState()}getDistinctId(){var e;return null!==(e=this._host.userManager.getDistinctId())&&void 0!==e?e:this._host.userManager.getAnonymousId()}getAnonymousId(){return this._host.userManager.getAnonymousId()}}var Jn="_vtilt_consent";class Qn{constructor(e){this._state={},this._hasBeenSet=!1,this._host=e,this._readFromCookie()}setConsent(e){var t;this._state=i({},this._state,e),this._hasBeenSet=!0,this._writeToCookie(),null===(t=this._host._emitter)||void 0===t||t.emit("consent:updated",{consent:this._state})}getConsent(){return i({},this._state)}hasConsent(){return this._hasBeenSet}setDefaultGranted(){this._hasBeenSet||(this._state={analytics:!0,marketing:!0,advertising:!0},this._hasBeenSet=!0)}getConsentProperties(){var e={};return void 0!==this._state.analytics&&(e.$consent_analytics=this._state.analytics),void 0!==this._state.marketing&&(e.$consent_marketing=this._state.marketing),void 0!==this._state.advertising&&(e.$consent_advertising=this._state.advertising),e}reset(){this._state={},this._hasBeenSet=!1,this._removeCookie()}_readFromCookie(){if(void 0!==H&&(null==H?void 0:H.cookie)){var e=Jn+"=";for(var t of H.cookie.split(";")){var i=t.trim();if(i.startsWith(e)){try{var r=decodeURIComponent(i.slice(15)),n=JSON.parse(r);n&&"object"==typeof n&&(this._state=n,this._hasBeenSet=!0)}catch(e){}return}}}}_writeToCookie(){if(void 0!==H){var e=encodeURIComponent(JSON.stringify(this._state)),t="undefined"!=typeof location&&"https:"===location.protocol?"; Secure":"";H.cookie=Jn+"="+e+"; Max-Age=31536000; path=/; SameSite=Lax"+t}}_removeCookie(){void 0!==H&&(H.cookie=Jn+"=; Max-Age=0; path=/")}}class Xn{constructor(e){this._descriptors=new Map,this._instances=new Map,this._host=e}register(e){this._descriptors.set(e.name,e)}createInstances(){var e=this,t=this._host.getConfig(),i=function(i,r){return e._instances.has(i)||e._isHardDisabled(t,r)?0:void oe(()=>{var n=r.FeatureClass.extractConfig(t),a=new r.FeatureClass(e._host,n);e._instances.set(i,a)})};for(var[r,n]of this._descriptors)i(r,n)}initAll(){this.createInstances();var e=function(e){oe(()=>{e.isStarted||e.startIfEnabled()})};for(var[,t]of this._instances)e(t)}notifyAll(e){var t=function(t){t.onConfigUpdate&&oe(()=>t.onConfigUpdate(e))};for(var[,i]of this._instances)t(i)}get(e){return this._instances.get(e)}set(e,t){this._instances.set(e,t)}getDescriptors(){return this._descriptors}_isHardDisabled(e,t){if(t.disableKey&&!0===e[t.disableKey])return!0;if(t.configKey){var i=e[t.configKey];if(i&&"object"==typeof i&&!1===i.enabled)return!0}return!1}}class Zn{constructor(e){this._queue=new mn,this._ready=!1,this._configReady=!1,this._host=e,this._checkReady(),this._ready||(this._safetyTimer=setTimeout(()=>this.forceFlush(),5e3))}push(e){this._ready?this._process(e):this._queue.enqueue(e)}markConfigReady(){this._configReady||(this._configReady=!0,this._tryFlush())}forceFlush(){this._clearSafetyTimer(),this._flush(),this._ready=!0}_checkReady(){this._ready=this._configReady}_tryFlush(){this._checkReady(),this._ready&&(this._clearSafetyTimer(),this._flush())}_flush(){var e=this._queue.takeAll();for(var t of e)this._process(t);e.length>0&&this._host.requestQueue.flush()}_process(e){if(this._configReady){if(this._isDisabledByConfig(e.name))return}else this._tagConfigPending(e.event);this._host.sendRequest(e.url,e.event)}_isDisabledByConfig(e){var t=this._host.getConfig();switch(e){case m:return!1===t.capture_pageview;case b:return!1===t.capture_pageleave;case S:return!1===t.capture_performance;case k:case x:return!1===t.autocapture;default:return!1}}_tagConfigPending(e){"object"==typeof e.payload&&null!==e.payload&&(e.payload.$config_pending=!0)}_clearSafetyTimer(){void 0!==this._safetyTimer&&(clearTimeout(this._safetyTimer),this._safetyTimer=void 0)}}var Yn="vt";class ea{constructor(e){void 0===e&&(e={}),this.version=r,this.__loaded=!1,this._has_warned_about_config=!1,this._booted=!1,this._pendingCalls=[],this._postBootInitDone=!1,ae().debug("ctor","start"),this._emitter=new ce,this.configManager=new W(e);var t=this.configManager.getConfig();se(t),this.sessionManager=new Ne(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new oi(t.persistence||"localStorage+cookie",t.cross_subdomain_cookie),this.rateLimiter=new Dn({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:e=>{this._captureManager.captureInternal(M,{$$client_ingestion_warning_message:e})}}),this.retryQueue=new Pn({sendRequest:e=>this._send_http_request(e),sendBeacon:e=>this._send_beacon_request(e)}),this.requestQueue=new Tn(e=>this._send_batched_request(e),{flush_interval_ms:3e3}),this.consentManager=new Qn(this),this._captureManager=new Wn(this),this._identityManager=new Gn(this),this._featureManager=new Xn(this),this._remoteConfigManager=new On(this),this._registerFeatures(),this._remoteConfigManager.onLoad(e=>{this._emitter.emit(_e,{config:e})}),this._installBootGate(),ae().debug("ctor","boot gate installed")}_registerFeatures(){this._featureManager.register({name:"HistoryAutocapture",configKey:"capture_pageview",FeatureClass:pi}),this._featureManager.register({name:"Autocapture",configKey:"autocapture",FeatureClass:sr}),this._featureManager.register({name:"WebVitals",configKey:"capture_performance",FeatureClass:_i}),this._featureManager.register({name:"SessionRecording",configKey:"session_recording",disableKey:"disable_session_recording",remoteConfig:{key:"sessionRecording",map:e=>({enabled:e.enabled,sampleRate:e.sampleRate,minimumDurationMs:e.minimumDurationMs,fullSnapshotIntervalMs:e.fullSnapshotIntervalMs,maskAllInputs:e.maskAllInputs,captureConsole:e.captureConsole,captureCanvas:e.captureCanvas})},FeatureClass:lr}),this._featureManager.register({name:"Chat",configKey:"chat",disableKey:"disable_chat",remoteConfig:{key:"chat",map:e=>({enabled:e.enabled,position:e.widgetPosition,color:e.widgetColor})},FeatureClass:Zr}),this._featureManager.register({name:"GoogleTagGateway",configKey:"google_tag",disableKey:"disable_google_tag",remoteConfig:{key:"googleTag",map:e=>e},FeatureClass:yn})}_installBootGate(){var e=this,t=function(t){var i=e[t];e[t]=function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];if(e._booted)return i.apply(e,n);e._pendingCalls.push([t,...n])}};for(var i of ea.BOOT_GATED_METHODS)t(i)}_boot(){if(!this._booted){for(var e of(this._booted=!0,ae().debug("boot","start"),ea.BOOT_GATED_METHODS))delete this[e];ae().debug("boot","gate removed"),this.__loaded&&!this._postBootInitDone?(ae().debug("boot","running _runPostBootInit"),this._runPostBootInit()):ae().debug("boot","skipping _runPostBootInit","loaded?",this.__loaded,"postBootDone?",this._postBootInitDone),ae().debug("boot","flush pendingCalls",this._pendingCalls.length),this._execute_array(this._pendingCalls),this._pendingCalls=[]}}init(e,t,i){var r;if(i&&i!==Yn){var n=null!==(r=ta[i])&&void 0!==r?r:new ea;return n._init(e,t,i),ta[i]=n,ta[Yn][i]=n,n}return this._init(e,t,i)}_init(e,t,r){if(void 0===t&&(t={}),this.__loaded)return ae().warn("init","already initialized; re-initializing is a no-op"),this;this.configManager.updateConfig(i({},t,{token:e||t.token,name:r}));var n=this.configManager.getConfig();return se(n),this.__loaded=!0,ae().debug("init","start","token present?",!!n.token,"name",null!=r?r:"vt"),this._featureManager.createInstances(),this._booted||void 0===H||"interactive"!==H.readyState&&"complete"!==H.readyState||(ae().debug("init","self-boot?",H.readyState),this._boot()),this._booted&&!this._postBootInitDone&&this._runPostBootInit(),ae().debug("init","postBootInitDone",this._postBootInitDone),this}_runPostBootInit(){if(!this._postBootInitDone){this._postBootInitDone=!0,ae().debug("postBoot","start");var e=this.configManager.getConfig();this.sessionManager=new Ne(e.storage||"cookie",e.cross_subdomain_cookie),this.sessionManager.hydrateFromStorage(),ae().debug("postBoot","sessionManager hydrated");var t=e.persistence||"localStorage+cookie";this.userManager.updateStorageMethod(t,e.cross_subdomain_cookie),this.userManager.hydrateFromStorage(),ae().debug("postBoot","userManager hydrated"),e.require_consent||this.consentManager.hasConsent()||this.consentManager.setDefaultGranted(),!0===this.consentManager.getConsent().advertising&&Ge(),this._emitter.on("consent:updated",e=>{var t=e.consent;!0===t.advertising?Ge():!1===t.advertising&&void 0!==H&&(H.cookie=je+"=; Max-Age=0; path=/",H.cookie=We+"=; Max-Age=0; path=/")}),this._read_vt_param_from_url(),this.userManager.set_initial_person_info(e.mask_personal_data_properties,e.custom_personal_data_properties),this._eventBuffer=new Zn({sendRequest:(e,t)=>this.sendRequest(e,t),requestQueue:this.requestQueue,getConfig:()=>this.configManager.getConfig()}),this._featureManager.initAll(),ae().debug("postBoot","features inited"),this._remoteConfigManager.load(),this._setup_unload_handler(),this._start_queue_if_opted_in();var i=this.configManager.getConfig();!1!==i.capture_pageview&&this._captureManager.captureInitialPageview(),this._featureManager.notifyAll(i),this._emitter.emit(he,{config:i}),ae().debug("postBoot","done"),ae().info("init","SDK ready")}}startAutocapture(){var e=this._featureManager.get("Autocapture");if(!e){var t=sr.extractConfig(this.configManager.getConfig());e=new sr(this,t),this._featureManager.set("Autocapture",e)}e.updateConfig({enabled:!0})}stopAutocapture(){var e=this._featureManager.get("Autocapture");e&&e.updateConfig({enabled:!1})}isAutocaptureActive(){var e,t;return null!==(t=null===(e=this._featureManager.get("Autocapture"))||void 0===e?void 0:e.isStarted)&&void 0!==t&&t}getAutocaptureDiagnostics(){var e,t;return null!==(t=null===(e=this._featureManager.get("Autocapture"))||void 0===e?void 0:e.getDiagnostics())&&void 0!==t?t:null}startSessionRecording(){var e=this._featureManager.get("SessionRecording");e||(e=new lr(this),this._featureManager.set("SessionRecording",e)),e.updateConfig({enabled:!0}),e.startIfEnabledOrStop("recording_initialized"),this._emitter.emit(fe)}stopSessionRecording(){var e;null===(e=this._featureManager.get("SessionRecording"))||void 0===e||e.stop(),this._emitter.emit(me)}isRecordingActive(){var e;return"active"===(null===(e=this._featureManager.get("SessionRecording"))||void 0===e?void 0:e.status)}getSessionRecordingId(){var e;return(null===(e=this._featureManager.get("SessionRecording"))||void 0===e?void 0:e.sessionId)||null}openChat(){var e=this._featureManager.get("Chat");e?e.open():ae().warn("chat","openChat: feature not available")}closeChat(){var e=this._featureManager.get("Chat");e?e.close():ae().warn("chat","closeChat: feature not available")}toggleChat(){var e=this._featureManager.get("Chat");e?e.toggle():ae().warn("chat","toggleChat: feature not available")}showChat(){var e=this._featureManager.get("Chat");e?e.show():ae().warn("chat","showChat: feature not available")}hideChat(){var e=this._featureManager.get("Chat");e?e.hide():ae().warn("chat","hideChat: feature not available")}sendChatMessage(e,t){var i=this._featureManager.get("Chat");i?i.sendMessage(e,t):ae().warn("chat","sendChatMessage: feature not available")}gtag(){for(var e=this._featureManager.get("GoogleTagGateway"),t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e?e.gtag(...i):this._pendingCalls.push(["gtag",...i])}setGoogleUserData(e){var t=this._featureManager.get("GoogleTagGateway");return t?t.setUserData(e):Promise.resolve()}get featureManager(){return this._featureManager}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}off(e){this._emitter.off(e)}_is_bot(){var e,t=this.getConfig();return!t.opt_out_useragent_filter&&Nn(B,null!==(e=t.custom_blocked_useragents)&&void 0!==e?e:[])}capture(e,t,i){this._captureManager.capture(e,t,i),this._emitter.emit(pe,{event:e,payload:t})}tryCapturePageleave(e){var t,i=null===(t=this._featureManager.get("Autocapture"))||void 0===t?void 0:t.getMaxScrollDepthPctForPageleave(),r=null!=i?{[$]:i}:void 0;this._captureManager.tryCapturePageleave(e,r)}identify(e,t,i){this._identityManager.identify(e,t,i)}setUserProperties(e,t){this._identityManager.setUserProperties(e,t)}resetUser(e){this._identityManager.resetUser(e)}alias(e,t){this._identityManager.alias(e,t)}setConsent(e){this.consentManager.setConsent(e)}getConsent(){return this.consentManager.getConsent()}getUserIdentity(){return this._identityManager.getUserIdentity()}getDeviceId(){return this._identityManager.getDeviceId()}getUserState(){return this._identityManager.getUserState()}getConfig(){return this.configManager.getConfig()}getRemoteConfig(){return this._remoteConfigManager.config}getSessionId(){return this.sessionManager.getSessionId()}getDistinctId(){return this._identityManager.getDistinctId()}getAnonymousId(){return this._identityManager.getAnonymousId()}toString(){var e,t=null!==(e=this.configManager.getConfig().name)&&void 0!==e?e:Yn;return t!==Yn&&(t="vt."+t),t}updateConfig(e){var t,i=this.configManager.getConfig();this.configManager.updateConfig(e);var r=this.configManager.getConfig();!i.__remote_config_loaded&&r.__remote_config_loaded&&(null===(t=this._eventBuffer)||void 0===t||t.markConfigReady()),this._featureManager.notifyAll(r),this._emitter.emit(ve,{config:r})}buildUrl(){return this.buildEndpointUrl("/api/e")}buildEndpointUrl(e){return de(this.configManager.getConfig(),e)}sendRequest(e,t){this._is_configured()&&this.requestQueue.enqueue({url:e,event:t})}bufferEvent(e,t,i){e!==E&&e!==I?this._eventBuffer.push({name:e,url:t,event:i}):this.sendRequest(t,i)}_is_configured(){return!!this.configManager.getConfig().token||(this._has_warned_about_config||(ae().warn("config","token is required for tracking"),this._has_warned_about_config=!0),!1)}_send_batched_request(e){"sendBeacon"!==e.transport?this.retryQueue.retriableRequest(e):this._send_beacon_request(e)}_send_http_request(e){return new Promise(t=>{var{url:i,events:r}=e,n=this.configManager.getConfig(),a=1===r.length?r[0]:{events:r},s=n.disable_compression?Sn.None:Sn.GZipJS;An({url:i,data:a,method:"POST",transport:"XHR",compression:s,projectToken:n.token,callback:e=>t({statusCode:e.statusCode})})})}_send_beacon_request(e){var{url:t,events:i}=e,r=this.configManager.getConfig(),n=1===i.length?i[0]:{events:i},a=r.disable_compression?Sn.None:Sn.GZipJS;An({url:t,data:n,method:"POST",transport:"sendBeacon",compression:a,projectToken:r.token})}_send_retriable_request(e){this.sendRequest(e.url,e.event)}_setup_unload_handler(){if(U){var e=()=>{this._eventBuffer.forceFlush(),this.requestQueue.unload(),this.retryQueue.unload()};Le(U,"beforeunload",e),Le(U,"pagehide",()=>{this._captureManager.tryCapturePageleave("pagehide"),e()}),H&&Le(H,"visibilitychange",()=>{H&&("hidden"===H.visibilityState?this._captureManager.tryCapturePageleave("visibility_hidden"):"visible"===H.visibilityState&&this._captureManager.resetPageleaveDedupe())})}}_start_queue_if_opted_in(){this.requestQueue.enable()}_read_vt_param_from_url(){oe(()=>{var e,t;if(void 0!==q&&q.search){var i=new URL(q.href),r=i.searchParams.get("vt"),n=i.searchParams.get("vtd");if((null==r?void 0:r.trim())&&(this._captureManager.setVtPersonId(r.trim()),i.searchParams.delete("vt")),(null==n?void 0:n.trim())&&(this._initVtdOverlay(n.trim()),i.searchParams.delete("vtd")),(null==r?void 0:r.trim())||(null==n?void 0:n.trim())){var a=i.pathname+(i.search||"")+i.hash;null===(t=null===(e=null==U?void 0:U.history)||void 0===e?void 0:e.replaceState)||void 0===t||t.call(e,{},"",a)}}})}_initVtdOverlay(e){this.vtdOverlay||(this.vtdOverlay=new Cn(this),this.vtdOverlay.setDestinationUrl(e))}_execute_array(e){J(e)&&e.forEach(e=>{if(e&&J(e)&&e.length>0){var t=e[0],i=e.slice(1);"function"==typeof this[t]&&oe(()=>this[t](...i))}})}_dom_loaded(){this._start_queue_if_opted_in()}}ea.BOOT_GATED_METHODS=["capture","identify","setUserProperties","resetUser","alias","setConsent","startAutocapture","stopAutocapture","startSessionRecording","stopSessionRecording","openChat","closeChat","toggleChat","showChat","hideChat","sendChatMessage"];var ta={};var ia,ra=(ia=ta[Yn]=new ea,function(){function e(){if(!e.done){e.done=!0,ae().debug("dom","handler fired");var t=Object.keys(ta);ae().debug("boot","instance count",t.length),Me(ta,(e,t)=>{ae().debug("boot","instance",t),e._boot(),e._dom_loaded()})}}if(H&&"function"==typeof H.addEventListener)return ae().debug("dom","readyState",H.readyState),void("complete"===H.readyState||"interactive"===H.readyState?(ae().debug("dom","running handler sync"),e()):(ae().debug("dom","registered DOMContentLoaded listener"),Le(H,"DOMContentLoaded",e,{capture:!1})));U&&ae().error("dom","browser doesn't support document.addEventListener")}(),ia);export{li as ALL_WEB_VITALS_METRICS,di as DEFAULT_WEB_VITALS_METRICS,ea as VTilt,ra as default,ra as vt};
|
|
1
|
+
function e(e,t,i,r,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void i(e)}o.done?t(l):Promise.resolve(l).then(r,n)}function t(t){return function(){var i=this,r=arguments;return new Promise(function(n,a){var s=t.apply(i,r);function o(t){e(s,n,a,o,l,"next",t)}function l(t){e(s,n,a,o,l,"throw",t)}o(void 0)})}}function i(){return i=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},i.apply(null,arguments)}var r="1.13.1",n="__vt_session",a="__vt_window_id",s="__vt_primary_window",o="__vt_user_state",l="__vt_device_id",d="__vt_anonymous_id",u="__vt_remote_config",h="__vt_distinct_id",c="__vt_user_properties",v="localStorage",_="localStorage+cookie",g="sessionStorage",p="memory",f="$initial_person_info",m="$pageview",b="$pageleave",y="$identify",w="$alias",C="$set",S="$performance_event",k="$autocapture",x="$scroll_depth",I="$snapshot",E="$snapshot_items",M="$$client_ingestion_warning",L="$current_url",A="$pathname",P="$prev_pageview_duration",T="$prev_pageview_pathname",U="$prev_pageview_url",R="$scroll_depth_pct",D="$scroll_depth_max_pct",O="$prev_pageview_scroll_depth_pct";function $(e,t){var r,n,a=t.bubble,s=null==e?void 0:e.bubble;if(a){var o=null===a.offset?void 0:void 0!==a.offset?i({},null===(r=null==e?void 0:e.bubble)||void 0===r?void 0:r.offset,a.offset):null===(n=null==e?void 0:e.bubble)||void 0===n?void 0:n.offset;s=i({},null==e?void 0:e.bubble,a,{offset:o})}return i({},e,t,{bubble:s})}var B="undefined"!=typeof window?window:void 0,N="undefined"!=typeof globalThis?globalThis:B,H=null==N?void 0:N.navigator,q=null==N?void 0:N.document,F=null==N?void 0:N.location,j=null==N?void 0:N.fetch;B&&q&&q.createElement,null==N||N.XMLHttpRequest,null==N||N.AbortController;var z=null==H?void 0:H.userAgent,W=null!=B?B:{};class V{constructor(e){void 0===e&&(e={}),this.config=this.parseConfigFromScript(e)}parseConfigFromScript(e){if(!(null==q?void 0:q.currentScript))return i({token:e.token||""},e);var t=q.currentScript,r=i({token:""},e);r.api_host=t.getAttribute("data-api-host")||t.getAttribute("data-host")||e.api_host,r.script_host=t.getAttribute("data-script-host")||e.script_host,r.token=t.getAttribute("data-token")||e.token||"",r.domain=t.getAttribute("data-domain")||e.domain,r.storage=t.getAttribute("data-storage")||e.storage,r.stringifyPayload="false"!==t.getAttribute("data-stringify-payload");var n="true"===t.getAttribute("data-capture-performance");for(var a of(r.capture_performance=!!n||e.capture_performance,r.globalAttributes=i({},e.globalAttributes),Array.from(t.attributes)))a.name.startsWith("data-vt-")&&(r.globalAttributes[a.name.slice(8).replace(/-/g,"_")]=a.value);return r}getConfig(){return i({},this.config)}updateConfig(e){var t=function(e,t){return void 0===t.chat?t:i({},t,{chat:$(e.chat,t.chat)})}(this.config,e);this.config=i({},this.config,t)}}function K(e){return"string"==typeof e}function G(e){return void 0===e}function J(e){return null==e}function Q(e){return Array.isArray(e)}function X(e){return"function"==typeof e}var Z={none:0,error:1,warn:2,info:3,debug:4},Y="[vTilt]",ee=new Set(["none","error","warn","info","debug"]);function te(){return"undefined"!=typeof console}function ie(e){var t=e.length>0&&"string"==typeof e[0]?e[0]:"",i=t?e.slice(1):e;return[t?Y+":"+t:Y,...i]}var re="warn",ne=!1;var ae=null;function se(){return ae||(ae={setLevel(e,t){void 0===t&&(t=!1),re=e,t&&(ne=!0)},setLevelFromRemote(e){ne||e&&ee.has(e)&&(re=e)},getLevel:()=>re,isLockedByInit:()=>ne,debug(){if(!(Z[re]<Z.debug)&&te()){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.log(...ie(t))}},info(){if(!(Z[re]<Z.info)&&te()){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.log(...ie(t))}},warn(){if(!(Z[re]<Z.warn)&&te()){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.warn(...ie(t))}},error(){if(!(Z[re]<Z.error)&&te()){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];console.error(...ie(t))}}}),ae}function oe(e,t){void 0===t&&(t=!0);var i=void 0!==e.log_level||!!e.debug,r=function(e){return e.log_level&&ee.has(e.log_level)?e.log_level:e.debug?"debug":"warn"}(e);return se().setLevel(r,t&&i),r}function le(e,t){try{return e()}catch(e){return t}}var de="x-api-key";function ue(e,t,i){void 0===i&&(i={});var{api_host:r,token:n}=e,a=""+(r?r.replace(/\/+$/gm,""):"")+t;if(i.includeTokenQuery&&n){var s=a.includes("?")?"&":"?";a=""+a+s+"token="+n}return a}function he(e){return e.token?{[de]:e.token}:{}}class ce{constructor(){this._events=new Map,this._onceEvents=new Map}on(e,t){return this._events.has(e)||this._events.set(e,new Set),this._events.get(e).add(t),()=>{var i;null===(i=this._events.get(e))||void 0===i||i.delete(t)}}once(e,t){return this._onceEvents.has(e)||this._onceEvents.set(e,new Set),this._onceEvents.get(e).add(t),()=>{var i;null===(i=this._onceEvents.get(e))||void 0===i||i.delete(t)}}emit(e,t){var i,r;null===(i=this._events.get(e))||void 0===i||i.forEach(i=>{try{i(t)}catch(t){se().error("emitter",'error in event listener for "'+e+'":',t)}});var n=this._onceEvents.get(e);n&&(n.forEach(i=>{try{i(t)}catch(t){se().error("emitter",'error in once listener for "'+e+'":',t)}}),this._onceEvents.delete(e)),null===(r=this._events.get("*"))||void 0===r||r.forEach(i=>{try{i({event:e,payload:t})}catch(e){se().error("emitter","error in wildcard listener:",e)}})}off(e){e?(this._events.delete(e),this._onceEvents.delete(e)):(this._events.clear(),this._onceEvents.clear())}listenerCount(e){var t,i,r,n;return(null!==(i=null===(t=this._events.get(e))||void 0===t?void 0:t.size)&&void 0!==i?i:0)+(null!==(n=null===(r=this._onceEvents.get(e))||void 0===r?void 0:r.size)&&void 0!==n?n:0)}hasListeners(e){return this.listenerCount(e)>0}}var ve="sdk:initialized",_e="sdk:config_updated",ge="sdk:remote_config_loaded",pe="consent:updated",fe="event:captured",me="recording:started",be="recording:stopped",ye=0,we=!1,Ce=!1;function Se(e){(ye+=1)<2||(we=!0,Ce||(Ce=!0,se().warn(e,"vTilt network requests are being cancelled before reaching the server (likely an ad blocker, privacy extension, or DNS-level filter). Further retries and snapshots have been suspended for this page. Route SDK traffic through your own domain to avoid this — see https://www.vtilt.com/docs/browser/reverse-proxy.")))}function ke(){ye=0}function xe(){return we}var Ie="23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function Ee(e){for(var t=(2<<31-Math.clz32(57))-1,i=Math.ceil(1.6*t*e/57),r="";r.length<e;)for(var n=crypto.getRandomValues(new Uint8Array(i)),a=0;a<i&&r.length<e;a++){var s=n[a]&t;s<57&&(r+=Ie[s])}return r}var Me=1048576;function Le(e,t,i){if(e)if(Array.isArray(e))e.forEach((e,r)=>{t.call(i,e,r)});else for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.call(i,e[r],r)}function Ae(e,t,i,r){var{capture:n=!1,passive:a=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:n,passive:a})}function Pe(e,t){if(!t)return e;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}function Te(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];for(var n of i)for(var a of n)e.push(a);return e}function Ue(e){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var r=e[i];null!=r&&""!==r&&(t[i]=r)}return t}var Re=[d,l,h,o],De=31536e3,Oe=["herokuapp.com","vercel.app","netlify.app"];function $e(e){var t;if(!e||"undefined"==typeof document)return"";var i=null===(t=document.location)||void 0===t?void 0:t.hostname;if(!i)return"";var r=i.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return r?"."+r[0]:""}class Be{constructor(e){var t,i,r;this.memoryStorage=new Map,this._localStorageSupported=null,this.method=e.method,this.cross_subdomain=null!==(t=e.cross_subdomain)&&void 0!==t?t:function(){var e;if("undefined"==typeof document)return!1;var t=null===(e=document.location)||void 0===e?void 0:e.hostname;if(!t)return!1;var i=t.split(".").slice(-2).join(".");return!Oe.includes(i)}(),this.sameSite=null!==(i=e.sameSite)&&void 0!==i?i:"Lax",this.secure=null!==(r=e.secure)&&void 0!==r?r:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this._localStorageSupported)return this._localStorageSupported;if(void 0===B||!B.localStorage)return this._localStorageSupported=!1,!1;try{var e="__vt_ls_test__";B.localStorage.setItem(e,"1");var t="1"===B.localStorage.getItem(e);return B.localStorage.removeItem(e),this._localStorageSupported=t,t||se().warn("storage","localStorage unavailable, using cookies"),t}catch(e){return this._localStorageSupported=!1,se().warn("storage","localStorage unavailable, using cookies"),!1}}isCriticalProperty(e){return Re.includes(e)}get(e){var t;try{switch(this.method){case p:return null!==(t=this.memoryStorage.get(e))&&void 0!==t?t:null;case _:return this.getLocalStoragePlusCookie(e);case v:return this.getLocalStorage(e);case g:return this.readFromSessionStorage(e);default:return this.getCookie(e)}}catch(t){return se().warn("storage",'get error for "'+e+'":',t),null}}set(e,t,i){try{switch(this.method){case p:this.memoryStorage.set(e,t);break;case _:this.setLocalStoragePlusCookie(e,t,i);break;case v:this.setLocalStorage(e,t);break;case g:this.writeToSessionStorage(e,t);break;default:this.setCookie(e,t,null!=i?i:De)}}catch(t){se().warn("storage",'set error for "'+e+'":',t)}}remove(e){try{switch(this.method){case p:this.memoryStorage.delete(e);break;case _:this.removeLocalStoragePlusCookie(e);break;case v:this.removeLocalStorage(e);break;case g:this.removeFromSessionStorage(e);break;default:this.removeCookie(e)}}catch(t){se().warn("storage",'remove error for "'+e+'":',t)}}getLocalStoragePlusCookie(e){if(this.isCriticalProperty(e)){var t=this.getCookie(e),i=this.getLocalStorage(e);if(null!==t){if(i!==t&&this.isLocalStorageSupported())try{null==B||B.localStorage.setItem(e,t)}catch(e){}return t}return null!==i?i:this.readFromSessionStorage(e)}return this.getLocalStorage(e)}setLocalStoragePlusCookie(e,t,i){this.setLocalStorage(e,t),this.isCriticalProperty(e)&&(this.setCookie(e,t,null!=i?i:De),this.writeToSessionStorage(e,t))}removeLocalStoragePlusCookie(e){this.removeLocalStorage(e),this.isCriticalProperty(e)&&(this.removeCookie(e),this.removeFromSessionStorage(e))}getLocalStorage(e){var t;if(!this.isLocalStorageSupported())return null;try{return null!==(t=null==B?void 0:B.localStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}setLocalStorage(e,t){if(this.isLocalStorageSupported())try{null==B||B.localStorage.setItem(e,t)}catch(e){se().warn("storage","localStorage write error:",e)}}removeLocalStorage(e){if(this.isLocalStorageSupported())try{null==B||B.localStorage.removeItem(e)}catch(e){}}readFromSessionStorage(e){var t;try{return null!==(t=null==B?void 0:B.sessionStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}writeToSessionStorage(e,t){try{null==B||B.sessionStorage.setItem(e,t)}catch(e){se().warn("storage","sessionStorage write error:",e)}}removeFromSessionStorage(e){try{null==B||B.sessionStorage.removeItem(e)}catch(e){}}getCookie(e){if("undefined"==typeof document)return null;var t=e+"=";for(var i of document.cookie.split(";")){var r=i.trim();if(r.startsWith(t))try{return decodeURIComponent(r.slice(t.length))}catch(e){return r.slice(t.length)}}return null}setCookie(e,t,i){if("undefined"!=typeof document){var r=$e(this.cross_subdomain),n=e+"="+encodeURIComponent(t)+"; Max-Age="+i+"; path=/; SameSite="+this.sameSite;this.secure&&(n+="; Secure"),r&&(n+="; domain="+r),document.cookie=n}}removeCookie(e){if("undefined"!=typeof document){var t=$e(this.cross_subdomain);document.cookie=e+"=; Max-Age=0; path=/"+(t?"; domain="+t:""),document.cookie=e+"=; Max-Age=0; path=/"}}getWithExpiry(e){var t=this.get(e);if(!t)return null;try{var i=JSON.parse(t);return i.expiry&&Date.now()>i.expiry?(this.remove(e),null):i.value}catch(e){return null}}setWithExpiry(e,t,r){var n=i({value:t},r?{expiry:Date.now()+r}:{});this.set(e,JSON.stringify(n))}getJSON(e){var t=this.get(e);if(!t)return null;try{return JSON.parse(t)}catch(e){return null}}setJSON(e,t,i){this.set(e,JSON.stringify(t),i)}canUseSessionStorage(){if(void 0===B||!(null==B?void 0:B.sessionStorage))return!1;try{var e="__vt_ss_test__";return B.sessionStorage.setItem(e,"1"),B.sessionStorage.removeItem(e),!0}catch(e){return!1}}getSessionStorage(){var e;return this.canUseSessionStorage()&&null!==(e=null==B?void 0:B.sessionStorage)&&void 0!==e?e:null}setMethod(e){this.method=e}getMethod(){return this.method}}class Ne{constructor(e,t){void 0===e&&(e="cookie"),this._isNewSession=!1,this.storage=new Be({method:e,cross_subdomain:t,sameSite:"Lax"}),this._windowId=void 0,se().debug("session","ctor")}hydrateFromStorage(){se().debug("session","hydrate"),this._initializeWindowId()}getSessionId(){var e=this._getSessionIdRaw();return e||(e=Ee(16),this._storeSessionId(e),this._isNewSession=!0),e}setSessionId(){var e=this._getSessionIdRaw(),t=e||Ee(16);return e||(this._isNewSession=!0),this._storeSessionId(t),t}resetSessionId(){this._clearSessionId(),this._isNewSession=!0,this.setSessionId(),this._setWindowId(Ee(16))}consumeSessionStart(){return!!this._isNewSession&&(this._isNewSession=!1,!0)}_getSessionIdRaw(){return this.storage.get(n)}_storeSessionId(e){this.storage.set(n,e,1800)}_clearSessionId(){this.storage.remove(n)}getWindowId(){if(this._windowId)return this._windowId;var e=this.storage.getSessionStorage();if(e){var t=e.getItem(a);if(t)return this._windowId=t,t}var i=Ee(16);return this._setWindowId(i),i}_setWindowId(e){if(e!==this._windowId){this._windowId=e;var t=this.storage.getSessionStorage();t&&t.setItem(a,e)}}_initializeWindowId(){var e=this.storage.getSessionStorage();if(e){var t=e.getItem(s),i=e.getItem(a);i&&!t?this._windowId=i:(i&&e.removeItem(a),this._setWindowId(Ee(16))),e.setItem(s,"true"),this._listenToUnload()}else this._windowId=Ee(16)}_listenToUnload(){var e=this.storage.getSessionStorage();B&&e&&Ae(B,"beforeunload",()=>{var e=this.storage.getSessionStorage();e&&e.removeItem(s)},{capture:!1})}updateStorageMethod(e,t){this.storage=new Be({method:e,cross_subdomain:t,sameSite:"Lax"})}}function He(e){if(!q)return null;var t=q.createElement("a");return t.href=e,t}function qe(e){try{return decodeURIComponent(e).replace(/\+/g," ")}catch(t){return e.replace(/\+/g," ")}}function Fe(e){for(var t={},i=function(e){return((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"")}(e).split("&"),r=0;r<i.length;r++){var n=i[r];if(n){var a=n.indexOf("="),s=-1===a?n:n.slice(0,a);if(s){var o=qe(s),l=-1===a?"":n.slice(a+1);t[o]=qe(l)}}}return t}function je(e,t){var i;return null!==(i=Fe(e)[t])&&void 0!==i?i:""}function ze(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),n=r[0]||"",a=r[1],s=n.split("?"),o=s[1],l=s[0],d=(o||"").split("&"),u=[],h=0;h<d.length;h++){var c=d[h].split("="),v=c[0],_=c.slice(1).join("=");-1!==t.indexOf(v)?u.push(v+"="+i):v&&u.push(v+(_?"="+_:""))}var g=u.join("&");return l+(g?"?"+g:"")+(a?"#"+a:"")}var We="_fbp",Ve="_fbc",Ke=15552e3,Ge=7776e3;function Je(){void 0!==q&&(function(){if(Qe(We))return;var e=Date.now(),t=Math.floor(1e9+9e9*Math.random());Xe(We,"fb.1."+e+"."+t,Ke)}(),function(){if(!(null==F?void 0:F.search))return;try{var e=new URL(F.href).searchParams.get("fbclid");if(!(null==e?void 0:e.trim()))return;var t="fb.1."+Date.now()+"."+e.trim();Xe(Ve,t,Ge)}catch(e){}}())}function Qe(e){if(void 0===q||!(null==q?void 0:q.cookie))return null;var t=e+"=";for(var i of q.cookie.split(";")){var r=i.trim();if(r.startsWith(t))try{return decodeURIComponent(r.slice(t.length))}catch(e){return r.slice(t.length)}}return null}function Xe(e,t,i){if(void 0!==q){var r=void 0!==F&&"https:"===F.protocol?"; Secure":"";q.cookie=e+"="+encodeURIComponent(t)+"; Max-Age="+i+"; path=/; SameSite=Lax"+r}}var Ze="Mobile",Ye="iOS",et="Android",tt="Tablet",it=et+" "+tt,rt="iPad",nt="Apple",at=nt+" Watch",st="Safari",ot="BlackBerry",lt="Samsung",dt=lt+"Browser",ut=lt+" Internet",ht="Chrome",ct=ht+" OS",vt=ht+" "+Ye,_t="Internet Explorer",gt=_t+" "+Ze,pt="Opera",ft=pt+" Mini",mt="Edge",bt="Microsoft "+mt,yt="Firefox",wt=yt+" "+Ye,Ct="Nintendo",St="PlayStation",kt="Xbox",xt=et+" "+Ze,It=Ze+" "+st,Et="Windows",Mt=Et+" Phone",Lt="Nokia",At="Ouya",Pt="Generic",Tt=Pt+" "+Ze.toLowerCase(),Ut=Pt+" "+tt.toLowerCase(),Rt="Konqueror",Dt="(\\d+(\\.\\d+)?)",Ot=new RegExp("Version/"+Dt),$t=new RegExp(kt,"i"),Bt=new RegExp(St+" \\w+","i"),Nt=new RegExp(Ct+" \\w+","i"),Ht=new RegExp(ot+"|PlayBook|BB10","i"),qt={"NT3.51":"NT 3.11","NT4.0":"NT 4.0","5.0":"2000",5.1:"XP",5.2:"XP","6.0":"Vista",6.1:"7",6.2:"8",6.3:"8.1",6.4:"10","10.0":"10"};function Ft(e,t){return e.toLowerCase().includes(t.toLowerCase())}var jt=(e,t)=>t&&Ft(t,nt)||function(e){return Ft(e,st)&&!Ft(e,ht)&&!Ft(e,et)}(e),zt=function(e,t){return t=t||"",Ft(e," OPR/")&&Ft(e,"Mini")?ft:Ft(e," OPR/")?pt:Ht.test(e)?ot:Ft(e,"IE"+Ze)||Ft(e,"WPDesktop")?gt:Ft(e,dt)?ut:Ft(e,mt)||Ft(e,"Edg/")?bt:Ft(e,"FBIOS")?"Facebook "+Ze:Ft(e,"UCWEB")||Ft(e,"UCBrowser")?"UC Browser":Ft(e,"CriOS")?vt:Ft(e,"CrMo")||Ft(e,ht)?ht:Ft(e,et)&&Ft(e,st)?xt:Ft(e,"FxiOS")?wt:Ft(e.toLowerCase(),Rt.toLowerCase())?Rt:jt(e,t)?Ft(e,Ze)?It:st:Ft(e,yt)?yt:Ft(e,"MSIE")||Ft(e,"Trident/")?_t:Ft(e,"Gecko")?yt:""},Wt={[gt]:[new RegExp("rv:"+Dt)],[bt]:[new RegExp(mt+"?\\/"+Dt)],[ht]:[new RegExp("("+ht+"|CrMo)\\/"+Dt)],[vt]:[new RegExp("CriOS\\/"+Dt)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Dt)],[st]:[Ot],[It]:[Ot],[pt]:[new RegExp("(Opera|OPR)\\/"+Dt)],[yt]:[new RegExp(yt+"\\/"+Dt)],[wt]:[new RegExp("FxiOS\\/"+Dt)],[Rt]:[new RegExp("Konqueror[:/]?"+Dt,"i")],[ot]:[new RegExp(ot+" "+Dt),Ot],[xt]:[new RegExp("android\\s"+Dt,"i")],[ut]:[new RegExp(dt+"\\/"+Dt)],[_t]:[new RegExp("(rv:|MSIE )"+Dt)],Mozilla:[new RegExp("rv:"+Dt)]},Vt=function(e,t){var i=zt(e,t),r=Wt[i];if(void 0===r)return null;for(var n=0;n<r.length;n++){var a=r[n],s=e.match(a);if(s)return parseFloat(s[s.length-2])}return null},Kt=[[new RegExp(kt+"; "+kt+" (.*?)[);]","i"),e=>[kt,e&&e[1]||""]],[new RegExp(Ct,"i"),[Ct,""]],[new RegExp(St,"i"),[St,""]],[Ht,[ot,""]],[new RegExp(Et,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Mt,""];if(new RegExp(Ze).test(t)&&!/IEMobile\b/.test(t))return[Et+" "+Ze,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],n=qt[r]||"";return/arm/i.test(t)&&(n="RT"),[Et,n]}return[Et,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[Ye,t.join(".")]}return[Ye,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=void 0===e[2]?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+et+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+et+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[et,t.join(".")]}return[et,""]}],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];if(e&&e[1]){var i=[e[1],e[2],e[3]||"0"];t[1]=i.join(".")}return t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[ct,""]],[/Linux|debian/i,["Linux",""]]],Gt=function(e){return Nt.test(e)?Ct:Bt.test(e)?St:$t.test(e)?kt:new RegExp(At,"i").test(e)?At:new RegExp("("+Mt+"|WPDesktop)","i").test(e)?Mt:/iPad/.test(e)?rt:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?at:Ht.test(e)?ot:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Lt,"i").test(e)?Lt:/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i.test(e)||/(kf[a-z]+)( bui|\)).+silk\//i.test(e)?"Kindle Fire":/(Android|ZTE)/i.test(e)?!new RegExp(Ze).test(e)||/(9138B|TB782B|Nexus [97]|pixel c|HUAWEISHT|BTV|noble nook|smart ultra 6)/i.test(e)?/pixel[\daxl ]{1,6}/i.test(e)&&!/pixel c/i.test(e)||/(huaweimed-al00|tah-|APA|SM-G92|i980|zte|U304AA)/i.test(e)||/lmy47v/i.test(e)&&!/QTAQZ3/i.test(e)?et:it:et:new RegExp("(pda|"+Ze+")","i").test(e)?Tt:new RegExp(tt,"i").test(e)&&!new RegExp(tt+" pc","i").test(e)?Ut:""},Jt="https?://(.*)",Qt=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Xt=Te(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Qt),Zt="<masked>";function Yt(e,t){var i=Xt.concat([]),r=Pe({},function(e){var t={};return Le(Fe(e),function(e,i){"string"==typeof i&&i.startsWith("utm_")&&e&&(t[i]=e)}),t}(e));return Le(i,function(t){if(t.startsWith("utm_")){if(!(t in r)){var i=je(e,t);r[t]=i||null}}else{var n=je(e,t);r[t]=n||null}}),r}function ei(e){var t=function(e){return e?0===e.search(Jt+"google.([^/?]*)")?"google":0===e.search(Jt+"bing.com")?"bing":0===e.search(Jt+"yahoo.com")?"yahoo":0===e.search(Jt+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!==t?"q":"p",r={};if(!function(e){return null===e}(t)){r.$search_engine=t;var n=q?je(q.referrer,i):"";n.length&&(r.ph_keyword=n)}return r}function ti(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function ii(){return(null==q?void 0:q.referrer)||"$direct"}function ri(){var e;return(null==q?void 0:q.referrer)&&(null===(e=He(q.referrer))||void 0===e?void 0:e.host)||"$direct"}function ni(e){var t=function(e){var t,{r:i,u:r}=e,n={$referrer:i,$referring_domain:null==i?void 0:"$direct"===i?"$direct":null===(t=He(i))||void 0===t?void 0:t.host};if(r){n.$current_url=r;var a=He(r);n.$host=null==a?void 0:a.host,n.$pathname=null==a?void 0:a.pathname,Pe(n,Yt(r))}return i&&Pe(n,ei(i)),n}(e),i={};return Le(t,function(e,t){var r;i["$initial_"+(r=String(t),r.startsWith("$")?r.substring(1):r)]=e}),i}function ai(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function si(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function oi(e,t){if(!z)return{};var i,n,a,s=e?Te([],Qt,t||[]):[],[o,l]=function(e){for(var t=0;t<Kt.length;t++){var[i,r]=Kt[t],n=i.exec(e);if(n){var a="function"==typeof r?r(n,e):r;if(a)return a}}return["",""]}(z),d=Qe(We)||void 0,u=Qe(Ve)||void 0;return Pe(Ue({$os:o,$os_version:l,$browser:zt(z,navigator.vendor),$device:Gt(z),$device_type:(n=z,a=Gt(n),a===rt||a===it||"Kobo"===a||"Kindle Fire"===a||a===Ut?tt:a===Ct||a===kt||a===St||a===At?"Console":a===at?"Wearable":a?Ze:"Desktop"),$timezone:ai(),$timezone_offset:si(),$fb_browser_id:d,$fb_click_id:u}),{$current_url:ze(null==F?void 0:F.href,s,Zt),$host:null==F?void 0:F.host,$pathname:null==F?void 0:F.pathname,$raw_user_agent:z.length>1e3?z.substring(0,997)+"...":z,$browser_version:Vt(z,navigator.vendor),$browser_language:ti(),$browser_language_prefix:(i=ti(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==B?void 0:B.screen.height,$screen_width:null==B?void 0:B.screen.width,$viewport_height:null==B?void 0:B.innerHeight,$viewport_width:null==B?void 0:B.innerWidth,$lib:"web",$lib_version:r,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10)})}class li{constructor(e,t){void 0===e&&(e="localStorage"),this._isFirstVisit=!1,this.storage=new Be({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.generateEphemeralIdentity(),se().debug("user","ctor","ephemeral identity only")}hydrateFromStorage(){se().debug("user","hydrate start"),this.userIdentity=this.loadUserIdentity();var e=this.userIdentity.anonymous_id,t=this.userIdentity.distinct_id;se().debug("user","hydrate done","anonymous_id",e?e.slice(0,12)+"...":"n/a","distinct_id",t?t.slice(0,12)+"...":"null")}generateEphemeralIdentity(){return{distinct_id:null,anonymous_id:this.generateAnonymousId(),device_id:this.generateDeviceId(),properties:{},user_state:"anonymous"}}getUserIdentity(){return i({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){var e=this.userIdentity.anonymous_id;return e||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(d,this.userIdentity.anonymous_id,De),se().debug("user","getAnonymousId generated (was missing)",this.userIdentity.anonymous_id.slice(0,12)+"..."),this.userIdentity.anonymous_id)}getUserProperties(){return i({},this.userIdentity.properties)}getEffectiveId(){return this.userIdentity.distinct_id||this.getAnonymousId()}getDeviceId(){return this.userIdentity.device_id}getUserState(){return this.userIdentity.user_state}consumeFirstVisit(){return!!this._isFirstVisit&&(this._isFirstVisit=!1,!0)}applyUpdate(e){if(void 0!==e.distinct_id&&(this.userIdentity.distinct_id=e.distinct_id),void 0!==e.user_state&&(this.userIdentity.user_state=e.user_state),void 0!==e.device_id&&(this.userIdentity.device_id=e.device_id),e.properties_set&&(this.userIdentity.properties=i({},this.userIdentity.properties,e.properties_set)),e.properties_set_once)for(var t of Object.keys(e.properties_set_once))t in this.userIdentity.properties||(this.userIdentity.properties[t]=e.properties_set_once[t]);this.saveUserIdentity()}reset(e){this.userIdentity={distinct_id:null,anonymous_id:this.generateAnonymousId(),device_id:e?this.generateDeviceId():this.userIdentity.device_id,properties:{$last_vtilt_reset:(new Date).toISOString()},user_state:"anonymous"},this.saveUserIdentity()}set_initial_person_info(e,t){if(!this.getStoredUserProperties()[f]){var i=function(e,t){var i=e?Te([],Qt,t||[]):[],r=null==F?void 0:F.href.substring(0,1e3);return{r:ii().substring(0,1e3),u:r?ze(r,i,Zt):void 0}}(e,t);this.register_once({[f]:i},void 0)}}get_initial_props(){var e=this.getStoredUserProperties()[f];return e?ni(e):{}}update_referrer_info(){var e={$referrer:ii(),$referring_domain:ri()};this.register_once(e,void 0)}loadUserIdentity(){var e=this.storage.get(d),t=this.storage.get(l),i=this.storage.get(h),r=this.storage.get(o),n=this.getStoredUserProperties(),a=e||this.generateAnonymousId(),s=t||this.generateDeviceId(),u=i||null,c=r||"anonymous";e?se().debug("user","hydrate","loaded from storage",e.slice(0,12)+"..."):(this._isFirstVisit=!0,se().debug("user","hydrate","generated new anonymous_id"));var v=a||this.generateAnonymousId();return e||this.storage.set(d,v,De),t||this.storage.set(l,s,De),r||this.storage.set(o,c,De),{distinct_id:u,anonymous_id:v,device_id:s,properties:n,user_state:c}}saveUserIdentity(){this.storage.set(d,this.userIdentity.anonymous_id,De),this.storage.set(l,this.userIdentity.device_id,De),this.storage.set(o,this.userIdentity.user_state,De),this.userIdentity.distinct_id?this.storage.set(h,this.userIdentity.distinct_id,De):this.storage.remove(h),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(c)||{}}setStoredUserProperties(e){this.storage.setJSON(c,e,De)}register_once(e,t){var i=this.getStoredUserProperties(),r=!1;for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(n in i||(i[n]=e[n],r=!0));if(t)for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(a in i||(i[a]=t[a],r=!0));r&&this.setStoredUserProperties(i)}generateAnonymousId(){return"anon_"+Ee(16)}generateDeviceId(){return"device_"+Ee(16)}updateStorageMethod(e,t){this.storage=new Be({method:e,cross_subdomain:t,sameSite:"Lax"})}}var di=["LCP","CLS","FCP","INP","TTFB"],ui=["LCP","CLS","FCP","INP"];class hi{constructor(e,t){this._isStarted=!1,this._isLoading=!1,this._loadCallbacks=[],this._apiReady=!1,this._deferredCalls=[],this._instance=e,this._config=t}get isEnabled(){return!1!==this._config.enabled}get isStarted(){return this._isStarted}get isLoaded(){return!!this._loaded}_ensureLoaded(e){var t;if(this._loaded)e(this._loaded);else if(this._loadCallbacks.push(e),!this._isLoading){this._isLoading=!0;var i=null===(t=W.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;if(!i)return se().error("feature",this.name,"loadExternalDependency not available"),this._isLoading=!1,void(this._loadCallbacks=[]);i(this._instance,this.scriptName,e=>{if(this._isLoading=!1,e)return se().error("feature",this.name,"could not load "+this.scriptName+":",e),void(this._loadCallbacks=[]);this._loaded||(this._loaded=this._createLoaded());var t=this._loaded,i=this._loadCallbacks;for(var r of(this._loadCallbacks=[],i))try{r(t)}catch(e){se().error("feature",this.name,"load callback error:",e)}})}}startIfEnabled(){this.isEnabled&&!this._isStarted&&(this._isStarted=!0,this._ensureLoaded(e=>this._onLoaded(e)))}_onLoaded(e){}stop(){this._isStarted=!1}updateConfig(e){this._config=i({},this._config,e)}_deferCall(e){this._apiReady?e():this._deferredCalls.push(e)}_markApiReady(){if(!this._apiReady){this._apiReady=!0;var e=this._deferredCalls;for(var t of(this._deferredCalls=[],e))try{t()}catch(e){se().error("feature",this.name,"deferred call error:",e)}}}_resetDeferral(){this._apiReady=!1,this._deferredCalls=[]}}class ci extends hi{startIfEnabledOrStop(e){if(this.isEnabled){if(this._isStarted&&this._loaded)return;this._isStarted=!0,this._ensureLoaded(e=>this._onLoaded(e))}else this.stop()}}var vi=9e5,_i="web-vitals";class gi extends hi{static extractConfig(e){var t=e.capture_performance;return"boolean"==typeof t?{web_vitals:t}:"object"==typeof t&&null!==t?t:{web_vitals:!1}}constructor(e,t){super(e,null!=t?t:gi.extractConfig(e.getConfig())),this.name="WebVitals",this.scriptName="web-vitals",this._buffer=this._createEmptyBuffer()}get isEnabled(){var e=null==F?void 0:F.protocol;return("http:"===e||"https:"===e)&&!0===this._config.web_vitals}startIfEnabled(){if(this.isEnabled&&!this._isStarted&&B){var e=this._getWebVitalsCallbacks();e?(this._isStarted=!0,this._loaded=e,this._startCapturing(e)):(this._isStarted=!0,this._ensureLoaded(e=>this._onLoaded(e)))}}stop(){this._isStarted&&(this._flush(),this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0),this._isStarted=!1)}onConfigUpdate(e){var t=gi.extractConfig(e),i=this.isEnabled;this._config=t,i||!this.isEnabled||this._isStarted?i&&!this.isEnabled&&this._isStarted&&this.stop():this.startIfEnabled()}_createLoaded(){var e=this._getWebVitalsCallbacks();if(!e)throw new Error("[vTilt:web-vitals] web-vitals loaded but callbacks not registered");return e}_onLoaded(e){this._startCapturing(e)}get allowedMetrics(){return this._config.web_vitals_allowed_metrics||ui}get flushTimeoutMs(){return this._config.web_vitals_delayed_flush_ms||5e3}get maxAllowedValue(){var e=this._config.__web_vitals_max_value;return void 0===e?vi:0===e?0:e<6e4?vi:e}_createEmptyBuffer(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}_getWebVitalsCallbacks(){var e;return null===(e=W.__VTiltExtensions__)||void 0===e?void 0:e.webVitalsCallbacks}_startCapturing(e){var t=this.allowedMetrics,i=this._addToBuffer.bind(this);t.includes("LCP")&&e.onLCP&&e.onLCP(i),t.includes("CLS")&&e.onCLS&&e.onCLS(i,{reportAllChanges:!0}),t.includes("FCP")&&e.onFCP&&e.onFCP(i),t.includes("INP")&&e.onINP&&e.onINP(i),t.includes("TTFB")&&e.onTTFB&&e.onTTFB(i)}_getCurrentUrl(){var e;return null===(e=null==B?void 0:B.location)||void 0===e?void 0:e.href}_getCurrentPathname(){return null==F?void 0:F.pathname}_addToBuffer(e){var t,r,n;try{if(!B||!q||!F)return;if(!(null==e?void 0:e.name)||void 0===(null==e?void 0:e.value))return void se().warn(_i,"invalid metric received",e);if(this.maxAllowedValue>0&&e.value>=this.maxAllowedValue&&"CLS"!==e.name)return void se().warn(_i,"ignoring "+e.name+" with value >= "+this.maxAllowedValue+"ms");var a=this._getCurrentUrl(),s=this._getCurrentPathname();if(!a)return void se().warn(_i,"could not determine current URL");this._buffer.url&&this._buffer.url!==a&&this._flush(),this._buffer.url||(this._buffer.url=a,this._buffer.pathname=s),this._buffer.firstMetricTimestamp||(this._buffer.firstMetricTimestamp=Date.now());var o=this._cleanAttribution(e.attribution),l=null!==(n=null===(r=(t=this._instance).getSessionId)||void 0===r?void 0:r.call(t))&&void 0!==n?n:null,d=this._getWindowId(),u=i({},e,{attribution:o,timestamp:Date.now(),$current_url:a,$session_id:l,$window_id:d}),h=this._buffer.metrics.findIndex(t=>t.name===e.name);h>=0?this._buffer.metrics[h]=u:this._buffer.metrics.push(u),this._scheduleFlush(),this._buffer.metrics.length>=this.allowedMetrics.length&&this._flush()}catch(e){se().error(_i,"error adding metric to buffer:",e)}}_cleanAttribution(e){if(e){var t=i({},e);return"interactionTargetElement"in t&&delete t.interactionTargetElement,t}}_getWindowId(){var e;try{return(null===(e=this._instance.sessionManager)||void 0===e?void 0:e.getWindowId())||null}catch(e){return null}}_scheduleFlush(){this._flushTimer&&clearTimeout(this._flushTimer),this._flushTimer=setTimeout(()=>{this._flush()},this.flushTimeoutMs)}_flush(){if(this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0),0!==this._buffer.metrics.length){try{var e={$pathname:this._buffer.pathname,$current_url:this._buffer.url};for(var t of this._buffer.metrics)e["$web_vitals_"+t.name+"_value"]=t.value,e["$web_vitals_"+t.name+"_event"]={name:t.name,value:t.value,delta:t.delta,rating:t.rating,id:t.id,navigationType:t.navigationType,attribution:t.attribution,$session_id:t.$session_id,$window_id:t.$window_id};this._instance.capture("$web_vitals",e)}catch(e){se().error(_i,"error flushing metrics:",e)}this._buffer=this._createEmptyBuffer()}}}function pi(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],n=i(r);return X(n)&&(n.prototype=n.prototype||{},Object.defineProperties(n,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),e[t]=n,()=>{e[t]=r}}catch(e){return()=>{}}}class fi{constructor(e,t){var i;this.name="HistoryAutocapture",this._isStarted=!1,this._instance=e,this._config=t||fi.extractConfig(e.getConfig()),this._lastPathname=(null===(i=null==B?void 0:B.location)||void 0===i?void 0:i.pathname)||""}static extractConfig(e){return{enabled:!1!==e.capture_pageview}}get isEnabled(){return!1!==this._config.enabled&&!1!==this._instance.getConfig().capture_pageview}get isStarted(){return this._isStarted}startIfEnabled(){this.isEnabled&&!this._isStarted&&this._start()}stop(){this._isStarted&&(this._popstateListener&&(this._popstateListener(),this._popstateListener=void 0),this._isStarted=!1)}onConfigUpdate(e){this._config=fi.extractConfig(e),this.isEnabled&&!this._isStarted?this._start():!this.isEnabled&&this._isStarted&&this.stop()}_start(){B&&F&&(this._lastPathname=F.pathname||"",this._patchHistoryMethods(),this._setupPopstateListener(),this._isStarted=!0,se().info("history-autocapture","started"))}_patchHistoryMethods(){var e,t;if(null==B?void 0:B.history){var i=this;(null===(e=B.history.pushState)||void 0===e?void 0:e.__vtilt_wrapped__)||pi(B.history,"pushState",e=>function(t,r,n){i._emitPageleaveIfPathWillChange(n),e.call(this,t,r,n),i._capturePageview("pushState")}),(null===(t=B.history.replaceState)||void 0===t?void 0:t.__vtilt_wrapped__)||pi(B.history,"replaceState",e=>function(t,r,n){i._emitPageleaveIfPathWillChange(n),e.call(this,t,r,n),i._capturePageview("replaceState")})}}_emitPageleaveIfPathWillChange(e){var t;if(F){var i=F.pathname||"",r=null!==(t=function(e){if(!F)return null;if(null==e||""===e)return F.pathname||null;try{return new URL(String(e),F.href).pathname}catch(e){return null}}(e))&&void 0!==t?t:i;r!==i&&this._instance.tryCapturePageleave("spa_transition")}}_setupPopstateListener(){if(!this._popstateListener&&B){var e=()=>{this._capturePageview("popstate")};Ae(B,"popstate",e),this._popstateListener=()=>{null==B||B.removeEventListener("popstate",e)}}}_capturePageview(e){this.isEnabled&&this._isStarted&&le(()=>{var t,i=null===(t=null==B?void 0:B.location)||void 0===t?void 0:t.pathname;if(i&&F&&q)if(i!==this._lastPathname){se().debug("history-autocapture",e,i),this._lastPathname=i;var r={navigation_type:e};this._instance.capture(m,r)}else this._lastPathname=i})}}var mi=["a","button","form","input","select","textarea","label"],bi="$copy_autocapture",yi=['[id*="cookie" i]','[class*="cookie" i]','[id*="consent" i]','[class*="consent" i]','[id*="gdpr" i]','[class*="gdpr" i]','[id*="privacy-banner" i]','[class*="privacy-banner" i]','[id*="cookie-banner" i]','[class*="cookie-banner" i]','[id*="cookie-notice" i]','[class*="cookie-notice" i]',"#CybotCookiebotDialog",'[class^="CybotCookiebotDialog"]','[id^="onetrust"]','[class^="onetrust"]','[id^="cc-"]',".cc-banner",".cc-window",".cc-revoke",'[id^="cookieconsent"]','[class^="cookieconsent"]','[id^="gdpr-cookie"]','[id^="qc-cmp"]',"#termly-code-snippet-support",'[id^="iubenda"]','[id^="truste"]','[class^="truste"]',"#consent_blackbar",'[id^="didomi"]','[id^="usercentrics"]',"#uc-center-container",".klaro","#klaro","#cookiescript_injected",".cky-consent-container","#cky-consent","#cmplz-cookiebanner-container","#gdpr-cookie-message",'[class*="fs-cc"]','[class*="fc-cc"]',"[fs-cc]","[fs-cc-checkbox]",'[class*="cookie-preferences"]',"#cookie-preferences",'[role="dialog"][aria-label*="cookie" i]','[role="dialog"][aria-label*="consent" i]','[aria-describedby*="cookie" i]','[aria-label*="Cookie Preferences" i]'];function wi(e){return e.replace(/^\s+|\s+$/g,"")}function Ci(e,t){return e.indexOf(t)>-1}function Si(e){return 1===(null==e?void 0:e.nodeType)}function ki(e){return 3===(null==e?void 0:e.nodeType)}function xi(e,t){var i;return(null===(i=null==e?void 0:e.tagName)||void 0===i?void 0:i.toLowerCase())===t}function Ii(e){return 11===(null==e?void 0:e.nodeType)}function Ei(e){return e?wi(e).split(/\s+/):[]}function Mi(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className&&"string"==typeof e.className.baseVal?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return Ei(t)}function Li(e){return J(e)?null:wi(e).split(/(\s+)/).filter(e=>Fi(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Ai(e){var t,i="";if(zi(e)&&!Wi(e)&&e.childNodes&&e.childNodes.length)for(var r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];ki(n)&&n.textContent&&(i+=null!==(t=Li(n.textContent))&&void 0!==t?t:"")}return wi(i)}function Pi(e){var t,i="";if(e&&e.childNodes&&e.childNodes.length)for(var r=0;r<e.childNodes.length;r++){var n=e.childNodes[r];if(n&&"span"===(null===(t=n.tagName)||void 0===t?void 0:t.toLowerCase()))try{i=(i+" "+Ai(n)).trim(),n.childNodes&&n.childNodes.length&&(i=(i+" "+Pi(n)).trim())}catch(e){}}return i}function Ti(e){var t=Ai(e);return Fi(t=(t+" "+Pi(e)).trim())?t:""}function Ui(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!Si(t));return t}function Ri(e){var t=e.parentNode;return!(!t||!Si(t))&&t}function Di(e){var t=null==B?void 0:B.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}var Oi="(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11})",$i=new RegExp("^(?:"+Oi+")$"),Bi=new RegExp(Oi),Ni="\\d{3}-?\\d{2}-?\\d{4}",Hi=new RegExp("^("+Ni+")$"),qi=new RegExp("("+Ni+")");function Fi(e,t){if(void 0===t&&(t=!0),J(e))return!1;if(K(e)){if(e=wi(e),(t?$i:Bi).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Hi:qi).test(e))return!1}return!0}function ji(e){return!!K(e)&&("_ngcontent"===e.substring(0,10)||"_nghost"===e.substring(0,7))}function zi(e){for(var t=e;t&&t.parentNode&&!xi(t,"body");t=t.parentNode){var i=Mi(t);if(Ci(i,"vt-sensitive")||Ci(i,"vt-no-capture"))return!1}if(Ci(Mi(e),"vt-include"))return!0;var r=e.type||"";if(K(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var n=e.name||e.id||"";if(K(n)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(n.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Wi(e){return!!(xi(e,"input")&&!["button","checkbox","submit","reset","radio"].includes(e.type)||xi(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function Vi(e){if(!zi(e))return null;if(xi(e,"input")){var t=e,i=(t.type||"text").toLowerCase();if("password"===i||"hidden"===i)return null;if("checkbox"===i||"radio"===i){var r={$el_value:t.checked?"true":"false"},n=function(e){var t=e.closest("label");if(t){var i=wi(t.textContent||"");if(i&&Fi(i))return Li(i)||null}if(e.id)try{var r=null===document||void 0===document?void 0:document.querySelector('label[for="'+e.id+'"]');if(r){var n=wi(r.textContent||"");if(n&&Fi(n))return Li(n)||null}}catch(e){}return null}(t);return n?r.$selected_text=n:t.value&&Fi(t.value)&&(r.$selected_text=t.value),r}var a=t.value;if(a&&Fi(a)){var s=Li(a);if(s)return{$el_value:s}}return null}if(xi(e,"select")){var o=e,l=o.selectedIndex;if(l>=0&&o.options[l]){var d=o.options[l],u={};d.value&&Fi(d.value)&&(u.$el_value=d.value);var h=d.text;if(h&&Fi(h)){var c=Li(h);c&&(u.$selected_text=c)}if(u.$el_value||u.$selected_text)return u}return null}return xi(e,"textarea"),null}function Ki(e,t,i,r,n){if(void 0===i&&(i=void 0),!B)return{capture:!1,reason:"no_window"};if(!e)return{capture:!1,reason:"no_element"};if(xi(e,"html")||!Si(e))return{capture:!1,reason:"html_element"};if((null==i?void 0:i.url_allowlist)&&!Di(i.url_allowlist))return{capture:!1,reason:"url_allowlist_miss"};if((null==i?void 0:i.url_ignorelist)&&Di(i.url_ignorelist))return{capture:!1,reason:"url_ignorelist_hit"};if(null==i?void 0:i.dom_event_allowlist){var a=i.dom_event_allowlist;if(a&&!a.some(e=>t.type===e))return{capture:!1,reason:"dom_event_not_allowed"}}for(var s=!1,o=[e],l=!0,d=e;d.parentNode&&!xi(d,"body");)if(Ii(d.parentNode))o.push(d.parentNode.host),d=d.parentNode.host;else{if(!(l=Ri(d)))break;if(r||mi.indexOf(l.tagName.toLowerCase())>-1)s=!0;else{var u=B.getComputedStyle(l);u&&"pointer"===u.getPropertyValue("cursor")&&(s=!0)}o.push(l),d=l}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(G(i))return!0;var r,n=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var a of e)if(r=n(a))return r.v;return!1}(o,i))return{capture:!1,reason:"element_allowlist_miss"};if(!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if(G(i))return!0;var r,n=function(e){if(i.some(t=>e.matches(t)))return{v:!0}};for(var a of e)if(r=n(a))return r.v;return!1}(o,i))return{capture:!1,reason:"css_selector_allowlist_miss"};if(function(e,t){var i=null==t?void 0:t.css_selector_ignorelist,r=void 0===i?yi:i;if(0===r.length)return!1;for(var n of e)for(var a of r)try{if(n.matches(a))return!0}catch(e){}return!1}(o,i))return{capture:!1,reason:"css_selector_ignorelist_hit"};var h=B.getComputedStyle(e);if(h&&"pointer"===h.getPropertyValue("cursor")&&"click"===t.type)return{capture:!0};var c=e.tagName.toLowerCase();switch(c){case"html":return{capture:!1,reason:"tag_html"};case"form":return(n||["submit"]).indexOf(t.type)>=0?{capture:!0}:{capture:!1,reason:"form_event_not_allowed"};case"input":case"select":case"textarea":return(n||["change","click"]).indexOf(t.type)>=0?{capture:!0}:{capture:!1,reason:"input_event_not_allowed"};default:return s?(n||["click"]).indexOf(t.type)>=0?{capture:!0}:{capture:!1,reason:"dom_event_not_allowed"}:(n||["click"]).indexOf(t.type)>=0&&(mi.indexOf(c)>-1||"true"===e.getAttribute("contenteditable"))?{capture:!0}:{capture:!1,reason:"tag_not_capturable"}}}function Gi(e,t){return t.length>e?t.slice(0,e)+"...":t}function Ji(e,t,i,r){var n=e.tagName.toLowerCase(),a={tag_name:n};mi.indexOf(n)>-1&&!i&&(a.$el_text=Gi(1024,"a"===n||"button"===n?Ti(e):Ai(e)));var s=Mi(e);s.length>0&&(a.classes=s.filter(e=>""!==e));for(var o=0;o<e.attributes.length;o++){var l=e.attributes[o];if((!Wi(e)||-1!==["name","id","class","aria-label"].indexOf(l.name))&&(!(null==r?void 0:r.includes(l.name))&&!t&&Fi(l.value)&&!ji(l.name))){var d=l.value;"class"===l.name&&(d=Ei(d).join(" ")),a["attr__"+l.name]=Gi(1024,d)}}for(var u=1,h=1,c=e;c=Ui(c);)u++,c.tagName===e.tagName&&h++;return a.nth_child=u,a.nth_of_type=h,a}function Qi(e){if(!zi(e))return{};for(var t={},i=0;i<e.attributes.length;i++){var r=e.attributes[i];if(r.name&&0===r.name.indexOf("data-vt-capture-attribute")){var n=r.name.replace("data-vt-capture-attribute-",""),a=r.value;n&&a&&Fi(a)&&(t[n]=a)}}return t}function Xi(e){return e.replace(/"|\\"/g,'\\"')}function Zi(e){var t=e.attr__class;return t?Q(t)?t:Ei(t):void 0}function Yi(e){return function(e){var t=e.map(e=>{var t,r,n="";if(e.tag_name&&(n+=e.tag_name),e.attr_class)for(var a of(e.attr_class.sort(),e.attr_class))n+="."+a.replace(/"/g,"");var s=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(r=e.nth_of_type)&&void 0!==r?r:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Object.entries(s).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[Xi(t.toString())]=Xi(String(i))}),(n+=":")+Object.entries(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")});return t.join(";")}(function(e){return e.map(e=>{var t,i,r={text:null===(t=e.$el_text)||void 0===t?void 0:t.slice(0,400),tag_name:e.tag_name,href:null===(i=e.attr__href)||void 0===i?void 0:i.slice(0,2048),attr_class:Zi(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return Object.entries(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r})}(e))}var er=[25,50,75,100];function tr(e){var t;if(!e)return null;var i=e.milestones,r=!0===i||"object"==typeof i&&null!==i,n="object"==typeof i&&null!==i&&(null===(t=i.thresholds)||void 0===t?void 0:t.length)?[...i.thresholds].sort((e,t)=>e-t):[...er],a=!0===e.pageleave;return r||a?{milestones:r,thresholds:n,pageleave:a,scroll_root_selector:e.scroll_root_selector}:null}class ir{constructor(e){this._options=e,this._maxPctSeen=0,this._firedThresholds=new Set,this._scrollHandler=null,this._scrollTarget=null,this._rafId=null,this._pageviewUnsub=null}start(){this.stop(),this._scrollTarget=function(e){if(!B)return null;if(e){var t=Array.isArray(e)?e:[e];for(var i of t){var r=null==q?void 0:q.querySelector(i);if(r instanceof Element)return r}}return B}(this._options.scroll_root_selector),this._scrollTarget&&(this._scrollHandler=()=>this._scheduleScrollUpdate(),Ae(this._scrollTarget,"scroll",this._scrollHandler,{passive:!0}),this._onScroll(),this._pageviewUnsub=this._options.onPageview(()=>this.reset()))}stop(){this._pageviewUnsub&&(this._pageviewUnsub(),this._pageviewUnsub=null),null!=this._rafId&&B&&(B.cancelAnimationFrame(this._rafId),this._rafId=null),this._scrollHandler&&this._scrollTarget&&(this._scrollTarget.removeEventListener("scroll",this._scrollHandler,{passive:!0}),this._scrollHandler=null,this._scrollTarget=null)}reset(){this._maxPctSeen=0,this._firedThresholds.clear(),this._onScroll()}getMaxPct(){return this._maxPctSeen}_scheduleScrollUpdate(){B&&null==this._rafId&&(this._rafId=B.requestAnimationFrame(()=>{this._rafId=null,this._onScroll()}))}_onScroll(){if(this._scrollTarget){var e=function(e){var t,i,r,n,a,s;if(!e)return 0;if(e===B){var o=null!==(t=B.scrollY)&&void 0!==t?t:0,l=null!==(i=B.innerHeight)&&void 0!==i?i:0,d=null==q?void 0:q.documentElement,u=null==q?void 0:q.body,h=Math.max(null!==(r=null==d?void 0:d.scrollHeight)&&void 0!==r?r:0,null!==(n=null==u?void 0:u.scrollHeight)&&void 0!==n?n:0,null!==(a=null==d?void 0:d.offsetHeight)&&void 0!==a?a:0,null!==(s=null==u?void 0:u.offsetHeight)&&void 0!==s?s:0)-l;return h<=0?100:Math.round(Math.min(100,o/h*100))}var c=e,v=c.scrollHeight-c.clientHeight;return v<=0?100:Math.round(Math.min(100,c.scrollTop/v*100))}(this._scrollTarget);if(e>this._maxPctSeen&&(this._maxPctSeen=e),this._options.milestones&&this._options.isUrlAllowed())for(var t of this._options.thresholds)this._maxPctSeen>=t&&!this._firedThresholds.has(t)&&(this._firedThresholds.add(t),this._options.capture(x,{[R]:t,[D]:this._maxPctSeen}))}}}function rr(e,t){return e.indexOf(t)>-1}class nr{constructor(){this.clicks=[],this.RAGE_CLICK_THRESHOLD_PX=30,this.RAGE_CLICK_TIMEOUT_MS=1e3,this.RAGE_CLICK_CLICK_COUNT=3}isRageClick(e,t,i){if(this.clicks=this.clicks.filter(e=>i-e.timestamp<this.RAGE_CLICK_TIMEOUT_MS),this.clicks.length>0){var r=this.clicks[this.clicks.length-1];Math.sqrt(Math.pow(e-r.x,2)+Math.pow(t-r.y,2))>this.RAGE_CLICK_THRESHOLD_PX&&(this.clicks=[])}return this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length>=this.RAGE_CLICK_CLICK_COUNT}}function ar(e,t){for(var i,r,n,a,{e:s,maskAllElementAttributes:o,maskAllText:l,elementAttributeIgnoreList:d,elementsChainAsString:u,captureElementValues:h}=t,c=[e],v=e;v.parentNode&&!xi(v,"body");)Ii(v.parentNode)?(c.push(v.parentNode.host),v=v.parentNode.host):(c.push(v.parentNode),v=v.parentNode);var _,g=[],p={},f=!1,m=!1;for(var b of c){var y=zi(b);if("a"===b.tagName.toLowerCase()){var w=b.getAttribute("href");f=!!(y&&w&&Fi(w))&&w}rr(Mi(b),"vt-no-capture")&&(m=!0),g.push(Ji(b,o,l,d));var C=Qi(b);Object.assign(p,C)}if(m)return{props:{},explicitNoCapture:m};if(l||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?g[0].$el_text=Ti(e):g[0].$el_text=Ai(e)),"change"===s.type&&h){var S=Vi(e);S&&(S.$el_value&&(g[0].$el_value=S.$el_value),S.$selected_text&&(g[0].$selected_text=S.$selected_text))}if(f){g[0].attr__href=f;var k=null===(i=He(f))||void 0===i?void 0:i.host,x=null===(r=null==B?void 0:B.location)||void 0===r?void 0:r.host;k&&x&&k!==x&&(_=f)}var I=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return Object.assign({},...t)}({$event_type:s.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:Yi(g)},(null===(n=g[0])||void 0===n?void 0:n.$el_text)?{$el_text:null===(a=g[0])||void 0===a?void 0:a.$el_text}:{},_&&"click"===s.type?{$external_click_url:_}:{},p);return{props:I}}var sr=["copy","cut"];class or{static extractConfig(e){return{enabled:!1!==e.autocapture}}constructor(e,t){this.name="Autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._userOverride=null,this._elementSelectors=null,this._rageclicks=new nr,this._elementsChainAsString=!0,this._cachedConfig=null,this._cachedConfigSource=null,this._domHandler=null,this._copyHandler=null,this._copyHandlerAttached=!1,this._scrollDepthTracker=null,this._pageviewUnsubscribe=null,this._instance=e}get _config(){var e=this._instance.getConfig().autocapture;if(e===this._cachedConfigSource&&this._cachedConfig)return this._cachedConfig;this._cachedConfigSource=e;var t=function(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}(e)?e:{};return t.url_allowlist&&(t.url_allowlist=t.url_allowlist.map(e=>"string"==typeof e?new RegExp(e):e)),t.url_ignorelist&&(t.url_ignorelist=t.url_ignorelist.map(e=>"string"==typeof e?new RegExp(e):e)),this._cachedConfig=t,t}get isEnabled(){return this._evaluateEnabled().enabled}get isStarted(){return this._initialized}startIfEnabled(){var{enabled:e,reason:t}=this._evaluateEnabled();e?this._initialized?(this._syncCopyHandler(),this._syncScrollDepthHandler()):(this._addDomEventHandlers(),this._initialized=!0,se().info("autocapture","started; listening for click/change/submit events")):this._initialized?(se().info("autocapture","stopping; reason:",null!=t?t:"unknown"),this._removeDomEventHandlers(),this._initialized=!1):(se().debug("autocapture","not started; reason:",null!=t?t:"unknown"),this._teardownScrollDepth())}stop(){this._initialized&&(this._removeDomEventHandlers(),this._initialized=!1,se().info("autocapture","stopped (DOM listeners detached)")),this._teardownScrollDepth()}getMaxScrollDepthPctForPageleave(){var e=tr(this._config.scroll_depth);return(null==e?void 0:e.pageleave)&&this._scrollDepthTracker?this._scrollDepthTracker.getMaxPct():null}onConfigUpdate(e){var t=e;"boolean"==typeof t.elementsChainAsString&&(this._elementsChainAsString=t.elementsChainAsString),void 0!==t.autocapture_opt_out&&(this._isDisabledServerSide=!!t.autocapture_opt_out),this.startIfEnabled()}updateConfig(e){void 0!==e.enabled&&(this._userOverride=e.enabled,e.enabled&&(this._isDisabledServerSide=!1),this.startIfEnabled())}getDiagnostics(){var e,t,i,{enabled:r,reason:n}=this._evaluateEnabled(),a=tr(this._config.scroll_depth);return{isEnabled:r,isStarted:this._initialized,disabledReason:r?null:n,inputs:{configAutocapture:this._instance.getConfig().autocapture,isDisabledServerSide:null!==(e=this._isDisabledServerSide)&&void 0!==e&&e,userOverride:this._userOverride,elementsChainAsString:this._elementsChainAsString,captureCopiedText:!!this._config.capture_copied_text,scrollDepthMilestones:null!==(t=null==a?void 0:a.milestones)&&void 0!==t&&t,scrollDepthPageleave:null!==(i=null==a?void 0:a.pageleave)&&void 0!==i&&i,scrollDepthListenerAttached:null!==this._scrollDepthTracker}}}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach(t=>{var r=null==q?void 0:q.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&i.push(t)})}),i}_evaluateEnabled(){if(!1===this._userOverride)return{enabled:!1,reason:"user_stop_called"};if(this._isDisabledServerSide)return{enabled:!1,reason:"server_opt_out"};if(!0===this._userOverride)return{enabled:!0,reason:null};var e=this._instance.getConfig().autocapture;return!1===e?{enabled:!1,reason:"config_autocapture_false"}:null==e?{enabled:!1,reason:"config_autocapture_undefined"}:{enabled:!0,reason:null}}_addDomEventHandlers(){this._isBrowserSupported()?B&&q&&(this._domHandler=e=>{var t=e||(null==B?void 0:B.event);if(t)try{this._captureEvent(t)}catch(e){se().error("autocapture","capture handler threw",e)}},Ae(q,"submit",this._domHandler,{capture:!0}),Ae(q,"change",this._domHandler,{capture:!0}),Ae(q,"click",this._domHandler,{capture:!0}),this._syncCopyHandler(),this._syncScrollDepthHandler()):se().warn("autocapture","browser unsupported (no querySelectorAll)")}_removeDomEventHandlers(){q&&(this._domHandler&&(q.removeEventListener("submit",this._domHandler,!0),q.removeEventListener("change",this._domHandler,!0),q.removeEventListener("click",this._domHandler,!0),this._domHandler=null),this._copyHandler&&this._copyHandlerAttached&&(q.removeEventListener("copy",this._copyHandler,!0),q.removeEventListener("cut",this._copyHandler,!0),this._copyHandlerAttached=!1,this._copyHandler=null),this._teardownScrollDepth())}_syncScrollDepthHandler(){var e,t=tr(this._config.scroll_depth),i=this.isEnabled&&null!==t&&null!==tr(null==(e=this._config)?void 0:e.scroll_depth);i&&!this._scrollDepthTracker?(this._scrollDepthTracker=new ir({milestones:t.milestones,pageleave:t.pageleave,thresholds:t.thresholds,scroll_root_selector:t.scroll_root_selector,capture:(e,t)=>this._instance.capture(e,t),isUrlAllowed:()=>{return e=this._config,!(!B||(null==e?void 0:e.url_allowlist)&&!Di(e.url_allowlist)||(null==e?void 0:e.url_ignorelist)&&Di(e.url_ignorelist));var e},onPageview:e=>(this._pageviewUnsubscribe&&this._pageviewUnsubscribe(),this._pageviewUnsubscribe=this._instance.on(fe,t=>{(null==t?void 0:t.event)===m&&e()}),()=>{var e;null===(e=this._pageviewUnsubscribe)||void 0===e||e.call(this),this._pageviewUnsubscribe=null})}),this._scrollDepthTracker.start(),se().info("autocapture","scroll depth tracking started",{milestones:t.milestones,pageleave:t.pageleave})):i||this._teardownScrollDepth()}_teardownScrollDepth(){this._scrollDepthTracker&&(this._scrollDepthTracker.stop(),this._scrollDepthTracker=null,se().info("autocapture","scroll depth tracking stopped")),this._pageviewUnsubscribe&&(this._pageviewUnsubscribe(),this._pageviewUnsubscribe=null)}_syncCopyHandler(){if(q){var e=!!this._config.capture_copied_text;e&&!this._copyHandlerAttached?(this._copyHandler=e=>{var t=e||(null==B?void 0:B.event);if(t)try{this._captureEvent(t,bi)}catch(e){se().error("autocapture","copy handler threw",e)}},Ae(q,"copy",this._copyHandler,{capture:!0}),Ae(q,"cut",this._copyHandler,{capture:!0}),this._copyHandlerAttached=!0):!e&&this._copyHandlerAttached&&this._copyHandler&&(q.removeEventListener("copy",this._copyHandler,!0),q.removeEventListener("cut",this._copyHandler,!0),this._copyHandlerAttached=!1,this._copyHandler=null)}}_captureEvent(e,t){var i,r,n,a,s,o,l,d;if(void 0===t&&(t="$autocapture"),this.isEnabled)if(e.isTrusted){var u=function(e){var t;return G(e.target)?e.srcElement||null:(null===(t=e.target)||void 0===t?void 0:t.shadowRoot)?e.composedPath()[0]||null:e.target||null}(e);if(ki(u)&&(u=u.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent)this._instance.getConfig().rageclick&&(null===(i=this._rageclicks)||void 0===i?void 0:i.isRageClick(e.clientX,e.clientY,(new Date).getTime()))&&(se().info("autocapture","$rageclick detected"),this._captureEvent(e,"$rageclick"));var h=t===bi;if(u){var c=Ki(u,e,this._config,h,h?[...sr]:void 0);if(c.capture){var v=this._instance.getConfig(),{props:_,explicitNoCapture:g}=ar(u,{e:e,maskAllElementAttributes:null!==(a=v.mask_all_element_attributes)&&void 0!==a&&a,maskAllText:null!==(s=v.mask_all_text)&&void 0!==s&&s,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,captureElementValues:null!==(o=this._config.capture_element_values)&&void 0!==o&&o});if(g)return se().debug("autocapture","skip: vt-no-capture class on element chain",{tag:null===(l=u.tagName)||void 0===l?void 0:l.toLowerCase()}),!1;var p=this.getElementSelectors(u);if(p&&p.length>0&&(_.$element_selectors=p),t===bi){var f=Li(null===(d=null==B?void 0:B.getSelection())||void 0===d?void 0:d.toString()),m=e.type||"clipboard";if(!f)return se().debug("autocapture","skip copy: empty selection"),!1;_.$selected_content=f,_.$copy_type=m}return this._instance.capture(t,_),!0}se().debug("autocapture","skip:",null!==(r=c.reason)&&void 0!==r?r:"unknown",{type:e.type,tag:null===(n=u.tagName)||void 0===n?void 0:n.toLowerCase()})}else se().debug("autocapture","skip: no event target",{type:e.type})}else se().debug("autocapture","skip: synthetic event (isTrusted=false)",{type:e.type})}_isBrowserSupported(){return X(null==q?void 0:q.querySelectorAll)}}var lr="replay";class dr extends ci{constructor(e,t){super(e,t||dr.extractConfig(e.getConfig())),this.name="SessionRecording",this.scriptName="recorder"}static extractConfig(e){var t,i,r,n=e.session_recording||{};return{enabled:null!==(t=n.enabled)&&void 0!==t&&t,sampleRate:n.sampleRate,minimumDurationMs:n.minimumDurationMs,sessionIdleThresholdMs:n.sessionIdleThresholdMs,fullSnapshotIntervalMs:n.fullSnapshotIntervalMs,captureConsole:null!==(i=n.captureConsole)&&void 0!==i&&i,captureNetwork:null!==(r=n.captureNetwork)&&void 0!==r&&r,captureCanvas:n.captureCanvas,blockClass:n.blockClass,blockSelector:n.blockSelector,skipDefaultInvisibleBlocking:n.skipDefaultInvisibleBlocking,ignoreClass:n.ignoreClass,maskTextClass:n.maskTextClass,maskTextSelector:n.maskTextSelector,maskAllInputs:n.maskAllInputs,maskInputOptions:n.maskInputOptions,masking:n.masking,recordHeaders:n.recordHeaders,recordBody:n.recordBody,compressEvents:n.compressEvents,__mutationThrottlerRefillRate:n.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:n.__mutationThrottlerBucketSize}}get isEnabled(){var e,t=this._instance.getConfig(),i=null!==(e=this._config.enabled)&&void 0!==e&&e,r=!t.disable_session_recording;return!!B&&i&&r}get isStarted(){var e;return this._isStarted&&!!(null===(e=this._loaded)||void 0===e?void 0:e.isStarted)}startIfEnabled(){this.startIfEnabledOrStop("recording_initialized")}startIfEnabledOrStop(e){var t;if(!this.isEnabled||!(null===(t=this._loaded)||void 0===t?void 0:t.isStarted)){var i=void 0!==Object.assign&&void 0!==Array.from;this.isEnabled&&i?(this._isStarted=!0,this._ensureLoaded(t=>this._onLoaded(t,e)),se().info(lr,"starting")):this.stop()}}stop(){le(()=>{var e;null===(e=this._loaded)||void 0===e||e.stop(),this._isStarted=!1})}onConfigUpdate(e){var t;this._config=dr.extractConfig(e),null===(t=this._loaded)||void 0===t||t.updateConfig(this._config),this.startIfEnabledOrStop("config_updated")}_createLoaded(){var e,t=null===(e=W.__VTiltExtensions__)||void 0===e?void 0:e.initSessionRecording;if(!t)throw new Error("[vTilt:replay] initSessionRecording not available after script load");return t(this._instance,this._config)}_onLoaded(e,t){e.start(t)}get started(){return this.isStarted}get status(){var e;return(null===(e=this._loaded)||void 0===e?void 0:e.status)||"lazy_loading"}get sessionId(){var e;return(null===(e=this._loaded)||void 0===e?void 0:e.sessionId)||""}stopRecording(){this.stop()}log(e,t){var i;void 0===t&&(t="log"),(null===(i=this._loaded)||void 0===i?void 0:i.log)?this._loaded.log(e,t):se().warn(lr,"log called before recorder was ready")}updateConfig(e){var t;this._config=i({},this._config,e),null===(t=this._loaded)||void 0===t||t.updateConfig(this._config)}}var ur=(e=>(e[e.Mutation=0]="Mutation",e[e.MouseMove=1]="MouseMove",e[e.MouseInteraction=2]="MouseInteraction",e[e.Scroll=3]="Scroll",e[e.ViewportResize=4]="ViewportResize",e[e.Input=5]="Input",e[e.TouchMove=6]="TouchMove",e[e.MediaInteraction=7]="MediaInteraction",e[e.StyleSheetRule=8]="StyleSheetRule",e[e.CanvasMutation=9]="CanvasMutation",e[e.Font=10]="Font",e[e.Log=11]="Log",e[e.Drag=12]="Drag",e[e.StyleDeclaration=13]="StyleDeclaration",e[e.Selection=14]="Selection",e[e.AdoptedStyleSheet=15]="AdoptedStyleSheet",e[e.CustomElement=16]="CustomElement",e))(ur||{});ur.MouseMove,ur.MouseInteraction,ur.Scroll,ur.ViewportResize,ur.Input,ur.TouchMove,ur.MediaInteraction,ur.Drag;var hr=Uint8Array,cr=Uint16Array,vr=Int32Array,_r=new hr([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),gr=new hr([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),pr=new hr([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),fr=function(e,t){for(var i=new cr(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var n=new vr(i[30]);for(r=1;r<30;++r)for(var a=i[r];a<i[r+1];++a)n[a]=a-i[r]<<5|r;return{b:i,r:n}},mr=fr(_r,2),br=mr.b,yr=mr.r;br[28]=258,yr[258]=28;for(var wr=fr(gr,0).r,Cr=new cr(32768),Sr=0;Sr<32768;++Sr){var kr=(43690&Sr)>>1|(21845&Sr)<<1;kr=(61680&(kr=(52428&kr)>>2|(13107&kr)<<2))>>4|(3855&kr)<<4,Cr[Sr]=((65280&kr)>>8|(255&kr)<<8)>>1}var xr=function(e,t,i){for(var r=e.length,n=0,a=new cr(t);n<r;++n)e[n]&&++a[e[n]-1];var s,o=new cr(t);for(n=1;n<t;++n)o[n]=o[n-1]+a[n-1]<<1;if(i){s=new cr(1<<t);var l=15-t;for(n=0;n<r;++n)if(e[n])for(var d=n<<4|e[n],u=t-e[n],h=o[e[n]-1]++<<u,c=h|(1<<u)-1;h<=c;++h)s[Cr[h]>>l]=d}else for(s=new cr(r),n=0;n<r;++n)e[n]&&(s[n]=Cr[o[e[n]-1]++]>>15-e[n]);return s},Ir=new hr(288);for(Sr=0;Sr<144;++Sr)Ir[Sr]=8;for(Sr=144;Sr<256;++Sr)Ir[Sr]=9;for(Sr=256;Sr<280;++Sr)Ir[Sr]=7;for(Sr=280;Sr<288;++Sr)Ir[Sr]=8;var Er=new hr(32);for(Sr=0;Sr<32;++Sr)Er[Sr]=5;var Mr=xr(Ir,9,0),Lr=xr(Er,5,0),Ar=function(e){return(e+7)/8|0},Pr=function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new hr(e.subarray(t,i))},Tr=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8},Ur=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>8,e[r+2]|=i>>16},Rr=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var n=i.length,a=i.slice();if(!n)return{t:qr,l:0};if(1==n){var s=new hr(i[0].s+1);return s[i[0].s]=1,{t:s,l:1}}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],l=i[1],d=0,u=1,h=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};u!=n-1;)o=i[i[d].f<i[h].f?d++:h++],l=i[d!=u&&i[d].f<i[h].f?d++:h++],i[u++]={s:-1,f:o.f+l.f,l:o,r:l};var c=a[0].s;for(r=1;r<n;++r)a[r].s>c&&(c=a[r].s);var v=new cr(c+1),_=Dr(i[u-1],v,0);if(_>t){r=0;var g=0,p=_-t,f=1<<p;for(a.sort(function(e,t){return v[t.s]-v[e.s]||e.f-t.f});r<n;++r){var m=a[r].s;if(!(v[m]>t))break;g+=f-(1<<_-v[m]),v[m]=t}for(g>>=p;g>0;){var b=a[r].s;v[b]<t?g-=1<<t-v[b]++-1:++r}for(;r>=0&&g;--r){var y=a[r].s;v[y]==t&&(--v[y],++g)}_=t}return{t:new hr(v),l:_}},Dr=function(e,t,i){return-1==e.s?Math.max(Dr(e.l,t,i+1),Dr(e.r,t,i+1)):t[e.s]=i},Or=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new cr(++t),r=0,n=e[0],a=1,s=function(e){i[r++]=e},o=1;o<=t;++o)if(e[o]==n&&o!=t)++a;else{if(!n&&a>2){for(;a>138;a-=138)s(32754);a>2&&(s(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(s(n),--a;a>6;a-=6)s(8304);a>2&&(s(a-3<<5|8208),a=0)}for(;a--;)s(n);a=1,n=e[o]}return{c:i.subarray(0,r),n:t}},$r=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},Br=function(e,t,i){var r=i.length,n=Ar(t+2);e[n]=255&r,e[n+1]=r>>8,e[n+2]=255^e[n],e[n+3]=255^e[n+1];for(var a=0;a<r;++a)e[n+a+4]=i[a];return 8*(n+4+r)},Nr=function(e,t,i,r,n,a,s,o,l,d,u){Tr(t,u++,i),++n[256];for(var h=Rr(n,15),c=h.t,v=h.l,_=Rr(a,15),g=_.t,p=_.l,f=Or(c),m=f.c,b=f.n,y=Or(g),w=y.c,C=y.n,S=new cr(19),k=0;k<m.length;++k)++S[31&m[k]];for(k=0;k<w.length;++k)++S[31&w[k]];for(var x=Rr(S,7),I=x.t,E=x.l,M=19;M>4&&!I[pr[M-1]];--M);var L,A,P,T,U=d+5<<3,R=$r(n,Ir)+$r(a,Er)+s,D=$r(n,c)+$r(a,g)+s+14+3*M+$r(S,I)+2*S[16]+3*S[17]+7*S[18];if(l>=0&&U<=R&&U<=D)return Br(t,u,e.subarray(l,l+d));if(Tr(t,u,1+(D<R)),u+=2,D<R){L=xr(c,v,0),A=c,P=xr(g,p,0),T=g;var O=xr(I,E,0);Tr(t,u,b-257),Tr(t,u+5,C-1),Tr(t,u+10,M-4),u+=14;for(k=0;k<M;++k)Tr(t,u+3*k,I[pr[k]]);u+=3*M;for(var $=[m,w],B=0;B<2;++B){var N=$[B];for(k=0;k<N.length;++k){var H=31&N[k];Tr(t,u,O[H]),u+=I[H],H>15&&(Tr(t,u,N[k]>>5&127),u+=N[k]>>12)}}}else L=Mr,A=Ir,P=Lr,T=Er;for(k=0;k<o;++k){var q=r[k];if(q>255){Ur(t,u,L[(H=q>>18&31)+257]),u+=A[H+257],H>7&&(Tr(t,u,q>>23&31),u+=_r[H]);var F=31&q;Ur(t,u,P[F]),u+=T[F],F>3&&(Ur(t,u,q>>5&8191),u+=gr[F])}else Ur(t,u,L[q]),u+=A[q]}return Ur(t,u,L[256]),u+A[256]},Hr=new vr([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qr=new hr(0),Fr=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),jr=function(e,t,i,r,n){if(!n&&(n={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),s=new hr(a.length+e.length);s.set(a),s.set(e,a.length),e=s,n.w=a.length}return function(e,t,i,r,n,a){var s=a.z||e.length,o=new hr(r+s+5*(1+Math.ceil(s/7e3))+n),l=o.subarray(r,o.length-n),d=a.l,u=7&(a.r||0);if(t){u&&(l[0]=a.r>>3);for(var h=Hr[t-1],c=h>>13,v=8191&h,_=(1<<i)-1,g=a.p||new cr(32768),p=a.h||new cr(_+1),f=Math.ceil(i/3),m=2*f,b=function(t){return(e[t]^e[t+1]<<f^e[t+2]<<m)&_},y=new vr(25e3),w=new cr(288),C=new cr(32),S=0,k=0,x=a.i||0,I=0,E=a.w||0,M=0;x+2<s;++x){var L=b(x),A=32767&x,P=p[L];if(g[A]=P,p[L]=A,E<=x){var T=s-x;if((S>7e3||I>24576)&&(T>423||!d)){u=Nr(e,l,0,y,w,C,k,I,M,x-M,u),I=S=k=0,M=x;for(var U=0;U<286;++U)w[U]=0;for(U=0;U<30;++U)C[U]=0}var R=2,D=0,O=v,$=A-P&32767;if(T>2&&L==b(x-$))for(var B=Math.min(c,T)-1,N=Math.min(32767,x),H=Math.min(258,T);$<=N&&--O&&A!=P;){if(e[x+R]==e[x+R-$]){for(var q=0;q<H&&e[x+q]==e[x+q-$];++q);if(q>R){if(R=q,D=$,q>B)break;var F=Math.min($,q-2),j=0;for(U=0;U<F;++U){var z=x-$+U&32767,W=z-g[z]&32767;W>j&&(j=W,P=z)}}}$+=(A=P)-(P=g[A])&32767}if(D){y[I++]=268435456|yr[R]<<18|wr[D];var V=31&yr[R],K=31&wr[D];k+=_r[V]+gr[K],++w[257+V],++C[K],E=x+R,++S}else y[I++]=e[x],++w[e[x]]}}for(x=Math.max(x,E);x<s;++x)y[I++]=e[x],++w[e[x]];u=Nr(e,l,d,y,w,C,k,I,M,x-M,u),d||(a.r=7&u|l[u/8|0]<<3,u-=7,a.h=p,a.p=g,a.i=x,a.w=E)}else{for(x=a.w||0;x<s+d;x+=65535){var G=x+65535;G>=s&&(l[u/8|0]=d,G=s),u=Br(l,u+1,e.subarray(x,G))}a.i=s}return Pr(o,0,r+Ar(u)+n)}(e,null==t.level?6:t.level,null==t.mem?n.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,r,n)},zr=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Wr(e,t){t||(t={});var i=function(){var e=-1;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Fr[255&i^t[r]]^i>>>8;e=i},d:function(){return~e}}}(),r=e.length;i.p(e);var n,a=jr(e,t,10+((n=t).filename?n.filename.length+1:0),8),s=a.length;return function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=t.level<2?4:9==t.level?2:0,e[9]=3,0!=t.mtime&&zr(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(a,t),zr(a,s-8,i.d()),zr(a,s-4,r),a}var Vr="undefined"!=typeof TextEncoder&&new TextEncoder,Kr="undefined"!=typeof TextDecoder&&new TextDecoder;try{Kr.decode(qr,{stream:!0})}catch(e){}var Gr="vtilt-bubble-pos";function Jr(e){try{localStorage.setItem(Gr,JSON.stringify(e))}catch(e){}}function Qr(e,t,i){var r=e.getBoundingClientRect(),n=r.left-t,a=r.top-i,s=window.innerWidth-e.offsetWidth-n,o=-n,l=window.innerHeight-e.offsetHeight-a,d=-a;return{x:Math.min(Math.max(t,o),s),y:Math.min(Math.max(i,d),l)}}function Xr(e,t,i){e.style.transform="translate3d("+t+"px, "+i+"px, 0)"}function Zr(e,t){var i=e,r=0,n=0,a=0,s=0,o=0,l=0,d=!1,u=!1,h=function(){try{var e=localStorage.getItem(Gr);if(!e)return null;var t=JSON.parse(e);if("number"==typeof t.x&&"number"==typeof t.y)return t}catch(e){}return null}();if(h){r=h.x,n=h.y;var c=e.style.transition;e.style.transition="none",Xr(e,r,n);var v=Qr(e,r,n);r=v.x,n=v.y,Xr(e,r,n),e.offsetHeight,e.style.transition=c}i.style.cursor="grab",i.style.touchAction="none";var _=t=>{0===t.button&&(d=!0,u=!1,a=t.clientX,s=t.clientY,o=r,l=n,i.setPointerCapture(t.pointerId),i.style.cursor="grabbing",e.style.transition="none")},g=t=>{if(d){var i=t.clientX-a,h=t.clientY-s;if(!(!u&&Math.abs(i)<5&&Math.abs(h)<5)){u=!0;var c={x:o+i,y:l+h},v=Qr(e,c.x,c.y);r=v.x,n=v.y,Xr(e,r,n)}}},p=()=>{d&&(d=!1,i.style.cursor="grab",e.style.transition="",u&&Jr({x:r,y:n}))},f=e=>{u&&(e.stopPropagation(),e.preventDefault(),u=!1)},m=()=>{var t=r,i=n,a=Qr(e,r,n);r=a.x,n=a.y,Xr(e,r,n),t===r&&i===n||Jr({x:r,y:n})};return i.addEventListener("pointerdown",_),i.addEventListener("pointermove",g),i.addEventListener("pointerup",p),i.addEventListener("pointercancel",p),i.addEventListener("click",f,!0),window.addEventListener("resize",m),{destroy(){i.removeEventListener("pointerdown",_),i.removeEventListener("pointermove",g),i.removeEventListener("pointerup",p),i.removeEventListener("pointercancel",p),i.removeEventListener("click",f,!0),window.removeEventListener("resize",m)}}}var Yr={bottom:20,right:20,left:20};function en(e,t){return void 0!==e&&Number.isFinite(e)?Math.max(0,e):t}function tn(e){return null===e?i({},Yr):{bottom:en(null==e?void 0:e.bottom,Yr.bottom),right:en(null==e?void 0:e.right,Yr.right),left:en(null==e?void 0:e.left,Yr.left)}}function rn(e,t,i){e.style.bottom=i.bottom+"px","bottom-right"===t?(e.style.right=i.right+"px",e.style.left=""):(e.style.left=i.left+"px",e.style.right="")}var nn="chat";class an extends hi{constructor(e,t){super(e,t||an.extractConfig(e.getConfig())),this.name="Chat",this.scriptName="chat",this._serverConfig=null,this._configFetched=!1,this._loadError=null,this._bubbleDragHandle=null,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[],this._bubbleExplicitShow=!1,this._unreadPollIntervalId=null,this._onVisibilityChange=()=>{if("visible"===document.visibilityState)return this._fetchUnreadForBubble(),void this._startUnreadPoll();this._stopUnreadPoll()}}static extractConfig(e){var t,i=e.chat||{};return{enabled:i.enabled,autoConfig:null===(t=i.autoConfig)||void 0===t||t,position:i.position,greeting:i.greeting,color:i.color,aiMode:i.aiMode,aiGreeting:i.aiGreeting,preload:i.preload,offlineMessage:i.offlineMessage,collectEmailOffline:i.collectEmailOffline,bubble:i.bubble}}get isEnabled(){var e;return!1!==this._config.enabled&&(!0===this._config.enabled||!this._instance.getConfig().disable_chat&&!0===(null===(e=this._serverConfig)||void 0===e?void 0:e.enabled))}startIfEnabled(){se().debug(nn,"startIfEnabled"),this._startAsync().catch(e=>{se().error(nn,"error starting:",e)})}stop(){this.destroy(),this._isStarted=!1}onConfigUpdate(e){var t,i;this._config=an.extractConfig(e),this._isBubbleDraggable()||this._syncBubbleLayout(),this._loaded&&(null===(i=(t=this._loaded).updateConfig)||void 0===i||i.call(t,this.getMergedConfig()))}_createLoaded(){var e,t,i,r=null===(e=W.__VTiltExtensions__)||void 0===e?void 0:e.initChat;if(!r)throw new Error("[vTilt:chat] initChat not available after script load");var n=this.getMergedConfig(),a=r(this._instance,n);this._bubbleExplicitShow&&a.show(),this._messageCallbacks.forEach(e=>a.onMessage(e)),this._typingCallbacks.forEach(e=>a.onTyping(e)),this._connectionCallbacks.forEach(e=>a.onConnectionChange(e)),null===(t=this._bubbleDragHandle)||void 0===t||t.destroy(),this._bubbleDragHandle=null;var s=null===(i=null==B?void 0:B.document)||void 0===i?void 0:i.getElementById("vtilt-chat-bubble");return s&&!s.closest("#vtilt-chat-container")&&s.remove(),a}_onLoaded(e){this._pendingCallbacks.forEach(e=>e()),this._pendingCallbacks=[],e.isOpen||(this._fetchUnreadForBubble(),this._startUnreadPoll()),se().info(nn,"loaded and ready")}_startAsync(){var e=this;return t(function*(){var t,i;try{if(!1===e._config.enabled)return void se().info(nn,"disabled by code config");if(e._instance.getConfig().disable_chat)return void se().info(nn,"disabled by disable_chat config");if(!1!==e._config.autoConfig&&(yield e._fetchServerSettings()),!e.isEnabled)return void se().info(nn,"not enabled (check dashboard settings)");se().debug(nn,"startIfEnabled enabled"),e._isStarted=!0,!0===e._config.preload&&e._schedulePreload();var r=e.getMergedConfig();(null===(t=e._serverConfig)||void 0===t?void 0:t.enabled)&&!1!==(null===(i=r.bubble)||void 0===i?void 0:i.visible)&&e._showBubble(),se().info(nn,"ready (lazy-load on demand)")}finally{e._markApiReady()}})()}get isOpen(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.isOpen)&&void 0!==t&&t}get isConnected(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.isConnected)&&void 0!==t&&t}get isLoading(){var e,t;return this._isLoading||null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.isLoading)&&void 0!==t&&t}get unreadCount(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.unreadCount)&&void 0!==t?t:0}get channel(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.channel)&&void 0!==t?t:null}get channels(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.channels)&&void 0!==t?t:[]}get currentView(){var e,t;return null!==(t=null===(e=this._loaded)||void 0===e?void 0:e.currentView)&&void 0!==t?t:"list"}open(){this._deferCall(()=>{this._stopUnreadPoll(),this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.open()})})}close(){this._deferCall(()=>{this._loaded?(this._loaded.close(),this._fetchUnreadForBubble(),this._startUnreadPoll()):this._lazyLoadAndThen(()=>{var e;null===(e=this._loaded)||void 0===e||e.close(),this._fetchUnreadForBubble(),this._startUnreadPoll()})})}toggle(){this._deferCall(()=>{this._loaded?this._loaded.toggle():this.open()})}show(){this._deferCall(()=>{this._bubbleExplicitShow=!0,this._loaded?this._loaded.show():this._isStarted&&this._showBubble()})}hide(){this._deferCall(()=>{var e;if(this._bubbleExplicitShow=!1,this._loaded)this._loaded.hide();else{var t=null===(e=null==B?void 0:B.document)||void 0===e?void 0:e.getElementById("vtilt-chat-bubble");t&&(t.style.display="none")}})}getChannels(){this._deferCall(()=>{this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.getChannels()})})}selectChannel(e){this._deferCall(()=>{this._lazyLoadAndThen(()=>{var t;return null===(t=this._loaded)||void 0===t?void 0:t.selectChannel(e)})})}createChannel(){this._deferCall(()=>{this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.createChannel()})})}goToChannelList(){this._deferCall(()=>{this._loaded?this._loaded.goToChannelList():this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.goToChannelList()})})}sendMessage(e,t){return this._loaded?this._loaded.sendMessage(e,t):new Promise((i,r)=>{this._deferCall(()=>{this._loaded?this._loaded.sendMessage(e,t).then(i).catch(r):(this._pendingMessages.push({content:e,options:t,resolve:i,reject:r}),this._lazyLoadAndThen(()=>{var e,t=this._pendingMessages;for(var i of(this._pendingMessages=[],t))null===(e=this._loaded)||void 0===e||e.sendMessage(i.content,i.options).then(i.resolve).catch(i.reject)}))})})}markAsRead(){this._deferCall(()=>{this._loaded?this._loaded.markAsRead():this._lazyLoadAndThen(()=>{var e;return null===(e=this._loaded)||void 0===e?void 0:e.markAsRead()})})}registerWidget(e){this._deferCall(()=>{var t,i;this._loaded?null===(i=(t=this._loaded).registerWidget)||void 0===i||i.call(t,e):this._lazyLoadAndThen(()=>{var t,i;null===(i=null===(t=this._loaded)||void 0===t?void 0:t.registerWidget)||void 0===i||i.call(t,e)})})}onMessage(e){return this._messageCallbacks.push(e),this._loaded?this._loaded.onMessage(e):()=>{var t=this._messageCallbacks.indexOf(e);t>-1&&this._messageCallbacks.splice(t,1)}}onTyping(e){return this._typingCallbacks.push(e),this._loaded?this._loaded.onTyping(e):()=>{var t=this._typingCallbacks.indexOf(e);t>-1&&this._typingCallbacks.splice(t,1)}}onConnectionChange(e){return this._connectionCallbacks.push(e),this._loaded?this._loaded.onConnectionChange(e):()=>{var t=this._connectionCallbacks.indexOf(e);t>-1&&this._connectionCallbacks.splice(t,1)}}_isBubbleDraggable(){var e;return!0===(null===(e=this.getMergedConfig().bubble)||void 0===e?void 0:e.draggable)}getMergedConfig(){var e,t,i,r,n,a,s,o,l,d,u,h,c,v,_,g,p,f,m,b,y,w,C,S,k,x=this._serverConfig,I=this._config;return{enabled:null!==(t=null!==(e=I.enabled)&&void 0!==e?e:null==x?void 0:x.enabled)&&void 0!==t&&t,autoConfig:null===(i=I.autoConfig)||void 0===i||i,position:null!==(n=null!==(r=I.position)&&void 0!==r?r:null==x?void 0:x.position)&&void 0!==n?n:"bottom-right",greeting:null!==(a=I.greeting)&&void 0!==a?a:null==x?void 0:x.greeting,color:null!==(o=null!==(s=I.color)&&void 0!==s?s:null==x?void 0:x.color)&&void 0!==o?o:"#6366f1",aiMode:null===(d=null!==(l=I.aiMode)&&void 0!==l?l:null==x?void 0:x.ai_enabled)||void 0===d||d,aiGreeting:null!==(u=I.aiGreeting)&&void 0!==u?u:null==x?void 0:x.ai_greeting,preload:null!==(h=I.preload)&&void 0!==h&&h,theme:null!==(c=I.theme)&&void 0!==c?c:{primaryColor:null!==(_=null!==(v=I.color)&&void 0!==v?v:null==x?void 0:x.color)&&void 0!==_?_:"#6366f1"},offlineMessage:null!==(g=I.offlineMessage)&&void 0!==g?g:null==x?void 0:x.offline_message,collectEmailOffline:null===(f=null!==(p=I.collectEmailOffline)&&void 0!==p?p:null==x?void 0:x.collect_email_offline)||void 0===f||f,bubble:{draggable:null!==(y=null!==(b=null===(m=I.bubble)||void 0===m?void 0:m.draggable)&&void 0!==b?b:null==x?void 0:x.bubble_draggable)&&void 0!==y&&y,visible:null===(S=null!==(C=null===(w=I.bubble)||void 0===w?void 0:w.visible)&&void 0!==C?C:null==x?void 0:x.bubble_visible)||void 0===S||S,offset:null===(k=I.bubble)||void 0===k?void 0:k.offset}}}_syncBubbleLayout(){var e,t,i=this.getMergedConfig(),r=null!==(e=i.position)&&void 0!==e?e:"bottom-right",n=tn(null===(t=i.bubble)||void 0===t?void 0:t.offset),a=document.getElementById("vtilt-chat-bubble");a&&rn(a,r,n)}destroy(){le(()=>{var e,t,i;this._stopUnreadPoll(),document.removeEventListener("visibilitychange",this._onVisibilityChange),null===(e=this._loaded)||void 0===e||e.destroy(),this._loaded=void 0,this._bubbleExplicitShow=!1,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[],this._resetDeferral(),null===(t=this._bubbleDragHandle)||void 0===t||t.destroy(),this._bubbleDragHandle=null;var r=null===(i=null==B?void 0:B.document)||void 0===i?void 0:i.getElementById("vtilt-chat-bubble");r&&r.remove()})}_fetchServerSettings(){var e=this;return t(function*(){if(!e._configFetched){var t=e._instance.getConfig();if(!t.token)return se().warn(nn,"cannot fetch settings: missing token"),void(e._configFetched=!0);try{var i=ue(t,"/api/chat/settings"),r=yield fetch(i,{headers:he(t)});if(!r.ok)return se().warn(nn,"failed to fetch settings: "+r.status),void(e._configFetched=!0);e._serverConfig=yield r.json(),e._configFetched=!0,se().info(nn,"loaded settings from dashboard")}catch(t){se().warn(nn,"error fetching settings:",t),e._configFetched=!0}}})()}_fetchUnreadForBubble(){var e=this;return t(function*(){var t,i,r,n,a,s,o=e._instance.getConfig(),l=o.token,d=null!==(r=null===(i=(t=e._instance).getDistinctId)||void 0===i?void 0:i.call(t))&&void 0!==r?r:"";if(se().debug("chat","fetchUnread","distinctId",d?d.slice(0,12)+"...":"empty"),l&&d)try{var u=ue(o,"/api/chat/widget/unread"),h=u.includes("?")?"&":"?",c=""+u+h+"distinct_id="+encodeURIComponent(d),v=yield fetch(c,{headers:he(o)});if(!v.ok)return;var _=yield v.json(),g=Number(null!==(n=_.unread_count)&&void 0!==n?n:0);null===(s=null===(a=e._loaded)||void 0===a?void 0:a.applyPolledUnreadCount)||void 0===s||s.call(a,g);var p=document.getElementById("vtilt-chat-bubble");if(!p)return;var f=p.querySelector(".vtilt-chat-bubble-badge");if(!f)return;g>0?(f.style.display="flex",f.textContent=g>99?"99+":String(g)):f.style.display="none"}catch(e){}else{var m=l?"missing distinctId":"missing token";se().debug("chat","fetchUnread skip","reason",m)}})()}_showBubble(){var e,t,i,r;if(null==B?void 0:B.document){var n=document.getElementById("vtilt-chat-bubble");if(n)return n.style.display="flex",void this._syncBubbleLayout();var a=this.getMergedConfig(),s=null!==(e=a.position)&&void 0!==e?e:"bottom-right",o=tn(null===(t=a.bubble)||void 0===t?void 0:t.offset),l=a.color||"#6366f1",d=document.createElement("div");d.id="vtilt-chat-bubble",d.setAttribute("style",("\n position: fixed;\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+l+";\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n transition: transform 0.2s, box-shadow 0.2s;\n z-index: 999999;\n ").trim()),rn(d,s,o),d.innerHTML='\n <svg width="28" height="28" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2">\n <path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"></path>\n </svg>\n <div class="vtilt-chat-bubble-badge" style="\n display: none;\n position: absolute;\n top: -4px;\n right: -4px;\n background: #E53935;\n color: white;\n font-size: 11px;\n font-weight: 700;\n min-width: 20px;\n height: 20px;\n border-radius: 10px;\n align-items: center;\n justify-content: center;\n padding: 0 6px;\n box-sizing: border-box;\n border: 2px solid white;\n ">0</div>\n ';var u=!0===(null===(i=a.bubble)||void 0===i?void 0:i.draggable);u||(d.addEventListener("mouseenter",()=>{d.style.transform="scale(1.05)",d.style.boxShadow="0 6px 16px rgba(0, 0, 0, 0.2)"}),d.addEventListener("mouseleave",()=>{d.style.transform="scale(1)",d.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"})),d.addEventListener("click",()=>{this.open()}),document.body.appendChild(d),u&&(null===(r=this._bubbleDragHandle)||void 0===r||r.destroy(),this._bubbleDragHandle=Zr(d)),this._fetchUnreadForBubble(),this._startUnreadPoll(),document.addEventListener("visibilitychange",this._onVisibilityChange)}}_shouldPollUnread(){return"undefined"!=typeof document&&("visible"===document.visibilityState&&(!!document.getElementById("vtilt-chat-bubble")||!(!this._loaded||this._loaded.isOpen)))}_startUnreadPoll(){this._shouldPollUnread()&&null===this._unreadPollIntervalId&&(this._unreadPollIntervalId=setInterval(()=>{this._fetchUnreadForBubble()},3e4))}_stopUnreadPoll(){null!==this._unreadPollIntervalId&&(clearInterval(this._unreadPollIntervalId),this._unreadPollIntervalId=null)}_schedulePreload(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this._ensureLoaded(()=>{}),{timeout:5e3}):setTimeout(()=>this._ensureLoaded(()=>{}),3e3)}_lazyLoadAndThen(e){this._loaded?e():(this._pendingCallbacks.push(e),this._ensureLoaded(e=>this._onLoaded(e)))}}function sn(e,t){e("js",new Date);var{tagIds:r,configParams:n,sendPageView:a,debugMode:s,conversionLinker:o,linkerDomains:l}=t,d=i({},n||{});for(var u of(!1===a&&(d.send_page_view=!1),s&&(d.debug_mode=!0),!1===o&&(d.conversion_linker=!1),l&&l.length>0&&(d.linker={domains:l,decorate_forms:!0}),r))u&&e("config",u,d)}function on(e,t){var i,r=(e.tagIds||[]).filter(e=>!!e);if(0===r.length)return null;var n,a,s,o=null!==(i=e.proxyMode)&&void 0!==i?i:"proxied";if("direct"===o)n=dn,a=dn,s="";else{var l=function(e){var t,i=void 0!==B&&(null===(t=null==B?void 0:B.location)||void 0===t?void 0:t.origin)?B.location.origin:"";if(!e)return i?{base:i,absoluteBase:i}:null;var r=e.replace(/\/+$/g,"");if(!r)return i?{base:i,absoluteBase:i}:null;try{var n=new URL(r),a=n.pathname.replace(/\/$/,""),s=""+n.origin+a;return{base:s,absoluteBase:s}}catch(e){}if(r.startsWith("/"))return{base:r,absoluteBase:i?""+i+r:r};return i?{base:i,absoluteBase:i}:null}(t);if(!l)return null;n=l.base,a=l.absoluteBase,s=ln}var d={};if("direct"!==o){var u=function(e){if(!e)return"";var t=e.startsWith("/")?e:"/"+e;return t.replace(/\/$/,"")}(s);d.transport_url=""+a.replace(/\/$/,"")+u}return{origin:n,gatewayPath:s,primaryTagId:r.find(e=>e.startsWith("G-"))||r[0]||"",tagIds:r,configParams:d,sendPageView:!1!==e.capturePageview,debugMode:!!e.debugMode,conversionLinker:!1!==e.conversionLinker,linkerDomains:e.linkerDomains}}var ln="/gt",dn="https://www.googletagmanager.com";function un(e,t){var r=!0===e.advertising,n={ad_storage:r?"granted":"denied",ad_user_data:r?"granted":"denied",ad_personalization:r?"granted":"denied",analytics_storage:!0===e.analytics?"granted":"denied"};if(!t)return n;var a=i({},n);return Object.keys(n).forEach(i=>{var r=t[i];void 0!==r&&(a[i]=function(e,t){return"granted"===t?"granted":"denied"===t?"denied":"follow_advertising"===t?!0===e.advertising?"granted":"denied":"follow_analytics"===t&&!0===e.analytics?"granted":"denied"}(e,r))}),a}function hn(e){if(null==e)return null;var t=String(e).trim().toLowerCase();return t||null}function cn(e,t){if(e&&t){var i=t.split("."),r=e;for(var n of i){if(null==r||"object"!=typeof r)return;r=r[n]}return r}}function vn(e){if("number"==typeof e&&Number.isFinite(e))return e;if("string"==typeof e&&""!==e.trim()){var t=Number(e);if(Number.isFinite(t))return t}}function _n(e){if(null!=e)return"string"==typeof e?e:"number"==typeof e||"boolean"==typeof e?String(e):void 0}function gn(e){var{mapping:t,payload:i}=e,r={send_to:t.send_to},n=t.value_param_path||"value",a=t.currency_param_path||"currency",s=vn(cn(i,n));void 0!==s&&(r.value=s);var o=_n(cn(i,a))||t.default_currency||void 0;if(o&&(r.currency=o),!1!==t.send_transaction_id){var l=_n(cn(i,t.transaction_id_param_path||"transaction_id"));l&&(r.transaction_id=l)}return{send_to:t.send_to,params:r}}var pn=[{source:"$pageview",destination:"page_view",buildParams:e=>{var t,i={},r=_n(e.$current_url);r&&(i.page_location=r);var n=_n(e.$pathname);n&&(i.page_path=n);var a=null!==(t=_n(e.title))&&void 0!==t?t:_n(e.$title);a&&(i.page_title=a);var s=_n(e.$referrer);return s&&(i.page_referrer=s),i}},{source:"$pageleave",destination:"user_engagement",buildParams:e=>{var t,i,r={},n=vn(null!==(i=null!==(t=e.$dwell_time_ms)&&void 0!==t?t:e.engagement_time_msec)&&void 0!==i?i:e.$time_on_page_ms);return void 0!==n&&(r.engagement_time_msec=Math.round(n)),r}}];function fn(e,t,i){var r=t.split(".").filter(Boolean);if(0!==r.length)if(1!==r.length){for(var n=e,a=0;a<r.length-1;a++){var s=r[a],o=r[a+1];if(null==n||"object"!=typeof n||Array.isArray(n))return;var l=n;if(/^\d+$/.test(o)){var d=Array.isArray(l[s])?l[s]:[];Array.isArray(l[s])||(l[s]=d);for(var u=parseInt(o,10);d.length<=u;)d.push({});if(a+1===r.length-1)return void(d[u]=i);var h=d[u];h&&"object"==typeof h&&!Array.isArray(h)||(h={},d[u]=h),n=h,a++}else{var c=l[s];c&&"object"==typeof c&&!Array.isArray(c)||(c={},l[s]=c),n=c}}var v=r[r.length-1];n&&"object"==typeof n&&!Array.isArray(n)&&(n[v]=i)}else e[r[0]]=i}var mn=new Set(["client_id","user_id","first_visit","session_start"]);function bn(e,t,i,r){if(!function(e,t){return!(t&&(Array.isArray(t.exclude)&&t.exclude.includes(e)||Array.isArray(t.include)&&t.include.length>0&&!t.include.includes(e)))}(t,r.eventFilter))return{fired:!1};var n=(r.eventMappings||[]).find(e=>(null==e?void 0:e.source)===t);if(n&&n.destination){var{name:a,params:s}=function(e,t){var i={},r=Array.isArray(e.param_mappings)?e.param_mappings:[];for(var n of r){var a=null==n?void 0:n.source,s=null==n?void 0:n.destination;if(a&&s){var o=cn(t,a);void 0!==o&&(s.includes(".")?fn(i,s,o):i[s]=o)}}return{name:e.destination,params:i}}(n,i);return e("event",a,s),{fired:!0,eventName:a,params:s,source:"mapping"}}if(!1===r.autoForward)return{fired:!1};var o=pn.find(e=>e.source===t);if(o){var l=o.buildParams(i);return e("event",o.destination,l),{fired:!0,eventName:o.destination,params:l,source:"preset"}}if(t.startsWith("$"))return{fired:!1};var d=function(e){var t={};for(var[i,r]of Object.entries(e))i.startsWith("$")||mn.has(i)||void 0!==r&&(t[i]=r);return t}(i);return e("event",t,d),{fired:!0,eventName:t,params:d,source:"auto"}}function yn(){var e=null,t=[],i=[];return{call:function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];if((e=>{i.push(e),i.length>50&&i.shift()})(n),e)try{e(...n)}catch(e){}else t.push(n)},flush(i){for(e=i;t.length;){var r=t.shift();try{i(...r)}catch(e){}}},getRecentCalls:()=>i.slice()}}function wn(e){return Cn.apply(this,arguments)}function Cn(){return(Cn=t(function*(e){try{var t="undefined"!=typeof crypto&&crypto.subtle?crypto.subtle:null;if(!t)return null;var i=(new TextEncoder).encode(e),r=yield t.digest("SHA-256",i);return Array.from(new Uint8Array(r)).map(e=>e.toString(16).padStart(2,"0")).join("")}catch(e){return null}})).apply(this,arguments)}function Sn(){return(Sn=t(function*(e){var t={},i=function(e){if(!e)return null;var t=String(e).trim().toLowerCase();if(!t)return null;if(!t.includes("@"))return null;var[i,r]=t.split("@");if(!i||!r)return null;if("gmail.com"===r||"googlemail.com"===r){var n=i.split("+")[0].replace(/\./g,"");return n?n+"@"+r:null}return i+"@"+r}(e.email),r=function(e){if(!e)return null;var t=String(e).trim();if(!t)return null;if(t.startsWith("+")){var i=t.slice(1).replace(/\D/g,"");return i?"+"+i:null}return null}(e.phone),n=hn(e.first_name),a=hn(e.last_name),s=hn(e.street),o=hn(e.city),l=hn(e.region),d=function(e){if(!e)return null;var t=String(e).trim().toUpperCase().replace(/\s+/g,"");return t||null}(e.postal_code),u=hn(e.country);if(i){var h=yield wn(i);h&&(t.sha256_email_address=h)}if(r){var c=yield wn(r);c&&(t.sha256_phone_number=c)}var v={};if(n){var _=yield wn(n);_&&(v.sha256_first_name=_)}if(a){var g=yield wn(a);g&&(v.sha256_last_name=g)}if(s){var p=yield wn(s);p&&(v.sha256_street=p)}return o&&(v.city=o),l&&(v.region=l),d&&(v.postal_code=d),u&&(v.country=u),Object.keys(v).length>0&&(t.address=v),0===Object.keys(t).length?null:t})).apply(this,arguments)}class kn{constructor(e){void 0===e&&(e=Number.POSITIVE_INFINITY),this._maxItems=e,this._items=[]}get length(){return this._items.length}enqueue(e){return!(this._items.length>=this._maxItems)&&(this._items.push(e),!0)}takeAll(){if(0===this._items.length)return[];var e=this._items;return this._items=[],e}clear(){this._items=[]}}var xn="google-tag";class In{constructor(e,t){this.name="GoogleTagGateway",this._isStarted=!1,this._scriptInjected=!1,this._scriptLoaded=!1,this._consentDefaultsPushed=!1,this._gtag=null,this._loaderOptions=null,this._unsubscribeCaptured=null,this._unsubscribeConsent=null,this._deliveryLog=[],this._maxDeliveryLog=100,this._pendingCaptures=new kn(100),this._instance=e,this._config=t||In.extractConfig(e.getConfig()),this._publicApi=yn(),this._subscribeCaptured()}static extractConfig(e){if(e.disable_google_tag)return{enabled:!1};var t=e.google_tag;return t?{enabled:(t.tagIds||[]).some(e=>!!e),remote:t}:{enabled:!1}}get isEnabled(){return!1!==this._config.enabled&&!!this._config.remote}get isStarted(){return this._isStarted}get gtag(){return this._publicApi.call}get deliveryLog(){return this._deliveryLog.slice()}startIfEnabled(){this._isStarted||this.isEnabled&&this._instance.getConfig().__remote_config_loaded&&this._start()}stop(){var e;this._isStarted&&(null===(e=this._unsubscribeConsent)||void 0===e||e.call(this),this._unsubscribeConsent=null,this._isStarted=!1)}onConfigUpdate(e){var t=In.extractConfig(e),i=this.isEnabled;this._config=t;var r=!0===e.__remote_config_loaded;if(i&&!this.isEnabled)this.stop();else if(this._isStarted&&t.remote&&this._loaderOptions){var n=on(t.remote,this._instance.getConfig().api_host);n&&(this._loaderOptions=n,sn(this._gtag,n))}r&&!this.isEnabled&&this._pendingCaptures.clear(),r&&this.isEnabled&&!this._isStarted&&this.startIfEnabled()}setUserData(e){var i=this;return t(function*(){var t=i._config.remote;if(t&&t.enhancedConversions){var r=yield function(e){return Sn.apply(this,arguments)}(e);r&&i._publicApi.call("set","user_data",r)}})()}getRecentPublicCalls(){return this._publicApi.getRecentCalls()}_start(){var e=this._config.remote;if(e){var t=on(e,this._instance.getConfig().api_host);if(t){this._loaderOptions=t;var{gtag:i}=function(){var e,t,i=W,r=null!==(e=(t=i).dataLayer)&&void 0!==e?e:t.dataLayer=[],n=i.gtag;if(n)return{gtag:n,dataLayer:r};var a=function(){r.push(arguments)};return i.gtag=a,{gtag:a,dataLayer:r}}();this._gtag=i,this._publicApi.flush(i),this._pushConsentDefaultsOnce(),sn(i,t),this._scriptInjected||(this._scriptInjected=!0,function(e,t,i){var r=null==B?void 0:B.document;if(!r)return null;var{origin:n,gatewayPath:a,primaryTagId:s}=e;if(!n||!s)return null;var o=""+n.replace(/\/$/,"")+(a?a.startsWith("/")?a.replace(/\/$/,""):"/"+a.replace(/\/$/,""):"")+"/gtag/js?id="+encodeURIComponent(s)+"&l=dataLayer",l=r.querySelector('script[data-vtilt-gtag-loader="'+s+'"]');if(l)return l;var d=r.createElement("script");d.async=!0,d.src=o,d.setAttribute("data-vtilt-gtag-loader",s),d.onload=()=>null==t?void 0:t(),d.onerror=()=>{var e=new Error("[GoogleTagGateway] failed to load "+o);null==i||i(e)},(r.head||r.body||r.documentElement).appendChild(d)}(t,()=>{this._scriptLoaded=!0},e=>{se().warn(xn,e.message)})),this._subscribeConsent(),this._isStarted=!0,this._drainPending()}else se().warn(xn,"skipped — missing tag_ids or resolvable origin")}}_drainPending(){for(var e of this._pendingCaptures.takeAll())this._handleCaptured(e.event,e.payload)}_pushConsentDefaultsOnce(){var e;if(!this._consentDefaultsPushed&&this._gtag){var t=le(()=>this._instance.consentManager.getConsent());!function(e,t,r){e("consent","default",i({},un(t,r),{wait_for_update:500}))}(this._gtag,t||{},null===(e=this._config.remote)||void 0===e?void 0:e.consentOverride),this._consentDefaultsPushed=!0}}_subscribeCaptured(){if(!this._unsubscribeCaptured){this._unsubscribeCaptured=this._instance._emitter.on(fe,e=>{var t=e;t&&"string"==typeof t.event&&this._handleCaptured(t.event,t.payload||{})})}}_handleCaptured(e,t){var i=this._instance.getConfig();if(!i.disable_google_tag)if(i.__remote_config_loaded){if(this.isEnabled&&(this._isStarted||this.startIfEnabled(),this._gtag&&this._config.remote&&this._isStarted)){var r=this._config.remote,n=r.tagIds||[],a=bn(this._gtag,e,t,r);if(a.fired&&a.eventName&&this._record({ts:Date.now(),tag_ids:n,event_name:e,send_to:"ga4:"+a.eventName,status:"fired",reason:a.source}),!1!==r.sendAdsConversions){var s=function(e,t,i,r){var n=(r.conversions||[]).filter(e=>e.event_name===t);if(0===n.length)return[];var a=[];for(var s of n){var o=gn({mapping:s,payload:i});e("event","conversion",o.params),a.push(o)}return a}(this._gtag,e,t,r);for(var o of s)this._record({ts:Date.now(),tag_ids:n,event_name:e,send_to:o.send_to,status:"fired"})}}}else this._pendingCaptures.enqueue({event:e,payload:t})}_subscribeConsent(){if(!this._unsubscribeConsent){this._unsubscribeConsent=this._instance._emitter.on(pe,e=>{var t;if(this._gtag){var i,r,n,a=e;i=this._gtag,r=a.consent||{},n=null===(t=this._config.remote)||void 0===t?void 0:t.consentOverride,i("consent","update",un(r,n))}})}}_record(e){this._deliveryLog.push(e),this._deliveryLog.length>this._maxDeliveryLog&&this._deliveryLog.shift()}}var En="vtd-overlay";class Mn{constructor(e,t){this.name="VtdOverlay",this._isStarted=!1,this._destinationUrl=null,this._originalUrl=null,this._isLoading=!0,this._container=null,this._iframe=null,this._loadingEl=null,this._instance=e,this._config=t||Mn.extractConfig(e.getConfig())}static extractConfig(e){return{enabled:!1!==e.vtd_overlay}}get isEnabled(){return!1!==this._config.enabled}get isStarted(){return this._isStarted}startIfEnabled(){}stop(){this._isStarted&&le(()=>{this._destroyOverlay(),this._isStarted=!1})}onConfigUpdate(e){this._config=Mn.extractConfig(e),!this.isEnabled&&this._isStarted&&this.stop()}setDestinationUrl(e){var t;if(this.isEnabled)if(null==e?void 0:e.trim()){var i=e;try{i=decodeURIComponent(e)}catch(t){i=e}if(this._isValidUrl(i)){var r=this._toEmbedUrl(i);this._originalUrl=i,this._destinationUrl=r,this._isLoading=!0,this._showOverlay(),this._isStarted=!0,this._instance.capture("$vtd_view",{$vtd_url:i,$vtd_embed_url:r!==i?r:void 0,$current_url:null===(t=null==B?void 0:B.location)||void 0===t?void 0:t.href})}else se().warn(En,"invalid URL: "+i)}else se().warn(En,"empty URL provided");else se().warn(En,"feature is disabled")}getDestinationUrl(){return this._destinationUrl}close(){this._instance.capture("$vtd_close",{$vtd_url:this._originalUrl}),this._container?(this._container.classList.add("vtilt-vtd-closing"),setTimeout(()=>{this._destroyOverlay(),this._isStarted=!1,this._destinationUrl=null,this._originalUrl=null},200)):(this._destroyOverlay(),this._isStarted=!1,this._destinationUrl=null,this._originalUrl=null)}_isValidUrl(e){try{var t=new URL(e);return"http:"===t.protocol||"https:"===t.protocol}catch(e){return!1}}_toEmbedUrl(e){try{var t=new URL(e),i=t.hostname.toLowerCase();if("youtube.com"===i||"www.youtube.com"===i||"m.youtube.com"===i){var r=t.searchParams.get("v");if(r){var n=t.searchParams.get("t"),a="https://www.youtube.com/embed/"+r+"?autoplay=1";return n&&(a+="&start="+n.replace("s","")),a}}if("youtu.be"===i){var s=t.pathname.slice(1);if(s){var o=t.searchParams.get("t"),l="https://www.youtube.com/embed/"+s+"?autoplay=1";return o&&(l+="&start="+o.replace("s","")),l}}if("vimeo.com"===i||"www.vimeo.com"===i){var d=t.pathname.match(/^\/(\d+)/);if(d)return"https://player.vimeo.com/video/"+d[1]+"?autoplay=1"}if("loom.com"===i||"www.loom.com"===i){var u=t.pathname.match(/^\/share\/([a-zA-Z0-9]+)/);if(u)return"https://www.loom.com/embed/"+u[1]+"?autoplay=1"}if(i.endsWith("wistia.com")){var h=t.pathname.match(/^\/medias\/([a-zA-Z0-9]+)/);if(h)return"https://fast.wistia.net/embed/iframe/"+h[1]+"?autoplay=1"}if("dailymotion.com"===i||"www.dailymotion.com"===i){var c=t.pathname.match(/^\/video\/([a-zA-Z0-9]+)/);if(c)return"https://www.dailymotion.com/embed/video/"+c[1]+"?autoplay=1"}if("open.spotify.com"===i){var v=t.pathname.match(/^\/(track|album|playlist|episode|show)\/([a-zA-Z0-9]+)/);if(v)return"https://open.spotify.com/embed/"+v[1]+"/"+v[2]}return"drive.google.com"===i&&t.pathname.includes("/view")?e.replace("/view","/preview"):e}catch(t){return e}}_getHostname(e){try{return new URL(e).hostname}catch(t){return e}}_getFaviconUrl(e){try{return"https://www.google.com/s2/favicons?domain="+new URL(e).hostname+"&sz=32"}catch(e){return""}}_showOverlay(){if(q&&this._destinationUrl){this._destroyOverlay(),this._container=q.createElement("div"),this._container.id="vtilt-vtd-overlay",this._container.className="vtilt-vtd-opening",this._container.setAttribute("style",this._getBackdropStyles());var e=q.createElement("div");e.className="vtilt-vtd-modal",e.setAttribute("style",this._getModalStyles());var t=q.createElement("div");t.className="vtilt-vtd-header",t.setAttribute("style",this._getHeaderStyles()),t.innerHTML=this._getHeaderHTML(),e.appendChild(t);var i=q.createElement("div");i.className="vtilt-vtd-iframe-wrapper",i.setAttribute("style",this._getIframeWrapperStyles()),this._loadingEl=q.createElement("div"),this._loadingEl.className="vtilt-vtd-loading",this._loadingEl.setAttribute("style",this._getLoadingStyles()),this._loadingEl.innerHTML=this._getLoadingHTML(),i.appendChild(this._loadingEl),this._iframe=q.createElement("iframe"),this._iframe.id="vtilt-vtd-iframe",this._iframe.className="vtilt-vtd-iframe",this._iframe.setAttribute("style",this._getIframeStyles()),this._iframe.setAttribute("frameborder","0"),this._iframe.setAttribute("allowfullscreen","true"),this._iframe.setAttribute("allow","accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share");var r=()=>{this._isLoading=!1,this._loadingEl&&(this._loadingEl.style.opacity="0",setTimeout(()=>{var e;(null===(e=this._loadingEl)||void 0===e?void 0:e.parentNode)&&(this._loadingEl.style.display="none")},300)),this._iframe&&(this._iframe.style.opacity="1")};this._iframe.onload=r,this._iframe.onerror=r,setTimeout(()=>{this._isLoading&&r()},5e3),i.appendChild(this._iframe),this._iframe.src=this._destinationUrl,e.appendChild(i),this._container.appendChild(e);var n=q.createElement("style");n.id="vtilt-vtd-styles",n.textContent=this._getGlobalStyles(),q.head.appendChild(n),q.body.appendChild(this._container),this._attachEventListeners(),q.body.style.overflow="hidden"}}_destroyOverlay(){var e;(null===(e=this._container)||void 0===e?void 0:e.parentNode)&&(this._container.parentNode.removeChild(this._container),this._container=null,this._iframe=null,this._loadingEl=null);var t=null==q?void 0:q.getElementById("vtilt-vtd-styles");(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t),(null==q?void 0:q.body)&&(q.body.style.overflow="")}_attachEventListeners(){var e,t,i,r=null===(e=this._container)||void 0===e?void 0:e.querySelector(".vtilt-vtd-close");null==r||r.addEventListener("click",()=>this.close());var n=null===(t=this._container)||void 0===t?void 0:t.querySelector(".vtilt-vtd-open");null==n||n.addEventListener("click",()=>{this._originalUrl&&(null==B||B.open(this._originalUrl,"_blank"))}),null===(i=this._container)||void 0===i||i.addEventListener("click",e=>{e.target===this._container&&this.close()});var a=e=>{"Escape"===e.key&&(this.close(),null==q||q.removeEventListener("keydown",a))};null==q||q.addEventListener("keydown",a)}_getBackdropStyles(){return'\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 2147483647;\n background: rgba(0, 0, 0, 0.85);\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n '}_getModalStyles(){return"\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n background: #0a0a0a;\n overflow: hidden;\n "}_getHeaderStyles(){return"\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0 16px;\n height: 56px;\n background: linear-gradient(180deg, rgba(20, 20, 20, 1) 0%, rgba(15, 15, 15, 1) 100%);\n border-bottom: 1px solid rgba(255, 255, 255, 0.08);\n flex-shrink: 0;\n gap: 16px;\n "}_getHeaderHTML(){var e=this._originalUrl||this._destinationUrl,t=e?this._getHostname(e):"";return'\n <div style="display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0;">\n <img \n src="'+(e?this._getFaviconUrl(e):"")+'" \n alt="" \n style="width: 20px; height: 20px; border-radius: 4px; flex-shrink: 0;"\n onerror="this.style.display=\'none\'"\n />\n <div style="\n display: flex;\n flex-direction: column;\n min-width: 0;\n gap: 2px;\n ">\n <div style="\n color: rgba(255, 255, 255, 0.95);\n font-size: 14px;\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.2;\n ">'+this._escapeHtml(t)+'</div>\n <div style="\n color: rgba(255, 255, 255, 0.45);\n font-size: 12px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n line-height: 1.2;\n ">'+this._escapeHtml(this._truncateUrl(e||"",50))+'</div>\n </div>\n </div>\n <div style="display: flex; align-items: center; gap: 8px; flex-shrink: 0;">\n <button class="vtilt-vtd-open vtilt-vtd-btn" title="Open in new tab">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>\n <polyline points="15 3 21 3 21 9"></polyline>\n <line x1="10" y1="14" x2="21" y2="3"></line>\n </svg>\n <span class="vtilt-vtd-btn-text">Open</span>\n </button>\n <button class="vtilt-vtd-close vtilt-vtd-btn vtilt-vtd-btn-primary" title="Close (Esc)">\n <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">\n <line x1="18" y1="6" x2="6" y2="18"></line>\n <line x1="6" y1="6" x2="18" y2="18"></line>\n </svg>\n <span class="vtilt-vtd-btn-text">Close</span>\n </button>\n </div>\n '}_getIframeWrapperStyles(){return"\n flex: 1;\n position: relative;\n background: #000;\n overflow: hidden;\n "}_getLoadingStyles(){return"\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n background: #0a0a0a;\n z-index: 1;\n transition: opacity 0.3s ease;\n "}_getLoadingHTML(){var e=this._originalUrl||this._destinationUrl,t=e?this._getHostname(e):"";return'\n <div class="vtilt-vtd-spinner"></div>\n <div style="\n margin-top: 20px;\n color: rgba(255, 255, 255, 0.7);\n font-size: 14px;\n font-weight: 500;\n ">Loading '+this._escapeHtml(t)+'...</div>\n <div style="\n margin-top: 8px;\n color: rgba(255, 255, 255, 0.35);\n font-size: 12px;\n ">Press <kbd style="\n display: inline-block;\n padding: 2px 6px;\n background: rgba(255, 255, 255, 0.1);\n border-radius: 4px;\n font-family: inherit;\n font-size: 11px;\n ">Esc</kbd> to close</div>\n '}_getIframeStyles(){return"\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n border: none;\n background: white;\n opacity: 0;\n transition: opacity 0.3s ease;\n "}_getGlobalStyles(){return"\n /* Animations */\n @keyframes vtilt-vtd-fade-in {\n from { opacity: 0; }\n to { opacity: 1; }\n }\n \n @keyframes vtilt-vtd-fade-out {\n from { opacity: 1; }\n to { opacity: 0; }\n }\n \n @keyframes vtilt-vtd-scale-in {\n from { opacity: 0; transform: scale(0.96); }\n to { opacity: 1; transform: scale(1); }\n }\n \n @keyframes vtilt-vtd-spin {\n to { transform: rotate(360deg); }\n }\n \n /* Container animations */\n #vtilt-vtd-overlay.vtilt-vtd-opening {\n animation: vtilt-vtd-fade-in 0.2s ease-out forwards;\n }\n \n #vtilt-vtd-overlay.vtilt-vtd-opening .vtilt-vtd-modal {\n animation: vtilt-vtd-scale-in 0.25s ease-out forwards;\n }\n \n #vtilt-vtd-overlay.vtilt-vtd-closing {\n animation: vtilt-vtd-fade-out 0.2s ease-in forwards;\n }\n \n /* Loading spinner */\n .vtilt-vtd-spinner {\n width: 40px;\n height: 40px;\n border: 3px solid rgba(255, 255, 255, 0.1);\n border-top-color: rgba(255, 255, 255, 0.8);\n border-radius: 50%;\n animation: vtilt-vtd-spin 0.8s linear infinite;\n }\n \n /* Button base styles */\n .vtilt-vtd-btn {\n background: rgba(255, 255, 255, 0.08);\n border: 1px solid rgba(255, 255, 255, 0.1);\n color: rgba(255, 255, 255, 0.9);\n padding: 8px 14px;\n border-radius: 8px;\n cursor: pointer;\n font-size: 13px;\n font-weight: 500;\n display: flex;\n align-items: center;\n gap: 6px;\n transition: all 0.15s ease;\n -webkit-tap-highlight-color: transparent;\n outline: none;\n }\n \n .vtilt-vtd-btn:hover {\n background: rgba(255, 255, 255, 0.14);\n border-color: rgba(255, 255, 255, 0.18);\n }\n \n .vtilt-vtd-btn:active {\n background: rgba(255, 255, 255, 0.18);\n transform: scale(0.98);\n }\n \n .vtilt-vtd-btn:focus-visible {\n box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);\n }\n \n /* Primary button variant */\n .vtilt-vtd-btn-primary {\n background: rgba(255, 255, 255, 0.95);\n border-color: transparent;\n color: #0a0a0a;\n }\n \n .vtilt-vtd-btn-primary:hover {\n background: rgba(255, 255, 255, 1);\n border-color: transparent;\n }\n \n .vtilt-vtd-btn-primary:active {\n background: rgba(255, 255, 255, 0.85);\n }\n \n /* Desktop responsive - modal with margin */\n @media (min-width: 768px) {\n #vtilt-vtd-overlay {\n padding: 32px;\n }\n \n .vtilt-vtd-modal {\n max-width: 1200px;\n max-height: 90vh;\n width: 100%;\n height: auto;\n min-height: 500px;\n border-radius: 16px;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);\n }\n \n .vtilt-vtd-header {\n border-radius: 16px 16px 0 0;\n }\n \n .vtilt-vtd-iframe-wrapper {\n border-radius: 0 0 16px 16px;\n min-height: 400px;\n }\n }\n \n /* Large desktop - bigger modal */\n @media (min-width: 1400px) {\n #vtilt-vtd-overlay {\n padding: 48px;\n }\n \n .vtilt-vtd-modal {\n max-width: 1400px;\n max-height: 85vh;\n }\n }\n \n /* Tablet */\n @media (min-width: 768px) and (max-width: 1024px) {\n #vtilt-vtd-overlay {\n padding: 24px;\n }\n \n .vtilt-vtd-modal {\n max-width: 95%;\n max-height: 90vh;\n }\n }\n \n /* Mobile - fullscreen */\n @media (max-width: 767px) {\n #vtilt-vtd-overlay {\n padding: 0 !important;\n background: #0a0a0a !important;\n }\n \n .vtilt-vtd-modal {\n width: 100% !important;\n height: 100% !important;\n max-width: none !important;\n max-height: none !important;\n border-radius: 0 !important;\n }\n \n .vtilt-vtd-header {\n border-radius: 0 !important;\n padding: 0 12px !important;\n height: 52px !important;\n }\n \n .vtilt-vtd-btn {\n padding: 8px 10px !important;\n }\n \n .vtilt-vtd-btn-text {\n display: none !important;\n }\n \n .vtilt-vtd-iframe-wrapper {\n border-radius: 0 !important;\n }\n }\n \n /* Reduced motion */\n @media (prefers-reduced-motion: reduce) {\n #vtilt-vtd-overlay,\n #vtilt-vtd-overlay *,\n .vtilt-vtd-spinner {\n animation-duration: 0.01ms !important;\n transition-duration: 0.01ms !important;\n }\n }\n "}_truncateUrl(e,t){return e.length<=t?e:e.substring(0,t-3)+"..."}_escapeHtml(e){if(void 0===q)return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");var t=q.createElement("div");return t.textContent=e,t.innerHTML}}var Ln,An="text/plain",Pn=61440;!function(e){e.GZipJS="gzip-js",e.Base64="base64",e.None="none"}(Ln||(Ln={}));var Tn=function(e,t){void 0===t&&(t="binary");var{data:i,compression:r}=e;if(i){var n=(e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t))(i),a=new Blob([n]).size;if(r===Ln.GZipJS&&a>=1024)try{var s=Wr(function(e,t){if(Vr)return Vr.encode(e);for(var i=e.length,r=new hr(e.length+(e.length>>1)),n=0,a=function(e){r[n++]=e},s=0;s<i;++s){if(n+5>r.length){var o=new hr(n+8+(i-s<<1));o.set(r),r=o}var l=e.charCodeAt(s);l<128||t?a(l):l<2048?(a(192|l>>6),a(128|63&l)):l>55295&&l<57344?(a(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++s))>>18),a(128|l>>12&63),a(128|l>>6&63),a(128|63&l)):(a(224|l>>12),a(128|l>>6&63),a(128|63&l))}return Pr(r,0,n)}(n),{mtime:0});if("text-base64"===t){var o=function(e){if("undefined"==typeof btoa)throw new Error("btoa is not available in this environment");for(var t="",i=0;i<e.length;i+=32768){var r=Math.min(i+32768,e.length),n=e.subarray(i,r);t+=String.fromCharCode.apply(null,n)}return btoa(t)}(s);if(o.length>0&&o.length<.95*a)return{contentType:An,body:o,estimatedSize:o.length,compressionApplied:Ln.Base64}}else{var l=new Blob([s],{type:An});if(l.size>0&&l.size<.95*a)return{contentType:An,body:l,estimatedSize:l.size,compressionApplied:Ln.GZipJS}}}catch(e){}return{contentType:"application/json",body:n,estimatedSize:a,compressionApplied:null}}};function Un(e,t){return t.compressionApplied?(i=e.url,r=t.compressionApplied,n=i.includes("?")?"&":"?",""+i+n+"compression="+r):e.url;var i,r,n}function Rn(e,t){var i={};return t&&(i["Content-Type"]=t),e.headers&&Object.assign(i,e.headers),e.projectToken&&(i[de]=e.projectToken),i}var Dn=[{name:"fetch",isAvailable:()=>"undefined"!=typeof fetch,method:e=>{var i=Tn(e,"binary");if(i){var{contentType:r,body:n,estimatedSize:a}=i,s=Un(e,i),o=Rn(e,r),l=new AbortController,d=e.timeout?setTimeout(()=>l.abort(),e.timeout):null;fetch(s,{method:e.method||"POST",headers:o,body:n,keepalive:a<Pn,signal:l.signal}).then(function(){var i=t(function*(t){var i,r=yield t.text(),n={statusCode:t.status,text:r};if(200===t.status){ke();try{n.json=JSON.parse(r)}catch(e){}}null===(i=e.callback)||void 0===i||i.call(e,n)});return function(e){return i.apply(this,arguments)}}()).catch(()=>{var t;Se("capture"),null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})}).finally(()=>{d&&clearTimeout(d)})}}},{name:"XHR",isAvailable:()=>"undefined"!=typeof XMLHttpRequest,method:e=>{var t=Tn(e,"binary");if(t){var{contentType:i,body:r}=t,n=Un(e,t),a=Rn(e,i),s=new XMLHttpRequest;for(var[o,l]of(s.open(e.method||"POST",n,!0),Object.entries(a)))s.setRequestHeader(o,l);e.timeout&&(s.timeout=e.timeout),s.onreadystatechange=()=>{var t;if(4===s.readyState){var i={statusCode:s.status,text:s.responseText};if(200===s.status){ke();try{i.json=JSON.parse(s.responseText)}catch(e){}}null===(t=e.callback)||void 0===t||t.call(e,i)}},s.onerror=()=>{var t;Se("capture"),null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})},s.send(r)}}},{name:"sendBeacon",isAvailable:()=>"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:e=>{var t=Tn(e,"text-base64");if(t){var{contentType:r,body:n,estimatedSize:a}=t;if(0!==a){var s=Un(e,t),o=e.projectToken?function(e,t){if(!t||/[?&]token=/.test(e))return e;var i=e.includes("?")?"&":"?";return""+e+i+"token="+t}(s,e.projectToken):s;if(a<=Pn)try{var l="string"==typeof n?new Blob([n],{type:r}):n;if("undefined"!=typeof navigator&&navigator.sendBeacon)if(navigator.sendBeacon(o,l))return}catch(e){}try{var d="string"==typeof n?new Blob([n],{type:r}):n,u=i({"Content-Type":r},e.headers||{});fetch(o,{method:e.method||"POST",headers:u,body:d,keepalive:a<Pn}).catch(()=>{})}catch(e){}}}}}],On=e=>{var t,i;if(xe())null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0});else{var r=e.transport||"fetch",n=Dn.find(e=>e.name===r&&e.isAvailable())||Dn.find(e=>e.isAvailable());if(!n)return se().error("request","no available transport method"),void(null===(i=e.callback)||void 0===i||i.call(e,{statusCode:0}));n.method(e)}};class $n{constructor(e,t){var i,r,n,a;this._isPaused=!0,this._queue=[],this._flushTimeoutMs=(i=(null==t?void 0:t.flush_interval_ms)||3e3,r=250,n=5e3,a=3e3,"number"!=typeof i||isNaN(i)?a:Math.min(Math.max(i,r),n)),this._sendRequest=e}get length(){return this._queue.length}enqueue(e){this._queue.push(e),this._flushTimeout||this._setFlushTimeout()}unload(){if(this._clearFlushTimeout(),0!==this._queue.length){var e=this._formatQueue();for(var t in e){var r=e[t];this._sendRequest(i({},r,{transport:"sendBeacon"}))}}}enable(){this._isPaused=!1,this._setFlushTimeout()}pause(){this._isPaused=!0,this._clearFlushTimeout()}flush(){this._clearFlushTimeout(),this._flushNow(),this._setFlushTimeout()}_setFlushTimeout(){this._isPaused||(this._flushTimeout=setTimeout(()=>{this._clearFlushTimeout(),this._flushNow(),this._queue.length>0&&this._setFlushTimeout()},this._flushTimeoutMs))}_clearFlushTimeout(){this._flushTimeout&&(clearTimeout(this._flushTimeout),this._flushTimeout=void 0)}_flushNow(){if(0!==this._queue.length){var e=this._formatQueue(),t=Date.now();for(var i in e){var r=e[i];r.events.forEach(e=>{var i=new Date(e.timestamp).getTime();e.$offset=Math.abs(i-t)}),this._sendRequest(r)}}}_formatQueue(){var e={};return this._queue.forEach(t=>{var i=t.batchKey||t.url;e[i]||(e[i]={url:t.url,events:[],batchKey:t.batchKey}),e[i].events.push(t.event)}),this._queue=[],e}}class Bn{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._areWeOnline=!0,this._sendRequest=e.sendRequest,this._sendBeacon=e.sendBeacon,B&&void 0!==H&&"onLine"in H&&(this._areWeOnline=H.onLine,Ae(B,"online",()=>{this._areWeOnline=!0,this._flush()}),Ae(B,"offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}enqueue(e,t){if(void 0===t&&(t=0),t>=10)se().error("retry","request failed after 10 retries, giving up");else if(!xe()){var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,r=Math.min(18e5,t),n=(Math.random()-.5)*(r-i);return Math.ceil(r+n)}(t),r=Date.now()+i;this._queue.push({retryAt:r,request:e,retriesPerformedSoFar:t+1});var n="enqueued failed request for retry in "+Math.round(i/1e3)+"s";this._areWeOnline||(n+=" (browser is offline)"),se().warn("retry",n),this._isPolling||(this._isPolling=!0,this._poll())}}retriableRequest(e){var i=this;return t(function*(){try{var t=yield i._sendRequest(e);200!==t.statusCode&&(t.statusCode<400||t.statusCode>=500)&&i.enqueue(e,0)}catch(t){i.enqueue(e,0)}})()}_poll(){this._poller&&clearTimeout(this._poller),this._poller=setTimeout(()=>{this._areWeOnline&&this._queue.length>0&&this._flush(),this._queue.length>0?this._poll():this._isPolling=!1},this._pollIntervalMs)}_flush(){var e=this,i=Date.now(),r=[],n=[];this._queue.forEach(e=>{e.retryAt<i?n.push(e):r.push(e)}),this._queue=r,n.forEach(function(){var i=t(function*(t){var{request:i,retriesPerformedSoFar:r}=t;try{var n=yield e._sendRequest(i);200!==n.statusCode&&(n.statusCode<400||n.statusCode>=500)&&e.enqueue(i,r)}catch(t){e.enqueue(i,r)}});return function(e){return i.apply(this,arguments)}}())}unload(){this._poller&&(clearTimeout(this._poller),this._poller=void 0),this._queue.forEach(e=>{var{request:t}=e;try{this._sendBeacon(t)}catch(e){se().error("retry","failed to send beacon on unload",e)}}),this._queue=[]}}var Nn="vt_rate_limit";class Hn{constructor(e){var t,i;void 0===e&&(e={}),this.lastEventRateLimited=!1,this.eventsPerSecond=null!==(t=e.eventsPerSecond)&&void 0!==t?t:10,this.eventsBurstLimit=Math.max(null!==(i=e.eventsBurstLimit)&&void 0!==i?i:10*this.eventsPerSecond,this.eventsPerSecond),this.persistence=e.persistence,this.captureWarning=e.captureWarning,this.lastEventRateLimited=this.checkRateLimit(!0).isRateLimited}checkRateLimit(e){var t,i,r,n;void 0===e&&(e=!1);var a=Date.now(),s=null!==(i=null===(t=this.persistence)||void 0===t?void 0:t.get(Nn))&&void 0!==i?i:{tokens:this.eventsBurstLimit,last:a},o=(a-s.last)/1e3;s.tokens+=o*this.eventsPerSecond,s.last=a,s.tokens>this.eventsBurstLimit&&(s.tokens=this.eventsBurstLimit);var l=s.tokens<1;return l||e||(s.tokens=Math.max(0,s.tokens-1)),!l||this.lastEventRateLimited||e||null===(r=this.captureWarning)||void 0===r||r.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=l,null===(n=this.persistence)||void 0===n||n.set(Nn,s),{isRateLimited:l,remainingTokens:s.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class qn{constructor(e){this._remoteConfig=null,this._initConfig=null,this._host=e}get config(){return this._remoteConfig}onApply(e){this._onApply=e}onLoad(e){this._onLoad=e}load(){var e,t=this._host.getConfig();if(t.token){if(this._initConfig||(this._initConfig=i({},t)),null===(e=t.bootstrap)||void 0===e?void 0:e.remoteConfig)return this._remoteConfig=t.bootstrap.remoteConfig,this._apply(this._remoteConfig),void this._fetch();var r=le(()=>B.__VTILT_BOOTSTRAP__);if(null==r?void 0:r.remoteConfig)return this._remoteConfig=r.remoteConfig,this._apply(this._remoteConfig),void this._fetch();le(()=>{var e=localStorage.getItem(u+"_"+t.token);e&&(this._remoteConfig=JSON.parse(e),this._apply(this._remoteConfig,!0))}),this._fetch()}}_fetch(){var e=this._host.getConfig();if(e.token)if(xe())this._host.updateConfig({__remote_config_loaded:!0});else{var t=this._host.buildEndpointUrl("/api/d"),r=new AbortController,n=setTimeout(()=>r.abort(),3e3);(j||fetch)(t,{method:"GET",signal:r.signal,headers:i({Accept:"application/json"},he(e))}).then(e=>e.json()).then(t=>{var i;clearTimeout(n),ke(),this._remoteConfig=t,le(()=>{localStorage.setItem(u+"_"+e.token,JSON.stringify(t))}),this._apply(t),null===(i=this._onLoad)||void 0===i||i.call(this,t)}).catch(()=>{clearTimeout(n),Se("config"),this._host.updateConfig({__remote_config_loaded:!0})})}}_apply(e,t){var r,n,a,s;void 0===t&&(t=!1);var o=this._initConfig||this._host.getConfig(),l={};for(var[,d]of this._host.featureManager.getDescriptors())if(d.remoteConfig&&d.configKey){var u=e[d.remoteConfig.key];u&&void 0===o[d.configKey]&&(l[d.configKey]=d.remoteConfig.map(u))}if(e.analytics&&!t&&(void 0!==e.analytics.capturePageview&&void 0===o.capture_pageview&&(l.capture_pageview=e.analytics.capturePageview),void 0!==e.analytics.capturePageleave&&void 0===o.capture_pageleave&&(l.capture_pageleave=!!e.analytics.capturePageleave),void 0!==e.analytics.capturePerformance&&void 0===o.capture_performance&&(l.capture_performance=e.analytics.capturePerformance),void 0===o.autocapture)){var h=e.analytics.autocapture,c=e.analytics.scrollDepthMilestones,v=e.analytics.scrollDepthPageleave;void 0!==h&&(l.autocapture=h&&(c||v)?{scroll_depth:i({},c?{milestones:!0}:{},v?{pageleave:!0}:{})}:h)}t||(l.__remote_config_loaded=!0),void 0!==(null===(r=e.privacy)||void 0===r?void 0:r.respectDnt)&&void 0===o.respect_dnt&&(l.respect_dnt=e.privacy.respectDnt),void 0!==(null===(n=e.privacy)||void 0===n?void 0:n.requireConsent)&&void 0===o.require_consent&&(l.require_consent=e.privacy.requireConsent),void 0!==e.autocapture_opt_out&&(l.autocapture_opt_out=e.autocapture_opt_out),void 0!==e.elementsChainAsString&&(l.elementsChainAsString=e.elementsChainAsString),(null===(a=e.diagnostics)||void 0===a?void 0:a.defaultLogLevel)&&se().setLevelFromRemote(e.diagnostics.defaultLogLevel),Object.keys(l).length>0&&this._host.updateConfig(l),null===(s=this._onApply)||void 0===s||s.call(this,e)}}var Fn=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"];function jn(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return[...Fn,...t].some(e=>-1!==i.indexOf(e.toLowerCase()))}function zn(e,t){var i;if(void 0===t&&(t=[]),!e)return!1;var r=e.userAgent;if(r&&jn(r,t))return!0;try{var n=e.userAgentData;if(null===(i=null==n?void 0:n.brands)||void 0===i?void 0:i.some(e=>jn(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver}var Wn=36e5;function Vn(){var e,t,i;return null!==(i=null===(t=null===(e=null==B?void 0:B.performance)||void 0===e?void 0:e.now)||void 0===t?void 0:t.call(e))&&void 0!==i?i:Date.now()}class Kn{constructor(){this._pageEnterPerf=Vn(),this._lastCapturePerf=null,this._bootPerf=Vn(),this._prevUrl="",this._prevPathname="",this._prevTitle="",this._leaveEmittedForPageKey=""}onAfterPageview(){var e=Vn();this._pageEnterPerf=e,this._lastCapturePerf=e,this._leaveEmittedForPageKey="",F&&(this._prevUrl=F.href||"",this._prevPathname=F.pathname||""),q&&(this._prevTitle=q.title||"")}peekEngagementSinceLastCaptureMs(){var e,t=Vn(),i=null!==(e=this._lastCapturePerf)&&void 0!==e?e:this._bootPerf,r=Math.round(t-i);return r<1&&(r=1),r>Wn&&(r=Wn),r}commitCaptureClock(){this._lastCapturePerf=Vn()}_pageKey(){return this._prevUrl+"\0"+this._prevPathname}clearLeaveDedupe(){this._leaveEmittedForPageKey=""}tryCapturePageleave(e,t,i,r){if(function(e){var t=e.capture_pageleave;return!1!==t&&(!0===t||!1!==e.capture_pageview)}(e)){var n=this._pageKey();if((this._prevUrl||this._prevPathname)&&n&&this._leaveEmittedForPageKey!==n){this._leaveEmittedForPageKey=n;var a=Vn(),s=Math.round(a-this._pageEnterPerf);s<1&&(s=1),s>Wn&&(s=Wn);var o={navigation_type:i,engagement_time_msec:s,[L]:this._prevUrl,[A]:this._prevPathname,[P]:Math.round(s/1e3),[T]:this._prevPathname,[U]:this._prevUrl},l=this._prevUrl?function(e){try{return new URL(e).host}catch(e){return""}}(this._prevUrl):"";l&&(o.$host=l),this._prevTitle&&(o.title=this._prevTitle),r&&Object.assign(o,r),t(b,o,{skip_engagement:!0})}}}}var Gn=[y,w,C,b,I,E,S,M],Jn=new Set([y,w,C]),Qn=new Set([b,M,I,E,S]);class Xn{constructor(e){this._set_once_properties_sent=!1,this._initial_pageview_captured=!1,this._visibility_state_listener=null,this._vt_person_id=null,this._pageLifecycle=new Kn,this._host=e}setVtPersonId(e){this._vt_person_id=e}capture(e,t,r){var n,a,s;this._host.sessionManager.setSessionId();var o=this._host.getConfig();if(o.opt_out_useragent_filter||!zn(H,null!==(n=o.custom_blocked_useragents)&&void 0!==n?n:[]))if((null==H?void 0:H.userAgent)&&function(e){return!(e&&"string"==typeof e&&e.length>500)}(H.userAgent))if((null==r?void 0:r.skip_client_rate_limiting)||Gn.includes(e)||this._host.rateLimiter.shouldAllowEvent())if(!this._host.getConfig().require_consent||Jn.has(e)||(null===(a=this._host.consentManager)||void 0===a?void 0:a.hasConsent())){var l=this._host.buildUrl(),d=!0===(null==r?void 0:r.skip_engagement)||Qn.has(e),u=i({},t);d||"number"==typeof u.engagement_time_msec||(u=i({},u,{engagement_time_msec:this._pageLifecycle.peekEngagementSinceLastCaptureMs()}));var h=i({},this._buildEventPayload(e,u),o.globalAttributes),c=JSON.stringify(h);if(!(v=c)||"string"!=typeof v||v.length<2||v.length>Me)se().debug("capture","dropped",e,{reason:"payload_invalid_size",bytes:c.length,limitBytes:Me,hint:e===k?"Trim global / event properties; $elements is already off by default in compact mode.":"Trim event properties; payload exceeded the runaway-guard cap."});else{var v,_=e===y?this._host.userManager.getAnonymousId():null!==(s=this._host.userManager.getDistinctId())&&void 0!==s?s:this._host.userManager.getAnonymousId(),g={timestamp:(new Date).toISOString(),event:e,payload:h,distinct_id:_,anonymous_id:this._host.userManager.getAnonymousId()};this._host.bufferEvent(e,l,g),se().debug("capture","enqueued",e,i({distinct_id:_,$current_url:h.$current_url,$session_id:h.$session_id,$debug:h.$debug},e===k&&"object"==typeof h&&null!==h?{$event_type:h.$event_type}:{})),this._vt_person_id&&(this._vt_person_id=null),e===m?this._pageLifecycle.onAfterPageview():this._pageLifecycle.commitCaptureClock()}}else se().debug("capture","dropped",e,{reason:"require_consent_and_no_consent"});else se().debug("capture","dropped",e,{reason:"client_rate_limited",hint:"Token bucket (~10/s, burst ~100). $autocapture counts toward the same limit as custom events."});else se().debug("capture","dropped",e,{reason:"invalid_or_missing_user_agent"});else se().debug("capture","dropped",e,{reason:"bot"})}captureInternal(e,t){this.capture(e,t,{skip_client_rate_limiting:!0})}captureInitialPageview(){q&&("visible"===q.visibilityState?this._initial_pageview_captured||(this._initial_pageview_captured=!0,setTimeout(()=>{q&&F&&!1!==this._host.getConfig().capture_pageview&&this.capture(m,{navigation_type:"initial_load"})},300),this._visibility_state_listener&&(q.removeEventListener("visibilitychange",this._visibility_state_listener),this._visibility_state_listener=null)):this._visibility_state_listener||(this._visibility_state_listener=()=>this.captureInitialPageview(),Ae(q,"visibilitychange",this._visibility_state_listener)))}tryCapturePageleave(e,t){this._pageLifecycle.tryCapturePageleave(this._host.getConfig(),(e,t,i)=>this.capture(e,t,i),e,t)}resetPageleaveDedupe(){this._pageLifecycle.clearLeaveDedupe()}_isDebugMode(){if(this._host.getConfig().debug)return!0;try{if(null==F?void 0:F.search)if("1"===new URLSearchParams(F.search).get("vtilt_debug"))return!0}catch(e){}return!1}_buildEventPayload(e,t){var r,n,a=this._host.getConfig(),s=a.mask_personal_data_properties,o=a.custom_personal_data_properties,l=oi(s,o),d=Ue(function(e,t,i){if(!q)return{};var r=t?Te([],Qt,i||[]):[];return Pe({},Yt(ze(q.URL,r,Zt)))}(0,s,o)),u=this._host.userManager.getUserProperties(),h=this._host.userManager.get_initial_props(),c=this._host.sessionManager.getSessionId(),v=this._host.sessionManager.getWindowId(),_={};!this._set_once_properties_sent&&Object.keys(h).length>0&&Object.assign(_,h),t.$set_once&&Object.assign(_,t.$set_once);var g=i({},l,d,u,null!==(n=null===(r=this._host.consentManager)||void 0===r?void 0:r.getConsentProperties())&&void 0!==n?n:{},{$session_id:c,$window_id:v},this._vt_person_id?{$vt:this._vt_person_id}:{},Object.keys(_).length>0?{$set_once:_}:{},t.$set?{$set:t.$set}:{},t);!this._set_once_properties_sent&&Object.keys(h).length>0&&(this._set_once_properties_sent=!0),e===m&&q&&(g.title=q.title),this._isDebugMode()&&(g.$debug=!0);var p=this._host.sessionManager.consumeSessionStart(),f=this._host.userManager.consumeFirstVisit();return p&&(g.$session_start=!0),f&&(g.$first_visit=!0),g}}var Zn=["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"];function Yn(e){return!(!e||"string"!=typeof e)&&Zn.includes(e.toLowerCase().trim())}class ea{constructor(e){this._lastIdentifyHash=null,this._lastSetPropertiesHash=null,this._host=e}identify(e,t,r){var n;if("number"==typeof e&&(e=String(e),se().warn("identify","first argument should be a string, not a number")),e)if(Yn(e))se().error("identify",'"'+e+'" appears to be a hardcoded string');else if("COOKIELESS_SENTINEL_VALUE"!==e){var a=JSON.stringify([e,t,r]);if(this._lastIdentifyHash!==a){var s=this._host.userManager,o=s.getDistinctId(),l=s.getAnonymousId(),d=s.getDeviceId();if(!("identified"===s.getUserState())&&l!==e||e!==o){this._host.capture(y,{distinct_id:e,$set:t||{},$set_once:r||{}});var u={user_state:"identified",distinct_id:e,properties_set:t,properties_set_once:r};if(!d){var h=o||l;u.device_id=h,u.properties_set=i({$had_persisted_distinct_id:!0,$device_id:h},u.properties_set||{})}s.applyUpdate(u),null===(n=this._host._emitter)||void 0===n||n.emit("user:identified",{distinctId:e})}else(t||r)&&this.setUserProperties(t,r);this._lastIdentifyHash=a}}else se().error("identify","cannot use sentinel value as distinct_id");else se().error("identify","unique user id is required")}setUserProperties(e,t){var i,r;if(e||t){var n=this._host.userManager,a=JSON.stringify([null!==(i=n.getDistinctId())&&void 0!==i?i:n.getAnonymousId(),e,t]);this._lastSetPropertiesHash!==a&&(n.applyUpdate({properties_set:e,properties_set_once:t}),this._host.capture(C,{$set:e||{},$set_once:t||{}}),null===(r=this._host._emitter)||void 0===r||r.emit("user:properties_set",{properties:e}),this._lastSetPropertiesHash=a)}}resetUser(e){var t;this._host.sessionManager.resetSessionId(),this._host.userManager.reset(e),this._lastIdentifyHash=null,this._lastSetPropertiesHash=null,null===(t=this._host._emitter)||void 0===t||t.emit("user:reset")}alias(e,t){var i;if(e&&!Yn(e)){var r=this._host.userManager,n=null!==(i=null!=t?t:r.getDistinctId())&&void 0!==i?i:r.getAnonymousId();n&&!Yn(n)?e!==n?this._host.capture(w,{$original_id:n,$alias_id:e}):this.identify(e):se().warn("alias","invalid original distinct ID")}else se().warn("alias","invalid alias")}getUserIdentity(){return this._host.userManager.getUserIdentity()}getDeviceId(){return this._host.userManager.getDeviceId()}getUserState(){return this._host.userManager.getUserState()}getDistinctId(){var e;return null!==(e=this._host.userManager.getDistinctId())&&void 0!==e?e:this._host.userManager.getAnonymousId()}getAnonymousId(){return this._host.userManager.getAnonymousId()}}var ta="_vtilt_consent";class ia{constructor(e){this._state={},this._hasBeenSet=!1,this._host=e,this._readFromCookie()}setConsent(e){var t;this._state=i({},this._state,e),this._hasBeenSet=!0,this._writeToCookie(),null===(t=this._host._emitter)||void 0===t||t.emit("consent:updated",{consent:this._state})}getConsent(){return i({},this._state)}hasConsent(){return this._hasBeenSet}setDefaultGranted(){this._hasBeenSet||(this._state={analytics:!0,marketing:!0,advertising:!0},this._hasBeenSet=!0)}getConsentProperties(){var e={};return void 0!==this._state.analytics&&(e.$consent_analytics=this._state.analytics),void 0!==this._state.marketing&&(e.$consent_marketing=this._state.marketing),void 0!==this._state.advertising&&(e.$consent_advertising=this._state.advertising),e}reset(){this._state={},this._hasBeenSet=!1,this._removeCookie()}_readFromCookie(){if(void 0!==q&&(null==q?void 0:q.cookie)){var e=ta+"=";for(var t of q.cookie.split(";")){var i=t.trim();if(i.startsWith(e)){try{var r=decodeURIComponent(i.slice(15)),n=JSON.parse(r);n&&"object"==typeof n&&(this._state=n,this._hasBeenSet=!0)}catch(e){}return}}}}_writeToCookie(){if(void 0!==q){var e=encodeURIComponent(JSON.stringify(this._state)),t="undefined"!=typeof location&&"https:"===location.protocol?"; Secure":"";q.cookie=ta+"="+e+"; Max-Age=31536000; path=/; SameSite=Lax"+t}}_removeCookie(){void 0!==q&&(q.cookie=ta+"=; Max-Age=0; path=/")}}class ra{constructor(e){this._descriptors=new Map,this._instances=new Map,this._host=e}register(e){this._descriptors.set(e.name,e)}createInstances(){var e=this,t=this._host.getConfig(),i=function(i,r){return e._instances.has(i)||e._isHardDisabled(t,r)?0:void le(()=>{var n=r.FeatureClass.extractConfig(t),a=new r.FeatureClass(e._host,n);e._instances.set(i,a)})};for(var[r,n]of this._descriptors)i(r,n)}initAll(){this.createInstances();var e=function(e){le(()=>{e.isStarted||e.startIfEnabled()})};for(var[,t]of this._instances)e(t)}notifyAll(e){var t=function(t){t.onConfigUpdate&&le(()=>t.onConfigUpdate(e))};for(var[,i]of this._instances)t(i)}get(e){return this._instances.get(e)}set(e,t){this._instances.set(e,t)}getDescriptors(){return this._descriptors}_isHardDisabled(e,t){if(t.disableKey&&!0===e[t.disableKey])return!0;if(t.configKey){var i=e[t.configKey];if(i&&"object"==typeof i&&!1===i.enabled)return!0}return!1}}class na{constructor(e){this._queue=new kn,this._ready=!1,this._configReady=!1,this._host=e,this._checkReady(),this._ready||(this._safetyTimer=setTimeout(()=>this.forceFlush(),5e3))}push(e){this._ready?this._process(e):this._queue.enqueue(e)}markConfigReady(){this._configReady||(this._configReady=!0,this._tryFlush())}forceFlush(){this._clearSafetyTimer(),this._flush(),this._ready=!0}_checkReady(){this._ready=this._configReady}_tryFlush(){this._checkReady(),this._ready&&(this._clearSafetyTimer(),this._flush())}_flush(){var e=this._queue.takeAll();for(var t of e)this._process(t);e.length>0&&this._host.requestQueue.flush()}_process(e){if(this._configReady){if(this._isDisabledByConfig(e.name))return}else this._tagConfigPending(e.event);this._host.sendRequest(e.url,e.event)}_isDisabledByConfig(e){var t=this._host.getConfig();switch(e){case m:return!1===t.capture_pageview;case b:return!1===t.capture_pageleave;case S:return!1===t.capture_performance;case k:case x:return!1===t.autocapture;default:return!1}}_tagConfigPending(e){"object"==typeof e.payload&&null!==e.payload&&(e.payload.$config_pending=!0)}_clearSafetyTimer(){void 0!==this._safetyTimer&&(clearTimeout(this._safetyTimer),this._safetyTimer=void 0)}}var aa="vt";class sa{constructor(e){void 0===e&&(e={}),this.version=r,this.__loaded=!1,this._has_warned_about_config=!1,this._booted=!1,this._pendingCalls=[],this._postBootInitDone=!1,se().debug("ctor","start"),this._emitter=new ce,this.configManager=new V(e);var t=this.configManager.getConfig();oe(t),this.sessionManager=new Ne(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new li(t.persistence||"localStorage+cookie",t.cross_subdomain_cookie),this.rateLimiter=new Hn({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:e=>{this._captureManager.captureInternal(M,{$$client_ingestion_warning_message:e})}}),this.retryQueue=new Bn({sendRequest:e=>this._send_http_request(e),sendBeacon:e=>this._send_beacon_request(e)}),this.requestQueue=new $n(e=>this._send_batched_request(e),{flush_interval_ms:3e3}),this.consentManager=new ia(this),this._captureManager=new Xn(this),this._identityManager=new ea(this),this._featureManager=new ra(this),this._remoteConfigManager=new qn(this),this._registerFeatures(),this._remoteConfigManager.onLoad(e=>{this._emitter.emit(ge,{config:e})}),this._installBootGate(),se().debug("ctor","boot gate installed")}_registerFeatures(){this._featureManager.register({name:"HistoryAutocapture",configKey:"capture_pageview",FeatureClass:fi}),this._featureManager.register({name:"Autocapture",configKey:"autocapture",FeatureClass:or}),this._featureManager.register({name:"WebVitals",configKey:"capture_performance",FeatureClass:gi}),this._featureManager.register({name:"SessionRecording",configKey:"session_recording",disableKey:"disable_session_recording",remoteConfig:{key:"sessionRecording",map:e=>({enabled:e.enabled,sampleRate:e.sampleRate,minimumDurationMs:e.minimumDurationMs,fullSnapshotIntervalMs:e.fullSnapshotIntervalMs,maskAllInputs:e.maskAllInputs,captureConsole:e.captureConsole,captureCanvas:e.captureCanvas})},FeatureClass:dr}),this._featureManager.register({name:"Chat",configKey:"chat",disableKey:"disable_chat",remoteConfig:{key:"chat",map:e=>({enabled:e.enabled,position:e.widgetPosition,color:e.widgetColor})},FeatureClass:an}),this._featureManager.register({name:"GoogleTagGateway",configKey:"google_tag",disableKey:"disable_google_tag",remoteConfig:{key:"googleTag",map:e=>e},FeatureClass:In})}_installBootGate(){var e=this,t=function(t){var i=e[t];e[t]=function(){for(var r=arguments.length,n=new Array(r),a=0;a<r;a++)n[a]=arguments[a];if(e._booted)return i.apply(e,n);e._pendingCalls.push([t,...n])}};for(var i of sa.BOOT_GATED_METHODS)t(i)}_boot(){if(!this._booted){for(var e of(this._booted=!0,se().debug("boot","start"),sa.BOOT_GATED_METHODS))delete this[e];se().debug("boot","gate removed"),this.__loaded&&!this._postBootInitDone?(se().debug("boot","running _runPostBootInit"),this._runPostBootInit()):se().debug("boot","skipping _runPostBootInit","loaded?",this.__loaded,"postBootDone?",this._postBootInitDone),se().debug("boot","flush pendingCalls",this._pendingCalls.length),this._execute_array(this._pendingCalls),this._pendingCalls=[]}}init(e,t,i){var r;if(i&&i!==aa){var n=null!==(r=oa[i])&&void 0!==r?r:new sa;return n._init(e,t,i),oa[i]=n,oa[aa][i]=n,n}return this._init(e,t,i)}_init(e,t,r){if(void 0===t&&(t={}),this.__loaded)return se().warn("init","already initialized; re-initializing is a no-op"),this;this.configManager.updateConfig(i({},t,{token:e||t.token,name:r}));var n=this.configManager.getConfig();return oe(n),this.__loaded=!0,se().debug("init","start","token present?",!!n.token,"name",null!=r?r:"vt"),this._featureManager.createInstances(),this._booted||void 0===q||"interactive"!==q.readyState&&"complete"!==q.readyState||(se().debug("init","self-boot?",q.readyState),this._boot()),this._booted&&!this._postBootInitDone&&this._runPostBootInit(),se().debug("init","postBootInitDone",this._postBootInitDone),this}_runPostBootInit(){if(!this._postBootInitDone){this._postBootInitDone=!0,se().debug("postBoot","start");var e=this.configManager.getConfig();this.sessionManager=new Ne(e.storage||"cookie",e.cross_subdomain_cookie),this.sessionManager.hydrateFromStorage(),se().debug("postBoot","sessionManager hydrated");var t=e.persistence||"localStorage+cookie";this.userManager.updateStorageMethod(t,e.cross_subdomain_cookie),this.userManager.hydrateFromStorage(),se().debug("postBoot","userManager hydrated"),e.require_consent||this.consentManager.hasConsent()||this.consentManager.setDefaultGranted(),!0===this.consentManager.getConsent().advertising&&Je(),this._emitter.on("consent:updated",e=>{var t=e.consent;!0===t.advertising?Je():!1===t.advertising&&void 0!==q&&(q.cookie=We+"=; Max-Age=0; path=/",q.cookie=Ve+"=; Max-Age=0; path=/")}),this._read_vt_param_from_url(),this.userManager.set_initial_person_info(e.mask_personal_data_properties,e.custom_personal_data_properties),this._eventBuffer=new na({sendRequest:(e,t)=>this.sendRequest(e,t),requestQueue:this.requestQueue,getConfig:()=>this.configManager.getConfig()}),this._featureManager.initAll(),se().debug("postBoot","features inited"),this._remoteConfigManager.load(),this._setup_unload_handler(),this._start_queue_if_opted_in();var i=this.configManager.getConfig();!1!==i.capture_pageview&&this._captureManager.captureInitialPageview(),this._featureManager.notifyAll(i),this._emitter.emit(ve,{config:i}),se().debug("postBoot","done"),se().info("init","SDK ready")}}startAutocapture(){var e=this._featureManager.get("Autocapture");if(!e){var t=or.extractConfig(this.configManager.getConfig());e=new or(this,t),this._featureManager.set("Autocapture",e)}e.updateConfig({enabled:!0})}stopAutocapture(){var e=this._featureManager.get("Autocapture");e&&e.updateConfig({enabled:!1})}isAutocaptureActive(){var e,t;return null!==(t=null===(e=this._featureManager.get("Autocapture"))||void 0===e?void 0:e.isStarted)&&void 0!==t&&t}getAutocaptureDiagnostics(){var e,t;return null!==(t=null===(e=this._featureManager.get("Autocapture"))||void 0===e?void 0:e.getDiagnostics())&&void 0!==t?t:null}startSessionRecording(){var e=this._featureManager.get("SessionRecording");e||(e=new dr(this),this._featureManager.set("SessionRecording",e)),e.updateConfig({enabled:!0}),e.startIfEnabledOrStop("recording_initialized"),this._emitter.emit(me)}stopSessionRecording(){var e;null===(e=this._featureManager.get("SessionRecording"))||void 0===e||e.stop(),this._emitter.emit(be)}isRecordingActive(){var e;return"active"===(null===(e=this._featureManager.get("SessionRecording"))||void 0===e?void 0:e.status)}getSessionRecordingId(){var e;return(null===(e=this._featureManager.get("SessionRecording"))||void 0===e?void 0:e.sessionId)||null}openChat(){var e=this._featureManager.get("Chat");e?e.open():se().warn("chat","openChat: feature not available")}closeChat(){var e=this._featureManager.get("Chat");e?e.close():se().warn("chat","closeChat: feature not available")}toggleChat(){var e=this._featureManager.get("Chat");e?e.toggle():se().warn("chat","toggleChat: feature not available")}showChat(){var e=this._featureManager.get("Chat");e?e.show():se().warn("chat","showChat: feature not available")}hideChat(){var e=this._featureManager.get("Chat");e?e.hide():se().warn("chat","hideChat: feature not available")}sendChatMessage(e,t){var i=this._featureManager.get("Chat");return i?i.sendMessage(e,t):(se().warn("chat","sendChatMessage: feature not available"),Promise.resolve())}gtag(){for(var e=this._featureManager.get("GoogleTagGateway"),t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];e?e.gtag(...i):this._pendingCalls.push(["gtag",...i])}setGoogleUserData(e){var t=this._featureManager.get("GoogleTagGateway");return t?t.setUserData(e):Promise.resolve()}get featureManager(){return this._featureManager}on(e,t){return this._emitter.on(e,t)}once(e,t){return this._emitter.once(e,t)}off(e){this._emitter.off(e)}_is_bot(){var e,t=this.getConfig();return!t.opt_out_useragent_filter&&zn(H,null!==(e=t.custom_blocked_useragents)&&void 0!==e?e:[])}capture(e,t,i){this._captureManager.capture(e,t,i),this._emitter.emit(fe,{event:e,payload:t})}tryCapturePageleave(e){var t,i=null===(t=this._featureManager.get("Autocapture"))||void 0===t?void 0:t.getMaxScrollDepthPctForPageleave(),r=null!=i?{[O]:i}:void 0;this._captureManager.tryCapturePageleave(e,r)}identify(e,t,i){this._identityManager.identify(e,t,i)}setUserProperties(e,t){this._identityManager.setUserProperties(e,t)}resetUser(e){this._identityManager.resetUser(e)}alias(e,t){this._identityManager.alias(e,t)}setConsent(e){this.consentManager.setConsent(e)}getConsent(){return this.consentManager.getConsent()}getUserIdentity(){return this._identityManager.getUserIdentity()}getDeviceId(){return this._identityManager.getDeviceId()}getUserState(){return this._identityManager.getUserState()}getConfig(){return this.configManager.getConfig()}getRemoteConfig(){return this._remoteConfigManager.config}getSessionId(){return this.sessionManager.getSessionId()}getDistinctId(){return this._identityManager.getDistinctId()}getAnonymousId(){return this._identityManager.getAnonymousId()}toString(){var e,t=null!==(e=this.configManager.getConfig().name)&&void 0!==e?e:aa;return t!==aa&&(t="vt."+t),t}updateConfig(e){var t,i=this.configManager.getConfig();this.configManager.updateConfig(e);var r=this.configManager.getConfig();!i.__remote_config_loaded&&r.__remote_config_loaded&&(null===(t=this._eventBuffer)||void 0===t||t.markConfigReady()),this._featureManager.notifyAll(r),this._emitter.emit(_e,{config:r})}buildUrl(){return this.buildEndpointUrl("/api/e")}buildEndpointUrl(e){return ue(this.configManager.getConfig(),e)}sendRequest(e,t){this._is_configured()&&this.requestQueue.enqueue({url:e,event:t})}bufferEvent(e,t,i){e!==I&&e!==E?this._eventBuffer.push({name:e,url:t,event:i}):this.sendRequest(t,i)}_is_configured(){return!!this.configManager.getConfig().token||(this._has_warned_about_config||(se().warn("config","token is required for tracking"),this._has_warned_about_config=!0),!1)}_send_batched_request(e){"sendBeacon"!==e.transport?this.retryQueue.retriableRequest(e):this._send_beacon_request(e)}_send_http_request(e){return new Promise(t=>{var{url:i,events:r}=e,n=this.configManager.getConfig(),a=1===r.length?r[0]:{events:r},s=n.disable_compression?Ln.None:Ln.GZipJS;On({url:i,data:a,method:"POST",transport:"XHR",compression:s,projectToken:n.token,callback:e=>t({statusCode:e.statusCode})})})}_send_beacon_request(e){var{url:t,events:i}=e,r=this.configManager.getConfig(),n=1===i.length?i[0]:{events:i},a=r.disable_compression?Ln.None:Ln.GZipJS;On({url:t,data:n,method:"POST",transport:"sendBeacon",compression:a,projectToken:r.token})}_send_retriable_request(e){this.sendRequest(e.url,e.event)}_setup_unload_handler(){if(B){var e=()=>{this._eventBuffer.forceFlush(),this.requestQueue.unload(),this.retryQueue.unload()};Ae(B,"beforeunload",e),Ae(B,"pagehide",()=>{this._captureManager.tryCapturePageleave("pagehide"),e()}),q&&Ae(q,"visibilitychange",()=>{q&&("hidden"===q.visibilityState?this._captureManager.tryCapturePageleave("visibility_hidden"):"visible"===q.visibilityState&&this._captureManager.resetPageleaveDedupe())})}}_start_queue_if_opted_in(){this.requestQueue.enable()}_read_vt_param_from_url(){le(()=>{var e,t;if(void 0!==F&&F.search){var i=new URL(F.href),r=i.searchParams.get("vt"),n=i.searchParams.get("vtd");if((null==r?void 0:r.trim())&&(this._captureManager.setVtPersonId(r.trim()),i.searchParams.delete("vt")),(null==n?void 0:n.trim())&&(this._initVtdOverlay(n.trim()),i.searchParams.delete("vtd")),(null==r?void 0:r.trim())||(null==n?void 0:n.trim())){var a=i.pathname+(i.search||"")+i.hash;null===(t=null===(e=null==B?void 0:B.history)||void 0===e?void 0:e.replaceState)||void 0===t||t.call(e,{},"",a)}}})}_initVtdOverlay(e){this.vtdOverlay||(this.vtdOverlay=new Mn(this),this.vtdOverlay.setDestinationUrl(e))}_execute_array(e){Q(e)&&e.forEach(e=>{if(e&&Q(e)&&e.length>0){var t=e[0],i=e.slice(1);"function"==typeof this[t]&&le(()=>this[t](...i))}})}_dom_loaded(){this._start_queue_if_opted_in()}}sa.BOOT_GATED_METHODS=["capture","identify","setUserProperties","resetUser","alias","setConsent","startAutocapture","stopAutocapture","startSessionRecording","stopSessionRecording","openChat","closeChat","toggleChat","showChat","hideChat","sendChatMessage"];var oa={};var la,da=["init","capture","identify","setUserProperties","resetUser","getUserIdentity","getDeviceId","getUserState","alias","getConfig","getSessionId","updateConfig","setConsent","on","once","off","startAutocapture","stopAutocapture","startSessionRecording","stopSessionRecording","openChat","closeChat","toggleChat","showChat","hideChat","sendChatMessage","gtag","setGoogleUserData"],ua=da.join(" "),ha=(la=oa[aa]=new sa,function(){function e(){if(!e.done){e.done=!0,se().debug("dom","handler fired");var t=Object.keys(oa);se().debug("boot","instance count",t.length),Le(oa,(e,t)=>{se().debug("boot","instance",t),e._boot(),e._dom_loaded()})}}if(q&&"function"==typeof q.addEventListener)return se().debug("dom","readyState",q.readyState),void("complete"===q.readyState||"interactive"===q.readyState?(se().debug("dom","running handler sync"),e()):(se().debug("dom","registered DOMContentLoaded listener"),Ae(q,"DOMContentLoaded",e,{capture:!1})));B&&se().error("dom","browser doesn't support document.addEventListener")}(),la);export{di as ALL_WEB_VITALS_METRICS,ui as DEFAULT_WEB_VITALS_METRICS,ua as VTILT_SNIPPET_STUB_METHODS,da as VTILT_SNIPPET_STUB_METHOD_NAMES,sa as VTilt,ha as default,ha as vt};
|
|
2
2
|
//# sourceMappingURL=module.no-external.js.map
|