@v-tilt/browser 1.10.7 → 1.10.9
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 +1 -1
- package/dist/all-external-dependencies.js.map +1 -1
- package/dist/array.full.js +1 -1
- package/dist/array.full.js.map +1 -1
- 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/external-scripts-loader.js +1 -1
- package/dist/external-scripts-loader.js.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/module.js +1 -1
- package/dist/module.js.map +1 -1
- package/dist/module.no-external.js +1 -1
- package/dist/module.no-external.js.map +1 -1
- package/dist/recorder.js +1 -1
- package/dist/recorder.js.map +1 -1
- package/dist/utils/globals.d.ts +5 -0
- package/dist/web-vitals.js +1 -1
- package/dist/web-vitals.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(){"use strict";function e(e,t,i,n,r,s,a){try{var o=e[s](a),l=o.value}catch(e){return void i(e)}o.done?t(l):Promise.resolve(l).then(n,r)}function t(t){return function(){var i=this,n=arguments;return new Promise(function(r,s){var a=t.apply(i,n);function o(t){e(a,r,s,o,l,"next",t)}function l(t){e(a,r,s,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 n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},i.apply(null,arguments)}var n="1.10.7",r="__vt_session",s="__vt_window_id",a="__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";class m{constructor(e){void 0===e&&(e={}),this.config=this.parseConfigFromScript(e)}parseConfigFromScript(e){if(!document.currentScript)return i({token:e.token||""},e);var t=document.currentScript,n=i({token:""},e);n.api_host=t.getAttribute("data-api-host")||t.getAttribute("data-host")||e.api_host,n.script_host=t.getAttribute("data-script-host")||e.script_host,n.proxy=t.getAttribute("data-proxy")||e.proxy,n.proxyUrl=t.getAttribute("data-proxy-url")||e.proxyUrl,n.token=t.getAttribute("data-token")||e.token||"",n.domain=t.getAttribute("data-domain")||e.domain,n.storage=t.getAttribute("data-storage")||e.storage,n.stringifyPayload="false"!==t.getAttribute("data-stringify-payload");var r="true"===t.getAttribute("data-capture-performance");if(n.capture_performance=!!r||e.capture_performance,n.proxy&&n.proxyUrl)throw console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them."),new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");for(var s of(n.globalAttributes=i({},e.globalAttributes),Array.from(t.attributes)))s.name.startsWith("data-vt-")&&(n.globalAttributes[s.name.slice(8).replace(/-/g,"_")]=s.value);return n}getConfig(){return i({},this.config)}updateConfig(e){this.config=i({},this.config,e)}}function y(e,t){try{return e()}catch(e){return t}}class b{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,n;null===(i=this._events.get(e))||void 0===i||i.forEach(i=>{try{i(t)}catch(t){console.error('[vTilt] Error in event listener for "'+e+'":',t)}});var r=this._onceEvents.get(e);r&&(r.forEach(i=>{try{i(t)}catch(t){console.error('[vTilt] Error in once listener for "'+e+'":',t)}}),this._onceEvents.delete(e)),null===(n=this._events.get("*"))||void 0===n||n.forEach(i=>{try{i({event:e,payload:t})}catch(e){console.error("[vTilt] 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,n,r;return(null!==(i=null===(t=this._events.get(e))||void 0===t?void 0:t.size)&&void 0!==i?i:0)+(null!==(r=null===(n=this._onceEvents.get(e))||void 0===n?void 0:n.size)&&void 0!==r?r:0)}hasListeners(e){return this.listenerCount(e)>0}}var w="sdk:initialized",S="sdk:config_updated",C="sdk:remote_config_loaded",x="feature:started",I="feature:stopped",k="event:captured",E="recording:started",L="recording:stopped",M="23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function T(e){for(var t=(2<<31-Math.clz32(57))-1,i=Math.ceil(1.6*t*e/57),n="";n.length<e;)for(var r=crypto.getRandomValues(new Uint8Array(i)),s=0;s<i&&n.length<e;s++){var a=r[s]&t;a<57&&(n+=M[a])}return n}function A(e){return!(!e||"string"!=typeof e)&&!(e.length<2||e.length>10240)}function R(e,t,i){if(e)if(Array.isArray(e))e.forEach((e,n)=>{t.call(i,e,n)});else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(i,e[n],n)}function P(e,t,i,n){var{capture:r=!1,passive:s=!0}=null!=n?n:{};null==e||e.addEventListener(t,i,{capture:r,passive:s})}function U(e,t){if(!t)return e;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}function O(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r of i)for(var s of r)e.push(s);return e}var $="undefined"!=typeof window?window:void 0,z="undefined"!=typeof globalThis?globalThis:$,N=null==z?void 0:z.navigator,q=null==z?void 0:z.document,D=null==z?void 0:z.location,F=null==z?void 0:z.fetch,B=(null==z?void 0:z.XMLHttpRequest)&&"withCredentials"in new z.XMLHttpRequest?z.XMLHttpRequest:void 0;null==z||z.AbortController;var V=null==N?void 0:N.userAgent,j=null!=$?$:{},H=[d,l,c,o],W=31536e3,G=["herokuapp.com","vercel.app","netlify.app"];function J(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 n=i.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return n?"."+n[0]:""}class K{constructor(e){var t,i,n;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!G.includes(i)}(),this.sameSite=null!==(i=e.sameSite)&&void 0!==i?i:"Lax",this.secure=null!==(n=e.secure)&&void 0!==n?n:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this._localStorageSupported)return this._localStorageSupported;if(void 0===$||!$.localStorage)return this._localStorageSupported=!1,!1;try{var e="__vt_ls_test__";$.localStorage.setItem(e,"1");var t="1"===$.localStorage.getItem(e);return $.localStorage.removeItem(e),this._localStorageSupported=t,t||console.warn("[vTilt] localStorage unavailable, using cookies"),t}catch(e){return this._localStorageSupported=!1,console.warn("[vTilt] localStorage unavailable, using cookies"),!1}}isCriticalProperty(e){return H.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 console.warn('[vTilt] 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:W)}}catch(t){console.warn('[vTilt] 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){console.warn('[vTilt] 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==$||$.localStorage.setItem(e,t)}catch(e){}return t}return i}return this.getLocalStorage(e)}setLocalStoragePlusCookie(e,t,i){this.setLocalStorage(e,t),this.isCriticalProperty(e)&&this.setCookie(e,t,null!=i?i:W)}removeLocalStoragePlusCookie(e){this.removeLocalStorage(e),this.isCriticalProperty(e)&&this.removeCookie(e)}getLocalStorage(e){var t;if(!this.isLocalStorageSupported())return null;try{return null!==(t=null==$?void 0:$.localStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}setLocalStorage(e,t){if(this.isLocalStorageSupported())try{null==$||$.localStorage.setItem(e,t)}catch(e){console.warn("[vTilt] localStorage write error:",e)}}removeLocalStorage(e){if(this.isLocalStorageSupported())try{null==$||$.localStorage.removeItem(e)}catch(e){}}readFromSessionStorage(e){var t;try{return null!==(t=null==$?void 0:$.sessionStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}writeToSessionStorage(e,t){try{null==$||$.sessionStorage.setItem(e,t)}catch(e){console.warn("[vTilt] sessionStorage write error:",e)}}removeFromSessionStorage(e){try{null==$||$.sessionStorage.removeItem(e)}catch(e){}}getCookie(e){if("undefined"==typeof document)return null;var t=e+"=";for(var i of document.cookie.split(";")){var n=i.trim();if(n.startsWith(t))try{return decodeURIComponent(n.slice(t.length))}catch(e){return n.slice(t.length)}}return null}setCookie(e,t,i){if("undefined"!=typeof document){var n=J(this.cross_subdomain),r=e+"="+encodeURIComponent(t)+"; Max-Age="+i+"; path=/; SameSite="+this.sameSite;this.secure&&(r+="; Secure"),n&&(r+="; domain="+n),document.cookie=r}}removeCookie(e){if("undefined"!=typeof document){var t=J(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,n){var r=i({value:t},n?{expiry:Date.now()+n}:{});this.set(e,JSON.stringify(r))}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===$||!(null==$?void 0:$.sessionStorage))return!1;try{var e="__vt_ss_test__";return $.sessionStorage.setItem(e,"1"),$.sessionStorage.removeItem(e),!0}catch(e){return!1}}getSessionStorage(){var e;return this.canUseSessionStorage()&&null!==(e=null==$?void 0:$.sessionStorage)&&void 0!==e?e:null}setMethod(e){this.method=e}getMethod(){return this.method}}class Q{constructor(e,t){void 0===e&&(e="cookie"),this.storage=new K({method:e,cross_subdomain:t,sameSite:"Lax"}),this._windowId=void 0,this._initializeWindowId()}getSessionId(){var e=this._getSessionIdRaw();return e||(e=T(16),this._storeSessionId(e)),e}setSessionId(){var e=this._getSessionIdRaw()||T(16);return this._storeSessionId(e),e}resetSessionId(){this._clearSessionId(),this.setSessionId(),this._setWindowId(T(16))}_getSessionIdRaw(){return this.storage.get(r)}_storeSessionId(e){this.storage.set(r,e,1800)}_clearSessionId(){this.storage.remove(r)}getWindowId(){if(this._windowId)return this._windowId;var e=this.storage.getSessionStorage();if(e){var t=e.getItem(s);if(t)return this._windowId=t,t}var i=T(16);return this._setWindowId(i),i}_setWindowId(e){if(e!==this._windowId){this._windowId=e;var t=this.storage.getSessionStorage();t&&t.setItem(s,e)}}_initializeWindowId(){var e=this.storage.getSessionStorage();if(e){var t=e.getItem(a),i=e.getItem(s);i&&!t?this._windowId=i:(i&&e.removeItem(s),this._setWindowId(T(16))),e.setItem(a,"true"),this._listenToUnload()}else this._windowId=T(16)}_listenToUnload(){var e=this.storage.getSessionStorage();$&&e&&P($,"beforeunload",()=>{var e=this.storage.getSessionStorage();e&&e.removeItem(a)},{capture:!1})}updateStorageMethod(e,t){this.storage=new K({method:e,cross_subdomain:t,sameSite:"Lax"})}}function X(e){if(!q)return null;var t=q.createElement("a");return t.href=e,t}function Z(e,t){for(var i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;n<i.length;n++){var r=i[n].split("=");if(r[0]===t){if(r.length<2)return"";var s=r[1];try{s=decodeURIComponent(s)}catch(e){}return s.replace(/\+/g," ")}}return""}function Y(e,t,i){if(!e||!t||!t.length)return e;for(var n=e.split("#"),r=n[0]||"",s=n[1],a=r.split("?"),o=a[1],l=a[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:"")+(s?"#"+s:"")}function ee(e){return"function"==typeof e}var te="Mobile",ie="iOS",ne="Android",re="Tablet",se=ne+" "+re,ae="iPad",oe="Apple",le=oe+" Watch",de="Safari",ue="BlackBerry",ce="Samsung",he=ce+"Browser",ve=ce+" Internet",_e="Chrome",ge=_e+" OS",pe=_e+" "+ie,fe="Internet Explorer",me=fe+" "+te,ye="Opera",be=ye+" Mini",we="Edge",Se="Microsoft "+we,Ce="Firefox",xe=Ce+" "+ie,Ie="Nintendo",ke="PlayStation",Ee="Xbox",Le=ne+" "+te,Me=te+" "+de,Te="Windows",Ae=Te+" Phone",Re="Nokia",Pe="Ouya",Ue="Generic",Oe=Ue+" "+te.toLowerCase(),$e=Ue+" "+re.toLowerCase(),ze="Konqueror",Ne="(\\d+(\\.\\d+)?)",qe=new RegExp("Version/"+Ne),De=new RegExp(Ee,"i"),Fe=new RegExp(ke+" \\w+","i"),Be=new RegExp(Ie+" \\w+","i"),Ve=new RegExp(ue+"|PlayBook|BB10","i"),je={"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 He(e,t){return e.toLowerCase().includes(t.toLowerCase())}var We=(e,t)=>t&&He(t,oe)||function(e){return He(e,de)&&!He(e,_e)&&!He(e,ne)}(e),Ge=function(e,t){return t=t||"",He(e," OPR/")&&He(e,"Mini")?be:He(e," OPR/")?ye:Ve.test(e)?ue:He(e,"IE"+te)||He(e,"WPDesktop")?me:He(e,he)?ve:He(e,we)||He(e,"Edg/")?Se:He(e,"FBIOS")?"Facebook "+te:He(e,"UCWEB")||He(e,"UCBrowser")?"UC Browser":He(e,"CriOS")?pe:He(e,"CrMo")||He(e,_e)?_e:He(e,ne)&&He(e,de)?Le:He(e,"FxiOS")?xe:He(e.toLowerCase(),ze.toLowerCase())?ze:We(e,t)?He(e,te)?Me:de:He(e,Ce)?Ce:He(e,"MSIE")||He(e,"Trident/")?fe:He(e,"Gecko")?Ce:""},Je={[me]:[new RegExp("rv:"+Ne)],[Se]:[new RegExp(we+"?\\/"+Ne)],[_e]:[new RegExp("("+_e+"|CrMo)\\/"+Ne)],[pe]:[new RegExp("CriOS\\/"+Ne)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ne)],[de]:[qe],[Me]:[qe],[ye]:[new RegExp("(Opera|OPR)\\/"+Ne)],[Ce]:[new RegExp(Ce+"\\/"+Ne)],[xe]:[new RegExp("FxiOS\\/"+Ne)],[ze]:[new RegExp("Konqueror[:/]?"+Ne,"i")],[ue]:[new RegExp(ue+" "+Ne),qe],[Le]:[new RegExp("android\\s"+Ne,"i")],[ve]:[new RegExp(he+"\\/"+Ne)],[fe]:[new RegExp("(rv:|MSIE )"+Ne)],Mozilla:[new RegExp("rv:"+Ne)]},Ke=function(e,t){var i=Ge(e,t),n=Je[i];if(void 0===n)return null;for(var r=0;r<n.length;r++){var s=n[r],a=e.match(s);if(a)return parseFloat(a[a.length-2])}return null},Qe=[[new RegExp(Ee+"; "+Ee+" (.*?)[);]","i"),e=>[Ee,e&&e[1]||""]],[new RegExp(Ie,"i"),[Ie,""]],[new RegExp(ke,"i"),[ke,""]],[Ve,[ue,""]],[new RegExp(Te,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ae,""];if(new RegExp(te).test(t)&&!/IEMobile\b/.test(t))return[Te+" "+te,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var n=i[1],r=je[n]||"";return/arm/i.test(t)&&(r="RT"),[Te,r]}return[Te,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[ie,t.join(".")]}return[ie,""]}],[/(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("("+ne+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ne+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[ne,t.join(".")]}return[ne,""]}],[/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/,[ge,""]],[/Linux|debian/i,["Linux",""]]],Xe=function(e){return Be.test(e)?Ie:Fe.test(e)?ke:De.test(e)?Ee:new RegExp(Pe,"i").test(e)?Pe:new RegExp("("+Ae+"|WPDesktop)","i").test(e)?Ae:/iPad/.test(e)?ae:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?le:Ve.test(e)?ue:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Re,"i").test(e)?Re:/(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(te).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)?ne:se:ne:new RegExp("(pda|"+te+")","i").test(e)?Oe:new RegExp(re,"i").test(e)&&!new RegExp(re+" pc","i").test(e)?$e:""},Ze="https?://(.*)",Ye=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],et=O(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ye),tt="<masked>";function it(e){var t=function(e){return e?0===e.search(Ze+"google.([^/?]*)")?"google":0===e.search(Ze+"bing.com")?"bing":0===e.search(Ze+"yahoo.com")?"yahoo":0===e.search(Ze+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!==t?"q":"p",n={};if(null!==t){n.$search_engine=t;var r=q?Z(q.referrer,i):"";r.length&&(n.ph_keyword=r)}return n}function nt(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function rt(){return(null==q?void 0:q.referrer)||"$direct"}function st(){var e;return(null==q?void 0:q.referrer)&&(null===(e=X(q.referrer))||void 0===e?void 0:e.host)||"$direct"}function at(e){var t,{r:i,u:n}=e,r={$referrer:i,$referring_domain:null==i?void 0:"$direct"===i?"$direct":null===(t=X(i))||void 0===t?void 0:t.host};if(n){r.$current_url=n;var s=X(n);r.$host=null==s?void 0:s.host,r.$pathname=null==s?void 0:s.pathname;var a=function(e){var t=et.concat([]),i={};return R(t,function(t){var n=Z(e,t);i[t]=n||null}),i}(n);U(r,a)}i&&U(r,it(i));return r}function ot(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function lt(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function dt(e,t){if(!V)return{};var i,r,s,[a,o]=function(e){for(var t=0;t<Qe.length;t++){var[i,n]=Qe[t],r=i.exec(e),s=r&&(ee(n)?n(r,e):n);if(s)return s}return["",""]}(V);return U(function(e){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];null!=n&&""!==n&&(t[i]=n)}return t}({$os:a,$os_version:o,$browser:Ge(V,navigator.vendor),$device:Xe(V),$device_type:(r=V,s=Xe(r),s===ae||s===se||"Kobo"===s||"Kindle Fire"===s||s===$e?re:s===Ie||s===Ee||s===ke||s===Pe?"Console":s===le?"Wearable":s?te:"Desktop"),$timezone:ot(),$timezone_offset:lt()}),{$current_url:Y(null==D?void 0:D.href,[],tt),$host:null==D?void 0:D.host,$pathname:null==D?void 0:D.pathname,$raw_user_agent:V.length>1e3?V.substring(0,997)+"...":V,$browser_version:Ke(V,navigator.vendor),$browser_language:nt(),$browser_language_prefix:(i=nt(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==$?void 0:$.screen.height,$screen_width:null==$?void 0:$.screen.width,$viewport_height:null==$?void 0:$.innerHeight,$viewport_width:null==$?void 0:$.innerWidth,$lib:"web",$lib_version:n,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class ut{constructor(e,t){void 0===e&&(e="localStorage"),this._cachedPersonProperties=null,this.storage=new K({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return i({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(d,this.userIdentity.anonymous_id,W)),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}identify(e,t,n){if("number"==typeof e&&(e=e.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),e)if(this.isDistinctIdStringLike(e))console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==e){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=e,!this.userIdentity.device_id){var s=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=s,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:s})}e!==r&&(this.userIdentity.distinct_id=e);var a="anonymous"===this.userIdentity.user_state;e!==r&&a?(this.userIdentity.user_state="identified",t&&(this.userIdentity.properties=i({},this.userIdentity.properties,t)),n&&Object.keys(n).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=n[e])}),this.saveUserIdentity()):t||n?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),t&&(this.userIdentity.properties=i({},this.userIdentity.properties,t)),n&&Object.keys(n).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=n[e])}),this.saveUserIdentity()):e!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(e,t){if(!e&&!t)return!1;var n=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(n,e,t);return this._cachedPersonProperties===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=t[e])}),this.saveUserIdentity(),this._cachedPersonProperties=r,!0)}reset(e){var t=this.generateAnonymousId(),n=this.userIdentity.device_id,r=e?this.generateDeviceId():n;this.userIdentity={distinct_id:null,anonymous_id:t,device_id:r,properties:{},user_state:"anonymous"},this._cachedPersonProperties=null,this.saveUserIdentity(),this.userIdentity.properties=i({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}setDistinctId(e){this.userIdentity.distinct_id=e,this.saveUserIdentity()}setUserState(e){this.userIdentity.user_state=e,this.saveUserIdentity()}updateUserProperties(e,t){e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=t[e])}),this.saveUserIdentity()}ensureDeviceId(e){this.userIdentity.device_id||(this.userIdentity.device_id=e,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:e}),this.saveUserIdentity())}createAlias(e,t){return this.isValidDistinctId(e)?(void 0===t&&(t=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(t)?e===t?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:e,original:t}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isDistinctIdStringLikePublic(e){return this.isDistinctIdStringLike(e)}set_initial_person_info(e,t){if(!this.getStoredUserProperties()[f]){var i=function(e,t){var i=e?O([],Ye,t||[]):[],n=null==D?void 0:D.href.substring(0,1e3);return{r:rt().substring(0,1e3),u:n?Y(n,i,tt):void 0}}(e,t);this.register_once({[f]:i},void 0)}}get_initial_props(){var e,t,i=this.getStoredUserProperties()[f];return i?(e=at(i),t={},R(e,function(e,i){var n;t["$initial_"+(n=String(i),n.startsWith("$")?n.substring(1):n)]=e}),t):{}}update_referrer_info(){var e={$referrer:rt(),$referring_domain:st()};this.register_once(e,void 0)}loadUserIdentity(){var e=this.storage.get(d),t=this.storage.get(l),i=this.storage.get(c),n=this.storage.get(o),r=this.getStoredUserProperties(),s=e||this.generateAnonymousId(),a=t||this.generateDeviceId(),u=i||null,h=n||"anonymous",v=s||this.generateAnonymousId();return e||this.storage.set(d,v,W),t||this.storage.set(l,a,W),n||this.storage.set(o,h,W),{distinct_id:u,anonymous_id:v,device_id:a,properties:r,user_state:h}}saveUserIdentity(){this.storage.set(d,this.userIdentity.anonymous_id,W),this.storage.set(l,this.userIdentity.device_id,W),this.storage.set(o,this.userIdentity.user_state,W),this.userIdentity.distinct_id?this.storage.set(c,this.userIdentity.distinct_id,W):this.storage.remove(c),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(h)||{}}setStoredUserProperties(e){this.storage.setJSON(h,e,W)}register_once(e,t){var i=this.getStoredUserProperties(),n=!1;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(r in i||(i[r]=e[r],n=!0));if(t)for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(s in i||(i[s]=t[s],n=!0));n&&this.setStoredUserProperties(i)}generateAnonymousId(){return"anon_"+T(16)}generateDeviceId(){return"device_"+T(16)}getPersonPropertiesHash(e,t,i){return JSON.stringify({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}isValidDistinctId(e){if(!e||"string"!=typeof e)return!1;var t=e.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(t)&&0!==e.trim().length}isDistinctIdStringLike(e){if(!e||"string"!=typeof e)return!1;var t=e.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(t)}updateStorageMethod(e,t){this.storage=new K({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var ct=["LCP","CLS","FCP","INP"],ht=9e5,vt="[WebVitals]";class _t{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){this.name="WebVitals",this._isStarted=!1,this._instance=e,this._buffer=this._createEmptyBuffer(),this._config=_t.extractConfig(e.getConfig())}get isEnabled(){var e=null==D?void 0:D.protocol;return("http:"===e||"https:"===e)&&!0===this._config.web_vitals}get isStarted(){return this._isStarted}startIfEnabled(){if(this.isEnabled&&!this._isStarted&&$){var e=this._getWebVitalsCallbacks();e?this._startCapturing(e):this._loadWebVitals()}}stop(){this._isStarted&&(this._flush(),this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0),this._isStarted=!1)}onConfigUpdate(e){var t=_t.extractConfig(e),i=this.isEnabled;this._config=t,i||!this.isEnabled||this._isStarted?i&&!this.isEnabled&&this._isStarted&&this.stop():this.startIfEnabled()}get allowedMetrics(){return this._config.web_vitals_allowed_metrics||ct}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?ht:0===e?0:e<6e4?ht: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}_loadWebVitals(){var e,t=null===(e=j.__VTiltExtensions__)||void 0===e?void 0:e.loadExternalDependency;t?t(this._instance,"web-vitals",e=>{if(e)console.error(vt+" Failed to load web-vitals:",e);else{var t=this._getWebVitalsCallbacks();t?this._startCapturing(t):console.error(vt+" web-vitals loaded but callbacks not registered")}}):console.warn(vt+" External dependency loader not available. Include web-vitals.ts entrypoint or use array.full.js bundle.")}_startCapturing(e){if(!this._isStarted){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),this._isStarted=!0}}_getCurrentUrl(){var e;return null===(e=null==$?void 0:$.location)||void 0===e?void 0:e.href}_getCurrentPathname(){return null==D?void 0:D.pathname}_addToBuffer(e){try{if(!$||!q||!D)return;if(!(null==e?void 0:e.name)||void 0===(null==e?void 0:e.value))return void console.warn(vt+" Invalid metric received",e);if(this.maxAllowedValue>0&&e.value>=this.maxAllowedValue&&"CLS"!==e.name)return void console.warn(vt+" Ignoring "+e.name+" with value >= "+this.maxAllowedValue+"ms");var t=this._getCurrentUrl(),n=this._getCurrentPathname();if(!t)return void console.warn(vt+" Could not determine current URL");this._buffer.url&&this._buffer.url!==t&&this._flush(),this._buffer.url||(this._buffer.url=t,this._buffer.pathname=n),this._buffer.firstMetricTimestamp||(this._buffer.firstMetricTimestamp=Date.now());var r=this._cleanAttribution(e.attribution),s=this._instance.getSessionId(),a=this._getWindowId(),o=i({},e,{attribution:r,timestamp:Date.now(),$current_url:t,$session_id:s,$window_id:a}),l=this._buffer.metrics.findIndex(t=>t.name===e.name);l>=0?this._buffer.metrics[l]=o:this._buffer.metrics.push(o),this._scheduleFlush(),this._buffer.metrics.length>=this.allowedMetrics.length&&this._flush()}catch(e){console.error(vt+" 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){console.error(vt+" Error flushing metrics:",e)}this._buffer=this._createEmptyBuffer()}}}function gt(e,t,i){try{if(!(t in e))return()=>{};var n=e[t],r=i(n);return ee(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=n}}catch(e){return()=>{}}}class pt{constructor(e,t){var i;this.name="HistoryAutocapture",this._isStarted=!1,this._instance=e,this._config=t||pt.extractConfig(e.getConfig()),this._lastPathname=(null===(i=null==$?void 0:$.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=pt.extractConfig(e),this.isEnabled&&!this._isStarted?this._start():!this.isEnabled&&this._isStarted&&this.stop()}_start(){$&&D&&(this._lastPathname=D.pathname||"",this._patchHistoryMethods(),this._setupPopstateListener(),this._isStarted=!0)}_patchHistoryMethods(){var e,t;if(null==$?void 0:$.history){var i=this;(null===(e=$.history.pushState)||void 0===e?void 0:e.__vtilt_wrapped__)||gt($.history,"pushState",e=>function(t,n,r){e.call(this,t,n,r),i._capturePageview("pushState")}),(null===(t=$.history.replaceState)||void 0===t?void 0:t.__vtilt_wrapped__)||gt($.history,"replaceState",e=>function(t,n,r){e.call(this,t,n,r),i._capturePageview("replaceState")})}}_setupPopstateListener(){if(!this._popstateListener&&$){var e=()=>{this._capturePageview("popstate")};P($,"popstate",e),this._popstateListener=()=>{null==$||$.removeEventListener("popstate",e)}}}_capturePageview(e){this.isEnabled&&this._isStarted&&y(()=>{var t,i=null===(t=null==$?void 0:$.location)||void 0===t?void 0:t.pathname;if(i&&D&&q){if(i!==this._lastPathname){var n={navigation_type:e};this._instance.capture("$pageview",n)}this._lastPathname=i}})}}var ft=["a","button","form","input","select","textarea","label"],mt="$copy_autocapture",yt=['[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 bt(e){return null==e}function wt(e){return"string"==typeof e}function St(e){return void 0===e}function Ct(e){return e.replace(/^\s+|\s+$/g,"")}function xt(e,t){return e.indexOf(t)>-1}function It(e){return 1===(null==e?void 0:e.nodeType)}function kt(e){return 3===(null==e?void 0:e.nodeType)}function Et(e,t){var i;return(null===(i=null==e?void 0:e.tagName)||void 0===i?void 0:i.toLowerCase())===t}function Lt(e){return 11===(null==e?void 0:e.nodeType)}function Mt(e){return e?Ct(e).split(/\s+/):[]}function Tt(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 Mt(t)}function At(e){return bt(e)?null:Ct(e).split(/(\s+)/).filter(e=>jt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Rt(e){var t,i="";if(Wt(e)&&!Gt(e)&&e.childNodes&&e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];kt(r)&&r.textContent&&(i+=null!==(t=At(r.textContent))&&void 0!==t?t:"")}return Ct(i)}function Pt(e){var t,i="";if(e&&e.childNodes&&e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(r&&"span"===(null===(t=r.tagName)||void 0===t?void 0:t.toLowerCase()))try{i=(i+" "+Rt(r)).trim(),r.childNodes&&r.childNodes.length&&(i=(i+" "+Pt(r)).trim())}catch(e){}}return i}function Ut(e){var t=Rt(e);return jt(t=(t+" "+Pt(e)).trim())?t:""}function Ot(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!It(t));return t}function $t(e){var t=e.parentNode;return!(!t||!It(t))&&t}function zt(e){var t=null==$?void 0:$.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}var Nt="(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})",qt=new RegExp("^(?:"+Nt+")$"),Dt=new RegExp(Nt),Ft="\\d{3}-?\\d{2}-?\\d{4}",Bt=new RegExp("^("+Ft+")$"),Vt=new RegExp("("+Ft+")");function jt(e,t){if(void 0===t&&(t=!0),bt(e))return!1;if(wt(e)){if(e=Ct(e),(t?qt:Dt).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Bt:Vt).test(e))return!1}return!0}function Ht(e){return!!wt(e)&&("_ngcontent"===e.substring(0,10)||"_nghost"===e.substring(0,7))}function Wt(e){for(var t=e;t&&t.parentNode&&!Et(t,"body");t=t.parentNode){var i=Tt(t);if(xt(i,"vt-sensitive")||xt(i,"vt-no-capture"))return!1}if(xt(Tt(e),"vt-include"))return!0;var n=e.type||"";if(wt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";if(wt(r)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Gt(e){return!!(Et(e,"input")&&!["button","checkbox","submit","reset","radio"].includes(e.type)||Et(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function Jt(e){if(!Wt(e))return null;if(Et(e,"input")){var t=e,i=(t.type||"text").toLowerCase();if("password"===i||"hidden"===i)return null;if("checkbox"===i||"radio"===i){var n={$el_value:t.checked?"true":"false"},r=function(e){var t=e.closest("label");if(t){var i=Ct(t.textContent||"");if(i&&jt(i))return At(i)||null}if(e.id)try{var n=null===document||void 0===document?void 0:document.querySelector('label[for="'+e.id+'"]');if(n){var r=Ct(n.textContent||"");if(r&&jt(r))return At(r)||null}}catch(e){}return null}(t);return r?n.$selected_text=r:t.value&&jt(t.value)&&(n.$selected_text=t.value),n}var s=t.value;if(s&&jt(s)){var a=At(s);if(a)return{$el_value:a}}return null}if(Et(e,"select")){var o=e,l=o.selectedIndex;if(l>=0&&o.options[l]){var d=o.options[l],u={};d.value&&jt(d.value)&&(u.$el_value=d.value);var c=d.text;if(c&&jt(c)){var h=At(c);h&&(u.$selected_text=h)}if(u.$el_value||u.$selected_text)return u}return null}return Et(e,"textarea"),null}function Kt(e,t,i,n,r){if(void 0===i&&(i=void 0),!$||!e||Et(e,"html")||!It(e))return!1;if((null==i?void 0:i.url_allowlist)&&!zt(i.url_allowlist))return!1;if((null==i?void 0:i.url_ignorelist)&&zt(i.url_ignorelist))return!1;if(null==i?void 0:i.dom_event_allowlist){var s=i.dom_event_allowlist;if(s&&!s.some(e=>t.type===e))return!1}for(var a=!1,o=[e],l=!0,d=e;d.parentNode&&!Et(d,"body");)if(Lt(d.parentNode))o.push(d.parentNode.host),d=d.parentNode.host;else{if(!(l=$t(d)))break;if(n||ft.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var u=$.getComputedStyle(l);u&&"pointer"===u.getPropertyValue("cursor")&&(a=!0)}o.push(l),d=l}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(St(i))return!0;var n,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var s of e)if(n=r(s))return n.v;return!1}(o,i))return!1;if(!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if(St(i))return!0;var n,r=function(e){if(i.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(n=r(s))return n.v;return!1}(o,i))return!1;if(function(e,t){var i=null==t?void 0:t.css_selector_ignorelist,n=void 0===i?yt:i;if(0===n.length)return!1;for(var r of e)for(var s of n)try{if(r.matches(s))return!0}catch(e){}return!1}(o,i))return!1;var c=$.getComputedStyle(e);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(ft.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}function Qt(e,t){return t.length>e?t.slice(0,e)+"...":t}function Xt(e,t,i,n){var r=e.tagName.toLowerCase(),s={tag_name:r};ft.indexOf(r)>-1&&!i&&(s.$el_text=Qt(1024,"a"===r||"button"===r?Ut(e):Rt(e)));var a=Tt(e);a.length>0&&(s.classes=a.filter(e=>""!==e));for(var o=0;o<e.attributes.length;o++){var l=e.attributes[o];if((!Gt(e)||-1!==["name","id","class","aria-label"].indexOf(l.name))&&(!(null==n?void 0:n.includes(l.name))&&!t&&jt(l.value)&&!Ht(l.name))){var d=l.value;"class"===l.name&&(d=Mt(d).join(" ")),s["attr__"+l.name]=Qt(1024,d)}}for(var u=1,c=1,h=e;h=Ot(h);)u++,h.tagName===e.tagName&&c++;return s.nth_child=u,s.nth_of_type=c,s}function Zt(e){if(!Wt(e))return{};for(var t={},i=0;i<e.attributes.length;i++){var n=e.attributes[i];if(n.name&&0===n.name.indexOf("data-vt-capture-attribute")){var r=n.name.replace("data-vt-capture-attribute-",""),s=n.value;r&&s&&jt(s)&&(t[r]=s)}}return t}function Yt(e){return e.replace(/"|\\"/g,'\\"')}function ei(e){var t,i=e.attr__class;return i?(t=i,Array.isArray(t)?i:Mt(i)):void 0}function ti(e){return function(e){var t=e.map(e=>{var t,n,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))r+="."+s.replace(/"/g,"");var a=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Object.entries(a).sort((e,t)=>{var[i]=e,[n]=t;return i.localeCompare(n)}).forEach(e=>{var[t,i]=e;return o[Yt(t.toString())]=Yt(String(i))}),(r+=":")+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,n={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:ei(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 n.attributes[t]=i}),n})}(e))}function ii(e,t){return e.indexOf(t)>-1}class ni{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 n=this.clicks[this.clicks.length-1];Math.sqrt(Math.pow(e-n.x,2)+Math.pow(t-n.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 ri(e,t){for(var i,n,r,s,{e:a,maskAllElementAttributes:o,maskAllText:l,elementAttributeIgnoreList:d,elementsChainAsString:u,captureElementValues:c}=t,h=[e],v=e;v.parentNode&&!Et(v,"body");)Lt(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 y of h){var b=Wt(y);if("a"===y.tagName.toLowerCase()){var w=y.getAttribute("href");f=!!(b&&w&&jt(w))&&w}ii(Tt(y),"vt-no-capture")&&(m=!0),g.push(Xt(y,o,l,d));var S=Zt(y);Object.assign(p,S)}if(m)return{props:{},explicitNoCapture:m};if(l||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?g[0].$el_text=Ut(e):g[0].$el_text=Rt(e)),"change"===a.type&&c){var C=Jt(e);C&&(C.$el_value&&(g[0].$el_value=C.$el_value),C.$selected_text&&(g[0].$selected_text=C.$selected_text))}if(f){g[0].attr__href=f;var x=null===(i=X(f))||void 0===i?void 0:i.host,I=null===(n=null==$?void 0:$.location)||void 0===n?void 0:n.host;x&&I&&x!==I&&(_=f)}var k=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:a.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:ti(g)},(null===(r=g[0])||void 0===r?void 0:r.$el_text)?{$el_text:null===(s=g[0])||void 0===s?void 0:s.$el_text}:{},_&&"click"===a.type?{$external_click_url:_}:{},p);return{props:k}}class si{constructor(e){this.name="Autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._elementSelectors=null,this._rageclicks=new ni,this._elementsChainAsString=!1,this._instance=e}get _config(){var e,t=this._instance.getConfig(),i="object"!=typeof(e=t.autocapture)||null===e||Array.isArray(e)?{}:t.autocapture;return i.url_allowlist&&(i.url_allowlist=i.url_allowlist.map(e=>"string"==typeof e?new RegExp(e):e)),i.url_ignorelist&&(i.url_ignorelist=i.url_ignorelist.map(e=>"string"==typeof e?new RegExp(e):e)),i}get isEnabled(){var e,t=null!==(e=this._isDisabledServerSide)&&void 0!==e&&e;return!!this._instance.getConfig().autocapture&&!t}get isStarted(){return this._initialized}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}stop(){this._initialized=!1}onConfigUpdate(e){this.isEnabled&&!this._initialized&&this.startIfEnabled()}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}updateConfig(e){void 0!==e.enabled&&e.enabled&&(this._isDisabledServerSide=!1)}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach(t=>{var n=null==q?void 0:q.querySelectorAll(t);null==n||n.forEach(n=>{e===n&&i.push(t)})}),i}_addDomEventHandlers(){if(this._isBrowserSupported()&&$&&q){var e=e=>{e=e||(null==$?void 0:$.event);try{this._captureEvent(e)}catch(e){}};if(P(q,"submit",e,{capture:!0}),P(q,"change",e,{capture:!0}),P(q,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==$?void 0:$.event),this._captureEvent(e,mt)};P(q,"copy",t,{capture:!0}),P(q,"cut",t,{capture:!0})}}}_captureEvent(e,t){var i,n,r,s,a;if(void 0===t&&(t="$autocapture"),this.isEnabled&&e.isTrusted){var o=function(e){var t;return St(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(kt(o)&&(o=o.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()))&&this._captureEvent(e,"$rageclick");var l=t===mt;if(o&&Kt(o,e,this._config,l,l?["copy","cut"]:void 0)){var d=this._instance.getConfig(),{props:u,explicitNoCapture:c}=ri(o,{e:e,maskAllElementAttributes:null!==(n=d.mask_all_element_attributes)&&void 0!==n&&n,maskAllText:null!==(r=d.mask_all_text)&&void 0!==r&&r,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,captureElementValues:null!==(s=this._config.capture_element_values)&&void 0!==s&&s});if(c)return!1;var h=this.getElementSelectors(o);if(h&&h.length>0&&(u.$element_selectors=h),t===mt){var v=At(null===(a=null==$?void 0:$.getSelection())||void 0===a?void 0:a.toString()),_=e.type||"clipboard";if(!v)return!1;u.$selected_content=v,u.$copy_type=_}return this._instance.capture(t,u),!0}}}_isBrowserSupported(){return"function"==typeof(null==q?void 0:q.querySelectorAll)}}var ai="[SessionRecording]";class oi{constructor(e,t){this._instance=e,this.name="SessionRecording",this._isStarted=!1,this._config=t||oi.extractConfig(e.getConfig())}static extractConfig(e){var t,i,n,r=e.session_recording||{};return{enabled:null!==(t=r.enabled)&&void 0!==t&&t,sampleRate:r.sampleRate,minimumDurationMs:r.minimumDurationMs,sessionIdleThresholdMs:r.sessionIdleThresholdMs,fullSnapshotIntervalMs:r.fullSnapshotIntervalMs,captureConsole:null!==(i=r.captureConsole)&&void 0!==i&&i,captureNetwork:null!==(n=r.captureNetwork)&&void 0!==n&&n,captureCanvas:r.captureCanvas,blockClass:r.blockClass,blockSelector:r.blockSelector,ignoreClass:r.ignoreClass,maskTextClass:r.maskTextClass,maskTextSelector:r.maskTextSelector,maskAllInputs:r.maskAllInputs,maskInputOptions:r.maskInputOptions,masking:r.masking,recordHeaders:r.recordHeaders,recordBody:r.recordBody,compressEvents:r.compressEvents,__mutationThrottlerRefillRate:r.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:r.__mutationThrottlerBucketSize}}get isEnabled(){var e,t=this._instance.getConfig(),i=null!==(e=this._config.enabled)&&void 0!==e&&e,n=!t.disable_session_recording;return!!$&&i&&n}get isStarted(){var e;return this._isStarted&&!!(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.isStarted)}startIfEnabled(){this.startIfEnabledOrStop("recording_initialized")}startIfEnabledOrStop(e){var t;if(!this.isEnabled||!(null===(t=this._lazyLoadedRecording)||void 0===t?void 0:t.isStarted)){var i=void 0!==Object.assign&&void 0!==Array.from;this.isEnabled&&i?(this._lazyLoadAndStart(e),this._isStarted=!0,console.info(ai+" starting")):this.stop()}}stop(){y(()=>{var e;null===(e=this._lazyLoadedRecording)||void 0===e||e.stop(),this._isStarted=!1})}onConfigUpdate(e){var t;this._config=oi.extractConfig(e),null===(t=this._lazyLoadedRecording)||void 0===t||t.updateConfig(this._config),this.startIfEnabledOrStop("config_updated")}onRemoteConfig(e){var t,n,r,s,a,o,l;if(e.sessionRecording){var d=e.sessionRecording;this._config=i({},this._config,{enabled:null!==(t=this._config.enabled)&&void 0!==t?t:d.enabled,sampleRate:null!==(n=this._config.sampleRate)&&void 0!==n?n:d.sampleRate,minimumDurationMs:null!==(r=this._config.minimumDurationMs)&&void 0!==r?r:d.minimumDurationMs,fullSnapshotIntervalMs:null!==(s=this._config.fullSnapshotIntervalMs)&&void 0!==s?s:d.fullSnapshotIntervalMs,maskAllInputs:null!==(a=this._config.maskAllInputs)&&void 0!==a?a:d.maskAllInputs,captureConsole:null!==(o=this._config.captureConsole)&&void 0!==o?o:d.captureConsole,captureCanvas:null!==(l=this._config.captureCanvas)&&void 0!==l?l:d.captureCanvas}),this.startIfEnabledOrStop("remote_config")}}get started(){return this.isStarted}get status(){var e;return(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.status)||"lazy_loading"}get sessionId(){var e;return(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.sessionId)||""}stopRecording(){this.stop()}log(e,t){var i;void 0===t&&(t="log"),(null===(i=this._lazyLoadedRecording)||void 0===i?void 0:i.log)?this._lazyLoadedRecording.log(e,t):console.warn(ai+" log called before recorder was ready")}updateConfig(e){var t;this._config=i({},this._config,e),null===(t=this._lazyLoadedRecording)||void 0===t||t.updateConfig(this._config)}get _scriptName(){return"recorder"}_lazyLoadAndStart(e){var t,i,n,r;if(this.isEnabled)if((null===(i=null===(t=null==j?void 0:j.__VTiltExtensions__)||void 0===t?void 0:t.rrweb)||void 0===i?void 0:i.record)&&(null===(n=j.__VTiltExtensions__)||void 0===n?void 0:n.initSessionRecording))this._onScriptLoaded(e);else{var s=null===(r=j.__VTiltExtensions__)||void 0===r?void 0:r.loadExternalDependency;s?s(this._instance,this._scriptName,t=>{t?console.error(ai+" could not load recorder:",t):this._onScriptLoaded(e)}):console.error(ai+" loadExternalDependency not available. Session recording cannot start.")}}_onScriptLoaded(e){var t,i=null===(t=j.__VTiltExtensions__)||void 0===t?void 0:t.initSessionRecording;i?(this._lazyLoadedRecording||(this._lazyLoadedRecording=i(this._instance,this._config)),this._lazyLoadedRecording.start(e)):console.error(ai+" initSessionRecording not available after script load")}}var li=(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))(li||{}),di=Uint8Array,ui=Uint16Array,ci=Int32Array,hi=new di([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]),vi=new di([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]),_i=new di([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gi=function(e,t){for(var i=new ui(31),n=0;n<31;++n)i[n]=t+=1<<e[n-1];var r=new ci(i[30]);for(n=1;n<30;++n)for(var s=i[n];s<i[n+1];++s)r[s]=s-i[n]<<5|n;return{b:i,r:r}},pi=gi(hi,2),fi=pi.b,mi=pi.r;fi[28]=258,mi[258]=28;for(var yi=gi(vi,0).r,bi=new ui(32768),wi=0;wi<32768;++wi){var Si=(43690&wi)>>1|(21845&wi)<<1;Si=(61680&(Si=(52428&Si)>>2|(13107&Si)<<2))>>4|(3855&Si)<<4,bi[wi]=((65280&Si)>>8|(255&Si)<<8)>>1}var Ci=function(e,t,i){for(var n=e.length,r=0,s=new ui(t);r<n;++r)e[r]&&++s[e[r]-1];var a,o=new ui(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;if(i){a=new ui(1<<t);var l=15-t;for(r=0;r<n;++r)if(e[r])for(var d=r<<4|e[r],u=t-e[r],c=o[e[r]-1]++<<u,h=c|(1<<u)-1;c<=h;++c)a[bi[c]>>l]=d}else for(a=new ui(n),r=0;r<n;++r)e[r]&&(a[r]=bi[o[e[r]-1]++]>>15-e[r]);return a},xi=new di(288);for(wi=0;wi<144;++wi)xi[wi]=8;for(wi=144;wi<256;++wi)xi[wi]=9;for(wi=256;wi<280;++wi)xi[wi]=7;for(wi=280;wi<288;++wi)xi[wi]=8;var Ii=new di(32);for(wi=0;wi<32;++wi)Ii[wi]=5;var ki=Ci(xi,9,0),Ei=Ci(Ii,5,0),Li=function(e){return(e+7)/8|0},Mi=function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new di(e.subarray(t,i))},Ti=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8},Ai=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8,e[n+2]|=i>>16},Ri=function(e,t){for(var i=[],n=0;n<e.length;++n)e[n]&&i.push({s:n,f:e[n]});var r=i.length,s=i.slice();if(!r)return{t:qi,l:0};if(1==r){var a=new di(i[0].s+1);return a[i[0].s]=1,{t:a,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!=r-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=s[0].s;for(n=1;n<r;++n)s[n].s>h&&(h=s[n].s);var v=new ui(h+1),_=Pi(i[u-1],v,0);if(_>t){n=0;var g=0,p=_-t,f=1<<p;for(s.sort(function(e,t){return v[t.s]-v[e.s]||e.f-t.f});n<r;++n){var m=s[n].s;if(!(v[m]>t))break;g+=f-(1<<_-v[m]),v[m]=t}for(g>>=p;g>0;){var y=s[n].s;v[y]<t?g-=1<<t-v[y]++-1:++n}for(;n>=0&&g;--n){var b=s[n].s;v[b]==t&&(--v[b],++g)}_=t}return{t:new di(v),l:_}},Pi=function(e,t,i){return-1==e.s?Math.max(Pi(e.l,t,i+1),Pi(e.r,t,i+1)):t[e.s]=i},Ui=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ui(++t),n=0,r=e[0],s=1,a=function(e){i[n++]=e},o=1;o<=t;++o)if(e[o]==r&&o!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(r),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(r);s=1,r=e[o]}return{c:i.subarray(0,n),n:t}},Oi=function(e,t){for(var i=0,n=0;n<t.length;++n)i+=e[n]*t[n];return i},$i=function(e,t,i){var n=i.length,r=Li(t+2);e[r]=255&n,e[r+1]=n>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var s=0;s<n;++s)e[r+s+4]=i[s];return 8*(r+4+n)},zi=function(e,t,i,n,r,s,a,o,l,d,u){Ti(t,u++,i),++r[256];for(var c=Ri(r,15),h=c.t,v=c.l,_=Ri(s,15),g=_.t,p=_.l,f=Ui(h),m=f.c,y=f.n,b=Ui(g),w=b.c,S=b.n,C=new ui(19),x=0;x<m.length;++x)++C[31&m[x]];for(x=0;x<w.length;++x)++C[31&w[x]];for(var I=Ri(C,7),k=I.t,E=I.l,L=19;L>4&&!k[_i[L-1]];--L);var M,T,A,R,P=d+5<<3,U=Oi(r,xi)+Oi(s,Ii)+a,O=Oi(r,h)+Oi(s,g)+a+14+3*L+Oi(C,k)+2*C[16]+3*C[17]+7*C[18];if(l>=0&&P<=U&&P<=O)return $i(t,u,e.subarray(l,l+d));if(Ti(t,u,1+(O<U)),u+=2,O<U){M=Ci(h,v,0),T=h,A=Ci(g,p,0),R=g;var $=Ci(k,E,0);Ti(t,u,y-257),Ti(t,u+5,S-1),Ti(t,u+10,L-4),u+=14;for(x=0;x<L;++x)Ti(t,u+3*x,k[_i[x]]);u+=3*L;for(var z=[m,w],N=0;N<2;++N){var q=z[N];for(x=0;x<q.length;++x){var D=31&q[x];Ti(t,u,$[D]),u+=k[D],D>15&&(Ti(t,u,q[x]>>5&127),u+=q[x]>>12)}}}else M=ki,T=xi,A=Ei,R=Ii;for(x=0;x<o;++x){var F=n[x];if(F>255){Ai(t,u,M[(D=F>>18&31)+257]),u+=T[D+257],D>7&&(Ti(t,u,F>>23&31),u+=hi[D]);var B=31&F;Ai(t,u,A[B]),u+=R[B],B>3&&(Ai(t,u,F>>5&8191),u+=vi[B])}else Ai(t,u,M[F]),u+=T[F]}return Ai(t,u,M[256]),u+T[256]},Ni=new ci([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),qi=new di(0),Di=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,n=9;--n;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),Fi=function(e,t,i,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new di(s.length+e.length);a.set(s),a.set(e,s.length),e=a,r.w=s.length}return function(e,t,i,n,r,s){var a=s.z||e.length,o=new di(n+a+5*(1+Math.ceil(a/7e3))+r),l=o.subarray(n,o.length-r),d=s.l,u=7&(s.r||0);if(t){u&&(l[0]=s.r>>3);for(var c=Ni[t-1],h=c>>13,v=8191&c,_=(1<<i)-1,g=s.p||new ui(32768),p=s.h||new ui(_+1),f=Math.ceil(i/3),m=2*f,y=function(t){return(e[t]^e[t+1]<<f^e[t+2]<<m)&_},b=new ci(25e3),w=new ui(288),S=new ui(32),C=0,x=0,I=s.i||0,k=0,E=s.w||0,L=0;I+2<a;++I){var M=y(I),T=32767&I,A=p[M];if(g[T]=A,p[M]=T,E<=I){var R=a-I;if((C>7e3||k>24576)&&(R>423||!d)){u=zi(e,l,0,b,w,S,x,k,L,I-L,u),k=C=x=0,L=I;for(var P=0;P<286;++P)w[P]=0;for(P=0;P<30;++P)S[P]=0}var U=2,O=0,$=v,z=T-A&32767;if(R>2&&M==y(I-z))for(var N=Math.min(h,R)-1,q=Math.min(32767,I),D=Math.min(258,R);z<=q&&--$&&T!=A;){if(e[I+U]==e[I+U-z]){for(var F=0;F<D&&e[I+F]==e[I+F-z];++F);if(F>U){if(U=F,O=z,F>N)break;var B=Math.min(z,F-2),V=0;for(P=0;P<B;++P){var j=I-z+P&32767,H=j-g[j]&32767;H>V&&(V=H,A=j)}}}z+=(T=A)-(A=g[T])&32767}if(O){b[k++]=268435456|mi[U]<<18|yi[O];var W=31&mi[U],G=31&yi[O];x+=hi[W]+vi[G],++w[257+W],++S[G],E=I+U,++C}else b[k++]=e[I],++w[e[I]]}}for(I=Math.max(I,E);I<a;++I)b[k++]=e[I],++w[e[I]];u=zi(e,l,d,b,w,S,x,k,L,I-L,u),d||(s.r=7&u|l[u/8|0]<<3,u-=7,s.h=p,s.p=g,s.i=I,s.w=E)}else{for(I=s.w||0;I<a+d;I+=65535){var J=I+65535;J>=a&&(l[u/8|0]=d,J=a),u=$i(l,u+1,e.subarray(I,J))}s.i=a}return Mi(o,0,n+Li(u)+r)}(e,null==t.level?6:t.level,null==t.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,n,r)},Bi=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Vi(e,t){t||(t={});var i=function(){var e=-1;return{p:function(t){for(var i=e,n=0;n<t.length;++n)i=Di[255&i^t[n]]^i>>>8;e=i},d:function(){return~e}}}(),n=e.length;i.p(e);var r,s=Fi(e,t,10+((r=t).filename?r.filename.length+1:0),8),a=s.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&&Bi(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var n=0;n<=i.length;++n)e[n+10]=i.charCodeAt(n)}}(s,t),Bi(s,a-8,i.d()),Bi(s,a-4,n),s}var ji="undefined"!=typeof TextEncoder&&new TextEncoder,Hi="undefined"!=typeof TextDecoder&&new TextDecoder;try{Hi.decode(qi,{stream:!0})}catch(e){}li.MouseMove,li.MouseInteraction,li.Scroll,li.ViewportResize,li.Input,li.TouchMove,li.MediaInteraction,li.Drag;var Wi="[Chat]";class Gi{constructor(e,t){this._instance=e,this.name="Chat",this._serverConfig=null,this._configFetched=!1,this._isLoading=!1,this._isStarted=!1,this._loadError=null,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[],this._config=t||Gi.extractConfig(e.getConfig())}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}}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))}get isStarted(){return this._isStarted}startIfEnabled(){this._startAsync().catch(e=>{console.error(Wi+" Error starting:",e)})}stop(){this.destroy(),this._isStarted=!1}onConfigUpdate(e){var t,i;this._config=Gi.extractConfig(e),this._lazyLoadedChat&&(null===(i=(t=this._lazyLoadedChat).updateConfig)||void 0===i||i.call(t,this.getMergedConfig()))}onRemoteConfig(e){var t,n,r,s,a,o,l,d,u;e.chat&&(this._serverConfig=i({},this._serverConfig,{enabled:null!==(r=null!==(t=e.chat.enabled)&&void 0!==t?t:null===(n=this._serverConfig)||void 0===n?void 0:n.enabled)&&void 0!==r&&r,position:null!==(o=null!==(s=e.chat.widgetPosition)&&void 0!==s?s:null===(a=this._serverConfig)||void 0===a?void 0:a.position)&&void 0!==o?o:"bottom-right",color:null!==(u=null!==(l=e.chat.widgetColor)&&void 0!==l?l:null===(d=this._serverConfig)||void 0===d?void 0:d.color)&&void 0!==u?u:"#6366f1"}),this.isEnabled&&!this._isStarted&&this.startIfEnabled())}_startAsync(){var e=this;return t(function*(){var t,i,n,r;!1!==e._config.enabled?e._instance.getConfig().disable_chat?console.info(Wi+" disabled by disable_chat config"):(!1!==e._config.autoConfig&&(yield e._fetchServerSettings()),e.isEnabled?(e._isStarted=!0,null!==(n=null!==(t=e._config.preload)&&void 0!==t?t:null===(i=e._serverConfig)||void 0===i?void 0:i.enabled)&&void 0!==n&&n&&e._schedulePreload(),(null===(r=e._serverConfig)||void 0===r?void 0:r.enabled)&&e._showBubble(),console.info(Wi+" ready (lazy-load on demand)")):console.info(Wi+" not enabled (check dashboard settings)")):console.info(Wi+" disabled by code config")})()}get isOpen(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isOpen)&&void 0!==t&&t}get isConnected(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isConnected)&&void 0!==t&&t}get isLoading(){var e,t;return this._isLoading||null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isLoading)&&void 0!==t&&t}get unreadCount(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.unreadCount)&&void 0!==t?t:0}get channel(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.channel)&&void 0!==t?t:null}get channels(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.channels)&&void 0!==t?t:[]}get currentView(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.currentView)&&void 0!==t?t:"list"}open(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.open()})}close(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.close()}toggle(){this._lazyLoadedChat?this._lazyLoadedChat.toggle():this.open()}show(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.show()})}hide(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.hide()}getChannels(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.getChannels()})}selectChannel(e){this._lazyLoadAndThen(()=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.selectChannel(e)})}createChannel(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.createChannel()})}goToChannelList(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.goToChannelList()}sendMessage(e){this._lazyLoadedChat?this._lazyLoadedChat.sendMessage(e):(this._pendingMessages.push(e),this._lazyLoadAndThen(()=>{this._pendingMessages.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.sendMessage(e)}),this._pendingMessages=[]}))}markAsRead(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.markAsRead()}onMessage(e){return this._messageCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onMessage(e):()=>{var t=this._messageCallbacks.indexOf(e);t>-1&&this._messageCallbacks.splice(t,1)}}onTyping(e){return this._typingCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onTyping(e):()=>{var t=this._typingCallbacks.indexOf(e);t>-1&&this._typingCallbacks.splice(t,1)}}onConnectionChange(e){return this._connectionCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onConnectionChange(e):()=>{var t=this._connectionCallbacks.indexOf(e);t>-1&&this._connectionCallbacks.splice(t,1)}}updateConfig(e){this._config=i({},this._config,e)}getMergedConfig(){var e,t,i,n,r,s,a,o,l,d,u,c,h,v,_,g,p,f,m=this._serverConfig,y=this._config;return{enabled:null!==(t=null!==(e=y.enabled)&&void 0!==e?e:null==m?void 0:m.enabled)&&void 0!==t&&t,autoConfig:null===(i=y.autoConfig)||void 0===i||i,position:null!==(r=null!==(n=y.position)&&void 0!==n?n:null==m?void 0:m.position)&&void 0!==r?r:"bottom-right",greeting:null!==(s=y.greeting)&&void 0!==s?s:null==m?void 0:m.greeting,color:null!==(o=null!==(a=y.color)&&void 0!==a?a:null==m?void 0:m.color)&&void 0!==o?o:"#6366f1",aiMode:null===(d=null!==(l=y.aiMode)&&void 0!==l?l:null==m?void 0:m.ai_enabled)||void 0===d||d,aiGreeting:null!==(u=y.aiGreeting)&&void 0!==u?u:null==m?void 0:m.ai_greeting,preload:null!==(c=y.preload)&&void 0!==c&&c,theme:null!==(h=y.theme)&&void 0!==h?h:{primaryColor:null!==(_=null!==(v=y.color)&&void 0!==v?v:null==m?void 0:m.color)&&void 0!==_?_:"#6366f1"},offlineMessage:null!==(g=y.offlineMessage)&&void 0!==g?g:null==m?void 0:m.offline_message,collectEmailOffline:null===(f=null!==(p=y.collectEmailOffline)&&void 0!==p?p:null==m?void 0:m.collect_email_offline)||void 0===f||f}}destroy(){y(()=>{var e,t;null===(e=this._lazyLoadedChat)||void 0===e||e.destroy(),this._lazyLoadedChat=void 0,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[];var i=null===(t=null==$?void 0:$.document)||void 0===t?void 0:t.getElementById("vtilt-chat-bubble");i&&i.remove()})}_fetchServerSettings(){var e=this;return t(function*(){if(!e._configFetched){var t=e._instance.getConfig(),i=t.token,n=t.api_host;if(!i||!n)return console.warn(Wi+" Cannot fetch settings: missing token or api_host"),void(e._configFetched=!0);try{var r=n+"/api/chat/settings?token="+encodeURIComponent(i),s=yield fetch(r);if(!s.ok)return console.warn(Wi+" Failed to fetch settings: "+s.status),void(e._configFetched=!0);e._serverConfig=yield s.json(),e._configFetched=!0,console.info(Wi+" Loaded settings from dashboard")}catch(t){console.warn(Wi+" Error fetching settings:",t),e._configFetched=!0}}})()}_showBubble(){if((null==$?void 0:$.document)&&!document.getElementById("vtilt-chat-bubble")){var e=this.getMergedConfig(),t=e.position||"bottom-right",i=e.color||"#6366f1",n=document.createElement("div");n.id="vtilt-chat-bubble",n.setAttribute("style",("\n position: fixed;\n bottom: 20px;\n "+("bottom-right"===t?"right: 20px;":"left: 20px;")+"\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+i+";\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()),n.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 ',n.addEventListener("mouseenter",()=>{n.style.transform="scale(1.05)",n.style.boxShadow="0 6px 16px rgba(0, 0, 0, 0.2)"}),n.addEventListener("mouseleave",()=>{n.style.transform="scale(1)",n.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}),n.addEventListener("click",()=>{this.open()}),document.body.appendChild(n)}}get _scriptName(){return"chat"}_schedulePreload(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this._lazyLoad(),{timeout:5e3}):setTimeout(()=>this._lazyLoad(),3e3)}_lazyLoadAndThen(e){this._lazyLoadedChat?e():(this._pendingCallbacks.push(e),this._lazyLoad())}_lazyLoad(){var e,t;if(!(this._isLoading||this._lazyLoadedChat||this._loadError))if(null===(e=j.__VTiltExtensions__)||void 0===e?void 0:e.initChat)this._onScriptLoaded();else{this._isLoading=!0;var i=null===(t=j.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;if(!i)return console.error(Wi+" loadExternalDependency not available. Chat cannot start."),this._isLoading=!1,void(this._loadError="loadExternalDependency not available");i(this._instance,this._scriptName,e=>{if(this._isLoading=!1,e)return console.error(Wi+" Failed to load:",e),void(this._loadError=String(e));this._onScriptLoaded()})}}_onScriptLoaded(){var e,t=null===(e=j.__VTiltExtensions__)||void 0===e?void 0:e.initChat;if(!t)return console.error(Wi+" initChat not available after script load"),void(this._loadError="initChat not available");if(!this._lazyLoadedChat){var i=this.getMergedConfig();this._lazyLoadedChat=t(this._instance,i),this._messageCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onMessage(e)}),this._typingCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onTyping(e)}),this._connectionCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onConnectionChange(e)});var n=null===document||void 0===document?void 0:document.getElementById("vtilt-chat-bubble");n&&n.remove()}this._pendingCallbacks.forEach(e=>e()),this._pendingCallbacks=[],console.info(Wi+" loaded and ready")}}var Ji="[VtdOverlay]";class Ki{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||Ki.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&&y(()=>{this._destroyOverlay(),this._isStarted=!1})}onConfigUpdate(e){this._config=Ki.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 n=this._toEmbedUrl(i);this._originalUrl=i,this._destinationUrl=n,this._isLoading=!0,this._showOverlay(),this._isStarted=!0,this._instance.capture("$vtd_view",{$vtd_url:i,$vtd_embed_url:n!==i?n:void 0,$current_url:null===(t=null==$?void 0:$.location)||void 0===t?void 0:t.href})}else console.warn(Ji+" Invalid URL: "+i)}else console.warn(Ji+" Empty URL provided");else console.warn(Ji+" 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 n=t.searchParams.get("v");if(n){var r=t.searchParams.get("t"),s="https://www.youtube.com/embed/"+n+"?autoplay=1";return r&&(s+="&start="+r.replace("s","")),s}}if("youtu.be"===i){var a=t.pathname.slice(1);if(a){var o=t.searchParams.get("t"),l="https://www.youtube.com/embed/"+a+"?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(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 n=()=>{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=n,this._iframe.onerror=n,setTimeout(()=>{this._isLoading&&n()},5e3),i.appendChild(this._iframe),this._iframe.src=this._destinationUrl,e.appendChild(i),this._container.appendChild(e);var r=q.createElement("style");r.id="vtilt-vtd-styles",r.textContent=this._getGlobalStyles(),q.head.appendChild(r),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,n=null===(e=this._container)||void 0===e?void 0:e.querySelector(".vtilt-vtd-close");null==n||n.addEventListener("click",()=>this.close());var r=null===(t=this._container)||void 0===t?void 0:t.querySelector(".vtilt-vtd-open");null==r||r.addEventListener("click",()=>{this._originalUrl&&(null==$||$.open(this._originalUrl,"_blank"))}),null===(i=this._container)||void 0===i||i.addEventListener("click",e=>{e.target===this._container&&this.close()});var s=e=>{"Escape"===e.key&&(this.close(),null==q||q.removeEventListener("keydown",s))};null==q||q.addEventListener("keydown",s)}_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 Qi,Xi="text/plain";!function(e){e.GZipJS="gzip-js",e.None="none"}(Qi||(Qi={}));var Zi=e=>{var{data:t,compression:i}=e;if(t){var n=(e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t))(t),r=new Blob([n]).size;if(i===Qi.GZipJS&&r>=1024)try{var s=Vi(function(e,t){if(ji)return ji.encode(e);for(var i=e.length,n=new di(e.length+(e.length>>1)),r=0,s=function(e){n[r++]=e},a=0;a<i;++a){if(r+5>n.length){var o=new di(r+8+(i-a<<1));o.set(n),n=o}var l=e.charCodeAt(a);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return Mi(n,0,r)}(n),{mtime:0}),a=new Blob([s],{type:Xi});if(a.size<.95*r)return{contentType:Xi,body:a,estimatedSize:a.size}}catch(e){}return{contentType:"application/json",body:n,estimatedSize:r}}},Yi=[{name:"fetch",available:"undefined"!=typeof fetch,method:e=>{var n=Zi(e);if(n){var{contentType:r,body:s,estimatedSize:a}=n,o=e.compression===Qi.GZipJS&&r===Xi?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url,l=i({"Content-Type":r},e.headers||{}),d=new AbortController,u=e.timeout?setTimeout(()=>d.abort(),e.timeout):null;fetch(o,{method:e.method||"POST",headers:l,body:s,keepalive:a<52428.8,signal:d.signal}).then(function(){var i=t(function*(t){var i,n=yield t.text(),r={statusCode:t.status,text:n};if(200===t.status)try{r.json=JSON.parse(n)}catch(e){}null===(i=e.callback)||void 0===i||i.call(e,r)});return function(e){return i.apply(this,arguments)}}()).catch(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})}).finally(()=>{u&&clearTimeout(u)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:e=>{var t=Zi(e);if(t){var{contentType:i,body:n}=t,r=e.compression===Qi.GZipJS&&i===Xi?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url,s=new XMLHttpRequest;s.open(e.method||"POST",r,!0),e.headers&&Object.entries(e.headers).forEach(e=>{var[t,i]=e;s.setRequestHeader(t,i)}),s.setRequestHeader("Content-Type",i),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)try{i.json=JSON.parse(s.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,i)}},s.onerror=()=>{var t;null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})},s.send(n)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:e=>{var t=Zi(e);if(t){var{contentType:i,body:n}=t;try{var r="string"==typeof n?new Blob([n],{type:i}):n,s=e.compression===Qi.GZipJS&&i===Xi?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url;navigator.sendBeacon(s,r)}catch(e){}}}}],en=e=>{var t,i=e.transport||"fetch",n=Yi.find(e=>e.name===i&&e.available)||Yi.find(e=>e.available);if(!n)return console.error("vTilt: No available transport method"),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0}));n.method(e)};class tn{constructor(e,t){var i,n,r,s;this._isPaused=!0,this._queue=[],this._flushTimeoutMs=(i=(null==t?void 0:t.flush_interval_ms)||3e3,n=250,r=5e3,s=3e3,"number"!=typeof i||isNaN(i)?s:Math.min(Math.max(i,n),r)),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 n=e[t];this._sendRequest(i({},n,{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 n=e[i];n.events.forEach(e=>{var i=new Date(e.timestamp).getTime();e.$offset=Math.abs(i-t)}),this._sendRequest(n)}}}_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 nn{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._areWeOnline=!0,this._sendRequest=e.sendRequest,this._sendBeacon=e.sendBeacon,$&&void 0!==N&&"onLine"in N&&(this._areWeOnline=N.onLine,P($,"online",()=>{this._areWeOnline=!0,this._flush()}),P($,"offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}enqueue(e,t){if(void 0===t&&(t=0),t>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,n=Math.min(18e5,t),r=(Math.random()-.5)*(n-i);return Math.ceil(n+r)}(t),n=Date.now()+i;this._queue.push({retryAt:n,request:e,retriesPerformedSoFar:t+1});var r="VTilt: Enqueued failed request for retry in "+Math.round(i/1e3)+"s";this._areWeOnline||(r+=" (Browser is offline)"),console.warn(r),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(),n=[],r=[];this._queue.forEach(e=>{e.retryAt<i?r.push(e):n.push(e)}),this._queue=n,r.forEach(function(){var i=t(function*(t){var{request:i,retriesPerformedSoFar:n}=t;try{var r=yield e._sendRequest(i);200!==r.statusCode&&(r.statusCode<400||r.statusCode>=500)&&e.enqueue(i,n)}catch(t){e.enqueue(i,n)}});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){console.error("VTilt: Failed to send beacon on unload",e)}}),this._queue=[]}}var rn="vt_rate_limit";class sn{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,n,r;void 0===e&&(e=!1);var s=Date.now(),a=null!==(i=null===(t=this.persistence)||void 0===t?void 0:t.get(rn))&&void 0!==i?i:{tokens:this.eventsBurstLimit,last:s},o=(s-a.last)/1e3;a.tokens+=o*this.eventsPerSecond,a.last=s,a.tokens>this.eventsBurstLimit&&(a.tokens=this.eventsBurstLimit);var l=a.tokens<1;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||null===(n=this.captureWarning)||void 0===n||n.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=l,null===(r=this.persistence)||void 0===r||r.set(rn,a),{isRateLimited:l,remainingTokens:a.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class an{constructor(e){this._remoteConfig=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(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 i=y(()=>$.__VTILT_BOOTSTRAP__);if(null==i?void 0:i.remoteConfig)return this._remoteConfig=i.remoteConfig,this._apply(this._remoteConfig),void this._fetch();y(()=>{var e=localStorage.getItem(u+"_"+t.token);e&&(this._remoteConfig=JSON.parse(e),this._apply(this._remoteConfig))}),this._fetch()}}_fetch(){var e=this._host.getConfig();if(e.token&&e.api_host){var t=e.api_host+"/api/decide?token="+e.token,i=new AbortController,n=setTimeout(()=>i.abort(),3e3);(F||fetch)(t,{method:"GET",signal:i.signal,headers:{Accept:"application/json"}}).then(e=>e.json()).then(t=>{var i;clearTimeout(n),this._remoteConfig=t,y(()=>{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)})}}_apply(e){var t,i,n,r,s,a,o,l,d,u=this._host.getConfig(),c={},h=!1,v=!1,_=!1;e.sessionRecording&&void 0===u.session_recording&&(c.session_recording={enabled:e.sessionRecording.enabled,sampleRate:e.sessionRecording.sampleRate,minimumDurationMs:e.sessionRecording.minimumDurationMs,fullSnapshotIntervalMs:e.sessionRecording.fullSnapshotIntervalMs,maskAllInputs:e.sessionRecording.maskAllInputs,captureConsole:e.sessionRecording.captureConsole,captureCanvas:e.sessionRecording.captureCanvas},e.sessionRecording.enabled&&(h=!0)),(null===(t=e.chat)||void 0===t?void 0:t.enabled)&&void 0===u.chat&&(c.chat={enabled:e.chat.enabled,position:e.chat.widgetPosition,color:e.chat.widgetColor},v=!0),e.analytics&&(void 0!==e.analytics.capturePageview&&void 0===u.capture_pageview&&(c.capture_pageview=e.analytics.capturePageview),void 0!==e.analytics.capturePageleave&&void 0===u.capture_pageleave&&(c.capture_pageleave=!!e.analytics.capturePageleave),void 0!==e.analytics.capturePerformance&&void 0===u.capture_performance&&(c.capture_performance=e.analytics.capturePerformance),void 0!==e.analytics.autocapture&&void 0===u.autocapture&&(c.autocapture=e.analytics.autocapture,e.analytics.autocapture&&(_=!0))),void 0!==(null===(i=e.privacy)||void 0===i?void 0:i.respectDnt)&&void 0===u.respect_dnt&&(c.respect_dnt=e.privacy.respectDnt),Object.keys(c).length>0&&this._host.updateConfig(c),null===(n=this._onApply)||void 0===n||n.call(this,e),this._host.__loaded&&(h&&(null===(s=(r=this._host).startSessionRecording)||void 0===s||s.call(r)),v&&(null===(o=(a=this._host)._initChat)||void 0===o||o.call(a)),_&&(null===(d=(l=this._host).startAutocapture)||void 0===d||d.call(l)))}}class on{constructor(e){this._set_once_properties_sent=!1,this._initial_pageview_captured=!1,this._visibility_state_listener=null,this._vt_person_id=null,this._host=e}setVtPersonId(e){this._vt_person_id=e}capture(e,t,n){var r;if(this._host.sessionManager.setSessionId(),(null==N?void 0:N.userAgent)&&function(e){return!(e&&"string"==typeof e&&e.length>500)}(N.userAgent)&&((null==n?void 0:n.skip_client_rate_limiting)||this._host.rateLimiter.shouldAllowEvent())){var s,a=this._host.buildUrl(),o=this._host.getConfig(),l=this._buildEventPayload(e,t);if(!1!==o.stringifyPayload){if(!A(s=JSON.stringify(i({},l,o.globalAttributes))))return}else if(s=i({},l,o.globalAttributes),!A(JSON.stringify(s)))return;var d="$identify"===e?this._host.userManager.getAnonymousId():null!==(r=this._host.userManager.getDistinctId())&&void 0!==r?r:this._host.userManager.getAnonymousId(),u={timestamp:(new Date).toISOString(),event:e,payload:s,distinct_id:d,anonymous_id:this._host.userManager.getAnonymousId()};this._host.sendRequest(a,u,!0)}}captureInternal(e,t){this.capture(e,t,{skip_client_rate_limiting:!0})}trackEvent(e,t){void 0===t&&(t={}),this.capture(e,t)}captureInitialPageview(){q&&("visible"===q.visibilityState?this._initial_pageview_captured||(this._initial_pageview_captured=!0,setTimeout(()=>{q&&D&&this.capture("$pageview",{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(),P(q,"visibilitychange",this._visibility_state_listener)))}_buildEventPayload(e,t){var n=dt(),r=this._host.userManager.getUserProperties(),s=this._host.userManager.get_initial_props(),a=this._host.sessionManager.getSessionId(),o=this._host.sessionManager.getWindowId(),l=this._host.userManager.getAnonymousId(),d={};!this._set_once_properties_sent&&Object.keys(s).length>0&&Object.assign(d,s),t.$set_once&&Object.assign(d,t.$set_once);var u=i({},n,r,{$session_id:a,$window_id:o},l?{$anon_distinct_id:l}:{},this._vt_person_id?{$vt:this._vt_person_id}:{},Object.keys(d).length>0?{$set_once:d}:{},t.$set?{$set:t.$set}:{},t);return!this._set_once_properties_sent&&Object.keys(s).length>0&&(this._set_once_properties_sent=!0),"$pageview"===e&&q&&(u.title=q.title),u}}class ln{constructor(e){this._host=e}identify(e,t,i){var n,r;if("number"==typeof e&&(e=String(e),console.warn("identify: first argument should be a string, not a number")),e)if(this._host.userManager.isDistinctIdStringLikePublic(e))console.error('identify: "'+e+'" appears to be a hardcoded string');else if("COOKIELESS_SENTINEL_VALUE"!==e){var s=this._host.userManager.getDistinctId(),a=this._host.userManager.getAnonymousId(),o=this._host.userManager.getDeviceId(),l="anonymous"===this._host.userManager.getUserState();o||this._host.userManager.ensureDeviceId(s||a),e!==s&&l?(this._host.userManager.setUserState("identified"),this._host.userManager.updateUserProperties(t,i),this._host.capture("$identify",{distinct_id:e,$anon_distinct_id:a,$set:t||{},$set_once:i||{}}),this._host.userManager.setDistinctId(e),null===(n=this._host._emitter)||void 0===n||n.emit("user:identified",{distinctId:e})):e!==s?(this._host.userManager.setUserState("identified"),this._host.userManager.setDistinctId(e),this._host.userManager.updateUserProperties(t,i),this._host.capture("$identify",{distinct_id:e,$anon_distinct_id:a,$set:t||{},$set_once:i||{}}),null===(r=this._host._emitter)||void 0===r||r.emit("user:identified",{distinctId:e})):(t||i)&&(l&&this._host.userManager.setUserState("identified"),this._host.userManager.updateUserProperties(t,i),this._host.capture("$set",{$set:t||{},$set_once:i||{}}))}else console.error("identify: cannot use sentinel value as distinct_id");else console.error("identify: unique user id is required")}setUserProperties(e,t){var i;this._host.userManager.setUserProperties(e,t)&&(this._host.capture("$set",{$set:e||{},$set_once:t||{}}),null===(i=this._host._emitter)||void 0===i||i.emit("user:properties_set",{properties:e}))}resetUser(e){var t;this._host.sessionManager.resetSessionId(),this._host.userManager.reset(e),null===(t=this._host._emitter)||void 0===t||t.emit("user:reset")}createAlias(e,t){var i=this._host.userManager.createAlias(e,t);i?this._host.capture("$alias",{$original_id:i.original,$alias_id:i.distinct_id}):e===(t||this._host.userManager.getDistinctId()||this._host.userManager.getAnonymousId())&&this.identify(e)}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()}}class dn{constructor(e){this._features=new Map,this._host=e}onFeatureStarted(e){this._onFeatureStarted=e}onFeatureStopped(e){this._onFeatureStopped=e}register(e){this._features.set(e.name,e)}get(e){var t;return null===(t=this._features.get(e))||void 0===t?void 0:t.instance}initAll(){this._features.forEach(e=>{this._initFeature(e)})}init(e){var t=this._features.get(e);if(t)return this._initFeature(t),t.instance}start(e){var t,i=this._features.get(e);if(i&&(i.instance||this._initFeature(i),i.instance)){if(i.instance.onConfigUpdate){var n=this._host.getConfig();i.instance.onConfigUpdate(n)}i.instance.startIfEnabled(),null===(t=this._onFeatureStarted)||void 0===t||t.call(this,e)}}stop(e){var t,i=this._features.get(e);(null==i?void 0:i.instance)&&(i.instance.stop(),null===(t=this._onFeatureStopped)||void 0===t||t.call(this,e))}isActive(e){var t,i,n;return null!==(n=null===(i=null===(t=this._features.get(e))||void 0===t?void 0:t.instance)||void 0===i?void 0:i.isStarted)&&void 0!==n&&n}notifyConfigUpdate(e){this._features.forEach(t=>{var i;(null===(i=t.instance)||void 0===i?void 0:i.onConfigUpdate)&&y(()=>t.instance.onConfigUpdate(e))})}notifyRemoteConfig(e){this._features.forEach(t=>{var i;(null===(i=t.instance)||void 0===i?void 0:i.onRemoteConfig)&&y(()=>t.instance.onRemoteConfig(e))})}getAll(){var e=[];return this._features.forEach(t=>{t.instance&&e.push(t.instance)}),e}_initFeature(e){if(!e.instance){var t=this._host.getConfig();e.disableKey&&t[e.disableKey]||e.enableKey&&!1===t[e.enableKey]||y(()=>{var t;e.instance=new e.FeatureClass(this._host),e.instance.startIfEnabled(),e.instance.isStarted&&(null===(t=this._onFeatureStarted)||void 0===t||t.call(this,e.name))})}}}var un="vt",cn=Array.isArray;class hn{constructor(e){void 0===e&&(e={}),this.version=n,this.__loaded=!1,this.__request_queue=[],this._has_warned_about_config=!1,this._emitter=new b,this.configManager=new m(e);var t=this.configManager.getConfig();this.sessionManager=new Q(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new ut(t.persistence||"localStorage+cookie",t.cross_subdomain_cookie),this.rateLimiter=new sn({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:e=>{this._captureManager.captureInternal("$$client_ingestion_warning",{$$client_ingestion_warning_message:e})}}),this.retryQueue=new nn({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._captureManager=new on(this),this._identityManager=new ln(this),this._remoteConfigManager=new an(this),this._featureManager=new dn(this),this._remoteConfigManager.onApply(e=>{this._featureManager.notifyRemoteConfig(e)}),this._remoteConfigManager.onLoad(e=>{this._emitter.emit(C,{config:e})}),this._featureManager.onFeatureStarted(e=>{this._emitter.emit(x,{feature:e})}),this._featureManager.onFeatureStopped(e=>{this._emitter.emit(I,{feature:e})})}init(e,t,i){var n;if(i&&i!==un){var r=null!==(n=vn[i])&&void 0!==n?n:new hn;return r._init(e,t,i),vn[i]=r,vn[un][i]=r,r}return this._init(e,t,i)}_init(e,t,n){if(void 0===t&&(t={}),this.__loaded)return console.warn("vTilt: Already initialized! Re-initializing is a no-op"),this;this.updateConfig(i({},t,{token:e||t.token,name:n})),this.__loaded=!0,this._read_vt_param_from_url(),this._remoteConfigManager.load();var r=this.configManager.getConfig();return this.userManager.set_initial_person_info(r.mask_personal_data_properties,r.custom_personal_data_properties),this._initFeatures(),this._setup_unload_handler(),this._start_queue_if_opted_in(),!1!==r.capture_pageview&&this._captureManager.captureInitialPageview(),this._emitter.emit(w,{config:r}),this}_initFeatures(){this._initHistoryAutocapture(),this._initAutocapture(),this._initWebVitals(),this._initSessionRecording(),this._initChat()}_initHistoryAutocapture(){this.historyAutocapture||(this.historyAutocapture=new pt(this),this.historyAutocapture.startIfEnabled())}_initAutocapture(){this.autocapture||!1!==this.configManager.getConfig().autocapture&&(this.autocapture=new si(this),this.autocapture.startIfEnabled())}_initWebVitals(){this.webVitals||(this.webVitals=new _t(this),this.webVitals.startIfEnabled())}_initSessionRecording(){this.sessionRecording||(this.configManager.getConfig().disable_session_recording||(this.sessionRecording=new oi(this),this.sessionRecording.isEnabled&&(this.sessionRecording.startIfEnabledOrStop("recording_initialized"),this._emitter.emit(E))))}_initChat(){this.chat||(this.configManager.getConfig().disable_chat||(this.chat=new Gi(this),this.chat.startIfEnabled()))}startAutocapture(){this.autocapture||(this.autocapture=new si(this)),this.autocapture.updateConfig({enabled:!0}),this.autocapture.startIfEnabled()}stopAutocapture(){var e;null===(e=this.autocapture)||void 0===e||e.stop()}isAutocaptureActive(){var e,t;return null!==(t=null===(e=this.autocapture)||void 0===e?void 0:e.isStarted)&&void 0!==t&&t}startSessionRecording(){this.sessionRecording||(this.sessionRecording=new oi(this)),this.sessionRecording.updateConfig({enabled:!0}),this.sessionRecording.startIfEnabledOrStop("recording_initialized"),this._emitter.emit(E)}stopSessionRecording(){var e;null===(e=this.sessionRecording)||void 0===e||e.stop(),this._emitter.emit(L)}isRecordingActive(){var e;return"active"===(null===(e=this.sessionRecording)||void 0===e?void 0:e.status)}getSessionRecordingId(){var e;return(null===(e=this.sessionRecording)||void 0===e?void 0:e.sessionId)||null}capture(e,t,i){this._captureManager.capture(e,t,i),this._emitter.emit(k,{event:e,payload:t})}trackEvent(e,t){void 0===t&&(t={}),this._captureManager.trackEvent(e,t)}identify(e,t,i){this._identityManager.identify(e,t,i)}setUserProperties(e,t){this._identityManager.setUserProperties(e,t)}resetUser(e){this._identityManager.resetUser(e)}createAlias(e,t){this._identityManager.createAlias(e,t)}getUserIdentity(){return this._identityManager.getUserIdentity()}getDeviceId(){return this._identityManager.getDeviceId()}getUserState(){return this._identityManager.getUserState()}getConfig(){return this.configManager.getConfig()}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:un;return t!==un&&(t="vt."+t),t}updateConfig(e){this.configManager.updateConfig(e);var t=this.configManager.getConfig();this.sessionManager=new Q(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new ut(t.persistence||"localStorage+cookie",t.cross_subdomain_cookie),this._notifyFeaturesOfConfigUpdate(t),this._emitter.emit(S,{config:t})}_notifyFeaturesOfConfigUpdate(e){[this.historyAutocapture,this.autocapture,this.webVitals,this.sessionRecording,this.chat,this.vtdOverlay].forEach(t=>{(null==t?void 0:t.onConfigUpdate)&&y(()=>t.onConfigUpdate(e))})}buildUrl(){var e=this.configManager.getConfig(),{proxyUrl:t,proxy:i,api_host:n,token:r}=e;return t||(i?i+"/api/tracking?token="+r:n?n.replace(/\/+$/gm,"")+"/api/tracking?token="+r:"/api/tracking?token="+r)}sendRequest(e,t,i){if(this._is_configured()){if(i&&void 0!==$)if($.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:e,event:t});this.requestQueue.enqueue({url:e,event:t})}}_is_configured(){return!!this.configManager.getConfig().token||(this._has_warned_about_config||(console.warn("VTilt: 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:n}=e,r=1===n.length?n[0]:{events:n},s=this.configManager.getConfig().disable_compression?Qi.None:Qi.GZipJS;en({url:i,data:r,method:"POST",transport:"XHR",compression:s,callback:e=>t({statusCode:e.statusCode})})})}_send_beacon_request(e){var{url:t,events:i}=e,n=1===i.length?i[0]:{events:i},r=this.configManager.getConfig().disable_compression?Qi.None:Qi.GZipJS;en({url:t,data:n,method:"POST",transport:"sendBeacon",compression:r})}_send_retriable_request(e){this.sendRequest(e.url,e.event,!1)}_setup_unload_handler(){if($){var e=()=>{this.requestQueue.unload(),this.retryQueue.unload()};P($,"beforeunload",e),P($,"pagehide",e)}}_start_queue_if_opted_in(){this.requestQueue.enable()}_read_vt_param_from_url(){y(()=>{var e,t;if(void 0!==D&&D.search){var i=new URL(D.href),n=i.searchParams.get("vt"),r=i.searchParams.get("vtd");if((null==n?void 0:n.trim())&&(this._captureManager.setVtPersonId(n.trim()),i.searchParams.delete("vt")),(null==r?void 0:r.trim())&&(this._initVtdOverlay(r.trim()),i.searchParams.delete("vtd")),(null==n?void 0:n.trim())||(null==r?void 0:r.trim())){var s=i.pathname+(i.search||"")+i.hash;null===(t=null===(e=null==$?void 0:$.history)||void 0===e?void 0:e.replaceState)||void 0===t||t.call(e,{},"",s)}}})}_initVtdOverlay(e){this.vtdOverlay||(this.vtdOverlay=new Ki(this),this.vtdOverlay.setDestinationUrl(e))}_execute_array(e){Array.isArray(e)&&e.forEach(e=>{if(e&&Array.isArray(e)&&e.length>0){var t=e[0],i=e.slice(1);"function"==typeof this[t]&&y(()=>this[t](...i))}})}_dom_loaded(){this.__request_queue.forEach(e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}}var vn={},_n=!(void 0!==B||void 0!==F)&&-1===(null==V?void 0:V.indexOf("MSIE"))&&-1===(null==V?void 0:V.indexOf("Mozilla"));null!=$&&($.__VTILT_ENQUEUE_REQUESTS=_n);var gn,pn;gn=vn[un]=new hn,(pn=j.vt)&&R(pn._i,function(e){if(e&&cn(e)){var t=gn.init(e[0],e[1],e[2]),i=pn[e[2]||"vt"]||pn;t&&t._execute_array(i)}}),j.vt=gn,function(){function e(){e.done||(e.done=!0,_n=!1,null!=$&&($.__VTILT_ENQUEUE_REQUESTS=!1),R(vn,e=>e._dom_loaded()))}q&&"function"==typeof q.addEventListener?"complete"===q.readyState?e():P(q,"DOMContentLoaded",e,{capture:!1}):$&&console.error("Browser doesn't support document.addEventListener")}()}();
|
|
1
|
+
!function(){"use strict";function e(e,t,i,n,r,s,a){try{var o=e[s](a),l=o.value}catch(e){return void i(e)}o.done?t(l):Promise.resolve(l).then(n,r)}function t(t){return function(){var i=this,n=arguments;return new Promise(function(r,s){var a=t.apply(i,n);function o(t){e(a,r,s,o,l,"next",t)}function l(t){e(a,r,s,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 n in i)({}).hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e},i.apply(null,arguments)}var n="1.10.9",r="__vt_session",s="__vt_window_id",a="__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="undefined"!=typeof window?window:void 0,y="undefined"!=typeof globalThis?globalThis:m,b=null==y?void 0:y.navigator,w=null==y?void 0:y.document,S=null==y?void 0:y.location,C=null==y?void 0:y.fetch;m&&w&&w.createElement;var x=null==y?void 0:y.XMLHttpRequest;null==y||y.AbortController;var I=null==b?void 0:b.userAgent,k=null!=m?m:{};class E{constructor(e){void 0===e&&(e={}),this.config=this.parseConfigFromScript(e)}parseConfigFromScript(e){if(!(null==w?void 0:w.currentScript))return i({token:e.token||""},e);var t=w.currentScript,n=i({token:""},e);n.api_host=t.getAttribute("data-api-host")||t.getAttribute("data-host")||e.api_host,n.script_host=t.getAttribute("data-script-host")||e.script_host,n.proxy=t.getAttribute("data-proxy")||e.proxy,n.proxyUrl=t.getAttribute("data-proxy-url")||e.proxyUrl,n.token=t.getAttribute("data-token")||e.token||"",n.domain=t.getAttribute("data-domain")||e.domain,n.storage=t.getAttribute("data-storage")||e.storage,n.stringifyPayload="false"!==t.getAttribute("data-stringify-payload");var r="true"===t.getAttribute("data-capture-performance");if(n.capture_performance=!!r||e.capture_performance,n.proxy&&n.proxyUrl)throw console.error("Error: Both data-proxy and data-proxy-url are specified. Please use only one of them."),new Error("Both data-proxy and data-proxy-url are specified. Please use only one of them.");for(var s of(n.globalAttributes=i({},e.globalAttributes),Array.from(t.attributes)))s.name.startsWith("data-vt-")&&(n.globalAttributes[s.name.slice(8).replace(/-/g,"_")]=s.value);return n}getConfig(){return i({},this.config)}updateConfig(e){this.config=i({},this.config,e)}}function L(e,t){try{return e()}catch(e){return t}}class M{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,n;null===(i=this._events.get(e))||void 0===i||i.forEach(i=>{try{i(t)}catch(t){console.error('[vTilt] Error in event listener for "'+e+'":',t)}});var r=this._onceEvents.get(e);r&&(r.forEach(i=>{try{i(t)}catch(t){console.error('[vTilt] Error in once listener for "'+e+'":',t)}}),this._onceEvents.delete(e)),null===(n=this._events.get("*"))||void 0===n||n.forEach(i=>{try{i({event:e,payload:t})}catch(e){console.error("[vTilt] 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,n,r;return(null!==(i=null===(t=this._events.get(e))||void 0===t?void 0:t.size)&&void 0!==i?i:0)+(null!==(r=null===(n=this._onceEvents.get(e))||void 0===n?void 0:n.size)&&void 0!==r?r:0)}hasListeners(e){return this.listenerCount(e)>0}}var T="sdk:initialized",A="sdk:config_updated",R="sdk:remote_config_loaded",P="feature:started",U="feature:stopped",O="event:captured",$="recording:started",z="recording:stopped",N="23456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";function D(e){for(var t=(2<<31-Math.clz32(57))-1,i=Math.ceil(1.6*t*e/57),n="";n.length<e;)for(var r=crypto.getRandomValues(new Uint8Array(i)),s=0;s<i&&n.length<e;s++){var a=r[s]&t;a<57&&(n+=N[a])}return n}function q(e){return!(!e||"string"!=typeof e)&&!(e.length<2||e.length>10240)}function F(e,t,i){if(e)if(Array.isArray(e))e.forEach((e,n)=>{t.call(i,e,n)});else for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.call(i,e[n],n)}function B(e,t,i,n){var{capture:r=!1,passive:s=!0}=null!=n?n:{};null==e||e.addEventListener(t,i,{capture:r,passive:s})}function V(e,t){if(!t)return e;for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}function j(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n<t;n++)i[n-1]=arguments[n];for(var r of i)for(var s of r)e.push(s);return e}var W=[d,l,c,o],H=31536e3,G=["herokuapp.com","vercel.app","netlify.app"];function J(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 n=i.match(/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i);return n?"."+n[0]:""}class K{constructor(e){var t,i,n;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!G.includes(i)}(),this.sameSite=null!==(i=e.sameSite)&&void 0!==i?i:"Lax",this.secure=null!==(n=e.secure)&&void 0!==n?n:"undefined"!=typeof location&&"https:"===location.protocol}isLocalStorageSupported(){if(null!==this._localStorageSupported)return this._localStorageSupported;if(void 0===m||!m.localStorage)return this._localStorageSupported=!1,!1;try{var e="__vt_ls_test__";m.localStorage.setItem(e,"1");var t="1"===m.localStorage.getItem(e);return m.localStorage.removeItem(e),this._localStorageSupported=t,t||console.warn("[vTilt] localStorage unavailable, using cookies"),t}catch(e){return this._localStorageSupported=!1,console.warn("[vTilt] localStorage unavailable, using cookies"),!1}}isCriticalProperty(e){return W.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 console.warn('[vTilt] 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:H)}}catch(t){console.warn('[vTilt] 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){console.warn('[vTilt] 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==m||m.localStorage.setItem(e,t)}catch(e){}return t}return i}return this.getLocalStorage(e)}setLocalStoragePlusCookie(e,t,i){this.setLocalStorage(e,t),this.isCriticalProperty(e)&&this.setCookie(e,t,null!=i?i:H)}removeLocalStoragePlusCookie(e){this.removeLocalStorage(e),this.isCriticalProperty(e)&&this.removeCookie(e)}getLocalStorage(e){var t;if(!this.isLocalStorageSupported())return null;try{return null!==(t=null==m?void 0:m.localStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}setLocalStorage(e,t){if(this.isLocalStorageSupported())try{null==m||m.localStorage.setItem(e,t)}catch(e){console.warn("[vTilt] localStorage write error:",e)}}removeLocalStorage(e){if(this.isLocalStorageSupported())try{null==m||m.localStorage.removeItem(e)}catch(e){}}readFromSessionStorage(e){var t;try{return null!==(t=null==m?void 0:m.sessionStorage.getItem(e))&&void 0!==t?t:null}catch(e){return null}}writeToSessionStorage(e,t){try{null==m||m.sessionStorage.setItem(e,t)}catch(e){console.warn("[vTilt] sessionStorage write error:",e)}}removeFromSessionStorage(e){try{null==m||m.sessionStorage.removeItem(e)}catch(e){}}getCookie(e){if("undefined"==typeof document)return null;var t=e+"=";for(var i of document.cookie.split(";")){var n=i.trim();if(n.startsWith(t))try{return decodeURIComponent(n.slice(t.length))}catch(e){return n.slice(t.length)}}return null}setCookie(e,t,i){if("undefined"!=typeof document){var n=J(this.cross_subdomain),r=e+"="+encodeURIComponent(t)+"; Max-Age="+i+"; path=/; SameSite="+this.sameSite;this.secure&&(r+="; Secure"),n&&(r+="; domain="+n),document.cookie=r}}removeCookie(e){if("undefined"!=typeof document){var t=J(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,n){var r=i({value:t},n?{expiry:Date.now()+n}:{});this.set(e,JSON.stringify(r))}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===m||!(null==m?void 0:m.sessionStorage))return!1;try{var e="__vt_ss_test__";return m.sessionStorage.setItem(e,"1"),m.sessionStorage.removeItem(e),!0}catch(e){return!1}}getSessionStorage(){var e;return this.canUseSessionStorage()&&null!==(e=null==m?void 0:m.sessionStorage)&&void 0!==e?e:null}setMethod(e){this.method=e}getMethod(){return this.method}}class Q{constructor(e,t){void 0===e&&(e="cookie"),this.storage=new K({method:e,cross_subdomain:t,sameSite:"Lax"}),this._windowId=void 0,this._initializeWindowId()}getSessionId(){var e=this._getSessionIdRaw();return e||(e=D(16),this._storeSessionId(e)),e}setSessionId(){var e=this._getSessionIdRaw()||D(16);return this._storeSessionId(e),e}resetSessionId(){this._clearSessionId(),this.setSessionId(),this._setWindowId(D(16))}_getSessionIdRaw(){return this.storage.get(r)}_storeSessionId(e){this.storage.set(r,e,1800)}_clearSessionId(){this.storage.remove(r)}getWindowId(){if(this._windowId)return this._windowId;var e=this.storage.getSessionStorage();if(e){var t=e.getItem(s);if(t)return this._windowId=t,t}var i=D(16);return this._setWindowId(i),i}_setWindowId(e){if(e!==this._windowId){this._windowId=e;var t=this.storage.getSessionStorage();t&&t.setItem(s,e)}}_initializeWindowId(){var e=this.storage.getSessionStorage();if(e){var t=e.getItem(a),i=e.getItem(s);i&&!t?this._windowId=i:(i&&e.removeItem(s),this._setWindowId(D(16))),e.setItem(a,"true"),this._listenToUnload()}else this._windowId=D(16)}_listenToUnload(){var e=this.storage.getSessionStorage();m&&e&&B(m,"beforeunload",()=>{var e=this.storage.getSessionStorage();e&&e.removeItem(a)},{capture:!1})}updateStorageMethod(e,t){this.storage=new K({method:e,cross_subdomain:t,sameSite:"Lax"})}}function Z(e){if(!w)return null;var t=w.createElement("a");return t.href=e,t}function X(e,t){for(var i=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),n=0;n<i.length;n++){var r=i[n].split("=");if(r[0]===t){if(r.length<2)return"";var s=r[1];try{s=decodeURIComponent(s)}catch(e){}return s.replace(/\+/g," ")}}return""}function Y(e,t,i){if(!e||!t||!t.length)return e;for(var n=e.split("#"),r=n[0]||"",s=n[1],a=r.split("?"),o=a[1],l=a[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:"")+(s?"#"+s:"")}function ee(e){return"function"==typeof e}var te="Mobile",ie="iOS",ne="Android",re="Tablet",se=ne+" "+re,ae="iPad",oe="Apple",le=oe+" Watch",de="Safari",ue="BlackBerry",ce="Samsung",he=ce+"Browser",ve=ce+" Internet",_e="Chrome",ge=_e+" OS",pe=_e+" "+ie,fe="Internet Explorer",me=fe+" "+te,ye="Opera",be=ye+" Mini",we="Edge",Se="Microsoft "+we,Ce="Firefox",xe=Ce+" "+ie,Ie="Nintendo",ke="PlayStation",Ee="Xbox",Le=ne+" "+te,Me=te+" "+de,Te="Windows",Ae=Te+" Phone",Re="Nokia",Pe="Ouya",Ue="Generic",Oe=Ue+" "+te.toLowerCase(),$e=Ue+" "+re.toLowerCase(),ze="Konqueror",Ne="(\\d+(\\.\\d+)?)",De=new RegExp("Version/"+Ne),qe=new RegExp(Ee,"i"),Fe=new RegExp(ke+" \\w+","i"),Be=new RegExp(Ie+" \\w+","i"),Ve=new RegExp(ue+"|PlayBook|BB10","i"),je={"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 We(e,t){return e.toLowerCase().includes(t.toLowerCase())}var He=(e,t)=>t&&We(t,oe)||function(e){return We(e,de)&&!We(e,_e)&&!We(e,ne)}(e),Ge=function(e,t){return t=t||"",We(e," OPR/")&&We(e,"Mini")?be:We(e," OPR/")?ye:Ve.test(e)?ue:We(e,"IE"+te)||We(e,"WPDesktop")?me:We(e,he)?ve:We(e,we)||We(e,"Edg/")?Se:We(e,"FBIOS")?"Facebook "+te:We(e,"UCWEB")||We(e,"UCBrowser")?"UC Browser":We(e,"CriOS")?pe:We(e,"CrMo")||We(e,_e)?_e:We(e,ne)&&We(e,de)?Le:We(e,"FxiOS")?xe:We(e.toLowerCase(),ze.toLowerCase())?ze:He(e,t)?We(e,te)?Me:de:We(e,Ce)?Ce:We(e,"MSIE")||We(e,"Trident/")?fe:We(e,"Gecko")?Ce:""},Je={[me]:[new RegExp("rv:"+Ne)],[Se]:[new RegExp(we+"?\\/"+Ne)],[_e]:[new RegExp("("+_e+"|CrMo)\\/"+Ne)],[pe]:[new RegExp("CriOS\\/"+Ne)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Ne)],[de]:[De],[Me]:[De],[ye]:[new RegExp("(Opera|OPR)\\/"+Ne)],[Ce]:[new RegExp(Ce+"\\/"+Ne)],[xe]:[new RegExp("FxiOS\\/"+Ne)],[ze]:[new RegExp("Konqueror[:/]?"+Ne,"i")],[ue]:[new RegExp(ue+" "+Ne),De],[Le]:[new RegExp("android\\s"+Ne,"i")],[ve]:[new RegExp(he+"\\/"+Ne)],[fe]:[new RegExp("(rv:|MSIE )"+Ne)],Mozilla:[new RegExp("rv:"+Ne)]},Ke=function(e,t){var i=Ge(e,t),n=Je[i];if(void 0===n)return null;for(var r=0;r<n.length;r++){var s=n[r],a=e.match(s);if(a)return parseFloat(a[a.length-2])}return null},Qe=[[new RegExp(Ee+"; "+Ee+" (.*?)[);]","i"),e=>[Ee,e&&e[1]||""]],[new RegExp(Ie,"i"),[Ie,""]],[new RegExp(ke,"i"),[ke,""]],[Ve,[ue,""]],[new RegExp(Te,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[Ae,""];if(new RegExp(te).test(t)&&!/IEMobile\b/.test(t))return[Te+" "+te,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var n=i[1],r=je[n]||"";return/arm/i.test(t)&&(r="RT"),[Te,r]}return[Te,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[ie,t.join(".")]}return[ie,""]}],[/(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("("+ne+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ne+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[ne,t.join(".")]}return[ne,""]}],[/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/,[ge,""]],[/Linux|debian/i,["Linux",""]]],Ze=function(e){return Be.test(e)?Ie:Fe.test(e)?ke:qe.test(e)?Ee:new RegExp(Pe,"i").test(e)?Pe:new RegExp("("+Ae+"|WPDesktop)","i").test(e)?Ae:/iPad/.test(e)?ae:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?le:Ve.test(e)?ue:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Re,"i").test(e)?Re:/(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(te).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)?ne:se:ne:new RegExp("(pda|"+te+")","i").test(e)?Oe:new RegExp(re,"i").test(e)&&!new RegExp(re+" pc","i").test(e)?$e:""},Xe="https?://(.*)",Ye=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],et=j(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Ye),tt="<masked>";function it(e){var t=function(e){return e?0===e.search(Xe+"google.([^/?]*)")?"google":0===e.search(Xe+"bing.com")?"bing":0===e.search(Xe+"yahoo.com")?"yahoo":0===e.search(Xe+"duckduckgo.com")?"duckduckgo":null:null}(e),i="yahoo"!==t?"q":"p",n={};if(null!==t){n.$search_engine=t;var r=w?X(w.referrer,i):"";r.length&&(n.ph_keyword=r)}return n}function nt(){if("undefined"!=typeof navigator)return navigator.language||navigator.userLanguage}function rt(){return(null==w?void 0:w.referrer)||"$direct"}function st(){var e;return(null==w?void 0:w.referrer)&&(null===(e=Z(w.referrer))||void 0===e?void 0:e.host)||"$direct"}function at(e){var t,{r:i,u:n}=e,r={$referrer:i,$referring_domain:null==i?void 0:"$direct"===i?"$direct":null===(t=Z(i))||void 0===t?void 0:t.host};if(n){r.$current_url=n;var s=Z(n);r.$host=null==s?void 0:s.host,r.$pathname=null==s?void 0:s.pathname;var a=function(e){var t=et.concat([]),i={};return F(t,function(t){var n=X(e,t);i[t]=n||null}),i}(n);V(r,a)}i&&V(r,it(i));return r}function ot(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}function lt(){try{return(new Date).getTimezoneOffset()}catch(e){return}}function dt(e,t){if(!I)return{};var i,r,s,[a,o]=function(e){for(var t=0;t<Qe.length;t++){var[i,n]=Qe[t],r=i.exec(e),s=r&&(ee(n)?n(r,e):n);if(s)return s}return["",""]}(I);return V(function(e){var t={};for(var i in e)if(Object.prototype.hasOwnProperty.call(e,i)){var n=e[i];null!=n&&""!==n&&(t[i]=n)}return t}({$os:a,$os_version:o,$browser:Ge(I,navigator.vendor),$device:Ze(I),$device_type:(r=I,s=Ze(r),s===ae||s===se||"Kobo"===s||"Kindle Fire"===s||s===$e?re:s===Ie||s===Ee||s===ke||s===Pe?"Console":s===le?"Wearable":s?te:"Desktop"),$timezone:ot(),$timezone_offset:lt()}),{$current_url:Y(null==S?void 0:S.href,[],tt),$host:null==S?void 0:S.host,$pathname:null==S?void 0:S.pathname,$raw_user_agent:I.length>1e3?I.substring(0,997)+"...":I,$browser_version:Ke(I,navigator.vendor),$browser_language:nt(),$browser_language_prefix:(i=nt(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==m?void 0:m.screen.height,$screen_width:null==m?void 0:m.screen.width,$viewport_height:null==m?void 0:m.innerHeight,$viewport_width:null==m?void 0:m.innerWidth,$lib:"web",$lib_version:n,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}class ut{constructor(e,t){void 0===e&&(e="localStorage"),this._cachedPersonProperties=null,this.storage=new K({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}getUserIdentity(){return i({},this.userIdentity)}getDistinctId(){return this.userIdentity.distinct_id}getAnonymousId(){return this.userIdentity.anonymous_id||(this.userIdentity.anonymous_id=this.generateAnonymousId(),this.storage.set(d,this.userIdentity.anonymous_id,H)),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}identify(e,t,n){if("number"==typeof e&&(e=e.toString(),console.warn("The first argument to vTilt.identify was a number, but it should be a string. It has been converted to a string.")),e)if(this.isDistinctIdStringLike(e))console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if("COOKIELESS_SENTINEL_VALUE"!==e){var r=this.userIdentity.distinct_id;if(this.userIdentity.distinct_id=e,!this.userIdentity.device_id){var s=r||this.userIdentity.anonymous_id;this.userIdentity.device_id=s,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:s})}e!==r&&(this.userIdentity.distinct_id=e);var a="anonymous"===this.userIdentity.user_state;e!==r&&a?(this.userIdentity.user_state="identified",t&&(this.userIdentity.properties=i({},this.userIdentity.properties,t)),n&&Object.keys(n).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=n[e])}),this.saveUserIdentity()):t||n?("anonymous"===this.userIdentity.user_state&&(this.userIdentity.user_state="identified"),t&&(this.userIdentity.properties=i({},this.userIdentity.properties,t)),n&&Object.keys(n).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=n[e])}),this.saveUserIdentity()):e!==r&&(this.userIdentity.user_state="identified",this.saveUserIdentity())}else console.error('The string "'+e+'" was set in vTilt.identify which indicates an error. This ID is only used as a sentinel value.');else console.error("Unique user id has not been set in vTilt.identify")}setUserProperties(e,t){if(!e&&!t)return!1;var n=this.userIdentity.distinct_id||this.userIdentity.anonymous_id,r=this.getPersonPropertiesHash(n,e,t);return this._cachedPersonProperties===r?(console.info("VTilt: A duplicate setUserProperties call was made with the same properties. It has been ignored."),!1):(e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=t[e])}),this.saveUserIdentity(),this._cachedPersonProperties=r,!0)}reset(e){var t=this.generateAnonymousId(),n=this.userIdentity.device_id,r=e?this.generateDeviceId():n;this.userIdentity={distinct_id:null,anonymous_id:t,device_id:r,properties:{},user_state:"anonymous"},this._cachedPersonProperties=null,this.saveUserIdentity(),this.userIdentity.properties=i({},this.userIdentity.properties,{$last_vtilt_reset:(new Date).toISOString()}),this.saveUserIdentity()}setDistinctId(e){this.userIdentity.distinct_id=e,this.saveUserIdentity()}setUserState(e){this.userIdentity.user_state=e,this.saveUserIdentity()}updateUserProperties(e,t){e&&(this.userIdentity.properties=i({},this.userIdentity.properties,e)),t&&Object.keys(t).forEach(e=>{e in this.userIdentity.properties||(this.userIdentity.properties[e]=t[e])}),this.saveUserIdentity()}ensureDeviceId(e){this.userIdentity.device_id||(this.userIdentity.device_id=e,this.userIdentity.properties=i({},this.userIdentity.properties,{$had_persisted_distinct_id:!0,$device_id:e}),this.saveUserIdentity())}createAlias(e,t){return this.isValidDistinctId(e)?(void 0===t&&(t=this.getDistinctId()||this.getAnonymousId()),this.isValidDistinctId(t)?e===t?(console.warn("alias matches current distinct_id - should use identify instead"),null):{distinct_id:e,original:t}:(console.warn("Invalid original distinct ID"),null)):(console.warn("Invalid alias provided"),null)}isDistinctIdStringLikePublic(e){return this.isDistinctIdStringLike(e)}set_initial_person_info(e,t){if(!this.getStoredUserProperties()[f]){var i=function(e,t){var i=e?j([],Ye,t||[]):[],n=null==S?void 0:S.href.substring(0,1e3);return{r:rt().substring(0,1e3),u:n?Y(n,i,tt):void 0}}(e,t);this.register_once({[f]:i},void 0)}}get_initial_props(){var e,t,i=this.getStoredUserProperties()[f];return i?(e=at(i),t={},F(e,function(e,i){var n;t["$initial_"+(n=String(i),n.startsWith("$")?n.substring(1):n)]=e}),t):{}}update_referrer_info(){var e={$referrer:rt(),$referring_domain:st()};this.register_once(e,void 0)}loadUserIdentity(){var e=this.storage.get(d),t=this.storage.get(l),i=this.storage.get(c),n=this.storage.get(o),r=this.getStoredUserProperties(),s=e||this.generateAnonymousId(),a=t||this.generateDeviceId(),u=i||null,h=n||"anonymous",v=s||this.generateAnonymousId();return e||this.storage.set(d,v,H),t||this.storage.set(l,a,H),n||this.storage.set(o,h,H),{distinct_id:u,anonymous_id:v,device_id:a,properties:r,user_state:h}}saveUserIdentity(){this.storage.set(d,this.userIdentity.anonymous_id,H),this.storage.set(l,this.userIdentity.device_id,H),this.storage.set(o,this.userIdentity.user_state,H),this.userIdentity.distinct_id?this.storage.set(c,this.userIdentity.distinct_id,H):this.storage.remove(c),this.setStoredUserProperties(this.userIdentity.properties)}getStoredUserProperties(){return this.storage.getJSON(h)||{}}setStoredUserProperties(e){this.storage.setJSON(h,e,H)}register_once(e,t){var i=this.getStoredUserProperties(),n=!1;for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(r in i||(i[r]=e[r],n=!0));if(t)for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(s in i||(i[s]=t[s],n=!0));n&&this.setStoredUserProperties(i)}generateAnonymousId(){return"anon_"+D(16)}generateDeviceId(){return"device_"+D(16)}getPersonPropertiesHash(e,t,i){return JSON.stringify({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}isValidDistinctId(e){if(!e||"string"!=typeof e)return!1;var t=e.toLowerCase().trim();return!["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none"].includes(t)&&0!==e.trim().length}isDistinctIdStringLike(e){if(!e||"string"!=typeof e)return!1;var t=e.toLowerCase().trim();return["null","undefined","false","true","anonymous","anon","user","test","guest","visitor","unknown","none","demo","example","sample","placeholder"].includes(t)}updateStorageMethod(e,t){this.storage=new K({method:e,cross_subdomain:t,sameSite:"Lax"}),this.userIdentity=this.loadUserIdentity()}}var ct=["LCP","CLS","FCP","INP"],ht=9e5,vt="[WebVitals]";class _t{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){this.name="WebVitals",this._isStarted=!1,this._instance=e,this._buffer=this._createEmptyBuffer(),this._config=_t.extractConfig(e.getConfig())}get isEnabled(){var e=null==S?void 0:S.protocol;return("http:"===e||"https:"===e)&&!0===this._config.web_vitals}get isStarted(){return this._isStarted}startIfEnabled(){if(this.isEnabled&&!this._isStarted&&m){var e=this._getWebVitalsCallbacks();e?this._startCapturing(e):this._loadWebVitals()}}stop(){this._isStarted&&(this._flush(),this._flushTimer&&(clearTimeout(this._flushTimer),this._flushTimer=void 0),this._isStarted=!1)}onConfigUpdate(e){var t=_t.extractConfig(e),i=this.isEnabled;this._config=t,i||!this.isEnabled||this._isStarted?i&&!this.isEnabled&&this._isStarted&&this.stop():this.startIfEnabled()}get allowedMetrics(){return this._config.web_vitals_allowed_metrics||ct}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?ht:0===e?0:e<6e4?ht:e}_createEmptyBuffer(){return{url:void 0,pathname:void 0,metrics:[],firstMetricTimestamp:void 0}}_getWebVitalsCallbacks(){var e;return null===(e=k.__VTiltExtensions__)||void 0===e?void 0:e.webVitalsCallbacks}_loadWebVitals(){var e,t=null===(e=k.__VTiltExtensions__)||void 0===e?void 0:e.loadExternalDependency;t?t(this._instance,"web-vitals",e=>{if(e)console.error(vt+" Failed to load web-vitals:",e);else{var t=this._getWebVitalsCallbacks();t?this._startCapturing(t):console.error(vt+" web-vitals loaded but callbacks not registered")}}):console.warn(vt+" External dependency loader not available. Include web-vitals.ts entrypoint or use array.full.js bundle.")}_startCapturing(e){if(!this._isStarted){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),this._isStarted=!0}}_getCurrentUrl(){var e;return null===(e=null==m?void 0:m.location)||void 0===e?void 0:e.href}_getCurrentPathname(){return null==S?void 0:S.pathname}_addToBuffer(e){try{if(!m||!w||!S)return;if(!(null==e?void 0:e.name)||void 0===(null==e?void 0:e.value))return void console.warn(vt+" Invalid metric received",e);if(this.maxAllowedValue>0&&e.value>=this.maxAllowedValue&&"CLS"!==e.name)return void console.warn(vt+" Ignoring "+e.name+" with value >= "+this.maxAllowedValue+"ms");var t=this._getCurrentUrl(),n=this._getCurrentPathname();if(!t)return void console.warn(vt+" Could not determine current URL");this._buffer.url&&this._buffer.url!==t&&this._flush(),this._buffer.url||(this._buffer.url=t,this._buffer.pathname=n),this._buffer.firstMetricTimestamp||(this._buffer.firstMetricTimestamp=Date.now());var r=this._cleanAttribution(e.attribution),s=this._instance.getSessionId(),a=this._getWindowId(),o=i({},e,{attribution:r,timestamp:Date.now(),$current_url:t,$session_id:s,$window_id:a}),l=this._buffer.metrics.findIndex(t=>t.name===e.name);l>=0?this._buffer.metrics[l]=o:this._buffer.metrics.push(o),this._scheduleFlush(),this._buffer.metrics.length>=this.allowedMetrics.length&&this._flush()}catch(e){console.error(vt+" 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){console.error(vt+" Error flushing metrics:",e)}this._buffer=this._createEmptyBuffer()}}}function gt(e,t,i){try{if(!(t in e))return()=>{};var n=e[t],r=i(n);return ee(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__vtilt_wrapped__:{enumerable:!1,value:!0}})),e[t]=r,()=>{e[t]=n}}catch(e){return()=>{}}}class pt{constructor(e,t){var i;this.name="HistoryAutocapture",this._isStarted=!1,this._instance=e,this._config=t||pt.extractConfig(e.getConfig()),this._lastPathname=(null===(i=null==m?void 0:m.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=pt.extractConfig(e),this.isEnabled&&!this._isStarted?this._start():!this.isEnabled&&this._isStarted&&this.stop()}_start(){m&&S&&(this._lastPathname=S.pathname||"",this._patchHistoryMethods(),this._setupPopstateListener(),this._isStarted=!0)}_patchHistoryMethods(){var e,t;if(null==m?void 0:m.history){var i=this;(null===(e=m.history.pushState)||void 0===e?void 0:e.__vtilt_wrapped__)||gt(m.history,"pushState",e=>function(t,n,r){e.call(this,t,n,r),i._capturePageview("pushState")}),(null===(t=m.history.replaceState)||void 0===t?void 0:t.__vtilt_wrapped__)||gt(m.history,"replaceState",e=>function(t,n,r){e.call(this,t,n,r),i._capturePageview("replaceState")})}}_setupPopstateListener(){if(!this._popstateListener&&m){var e=()=>{this._capturePageview("popstate")};B(m,"popstate",e),this._popstateListener=()=>{null==m||m.removeEventListener("popstate",e)}}}_capturePageview(e){this.isEnabled&&this._isStarted&&L(()=>{var t,i=null===(t=null==m?void 0:m.location)||void 0===t?void 0:t.pathname;if(i&&S&&w){if(i!==this._lastPathname){var n={navigation_type:e};this._instance.capture("$pageview",n)}this._lastPathname=i}})}}var ft=["a","button","form","input","select","textarea","label"],mt="$copy_autocapture",yt=['[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 bt(e){return null==e}function wt(e){return"string"==typeof e}function St(e){return void 0===e}function Ct(e){return e.replace(/^\s+|\s+$/g,"")}function xt(e,t){return e.indexOf(t)>-1}function It(e){return 1===(null==e?void 0:e.nodeType)}function kt(e){return 3===(null==e?void 0:e.nodeType)}function Et(e,t){var i;return(null===(i=null==e?void 0:e.tagName)||void 0===i?void 0:i.toLowerCase())===t}function Lt(e){return 11===(null==e?void 0:e.nodeType)}function Mt(e){return e?Ct(e).split(/\s+/):[]}function Tt(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 Mt(t)}function At(e){return bt(e)?null:Ct(e).split(/(\s+)/).filter(e=>jt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Rt(e){var t,i="";if(Ht(e)&&!Gt(e)&&e.childNodes&&e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];kt(r)&&r.textContent&&(i+=null!==(t=At(r.textContent))&&void 0!==t?t:"")}return Ct(i)}function Pt(e){var t,i="";if(e&&e.childNodes&&e.childNodes.length)for(var n=0;n<e.childNodes.length;n++){var r=e.childNodes[n];if(r&&"span"===(null===(t=r.tagName)||void 0===t?void 0:t.toLowerCase()))try{i=(i+" "+Rt(r)).trim(),r.childNodes&&r.childNodes.length&&(i=(i+" "+Pt(r)).trim())}catch(e){}}return i}function Ut(e){var t=Rt(e);return jt(t=(t+" "+Pt(e)).trim())?t:""}function Ot(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!It(t));return t}function $t(e){var t=e.parentNode;return!(!t||!It(t))&&t}function zt(e){var t=null==m?void 0:m.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}var Nt="(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})",Dt=new RegExp("^(?:"+Nt+")$"),qt=new RegExp(Nt),Ft="\\d{3}-?\\d{2}-?\\d{4}",Bt=new RegExp("^("+Ft+")$"),Vt=new RegExp("("+Ft+")");function jt(e,t){if(void 0===t&&(t=!0),bt(e))return!1;if(wt(e)){if(e=Ct(e),(t?Dt:qt).test((e||"").replace(/[- ]/g,"")))return!1;if((t?Bt:Vt).test(e))return!1}return!0}function Wt(e){return!!wt(e)&&("_ngcontent"===e.substring(0,10)||"_nghost"===e.substring(0,7))}function Ht(e){for(var t=e;t&&t.parentNode&&!Et(t,"body");t=t.parentNode){var i=Tt(t);if(xt(i,"vt-sensitive")||xt(i,"vt-no-capture"))return!1}if(xt(Tt(e),"vt-include"))return!0;var n=e.type||"";if(wt(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}var r=e.name||e.id||"";if(wt(r)){if(/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(r.replace(/[^a-zA-Z0-9]/g,"")))return!1}return!0}function Gt(e){return!!(Et(e,"input")&&!["button","checkbox","submit","reset","radio"].includes(e.type)||Et(e,"textarea")||"true"===e.getAttribute("contenteditable"))}function Jt(e){if(!Ht(e))return null;if(Et(e,"input")){var t=e,i=(t.type||"text").toLowerCase();if("password"===i||"hidden"===i)return null;if("checkbox"===i||"radio"===i){var n={$el_value:t.checked?"true":"false"},r=function(e){var t=e.closest("label");if(t){var i=Ct(t.textContent||"");if(i&&jt(i))return At(i)||null}if(e.id)try{var n=null===document||void 0===document?void 0:document.querySelector('label[for="'+e.id+'"]');if(n){var r=Ct(n.textContent||"");if(r&&jt(r))return At(r)||null}}catch(e){}return null}(t);return r?n.$selected_text=r:t.value&&jt(t.value)&&(n.$selected_text=t.value),n}var s=t.value;if(s&&jt(s)){var a=At(s);if(a)return{$el_value:a}}return null}if(Et(e,"select")){var o=e,l=o.selectedIndex;if(l>=0&&o.options[l]){var d=o.options[l],u={};d.value&&jt(d.value)&&(u.$el_value=d.value);var c=d.text;if(c&&jt(c)){var h=At(c);h&&(u.$selected_text=h)}if(u.$el_value||u.$selected_text)return u}return null}return Et(e,"textarea"),null}function Kt(e,t,i,n,r){if(void 0===i&&(i=void 0),!m||!e||Et(e,"html")||!It(e))return!1;if((null==i?void 0:i.url_allowlist)&&!zt(i.url_allowlist))return!1;if((null==i?void 0:i.url_ignorelist)&&zt(i.url_ignorelist))return!1;if(null==i?void 0:i.dom_event_allowlist){var s=i.dom_event_allowlist;if(s&&!s.some(e=>t.type===e))return!1}for(var a=!1,o=[e],l=!0,d=e;d.parentNode&&!Et(d,"body");)if(Lt(d.parentNode))o.push(d.parentNode.host),d=d.parentNode.host;else{if(!(l=$t(d)))break;if(n||ft.indexOf(l.tagName.toLowerCase())>-1)a=!0;else{var u=m.getComputedStyle(l);u&&"pointer"===u.getPropertyValue("cursor")&&(a=!0)}o.push(l),d=l}if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(St(i))return!0;var n,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var s of e)if(n=r(s))return n.v;return!1}(o,i))return!1;if(!function(e,t){var i=null==t?void 0:t.css_selector_allowlist;if(St(i))return!0;var n,r=function(e){if(i.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(n=r(s))return n.v;return!1}(o,i))return!1;if(function(e,t){var i=null==t?void 0:t.css_selector_ignorelist,n=void 0===i?yt:i;if(0===n.length)return!1;for(var r of e)for(var s of n)try{if(r.matches(s))return!0}catch(e){}return!1}(o,i))return!1;var c=m.getComputedStyle(e);if(c&&"pointer"===c.getPropertyValue("cursor")&&"click"===t.type)return!0;var h=e.tagName.toLowerCase();switch(h){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return a?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(ft.indexOf(h)>-1||"true"===e.getAttribute("contenteditable"))}}function Qt(e,t){return t.length>e?t.slice(0,e)+"...":t}function Zt(e,t,i,n){var r=e.tagName.toLowerCase(),s={tag_name:r};ft.indexOf(r)>-1&&!i&&(s.$el_text=Qt(1024,"a"===r||"button"===r?Ut(e):Rt(e)));var a=Tt(e);a.length>0&&(s.classes=a.filter(e=>""!==e));for(var o=0;o<e.attributes.length;o++){var l=e.attributes[o];if((!Gt(e)||-1!==["name","id","class","aria-label"].indexOf(l.name))&&(!(null==n?void 0:n.includes(l.name))&&!t&&jt(l.value)&&!Wt(l.name))){var d=l.value;"class"===l.name&&(d=Mt(d).join(" ")),s["attr__"+l.name]=Qt(1024,d)}}for(var u=1,c=1,h=e;h=Ot(h);)u++,h.tagName===e.tagName&&c++;return s.nth_child=u,s.nth_of_type=c,s}function Xt(e){if(!Ht(e))return{};for(var t={},i=0;i<e.attributes.length;i++){var n=e.attributes[i];if(n.name&&0===n.name.indexOf("data-vt-capture-attribute")){var r=n.name.replace("data-vt-capture-attribute-",""),s=n.value;r&&s&&jt(s)&&(t[r]=s)}}return t}function Yt(e){return e.replace(/"|\\"/g,'\\"')}function ei(e){var t,i=e.attr__class;return i?(t=i,Array.isArray(t)?i:Mt(i)):void 0}function ti(e){return function(e){var t=e.map(e=>{var t,n,r="";if(e.tag_name&&(r+=e.tag_name),e.attr_class)for(var s of(e.attr_class.sort(),e.attr_class))r+="."+s.replace(/"/g,"");var a=i({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(n=e.nth_of_type)&&void 0!==n?n:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Object.entries(a).sort((e,t)=>{var[i]=e,[n]=t;return i.localeCompare(n)}).forEach(e=>{var[t,i]=e;return o[Yt(t.toString())]=Yt(String(i))}),(r+=":")+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,n={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:ei(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 n.attributes[t]=i}),n})}(e))}function ii(e,t){return e.indexOf(t)>-1}class ni{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 n=this.clicks[this.clicks.length-1];Math.sqrt(Math.pow(e-n.x,2)+Math.pow(t-n.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 ri(e,t){for(var i,n,r,s,{e:a,maskAllElementAttributes:o,maskAllText:l,elementAttributeIgnoreList:d,elementsChainAsString:u,captureElementValues:c}=t,h=[e],v=e;v.parentNode&&!Et(v,"body");)Lt(v.parentNode)?(h.push(v.parentNode.host),v=v.parentNode.host):(h.push(v.parentNode),v=v.parentNode);var _,g=[],p={},f=!1,y=!1;for(var b of h){var w=Ht(b);if("a"===b.tagName.toLowerCase()){var S=b.getAttribute("href");f=!!(w&&S&&jt(S))&&S}ii(Tt(b),"vt-no-capture")&&(y=!0),g.push(Zt(b,o,l,d));var C=Xt(b);Object.assign(p,C)}if(y)return{props:{},explicitNoCapture:y};if(l||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?g[0].$el_text=Ut(e):g[0].$el_text=Rt(e)),"change"===a.type&&c){var x=Jt(e);x&&(x.$el_value&&(g[0].$el_value=x.$el_value),x.$selected_text&&(g[0].$selected_text=x.$selected_text))}if(f){g[0].attr__href=f;var I=null===(i=Z(f))||void 0===i?void 0:i.host,k=null===(n=null==m?void 0:m.location)||void 0===n?void 0:n.host;I&&k&&I!==k&&(_=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:a.type,$ce_version:1},u?{}:{$elements:g},{$elements_chain:ti(g)},(null===(r=g[0])||void 0===r?void 0:r.$el_text)?{$el_text:null===(s=g[0])||void 0===s?void 0:s.$el_text}:{},_&&"click"===a.type?{$external_click_url:_}:{},p);return{props:E}}class si{constructor(e){this.name="Autocapture",this._initialized=!1,this._isDisabledServerSide=null,this._elementSelectors=null,this._rageclicks=new ni,this._elementsChainAsString=!1,this._instance=e}get _config(){var e,t=this._instance.getConfig(),i="object"!=typeof(e=t.autocapture)||null===e||Array.isArray(e)?{}:t.autocapture;return i.url_allowlist&&(i.url_allowlist=i.url_allowlist.map(e=>"string"==typeof e?new RegExp(e):e)),i.url_ignorelist&&(i.url_ignorelist=i.url_ignorelist.map(e=>"string"==typeof e?new RegExp(e):e)),i}get isEnabled(){var e,t=null!==(e=this._isDisabledServerSide)&&void 0!==e&&e;return!!this._instance.getConfig().autocapture&&!t}get isStarted(){return this._initialized}startIfEnabled(){this.isEnabled&&!this._initialized&&(this._addDomEventHandlers(),this._initialized=!0)}stop(){this._initialized=!1}onConfigUpdate(e){this.isEnabled&&!this._initialized&&this.startIfEnabled()}onRemoteConfig(e){e.elementsChainAsString&&(this._elementsChainAsString=e.elementsChainAsString),this._isDisabledServerSide=!!e.autocapture_opt_out,this.startIfEnabled()}updateConfig(e){void 0!==e.enabled&&e.enabled&&(this._isDisabledServerSide=!1)}setElementSelectors(e){this._elementSelectors=e}getElementSelectors(e){var t,i=[];return null===(t=this._elementSelectors)||void 0===t||t.forEach(t=>{var n=null==w?void 0:w.querySelectorAll(t);null==n||n.forEach(n=>{e===n&&i.push(t)})}),i}_addDomEventHandlers(){if(this._isBrowserSupported()&&m&&w){var e=e=>{e=e||(null==m?void 0:m.event);try{this._captureEvent(e)}catch(e){}};if(B(w,"submit",e,{capture:!0}),B(w,"change",e,{capture:!0}),B(w,"click",e,{capture:!0}),this._config.capture_copied_text){var t=e=>{e=e||(null==m?void 0:m.event),this._captureEvent(e,mt)};B(w,"copy",t,{capture:!0}),B(w,"cut",t,{capture:!0})}}}_captureEvent(e,t){var i,n,r,s,a;if(void 0===t&&(t="$autocapture"),this.isEnabled&&e.isTrusted){var o=function(e){var t;return St(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(kt(o)&&(o=o.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()))&&this._captureEvent(e,"$rageclick");var l=t===mt;if(o&&Kt(o,e,this._config,l,l?["copy","cut"]:void 0)){var d=this._instance.getConfig(),{props:u,explicitNoCapture:c}=ri(o,{e:e,maskAllElementAttributes:null!==(n=d.mask_all_element_attributes)&&void 0!==n&&n,maskAllText:null!==(r=d.mask_all_text)&&void 0!==r&&r,elementAttributeIgnoreList:this._config.element_attribute_ignorelist,elementsChainAsString:this._elementsChainAsString,captureElementValues:null!==(s=this._config.capture_element_values)&&void 0!==s&&s});if(c)return!1;var h=this.getElementSelectors(o);if(h&&h.length>0&&(u.$element_selectors=h),t===mt){var v=At(null===(a=null==m?void 0:m.getSelection())||void 0===a?void 0:a.toString()),_=e.type||"clipboard";if(!v)return!1;u.$selected_content=v,u.$copy_type=_}return this._instance.capture(t,u),!0}}}_isBrowserSupported(){return"function"==typeof(null==w?void 0:w.querySelectorAll)}}var ai="[SessionRecording]";class oi{constructor(e,t){this._instance=e,this.name="SessionRecording",this._isStarted=!1,this._config=t||oi.extractConfig(e.getConfig())}static extractConfig(e){var t,i,n,r=e.session_recording||{};return{enabled:null!==(t=r.enabled)&&void 0!==t&&t,sampleRate:r.sampleRate,minimumDurationMs:r.minimumDurationMs,sessionIdleThresholdMs:r.sessionIdleThresholdMs,fullSnapshotIntervalMs:r.fullSnapshotIntervalMs,captureConsole:null!==(i=r.captureConsole)&&void 0!==i&&i,captureNetwork:null!==(n=r.captureNetwork)&&void 0!==n&&n,captureCanvas:r.captureCanvas,blockClass:r.blockClass,blockSelector:r.blockSelector,ignoreClass:r.ignoreClass,maskTextClass:r.maskTextClass,maskTextSelector:r.maskTextSelector,maskAllInputs:r.maskAllInputs,maskInputOptions:r.maskInputOptions,masking:r.masking,recordHeaders:r.recordHeaders,recordBody:r.recordBody,compressEvents:r.compressEvents,__mutationThrottlerRefillRate:r.__mutationThrottlerRefillRate,__mutationThrottlerBucketSize:r.__mutationThrottlerBucketSize}}get isEnabled(){var e,t=this._instance.getConfig(),i=null!==(e=this._config.enabled)&&void 0!==e&&e,n=!t.disable_session_recording;return!!m&&i&&n}get isStarted(){var e;return this._isStarted&&!!(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.isStarted)}startIfEnabled(){this.startIfEnabledOrStop("recording_initialized")}startIfEnabledOrStop(e){var t;if(!this.isEnabled||!(null===(t=this._lazyLoadedRecording)||void 0===t?void 0:t.isStarted)){var i=void 0!==Object.assign&&void 0!==Array.from;this.isEnabled&&i?(this._lazyLoadAndStart(e),this._isStarted=!0,console.info(ai+" starting")):this.stop()}}stop(){L(()=>{var e;null===(e=this._lazyLoadedRecording)||void 0===e||e.stop(),this._isStarted=!1})}onConfigUpdate(e){var t;this._config=oi.extractConfig(e),null===(t=this._lazyLoadedRecording)||void 0===t||t.updateConfig(this._config),this.startIfEnabledOrStop("config_updated")}onRemoteConfig(e){var t,n,r,s,a,o,l;if(e.sessionRecording){var d=e.sessionRecording;this._config=i({},this._config,{enabled:null!==(t=this._config.enabled)&&void 0!==t?t:d.enabled,sampleRate:null!==(n=this._config.sampleRate)&&void 0!==n?n:d.sampleRate,minimumDurationMs:null!==(r=this._config.minimumDurationMs)&&void 0!==r?r:d.minimumDurationMs,fullSnapshotIntervalMs:null!==(s=this._config.fullSnapshotIntervalMs)&&void 0!==s?s:d.fullSnapshotIntervalMs,maskAllInputs:null!==(a=this._config.maskAllInputs)&&void 0!==a?a:d.maskAllInputs,captureConsole:null!==(o=this._config.captureConsole)&&void 0!==o?o:d.captureConsole,captureCanvas:null!==(l=this._config.captureCanvas)&&void 0!==l?l:d.captureCanvas}),this.startIfEnabledOrStop("remote_config")}}get started(){return this.isStarted}get status(){var e;return(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.status)||"lazy_loading"}get sessionId(){var e;return(null===(e=this._lazyLoadedRecording)||void 0===e?void 0:e.sessionId)||""}stopRecording(){this.stop()}log(e,t){var i;void 0===t&&(t="log"),(null===(i=this._lazyLoadedRecording)||void 0===i?void 0:i.log)?this._lazyLoadedRecording.log(e,t):console.warn(ai+" log called before recorder was ready")}updateConfig(e){var t;this._config=i({},this._config,e),null===(t=this._lazyLoadedRecording)||void 0===t||t.updateConfig(this._config)}get _scriptName(){return"recorder"}_lazyLoadAndStart(e){var t,i,n,r;if(this.isEnabled)if((null===(i=null===(t=null==k?void 0:k.__VTiltExtensions__)||void 0===t?void 0:t.rrweb)||void 0===i?void 0:i.record)&&(null===(n=k.__VTiltExtensions__)||void 0===n?void 0:n.initSessionRecording))this._onScriptLoaded(e);else{var s=null===(r=k.__VTiltExtensions__)||void 0===r?void 0:r.loadExternalDependency;s?s(this._instance,this._scriptName,t=>{t?console.error(ai+" could not load recorder:",t):this._onScriptLoaded(e)}):console.error(ai+" loadExternalDependency not available. Session recording cannot start.")}}_onScriptLoaded(e){var t,i=null===(t=k.__VTiltExtensions__)||void 0===t?void 0:t.initSessionRecording;i?(this._lazyLoadedRecording||(this._lazyLoadedRecording=i(this._instance,this._config)),this._lazyLoadedRecording.start(e)):console.error(ai+" initSessionRecording not available after script load")}}var li=(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))(li||{}),di=Uint8Array,ui=Uint16Array,ci=Int32Array,hi=new di([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]),vi=new di([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]),_i=new di([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gi=function(e,t){for(var i=new ui(31),n=0;n<31;++n)i[n]=t+=1<<e[n-1];var r=new ci(i[30]);for(n=1;n<30;++n)for(var s=i[n];s<i[n+1];++s)r[s]=s-i[n]<<5|n;return{b:i,r:r}},pi=gi(hi,2),fi=pi.b,mi=pi.r;fi[28]=258,mi[258]=28;for(var yi=gi(vi,0).r,bi=new ui(32768),wi=0;wi<32768;++wi){var Si=(43690&wi)>>1|(21845&wi)<<1;Si=(61680&(Si=(52428&Si)>>2|(13107&Si)<<2))>>4|(3855&Si)<<4,bi[wi]=((65280&Si)>>8|(255&Si)<<8)>>1}var Ci=function(e,t,i){for(var n=e.length,r=0,s=new ui(t);r<n;++r)e[r]&&++s[e[r]-1];var a,o=new ui(t);for(r=1;r<t;++r)o[r]=o[r-1]+s[r-1]<<1;if(i){a=new ui(1<<t);var l=15-t;for(r=0;r<n;++r)if(e[r])for(var d=r<<4|e[r],u=t-e[r],c=o[e[r]-1]++<<u,h=c|(1<<u)-1;c<=h;++c)a[bi[c]>>l]=d}else for(a=new ui(n),r=0;r<n;++r)e[r]&&(a[r]=bi[o[e[r]-1]++]>>15-e[r]);return a},xi=new di(288);for(wi=0;wi<144;++wi)xi[wi]=8;for(wi=144;wi<256;++wi)xi[wi]=9;for(wi=256;wi<280;++wi)xi[wi]=7;for(wi=280;wi<288;++wi)xi[wi]=8;var Ii=new di(32);for(wi=0;wi<32;++wi)Ii[wi]=5;var ki=Ci(xi,9,0),Ei=Ci(Ii,5,0),Li=function(e){return(e+7)/8|0},Mi=function(e,t,i){return(null==i||i>e.length)&&(i=e.length),new di(e.subarray(t,i))},Ti=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8},Ai=function(e,t,i){i<<=7&t;var n=t/8|0;e[n]|=i,e[n+1]|=i>>8,e[n+2]|=i>>16},Ri=function(e,t){for(var i=[],n=0;n<e.length;++n)e[n]&&i.push({s:n,f:e[n]});var r=i.length,s=i.slice();if(!r)return{t:Di,l:0};if(1==r){var a=new di(i[0].s+1);return a[i[0].s]=1,{t:a,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!=r-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=s[0].s;for(n=1;n<r;++n)s[n].s>h&&(h=s[n].s);var v=new ui(h+1),_=Pi(i[u-1],v,0);if(_>t){n=0;var g=0,p=_-t,f=1<<p;for(s.sort(function(e,t){return v[t.s]-v[e.s]||e.f-t.f});n<r;++n){var m=s[n].s;if(!(v[m]>t))break;g+=f-(1<<_-v[m]),v[m]=t}for(g>>=p;g>0;){var y=s[n].s;v[y]<t?g-=1<<t-v[y]++-1:++n}for(;n>=0&&g;--n){var b=s[n].s;v[b]==t&&(--v[b],++g)}_=t}return{t:new di(v),l:_}},Pi=function(e,t,i){return-1==e.s?Math.max(Pi(e.l,t,i+1),Pi(e.r,t,i+1)):t[e.s]=i},Ui=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new ui(++t),n=0,r=e[0],s=1,a=function(e){i[n++]=e},o=1;o<=t;++o)if(e[o]==r&&o!=t)++s;else{if(!r&&s>2){for(;s>138;s-=138)a(32754);s>2&&(a(s>10?s-11<<5|28690:s-3<<5|12305),s=0)}else if(s>3){for(a(r),--s;s>6;s-=6)a(8304);s>2&&(a(s-3<<5|8208),s=0)}for(;s--;)a(r);s=1,r=e[o]}return{c:i.subarray(0,n),n:t}},Oi=function(e,t){for(var i=0,n=0;n<t.length;++n)i+=e[n]*t[n];return i},$i=function(e,t,i){var n=i.length,r=Li(t+2);e[r]=255&n,e[r+1]=n>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var s=0;s<n;++s)e[r+s+4]=i[s];return 8*(r+4+n)},zi=function(e,t,i,n,r,s,a,o,l,d,u){Ti(t,u++,i),++r[256];for(var c=Ri(r,15),h=c.t,v=c.l,_=Ri(s,15),g=_.t,p=_.l,f=Ui(h),m=f.c,y=f.n,b=Ui(g),w=b.c,S=b.n,C=new ui(19),x=0;x<m.length;++x)++C[31&m[x]];for(x=0;x<w.length;++x)++C[31&w[x]];for(var I=Ri(C,7),k=I.t,E=I.l,L=19;L>4&&!k[_i[L-1]];--L);var M,T,A,R,P=d+5<<3,U=Oi(r,xi)+Oi(s,Ii)+a,O=Oi(r,h)+Oi(s,g)+a+14+3*L+Oi(C,k)+2*C[16]+3*C[17]+7*C[18];if(l>=0&&P<=U&&P<=O)return $i(t,u,e.subarray(l,l+d));if(Ti(t,u,1+(O<U)),u+=2,O<U){M=Ci(h,v,0),T=h,A=Ci(g,p,0),R=g;var $=Ci(k,E,0);Ti(t,u,y-257),Ti(t,u+5,S-1),Ti(t,u+10,L-4),u+=14;for(x=0;x<L;++x)Ti(t,u+3*x,k[_i[x]]);u+=3*L;for(var z=[m,w],N=0;N<2;++N){var D=z[N];for(x=0;x<D.length;++x){var q=31&D[x];Ti(t,u,$[q]),u+=k[q],q>15&&(Ti(t,u,D[x]>>5&127),u+=D[x]>>12)}}}else M=ki,T=xi,A=Ei,R=Ii;for(x=0;x<o;++x){var F=n[x];if(F>255){Ai(t,u,M[(q=F>>18&31)+257]),u+=T[q+257],q>7&&(Ti(t,u,F>>23&31),u+=hi[q]);var B=31&F;Ai(t,u,A[B]),u+=R[B],B>3&&(Ai(t,u,F>>5&8191),u+=vi[B])}else Ai(t,u,M[F]),u+=T[F]}return Ai(t,u,M[256]),u+T[256]},Ni=new ci([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Di=new di(0),qi=function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var i=t,n=9;--n;)i=(1&i&&-306674912)^i>>>1;e[t]=i}return e}(),Fi=function(e,t,i,n,r){if(!r&&(r={l:1},t.dictionary)){var s=t.dictionary.subarray(-32768),a=new di(s.length+e.length);a.set(s),a.set(e,s.length),e=a,r.w=s.length}return function(e,t,i,n,r,s){var a=s.z||e.length,o=new di(n+a+5*(1+Math.ceil(a/7e3))+r),l=o.subarray(n,o.length-r),d=s.l,u=7&(s.r||0);if(t){u&&(l[0]=s.r>>3);for(var c=Ni[t-1],h=c>>13,v=8191&c,_=(1<<i)-1,g=s.p||new ui(32768),p=s.h||new ui(_+1),f=Math.ceil(i/3),m=2*f,y=function(t){return(e[t]^e[t+1]<<f^e[t+2]<<m)&_},b=new ci(25e3),w=new ui(288),S=new ui(32),C=0,x=0,I=s.i||0,k=0,E=s.w||0,L=0;I+2<a;++I){var M=y(I),T=32767&I,A=p[M];if(g[T]=A,p[M]=T,E<=I){var R=a-I;if((C>7e3||k>24576)&&(R>423||!d)){u=zi(e,l,0,b,w,S,x,k,L,I-L,u),k=C=x=0,L=I;for(var P=0;P<286;++P)w[P]=0;for(P=0;P<30;++P)S[P]=0}var U=2,O=0,$=v,z=T-A&32767;if(R>2&&M==y(I-z))for(var N=Math.min(h,R)-1,D=Math.min(32767,I),q=Math.min(258,R);z<=D&&--$&&T!=A;){if(e[I+U]==e[I+U-z]){for(var F=0;F<q&&e[I+F]==e[I+F-z];++F);if(F>U){if(U=F,O=z,F>N)break;var B=Math.min(z,F-2),V=0;for(P=0;P<B;++P){var j=I-z+P&32767,W=j-g[j]&32767;W>V&&(V=W,A=j)}}}z+=(T=A)-(A=g[T])&32767}if(O){b[k++]=268435456|mi[U]<<18|yi[O];var H=31&mi[U],G=31&yi[O];x+=hi[H]+vi[G],++w[257+H],++S[G],E=I+U,++C}else b[k++]=e[I],++w[e[I]]}}for(I=Math.max(I,E);I<a;++I)b[k++]=e[I],++w[e[I]];u=zi(e,l,d,b,w,S,x,k,L,I-L,u),d||(s.r=7&u|l[u/8|0]<<3,u-=7,s.h=p,s.p=g,s.i=I,s.w=E)}else{for(I=s.w||0;I<a+d;I+=65535){var J=I+65535;J>=a&&(l[u/8|0]=d,J=a),u=$i(l,u+1,e.subarray(I,J))}s.i=a}return Mi(o,0,n+Li(u)+r)}(e,null==t.level?6:t.level,null==t.mem?r.l?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):20:12+t.mem,i,n,r)},Bi=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};function Vi(e,t){t||(t={});var i=function(){var e=-1;return{p:function(t){for(var i=e,n=0;n<t.length;++n)i=qi[255&i^t[n]]^i>>>8;e=i},d:function(){return~e}}}(),n=e.length;i.p(e);var r,s=Fi(e,t,10+((r=t).filename?r.filename.length+1:0),8),a=s.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&&Bi(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var n=0;n<=i.length;++n)e[n+10]=i.charCodeAt(n)}}(s,t),Bi(s,a-8,i.d()),Bi(s,a-4,n),s}var ji="undefined"!=typeof TextEncoder&&new TextEncoder,Wi="undefined"!=typeof TextDecoder&&new TextDecoder;try{Wi.decode(Di,{stream:!0})}catch(e){}li.MouseMove,li.MouseInteraction,li.Scroll,li.ViewportResize,li.Input,li.TouchMove,li.MediaInteraction,li.Drag;var Hi="[Chat]";class Gi{constructor(e,t){this._instance=e,this.name="Chat",this._serverConfig=null,this._configFetched=!1,this._isLoading=!1,this._isStarted=!1,this._loadError=null,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[],this._config=t||Gi.extractConfig(e.getConfig())}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}}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))}get isStarted(){return this._isStarted}startIfEnabled(){this._startAsync().catch(e=>{console.error(Hi+" Error starting:",e)})}stop(){this.destroy(),this._isStarted=!1}onConfigUpdate(e){var t,i;this._config=Gi.extractConfig(e),this._lazyLoadedChat&&(null===(i=(t=this._lazyLoadedChat).updateConfig)||void 0===i||i.call(t,this.getMergedConfig()))}onRemoteConfig(e){var t,n,r,s,a,o,l,d,u;e.chat&&(this._serverConfig=i({},this._serverConfig,{enabled:null!==(r=null!==(t=e.chat.enabled)&&void 0!==t?t:null===(n=this._serverConfig)||void 0===n?void 0:n.enabled)&&void 0!==r&&r,position:null!==(o=null!==(s=e.chat.widgetPosition)&&void 0!==s?s:null===(a=this._serverConfig)||void 0===a?void 0:a.position)&&void 0!==o?o:"bottom-right",color:null!==(u=null!==(l=e.chat.widgetColor)&&void 0!==l?l:null===(d=this._serverConfig)||void 0===d?void 0:d.color)&&void 0!==u?u:"#6366f1"}),this.isEnabled&&!this._isStarted&&this.startIfEnabled())}_startAsync(){var e=this;return t(function*(){var t,i,n,r;!1!==e._config.enabled?e._instance.getConfig().disable_chat?console.info(Hi+" disabled by disable_chat config"):(!1!==e._config.autoConfig&&(yield e._fetchServerSettings()),e.isEnabled?(e._isStarted=!0,null!==(n=null!==(t=e._config.preload)&&void 0!==t?t:null===(i=e._serverConfig)||void 0===i?void 0:i.enabled)&&void 0!==n&&n&&e._schedulePreload(),(null===(r=e._serverConfig)||void 0===r?void 0:r.enabled)&&e._showBubble(),console.info(Hi+" ready (lazy-load on demand)")):console.info(Hi+" not enabled (check dashboard settings)")):console.info(Hi+" disabled by code config")})()}get isOpen(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isOpen)&&void 0!==t&&t}get isConnected(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isConnected)&&void 0!==t&&t}get isLoading(){var e,t;return this._isLoading||null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.isLoading)&&void 0!==t&&t}get unreadCount(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.unreadCount)&&void 0!==t?t:0}get channel(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.channel)&&void 0!==t?t:null}get channels(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.channels)&&void 0!==t?t:[]}get currentView(){var e,t;return null!==(t=null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.currentView)&&void 0!==t?t:"list"}open(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.open()})}close(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.close()}toggle(){this._lazyLoadedChat?this._lazyLoadedChat.toggle():this.open()}show(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.show()})}hide(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.hide()}getChannels(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.getChannels()})}selectChannel(e){this._lazyLoadAndThen(()=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.selectChannel(e)})}createChannel(){this._lazyLoadAndThen(()=>{var e;return null===(e=this._lazyLoadedChat)||void 0===e?void 0:e.createChannel()})}goToChannelList(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.goToChannelList()}sendMessage(e){this._lazyLoadedChat?this._lazyLoadedChat.sendMessage(e):(this._pendingMessages.push(e),this._lazyLoadAndThen(()=>{this._pendingMessages.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.sendMessage(e)}),this._pendingMessages=[]}))}markAsRead(){var e;null===(e=this._lazyLoadedChat)||void 0===e||e.markAsRead()}onMessage(e){return this._messageCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onMessage(e):()=>{var t=this._messageCallbacks.indexOf(e);t>-1&&this._messageCallbacks.splice(t,1)}}onTyping(e){return this._typingCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onTyping(e):()=>{var t=this._typingCallbacks.indexOf(e);t>-1&&this._typingCallbacks.splice(t,1)}}onConnectionChange(e){return this._connectionCallbacks.push(e),this._lazyLoadedChat?this._lazyLoadedChat.onConnectionChange(e):()=>{var t=this._connectionCallbacks.indexOf(e);t>-1&&this._connectionCallbacks.splice(t,1)}}updateConfig(e){this._config=i({},this._config,e)}getMergedConfig(){var e,t,i,n,r,s,a,o,l,d,u,c,h,v,_,g,p,f,m=this._serverConfig,y=this._config;return{enabled:null!==(t=null!==(e=y.enabled)&&void 0!==e?e:null==m?void 0:m.enabled)&&void 0!==t&&t,autoConfig:null===(i=y.autoConfig)||void 0===i||i,position:null!==(r=null!==(n=y.position)&&void 0!==n?n:null==m?void 0:m.position)&&void 0!==r?r:"bottom-right",greeting:null!==(s=y.greeting)&&void 0!==s?s:null==m?void 0:m.greeting,color:null!==(o=null!==(a=y.color)&&void 0!==a?a:null==m?void 0:m.color)&&void 0!==o?o:"#6366f1",aiMode:null===(d=null!==(l=y.aiMode)&&void 0!==l?l:null==m?void 0:m.ai_enabled)||void 0===d||d,aiGreeting:null!==(u=y.aiGreeting)&&void 0!==u?u:null==m?void 0:m.ai_greeting,preload:null!==(c=y.preload)&&void 0!==c&&c,theme:null!==(h=y.theme)&&void 0!==h?h:{primaryColor:null!==(_=null!==(v=y.color)&&void 0!==v?v:null==m?void 0:m.color)&&void 0!==_?_:"#6366f1"},offlineMessage:null!==(g=y.offlineMessage)&&void 0!==g?g:null==m?void 0:m.offline_message,collectEmailOffline:null===(f=null!==(p=y.collectEmailOffline)&&void 0!==p?p:null==m?void 0:m.collect_email_offline)||void 0===f||f}}destroy(){L(()=>{var e,t;null===(e=this._lazyLoadedChat)||void 0===e||e.destroy(),this._lazyLoadedChat=void 0,this._pendingMessages=[],this._pendingCallbacks=[],this._messageCallbacks=[],this._typingCallbacks=[],this._connectionCallbacks=[];var i=null===(t=null==m?void 0:m.document)||void 0===t?void 0:t.getElementById("vtilt-chat-bubble");i&&i.remove()})}_fetchServerSettings(){var e=this;return t(function*(){if(!e._configFetched){var t=e._instance.getConfig(),i=t.token,n=t.api_host;if(!i||!n)return console.warn(Hi+" Cannot fetch settings: missing token or api_host"),void(e._configFetched=!0);try{var r=n+"/api/chat/settings?token="+encodeURIComponent(i),s=yield fetch(r);if(!s.ok)return console.warn(Hi+" Failed to fetch settings: "+s.status),void(e._configFetched=!0);e._serverConfig=yield s.json(),e._configFetched=!0,console.info(Hi+" Loaded settings from dashboard")}catch(t){console.warn(Hi+" Error fetching settings:",t),e._configFetched=!0}}})()}_showBubble(){if((null==m?void 0:m.document)&&!document.getElementById("vtilt-chat-bubble")){var e=this.getMergedConfig(),t=e.position||"bottom-right",i=e.color||"#6366f1",n=document.createElement("div");n.id="vtilt-chat-bubble",n.setAttribute("style",("\n position: fixed;\n bottom: 20px;\n "+("bottom-right"===t?"right: 20px;":"left: 20px;")+"\n width: 60px;\n height: 60px;\n border-radius: 50%;\n background: "+i+";\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()),n.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 ',n.addEventListener("mouseenter",()=>{n.style.transform="scale(1.05)",n.style.boxShadow="0 6px 16px rgba(0, 0, 0, 0.2)"}),n.addEventListener("mouseleave",()=>{n.style.transform="scale(1)",n.style.boxShadow="0 4px 12px rgba(0, 0, 0, 0.15)"}),n.addEventListener("click",()=>{this.open()}),document.body.appendChild(n)}}get _scriptName(){return"chat"}_schedulePreload(){"undefined"!=typeof requestIdleCallback?requestIdleCallback(()=>this._lazyLoad(),{timeout:5e3}):setTimeout(()=>this._lazyLoad(),3e3)}_lazyLoadAndThen(e){this._lazyLoadedChat?e():(this._pendingCallbacks.push(e),this._lazyLoad())}_lazyLoad(){var e,t;if(!(this._isLoading||this._lazyLoadedChat||this._loadError))if(null===(e=k.__VTiltExtensions__)||void 0===e?void 0:e.initChat)this._onScriptLoaded();else{this._isLoading=!0;var i=null===(t=k.__VTiltExtensions__)||void 0===t?void 0:t.loadExternalDependency;if(!i)return console.error(Hi+" loadExternalDependency not available. Chat cannot start."),this._isLoading=!1,void(this._loadError="loadExternalDependency not available");i(this._instance,this._scriptName,e=>{if(this._isLoading=!1,e)return console.error(Hi+" Failed to load:",e),void(this._loadError=String(e));this._onScriptLoaded()})}}_onScriptLoaded(){var e,t=null===(e=k.__VTiltExtensions__)||void 0===e?void 0:e.initChat;if(!t)return console.error(Hi+" initChat not available after script load"),void(this._loadError="initChat not available");if(!this._lazyLoadedChat){var i=this.getMergedConfig();this._lazyLoadedChat=t(this._instance,i),this._messageCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onMessage(e)}),this._typingCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onTyping(e)}),this._connectionCallbacks.forEach(e=>{var t;return null===(t=this._lazyLoadedChat)||void 0===t?void 0:t.onConnectionChange(e)});var n=null===document||void 0===document?void 0:document.getElementById("vtilt-chat-bubble");n&&n.remove()}this._pendingCallbacks.forEach(e=>e()),this._pendingCallbacks=[],console.info(Hi+" loaded and ready")}}var Ji="[VtdOverlay]";class Ki{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||Ki.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&&L(()=>{this._destroyOverlay(),this._isStarted=!1})}onConfigUpdate(e){this._config=Ki.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 n=this._toEmbedUrl(i);this._originalUrl=i,this._destinationUrl=n,this._isLoading=!0,this._showOverlay(),this._isStarted=!0,this._instance.capture("$vtd_view",{$vtd_url:i,$vtd_embed_url:n!==i?n:void 0,$current_url:null===(t=null==m?void 0:m.location)||void 0===t?void 0:t.href})}else console.warn(Ji+" Invalid URL: "+i)}else console.warn(Ji+" Empty URL provided");else console.warn(Ji+" 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 n=t.searchParams.get("v");if(n){var r=t.searchParams.get("t"),s="https://www.youtube.com/embed/"+n+"?autoplay=1";return r&&(s+="&start="+r.replace("s","")),s}}if("youtu.be"===i){var a=t.pathname.slice(1);if(a){var o=t.searchParams.get("t"),l="https://www.youtube.com/embed/"+a+"?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(w&&this._destinationUrl){this._destroyOverlay(),this._container=w.createElement("div"),this._container.id="vtilt-vtd-overlay",this._container.className="vtilt-vtd-opening",this._container.setAttribute("style",this._getBackdropStyles());var e=w.createElement("div");e.className="vtilt-vtd-modal",e.setAttribute("style",this._getModalStyles());var t=w.createElement("div");t.className="vtilt-vtd-header",t.setAttribute("style",this._getHeaderStyles()),t.innerHTML=this._getHeaderHTML(),e.appendChild(t);var i=w.createElement("div");i.className="vtilt-vtd-iframe-wrapper",i.setAttribute("style",this._getIframeWrapperStyles()),this._loadingEl=w.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=w.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 n=()=>{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=n,this._iframe.onerror=n,setTimeout(()=>{this._isLoading&&n()},5e3),i.appendChild(this._iframe),this._iframe.src=this._destinationUrl,e.appendChild(i),this._container.appendChild(e);var r=w.createElement("style");r.id="vtilt-vtd-styles",r.textContent=this._getGlobalStyles(),w.head.appendChild(r),w.body.appendChild(this._container),this._attachEventListeners(),w.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==w?void 0:w.getElementById("vtilt-vtd-styles");(null==t?void 0:t.parentNode)&&t.parentNode.removeChild(t),(null==w?void 0:w.body)&&(w.body.style.overflow="")}_attachEventListeners(){var e,t,i,n=null===(e=this._container)||void 0===e?void 0:e.querySelector(".vtilt-vtd-close");null==n||n.addEventListener("click",()=>this.close());var r=null===(t=this._container)||void 0===t?void 0:t.querySelector(".vtilt-vtd-open");null==r||r.addEventListener("click",()=>{this._originalUrl&&(null==m||m.open(this._originalUrl,"_blank"))}),null===(i=this._container)||void 0===i||i.addEventListener("click",e=>{e.target===this._container&&this.close()});var s=e=>{"Escape"===e.key&&(this.close(),null==w||w.removeEventListener("keydown",s))};null==w||w.addEventListener("keydown",s)}_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===w)return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");var t=w.createElement("div");return t.textContent=e,t.innerHTML}}var Qi,Zi="text/plain";!function(e){e.GZipJS="gzip-js",e.None="none"}(Qi||(Qi={}));var Xi=e=>{var{data:t,compression:i}=e;if(t){var n=(e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t))(t),r=new Blob([n]).size;if(i===Qi.GZipJS&&r>=1024)try{var s=Vi(function(e,t){if(ji)return ji.encode(e);for(var i=e.length,n=new di(e.length+(e.length>>1)),r=0,s=function(e){n[r++]=e},a=0;a<i;++a){if(r+5>n.length){var o=new di(r+8+(i-a<<1));o.set(n),n=o}var l=e.charCodeAt(a);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|63&l)):l>55295&&l<57344?(s(240|(l=65536+(1047552&l)|1023&e.charCodeAt(++a))>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|63&l)):(s(224|l>>12),s(128|l>>6&63),s(128|63&l))}return Mi(n,0,r)}(n),{mtime:0}),a=new Blob([s],{type:Zi});if(a.size<.95*r)return{contentType:Zi,body:a,estimatedSize:a.size}}catch(e){}return{contentType:"application/json",body:n,estimatedSize:r}}},Yi=[{name:"fetch",available:"undefined"!=typeof fetch,method:e=>{var n=Xi(e);if(n){var{contentType:r,body:s,estimatedSize:a}=n,o=e.compression===Qi.GZipJS&&r===Zi?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url,l=i({"Content-Type":r},e.headers||{}),d=new AbortController,u=e.timeout?setTimeout(()=>d.abort(),e.timeout):null;fetch(o,{method:e.method||"POST",headers:l,body:s,keepalive:a<52428.8,signal:d.signal}).then(function(){var i=t(function*(t){var i,n=yield t.text(),r={statusCode:t.status,text:n};if(200===t.status)try{r.json=JSON.parse(n)}catch(e){}null===(i=e.callback)||void 0===i||i.call(e,r)});return function(e){return i.apply(this,arguments)}}()).catch(()=>{var t;null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})}).finally(()=>{u&&clearTimeout(u)})}}},{name:"XHR",available:"undefined"!=typeof XMLHttpRequest,method:e=>{var t=Xi(e);if(t){var{contentType:i,body:n}=t,r=e.compression===Qi.GZipJS&&i===Zi?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url,s=new XMLHttpRequest;s.open(e.method||"POST",r,!0),e.headers&&Object.entries(e.headers).forEach(e=>{var[t,i]=e;s.setRequestHeader(t,i)}),s.setRequestHeader("Content-Type",i),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)try{i.json=JSON.parse(s.responseText)}catch(e){}null===(t=e.callback)||void 0===t||t.call(e,i)}},s.onerror=()=>{var t;null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0})},s.send(n)}}},{name:"sendBeacon",available:"undefined"!=typeof navigator&&!!navigator.sendBeacon,method:e=>{var t=Xi(e);if(t){var{contentType:i,body:n}=t;try{var r="string"==typeof n?new Blob([n],{type:i}):n,s=e.compression===Qi.GZipJS&&i===Zi?e.url+(e.url.includes("?")?"&":"?")+"compression=gzip-js":e.url;navigator.sendBeacon(s,r)}catch(e){}}}}],en=e=>{var t,i=e.transport||"fetch",n=Yi.find(e=>e.name===i&&e.available)||Yi.find(e=>e.available);if(!n)return console.error("vTilt: No available transport method"),void(null===(t=e.callback)||void 0===t||t.call(e,{statusCode:0}));n.method(e)};class tn{constructor(e,t){var i,n,r,s;this._isPaused=!0,this._queue=[],this._flushTimeoutMs=(i=(null==t?void 0:t.flush_interval_ms)||3e3,n=250,r=5e3,s=3e3,"number"!=typeof i||isNaN(i)?s:Math.min(Math.max(i,n),r)),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 n=e[t];this._sendRequest(i({},n,{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 n=e[i];n.events.forEach(e=>{var i=new Date(e.timestamp).getTime();e.$offset=Math.abs(i-t)}),this._sendRequest(n)}}}_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 nn{constructor(e){this._isPolling=!1,this._pollIntervalMs=3e3,this._queue=[],this._areWeOnline=!0,this._sendRequest=e.sendRequest,this._sendBeacon=e.sendBeacon,m&&void 0!==b&&"onLine"in b&&(this._areWeOnline=b.onLine,B(m,"online",()=>{this._areWeOnline=!0,this._flush()}),B(m,"offline",()=>{this._areWeOnline=!1}))}get length(){return this._queue.length}enqueue(e,t){if(void 0===t&&(t=0),t>=10)console.warn("VTilt: Request failed after 10 retries, giving up");else{var i=function(e){var t=3e3*Math.pow(2,e),i=t/2,n=Math.min(18e5,t),r=(Math.random()-.5)*(n-i);return Math.ceil(n+r)}(t),n=Date.now()+i;this._queue.push({retryAt:n,request:e,retriesPerformedSoFar:t+1});var r="VTilt: Enqueued failed request for retry in "+Math.round(i/1e3)+"s";this._areWeOnline||(r+=" (Browser is offline)"),console.warn(r),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(),n=[],r=[];this._queue.forEach(e=>{e.retryAt<i?r.push(e):n.push(e)}),this._queue=n,r.forEach(function(){var i=t(function*(t){var{request:i,retriesPerformedSoFar:n}=t;try{var r=yield e._sendRequest(i);200!==r.statusCode&&(r.statusCode<400||r.statusCode>=500)&&e.enqueue(i,n)}catch(t){e.enqueue(i,n)}});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){console.error("VTilt: Failed to send beacon on unload",e)}}),this._queue=[]}}var rn="vt_rate_limit";class sn{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,n,r;void 0===e&&(e=!1);var s=Date.now(),a=null!==(i=null===(t=this.persistence)||void 0===t?void 0:t.get(rn))&&void 0!==i?i:{tokens:this.eventsBurstLimit,last:s},o=(s-a.last)/1e3;a.tokens+=o*this.eventsPerSecond,a.last=s,a.tokens>this.eventsBurstLimit&&(a.tokens=this.eventsBurstLimit);var l=a.tokens<1;return l||e||(a.tokens=Math.max(0,a.tokens-1)),!l||this.lastEventRateLimited||e||null===(n=this.captureWarning)||void 0===n||n.call(this,"vTilt client rate limited. Config: "+this.eventsPerSecond+" events/second, "+this.eventsBurstLimit+" burst limit."),this.lastEventRateLimited=l,null===(r=this.persistence)||void 0===r||r.set(rn,a),{isRateLimited:l,remainingTokens:a.tokens}}shouldAllowEvent(){return!this.checkRateLimit(!1).isRateLimited}getRemainingTokens(){return this.checkRateLimit(!0).remainingTokens}}class an{constructor(e){this._remoteConfig=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(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 i=L(()=>m.__VTILT_BOOTSTRAP__);if(null==i?void 0:i.remoteConfig)return this._remoteConfig=i.remoteConfig,this._apply(this._remoteConfig),void this._fetch();L(()=>{var e=localStorage.getItem(u+"_"+t.token);e&&(this._remoteConfig=JSON.parse(e),this._apply(this._remoteConfig))}),this._fetch()}}_fetch(){var e=this._host.getConfig();if(e.token&&e.api_host){var t=e.api_host+"/api/decide?token="+e.token,i=new AbortController,n=setTimeout(()=>i.abort(),3e3);(C||fetch)(t,{method:"GET",signal:i.signal,headers:{Accept:"application/json"}}).then(e=>e.json()).then(t=>{var i;clearTimeout(n),this._remoteConfig=t,L(()=>{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)})}}_apply(e){var t,i,n,r,s,a,o,l,d,u=this._host.getConfig(),c={},h=!1,v=!1,_=!1;e.sessionRecording&&void 0===u.session_recording&&(c.session_recording={enabled:e.sessionRecording.enabled,sampleRate:e.sessionRecording.sampleRate,minimumDurationMs:e.sessionRecording.minimumDurationMs,fullSnapshotIntervalMs:e.sessionRecording.fullSnapshotIntervalMs,maskAllInputs:e.sessionRecording.maskAllInputs,captureConsole:e.sessionRecording.captureConsole,captureCanvas:e.sessionRecording.captureCanvas},e.sessionRecording.enabled&&(h=!0)),(null===(t=e.chat)||void 0===t?void 0:t.enabled)&&void 0===u.chat&&(c.chat={enabled:e.chat.enabled,position:e.chat.widgetPosition,color:e.chat.widgetColor},v=!0),e.analytics&&(void 0!==e.analytics.capturePageview&&void 0===u.capture_pageview&&(c.capture_pageview=e.analytics.capturePageview),void 0!==e.analytics.capturePageleave&&void 0===u.capture_pageleave&&(c.capture_pageleave=!!e.analytics.capturePageleave),void 0!==e.analytics.capturePerformance&&void 0===u.capture_performance&&(c.capture_performance=e.analytics.capturePerformance),void 0!==e.analytics.autocapture&&void 0===u.autocapture&&(c.autocapture=e.analytics.autocapture,e.analytics.autocapture&&(_=!0))),void 0!==(null===(i=e.privacy)||void 0===i?void 0:i.respectDnt)&&void 0===u.respect_dnt&&(c.respect_dnt=e.privacy.respectDnt),Object.keys(c).length>0&&this._host.updateConfig(c),null===(n=this._onApply)||void 0===n||n.call(this,e),this._host.__loaded&&(h&&(null===(s=(r=this._host).startSessionRecording)||void 0===s||s.call(r)),v&&(null===(o=(a=this._host)._initChat)||void 0===o||o.call(a)),_&&(null===(d=(l=this._host).startAutocapture)||void 0===d||d.call(l)))}}class on{constructor(e){this._set_once_properties_sent=!1,this._initial_pageview_captured=!1,this._visibility_state_listener=null,this._vt_person_id=null,this._host=e}setVtPersonId(e){this._vt_person_id=e}capture(e,t,n){var r;if(this._host.sessionManager.setSessionId(),(null==b?void 0:b.userAgent)&&function(e){return!(e&&"string"==typeof e&&e.length>500)}(b.userAgent)&&((null==n?void 0:n.skip_client_rate_limiting)||this._host.rateLimiter.shouldAllowEvent())){var s,a=this._host.buildUrl(),o=this._host.getConfig(),l=this._buildEventPayload(e,t);if(!1!==o.stringifyPayload){if(!q(s=JSON.stringify(i({},l,o.globalAttributes))))return}else if(s=i({},l,o.globalAttributes),!q(JSON.stringify(s)))return;var d="$identify"===e?this._host.userManager.getAnonymousId():null!==(r=this._host.userManager.getDistinctId())&&void 0!==r?r:this._host.userManager.getAnonymousId(),u={timestamp:(new Date).toISOString(),event:e,payload:s,distinct_id:d,anonymous_id:this._host.userManager.getAnonymousId()};this._host.sendRequest(a,u,!0)}}captureInternal(e,t){this.capture(e,t,{skip_client_rate_limiting:!0})}trackEvent(e,t){void 0===t&&(t={}),this.capture(e,t)}captureInitialPageview(){w&&("visible"===w.visibilityState?this._initial_pageview_captured||(this._initial_pageview_captured=!0,setTimeout(()=>{w&&S&&this.capture("$pageview",{navigation_type:"initial_load"})},300),this._visibility_state_listener&&(w.removeEventListener("visibilitychange",this._visibility_state_listener),this._visibility_state_listener=null)):this._visibility_state_listener||(this._visibility_state_listener=()=>this.captureInitialPageview(),B(w,"visibilitychange",this._visibility_state_listener)))}_buildEventPayload(e,t){var n=dt(),r=this._host.userManager.getUserProperties(),s=this._host.userManager.get_initial_props(),a=this._host.sessionManager.getSessionId(),o=this._host.sessionManager.getWindowId(),l=this._host.userManager.getAnonymousId(),d={};!this._set_once_properties_sent&&Object.keys(s).length>0&&Object.assign(d,s),t.$set_once&&Object.assign(d,t.$set_once);var u=i({},n,r,{$session_id:a,$window_id:o},l?{$anon_distinct_id:l}:{},this._vt_person_id?{$vt:this._vt_person_id}:{},Object.keys(d).length>0?{$set_once:d}:{},t.$set?{$set:t.$set}:{},t);return!this._set_once_properties_sent&&Object.keys(s).length>0&&(this._set_once_properties_sent=!0),"$pageview"===e&&w&&(u.title=w.title),u}}class ln{constructor(e){this._host=e}identify(e,t,i){var n,r;if("number"==typeof e&&(e=String(e),console.warn("identify: first argument should be a string, not a number")),e)if(this._host.userManager.isDistinctIdStringLikePublic(e))console.error('identify: "'+e+'" appears to be a hardcoded string');else if("COOKIELESS_SENTINEL_VALUE"!==e){var s=this._host.userManager.getDistinctId(),a=this._host.userManager.getAnonymousId(),o=this._host.userManager.getDeviceId(),l="anonymous"===this._host.userManager.getUserState();o||this._host.userManager.ensureDeviceId(s||a),e!==s&&l?(this._host.userManager.setUserState("identified"),this._host.userManager.updateUserProperties(t,i),this._host.capture("$identify",{distinct_id:e,$anon_distinct_id:a,$set:t||{},$set_once:i||{}}),this._host.userManager.setDistinctId(e),null===(n=this._host._emitter)||void 0===n||n.emit("user:identified",{distinctId:e})):e!==s?(this._host.userManager.setUserState("identified"),this._host.userManager.setDistinctId(e),this._host.userManager.updateUserProperties(t,i),this._host.capture("$identify",{distinct_id:e,$anon_distinct_id:a,$set:t||{},$set_once:i||{}}),null===(r=this._host._emitter)||void 0===r||r.emit("user:identified",{distinctId:e})):(t||i)&&(l&&this._host.userManager.setUserState("identified"),this._host.userManager.updateUserProperties(t,i),this._host.capture("$set",{$set:t||{},$set_once:i||{}}))}else console.error("identify: cannot use sentinel value as distinct_id");else console.error("identify: unique user id is required")}setUserProperties(e,t){var i;this._host.userManager.setUserProperties(e,t)&&(this._host.capture("$set",{$set:e||{},$set_once:t||{}}),null===(i=this._host._emitter)||void 0===i||i.emit("user:properties_set",{properties:e}))}resetUser(e){var t;this._host.sessionManager.resetSessionId(),this._host.userManager.reset(e),null===(t=this._host._emitter)||void 0===t||t.emit("user:reset")}createAlias(e,t){var i=this._host.userManager.createAlias(e,t);i?this._host.capture("$alias",{$original_id:i.original,$alias_id:i.distinct_id}):e===(t||this._host.userManager.getDistinctId()||this._host.userManager.getAnonymousId())&&this.identify(e)}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()}}class dn{constructor(e){this._features=new Map,this._host=e}onFeatureStarted(e){this._onFeatureStarted=e}onFeatureStopped(e){this._onFeatureStopped=e}register(e){this._features.set(e.name,e)}get(e){var t;return null===(t=this._features.get(e))||void 0===t?void 0:t.instance}initAll(){this._features.forEach(e=>{this._initFeature(e)})}init(e){var t=this._features.get(e);if(t)return this._initFeature(t),t.instance}start(e){var t,i=this._features.get(e);if(i&&(i.instance||this._initFeature(i),i.instance)){if(i.instance.onConfigUpdate){var n=this._host.getConfig();i.instance.onConfigUpdate(n)}i.instance.startIfEnabled(),null===(t=this._onFeatureStarted)||void 0===t||t.call(this,e)}}stop(e){var t,i=this._features.get(e);(null==i?void 0:i.instance)&&(i.instance.stop(),null===(t=this._onFeatureStopped)||void 0===t||t.call(this,e))}isActive(e){var t,i,n;return null!==(n=null===(i=null===(t=this._features.get(e))||void 0===t?void 0:t.instance)||void 0===i?void 0:i.isStarted)&&void 0!==n&&n}notifyConfigUpdate(e){this._features.forEach(t=>{var i;(null===(i=t.instance)||void 0===i?void 0:i.onConfigUpdate)&&L(()=>t.instance.onConfigUpdate(e))})}notifyRemoteConfig(e){this._features.forEach(t=>{var i;(null===(i=t.instance)||void 0===i?void 0:i.onRemoteConfig)&&L(()=>t.instance.onRemoteConfig(e))})}getAll(){var e=[];return this._features.forEach(t=>{t.instance&&e.push(t.instance)}),e}_initFeature(e){if(!e.instance){var t=this._host.getConfig();e.disableKey&&t[e.disableKey]||e.enableKey&&!1===t[e.enableKey]||L(()=>{var t;e.instance=new e.FeatureClass(this._host),e.instance.startIfEnabled(),e.instance.isStarted&&(null===(t=this._onFeatureStarted)||void 0===t||t.call(this,e.name))})}}}var un="vt",cn=Array.isArray;class hn{constructor(e){void 0===e&&(e={}),this.version=n,this.__loaded=!1,this.__request_queue=[],this._has_warned_about_config=!1,this._emitter=new M,this.configManager=new E(e);var t=this.configManager.getConfig();this.sessionManager=new Q(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new ut(t.persistence||"localStorage+cookie",t.cross_subdomain_cookie),this.rateLimiter=new sn({eventsPerSecond:10,eventsBurstLimit:100,captureWarning:e=>{this._captureManager.captureInternal("$$client_ingestion_warning",{$$client_ingestion_warning_message:e})}}),this.retryQueue=new nn({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._captureManager=new on(this),this._identityManager=new ln(this),this._remoteConfigManager=new an(this),this._featureManager=new dn(this),this._remoteConfigManager.onApply(e=>{this._featureManager.notifyRemoteConfig(e)}),this._remoteConfigManager.onLoad(e=>{this._emitter.emit(R,{config:e})}),this._featureManager.onFeatureStarted(e=>{this._emitter.emit(P,{feature:e})}),this._featureManager.onFeatureStopped(e=>{this._emitter.emit(U,{feature:e})})}init(e,t,i){var n;if(i&&i!==un){var r=null!==(n=vn[i])&&void 0!==n?n:new hn;return r._init(e,t,i),vn[i]=r,vn[un][i]=r,r}return this._init(e,t,i)}_init(e,t,n){if(void 0===t&&(t={}),this.__loaded)return console.warn("vTilt: Already initialized! Re-initializing is a no-op"),this;this.updateConfig(i({},t,{token:e||t.token,name:n})),this.__loaded=!0,this._read_vt_param_from_url(),this._remoteConfigManager.load();var r=this.configManager.getConfig();return this.userManager.set_initial_person_info(r.mask_personal_data_properties,r.custom_personal_data_properties),this._initFeatures(),this._setup_unload_handler(),this._start_queue_if_opted_in(),!1!==r.capture_pageview&&this._captureManager.captureInitialPageview(),this._emitter.emit(T,{config:r}),this}_initFeatures(){this._initHistoryAutocapture(),this._initAutocapture(),this._initWebVitals(),this._initSessionRecording(),this._initChat()}_initHistoryAutocapture(){this.historyAutocapture||(this.historyAutocapture=new pt(this),this.historyAutocapture.startIfEnabled())}_initAutocapture(){this.autocapture||!1!==this.configManager.getConfig().autocapture&&(this.autocapture=new si(this),this.autocapture.startIfEnabled())}_initWebVitals(){this.webVitals||(this.webVitals=new _t(this),this.webVitals.startIfEnabled())}_initSessionRecording(){this.sessionRecording||(this.configManager.getConfig().disable_session_recording||(this.sessionRecording=new oi(this),this.sessionRecording.isEnabled&&(this.sessionRecording.startIfEnabledOrStop("recording_initialized"),this._emitter.emit($))))}_initChat(){this.chat||(this.configManager.getConfig().disable_chat||(this.chat=new Gi(this),this.chat.startIfEnabled()))}startAutocapture(){this.autocapture||(this.autocapture=new si(this)),this.autocapture.updateConfig({enabled:!0}),this.autocapture.startIfEnabled()}stopAutocapture(){var e;null===(e=this.autocapture)||void 0===e||e.stop()}isAutocaptureActive(){var e,t;return null!==(t=null===(e=this.autocapture)||void 0===e?void 0:e.isStarted)&&void 0!==t&&t}startSessionRecording(){this.sessionRecording||(this.sessionRecording=new oi(this)),this.sessionRecording.updateConfig({enabled:!0}),this.sessionRecording.startIfEnabledOrStop("recording_initialized"),this._emitter.emit($)}stopSessionRecording(){var e;null===(e=this.sessionRecording)||void 0===e||e.stop(),this._emitter.emit(z)}isRecordingActive(){var e;return"active"===(null===(e=this.sessionRecording)||void 0===e?void 0:e.status)}getSessionRecordingId(){var e;return(null===(e=this.sessionRecording)||void 0===e?void 0:e.sessionId)||null}capture(e,t,i){this._captureManager.capture(e,t,i),this._emitter.emit(O,{event:e,payload:t})}trackEvent(e,t){void 0===t&&(t={}),this._captureManager.trackEvent(e,t)}identify(e,t,i){this._identityManager.identify(e,t,i)}setUserProperties(e,t){this._identityManager.setUserProperties(e,t)}resetUser(e){this._identityManager.resetUser(e)}createAlias(e,t){this._identityManager.createAlias(e,t)}getUserIdentity(){return this._identityManager.getUserIdentity()}getDeviceId(){return this._identityManager.getDeviceId()}getUserState(){return this._identityManager.getUserState()}getConfig(){return this.configManager.getConfig()}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:un;return t!==un&&(t="vt."+t),t}updateConfig(e){this.configManager.updateConfig(e);var t=this.configManager.getConfig();this.sessionManager=new Q(t.storage||"cookie",t.cross_subdomain_cookie),this.userManager=new ut(t.persistence||"localStorage+cookie",t.cross_subdomain_cookie),this._notifyFeaturesOfConfigUpdate(t),this._emitter.emit(A,{config:t})}_notifyFeaturesOfConfigUpdate(e){[this.historyAutocapture,this.autocapture,this.webVitals,this.sessionRecording,this.chat,this.vtdOverlay].forEach(t=>{(null==t?void 0:t.onConfigUpdate)&&L(()=>t.onConfigUpdate(e))})}buildUrl(){var e=this.configManager.getConfig(),{proxyUrl:t,proxy:i,api_host:n,token:r}=e;return t||(i?i+"/api/tracking?token="+r:n?n.replace(/\/+$/gm,"")+"/api/tracking?token="+r:"/api/tracking?token="+r)}sendRequest(e,t,i){if(this._is_configured()){if(i&&void 0!==m)if(m.__VTILT_ENQUEUE_REQUESTS)return void this.__request_queue.push({url:e,event:t});this.requestQueue.enqueue({url:e,event:t})}}_is_configured(){return!!this.configManager.getConfig().token||(this._has_warned_about_config||(console.warn("VTilt: 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:n}=e,r=1===n.length?n[0]:{events:n},s=this.configManager.getConfig().disable_compression?Qi.None:Qi.GZipJS;en({url:i,data:r,method:"POST",transport:"XHR",compression:s,callback:e=>t({statusCode:e.statusCode})})})}_send_beacon_request(e){var{url:t,events:i}=e,n=1===i.length?i[0]:{events:i},r=this.configManager.getConfig().disable_compression?Qi.None:Qi.GZipJS;en({url:t,data:n,method:"POST",transport:"sendBeacon",compression:r})}_send_retriable_request(e){this.sendRequest(e.url,e.event,!1)}_setup_unload_handler(){if(m){var e=()=>{this.requestQueue.unload(),this.retryQueue.unload()};B(m,"beforeunload",e),B(m,"pagehide",e)}}_start_queue_if_opted_in(){this.requestQueue.enable()}_read_vt_param_from_url(){L(()=>{var e,t;if(void 0!==S&&S.search){var i=new URL(S.href),n=i.searchParams.get("vt"),r=i.searchParams.get("vtd");if((null==n?void 0:n.trim())&&(this._captureManager.setVtPersonId(n.trim()),i.searchParams.delete("vt")),(null==r?void 0:r.trim())&&(this._initVtdOverlay(r.trim()),i.searchParams.delete("vtd")),(null==n?void 0:n.trim())||(null==r?void 0:r.trim())){var s=i.pathname+(i.search||"")+i.hash;null===(t=null===(e=null==m?void 0:m.history)||void 0===e?void 0:e.replaceState)||void 0===t||t.call(e,{},"",s)}}})}_initVtdOverlay(e){this.vtdOverlay||(this.vtdOverlay=new Ki(this),this.vtdOverlay.setDestinationUrl(e))}_execute_array(e){Array.isArray(e)&&e.forEach(e=>{if(e&&Array.isArray(e)&&e.length>0){var t=e[0],i=e.slice(1);"function"==typeof this[t]&&L(()=>this[t](...i))}})}_dom_loaded(){this.__request_queue.forEach(e=>this._send_retriable_request(e)),this.__request_queue=[],this._start_queue_if_opted_in()}}var vn={},_n=!(void 0!==x||void 0!==C)&&-1===(null==I?void 0:I.indexOf("MSIE"))&&-1===(null==I?void 0:I.indexOf("Mozilla"));null!=m&&(m.__VTILT_ENQUEUE_REQUESTS=_n);var gn,pn;gn=vn[un]=new hn,(pn=k.vt)&&F(pn._i,function(e){if(e&&cn(e)){var t=gn.init(e[0],e[1],e[2]),i=pn[e[2]||"vt"]||pn;t&&t._execute_array(i)}}),k.vt=gn,function(){function e(){e.done||(e.done=!0,_n=!1,null!=m&&(m.__VTILT_ENQUEUE_REQUESTS=!1),F(vn,e=>e._dom_loaded()))}w&&"function"==typeof w.addEventListener?"complete"===w.readyState?e():B(w,"DOMContentLoaded",e,{capture:!1}):m&&console.error("Browser doesn't support document.addEventListener")}()}();
|
|
2
2
|
//# sourceMappingURL=array.no-external.js.map
|