@dori-ai/dori-side-widget 1.13.35 → 1.13.36
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/widget.js +1 -1
- package/dist/widget.js.br +0 -0
- package/dist/widget.js.gz +0 -0
- package/package.json +1 -1
package/dist/widget.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const e={},t=function(t,i,r){let s=Promise.resolve();if(i&&i.length>0){let t=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))};const n=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");s=t(i.map(t=>{if(t=function(e,t){return new URL(e,t).href}(t,r),t in e)return;e[t]=!0;const i=t.endsWith(".css"),s=i?'[rel="stylesheet"]':"";if(r)for(let e=n.length-1;e>=0;e--){const r=n[e];if(r.href===t&&(!i||"stylesheet"===r.rel))return}else if(document.querySelector(`link[href="${t}"]${s}`))return;const o=document.createElement("link");return o.rel=i?"stylesheet":"modulepreload",i||(o.as="script"),o.crossOrigin="",o.href=t,a&&o.setAttribute("nonce",a),document.head.appendChild(o),i?new Promise((e,i)=>{o.addEventListener("load",e),o.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${t}`)))}):void 0}))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(e=>{for(const t of e||[])"rejected"===t.status&&n(t.reason);return t().catch(n)})};let i=null;function r(e){let t=e.replace(/<thought>[\s\S]*?<\/thought>/gi,"");return t=t.replace(/<thought>[\s\S]*$/gi,""),t.trim()}const s=e=>{if(!e)return;const t=e.closest('[data-scroll-container="chat-messages"]');t&&null===i&&(i=setTimeout(()=>{i=null,t.scrollTo({top:t.scrollHeight,behavior:"smooth"})},200))},n=(e,t,i=new Date)=>{const r=e||"Dori";return`${i.getHours()>=18&&t.hiImEvening?t.hiImEvening:t.hiIm} ${r}!`};var o="undefined"!=typeof window?window:void 0,a="undefined"!=typeof globalThis?globalThis:o,l=Array.prototype,c=l.forEach,u=l.indexOf,h=null==a?void 0:a.navigator,d=null==a?void 0:a.document,p=null==a?void 0:a.location,g=null==a?void 0:a.fetch,_=null!=a&&a.XMLHttpRequest&&"withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:void 0,v=null==a?void 0:a.AbortController,f=null==h?void 0:h.userAgent,m=null!=o?o:{},y={DEBUG:!1,LIB_VERSION:"1.283.0"};function b(e,t,i,r,s,n,o){try{var a=e[n](o),l=a.value}catch(c){return void i(c)}a.done?t(l):Promise.resolve(l).then(r,s)}function w(e){return function(){var t=this,i=arguments;return new Promise(function(r,s){var n=e.apply(t,i);function o(e){b(n,r,s,o,a,"next",e)}function a(e){b(n,r,s,o,a,"throw",e)}o(void 0)})}}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},E.apply(null,arguments)}function S(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var x=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],k=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return x.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})},I=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function P(e,t){return-1!==e.indexOf(t)}var T=function(e){return e.trim()},$=function(e){return e.replace(/^\$/,"")},O=Array.isArray,F=Object.prototype,C=F.hasOwnProperty,R=F.toString,A=O||function(e){return"[object Array]"===R.call(e)},D=e=>"function"==typeof e,M=e=>e===Object(e)&&!A(e),N=e=>{if(M(e)){for(var t in e)if(C.call(e,t))return!1;return!0}return!1},L=e=>void 0===e,j=e=>"[object String]"==R.call(e),U=e=>j(e)&&0===e.trim().length,H=e=>null===e,q=e=>L(e)||H(e),B=e=>"[object Number]"==R.call(e),G=e=>"[object Boolean]"===R.call(e),W=e=>P(I,e);function V(e){return null===e||"object"!=typeof e}function z(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function Y(e){return!L(Event)&&function(e,t){try{return e instanceof t}catch(i){return!1}}(e,Event)}var X=[!0,"true",1,"1","yes"],J=e=>P(X,e),K=[!1,"false",0,"0","no"];function Z(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),B(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Z(s||i,t,i,r))}class Q{constructor(e){this.t={},this.i=e.i,this.o=Z(e.bucketSize,0,100,e.h),this.m=Z(e.refillRate,0,this.o,e.h),this.S=Z(e.refillInterval,0,864e5,e.h)}$(e,t){var i=t-e.lastAccess,r=Math.floor(i/this.S);if(r>0){var s=r*this.m;e.tokens=Math.min(e.tokens+s,this.o),e.lastAccess=e.lastAccess+r*this.S}}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this.t[r];return s?this.$(s,i):(s={tokens:this.o,lastAccess:i},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this.i)||t.call(this,e)),0===s.tokens)}stop(){this.t={}}}var ee,te,ie,re=e=>e instanceof Error;function se(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return ie&&i.length===te||(te=i.length,ie=i.reduce((i,r)=>{ee||(ee={});var s=ee[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,c=t[r];if(l&&c){i[l]=c,ee[r]=[l,c];break}}return i},{})),ie}}var ne="?";function oe(e,t,i,r){var s={platform:"web:javascript",filename:e,function:"<anonymous>"===t?ne:t,in_app:!0};return L(i)||(s.lineno=i),L(r)||(s.colno=r),s}var ae=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:ne,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},le=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ce=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ue=/\((\S*)(?::(\d+))(?::(\d+))\)/,he=e=>{var t=le.exec(e);if(t){var[,i,r,s]=t;return oe(i,ne,+r,+s)}var n=ce.exec(e);if(n){if(n[2]&&0===n[2].indexOf("eval")){var o=ue.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}var[a,l]=ae(n[1]||ne,n[2]);return oe(l,a,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},de=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ge=e=>{var t=de.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=pe.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var r=t[3],s=t[1]||ne;return[s,r]=ae(s,r),oe(r,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},_e=/\(error: (.*)\)/;class ve{constructor(e,t,i){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===i&&(i=[]),this.coercers=e,this.modifiers=i,this.stackParser=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return function(e,i){void 0===i&&(i=0);for(var r=[],s=e.split("\n"),n=i;n<s.length;n++){var o=s[n];if(!(o.length>1024)){var a=_e.test(o)?o.replace(_e,"$1"):o;if(!a.match(/\S*Error: /)){for(var l of t){var c=l(a);if(c){r.push(c);break}}if(r.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return E({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||ne});var i})}(r)}}(...t)}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return w(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&A(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),E({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return w(function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i})()}convertToExceptionList(e,t){var i,r,s,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,E({},t,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:se(this.stackParser)}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var r=(i,r)=>{if(r<=4){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return E({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,i),next:e=>r(e,i+1)})}}class fe{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return z(e,"DOMException")}isDOMError(e){return z(e,"DOMError")}}class me{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&"string"==typeof i.error.message?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class ye{constructor(){}match(e){return z(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var be=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class we{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(be);return r&&(t=r[1],i=r[2]),[t,i]}}var Ee=["fatal","error","warning","log","info","debug"];function Se(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(!(s.length>t))return r===i.length||s.length<=t?s:s.slice(0,t)+"..."}return""}class xe{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Y(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Se(e)}isSeverityLevel(e){return j(e)&&!U(e)&&Ee.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(re(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(i){return}}}class ke{match(e){return Y(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Se(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ie{match(e){return V(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Pe{match(e){return z(e,"PromiseRejectionEvent")}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return V(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(V(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(t){}return e}}var Te=e=>{var t={k:function(t){if(o&&(y.DEBUG||m.POSTHOG_DEBUG)&&!L(o.console)&&o.console){for(var i=("__rrweb_original__"in o.console[t]?o.console[t].__rrweb_original__:o.console[t]),r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];i(e,...s)}},info:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.k("log",...i)},warn:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.k("warn",...i)},error:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.k("error",...i)},critical:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning:e=>{t.error("You must initialize PostHog before calling "+e)},createLogger:t=>Te(e+" "+t)};return t},$e=Te("[PostHog.js]"),Oe=$e.createLogger,Fe=Oe("[ExternalScriptsLoader]"),Ce=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Fe.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==d?void 0:d.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}},o=0;o<r.length;o++)if(s=n())return s.v;var a=()=>{if(!d)return i("document not found");var r=d.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,i(void 0,e)},r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");var s,n=d.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):d.body.appendChild(r)};null!=d&&d.body?a():null==d||d.addEventListener("DOMContentLoaded",a)};m.__PosthogExtensions__=m.__PosthogExtensions__||{},m.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var r="/static/"+t+".js?v="+e.version;if("remote-config"===t&&(r="/array/"+e.config.token+"/config.js"),"toolbar"===t){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=e.requestRouter.endpointFor("assets",r);Ce(e,n,i)},m.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);Ce(e,r,i)};var Re={};function Ae(e,t,i){if(A(e))if(c&&e.forEach===c)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(i,e[r],r)===Re)return}function De(e,t,i){if(!q(e)){if(A(e))return Ae(e,t,i);if((e=>e instanceof FormData)(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===Re)return}else for(var s in e)if(C.call(e,s)&&t.call(i,e[s],s)===Re)return}}var Me=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Ae(i,function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])}),e},Ne=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Ae(i,function(t){Ae(t,function(t){e.push(t)})}),e};function Le(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var je=function(e){try{return e()}catch(t){return}},Ue=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(s){$e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$e.critical(s)}}},He=function(e){var t={};return De(e,function(e,i){(j(e)&&e.length>0||B(e))&&(t[i]=e)}),t},qe=["herokuapp.com","vercel.app","netlify.app"];function Be(e){var t=null==e?void 0:e.hostname;if(!j(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of qe)if(i===r)return!1;return!0}function Ge(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function We(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}var Ve="$people_distinct_id",ze="__alias",Ye="__timers",Xe="$autocapture_disabled_server_side",Je="$heatmaps_enabled_server_side",Ke="$exception_capture_enabled_server_side",Ze="$error_tracking_suppression_rules",Qe="$error_tracking_capture_extension_exceptions",et="$web_vitals_enabled_server_side",tt="$dead_clicks_enabled_server_side",it="$web_vitals_allowed_metrics",rt="$session_recording_remote_config",st="$sesid",nt="$session_is_sampled",ot="$enabled_feature_flags",at="$early_access_features",lt="$feature_flag_details",ct="$stored_person_properties",ut="$stored_group_properties",ht="$surveys",dt="$surveys_activated",pt="$flag_call_reported",gt="$user_state",_t="$client_session_props",vt="$capture_rate_limit",ft="$initial_campaign_params",mt="$initial_referrer_info",yt="$initial_person_info",bt="$epp",wt="__POSTHOG_TOOLBAR__",Et="$posthog_cookieless",St=[Ve,ze,"__cmpns",Ye,"$session_recording_enabled_server_side",Je,st,ot,Ze,gt,at,lt,ut,ct,ht,pt,_t,vt,ft,mt,bt,yt];function xt(e){return e instanceof Element&&(e.id===wt||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function kt(e){return!!e&&1===e.nodeType}function It(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Pt(e){return!!e&&3===e.nodeType}function Tt(e){return!!e&&11===e.nodeType}function $t(e){return e?T(e).split(/\s+/):[]}function Ot(e){var t=null==o?void 0:o.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function Ft(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return $t(t)}function Ct(e){return q(e)?null:T(e).split(/(\s+)/).filter(e=>Xt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Rt(e){var t="";return Ht(e)&&!qt(e)&&e.childNodes&&e.childNodes.length&&De(e.childNodes,function(e){var i;Pt(e)&&e.textContent&&(t+=null!==(i=Ct(e.textContent))&&void 0!==i?i:"")}),T(t)}function At(e){return L(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Dt=["a","button","form","input","select","textarea","label"];function Mt(e,t){if(L(t))return!0;var i,r=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function Nt(e){var t=e.parentNode;return!(!t||!kt(t))&&t}var Lt=[".ph-no-rageclick",".ph-no-capture"],jt=e=>!e||It(e,"html")||!kt(e),Ut=(e,t)=>{if(!o||jt(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],s=e;s.parentNode&&!It(s,"body");)if(Tt(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Nt(s);if(!n)break;if(t||Dt.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var a=o.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Ht(e){for(var t=e;t.parentNode&&!It(t,"body");t=t.parentNode){var i=Ft(t);if(P(i,"ph-sensitive")||P(i,"ph-no-capture"))return!1}if(P(Ft(e),"ph-include"))return!0;var r=e.type||"";if(j(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!j(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function qt(e){return!!(It(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||It(e,"select")||It(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Bt="(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})",Gt=new RegExp("^(?:"+Bt+")$"),Wt=new RegExp(Bt),Vt="\\d{3}-?\\d{2}-?\\d{4}",zt=new RegExp("^("+Vt+")$"),Yt=new RegExp("("+Vt+")");function Xt(e,t){if(void 0===t&&(t=!0),q(e))return!1;if(j(e)){if(e=T(e),(t?Gt:Wt).test((e||"").replace(/[- ]/g,"")))return!1;if((t?zt:Yt).test(e))return!1}return!0}function Jt(e){var t=Rt(e);return Xt(t=(t+" "+Kt(e)).trim())?t:""}function Kt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&De(e.childNodes,function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=Rt(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Kt(e)).trim())}catch(s){$e.error("[AutoCapture]",s)}}),t}function Zt(e){return e.map(e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?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 Le(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r}).map(e=>{var t,i,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 n=E({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Le(n).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[Qt(t.toString())]=Qt(i.toString())}),(r+=":")+Le(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")}function Qt(e){return e.replace(/"|\\"/g,'\\"')}function ei(e){var t=e.attr__class;return t?A(t)?t:$t(t):void 0}class ti{constructor(){this.clicks=[]}isRageClick(e,t,i){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&i-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var ii,ri="$copy_autocapture",si=((ii={}).GZipJS="gzip-js",ii.Base64="base64",ii),ni=e=>{var t=null==d?void 0:d.createElement("a");return L(t)?null:(t.href=e,t)},oi=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!A(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(a){$e.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ai=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],h=0;h<c.length;h++){var d=c[h].split("=");A(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(c[h]))}var p=l;return null!=a&&(p+="?"+u.join("&")),null!=n&&(p+="#"+n),p},li=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ci=Oe("[AutoCapture]");function ui(e,t){return t.length>e?t.slice(0,e)+"...":t}function hi(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!kt(t));return t}class di{constructor(e){this.P=!1,this.T=null,this.rageclicks=new ti,this.R=!1,this.instance=e,this.I=null}get C(){var e,t,i=M(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}O(){if(this.isBrowserSupported()){if(o&&d){var e=e=>{e=e||(null==o?void 0:o.event);try{this.F(e)}catch(ii){ci.error("Failed to capture event",ii)}};if(We(d,"submit",e,{capture:!0}),We(d,"change",e,{capture:!0}),We(d,"click",e,{capture:!0}),this.C.capture_copied_text){var t=e=>{e=e||(null==o?void 0:o.event),this.F(e,ri)};We(d,"copy",t,{capture:!0}),We(d,"cut",t,{capture:!0})}}}else ci.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.O(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.R=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Xe]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.I=e}getElementSelectors(e){var t,i=[];return null==(t=this.I)||t.forEach(t=>{var r=null==d?void 0:d.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[Xe],r=this.T;if(H(r)&&!G(i)&&!this.instance.M())return!1;var s=null!==(t=this.T)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}F(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=At(e);Pt(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&function(e,t){if(!o||jt(e))return!1;var i,r;if(!1===(i=G(t)?!!t&&Lt:null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Lt))return!1;var{targetElementList:s}=Ut(e,!1);return!Mt(s,i)}(r,this.instance.config.rageclick)&&this.F(e,"$rageclick");var s=t===ri;if(r&&function(e,t,i,r,s){var n,a,l,c;if(void 0===i&&(i=void 0),!o||jt(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!Ot(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&Ot(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:h,targetElementList:d}=Ut(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(L(i))return!0;var r,s=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(d,i))return!1;if(!Mt(d,null==(c=i)?void 0:c.css_selector_allowlist))return!1;var p=o.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return h?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(Dt.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.C,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=function(e,t){for(var i,r,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],h=e;h.parentNode&&!It(h,"body");)Tt(h.parentNode)?(u.push(h.parentNode.host),h=h.parentNode.host):(u.push(h.parentNode),h=h.parentNode);var d,p=[],g={},_=!1,v=!1;if(De(u,e=>{var t=Ht(e);"a"===e.tagName.toLowerCase()&&(_=e.getAttribute("href"),_=t&&_&&Xt(_)&&_),P(Ft(e),"ph-no-capture")&&(v=!0),p.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};Dt.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=ui(1024,Jt(e)):n.$el_text=ui(1024,Rt(e)));var o=Ft(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),De(e.attributes,function(i){var s;if((!qt(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&Xt(i.value)&&(s=i.name,!j(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=$t(o).join(" ")),n["attr__"+i.name]=ui(1024,o)}});for(var a=1,l=1,c=e;c=hi(c);)a++,c.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,n,a,l));var i=function(e){if(!Ht(e))return{};var t={};return De(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Xt(r)&&(t[i]=r)}}),t}(e);Me(g,i)}),v)return{props:{},explicitNoCapture:v};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?p[0].$el_text=Jt(e):p[0].$el_text=Rt(e)),_){var f,m;p[0].attr__href=_;var y=null==(f=ni(_))?void 0:f.host,b=null==o||null==(m=o.location)?void 0:m.host;y&&b&&y!==b&&(d=_)}return{props:Me({$event_type:s.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:Zt(p)},null!=(i=p[0])&&i.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},d&&"click"===s.type?{$external_click_url:d}:{},g)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.C.element_attribute_ignorelist,elementsChainAsString:this.R});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(n.$element_selectors=l),t===ri){var c,u=Ct(null==o||null==(c=o.getSelection())?void 0:c.toString()),h=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return D(null==d?void 0:d.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return B(e)&&isFinite(e)&&Math.floor(e)===e});var pi="0123456789abcdef";class gi{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new gi(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+pi.charAt(this.bytes[t]>>>4)+pi.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new gi(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class _i{constructor(){this.A=0,this.D=0,this.j=new mi}generate(){var e=this.generateOrAbort();if(L(e)){this.A=0;var t=this.generateOrAbort();if(L(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return gi.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var vi,fi=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};o&&!L(o.crypto)&&crypto.getRandomValues&&(fi=e=>crypto.getRandomValues(e));class mi{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(fi(this.N),this.U=0),this.N[this.U++]}}var yi=()=>bi().toString(),bi=()=>(vi||(vi=new _i)).generate(),wi="",Ei=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Si={H:()=>!!d,B:function(e){$e.error("cookieStore error: "+e)},q:function(e){if(d){try{for(var t=e+"=",i=d.cookie.split(";").filter(e=>e.length),r=0;r<i.length;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(n){}return null}},W:function(e){var t;try{t=JSON.parse(Si.q(e))||{}}catch(i){}return t},G:function(e,t,i,r,s){if(d)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=d),wi)return wi;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+yi();!wi&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",wi=n)}return wi}(e);if(!i){var r=(s=e.match(Ei))?s[0]:"";r!==i&&$e.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}var s;return""}(d.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&$e.warn("cookieStore warning: large cookie, len="+c.length),d.cookie=c,c}catch(u){return}},V:function(e,t){if(null!=d&&d.cookie)try{Si.G(e,"",-1,t)}catch(i){return}}},xi=null,ki={H:function(){if(!H(xi))return xi;var e=!0;if(L(o))e=!1;else try{var t="__mplssupport__";ki.G(t,"xyz"),'"xyz"'!==ki.q(t)&&(e=!1),ki.V(t)}catch(ii){e=!1}return e||$e.error("localStorage unsupported; falling back to cookie store"),xi=e,e},B:function(e){$e.error("localStorage error: "+e)},q:function(e){try{return null==o?void 0:o.localStorage.getItem(e)}catch(ii){ki.B(ii)}return null},W:function(e){try{return JSON.parse(ki.q(e))||{}}catch(t){}return null},G:function(e,t){try{null==o||o.localStorage.setItem(e,JSON.stringify(t))}catch(ii){ki.B(ii)}},V:function(e){try{null==o||o.localStorage.removeItem(e)}catch(ii){ki.B(ii)}}},Ii=["distinct_id",st,nt,bt,yt],Pi=E({},ki,{W:function(e){try{var t={};try{t=Si.W(e)||{}}catch(r){}var i=Me(t,JSON.parse(ki.q(e)||"{}"));return ki.G(e,i),i}catch(r){}return null},G:function(e,t,i,r,s,n){try{ki.G(e,t,void 0,void 0,n);var o={};Ii.forEach(e=>{t[e]&&(o[e]=t[e])}),Object.keys(o).length&&Si.G(e,o,i,r,s,n)}catch(a){ki.B(a)}},V:function(e,t){try{null==o||o.localStorage.removeItem(e),Si.V(e,t)}catch(ii){ki.B(ii)}}}),Ti={},$i={H:function(){return!0},B:function(e){$e.error("memoryStorage error: "+e)},q:function(e){return Ti[e]||null},W:function(e){return Ti[e]||null},G:function(e,t){Ti[e]=t},V:function(e){delete Ti[e]}},Oi=null,Fi={H:function(){if(!H(Oi))return Oi;if(Oi=!0,L(o))Oi=!1;else try{var e="__support__";Fi.G(e,"xyz"),'"xyz"'!==Fi.q(e)&&(Oi=!1),Fi.V(e)}catch(ii){Oi=!1}return Oi},B:function(e){$e.error("sessionStorage error: ",e)},q:function(e){try{return null==o?void 0:o.sessionStorage.getItem(e)}catch(ii){Fi.B(ii)}return null},W:function(e){try{return JSON.parse(Fi.q(e))||null}catch(t){}return null},G:function(e,t){try{null==o||o.sessionStorage.setItem(e,JSON.stringify(t))}catch(ii){Fi.B(ii)}},V:function(e){try{null==o||o.sessionStorage.removeItem(e)}catch(ii){Fi.B(ii)}}},Ci=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class Ri{constructor(e){this._instance=e}get C(){return this._instance.config}get consent(){return this.J()?Ci.DENIED:this.K}isOptedOut(){return"always"===this.C.cookieless_mode||this.consent===Ci.DENIED||this.consent===Ci.PENDING&&(this.C.opt_out_capturing_by_default||"on_reject"===this.C.cookieless_mode)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ci.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.C.cookie_expiration,this.C.cross_subdomain_cookie,this.C.secure_cookie)}reset(){this.Y.V(this.X,this.C.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return J(e)?Ci.GRANTED:P(K,e)?Ci.DENIED:Ci.PENDING}get Y(){if(!this.Z){var e=this.C.opt_out_capturing_persistence_type;this.Z="localStorage"===e?ki:Si;var t="localStorage"===e?Si:ki;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(J(t.q(this.X))),t.V(this.X,this.C.cross_subdomain_cookie))}return this.Z}J(){return!!this.C.respect_dnt&&!!Ge([null==h?void 0:h.doNotTrack,null==h?void 0:h.msDoNotTrack,m.doNotTrack],e=>J(e))}}var Ai=Oe("[Dead Clicks]"),Di=()=>!0,Mi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(tt)),r=e.instance.config.capture_dead_clicks;return G(r)?r:i};class Ni{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[tt]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?Ai.error("failed to load script",t):e()})}et(){var e;if(d){if(!this.tt&&null!=(e=m.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=M(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=m.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(d),Ai.info("starting...")}}else Ai.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Ai.info("stopping..."))}}var Li=Oe("[ExceptionAutocapture]");class ji{constructor(e){var t,i,r;this.rt=()=>{var e;if(o&&this.isEnabled&&null!=(e=m.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=m.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=m.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=m.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.C.capture_unhandled_errors&&(this.st=t(this.captureException.bind(this))),!this.nt&&this.C.capture_unhandled_rejections&&(this.nt=i(this.captureException.bind(this))),!this.ot&&this.C.capture_console_errors&&(this.ot=r(this.captureException.bind(this)))}catch(ii){Li.error("failed to start",ii),this.lt()}}},this._instance=e,this.ut=!(null==(t=this._instance.persistence)||!t.props[Ke]),this.C=this.ht(),this.dt=new Q({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,h:Li}),this.startIfEnabled()}ht(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return M(e)?t=E({},t,e):(L(e)?this.ut:e)&&(t=E({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.C.capture_console_errors||this.C.capture_unhandled_errors||this.C.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Li.info("enabled"),this.it(this.rt))}it(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return Li.error("failed to load script",t);e()})}lt(){var e,t,i;null==(e=this.st)||e.call(this),this.st=void 0,null==(t=this.nt)||t.call(this),this.nt=void 0,null==(i=this.ot)||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ut=!!t||!1,this.C=this.ht(),this._instance.persistence&&this._instance.persistence.register({[Ke]:this.ut}),this.startIfEnabled()}captureException(e){var t,i,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.dt.consumeRateLimit(r)?Li.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}}function Ui(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return D(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(n){return()=>{}}}class Hi{constructor(e){var t;this._instance=e,this.vt=(null==o||null==(t=o.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&($e.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,$e.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(o&&o.history){var i=this;null!=(e=o.history.pushState)&&e.__posthog_wrapped__||Ui(o.history,"pushState",e=>function(t,r,s){e.call(this,t,r,s),i.ft("pushState")}),null!=(t=o.history.replaceState)&&t.__posthog_wrapped__||Ui(o.history,"replaceState",e=>function(t,r,s){e.call(this,t,r,s),i.ft("replaceState")}),this.gt()}}ft(e){try{var t,i=null==o||null==(t=o.location)?void 0:t.pathname;if(!i)return;i!==this.vt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.vt=i}catch(ii){$e.error("Error capturing "+e+" pageview",ii)}}gt(){if(!this.ct){var e=()=>{this.ft("popstate")};We(o,"popstate",e),this.ct=()=>{o&&o.removeEventListener("popstate",e)}}}}var qi=Oe("[SegmentIntegration]"),Bi="posthog-js";function Gi(e,t){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,c,u,h;if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=(null==(a=t.exception)?void 0:a.values)||[],g=p.map(e=>E({},e,{stacktrace:e.stacktrace?E({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>E({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(l=p[0])?void 0:l.value)||t.message,$exception_type:null==(c=p[0])?void 0:c.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(u=p[0])?void 0:u.value)||t.message,$sentry_exception_type:null==(h=p[0])?void 0:h.type,$sentry_tags:t.tags};return i&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),o&&e.exceptions.sendExceptionEvent(_),t}}class Wi{constructor(e,t,i,r,s,n){this.name=Bi,this.setupOnce=function(o){o(Gi(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Vi=null!=o&&o.location?li(o.location.hash,"__posthog")||li(location.hash,"state"):null,zi="_postHogToolbarParams",Yi=Oe("[Toolbar]"),Xi=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(Xi||{});class Ji{constructor(e){this.instance=e}_t(e){m.ph_toolbar_state=e}yt(){var e;return null!==(e=m.ph_toolbar_state)&&void 0!==e?e:Xi.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),!o||!d)return!1;e=null!=e?e:o.location,i=null!=i?i:o.history;try{if(!t){try{o.localStorage.setItem("test","test"),o.localStorage.removeItem("test")}catch(ii){return!1}t=null==o?void 0:o.localStorage}var r,s=Vi||li(e.hash,"__posthog")||li(e.hash,"state"),n=s?je(()=>JSON.parse(atob(decodeURIComponent(s))))||je(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(zi)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(ii){return!1}}bt(e){var t=m.ph_load_toolbar||m.ph_load_editor;!q(t)&&D(t)?t(e,this.instance):Yi.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==d||!d.getElementById(wt));if(!o||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=E({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(o.localStorage.setItem(zi,JSON.stringify(E({},r,{source:void 0}))),this.yt()===Xi.LOADED)this.bt(r);else if(this.yt()===Xi.UNINITIALIZED){var s;this._t(Xi.LOADING),null==(s=m.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return Yi.error("[Toolbar] Failed to load",e),void this._t(Xi.UNINITIALIZED);this._t(Xi.LOADED),this.bt(r)}),We(o,"turbolinks:load",()=>{this._t(Xi.UNINITIALIZED),this.loadToolbar(r)})}return!0}wt(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Ki=Oe("[TracingHeaders]");class Zi{constructor(e){this.xt=void 0,this.St=void 0,this.rt=()=>{var e,t;L(this.xt)&&(null==(e=m.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),L(this.St)&&(null==(t=m.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return Ki.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(e=this.xt)||e.call(this),null==(t=this.St)||t.call(this),this.xt=void 0,this.St=void 0)}}var Qi="Mobile",er="iOS",tr="Android",ir="Tablet",rr=tr+" "+ir,sr="iPad",nr="Apple",or=nr+" Watch",ar="Safari",lr="BlackBerry",cr="Samsung",ur=cr+"Browser",hr=cr+" Internet",dr="Chrome",pr=dr+" OS",gr=dr+" "+er,_r="Internet Explorer",vr=_r+" "+Qi,fr="Opera",mr=fr+" Mini",yr="Edge",br="Microsoft "+yr,wr="Firefox",Er=wr+" "+er,Sr="Nintendo",xr="PlayStation",kr="Xbox",Ir=tr+" "+Qi,Pr=Qi+" "+ar,Tr="Windows",$r=Tr+" Phone",Or="Nokia",Fr="Ouya",Cr="Generic",Rr=Cr+" "+Qi.toLowerCase(),Ar=Cr+" "+ir.toLowerCase(),Dr="Konqueror",Mr="(\\d+(\\.\\d+)?)",Nr=new RegExp("Version/"+Mr),Lr=new RegExp(kr,"i"),jr=new RegExp(xr+" \\w+","i"),Ur=new RegExp(Sr+" \\w+","i"),Hr=new RegExp(lr+"|PlayBook|BB10","i"),qr={"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"},Br=function(e,t){return t=t||"",P(e," OPR/")&&P(e,"Mini")?mr:P(e," OPR/")?fr:Hr.test(e)?lr:P(e,"IE"+Qi)||P(e,"WPDesktop")?vr:P(e,ur)?hr:P(e,yr)||P(e,"Edg/")?br:P(e,"FBIOS")?"Facebook "+Qi:P(e,"UCWEB")||P(e,"UCBrowser")?"UC Browser":P(e,"CriOS")?gr:P(e,"CrMo")||P(e,dr)?dr:P(e,tr)&&P(e,ar)?Ir:P(e,"FxiOS")?Er:P(e.toLowerCase(),Dr.toLowerCase())?Dr:((e,t)=>{return t&&P(t,nr)||P(i=e,ar)&&!P(i,dr)&&!P(i,tr);var i})(e,t)?P(e,Qi)?Pr:ar:P(e,wr)?wr:P(e,"MSIE")||P(e,"Trident/")?_r:P(e,"Gecko")?wr:""},Gr={[vr]:[new RegExp("rv:"+Mr)],[br]:[new RegExp(yr+"?\\/"+Mr)],[dr]:[new RegExp("("+dr+"|CrMo)\\/"+Mr)],[gr]:[new RegExp("CriOS\\/"+Mr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Mr)],[ar]:[Nr],[Pr]:[Nr],[fr]:[new RegExp("(Opera|OPR)\\/"+Mr)],[wr]:[new RegExp(wr+"\\/"+Mr)],[Er]:[new RegExp("FxiOS\\/"+Mr)],[Dr]:[new RegExp("Konqueror[:/]?"+Mr,"i")],[lr]:[new RegExp(lr+" "+Mr),Nr],[Ir]:[new RegExp("android\\s"+Mr,"i")],[hr]:[new RegExp(ur+"\\/"+Mr)],[_r]:[new RegExp("(rv:|MSIE )"+Mr)],Mozilla:[new RegExp("rv:"+Mr)]},Wr=function(e,t){var i=Br(e,t),r=Gr[i];if(L(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=e.match(n);if(o)return parseFloat(o[o.length-2])}return null},Vr=[[new RegExp(kr+"; "+kr+" (.*?)[);]","i"),e=>[kr,e&&e[1]||""]],[new RegExp(Sr,"i"),[Sr,""]],[new RegExp(xr,"i"),[xr,""]],[Hr,[lr,""]],[new RegExp(Tr,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[$r,""];if(new RegExp(Qi).test(t)&&!/IEMobile\b/.test(t))return[Tr+" "+Qi,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],s=qr[r]||"";return/arm/i.test(t)&&(s="RT"),[Tr,s]}return[Tr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[er,t.join(".")]}return[er,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=L(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+tr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+tr+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[tr,t.join(".")]}return[tr,""]}],[/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/,[pr,""]],[/Linux|debian/i,["Linux",""]]],zr=function(e){return Ur.test(e)?Sr:jr.test(e)?xr:Lr.test(e)?kr:new RegExp(Fr,"i").test(e)?Fr:new RegExp("("+$r+"|WPDesktop)","i").test(e)?$r:/iPad/.test(e)?sr:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?or:Hr.test(e)?lr:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Or,"i").test(e)?Or:/(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(Qi).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)?tr:rr:tr:new RegExp("(pda|"+Qi+")","i").test(e)?Rr:new RegExp(ir,"i").test(e)&&!new RegExp(ir+" pc","i").test(e)?Ar:""},Yr="https?://(.*)",Xr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Jr=Ne(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Xr),Kr="<masked>",Zr=["li_fat_id"];function Qr(e,t,i){if(!d)return{};var r,s=t?Ne([],Xr,i||[]):[],n=es(ai(d.URL,s,Kr),e),o=(r={},De(Zr,function(e){var t=Si.q(e);r[e]=t||null}),r);return Me(o,n)}function es(e,t){var i=Jr.concat(t||[]),r={};return De(i,function(t){var i=oi(e,t);r[t]=i||null}),r}function ts(e){var t,i=(t=e)?0===t.search(Yr+"google.([^/?]*)")?"google":0===t.search(Yr+"bing.com")?"bing":0===t.search(Yr+"yahoo.com")?"yahoo":0===t.search(Yr+"duckduckgo.com")?"duckduckgo":null:null,r="yahoo"!=i?"q":"p",s={};if(!H(i)){s.$search_engine=i;var n=d?oi(d.referrer,r):"";n.length&&(s.ph_keyword=n)}return s}function is(){return navigator.language||navigator.userLanguage}function rs(){return(null==d?void 0:d.referrer)||"$direct"}function ss(e,t){var i=e?Ne([],Xr,t||[]):[],r=null==p?void 0:p.href.substring(0,1e3);return{r:rs().substring(0,1e3),u:r?ai(r,i,Kr):void 0}}function ns(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=ni(i))?void 0:t.host};if(r){s.$current_url=r;var n=ni(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=es(r);Me(s,o)}if(i){var a=ts(i);Me(s,a)}return s}function os(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(ii){return}}function as(){try{return(new Date).getTimezoneOffset()}catch(ii){return}}var ls=Oe("[Web Vitals]"),cs=9e5;class us{constructor(e){var t;this.Et=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce((e,t)=>E({},e,{["$web_vitals_"+t.name+"_event"]:E({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(L(i))ls.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Tt();L(r)||(q(null==e?void 0:e.name)||q(null==e?void 0:e.value)?ls.error("Invalid metric received",e):this.Rt&&e.value>=this.Rt?ls.error("Ignoring metric with value >= "+this.Rt,e):(this.N.url!==r&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),L(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=L(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(E({},e,{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()))}},this.rt=()=>{var e,t,i,r,s=m.__PosthogExtensions__;L(s)||L(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Pt.bind(this)),this.P=!0):ls.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Et=!(null==(t=this._instance.persistence)||!t.props[et]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=M(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return L(i)?(null==(t=this._instance.persistence)?void 0:t.props[it])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(M(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var e=M(this._instance.config.capture_performance)&&B(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:cs;return 0<e&&e<=6e4?cs:e}get isEnabled(){var e=null==p?void 0:p.protocol;if("http:"!==e&&"https:"!==e)return ls.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=M(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:G(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return G(t)?t:this.Et}startIfEnabled(){this.isEnabled&&!this.P&&(ls.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=M(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=M(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[et]:t}),this._instance.persistence.register({[it]:i})),this.Et=t,this.startIfEnabled()}it(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks&&e(),null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"web-vitals",t=>{t?ls.error("failed to load script",t):e()})}Tt(){var e=o?o.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,r=t?Ne([],Xr,i||[]):[];return ai(e,r,Kr)}ls.error("Could not determine current URL")}}var hs=Oe("[Heatmaps]");function ds(e){return M(e)&&"clientX"in e&&"clientY"in e&&B(e.clientX)&&B(e.clientY)}class ps{constructor(e){var t;this.rageclicks=new ti,this.Et=!1,this.P=!1,this.It=null,this.instance=e,this.Et=!(null==(t=this.instance.persistence)||!t.props[Je])}get flushIntervalMilliseconds(){var e=5e3;return M(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return L(this.instance.config.capture_heatmaps)?L(this.instance.config.enable_heatmaps)?this.Et:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;hs.info("starting..."),this.Ct(),this.Ot()}else{var e;clearInterval(null!==(e=this.It)&&void 0!==e?e:void 0),this.Ft(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Je]:t}),this.Et=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Mt(e){this.At(e.originalEvent,"deadclick")}Ot(){this.It&&clearInterval(this.It),this.It="visible"===(null==d?void 0:d.visibilityState)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Ct(){o&&d&&(this.jt=this.Dt.bind(this),We(o,"beforeunload",this.jt),this.Lt=e=>this.At(e||(null==o?void 0:o.event)),We(d,"click",this.Lt,{capture:!0}),this.Nt=e=>this.Ut(e||(null==o?void 0:o.event)),We(d,"mousemove",this.Nt,{capture:!0}),this.zt=new Ni(this.instance,Di,this.Mt.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ot.bind(this),We(d,"visibilitychange",this.Ht),this.P=!0)}Ft(){var e;o&&d&&(this.jt&&o.removeEventListener("beforeunload",this.jt),this.Lt&&d.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&d.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&d.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),null==(e=this.zt)||e.stop(),this.P=!1)}qt(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var r=e;r&&kt(r)&&!It(r,"body");){if(r===i)return!1;if(P(t,null==o?void 0:o.getComputedStyle(r).position))return!0;r=Nt(r)}return!1}(At(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:r),y:e.clientY+(n?0:i),target_fixed:n,type:t}}At(e,t){var i;if(void 0===t&&(t="click"),!xt(e.target)&&ds(e)){var r=this.qt(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Wt(E({},r,{type:"rageclick"})),this.Wt(r)}}Ut(e){!xt(e.target)&&ds(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout(()=>{this.Wt(this.qt(e,"mousemove"))},500))}Wt(e){if(o){var t=o.location.href,i=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,s=i?Ne([],Xr,r||[]):[],n=ai(t,s,Kr);this.N=this.N||{},this.N[n]||(this.N[n]=[]),this.N[n].push(e)}}Dt(){this.N&&!N(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class gs{constructor(e){this._instance=e}doPageView(e,t){var i,r=this.Gt(e,t);return this.Vt={pathname:null!==(i=null==o?void 0:o.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.Gt(e,null==(t=this.Vt)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Vt)?void 0:e.pageViewId}}Gt(e,t){var i=this.Vt;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!(L(n)||L(o)||L(a)||L(l)||L(c)||L(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var h=n<=1?1:Z(o/n,0,1,$e),d=n<=1?1:Z(a/n,0,1,$e),p=l<=1?1:Z(c/l,0,1,$e),g=l<=1?1:Z(u/l,0,1,$e);r=Me(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:g})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var _s=Uint8Array,vs=Uint16Array,fs=Uint32Array,ms=new _s([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]),ys=new _s([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]),bs=new _s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ws=function(e,t){for(var i=new vs(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new fs(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},Es=ws(ms,2),Ss=Es[0],xs=Es[1];Ss[28]=258,xs[258]=28;for(var ks=ws(ys,0)[1],Is=new vs(32768),Ps=0;Ps<32768;++Ps){var Ts=(43690&Ps)>>>1|(21845&Ps)<<1;Ts=(61680&(Ts=(52428&Ts)>>>2|(13107&Ts)<<2))>>>4|(3855&Ts)<<4,Is[Ps]=((65280&Ts)>>>8|(255&Ts)<<8)>>>1}var $s=function(e,t,i){for(var r=e.length,s=0,n=new vs(t);s<r;++s)++n[e[s]-1];var o,a=new vs(t);for(s=0;s<t;++s)a[s]=a[s-1]+n[s-1]<<1;for(o=new vs(r),s=0;s<r;++s)o[s]=Is[a[e[s]-1]++]>>>15-e[s];return o},Os=new _s(288);for(Ps=0;Ps<144;++Ps)Os[Ps]=8;for(Ps=144;Ps<256;++Ps)Os[Ps]=9;for(Ps=256;Ps<280;++Ps)Os[Ps]=7;for(Ps=280;Ps<288;++Ps)Os[Ps]=8;var Fs=new _s(32);for(Ps=0;Ps<32;++Ps)Fs[Ps]=5;var Cs=$s(Os,9),Rs=$s(Fs,5),As=function(e){return(e/8|0)+(7&e&&1)},Ds=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof vs?vs:e instanceof fs?fs:_s)(i-t);return r.set(e.subarray(t,i)),r},Ms=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8},Ns=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Ls=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new _s(0),0];if(1==s){var o=new _s(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[c].f<i[h].f?c++:h++],l=i[c!=u&&i[c].f<i[h].f?c++:h++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(r=1;r<s;++r)n[r].s>d&&(d=n[r].s);var p=new vs(d+1),g=js(i[u-1],p,0);if(g>t){r=0;var _=0,v=g-t,f=1<<v;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<s;++r){var m=n[r].s;if(!(p[m]>t))break;_+=f-(1<<g-p[m]),p[m]=t}for(_>>>=v;_>0;){var y=n[r].s;p[y]<t?_-=1<<t-p[y]++-1:++r}for(;r>=0&&_;--r){var b=n[r].s;p[b]==t&&(--p[b],++_)}g=t}return[new _s(p),g]},js=function(e,t,i){return-1==e.s?Math.max(js(e.l,t,i+1),js(e.r,t,i+1)):t[e.s]=i},Us=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new vs(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},Hs=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},qs=function(e,t,i){var r=i.length,s=As(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;n<r;++n)e[s+n+4]=i[n];return 8*(s+4+r)},Bs=function(e,t,i,r,s,n,o,a,l,c,u){Ms(t,u++,i),++s[256];for(var h=Ls(s,15),d=h[0],p=h[1],g=Ls(n,15),_=g[0],v=g[1],f=Us(d),m=f[0],y=f[1],b=Us(_),w=b[0],E=b[1],S=new vs(19),x=0;x<m.length;++x)S[31&m[x]]++;for(x=0;x<w.length;++x)S[31&w[x]]++;for(var k=Ls(S,7),I=k[0],P=k[1],T=19;T>4&&!I[bs[T-1]];--T);var $,O,F,C,R=c+5<<3,A=Hs(s,Os)+Hs(n,Fs)+o,D=Hs(s,d)+Hs(n,_)+o+14+3*T+Hs(S,I)+(2*S[16]+3*S[17]+7*S[18]);if(R<=A&&R<=D)return qs(t,u,e.subarray(l,l+c));if(Ms(t,u,1+(D<A)),u+=2,D<A){$=$s(d,p),O=d,F=$s(_,v),C=_;var M=$s(I,P);for(Ms(t,u,y-257),Ms(t,u+5,E-1),Ms(t,u+10,T-4),u+=14,x=0;x<T;++x)Ms(t,u+3*x,I[bs[x]]);u+=3*T;for(var N=[m,w],L=0;L<2;++L){var j=N[L];for(x=0;x<j.length;++x){var U=31&j[x];Ms(t,u,M[U]),u+=I[U],U>15&&(Ms(t,u,j[x]>>>5&127),u+=j[x]>>>12)}}}else $=Cs,O=Os,F=Rs,C=Fs;for(x=0;x<a;++x)if(r[x]>255){U=r[x]>>>18&31,Ns(t,u,$[U+257]),u+=O[U+257],U>7&&(Ms(t,u,r[x]>>>23&31),u+=ms[U]);var H=31&r[x];Ns(t,u,F[H]),u+=C[H],H>3&&(Ns(t,u,r[x]>>>5&8191),u+=ys[H])}else Ns(t,u,$[r[x]]),u+=O[r[x]];return Ns(t,u,$[256]),u+O[256]},Gs=new fs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ws=function(){for(var e=new fs(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Vs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};var zs=!!_||!!g,Ys="text/plain",Xs=function(e,t,i){var r;void 0===i&&(i=!0);var[s,n]=e.split("?"),o=E({},t),a=null!==(r=null==n?void 0:n.split("&").map(e=>{var t,[r,s]=e.split("="),n=i&&null!==(t=o[r])&&void 0!==t?t:s;return delete o[r],r+"="+n}))&&void 0!==r?r:[],l=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return De(e,function(e,t){L(e)||L(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)}),s.join(t)}(o);return l&&a.push(l),s+"?"+a.join("&")},Js=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Ks=e=>{var t,{data:i,compression:r}=e;if(i){if(r===si.GZipJS){var s=function(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Ws[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}}(),r=e.length;i.p(e);var s,n=function(e,t,i){return function(e,t,i,r){var s=e.length,n=new _s(r+s+5*(1+Math.floor(s/7e3))+8),o=n.subarray(r,n.length-8),a=0;if(!t||s<8)for(var l=0;l<=s;l+=65535){var c=l+65535;c<s?a=qs(o,a,e.subarray(l,c)):(o[l]=!0,a=qs(o,a,e.subarray(l,s)))}else{for(var u=Gs[t-1],h=u>>>13,d=8191&u,p=(1<<i)-1,g=new vs(32768),_=new vs(p+1),v=Math.ceil(i/3),f=2*v,m=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<f)&p},y=new fs(25e3),b=new vs(288),w=new vs(32),E=0,S=0,x=(l=0,0),k=0,I=0;l<s;++l){var P=m(l),T=32767&l,$=_[P];if(g[T]=$,_[P]=T,k<=l){var O=s-l;if((E>7e3||x>24576)&&O>423){a=Bs(e,o,0,y,b,w,S,x,I,l-I,a),x=E=S=0,I=l;for(var F=0;F<286;++F)b[F]=0;for(F=0;F<30;++F)w[F]=0}var C=2,R=0,A=d,D=T-$&32767;if(O>2&&P==m(l-D))for(var M=Math.min(h,O)-1,N=Math.min(32767,l),L=Math.min(258,O);D<=N&&--A&&T!=$;){if(e[l+C]==e[l+C-D]){for(var j=0;j<L&&e[l+j]==e[l+j-D];++j);if(j>C){if(C=j,R=D,j>M)break;var U=Math.min(D,j-2),H=0;for(F=0;F<U;++F){var q=l-D+F+32768&32767,B=q-g[q]+32768&32767;B>H&&(H=B,$=q)}}}D+=(T=$)-($=g[T])+32768&32767}if(R){y[x++]=268435456|xs[C]<<18|ks[R];var G=31&xs[C],W=31&ks[R];S+=ms[G]+ys[W],++b[257+G],++w[W],k=l+C,++E}else y[x++]=e[l],++b[e[l]]}}a=Bs(e,o,!0,y,b,w,S,x,I,l-I,a)}return Ds(n,0,r+As(a)+8)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i)}(e,t,10+((s=t).filename&&s.filename.length+1||0)),o=n.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&&Vs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(n,t),Vs(n,o-8,i.d()),Vs(n,o-4,r),n}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new _s(e.length+(e.length>>>1)),r=0,s=function(e){i[r++]=e},n=0;n<t;++n){if(r+5>i.length){var o=new _s(r+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);a<128?s(a):a<2048?(s(192|a>>>6),s(128|63&a)):a>55295&&a<57344?(s(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return Ds(i,0,r)}(Js(i)),{mtime:0}),n=new Blob([s],{type:Ys});return{contentType:Ys,body:n,estimatedSize:n.size}}if(r===si.Base64){var o=function(e){var t,i,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=function(e){var t,i,r,s,n="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=e.charCodeAt(s),a=null;o<128?i++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),H(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n}(e);do{t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,u[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(s)}while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(Js(i)),a=(t=o,"data="+encodeURIComponent("string"==typeof t?t:Js(t)));return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var l=Js(i);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},Zs=[];g&&Zs.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:s,estimatedSize:n}=null!==(t=Ks(e))&&void 0!==t?t:{},o=new Headers;De(e.headers,function(e,t){o.append(t,e)}),r&&o.append("Content-Type",r);var a=e.url,l=null;if(v){var c=new v;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}g(a,E({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(n||0)<52428.8,body:s,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(s){$e.error(s)}null==e.callback||e.callback(r)})).catch(t=>{$e.error(t),null==e.callback||e.callback({statusCode:0,text:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),_&&Zs.push({transport:"XHR",method:e=>{var t,i=new _;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=Ks(e))&&void 0!==t?t:{};De(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(r){}null==e.callback||e.callback(t)}},i.send(s)}}),null!=h&&h.sendBeacon&&Zs.push({transport:"sendBeacon",method:e=>{var t=Xs(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=Ks(e))&&void 0!==i?i:{},n="string"==typeof s?new Blob([s],{type:r}):s;h.sendBeacon(t,n)}catch(o){}}});var Qs=function(e,t){if(!function(){return!0}())return!1;try{return new RegExp(t).test(e)}catch(i){return!1}};function en(e,t,i){return Js({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var tn={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Qs(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Qs(t,e))),icontains:(e,t)=>t.map(rn).some(t=>e.map(rn).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(rn).every(t=>e.map(rn).every(e=>!t.includes(e)))},rn=e=>e.toLowerCase(),sn=Oe("[Error tracking]");class nn{constructor(e){var t,i;this.Jt=[],this.Kt=new ve([new fe,new Pe,new ye,new me,new ke,new xe,new we,new Ie],[he,ge]),this._instance=e,this.Jt=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(Ze))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,r,s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this.Jt=s,this._instance.persistence&&this._instance.persistence.register({[Ze]:this.Jt,[Qe]:n})}get Yt(){var e,t=!!this._instance.get_property(Qe),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.Kt.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.Xt(t)){if(this.Qt(t))return void sn.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(t))return void sn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(t))return void sn.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:r}=t;return j(i)&&i.length>0&&e.$exception_types.push(i),j(r)&&r.length>0&&e.$exception_values.push(r),e},{$exception_types:[],$exception_values:[]});return this.Jt.some(e=>{var i=e.values.map(e=>{var i,r=tn[e.operator],s=A(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}Zt(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ti(e){if(e.length>0){var t,i,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Xt(e){return!q(e)&&A(e)}}var on=Oe("[FeatureFlags]"),an="$active_feature_flags",ln="$override_feature_flags",cn="$feature_flag_payloads",un="$override_feature_flag_payloads",hn="$feature_flag_request_id",dn=e=>{var t={};for(var[i,r]of Le(e||{}))r&&(t[i]=r);return t},pn=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class gn{constructor(e){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=e,this.featureFlagEventHandlers=[]}li(){var e=this._instance.config.evaluation_environments;return null!=e&&e.length?e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||on.error("Invalid evaluation environment found:",e,"Expected non-empty string"),t}):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var e=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.di({disableFlags:e})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(lt),t=this._instance.get_property(ln),i=this._instance.get_property(un);if(!i&&!t)return e||{};var r=Me({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of s){var o,a,l=r[n],c=null==t?void 0:t[n],u=L(c)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!c,h=L(c)?l.variant:"string"==typeof c?c:void 0,d=null==i?void 0:i[n],p=E({},l,{enabled:u,variant:u?null!=h?h:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=E({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=p}return this.ii||(on.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.ii=!0),r}getFlagVariants(){var e=this._instance.get_property(ot),t=this._instance.get_property(ln);if(!t)return e||{};for(var i=Me({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this.ii||(on.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ii=!0),i}getFlagPayloads(){var e=this._instance.get_property(cn),t=this._instance.get_property(un);if(!t)return e||{};for(var i=Me({},e||{}),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this.ii||(on.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ii=!0),i}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout(()=>{this.di()},5))}vi(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.si=e}di(e){var t;if(this.vi(),!this._instance.M())if(this.ri)this.ni=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:E({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(ct)||{}),group_properties:this._instance.get_property(ut)};(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.ui()&&(i.evaluation_environments=this.li());var r=this._instance.config.__preview_remote_config,s=r?"/flags/?v=2":"/flags/?v=2&config=true",n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("api",s+n);r&&(i.timezone=os()),this.ri=!0,this._instance.ci({method:"POST",url:o,data:i,compression:this._instance.config.disable_compression?void 0:si.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,r,s=!0;if(200===e.statusCode&&(this.ni||(this.$anon_distinct_id=void 0),s=!1),this.ri=!1,this.oi||(this.oi=!0,this._instance.fi(null!==(r=e.json)&&void 0!==r?r:{})),!i.disable_flags||this.ni)if(this.ai=!s,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(pn.FeatureFlags))on.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var n;i.disable_flags||this.receivedFeatureFlags(null!==(n=e.json)&&void 0!==n?n:{},s),this.ni&&(this.ni=!1,this.di())}}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,s=this._instance.get_property(hn)||void 0,n=this._instance.get_property(pt)||{};if((t.send_event||!("send_event"in t))&&(!(e in n)||!n[e].includes(r))){var o,a,l,c,u,h,d,p,g;A(n[e])?n[e].push(r):n[e]=[r],null==(o=this._instance.persistence)||o.register({[pt]:n});var _=this.getFeatureFlagDetails(e),v={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:(null==(a=this._instance.config.bootstrap)||null==(a=a.featureFlags)?void 0:a[e])||null,$feature_flag_bootstrapped_payload:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlagPayloads)?void 0:l[e])||null,$used_bootstrap_value:!this.ai};L(null==_||null==(c=_.metadata)?void 0:c.version)||(v.$feature_flag_version=_.metadata.version);var f,m=null!==(u=null==_||null==(h=_.reason)?void 0:h.description)&&void 0!==u?u:null==_||null==(d=_.reason)?void 0:d.code;m&&(v.$feature_flag_reason=m),null!=_&&null!=(p=_.metadata)&&p.id&&(v.$feature_flag_id=_.metadata.id),L(null==_?void 0:_.original_variant)&&L(null==_?void 0:_.original_enabled)||(v.$feature_flag_original_response=L(_.original_variant)?_.original_enabled:_.original_variant),null!=_&&null!=(g=_.metadata)&&g.original_payload&&(v.$feature_flag_original_payload=null==_||null==(f=_.metadata)?void 0:f.original_payload),this._instance.capture("$feature_flag_called",v)}return i}on.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.ui()&&(r.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:si.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return L(i)?void 0:!!i}on.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ei=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,i,r,s){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var n=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(e=>t[e].enabled).filter(e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload}).map(e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]}))):on.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var c=e.requestId;if(A(a)){on.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var u={};if(a)for(var h=0;h<a.length;h++)u[a[h]]=!0;t&&t.register({[an]:a,[ot]:u})}else{var d=a,p=l,g=o;e.errorsWhileComputingFlags&&(d=E({},i,d),p=E({},r,p),g=E({},s,g)),t&&t.register(E({[an]:Object.keys(dn(d)),[ot]:d||{},[cn]:p||{},[lt]:g||{}},c?{[hn]:c}:{}))}}}(e,this._instance.persistence,i,r,s),this.pi(t)}}override(e,t){void 0===t&&(t=!1),on.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return on.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(ln),this._instance.persistence.unregister(un),void this.pi();if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,i=e;if(this.ii=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t),"flags"in i)if(!1===i.flags)this._instance.persistence.unregister(ln);else if(i.flags)if(A(i.flags)){for(var r={},s=0;s<i.flags.length;s++)r[i.flags[s]]=!0;this._instance.persistence.register({[ln]:r})}else this._instance.persistence.register({[ln]:i.flags});return"payloads"in i&&(!1===i.payloads?this._instance.persistence.unregister(un):i.payloads&&this._instance.persistence.register({[un]:i.payloads})),void this.pi()}this.pi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ei){var{flags:t,flagVariants:i}=this.gi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,s=(this._instance.get_property(at)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=E({},this.getFlagVariants(),{[e]:t});null==(r=this._instance.persistence)||r.register({[an]:Object.keys(dn(a)),[ot]:a}),this.pi()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._instance.get_property(at),s=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(r&&!t)return e(r);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.unregister(at),null==(r=this._instance.persistence)||r.register({[at]:s}),e(s)}}})}gi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}pi(e){var{flags:t,flagVariants:i}=this.gi();this.featureFlagEventHandlers.forEach(r=>r(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(ct)||{};this._instance.register({[ct]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ct)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(ut)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=E({},i[t],e[t]),delete e[t]}),this._instance.register({[ut]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(ut)||{};this._instance.register({[ut]:E({},t,{[e]:{}})})}else this._instance.unregister(ut)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.vi(),this.ii=!1}}var _n=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class vn{constructor(e,t){var i,r;this.C=e,this.props={},this.mi=!1,this.yi=(r="",(i=e).token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"),this.Y=this.bi(e),this.load(),e.debug&&$e.info("Persistence loaded",e.persistence,E({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.wi}bi(e){-1===_n.indexOf(e.persistence.toLowerCase())&&($e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&ki.H()?ki:"localstorage+cookie"===t&&Pi.H()?Pi:"sessionstorage"===t&&Fi.H()?Fi:"memory"===t?$i:"cookie"===t?Si:Pi.H()?Pi:Si}properties(){var e={};return De(this.props,function(t,i){if(i===ot&&M(t))for(var r=Object.keys(t),s=0;s<r.length;s++)e["$feature/"+r[s]]=t[r[s]];else o=i,a=!1,(H(n=St)?a:u&&n.indexOf===u?-1!=n.indexOf(o):(De(n,function(e){if(a||(a=e===o))return Re}),a))||(e[i]=t);var n,o,a}),e}load(){if(!this.wi){var e=this.Y.W(this.yi);e&&(this.props=Me({},e))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.Si,this.Ei,this.C.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(M(e)){L(t)&&(t="None"),this.xi=L(i)?this.$i:i;var r=!1;if(De(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(M(e)){this.xi=L(t)?this.$i:t;var i=!1;if(De(e,(t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.mi){var e=Qr(this.C.custom_campaign_params,this.C.mask_personal_data_properties,this.C.custom_personal_data_properties);N(He(e))||this.register(e),this.mi=!0}}update_search_keyword(){var e;this.register((e=null==d?void 0:d.referrer)?ts(e):{})}update_referrer_info(){var e;this.register_once({$referrer:rs(),$referring_domain:null!=d&&d.referrer&&(null==(e=ni(d.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[ft]||this.props[mt]||this.register_once({[yt]:ss(this.C.mask_personal_data_properties,this.C.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};De([mt,ft],t=>{var i=this.props[t];i&&De(i,function(t,i){e["$initial_"+$(i)]=t})});var t,i,r=this.props[yt];if(r){var s=(t=ns(r),i={},De(t,function(e,t){i["$initial_"+$(t)]=e}),i);Me(e,s)}return e}safe_merge(e){return De(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.$i=this.xi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.bi(e),s=this.props;this.clear(),this.Y=r,this.props=s,this.save()}}set_disabled(e){this.wi=e,this.wi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Si&&(this.Si=e,this.remove(),this.save())}set_secure(e){e!==this.Ei&&(this.Ei=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ye]||{};i[e]=t,this.props[Ye]=i,this.save()}remove_event_timer(e){var t=(this.props[Ye]||{})[e];return L(t)||(delete this.props[Ye][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}!function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}({}),function(e){e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}({});var fn=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({});!function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}({}),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}({}),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}({});var mn=function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e}({}),yn=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e}({}),bn=function(e){return e.Popover="popover",e.Inline="inline",e}({});class wn{constructor(){this.ki={},this.ki={}}on(e,t){return this.ki[e]||(this.ki[e]=[]),this.ki[e].push(t),()=>{this.ki[e]=this.ki[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.ki[e]||[])i(t);for(var r of this.ki["*"]||[])r(e,t)}}class En{constructor(e){this.Pi=new wn,this.Ti=(e,t)=>this.Ri(e,t)&&this.Ii(e,t)&&this.Ci(e,t),this.Ri=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Oi=new Set,this.Fi=new Set}init(){var e,t;L(null==(e=this._instance)?void 0:e.Mi)||null==(t=this._instance)||t.Mi((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!L(null==(t=this._instance)?void 0:t.Mi)&&(e.forEach(e=>{var t,i;null==(t=this.Fi)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.Oi)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Oi.has(e)||this.Oi.has(null==t?void 0:t.event))&&this.Fi&&(null==(i=this.Fi)?void 0:i.size)>0&&this.Fi.forEach(e=>{this.Ai(t,e)&&this.Pi.emit("actionCaptured",e.name)})}Di(e){this.onAction("actionCaptured",t=>e(t))}Ai(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Ti(e,i))return!0;return!1}onAction(e,t){return this.Pi.on(e,t)}Ii(e,t){if(null!=t&&t.url){var i,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!En.ji(r,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static ji(e,t,i){switch(i){case"regex":return!!o&&Qs(e,t);case"exact":return t===e;case"contains":var r=En.Li(t).replace(/_/g,".").replace(/%/g,".*");return Qs(e,r);default:return!1}}static Li(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ci(e,t){if((null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text)&&!this.Ni(e).some(e=>!(null!=t&&t.href&&!En.ji(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact")||null!=t&&t.tag_name&&e.tag_name!==(null==t?void 0:t.tag_name)||null!=t&&t.text&&!En.ji(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!En.ji(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact"))))return!1;if(null!=t&&t.selector){var i,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(!r)return!1;if(!r.includes(null==t?void 0:t.selector))return!1}return!0}Ni(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}var Sn=Oe("[Surveys]"),xn="seenSurvey_",kn=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},In=e=>{var t=""+xn+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+xn+e.id+"_"+e.current_iteration),t},Pn=[fn.Popover,fn.Widget,fn.API],Tn={ignoreConditions:!1,ignoreDelay:!1,displayType:bn.Popover};class $n{constructor(e){this._instance=e,this.Ui=new Map,this.zi=new Map}register(e){var t;L(null==(t=this._instance)?void 0:t.Mi)||(this.Hi(e),this.Bi(e))}Bi(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.qi&&(this.qi=new En(this._instance),this.qi.init(),this.qi.Di(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.qi)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.zi.get(t.name);i&&i.push(e.id),this.zi.set(t.name,i||[e.id])}}))}))}Hi(e){var t;0!==e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}).length&&(null==(t=this._instance)||t.Mi((e,t)=>{this.onEvent(e,t)}),e.forEach(e=>{var t;null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||t.forEach(t=>{if(t&&t.name){var i=this.Ui.get(t.name);i&&i.push(e.id),this.Ui.set(t.name,i||[e.id])}})}))}onEvent(e,t){var i,r,s=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[dt])||[];if(mn.SHOWN===e&&t&&s.length>0){var n;Sn.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:s});var o=null==t||null==(n=t.properties)?void 0:n.$survey_id;if(o){var a=s.indexOf(o);a>=0&&(s.splice(a,1),this.Wi(s))}}else if(this.Ui.has(e)){Sn.info("survey event name matched",{event:e,eventPayload:t,surveys:this.Ui.get(e)});var l=[];null==(r=this._instance)||r.getSurveys(t=>{l=t.filter(t=>{var i;return null==(i=this.Ui.get(e))?void 0:i.includes(t.id)})});var c=l.filter(i=>{var r,s=null==(r=i.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.find(t=>t.name===e);return!!s&&(!s.propertyFilters||Object.entries(s.propertyFilters).every(e=>{var i,[r,s]=e,n=null==t||null==(i=t.properties)?void 0:i[r];if(L(n)||H(n))return!1;var o=[String(n)],a=tn[s.operator];return a?a(s.values,o):(Sn.warn("Unknown property comparison operator: "+s.operator),!1)}))});this.Wi(s.concat(c.map(e=>e.id)||[]))}}onAction(e){var t,i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[dt])||[];this.zi.has(e)&&this.Wi(i.concat(this.zi.get(e)||[]))}Wi(e){var t;Sn.info("updating activated surveys",{activatedSurveys:e}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[dt]:[...new Set(e)]})}getSurveys(){var e;return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[dt])||[]}getEventToSurveys(){return this.Ui}Gi(){return this.qi}}class On{constructor(e){this.Vi=void 0,this._surveyManager=null,this.Ji=!1,this.Ki=!1,this.Yi=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(q(t))return Sn.warn("Flags not loaded yet. Not loading surveys.");var i=A(t);this.Vi=i?t.length>0:t,Sn.info("flags response received, isSurveysEnabled: "+this.Vi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(xn)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Ki)Sn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Sn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Sn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==m?void 0:m.__PosthogExtensions__;if(e){if(!L(this.Vi)||this._instance.config.advanced_enable_surveys){var t=this.Vi||this._instance.config.advanced_enable_surveys;this.Ki=!0;try{var i=e.generateSurveys;if(i)return void this.Xi(i,t);var r=e.loadExternalDependency;if(!r)return void this.Qi("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",i=>{i||!e.generateSurveys?this.Qi("Could not load surveys script",i):this.Xi(e.generateSurveys,t)})}catch(s){throw this.Qi("Error initializing surveys",s),s}finally{this.Ki=!1}}}else Sn.error("PostHog Extensions not found.")}}Xi(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new $n(this._instance),Sn.info("Surveys loaded successfully"),this.Zi({isLoaded:!0})}Qi(e,t){Sn.error(e,t),this.Zi({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Yi.push(e),this._surveyManager&&this.Zi({isLoaded:!0}),()=>{this.Yi=this.Yi.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return Sn.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(ht);if(i&&!t)return e(i,{isLoaded:!0});if(this.Ji)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.Ji=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var i;this.Ji=!1;var r=t.statusCode;if(200!==r||!t.json){var s="Surveys API could not be loaded, status: "+r;return Sn.error(s),e([],{isLoaded:!1,error:s})}var n,o=t.json.surveys||[],a=o.filter(e=>{return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});return a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a)),null==(i=this._instance.persistence)||i.register({[ht]:o}),e(o,{isLoaded:!0})}})}catch(r){throw this.Ji=!1,r}}Zi(e){for(var t of this.Yi)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){Sn.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!q(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Sn.warn("init was not called")}te(e){var t=null;return this.getSurveys(i=>{var r;t=null!==(r=i.find(t=>t.id===e))&&void 0!==r?r:null}),t}ie(e){if(q(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this.te(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(q(this._surveyManager))return Sn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ie(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return q(this._surveyManager)?(Sn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(t=>{var r,s=null!==(r=t.find(t=>t.id===e))&&void 0!==r?r:null;if(s){var n=this.ie(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){var i;if(q(this._surveyManager))Sn.warn("init was not called");else{var r="string"==typeof e?this.te(e):e;if(null!=r&&r.id)if(Pn.includes(r.type)){var s=null==d?void 0:d.querySelector(t);if(s)return null!=(i=r.appearance)&&i.surveyPopupDelaySeconds?(Sn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;Sn.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,s),Sn.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);Sn.warn("Survey element not found")}else Sn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Sn.warn("Survey not found")}}displaySurvey(e,t){var i;if(q(this._surveyManager))Sn.warn("init was not called");else{var r=this.te(e);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=E({},r,{appearance:E({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===t.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Sn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==bn.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,t.selector)}else Sn.warn("Survey not found")}}}var Fn=Oe("[RateLimiter]");class Cn{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Fn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(i){return void Fn.warn('could not rate limit - continuing. Error: "'+(null==i?void 0:i.message)+'"',{text:t})}},this.instance=e,this.captureEventsPerSecond=(null==(t=e.config.rate_limiting)?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(i=e.config.rate_limiting)?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var s=(new Date).getTime(),n=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(vt))&&void 0!==t?t:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||e||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null==(r=this.instance.persistence)||r.set_property(vt,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Rn=Oe("[RemoteConfig]");class An{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=m._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}ee(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Rn.error("PostHog Extensions not found. Cannot load remote config."),e())}re(e){this._instance.ci({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Rn.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.M())return void Rn.warn("Remote config is disabled. Falling back to local config.");this.ee(e=>{if(!e)return Rn.info("No config found after loading remote JS config. Falling back to JSON."),void this.re(e=>{this.fi(e)});this.fi(e)})}catch(ii){Rn.error("Error loading remote config",ii)}}fi(e){e?this._instance.config.__preview_remote_config?(this._instance.fi(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Rn.info("__preview_remote_config is disabled. Logging config instead",e):Rn.error("Failed to fetch remote config from PostHog.")}}var Dn=3e3;class Mn{constructor(e,t){this.se=!0,this.ne=[],this.oe=Z((null==t?void 0:t.flush_interval_ms)||Dn,250,5e3,$e.createLogger("flush interval"),Dn),this.ae=e}enqueue(e){this.ne.push(e),this.le||this.ue()}unload(){this.he();var e=this.ne.length>0?this.de():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.ae(E({},e,{transport:"sendBeacon"}))})}enable(){this.se=!1,this.ue()}ue(){var e=this;this.se||(this.le=setTimeout(()=>{if(this.he(),this.ne.length>0){var t=this.de(),i=function(){var i=t[r],s=(new Date).getTime();i.data&&A(i.data)&&De(i.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e.ae(i)};for(var r in t)i()}},this.oe))}he(){clearTimeout(this.le),this.le=void 0}de(){var e={};return De(this.ne,t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;L(e[s])&&(e[s]=E({},r,{data:[]})),null==(i=e[s].data)||i.push(r.data)}),this.ne=[],e}}var Nn=["retriesPerformedSoFar"];class Ln{constructor(e){this.ve=!1,this.ce=3e3,this.ne=[],this._instance=e,this.ne=[],this.fe=!0,!L(o)&&"onLine"in o.navigator&&(this.fe=o.navigator.onLine,this.pe=()=>{this.fe=!0,this.Dt()},this.ge=()=>{this.fe=!1},We(o,"online",this.pe),We(o,"offline",this.ge))}get length(){return this.ne.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=S(e,Nn);B(t)&&t>0&&(i.url=Xs(i.url,{retry_count:t})),this._instance.ci(E({},i,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this._e(E({retriesPerformedSoFar:t},i)):null==i.callback||i.callback(e)}}))}_e(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i,r,s,n,o,a=(i=t,s=(r=3e3*Math.pow(2,i))/2,n=Math.min(18e5,r),o=(Math.random()-.5)*(n-s),Math.ceil(n+o)),l=Date.now()+a;this.ne.push({retryAt:l,requestOptions:e});var c="Enqueued failed request for retry in "+a;navigator.onLine||(c+=" (Browser is offline)"),$e.warn(c),this.ve||(this.ve=!0,this.me())}me(){if(this.ye&&clearTimeout(this.ye),0===this.ne.length)return this.ve=!1,void(this.ye=void 0);this.ye=setTimeout(()=>{this.fe&&this.ne.length>0&&this.Dt(),this.me()},this.ce)}Dt(){var e=Date.now(),t=[],i=this.ne.filter(i=>i.retryAt<e||(t.push(i),!1));if(this.ne=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.ye&&(clearTimeout(this.ye),this.ye=void 0),this.ve=!1,L(o)||(this.pe&&(o.removeEventListener("online",this.pe),this.pe=void 0),this.ge&&(o.removeEventListener("offline",this.ge),this.ge=void 0)),this.ne))try{this._instance.ci(E({},e,{transport:"sendBeacon"}))}catch(ii){$e.error(ii)}this.ne=[]}}class jn{constructor(e){this.be=()=>{var e,t,i,r;this.we||(this.we={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.we.lastScrollY=Math.ceil(n),this.we.maxScrollY=Math.max(n,null!==(e=this.we.maxScrollY)&&void 0!==e?e:0),this.we.maxScrollHeight=Math.max(o,null!==(t=this.we.maxScrollHeight)&&void 0!==t?t:0),this.we.lastContentY=a,this.we.maxContentY=Math.max(a,null!==(i=this.we.maxContentY)&&void 0!==i?i:0),this.we.maxContentHeight=Math.max(l,null!==(r=this.we.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this.we}resetContext(){var e=this.we;return setTimeout(this.be,0),e}startMeasuringScrollPosition(){We(o,"scroll",this.be,{capture:!0}),We(o,"scrollend",this.be,{capture:!0}),We(o,"resize",this.be)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==o?void 0:o.document.documentElement;var e=A(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=null==o?void 0:o.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return o&&(o.scrollY||o.pageYOffset||o.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return o&&(o.scrollX||o.pageXOffset||o.document.documentElement.scrollLeft)||0}}var Un=e=>ss(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class Hn{constructor(e,t,i,r){this.xe=e=>{var t=this.Se();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Ee(this._instance)};this.$e.register({[_t]:i})}},this._instance=e,this.ke=t,this.$e=i,this.Ee=r||Un,this.ke.onSessionId(this.xe)}Se(){return this.$e.props[_t]}getSetOnceProps(){var e,t=null==(e=this.Se())?void 0:e.props;return t?"r"in t?ns(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return De(He(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+$(i)]=t}),e}}var qn=Oe("[SessionId]");class Bn{on(e,t){return this.Pe.on(e,t)}constructor(e,t,i){var r;if(this.Te=[],this.Re=void 0,this.Pe=new wn,this.Ie=(e,t)=>Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.C=e.config,this.$e=e.persistence,this.Ce=void 0,this.Oe=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Fe=t||yi,this.Me=i||yi;var s=this.C.persistence_name||this.C.token,n=this.C.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Z(n,60,36e3,qn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ae(),this.De="ph_"+s+"_window_id",this.je="ph_"+s+"_primary_window_exists",this.Le()){var o=Fi.W(this.De),a=Fi.W(this.je);o&&!a?this.Ce=o:Fi.V(this.De),Fi.G(this.je,!0)}if(null!=(r=this.C.bootstrap)&&r.sessionID)try{var l=(()=>{var e=this.C.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.Ne(this.C.bootstrap.sessionID,(new Date).getTime(),l)}catch(c){qn.error("Invalid sessionID in bootstrap",c)}this.Ue()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return L(this.Te)&&(this.Te=[]),this.Te.push(e),this.Oe&&e(this.Oe,this.Ce),()=>{this.Te=this.Te.filter(t=>t!==e)}}Le(){return"memory"!==this.C.persistence&&!this.$e.wi&&Fi.H()}ze(e){e!==this.Ce&&(this.Ce=e,this.Le()&&Fi.G(this.De,e))}He(){return this.Ce?this.Ce:this.Le()?Fi.W(this.De):null}Ne(e,t,i){e===this.Oe&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Oe=e,this.$e.register({[st]:[t,e,i]}))}Be(){if(this.Oe&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Oe,this._sessionStartTimestamp];var e=this.$e.props[st];return A(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ne(null,null,null)}destroy(){clearTimeout(this.qe),this.qe=void 0,this.Re&&o&&(o.removeEventListener("beforeunload",this.Re,{capture:!1}),this.Re=void 0),this.Te=[]}Ue(){this.Re=()=>{this.Le()&&Fi.V(this.je)},We(o,"beforeunload",this.Re,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this.C.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this.Be(),o=this.He(),a=B(n)&&n>0&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!e&&this.Ie(i,r);c||u||a?(s=this.Fe(),o=this.Me(),qn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.Me(),l=!0);var h=0===r||!e||a?i:r,d=0===n?(new Date).getTime():n;return this.ze(o),this.Ne(s,h,d),e||this.Ae(),l&&this.Te.forEach(e=>e(s,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}Ae(){clearTimeout(this.qe),this.qe=setTimeout(()=>{var[e]=this.Be();if(this.Ie((new Date).getTime(),e)){var t=this.Oe;this.resetSessionId(),this.Pe.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var Gn=["$set_once","$set"],Wn=Oe("[SiteApps]");class Vn{constructor(e){this._instance=e,this.We=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ge(e,t){if(t){var i=this.globalsForEvent(t);this.We.push(i),this.We.length>1e3&&(this.We=this.We.slice(10))}}get siteAppLoaders(){var e;return null==(e=m._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Mi(this.Ge.bind(this));this.Ve=()=>{e(),this.We=[],this.Ve=void 0}}}globalsForEvent(e){var t,i,r,s,n,o,a;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(u))l[h]={id:c[h],type:h,properties:d};var{$set_once:p,$set:g}=e;return{event:E({},S(e,Gn),{properties:E({},e.properties,g?{$set:E({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},g)}:{},p?{$set_once:E({},null!==(r=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==r?r:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.We.length&&(Wn.info("Processing "+this.We.length+" events for site app with id "+e.id),this.We.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.Ve)||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,Wn.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback:e=>{s(e)}});n&&(t.processEvent=n),r=!0}catch(o){Wn.error("Error while initializing PostHog app with config id "+e.id,o),s(!1)}if(r&&t.loaded)try{i()}catch(a){Wn.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Je(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Ke(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(r){Wn.error("Error while processing event "+e.event+" for site app "+i.id,r)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Je(),void this._instance.on("eventCaptured",e=>this.Ke(e))):void Wn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Ve)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;m["__$$ph_site_app_"+e]=s._instance,null==(t=m.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,t=>{if(t)return Wn.error("Error while initializing PostHog app with config id "+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else Wn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var zn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&k(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some(e=>k(null==e?void 0:e.brand,t)))return!0}catch(s){}return!!e.webdriver},Yn=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),Xn="i.posthog.com";class Jn{constructor(e){this.Ye={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Xn,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ye[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ye[this.apiHost]=Yn.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ye[this.apiHost]=Yn.EU:this.Ye[this.apiHost]=Yn.CUSTOM),this.Ye[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if(this.region===Yn.CUSTOM)return this.apiHost+t;var i=Xn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Kn={icontains:(e,t)=>!!o&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!o&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!o&&Qs(t.href,e),not_regex:(e,t)=>!!o&&!Qs(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Zn{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{Zn.Xe("retrieved web experiments from the server"),t.Qe=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;t.Qe&&(Zn.Xe("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Qe)||i.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);j(r)&&e.variants[r]&&t.Ze(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];Zn.tr(n)&&t.Ze(e.name,s,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}onFeatureFlags(e){if(this._is_bot())Zn.Xe("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(q(this.Qe))return this.Qe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Zn.Xe("applying feature flags",e),e.forEach(e=>{var t;if(this.Qe&&null!=(t=this.Qe)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this.Qe)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this.Ze(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var e=Zn.getWindowLocation();if(null!=e&&e.search){var t=oi(null==e?void 0:e.search,"__experiment_id"),i=oi(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Zn.Xe("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.ir(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}ir(e,t,i){var r=i.filter(t=>t.id===e);r&&r.length>0&&(Zn.Xe("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Ze(r[0].name,t,r[0].variants[t].transforms))}static tr(e){return!q(e.conditions)&&Zn.er(e)&&Zn.rr(e)}static er(e){var t;if(q(e.conditions)||q(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,s,n=Zn.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||Kn[null!==(r=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==o?void 0:o.location}static rr(e){var t;if(q(e.conditions)||q(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Qr();if(i.utm_source){var r,s,n,o,a,l,c,u,h=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,g=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==i.utm_term;return h&&p&&g&&d}return!1}static Xe(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];$e.info("[WebExperiments] "+e,i)}Ze(e,t,i){this._is_bot()?Zn.Xe("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach(i=>{if(i.selector){var r;Zn.Xe("applying transform of variant "+t+" for experiment "+e+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach(e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})}}):Zn.Xe("Control variants leave the page unmodified.")}_is_bot(){return h&&this._instance?zn(h,this._instance.config.custom_blocked_useragents):void 0}}var Qn=Oe("[PostHog ExternalIntegrations]"),eo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class to{constructor(e){this._instance=e}it(e,t){var i;null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return Qn.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;!r||null!=(i=m.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.it(eo[t],()=>{var i;null==(i=m.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)}),!r&&null!=(s=m.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(n=m.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}}var io="[SessionRecording]",ro=Oe(io);class so{get started(){var e;return!(null==(e=this.sr)||!e.isStarted)}get status(){return this.sr?this.sr.status:this.nr&&!this.ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.nr=!1,this.lr=void 0,this._instance=e,!this._instance.sessionManager)throw ro.error("started without valid sessionManager"),new Error(io+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(io+' cannot be used with cookieless_mode="always"')}get ar(){var e,t=!(null==(e=this._instance.get_property(rt))||!e.enabled),i=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return o&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.ar||null==(t=this.sr)||!t.isStarted){var i=!L(Object.assign)&&!L(Array.from);this.ar&&i?(this.ur(e),ro.info("starting")):this.stopRecording()}}ur(e){var t,i,r;this.ar&&(null!=m&&null!=(t=m.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=m.__PosthogExtensions__)&&i.initSessionRecording?this.hr(e):null==(r=m.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.dr,t=>{if(t)return ro.error("could not load recorder",t);this.hr(e)}))}stopRecording(){var e,t;null==(e=this.lr)||e.call(this),this.lr=void 0,null==(t=this.sr)||t.stop()}vr(){var e;null==(e=this._instance.persistence)||e.unregister(nt)}cr(e){if(this._instance.persistence){var t,i,r=this._instance.persistence,s=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,i=null==t?void 0:t.sampleRate,s=q(i)?null:parseFloat(i);q(s)&&this.vr();var n=null==t?void 0:t.minimumDurationMilliseconds;r.register({[rt]:E({enabled:!!t},t,{networkPayloadCapture:E({capturePerformance:e.capturePerformance},null==t?void 0:t.networkPayloadCapture),canvasRecording:{enabled:null==t?void 0:t.recordCanvas,fps:null==t?void 0:t.canvasFps,quality:null==t?void 0:t.canvasQuality},sampleRate:s,minimumDurationMilliseconds:L(n)?null:n,endpoint:null==t?void 0:t.endpoint,triggerMatchType:null==t?void 0:t.triggerMatchType,masking:null==t?void 0:t.masking,urlTriggers:null==t?void 0:t.urlTriggers})})};s(),null==(t=this.lr)||t.call(this),this.lr=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?!1!==e.sessionRecording?(this.cr(e),this.nr=!0,this.startIfEnabledOrStop()):this.nr=!0:ro.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.sr)&&i.log?this.sr.log(e,t):ro.warn("log called before recorder was ready")}get dr(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(rt);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}hr(e){var t,i;if(null==(t=m.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.sr||(this.sr=null==(i=m.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.sr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.sr.start(e)}onRRwebEmit(e){var t;null==(t=this.sr)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e;null==(e=this.sr)||e.overrideLinkedFlag()}overrideSampling(){var e;null==(e=this.sr)||e.overrideSampling()}overrideTrigger(e){var t;null==(t=this.sr)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.sr)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.sr)||!i.tryAddCustomEvent(e,t))}}var no={},oo=()=>{},ao="posthog",lo=!zs&&-1===(null==f?void 0:f.indexOf("MSIE"))&&-1===(null==f?void 0:f.indexOf("Mozilla")),co=e=>{var t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Be(null==d?void 0:d.location),persistence:"localStorage+cookie",persistence_name:"",loaded:oo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:"2025-05-24"!==e||"history_change",capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",debug:p&&j(null==p?void 0:p.search)&&-1!==p.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==o||null==(t=o.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;$e.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Dn},error_tracking:{},_onCapture:oo,__preview_eager_load_replay:!1}},uo=e=>{var t={};L(e.process_person)||(t.person_profiles=e.process_person),L(e.xhr_headers)||(t.request_headers=e.xhr_headers),L(e.cookie_name)||(t.persistence_name=e.cookie_name),L(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),L(e.store_google)||(t.save_campaign_params=e.store_google),L(e.verbose)||(t.debug=e.verbose);var i=Me({},t,e);return A(e.property_blacklist)&&(L(e.property_denylist)?i.property_denylist=e.property_blacklist:A(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:$e.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class ho{constructor(){this.__forceAllowLocalhost=!1}get pr(){return this.__forceAllowLocalhost}set pr(e){$e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class po{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new ho,this.gr=!1,this.version=y.LIB_VERSION,this._r=new wn,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=co(),this.SentryIntegration=Wi,this.sentryIntegration=e=>{return t=Gi(this,e),{name:Bi,processEvent:e=>t(e)};var t},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.mr=!1,this.yr=null,this.br=null,this.wr=null,this.featureFlags=new gn(this),this.toolbar=new Ji(this),this.scrollManager=new jn(this),this.pageViewManager=new gs(this),this.surveys=new On(this),this.experiments=new Zn(this),this.exceptions=new nn(this),this.rateLimiter=new Cn(this),this.requestRouter=new Jn(this),this.consent=new Ri(this),this.externalIntegrations=new to(this),this.people={set:(e,t,i)=>{var r=j(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=j(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",e=>$e.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==ao){var r,s=null!==(r=no[i])&&void 0!==r?r:new po;return s._init(e,t,i),no[i]=s,no[ao][i]=s,s}return this._init(e,t,i)}_init(e,t,i){var r,s;if(void 0===t&&(t={}),L(e)||U(e))return $e.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Sr(t.debug),this.Er=t,this.$r=[],t.person_profiles&&(this.br=t.person_profiles),this.set_config(Me({},co(t.defaults),uo(t),{name:i,token:e})),this.config.on_xhr_error&&$e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:si.GZipJS;var n=this.kr();this.persistence=new vn(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new vn(E({},this.config,{persistence:"sessionStorage"}),n);var a=E({},this.persistence.props),l=E({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Pr=new Mn(e=>this.Tr(e),this.config.request_queue_config),this.Rr=new Ln(this),this.__request_queue=[];var c="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new Bn(this),this.sessionPropsManager=new Hn(this,this.sessionManager,this.persistence)),new Zi(this).startIfEnabledOrStop(),this.siteApps=new Vn(this),null==(r=this.siteApps)||r.init(),c||(this.sessionRecording=new so(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new di(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new ps(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new us(this),this.exceptionObserver=new ji(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Ni(this,Mi),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Hi(this),this.historyAutocapture.startIfEnabled(),y.DEBUG=y.DEBUG||this.config.debug,y.DEBUG&&$e.info("Starting in debug mode",{this:this,config:t,thisC:E({},this.config),p:a,s:l}),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var u,h,d=this.config.get_device_id(yi()),p=null!=(u=t.bootstrap)&&u.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(gt,null!=(h=t.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.Ir()){var g,_,v=Object.keys((null==(g=t.bootstrap)?void 0:g.featureFlags)||{}).filter(e=>{var i;return!(null==(i=t.bootstrap)||null==(i=i.featureFlags)||!i[e])}).reduce((e,i)=>{var r;return e[i]=(null==(r=t.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,e},{}),f=Object.keys((null==(_=t.bootstrap)?void 0:_.featureFlagPayloads)||{}).filter(e=>v[e]).reduce((e,i)=>{var r,s;return null!=(r=t.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(e[i]=null==(s=t.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:f})}if(c)this.register_once({distinct_id:Et,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(yi());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(gt,"anonymous")}return We(o,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||yi();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(gt,"identified")),t()},s=i.user();"then"in s&&D(s.then)?s.then(e=>r(e)):r(s)}(e,()=>{i.register((e=>{Promise&&Promise.resolve||qi.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(qi.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(qi.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.Cr()):this.Cr(),D(this.config._onCapture)&&this.config._onCapture!==oo&&($e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&$e.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}fi(e){var t,i,r,s,n,o,a,l;if(!d||!d.body)return $e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.fi(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=P(e.supportedCompression,si.GZipJS)?si.GZipJS:P(e.supportedCompression,si.Base64)?si.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.br?this.br:"identified_only"}),null==(i=this.siteApps)||i.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(s=this.autocapture)||s.onRemoteConfig(e),null==(n=this.heatmaps)||n.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null==(o=this.webVitalsAutocapture)||o.onRemoteConfig(e),null==(a=this.exceptionObserver)||a.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),null==(l=this.deadClicksAutocapture)||l.onRemoteConfig(e)}Cr(){try{this.config.loaded(this)}catch(ii){$e.critical("`loaded` function failed",ii)}this.Or(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Fr()},1),new An(this).load(),this.featureFlags.flags()}Or(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Pr)||e.enable())}_dom_loaded(){this.is_capturing()&&Ae(this.__request_queue,e=>this.Tr(e)),this.__request_queue=[],this.Or()}_handle_unload(){var e,t;this.config.request_batching?(this.Mr()&&this.capture("$pageleave"),null==(e=this.Pr)||e.unload(),null==(t=this.Rr)||t.unload()):this.Mr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(e){this.__loaded&&(lo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Xs(e.url,{ip:this.config.ip?1:0}),e.headers=E({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,s=E({},e);s.timeout=s.timeout||6e4,s.url=Xs(s.url,{_:(new Date).getTime().toString(),ver:y.LIB_VERSION,compression:s.compression});var n=null!==(t=s.transport)&&void 0!==t?t:"fetch",o=Zs.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),a=null!==(i=null==(r=Ge(o,e=>e.transport===n))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(E({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null==(i=(r=this.config).on_request_error)||i.call(r,t)),null==e.callback||e.callback(t)}}))))}Tr(e){this.Rr?this.Rr.retriableRequest(e):this.ci(e)}_execute_array(e){var t,i=[],r=[],s=[];Ae(e,e=>{e&&(t=e[0],A(t)?s.push(e):D(e)?e.call(this):A(e)&&"alias"===t?i.push(e):A(e)&&-1!==t.indexOf("capture")&&D(this[t])?s.push(e):r.push(e))});var n=function(e,t){Ae(e,function(e){if(A(e[0])){var i=t;De(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};n(i,this),n(r,this),n(s,this)}Ir(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pr){if(this.is_capturing())if(!L(e)&&j(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!s||this.config.__preview_capture_bot_pageviews){var n=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=t&&t.$current_url&&!j(null==t?void 0:t.$current_url)&&($e.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(null==i?void 0:i.timestamp)||o,l=yi(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},a,l)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&s&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),n&&(c.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var u,h=this.Ar(null==i?void 0:i.$set_once);if(h&&(c.$set_once=h),(c=function(e,t){return i=e,r=e=>j(e)&&!H(t)?e.slice(0,t):e,s=new Set,function e(t,i){return t!==Object(t)?r?r(t):t:s.has(t)?void 0:(s.add(t),A(t)?(n=[],Ae(t,t=>{n.push(e(t))})):(n={},De(t,(t,i)=>{s.has(t)||(n[i]=e(t))})),n);var n}(i);var i,r,s}(c,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,L(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===mn.DISMISSED||e===mn.SENT){var d=null==t?void 0:t[yn.SURVEY_ID],p=null==t?void 0:t[yn.SURVEY_ITERATION];u={id:d,current_iteration:p},localStorage.getItem(In(u))||localStorage.setItem(In(u),"true"),c.$set=E({},c.$set,{[kn({id:d,current_iteration:p},e===mn.SENT?"responded":"dismissed")]:!0})}var g=E({},c.properties.$set,c.$set);if(N(g)||this.setPersonPropertiesForFlags(g),!q(this.config.before_send)){var _=this.Dr(c);if(!_)return;c=_}this._r.emit("eventCaptured",c);var v={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Tr(v):this.Pr.enqueue(v),c}$e.critical("This capture call is ignored due to client rate limiting.")}}else $e.error("No event name provided to posthog.capture")}else $e.uninitializedWarning("posthog.capture")}Mi(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=s?void 0:this.persistence.remove_event_timer(e),a=E({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===e){var l=E({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!j(a.distinct_id)&&!B(a.distinct_id)||U(a.distinct_id))&&$e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=function(e,t){if(!f)return{};var i,r,s,n=e?Ne([],Xr,t||[]):[],[a,l]=function(e){for(var t=0;t<Vr.length;t++){var[i,r]=Vr[t],s=i.exec(e),n=s&&(D(r)?r(s,e):r);if(n)return n}return["",""]}(f);return Me(He({$os:a,$os_version:l,$browser:Br(f,navigator.vendor),$device:zr(f),$device_type:(r=f,s=zr(r),s===sr||s===rr||"Kobo"===s||"Kindle Fire"===s||s===Ar?ir:s===Sr||s===kr||s===xr||s===Fr?"Console":s===or?"Wearable":s?Qi:"Desktop"),$timezone:os(),$timezone_offset:as()}),{$current_url:ai(null==p?void 0:p.href,n,Kr),$host:null==p?void 0:p.host,$pathname:null==p?void 0:p.pathname,$raw_user_agent:f.length>1e3?f.substring(0,997)+"...":f,$browser_version:Wr(f,navigator.vendor),$browser_language:is(),$browser_language_prefix:(i=is(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==o?void 0:o.screen.height,$screen_width:null==o?void 0:o.screen.width,$viewport_height:null==o?void 0:o.innerHeight,$viewport_width:null==o?void 0:o.innerWidth,$lib:"web",$lib_version:y.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());a.$session_id=h,a.$window_id=g}this.sessionPropsManager&&Me(a,this.sessionPropsManager.getSessionProps());try{var _;this.sessionRecording&&Me(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(_=this.Rr)?void 0:_.length}catch(w){a.$sdk_debug_error_capturing_properties=String(w)}if(this.requestRouter.region===Yn.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c="$pageview"!==e||s?"$pageleave"!==e||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),a=Me(a,c),"$pageview"===e&&d&&(a.title=d.title),!L(n)){var v=i.getTime()-n;a.$duration=parseFloat((v/1e3).toFixed(3))}f&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Me({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),A(this.config.property_denylist)?De(this.config.property_denylist,function(e){delete a[e]}):$e.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&($e.error("sanitize_properties is deprecated. Use before_send instead"),a=m(a,e));var b=this.jr();return a.$process_person_profile=b,b&&!s&&this.Lr("_calculate_event_properties"),a}Ar(e){var t;if(!this.persistence||!this.jr())return e;if(this.gr)return e;var i=this.persistence.get_initial_props(),r=null==(t=this.sessionPropsManager)?void 0:t.getSetOnceProps(),s=Me({},i,r||{},e||{}),n=this.config.sanitize_properties;return n&&($e.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this.gr=!0,N(s)?void 0:s}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Nr(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(i){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._r.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){void 0===t&&(t=Tn),this.surveys.displaySurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return $e.uninitializedWarning("posthog.identify");if(B(e)&&(e=e.toString(),$e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))$e.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==Et){if(this.Lr("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==r&&e!==this.get_property(ze)&&(this.unregister(ze),this.register({distinct_id:e}));var n="anonymous"===(this.persistence.get_property(gt)||"anonymous");e!==r&&n?(this.persistence.set_property(gt,"identified"),this.setPersonPropertiesForFlags(E({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.wr=en(e,t,i),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(pt))}}else $e.critical('The string "'+Et+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else $e.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Lr("posthog.setPersonProperties")){var i=en(this.get_distinct_id(),e,t);this.wr!==i?(this.setPersonPropertiesForFlags(E({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.wr=i):$e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Lr("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:E({},r,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}}else $e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this.Lr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s;if($e.info("reset"),!this.__loaded)return $e.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(gt,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.wr=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Et,$device_id:null},"");else{var o=this.config.get_device_id(yi());this.register_once({distinct_id:o,$device_id:e?o:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(Ve)?($e.critical("Attempting to create alias for existing People user - aborting."),-2):this.Lr("posthog.alias")?(L(t)&&(t=this.get_distinct_id()),e!==t?(this.Nr(ze,e),this.capture("$create_alias",{alias:e,distinct_id:t})):($e.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=E({},this.config);if(M(e)){var i,r,s,n,o;Me(this.config,uo(e));var a=this.kr();null==(i=this.persistence)||i.update_config(this.config,t,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new vn(E({},this.config,{persistence:"sessionStorage"}),a);var l=this.Sr(this.config.debug);G(l)&&(this.config.debug=l),G(this.config.debug)&&(this.config.debug?(y.DEBUG=!0,ki.H()&&ki.G("ph_debug","true"),$e.info("set_config",{config:e,oldConfig:t,newConfig:E({},this.config)})):(y.DEBUG=!1,ki.H()&&ki.V("ph_debug"))),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ur(),null==(o=this.externalIntegrations)||o.startIfEnabledOrStop()}}startSessionRecording(e){var t,i,r,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(E({},r,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:ao;return t!==ao&&(t=ao+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(gt))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(gt))}jr(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&N(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[ze])&&(null==(t=this.persistence)||null==(t=t.props)||!t[bt]))}Mr(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.jr()||this.Lr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Lr(e){return"never"===this.config.person_profiles?($e.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Nr(bt,!0),!0)}kr(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}Ur(){var e,t,i,r,s=this.kr();return(null==(e=this.persistence)?void 0:e.wi)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t.wi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(e){var t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=new Bn(this),this.persistence&&(this.sessionPropsManager=new Hn(this,this.sessionManager,this.persistence)),this.sessionRecording=new so(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ur(),this.Or(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),(L(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(i=null==e?void 0:e.captureEventName)&&void 0!==i?i:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Fr()):$e.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ur(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Et,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,this.Fr())):$e.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Ci.GRANTED?"granted":e===Ci.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ur()}_is_bot(){return h?zn(h,this.config.custom_blocked_useragents):void 0}Fr(){d&&("visible"===d.visibilityState?this.mr||(this.mr=!0,this.capture("$pageview",{title:d.title},{send_instantly:!0}),this.yr&&(d.removeEventListener("visibilitychange",this.yr),this.yr=null)):this.yr||(this.yr=this.Fr.bind(this),We(d,"visibilitychange",this.yr)))}debug(e){!1===e?(null==o||o.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==o||o.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,i,r,s,n,o=this.Er||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?($e.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=$e,s=(t="advanced_disable_flags")in(e=o)&&!L(e[t]),n=i in e&&!L(e[i]),s?e[t]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}Dr(e){if(q(this.config.before_send))return e;var t=A(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),q(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return W(e.event)?$e.warn(s+". This can cause unexpected behavior."):$e.info(s),null}i.properties&&!N(i.properties)||$e.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.Vt)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Sr(e){var t=G(e)&&!e,i=ki.H()&&"true"===ki.q("ph_debug");return!t&&(!!i||e)}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=Ue(e.prototype[t[i]])}(po,["identify"]);var go,_o=(go=no[ao]=new po,function(){function e(){e.done||(e.done=!0,lo=!1,De(no,function(e){e._dom_loaded()}))}null!=d&&d.addEventListener?"complete"===d.readyState?e():We(d,"DOMContentLoaded",e,{capture:!1}):o&&$e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),go);let vo=null,fo=!1;const mo="dori_shopify_end_user_id",yo="dori_shopify_end_user_session",bo=()=>"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now()}_${Math.random().toString(36).slice(2,10)}`;let wo=null;const Eo=()=>{if(wo)return wo;let e;try{const t=window?.DORI_CUSTOMER_ID;if(t){let i=window.localStorage.getItem(yo);i&&i.trim()||(i=bo(),window.localStorage.setItem(yo,i)),e=`shopify_customer_${String(t)}_${i}`}else{const t=window.localStorage.getItem(mo);t&&t.trim()?e=t:(e=`anon_${bo()}`,window.localStorage.setItem(mo,e))}}catch{e=`anon_${bo()}`}return wo=e,e};let So=null;const xo=()=>{try{const e=document.querySelector("script#dori-side-widget");return e?.getAttribute("data-sharing-id")||null}catch{return null}};let ko=null;const Io=()=>{const e={},t=xo();return t&&(e.sharing_id=t),"undefined"!=typeof window&&window.location&&window.location.hostname&&(e.shop_domain=window.location.hostname),e},Po=e=>{if(!e)return;const t=To();if(t)try{t.register({thread_id:e})}catch(i){}},To=()=>(vo||fo||(vo=(()=>{if(_o.__loaded)return _o;if(fo)return null;fo=!0;try{return _o.init("phc_Q0yKPwlYDSkhDCTq1U1K4oP5ne5xFMfso0cCkDbm4VI",{api_host:"https://us.i.posthog.com",person_profiles:"identified_only",autocapture:!1,capture_pageview:!1,capture_pageleave:!1,capture_performance:!1,capture_dead_clicks:!1,rageclick:!1,disable_session_recording:!0,bootstrap:{distinctID:Eo()},before_send:e=>e?(()=>{if(null===So){const e=xo()??"";So=(e=>{let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=Math.imul(t,16777619);return(t>>>0)/4294967296})(`${e}:${Eo()}`)<.1}return So})()&&("$exception"!==e.event||(e=>{const t=e?.properties??{};if("manual"===t.dori_capture)return!0;const i=(()=>{if(ko)return ko;const e=[];try{const t=document.querySelector("script#dori-side-widget"),i=t?.src;if(i){e.push(i);const t=i.slice(0,i.lastIndexOf("/")+1);t&&t!==i&&e.push(t)}}catch{}return ko=e,e})();if(0===i.length)return!0;const r=t.$exception_list;if(!Array.isArray(r)||0===r.length)return!0;for(const s of r){const e=s?.stacktrace?.frames;if(Array.isArray(e))for(const t of e){const e=t?.filename;if("string"==typeof e&&i.some(t=>e.startsWith(t)))return!0}}return!1})(e))?e:null:e,loaded:e=>{try{e.register({...Io(),surface:"side",flow_version:"1.13.35"})}catch(t){}}}),vo=_o,_o}catch(e){return console.error("[PostHog] Failed to initialize:",e),null}finally{fo=!1}})()),vo),$o=(e,t)=>{const i=To();if(i)try{i.capture(e,t)}catch(r){}},Oo=(e,t)=>{const i=To();if(i)try{console.error("Error captured:",e,t),i.capture("$exception",{$exception_message:e.message,$exception_type:e.name,$exception_stack_trace:e.stack,dori_capture:"manual",...t})}catch(r){console.error("[PostHog] Failed to capture exception:",r)}},Fo=(e,t)=>(...i)=>{try{return console.log("withErrorHandling",e),t(...i)}catch(r){throw console.error("Error in withErrorHandling:",r),Oo(r,{context:e}),r}},Co=(e,t)=>(...i)=>{try{return t(...i).catch(t=>{throw"AbortError"!==t.name&&Oo(t,{context:e}),t})}catch(r){throw"AbortError"!==r.name&&Oo(r,{context:e}),r}},Ro={BOT_DATA:"dori_widget_bot_data",BOT_DATA_ETAG:"dori_widget_bot_data_etag",CHAT_STATE:"dori_widget_chat_state",MESSAGES:"dori_widget_messages",CURRENT_STEP:"dori_widget_current_step",SESSION_TIMESTAMP:"dori_widget_session_timestamp",FAB_ANIMATION_TIMESTAMP:"dori_widget_fab_animation_timestamp",DORI_THREAD_ID:"dori_thread_id",DORI_SESSION_KEY:"dori_session_key",LOADED_FROM_STORAGE:"dori_loaded_from_storage",SHOPIFY_END_USER_ID:"dori_shopify_end_user_id",SHOPIFY_END_USER_SESSION:"dori_shopify_end_user_session"};function Ao(){if("undefined"==typeof window)return"";const e=window;if(e.chatbotData?.sharingID)return String(e.chatbotData.sharingID);const t=document.querySelector("script#dori-side-widget");return t?.getAttribute("data-sharing-id")||""}function Do(){try{const e="__test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return!1}}function Mo(){Do()&&localStorage.setItem(Ro.LOADED_FROM_STORAGE,"true")}function No(){Do()&&localStorage.removeItem(Ro.LOADED_FROM_STORAGE)}function Lo(){try{const e=localStorage.getItem(Ro.SESSION_TIMESTAMP);if(!e)return!1;const t=parseInt(e,10);return Date.now()-t<864e5}catch{return!1}}function jo(){if(Do())try{[Ro.CHAT_STATE,Ro.MESSAGES,Ro.CURRENT_STEP,Ro.DORI_THREAD_ID,Ro.DORI_SESSION_KEY,Ro.LOADED_FROM_STORAGE,Ro.SHOPIFY_END_USER_ID,Ro.SHOPIFY_END_USER_SESSION].forEach(e=>{localStorage.removeItem(e)})}catch(e){console.error("Error clearing local storage:",e)}}function Uo(e){if(Do())try{e?localStorage.setItem(Ro.BOT_DATA,JSON.stringify(e)):localStorage.removeItem(Ro.BOT_DATA)}catch(t){console.error("Error saving bot data:",t)}}function Ho(){if(!Do()||!Lo())return null;try{const e=localStorage.getItem(Ro.BOT_DATA);return e?JSON.parse(e):null}catch(e){return console.error("Error loading bot data:",e),null}}function qo(e){if(Do())try{localStorage.setItem(Ro.CHAT_STATE,JSON.stringify(e))}catch(t){console.error("Error saving chat state:",t)}}function Bo(e){if(Do())try{const t=e.map(e=>({...e,timestamp:e.timestamp instanceof Date?e.timestamp.toISOString():e.timestamp}));localStorage.setItem(Ro.MESSAGES,JSON.stringify(t))}catch(t){console.error("Error saving messages:",t)}}function Go(){if(!Do()||!Lo())return[];try{const e=localStorage.getItem(Ro.MESSAGES);return e?JSON.parse(e).map(e=>({...e,content:"string"==typeof e.content?r(e.content):e.content,timestamp:new Date(e.timestamp)})):[]}catch(e){return console.error("Error loading messages:",e),[]}}function Wo(e){if(Do())try{localStorage.setItem(Ro.CURRENT_STEP,e)}catch(t){console.error("Error saving current step:",t)}}function Vo(){if(!Do()||!Lo())return null;try{const e=Ho(),t=function(){if(!Do()||!Lo())return null;try{const e=localStorage.getItem(Ro.CHAT_STATE);return e?JSON.parse(e):null}catch(e){return console.error("Error loading chat state:",e),null}}(),i=Go(),r=function(){if(!Do()||!Lo())return"welcome";try{return localStorage.getItem(Ro.CURRENT_STEP)||"welcome"}catch(e){return console.error("Error loading current step:",e),"welcome"}}();return e||i.length>0?{botData:e,chatState:t||{repliedProduct:null,focusedProduct:null,threadId:null,isRequestInProgress:!1},messages:i,currentStep:r,sessionTimestamp:Date.now()}:null}catch(e){return console.error("Error loading session data:",e),null}}function zo(){if(!Do()||!Lo())return!1;try{const e=Ho(),t=Go();return!!(e||t.length>0)}catch{return!1}}function Yo(){if(Do())try{localStorage.setItem(Ro.SESSION_TIMESTAMP,Date.now().toString())}catch(e){console.error("Error updating session timestamp:",e)}}function Xo(){if(Do())try{localStorage.setItem(Ro.FAB_ANIMATION_TIMESTAMP,Date.now().toString())}catch(e){console.error("Error saving FAB animation timestamp:",e)}}function Jo(){const e=function(){if(!Do()||!Lo())return null;try{const e=localStorage.getItem(Ro.FAB_ANIMATION_TIMESTAMP);return e?parseInt(e,10):null}catch(e){return console.error("Error loading FAB animation timestamp:",e),null}}();return!e||Date.now()-e>=3e5}function Ko(){if(!Do())return"";try{let e=localStorage.getItem(Ro.DORI_SESSION_KEY);return e||(e="dori_session_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),localStorage.setItem(Ro.DORI_SESSION_KEY,e)),e}catch(e){return console.error("Error generating session key:",e),""}}function Zo(e){if(Do()&&e){try{localStorage.setItem(Ro.DORI_THREAD_ID,e)}catch(t){console.error("Error storing dori thread ID:",t)}Po(e)}}function Qo(){if(!Do())return null;try{const e=localStorage.getItem(Ro.DORI_THREAD_ID);return Po(e),e}catch(e){return console.error("Error retrieving dori thread ID:",e),null}}function ea(e){const t=window?.chatbotData;if("undefined"!=typeof window&&t?.ajaxurl){const i=Ko();fetch(t.ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"dori_store_thread_session",thread_id:e,session_key:i,nonce:t.nonce})}).catch(e=>console.warn("Failed to store thread in WooCommerce session:",e))}}const ta="https://standardapi.dori.tech",ia=["pointerdown","keydown"],ra=["pointermove","touchstart","wheel","scroll"],sa=["pointerover","focusin","click"],na="dori-bot-data-ready",oa="dori-bot-data-error",aa=(e,t)=>{window.dispatchEvent(new CustomEvent(e,t?{detail:{error:t}}:void 0))},la=async e=>{const t=await fetch(e);if(200!==t.status)throw new Error(`Failed to fetch bot data: ${t.status}`);const i=await t.json();if(i.error)throw new Error(i.error);if(!i.data)throw new Error("No data received from bot sharing API");return i},ca=(e,t)=>{Uo(e),t&&function(e){if(Do())try{e?localStorage.setItem(Ro.BOT_DATA_ETAG,e):localStorage.removeItem(Ro.BOT_DATA_ETAG)}catch(t){console.error("Error saving ETag:",t)}}(t),Yo()};!async function(){try{const t=(()=>{const e=document.querySelector("script#dori-side-widget");return e?.getAttribute("data-sharing-id")||null})();if(!t)return void aa(oa,"No sharing ID found");const i=Ho(),r=function(){if(!Do()||!Lo())return null;try{return localStorage.getItem(Ro.BOT_DATA_ETAG)}catch(e){return console.error("Error loading ETag:",e),null}}(),s=`${ta}/bot-sharing-data/${t}`;i&&aa(na);const n=i?[]:[1500,4e3];for(let o=0;;o++)try{const e=r?{"If-None-Match":r}:{},t=await fetch(s,{headers:e});if(304===t.status){if(!i){const e=await la(s);ca(e.data,t.headers.get("ETag")),aa(na)}return}if(200===t.status){const e=await t.json();if(e.error)throw new Error(e.error);if(!e.data)throw new Error("No data received");return ca(e.data,t.headers.get("ETag")),void aa(na)}throw new Error(`Failed to fetch bot data: ${t.status}`)}catch(e){if(i)return;if(o<n.length){await new Promise(e=>setTimeout(e,n[o]));continue}const t=e instanceof Error?e.message:String(e);return void aa(oa,t)}}catch(e){const t=e instanceof Error?e.message:String(e);aa(oa,t)}}(),function(e,t={}){let i=!1;try{i=window.self!==window.top}catch{i=!0}if(i)return t.onLoadStart?.(),void e();let r=!1;const s=[],n=()=>{if(!r){r=!0;for(const e of s)e();t.onLoadStart?.(),e()}},o=(e,t)=>{"function"==typeof window.requestIdleCallback?window.requestIdleCallback(()=>e(),{timeout:t}):window.setTimeout(e,200)},a=(e,t,i)=>{e.addEventListener(t,i,{once:!0,passive:!0,capture:!0}),s.push(()=>e.removeEventListener(t,i,!0))};for(const h of ia)a(window,h,n);let l=!1;const c=()=>{l||r||(l=!0,o(n,2e3))};for(const h of ra)a(window,h,c);for(const h of t.immediateTargets??[])if(h)for(const e of sa)a(h,e,n);const u=()=>{if(r)return;const e=window.setTimeout(()=>o(n,1e3),5e3);s.push(()=>window.clearTimeout(e))};"complete"===document.readyState?u():window.addEventListener("load",u,{once:!0})}(()=>{t(async()=>{const{initializeDoriWidget:e}=await import("./assets/main-CO_s2xtp.js").then(e=>e.e);return{initializeDoriWidget:e}},[],import.meta.url).then(({initializeDoriWidget:e})=>e()).catch(e=>{console.error("[Dori Widget] Error initializing widget:",e)})});export{ta as A,Xo as B,Oo as C,Ro as S,t as _,Fo as a,qo as b,$o as c,Bo as d,Wo as e,Vo as f,Qo as g,zo as h,Do as i,s as j,Ao as k,Go as l,Mo as m,jo as n,No as o,Zo as p,ea as q,Ko as r,Uo as s,r as t,Yo as u,Ho as v,Co as w,n as x,To as y,Jo as z};
|
|
1
|
+
const e={},t=function(t,i,r){let s=Promise.resolve();if(i&&i.length>0){let t=function(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:"fulfilled",value:e}),e=>({status:"rejected",reason:e}))))};const n=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");s=t(i.map(t=>{if(t=function(e,t){return new URL(e,t).href}(t,r),t in e)return;e[t]=!0;const i=t.endsWith(".css"),s=i?'[rel="stylesheet"]':"";if(r)for(let e=n.length-1;e>=0;e--){const r=n[e];if(r.href===t&&(!i||"stylesheet"===r.rel))return}else if(document.querySelector(`link[href="${t}"]${s}`))return;const o=document.createElement("link");return o.rel=i?"stylesheet":"modulepreload",i||(o.as="script"),o.crossOrigin="",o.href=t,a&&o.setAttribute("nonce",a),document.head.appendChild(o),i?new Promise((e,i)=>{o.addEventListener("load",e),o.addEventListener("error",()=>i(new Error(`Unable to preload CSS for ${t}`)))}):void 0}))}function n(e){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return s.then(e=>{for(const t of e||[])"rejected"===t.status&&n(t.reason);return t().catch(n)})};let i=null;function r(e){let t=e.replace(/<thought>[\s\S]*?<\/thought>/gi,"");return t=t.replace(/<thought>[\s\S]*$/gi,""),t.trim()}const s=e=>{if(!e)return;const t=e.closest('[data-scroll-container="chat-messages"]');t&&null===i&&(i=setTimeout(()=>{i=null,t.scrollTo({top:t.scrollHeight,behavior:"smooth"})},200))},n=(e,t,i=new Date)=>{const r=e||"Dori";return`${i.getHours()>=18&&t.hiImEvening?t.hiImEvening:t.hiIm} ${r}!`};var o="undefined"!=typeof window?window:void 0,a="undefined"!=typeof globalThis?globalThis:o,l=Array.prototype,c=l.forEach,u=l.indexOf,h=null==a?void 0:a.navigator,d=null==a?void 0:a.document,p=null==a?void 0:a.location,g=null==a?void 0:a.fetch,_=null!=a&&a.XMLHttpRequest&&"withCredentials"in new a.XMLHttpRequest?a.XMLHttpRequest:void 0,v=null==a?void 0:a.AbortController,f=null==h?void 0:h.userAgent,m=null!=o?o:{},y={DEBUG:!1,LIB_VERSION:"1.283.0"};function b(e,t,i,r,s,n,o){try{var a=e[n](o),l=a.value}catch(c){return void i(c)}a.done?t(l):Promise.resolve(l).then(r,s)}function w(e){return function(){var t=this,i=arguments;return new Promise(function(r,s){var n=e.apply(t,i);function o(e){b(n,r,s,o,a,"next",e)}function a(e){b(n,r,s,o,a,"throw",e)}o(void 0)})}}function E(){return E=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var r in i)({}).hasOwnProperty.call(i,r)&&(e[r]=i[r])}return e},E.apply(null,arguments)}function S(e,t){if(null==e)return{};var i={};for(var r in e)if({}.hasOwnProperty.call(e,r)){if(-1!==t.indexOf(r))continue;i[r]=e[r]}return i}var x=["amazonbot","amazonproductbot","app.hypefactors.com","applebot","archive.org_bot","awariobot","backlinksextendedbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","dataforseobot","deepscan","duckduckbot","facebookexternal","facebookcatalog","http://yandex.com/bots","hubspot","ia_archiver","leikibot","linkedinbot","meta-externalagent","mj12bot","msnbot","nessus","petalbot","pinterest","prerender","rogerbot","screaming frog","sebot-wa","sitebulb","slackbot","slurp","trendictionbot","turnitin","twitterbot","vercel-screenshot","vercelbot","yahoo! slurp","yandexbot","zoombot","bot.htm","bot.php","(bot;","bot/","crawler","ahrefsbot","ahrefssiteaudit","semrushbot","siteauditbot","splitsignalbot","gptbot","oai-searchbot","chatgpt-user","perplexitybot","better uptime bot","sentryuptimebot","uptimerobot","headlesschrome","cypress","google-hoteladsverifier","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleother","google-cloudvertexbot","googleweblight","mediapartners-google","storebot-google","google-inspectiontool","bytespider"],k=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return x.concat(t).some(e=>{var t=e.toLowerCase();return-1!==i.indexOf(t)})},I=["$snapshot","$pageview","$pageleave","$set","survey dismissed","survey sent","survey shown","$identify","$groupidentify","$create_alias","$$client_ingestion_warning","$web_experiment_applied","$feature_enrollment_update","$feature_flag_called"];function P(e,t){return-1!==e.indexOf(t)}var T=function(e){return e.trim()},$=function(e){return e.replace(/^\$/,"")},O=Array.isArray,F=Object.prototype,C=F.hasOwnProperty,R=F.toString,A=O||function(e){return"[object Array]"===R.call(e)},D=e=>"function"==typeof e,M=e=>e===Object(e)&&!A(e),N=e=>{if(M(e)){for(var t in e)if(C.call(e,t))return!1;return!0}return!1},L=e=>void 0===e,j=e=>"[object String]"==R.call(e),U=e=>j(e)&&0===e.trim().length,H=e=>null===e,q=e=>L(e)||H(e),B=e=>"[object Number]"==R.call(e),G=e=>"[object Boolean]"===R.call(e),W=e=>P(I,e);function V(e){return null===e||"object"!=typeof e}function z(e,t){return Object.prototype.toString.call(e)==="[object "+t+"]"}function Y(e){return!L(Event)&&function(e,t){try{return e instanceof t}catch(i){return!1}}(e,Event)}var X=[!0,"true",1,"1","yes"],J=e=>P(X,e),K=[!1,"false",0,"0","no"];function Z(e,t,i,r,s){return t>i&&(r.warn("min cannot be greater than max."),t=i),B(e)?e>i?(r.warn(" cannot be greater than max: "+i+". Using max value instead."),i):e<t?(r.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(r.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+s),Z(s||i,t,i,r))}class Q{constructor(e){this.t={},this.i=e.i,this.o=Z(e.bucketSize,0,100,e.h),this.m=Z(e.refillRate,0,this.o,e.h),this.S=Z(e.refillInterval,0,864e5,e.h)}$(e,t){var i=t-e.lastAccess,r=Math.floor(i/this.S);if(r>0){var s=r*this.m;e.tokens=Math.min(e.tokens+s,this.o),e.lastAccess=e.lastAccess+r*this.S}}consumeRateLimit(e){var t,i=Date.now(),r=String(e),s=this.t[r];return s?this.$(s,i):(s={tokens:this.o,lastAccess:i},this.t[r]=s),0===s.tokens||(s.tokens--,0===s.tokens&&(null==(t=this.i)||t.call(this,e)),0===s.tokens)}stop(){this.t={}}}var ee,te,ie,re=e=>e instanceof Error;function se(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return ie&&i.length===te||(te=i.length,ie=i.reduce((i,r)=>{ee||(ee={});var s=ee[r];if(s)i[s[0]]=s[1];else for(var n=e(r),o=n.length-1;o>=0;o--){var a=n[o],l=null==a?void 0:a.filename,c=t[r];if(l&&c){i[l]=c,ee[r]=[l,c];break}}return i},{})),ie}}var ne="?";function oe(e,t,i,r){var s={platform:"web:javascript",filename:e,function:"<anonymous>"===t?ne:t,in_app:!0};return L(i)||(s.lineno=i),L(r)||(s.colno=r),s}var ae=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),r=-1!==e.indexOf("safari-web-extension");return i||r?[-1!==e.indexOf("@")?e.split("@")[0]:ne,i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},le=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,ce=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,ue=/\((\S*)(?::(\d+))(?::(\d+))\)/,he=e=>{var t=le.exec(e);if(t){var[,i,r,s]=t;return oe(i,ne,+r,+s)}var n=ce.exec(e);if(n){if(n[2]&&0===n[2].indexOf("eval")){var o=ue.exec(n[2]);o&&(n[2]=o[1],n[3]=o[2],n[4]=o[3])}var[a,l]=ae(n[1]||ne,n[2]);return oe(l,a,n[3]?+n[3]:void 0,n[4]?+n[4]:void 0)}},de=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,pe=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,ge=e=>{var t=de.exec(e);if(t){if(t[3]&&t[3].indexOf(" > eval")>-1){var i=pe.exec(t[3]);i&&(t[1]=t[1]||"eval",t[3]=i[1],t[4]=i[2],t[5]="")}var r=t[3],s=t[1]||ne;return[s,r]=ae(s,r),oe(r,s,t[4]?+t[4]:void 0,t[5]?+t[5]:void 0)}},_e=/\(error: (.*)\)/;class ve{constructor(e,t,i){void 0===e&&(e=[]),void 0===t&&(t=[]),void 0===i&&(i=[]),this.coercers=e,this.modifiers=i,this.stackParser=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++)t[i]=arguments[i];return function(e,i){void 0===i&&(i=0);for(var r=[],s=e.split("\n"),n=i;n<s.length;n++){var o=s[n];if(!(o.length>1024)){var a=_e.test(o)?o.replace(_e,"$1"):o;if(!a.match(/\S*Error: /)){for(var l of t){var c=l(a);if(c){r.push(c);break}}if(r.length>=50)break}}}return function(e){if(!e.length)return[];var t=Array.from(e);return t.reverse(),t.slice(0,50).map(e=>{return E({},e,{filename:e.filename||(i=t,i[i.length-1]||{}).filename,function:e.function||ne});var i})}(r)}}(...t)}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},r=this.buildCoercingContext(i,t,0).apply(e),s=this.buildParsingContext(),n=this.parseStacktrace(r,s);return{$exception_list:this.convertToExceptionList(n,i),$exception_level:"error"}}modifyFrames(e){var t=this;return w(function*(){for(var i of e)i.stacktrace&&i.stacktrace.frames&&A(i.stacktrace.frames)&&(i.stacktrace.frames=yield t.applyModifiers(i.stacktrace.frames));return e})()}coerceFallback(e){var t;return{type:"Error",value:"Unknown error",stack:null==(t=e.syntheticException)?void 0:t.stack,synthetic:!0}}parseStacktrace(e,t){var i,r;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(r=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?1:0),t.chunkIdMap)),E({},e,{cause:i,stack:r})}applyChunkIds(e,t){return e.map(e=>(e.filename&&t&&(e.chunk_id=t[e.filename]),e))}applyCoercers(e,t){for(var i of this.coercers)if(i.match(e))return i.coerce(e,t);return this.coerceFallback(t)}applyModifiers(e){var t=this;return w(function*(){var i=e;for(var r of t.modifiers)i=yield r(i);return i})()}convertToExceptionList(e,t){var i,r,s,n={type:e.type,value:e.value,mechanism:{type:null!==(i=t.type)&&void 0!==i?i:"generic",handled:null===(r=t.handled)||void 0===r||r,synthetic:null!==(s=e.synthetic)&&void 0!==s&&s}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var o=[n];return null!=e.cause&&o.push(...this.convertToExceptionList(e.cause,E({},t,{handled:!0}))),o}buildParsingContext(){return{chunkIdMap:se(this.stackParser)}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var r=(i,r)=>{if(r<=4){var s=this.buildCoercingContext(e,t,r);return this.applyCoercers(i,s)}};return E({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>r(e,i),next:e=>r(e,i+1)})}}class fe{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=j(e.stack);return{type:this.getType(e),value:this.getValue(e),stack:i?e.stack:void 0,cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return this.isDOMError(e)?"DOMError":"DOMException"}getValue(e){var t=e.name||(this.isDOMError(e)?"DOMError":"DOMException");return e.message?t+": "+e.message:t}isDOMException(e){return z(e,"DOMException")}isDOMError(e){return z(e,"DOMError")}}class me{match(e){return e instanceof Error}coerce(e,t){return{type:this.getType(e),value:this.getMessage(e,t),stack:this.getStack(e),cause:e.cause?t.next(e.cause):void 0,synthetic:!1}}getType(e){return e.name||e.constructor.name}getMessage(e,t){var i=e.message;return i.error&&"string"==typeof i.error.message?String(i.error.message):String(i)}getStack(e){return e.stacktrace||e.stack||void 0}}class ye{constructor(){}match(e){return z(e,"ErrorEvent")&&null!=e.error}coerce(e,t){var i;return t.apply(e.error)||{type:"ErrorEvent",value:e.message,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}var be=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class we{match(e){return"string"==typeof e}coerce(e,t){var i,[r,s]=this.getInfos(e);return{type:null!=r?r:"Error",value:null!=s?s:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,r=e.match(be);return r&&(t=r[1],i=r[2]),[t,i]}}var Ee=["fatal","error","warning","log","info","debug"];function Se(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var r=i.length;r>0;r--){var s=i.slice(0,r).join(", ");if(!(s.length>t))return r===i.length||s.length<=t?s:s.slice(0,t)+"..."}return""}class xe{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null==(i=t.syntheticException)?void 0:i.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return Y(e)?e.constructor.name:"Error"}getValue(e){if("name"in e&&"string"==typeof e.name){var t="'"+e.name+"' captured as exception";return"message"in e&&"string"==typeof e.message&&(t+=" with message: '"+e.message+"'"),t}if("message"in e&&"string"==typeof e.message)return e.message;var i=this.getObjectClassName(e);return(i&&"Object"!==i?"'"+i+"'":"Object")+" captured as exception with keys: "+Se(e)}isSeverityLevel(e){return j(e)&&!U(e)&&Ee.indexOf(e)>=0}getErrorPropertyFromObject(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t)){var i=e[t];if(re(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(i){return}}}class ke{match(e){return Y(e)}coerce(e,t){var i,r=e.constructor.name;return{type:r,value:r+" captured as exception with keys: "+Se(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Ie{match(e){return V(e)}coerce(e,t){var i;return{type:"Error",value:"Primitive value captured as exception: "+String(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class Pe{match(e){return z(e,"PromiseRejectionEvent")}coerce(e,t){var i,r=this.getUnhandledRejectionReason(e);return V(r)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(r),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(r)}getUnhandledRejectionReason(e){if(V(e))return e;try{if("reason"in e)return e.reason;if("detail"in e&&"reason"in e.detail)return e.detail.reason}catch(t){}return e}}var Te=e=>{var t={k:function(t){if(o&&(y.DEBUG||m.POSTHOG_DEBUG)&&!L(o.console)&&o.console){for(var i=("__rrweb_original__"in o.console[t]?o.console[t].__rrweb_original__:o.console[t]),r=arguments.length,s=new Array(r>1?r-1:0),n=1;n<r;n++)s[n-1]=arguments[n];i(e,...s)}},info:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.k("log",...i)},warn:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.k("warn",...i)},error:function(){for(var e=arguments.length,i=new Array(e),r=0;r<e;r++)i[r]=arguments[r];t.k("error",...i)},critical:function(){for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];console.error(e,...i)},uninitializedWarning:e=>{t.error("You must initialize PostHog before calling "+e)},createLogger:t=>Te(e+" "+t)};return t},$e=Te("[PostHog.js]"),Oe=$e.createLogger,Fe=Oe("[ExternalScriptsLoader]"),Ce=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return Fe.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var r=null==d?void 0:d.querySelectorAll("script");if(r)for(var s,n=function(){if(r[o].src===t){var e=r[o];return e.__posthog_loading_callback_fired?{v:i()}:(e.addEventListener("load",t=>{e.__posthog_loading_callback_fired=!0,i(void 0,t)}),e.onerror=e=>i(e),{v:void 0})}},o=0;o<r.length;o++)if(s=n())return s.v;var a=()=>{if(!d)return i("document not found");var r=d.createElement("script");if(r.type="text/javascript",r.crossOrigin="anonymous",r.src=t,r.onload=e=>{r.__posthog_loading_callback_fired=!0,i(void 0,e)},r.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(r=e.config.prepare_external_dependency_script(r)),!r)return i("prepare_external_dependency_script returned null");var s,n=d.querySelectorAll("body > script");n.length>0?null==(s=n[0].parentNode)||s.insertBefore(r,n[0]):d.body.appendChild(r)};null!=d&&d.body?a():null==d||d.addEventListener("DOMContentLoaded",a)};m.__PosthogExtensions__=m.__PosthogExtensions__||{},m.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{var r="/static/"+t+".js?v="+e.version;if("remote-config"===t&&(r="/array/"+e.config.token+"/config.js"),"toolbar"===t){var s=3e5;r=r+"&t="+Math.floor(Date.now()/s)*s}var n=e.requestRouter.endpointFor("assets",r);Ce(e,n,i)},m.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var r=e.requestRouter.endpointFor("api",t);Ce(e,r,i)};var Re={};function Ae(e,t,i){if(A(e))if(c&&e.forEach===c)e.forEach(t,i);else if("length"in e&&e.length===+e.length)for(var r=0,s=e.length;r<s;r++)if(r in e&&t.call(i,e[r],r)===Re)return}function De(e,t,i){if(!q(e)){if(A(e))return Ae(e,t,i);if((e=>e instanceof FormData)(e)){for(var r of e.entries())if(t.call(i,r[1],r[0])===Re)return}else for(var s in e)if(C.call(e,s)&&t.call(i,e[s],s)===Re)return}}var Me=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Ae(i,function(t){for(var i in t)void 0!==t[i]&&(e[i]=t[i])}),e},Ne=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];return Ae(i,function(t){Ae(t,function(t){e.push(t)})}),e};function Le(e){for(var t=Object.keys(e),i=t.length,r=new Array(i);i--;)r[i]=[t[i],e[t[i]]];return r}var je=function(e){try{return e()}catch(t){return}},Ue=function(e){return function(){try{for(var t=arguments.length,i=new Array(t),r=0;r<t;r++)i[r]=arguments[r];return e.apply(this,i)}catch(s){$e.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),$e.critical(s)}}},He=function(e){var t={};return De(e,function(e,i){(j(e)&&e.length>0||B(e))&&(t[i]=e)}),t},qe=["herokuapp.com","vercel.app","netlify.app"];function Be(e){var t=null==e?void 0:e.hostname;if(!j(t))return!1;var i=t.split(".").slice(-2).join(".");for(var r of qe)if(i===r)return!1;return!0}function Ge(e,t){for(var i=0;i<e.length;i++)if(t(e[i]))return e[i]}function We(e,t,i,r){var{capture:s=!1,passive:n=!0}=null!=r?r:{};null==e||e.addEventListener(t,i,{capture:s,passive:n})}var Ve="$people_distinct_id",ze="__alias",Ye="__timers",Xe="$autocapture_disabled_server_side",Je="$heatmaps_enabled_server_side",Ke="$exception_capture_enabled_server_side",Ze="$error_tracking_suppression_rules",Qe="$error_tracking_capture_extension_exceptions",et="$web_vitals_enabled_server_side",tt="$dead_clicks_enabled_server_side",it="$web_vitals_allowed_metrics",rt="$session_recording_remote_config",st="$sesid",nt="$session_is_sampled",ot="$enabled_feature_flags",at="$early_access_features",lt="$feature_flag_details",ct="$stored_person_properties",ut="$stored_group_properties",ht="$surveys",dt="$surveys_activated",pt="$flag_call_reported",gt="$user_state",_t="$client_session_props",vt="$capture_rate_limit",ft="$initial_campaign_params",mt="$initial_referrer_info",yt="$initial_person_info",bt="$epp",wt="__POSTHOG_TOOLBAR__",Et="$posthog_cookieless",St=[Ve,ze,"__cmpns",Ye,"$session_recording_enabled_server_side",Je,st,ot,Ze,gt,at,lt,ut,ct,ht,pt,_t,vt,ft,mt,bt,yt];function xt(e){return e instanceof Element&&(e.id===wt||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function kt(e){return!!e&&1===e.nodeType}function It(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function Pt(e){return!!e&&3===e.nodeType}function Tt(e){return!!e&&11===e.nodeType}function $t(e){return e?T(e).split(/\s+/):[]}function Ot(e){var t=null==o?void 0:o.location.href;return!!(t&&e&&e.some(e=>t.match(e)))}function Ft(e){var t="";switch(typeof e.className){case"string":t=e.className;break;case"object":t=(e.className&&"baseVal"in e.className?e.className.baseVal:null)||e.getAttribute("class")||"";break;default:t=""}return $t(t)}function Ct(e){return q(e)?null:T(e).split(/(\s+)/).filter(e=>Xt(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function Rt(e){var t="";return Ht(e)&&!qt(e)&&e.childNodes&&e.childNodes.length&&De(e.childNodes,function(e){var i;Pt(e)&&e.textContent&&(t+=null!==(i=Ct(e.textContent))&&void 0!==i?i:"")}),T(t)}function At(e){return L(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null;var t}var Dt=["a","button","form","input","select","textarea","label"];function Mt(e,t){if(L(t))return!0;var i,r=function(e){if(t.some(t=>e.matches(t)))return{v:!0}};for(var s of e)if(i=r(s))return i.v;return!1}function Nt(e){var t=e.parentNode;return!(!t||!kt(t))&&t}var Lt=[".ph-no-rageclick",".ph-no-capture"],jt=e=>!e||It(e,"html")||!kt(e),Ut=(e,t)=>{if(!o||jt(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,r=[e],s=e;s.parentNode&&!It(s,"body");)if(Tt(s.parentNode))r.push(s.parentNode.host),s=s.parentNode.host;else{var n=Nt(s);if(!n)break;if(t||Dt.indexOf(n.tagName.toLowerCase())>-1)i=!0;else{var a=o.getComputedStyle(n);a&&"pointer"===a.getPropertyValue("cursor")&&(i=!0)}r.push(n),s=n}return{parentIsUsefulElement:i,targetElementList:r}};function Ht(e){for(var t=e;t.parentNode&&!It(t,"body");t=t.parentNode){var i=Ft(t);if(P(i,"ph-sensitive")||P(i,"ph-no-capture"))return!1}if(P(Ft(e),"ph-include"))return!0;var r=e.type||"";if(j(r))switch(r.toLowerCase()){case"hidden":case"password":return!1}var s=e.name||e.id||"";return!j(s)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(s.replace(/[^a-zA-Z0-9]/g,""))}function qt(e){return!!(It(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||It(e,"select")||It(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var Bt="(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})",Gt=new RegExp("^(?:"+Bt+")$"),Wt=new RegExp(Bt),Vt="\\d{3}-?\\d{2}-?\\d{4}",zt=new RegExp("^("+Vt+")$"),Yt=new RegExp("("+Vt+")");function Xt(e,t){if(void 0===t&&(t=!0),q(e))return!1;if(j(e)){if(e=T(e),(t?Gt:Wt).test((e||"").replace(/[- ]/g,"")))return!1;if((t?zt:Yt).test(e))return!1}return!0}function Jt(e){var t=Rt(e);return Xt(t=(t+" "+Kt(e)).trim())?t:""}function Kt(e){var t="";return e&&e.childNodes&&e.childNodes.length&&De(e.childNodes,function(e){var i;if(e&&"span"===(null==(i=e.tagName)?void 0:i.toLowerCase()))try{var r=Rt(e);t=(t+" "+r).trim(),e.childNodes&&e.childNodes.length&&(t=(t+" "+Kt(e)).trim())}catch(s){$e.error("[AutoCapture]",s)}}),t}function Zt(e){return e.map(e=>{var t,i,r={text:null==(t=e.$el_text)?void 0:t.slice(0,400),tag_name:e.tag_name,href:null==(i=e.attr__href)?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 Le(e).filter(e=>{var[t]=e;return 0===t.indexOf("attr__")}).forEach(e=>{var[t,i]=e;return r.attributes[t]=i}),r}).map(e=>{var t,i,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 n=E({},e.text?{text:e.text}:{},{"nth-child":null!==(t=e.nth_child)&&void 0!==t?t:0,"nth-of-type":null!==(i=e.nth_of_type)&&void 0!==i?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),o={};return Le(n).sort((e,t)=>{var[i]=e,[r]=t;return i.localeCompare(r)}).forEach(e=>{var[t,i]=e;return o[Qt(t.toString())]=Qt(i.toString())}),(r+=":")+Le(o).map(e=>{var[t,i]=e;return t+'="'+i+'"'}).join("")}).join(";")}function Qt(e){return e.replace(/"|\\"/g,'\\"')}function ei(e){var t=e.attr__class;return t?A(t)?t:$t(t):void 0}class ti{constructor(){this.clicks=[]}isRageClick(e,t,i){var r=this.clicks[this.clicks.length-1];if(r&&Math.abs(e-r.x)+Math.abs(t-r.y)<30&&i-r.timestamp<1e3){if(this.clicks.push({x:e,y:t,timestamp:i}),3===this.clicks.length)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var ii,ri="$copy_autocapture",si=((ii={}).GZipJS="gzip-js",ii.Base64="base64",ii),ni=e=>{var t=null==d?void 0:d.createElement("a");return L(t)?null:(t.href=e,t)},oi=function(e,t){for(var i,r=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),s=0;s<r.length;s++){var n=r[s].split("=");if(n[0]===t){i=n;break}}if(!A(i)||i.length<2)return"";var o=i[1];try{o=decodeURIComponent(o)}catch(a){$e.error("Skipping decoding for malformed query param: "+o)}return o.replace(/\+/g," ")},ai=function(e,t,i){if(!e||!t||!t.length)return e;for(var r=e.split("#"),s=r[0]||"",n=r[1],o=s.split("?"),a=o[1],l=o[0],c=(a||"").split("&"),u=[],h=0;h<c.length;h++){var d=c[h].split("=");A(d)&&(t.includes(d[0])?u.push(d[0]+"="+i):u.push(c[h]))}var p=l;return null!=a&&(p+="?"+u.join("&")),null!=n&&(p+="#"+n),p},li=function(e,t){var i=e.match(new RegExp(t+"=([^&]*)"));return i?i[1]:null},ci=Oe("[AutoCapture]");function ui(e,t){return t.length>e?t.slice(0,e)+"...":t}function hi(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do{t=t.previousSibling}while(t&&!kt(t));return t}class di{constructor(e){this.P=!1,this.T=null,this.rageclicks=new ti,this.R=!1,this.instance=e,this.I=null}get C(){var e,t,i=M(this.instance.config.autocapture)?this.instance.config.autocapture:{};return i.url_allowlist=null==(e=i.url_allowlist)?void 0:e.map(e=>new RegExp(e)),i.url_ignorelist=null==(t=i.url_ignorelist)?void 0:t.map(e=>new RegExp(e)),i}O(){if(this.isBrowserSupported()){if(o&&d){var e=e=>{e=e||(null==o?void 0:o.event);try{this.F(e)}catch(ii){ci.error("Failed to capture event",ii)}};if(We(d,"submit",e,{capture:!0}),We(d,"change",e,{capture:!0}),We(d,"click",e,{capture:!0}),this.C.capture_copied_text){var t=e=>{e=e||(null==o?void 0:o.event),this.F(e,ri)};We(d,"copy",t,{capture:!0}),We(d,"cut",t,{capture:!0})}}}else ci.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.P&&(this.O(),this.P=!0)}onRemoteConfig(e){e.elementsChainAsString&&(this.R=e.elementsChainAsString),this.instance.persistence&&this.instance.persistence.register({[Xe]:!!e.autocapture_opt_out}),this.T=!!e.autocapture_opt_out,this.startIfEnabled()}setElementSelectors(e){this.I=e}getElementSelectors(e){var t,i=[];return null==(t=this.I)||t.forEach(t=>{var r=null==d?void 0:d.querySelectorAll(t);null==r||r.forEach(r=>{e===r&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[Xe],r=this.T;if(H(r)&&!G(i)&&!this.instance.M())return!1;var s=null!==(t=this.T)&&void 0!==t?t:!!i;return!!this.instance.config.autocapture&&!s}F(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,r=At(e);Pt(r)&&(r=r.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&function(e,t){if(!o||jt(e))return!1;var i,r;if(!1===(i=G(t)?!!t&&Lt:null!==(r=null==t?void 0:t.css_selector_ignorelist)&&void 0!==r?r:Lt))return!1;var{targetElementList:s}=Ut(e,!1);return!Mt(s,i)}(r,this.instance.config.rageclick)&&this.F(e,"$rageclick");var s=t===ri;if(r&&function(e,t,i,r,s){var n,a,l,c;if(void 0===i&&(i=void 0),!o||jt(e))return!1;if(null!=(n=i)&&n.url_allowlist&&!Ot(i.url_allowlist))return!1;if(null!=(a=i)&&a.url_ignorelist&&Ot(i.url_ignorelist))return!1;if(null!=(l=i)&&l.dom_event_allowlist){var u=i.dom_event_allowlist;if(u&&!u.some(e=>t.type===e))return!1}var{parentIsUsefulElement:h,targetElementList:d}=Ut(e,r);if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(L(i))return!0;var r,s=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(r=s(n))return r.v;return!1}(d,i))return!1;if(!Mt(d,null==(c=i)?void 0:c.css_selector_allowlist))return!1;var p=o.getComputedStyle(e);if(p&&"pointer"===p.getPropertyValue("cursor")&&"click"===t.type)return!0;var g=e.tagName.toLowerCase();switch(g){case"html":return!1;case"form":return(s||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(s||["change","click"]).indexOf(t.type)>=0;default:return h?(s||["click"]).indexOf(t.type)>=0:(s||["click"]).indexOf(t.type)>=0&&(Dt.indexOf(g)>-1||"true"===e.getAttribute("contenteditable"))}}(r,e,this.C,s,s?["copy","cut"]:void 0)){var{props:n,explicitNoCapture:a}=function(e,t){for(var i,r,{e:s,maskAllElementAttributes:n,maskAllText:a,elementAttributeIgnoreList:l,elementsChainAsString:c}=t,u=[e],h=e;h.parentNode&&!It(h,"body");)Tt(h.parentNode)?(u.push(h.parentNode.host),h=h.parentNode.host):(u.push(h.parentNode),h=h.parentNode);var d,p=[],g={},_=!1,v=!1;if(De(u,e=>{var t=Ht(e);"a"===e.tagName.toLowerCase()&&(_=e.getAttribute("href"),_=t&&_&&Xt(_)&&_),P(Ft(e),"ph-no-capture")&&(v=!0),p.push(function(e,t,i,r){var s=e.tagName.toLowerCase(),n={tag_name:s};Dt.indexOf(s)>-1&&!i&&("a"===s.toLowerCase()||"button"===s.toLowerCase()?n.$el_text=ui(1024,Jt(e)):n.$el_text=ui(1024,Rt(e)));var o=Ft(e);o.length>0&&(n.classes=o.filter(function(e){return""!==e})),De(e.attributes,function(i){var s;if((!qt(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==r||!r.includes(i.name))&&!t&&Xt(i.value)&&(s=i.name,!j(s)||"_ngcontent"!==s.substring(0,10)&&"_nghost"!==s.substring(0,7))){var o=i.value;"class"===i.name&&(o=$t(o).join(" ")),n["attr__"+i.name]=ui(1024,o)}});for(var a=1,l=1,c=e;c=hi(c);)a++,c.tagName===e.tagName&&l++;return n.nth_child=a,n.nth_of_type=l,n}(e,n,a,l));var i=function(e){if(!Ht(e))return{};var t={};return De(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),r=e.value;i&&r&&Xt(r)&&(t[i]=r)}}),t}(e);Me(g,i)}),v)return{props:{},explicitNoCapture:v};if(a||("a"===e.tagName.toLowerCase()||"button"===e.tagName.toLowerCase()?p[0].$el_text=Jt(e):p[0].$el_text=Rt(e)),_){var f,m;p[0].attr__href=_;var y=null==(f=ni(_))?void 0:f.host,b=null==o||null==(m=o.location)?void 0:m.host;y&&b&&y!==b&&(d=_)}return{props:Me({$event_type:s.type,$ce_version:1},c?{}:{$elements:p},{$elements_chain:Zt(p)},null!=(i=p[0])&&i.$el_text?{$el_text:null==(r=p[0])?void 0:r.$el_text}:{},d&&"click"===s.type?{$external_click_url:d}:{},g)}}(r,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.C.element_attribute_ignorelist,elementsChainAsString:this.R});if(a)return!1;var l=this.getElementSelectors(r);if(l&&l.length>0&&(n.$element_selectors=l),t===ri){var c,u=Ct(null==o||null==(c=o.getSelection())?void 0:c.toString()),h=e.type||"clipboard";if(!u)return!1;n.$selected_content=u,n.$copy_type=h}return this.instance.capture(t,n),!0}}}isBrowserSupported(){return D(null==d?void 0:d.querySelectorAll)}}Math.trunc||(Math.trunc=function(e){return e<0?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return B(e)&&isFinite(e)&&Math.floor(e)===e});var pi="0123456789abcdef";class gi{constructor(e){if(this.bytes=e,16!==e.length)throw new TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,r){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(r)||e<0||t<0||i<0||r<0||e>0xffffffffffff||t>4095||i>1073741823||r>4294967295)throw new RangeError("invalid field value");var s=new Uint8Array(16);return s[0]=e/Math.pow(2,40),s[1]=e/Math.pow(2,32),s[2]=e/Math.pow(2,24),s[3]=e/Math.pow(2,16),s[4]=e/Math.pow(2,8),s[5]=e,s[6]=112|t>>>8,s[7]=t,s[8]=128|i>>>24,s[9]=i>>>16,s[10]=i>>>8,s[11]=i,s[12]=r>>>24,s[13]=r>>>16,s[14]=r>>>8,s[15]=r,new gi(s)}toString(){for(var e="",t=0;t<this.bytes.length;t++)e=e+pi.charAt(this.bytes[t]>>>4)+pi.charAt(15&this.bytes[t]),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw new Error("Invalid UUIDv7 was generated");return e}clone(){return new gi(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;t<16;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class _i{constructor(){this.A=0,this.D=0,this.j=new mi}generate(){var e=this.generateOrAbort();if(L(e)){this.A=0;var t=this.generateOrAbort();if(L(t))throw new Error("Could not generate UUID after timestamp reset");return t}return e}generateOrAbort(){var e=Date.now();if(e>this.A)this.A=e,this.L();else{if(!(e+1e4>this.A))return;this.D++,this.D>4398046511103&&(this.A++,this.L())}return gi.fromFieldsV7(this.A,Math.trunc(this.D/Math.pow(2,30)),this.D&Math.pow(2,30)-1,this.j.nextUint32())}L(){this.D=1024*this.j.nextUint32()+(1023&this.j.nextUint32())}}var vi,fi=e=>{if("undefined"!=typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw new Error("no cryptographically strong RNG available");for(var t=0;t<e.length;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};o&&!L(o.crypto)&&crypto.getRandomValues&&(fi=e=>crypto.getRandomValues(e));class mi{constructor(){this.N=new Uint32Array(8),this.U=1/0}nextUint32(){return this.U>=this.N.length&&(fi(this.N),this.U=0),this.N[this.U++]}}var yi=()=>bi().toString(),bi=()=>(vi||(vi=new _i)).generate(),wi="",Ei=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,Si={H:()=>!!d,B:function(e){$e.error("cookieStore error: "+e)},q:function(e){if(d){try{for(var t=e+"=",i=d.cookie.split(";").filter(e=>e.length),r=0;r<i.length;r++){for(var s=i[r];" "==s.charAt(0);)s=s.substring(1,s.length);if(0===s.indexOf(t))return decodeURIComponent(s.substring(t.length,s.length))}}catch(n){}return null}},W:function(e){var t;try{t=JSON.parse(Si.q(e))||{}}catch(i){}return t},G:function(e,t,i,r,s){if(d)try{var n="",o="",a=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=d),wi)return wi;if(!t)return"";if(["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),r=Math.min(i.length,8),s="dmn_chk_"+yi();!wi&&r--;){var n=i.slice(r).join("."),o=s+"=1;domain=."+n+";path=/";t.cookie=o+";max-age=3",t.cookie.includes(s)&&(t.cookie=o+";max-age=0",wi=n)}return wi}(e);if(!i){var r=(s=e.match(Ei))?s[0]:"";r!==i&&$e.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}var s;return""}(d.location.hostname,r);if(i){var l=new Date;l.setTime(l.getTime()+24*i*60*60*1e3),n="; expires="+l.toUTCString()}s&&(o="; secure");var c=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+a+o;return c.length>3686.4&&$e.warn("cookieStore warning: large cookie, len="+c.length),d.cookie=c,c}catch(u){return}},V:function(e,t){if(null!=d&&d.cookie)try{Si.G(e,"",-1,t)}catch(i){return}}},xi=null,ki={H:function(){if(!H(xi))return xi;var e=!0;if(L(o))e=!1;else try{var t="__mplssupport__";ki.G(t,"xyz"),'"xyz"'!==ki.q(t)&&(e=!1),ki.V(t)}catch(ii){e=!1}return e||$e.error("localStorage unsupported; falling back to cookie store"),xi=e,e},B:function(e){$e.error("localStorage error: "+e)},q:function(e){try{return null==o?void 0:o.localStorage.getItem(e)}catch(ii){ki.B(ii)}return null},W:function(e){try{return JSON.parse(ki.q(e))||{}}catch(t){}return null},G:function(e,t){try{null==o||o.localStorage.setItem(e,JSON.stringify(t))}catch(ii){ki.B(ii)}},V:function(e){try{null==o||o.localStorage.removeItem(e)}catch(ii){ki.B(ii)}}},Ii=["distinct_id",st,nt,bt,yt],Pi=E({},ki,{W:function(e){try{var t={};try{t=Si.W(e)||{}}catch(r){}var i=Me(t,JSON.parse(ki.q(e)||"{}"));return ki.G(e,i),i}catch(r){}return null},G:function(e,t,i,r,s,n){try{ki.G(e,t,void 0,void 0,n);var o={};Ii.forEach(e=>{t[e]&&(o[e]=t[e])}),Object.keys(o).length&&Si.G(e,o,i,r,s,n)}catch(a){ki.B(a)}},V:function(e,t){try{null==o||o.localStorage.removeItem(e),Si.V(e,t)}catch(ii){ki.B(ii)}}}),Ti={},$i={H:function(){return!0},B:function(e){$e.error("memoryStorage error: "+e)},q:function(e){return Ti[e]||null},W:function(e){return Ti[e]||null},G:function(e,t){Ti[e]=t},V:function(e){delete Ti[e]}},Oi=null,Fi={H:function(){if(!H(Oi))return Oi;if(Oi=!0,L(o))Oi=!1;else try{var e="__support__";Fi.G(e,"xyz"),'"xyz"'!==Fi.q(e)&&(Oi=!1),Fi.V(e)}catch(ii){Oi=!1}return Oi},B:function(e){$e.error("sessionStorage error: ",e)},q:function(e){try{return null==o?void 0:o.sessionStorage.getItem(e)}catch(ii){Fi.B(ii)}return null},W:function(e){try{return JSON.parse(Fi.q(e))||null}catch(t){}return null},G:function(e,t){try{null==o||o.sessionStorage.setItem(e,JSON.stringify(t))}catch(ii){Fi.B(ii)}},V:function(e){try{null==o||o.sessionStorage.removeItem(e)}catch(ii){Fi.B(ii)}}},Ci=function(e){return e[e.PENDING=-1]="PENDING",e[e.DENIED=0]="DENIED",e[e.GRANTED=1]="GRANTED",e}({});class Ri{constructor(e){this._instance=e}get C(){return this._instance.config}get consent(){return this.J()?Ci.DENIED:this.K}isOptedOut(){return"always"===this.C.cookieless_mode||this.consent===Ci.DENIED||this.consent===Ci.PENDING&&(this.C.opt_out_capturing_by_default||"on_reject"===this.C.cookieless_mode)}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return this.consent===Ci.DENIED}optInOut(e){this.Y.G(this.X,e?1:0,this.C.cookie_expiration,this.C.cross_subdomain_cookie,this.C.secure_cookie)}reset(){this.Y.V(this.X,this.C.cross_subdomain_cookie)}get X(){var{token:e,opt_out_capturing_cookie_prefix:t,consent_persistence_name:i}=this._instance.config;return i||(t?t+e:"__ph_opt_in_out_"+e)}get K(){var e=this.Y.q(this.X);return J(e)?Ci.GRANTED:P(K,e)?Ci.DENIED:Ci.PENDING}get Y(){if(!this.Z){var e=this.C.opt_out_capturing_persistence_type;this.Z="localStorage"===e?ki:Si;var t="localStorage"===e?Si:ki;t.q(this.X)&&(this.Z.q(this.X)||this.optInOut(J(t.q(this.X))),t.V(this.X,this.C.cross_subdomain_cookie))}return this.Z}J(){return!!this.C.respect_dnt&&!!Ge([null==h?void 0:h.doNotTrack,null==h?void 0:h.msDoNotTrack,m.doNotTrack],e=>J(e))}}var Ai=Oe("[Dead Clicks]"),Di=()=>!0,Mi=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(tt)),r=e.instance.config.capture_dead_clicks;return G(r)?r:i};class Ni{get lazyLoadedDeadClicksAutocapture(){return this.tt}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabled()}onRemoteConfig(e){this.instance.persistence&&this.instance.persistence.register({[tt]:null==e?void 0:e.captureDeadClicks}),this.startIfEnabled()}startIfEnabled(){this.isEnabled(this)&&this.it(()=>{this.et()})}it(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.initDeadClicksAutocapture&&e(),null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this.instance,"dead-clicks-autocapture",t=>{t?Ai.error("failed to load script",t):e()})}et(){var e;if(d){if(!this.tt&&null!=(e=m.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=M(this.instance.config.capture_dead_clicks)?this.instance.config.capture_dead_clicks:{};t.__onCapture=this.onCapture,this.tt=m.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.tt.start(d),Ai.info("starting...")}}else Ai.error("`document` not found. Cannot start.")}stop(){this.tt&&(this.tt.stop(),this.tt=void 0,Ai.info("stopping..."))}}var Li=Oe("[ExceptionAutocapture]");class ji{constructor(e){var t,i,r;this.rt=()=>{var e;if(o&&this.isEnabled&&null!=(e=m.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=m.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=m.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,r=m.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.st&&this.C.capture_unhandled_errors&&(this.st=t(this.captureException.bind(this))),!this.nt&&this.C.capture_unhandled_rejections&&(this.nt=i(this.captureException.bind(this))),!this.ot&&this.C.capture_console_errors&&(this.ot=r(this.captureException.bind(this)))}catch(ii){Li.error("failed to start",ii),this.lt()}}},this._instance=e,this.ut=!(null==(t=this._instance.persistence)||!t.props[Ke]),this.C=this.ht(),this.dt=new Q({refillRate:null!==(i=this._instance.config.error_tracking.__exceptionRateLimiterRefillRate)&&void 0!==i?i:1,bucketSize:null!==(r=this._instance.config.error_tracking.__exceptionRateLimiterBucketSize)&&void 0!==r?r:10,refillInterval:1e4,h:Li}),this.startIfEnabled()}ht(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return M(e)?t=E({},t,e):(L(e)?this.ut:e)&&(t=E({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.C.capture_console_errors||this.C.capture_unhandled_errors||this.C.capture_unhandled_rejections}startIfEnabled(){this.isEnabled&&(Li.info("enabled"),this.it(this.rt))}it(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.errorWrappingFunctions&&e(),null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"exception-autocapture",t=>{if(t)return Li.error("failed to load script",t);e()})}lt(){var e,t,i;null==(e=this.st)||e.call(this),this.st=void 0,null==(t=this.nt)||t.call(this),this.nt=void 0,null==(i=this.ot)||i.call(this),this.ot=void 0}onRemoteConfig(e){var t=e.autocaptureExceptions;this.ut=!!t||!1,this.C=this.ht(),this._instance.persistence&&this._instance.persistence.register({[Ke]:this.ut}),this.startIfEnabled()}captureException(e){var t,i,r=null!==(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)&&void 0!==t?t:"Exception";this.dt.consumeRateLimit(r)?Li.info("Skipping exception capture because of client rate limiting.",{exception:r}):this._instance.exceptions.sendExceptionEvent(e)}}function Ui(e,t,i){try{if(!(t in e))return()=>{};var r=e[t],s=i(r);return D(s)&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__posthog_wrapped__:{enumerable:!1,value:!0}})),e[t]=s,()=>{e[t]=r}}catch(n){return()=>{}}}class Hi{constructor(e){var t;this._instance=e,this.vt=(null==o||null==(t=o.location)?void 0:t.pathname)||""}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&($e.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.ct&&this.ct(),this.ct=void 0,$e.info("History API monitoring stopped")}monitorHistoryChanges(){var e,t;if(o&&o.history){var i=this;null!=(e=o.history.pushState)&&e.__posthog_wrapped__||Ui(o.history,"pushState",e=>function(t,r,s){e.call(this,t,r,s),i.ft("pushState")}),null!=(t=o.history.replaceState)&&t.__posthog_wrapped__||Ui(o.history,"replaceState",e=>function(t,r,s){e.call(this,t,r,s),i.ft("replaceState")}),this.gt()}}ft(e){try{var t,i=null==o||null==(t=o.location)?void 0:t.pathname;if(!i)return;i!==this.vt&&this.isEnabled&&this._instance.capture("$pageview",{navigation_type:e}),this.vt=i}catch(ii){$e.error("Error capturing "+e+" pageview",ii)}}gt(){if(!this.ct){var e=()=>{this.ft("popstate")};We(o,"popstate",e),this.ct=()=>{o&&o.removeEventListener("popstate",e)}}}}var qi=Oe("[SegmentIntegration]"),Bi="posthog-js";function Gi(e,t){var{organization:i,projectId:r,prefix:s,severityAllowList:n=["error"],sendExceptionsToPostHog:o=!0}=void 0===t?{}:t;return t=>{var a,l,c,u,h;if("*"!==n&&!n.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var d=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=d,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var p=(null==(a=t.exception)?void 0:a.values)||[],g=p.map(e=>E({},e,{stacktrace:e.stacktrace?E({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>E({},e,{platform:"web:javascript"}))}):void 0})),_={$exception_message:(null==(l=p[0])?void 0:l.value)||t.message,$exception_type:null==(c=p[0])?void 0:c.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(u=p[0])?void 0:u.value)||t.message,$sentry_exception_type:null==(h=p[0])?void 0:h.type,$sentry_tags:t.tags};return i&&r&&(_.$sentry_url=(s||"https://sentry.io/organizations/")+i+"/issues/?project="+r+"&query="+t.event_id),o&&e.exceptions.sendExceptionEvent(_),t}}class Wi{constructor(e,t,i,r,s,n){this.name=Bi,this.setupOnce=function(o){o(Gi(e,{organization:t,projectId:i,prefix:r,severityAllowList:s,sendExceptionsToPostHog:null==n||n}))}}}var Vi=null!=o&&o.location?li(o.location.hash,"__posthog")||li(location.hash,"state"):null,zi="_postHogToolbarParams",Yi=Oe("[Toolbar]"),Xi=function(e){return e[e.UNINITIALIZED=0]="UNINITIALIZED",e[e.LOADING=1]="LOADING",e[e.LOADED=2]="LOADED",e}(Xi||{});class Ji{constructor(e){this.instance=e}_t(e){m.ph_toolbar_state=e}yt(){var e;return null!==(e=m.ph_toolbar_state)&&void 0!==e?e:Xi.UNINITIALIZED}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),!o||!d)return!1;e=null!=e?e:o.location,i=null!=i?i:o.history;try{if(!t){try{o.localStorage.setItem("test","test"),o.localStorage.removeItem("test")}catch(ii){return!1}t=null==o?void 0:o.localStorage}var r,s=Vi||li(e.hash,"__posthog")||li(e.hash,"state"),n=s?je(()=>JSON.parse(atob(decodeURIComponent(s))))||je(()=>JSON.parse(decodeURIComponent(s))):null;return n&&"ph_authorize"===n.action?((r=n).source="url",r&&Object.keys(r).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((r=JSON.parse(t.getItem(zi)||"{}")).source="localstorage",delete r.userIntent),!(!r.token||this.instance.config.token!==r.token||(this.loadToolbar(r),0))}catch(ii){return!1}}bt(e){var t=m.ph_load_toolbar||m.ph_load_editor;!q(t)&&D(t)?t(e,this.instance):Yi.warn("No toolbar load function found")}loadToolbar(e){var t=!(null==d||!d.getElementById(wt));if(!o||t)return!1;var i="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=E({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},i?{instrument:!1}:{});if(o.localStorage.setItem(zi,JSON.stringify(E({},r,{source:void 0}))),this.yt()===Xi.LOADED)this.bt(r);else if(this.yt()===Xi.UNINITIALIZED){var s;this._t(Xi.LOADING),null==(s=m.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this.instance,"toolbar",e=>{if(e)return Yi.error("[Toolbar] Failed to load",e),void this._t(Xi.UNINITIALIZED);this._t(Xi.LOADED),this.bt(r)}),We(o,"turbolinks:load",()=>{this._t(Xi.UNINITIALIZED),this.loadToolbar(r)})}return!0}wt(e){return this.loadToolbar(e)}maybeLoadEditor(e,t,i){return void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),this.maybeLoadToolbar(e,t,i)}}var Ki=Oe("[TracingHeaders]");class Zi{constructor(e){this.xt=void 0,this.St=void 0,this.rt=()=>{var e,t;L(this.xt)&&(null==(e=m.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)||e._patchXHR(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager)),L(this.St)&&(null==(t=m.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)||t._patchFetch(this._instance.config.__add_tracing_headers||[],this._instance.get_distinct_id(),this._instance.sessionManager))},this._instance=e}it(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.tracingHeadersPatchFns&&e(),null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"tracing-headers",t=>{if(t)return Ki.error("failed to load script",t);e()})}startIfEnabledOrStop(){var e,t;this._instance.config.__add_tracing_headers?this.it(this.rt):(null==(e=this.xt)||e.call(this),null==(t=this.St)||t.call(this),this.xt=void 0,this.St=void 0)}}var Qi="Mobile",er="iOS",tr="Android",ir="Tablet",rr=tr+" "+ir,sr="iPad",nr="Apple",or=nr+" Watch",ar="Safari",lr="BlackBerry",cr="Samsung",ur=cr+"Browser",hr=cr+" Internet",dr="Chrome",pr=dr+" OS",gr=dr+" "+er,_r="Internet Explorer",vr=_r+" "+Qi,fr="Opera",mr=fr+" Mini",yr="Edge",br="Microsoft "+yr,wr="Firefox",Er=wr+" "+er,Sr="Nintendo",xr="PlayStation",kr="Xbox",Ir=tr+" "+Qi,Pr=Qi+" "+ar,Tr="Windows",$r=Tr+" Phone",Or="Nokia",Fr="Ouya",Cr="Generic",Rr=Cr+" "+Qi.toLowerCase(),Ar=Cr+" "+ir.toLowerCase(),Dr="Konqueror",Mr="(\\d+(\\.\\d+)?)",Nr=new RegExp("Version/"+Mr),Lr=new RegExp(kr,"i"),jr=new RegExp(xr+" \\w+","i"),Ur=new RegExp(Sr+" \\w+","i"),Hr=new RegExp(lr+"|PlayBook|BB10","i"),qr={"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"},Br=function(e,t){return t=t||"",P(e," OPR/")&&P(e,"Mini")?mr:P(e," OPR/")?fr:Hr.test(e)?lr:P(e,"IE"+Qi)||P(e,"WPDesktop")?vr:P(e,ur)?hr:P(e,yr)||P(e,"Edg/")?br:P(e,"FBIOS")?"Facebook "+Qi:P(e,"UCWEB")||P(e,"UCBrowser")?"UC Browser":P(e,"CriOS")?gr:P(e,"CrMo")||P(e,dr)?dr:P(e,tr)&&P(e,ar)?Ir:P(e,"FxiOS")?Er:P(e.toLowerCase(),Dr.toLowerCase())?Dr:((e,t)=>{return t&&P(t,nr)||P(i=e,ar)&&!P(i,dr)&&!P(i,tr);var i})(e,t)?P(e,Qi)?Pr:ar:P(e,wr)?wr:P(e,"MSIE")||P(e,"Trident/")?_r:P(e,"Gecko")?wr:""},Gr={[vr]:[new RegExp("rv:"+Mr)],[br]:[new RegExp(yr+"?\\/"+Mr)],[dr]:[new RegExp("("+dr+"|CrMo)\\/"+Mr)],[gr]:[new RegExp("CriOS\\/"+Mr)],"UC Browser":[new RegExp("(UCBrowser|UCWEB)\\/"+Mr)],[ar]:[Nr],[Pr]:[Nr],[fr]:[new RegExp("(Opera|OPR)\\/"+Mr)],[wr]:[new RegExp(wr+"\\/"+Mr)],[Er]:[new RegExp("FxiOS\\/"+Mr)],[Dr]:[new RegExp("Konqueror[:/]?"+Mr,"i")],[lr]:[new RegExp(lr+" "+Mr),Nr],[Ir]:[new RegExp("android\\s"+Mr,"i")],[hr]:[new RegExp(ur+"\\/"+Mr)],[_r]:[new RegExp("(rv:|MSIE )"+Mr)],Mozilla:[new RegExp("rv:"+Mr)]},Wr=function(e,t){var i=Br(e,t),r=Gr[i];if(L(r))return null;for(var s=0;s<r.length;s++){var n=r[s],o=e.match(n);if(o)return parseFloat(o[o.length-2])}return null},Vr=[[new RegExp(kr+"; "+kr+" (.*?)[);]","i"),e=>[kr,e&&e[1]||""]],[new RegExp(Sr,"i"),[Sr,""]],[new RegExp(xr,"i"),[xr,""]],[Hr,[lr,""]],[new RegExp(Tr,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[$r,""];if(new RegExp(Qi).test(t)&&!/IEMobile\b/.test(t))return[Tr+" "+Qi,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var r=i[1],s=qr[r]||"";return/arm/i.test(t)&&(s="RT"),[Tr,s]}return[Tr,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>{if(e&&e[3]){var t=[e[3],e[4],e[5]||"0"];return[er,t.join(".")]}return[er,""]}],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=L(e[2])?e[3]:e[2]),["watchOS",t]}],[new RegExp("("+tr+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+tr+")","i"),e=>{if(e&&e[2]){var t=[e[2],e[3],e[4]||"0"];return[tr,t.join(".")]}return[tr,""]}],[/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/,[pr,""]],[/Linux|debian/i,["Linux",""]]],zr=function(e){return Ur.test(e)?Sr:jr.test(e)?xr:Lr.test(e)?kr:new RegExp(Fr,"i").test(e)?Fr:new RegExp("("+$r+"|WPDesktop)","i").test(e)?$r:/iPad/.test(e)?sr:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?or:Hr.test(e)?lr:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":new RegExp(Or,"i").test(e)?Or:/(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(Qi).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)?tr:rr:tr:new RegExp("(pda|"+Qi+")","i").test(e)?Rr:new RegExp(ir,"i").test(e)&&!new RegExp(ir+" pc","i").test(e)?Ar:""},Yr="https?://(.*)",Xr=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],Jr=Ne(["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid"],Xr),Kr="<masked>",Zr=["li_fat_id"];function Qr(e,t,i){if(!d)return{};var r,s=t?Ne([],Xr,i||[]):[],n=es(ai(d.URL,s,Kr),e),o=(r={},De(Zr,function(e){var t=Si.q(e);r[e]=t||null}),r);return Me(o,n)}function es(e,t){var i=Jr.concat(t||[]),r={};return De(i,function(t){var i=oi(e,t);r[t]=i||null}),r}function ts(e){var t,i=(t=e)?0===t.search(Yr+"google.([^/?]*)")?"google":0===t.search(Yr+"bing.com")?"bing":0===t.search(Yr+"yahoo.com")?"yahoo":0===t.search(Yr+"duckduckgo.com")?"duckduckgo":null:null,r="yahoo"!=i?"q":"p",s={};if(!H(i)){s.$search_engine=i;var n=d?oi(d.referrer,r):"";n.length&&(s.ph_keyword=n)}return s}function is(){return navigator.language||navigator.userLanguage}function rs(){return(null==d?void 0:d.referrer)||"$direct"}function ss(e,t){var i=e?Ne([],Xr,t||[]):[],r=null==p?void 0:p.href.substring(0,1e3);return{r:rs().substring(0,1e3),u:r?ai(r,i,Kr):void 0}}function ns(e){var t,{r:i,u:r}=e,s={$referrer:i,$referring_domain:null==i?void 0:"$direct"==i?"$direct":null==(t=ni(i))?void 0:t.host};if(r){s.$current_url=r;var n=ni(r);s.$host=null==n?void 0:n.host,s.$pathname=null==n?void 0:n.pathname;var o=es(r);Me(s,o)}if(i){var a=ts(i);Me(s,a)}return s}function os(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(ii){return}}function as(){try{return(new Date).getTimezoneOffset()}catch(ii){return}}var ls=Oe("[Web Vitals]"),cs=9e5;class us{constructor(e){var t;this.Et=!1,this.P=!1,this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.$t=()=>{clearTimeout(this.kt),0!==this.N.metrics.length&&(this._instance.capture("$web_vitals",this.N.metrics.reduce((e,t)=>E({},e,{["$web_vitals_"+t.name+"_event"]:E({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.N={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.Pt=e=>{var t,i=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0);if(L(i))ls.error("Could not read session ID. Dropping metrics!");else{this.N=this.N||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var r=this.Tt();L(r)||(q(null==e?void 0:e.name)||q(null==e?void 0:e.value)?ls.error("Invalid metric received",e):this.Rt&&e.value>=this.Rt?ls.error("Ignoring metric with value >= "+this.Rt,e):(this.N.url!==r&&(this.$t(),this.kt=setTimeout(this.$t,this.flushToCaptureTimeoutMs)),L(this.N.url)&&(this.N.url=r),this.N.firstMetricTimestamp=L(this.N.firstMetricTimestamp)?Date.now():this.N.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0),this.N.metrics.push(E({},e,{$current_url:r,$session_id:i.sessionId,$window_id:i.windowId,timestamp:Date.now()})),this.N.metrics.length===this.allowedMetrics.length&&this.$t()))}},this.rt=()=>{var e,t,i,r,s=m.__PosthogExtensions__;L(s)||L(s.postHogWebVitalsCallbacks)||({onLCP:e,onCLS:t,onFCP:i,onINP:r}=s.postHogWebVitalsCallbacks),e&&t&&i&&r?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.Pt.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.Pt.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.Pt.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&r(this.Pt.bind(this)),this.P=!0):ls.error("web vitals callbacks not loaded - not starting")},this._instance=e,this.Et=!(null==(t=this._instance.persistence)||!t.props[et]),this.startIfEnabled()}get allowedMetrics(){var e,t,i=M(this._instance.config.capture_performance)?null==(e=this._instance.config.capture_performance)?void 0:e.web_vitals_allowed_metrics:void 0;return L(i)?(null==(t=this._instance.persistence)?void 0:t.props[it])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(M(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals_delayed_flush_ms:void 0)||5e3}get Rt(){var e=M(this._instance.config.capture_performance)&&B(this._instance.config.capture_performance.__web_vitals_max_value)?this._instance.config.capture_performance.__web_vitals_max_value:cs;return 0<e&&e<=6e4?cs:e}get isEnabled(){var e=null==p?void 0:p.protocol;if("http:"!==e&&"https:"!==e)return ls.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=M(this._instance.config.capture_performance)?this._instance.config.capture_performance.web_vitals:G(this._instance.config.capture_performance)?this._instance.config.capture_performance:void 0;return G(t)?t:this.Et}startIfEnabled(){this.isEnabled&&!this.P&&(ls.info("enabled, starting..."),this.it(this.rt))}onRemoteConfig(e){var t=M(e.capturePerformance)&&!!e.capturePerformance.web_vitals,i=M(e.capturePerformance)?e.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[et]:t}),this._instance.persistence.register({[it]:i})),this.Et=t,this.startIfEnabled()}it(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks&&e(),null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"web-vitals",t=>{t?ls.error("failed to load script",t):e()})}Tt(){var e=o?o.location.href:void 0;if(e){var t=this._instance.config.mask_personal_data_properties,i=this._instance.config.custom_personal_data_properties,r=t?Ne([],Xr,i||[]):[];return ai(e,r,Kr)}ls.error("Could not determine current URL")}}var hs=Oe("[Heatmaps]");function ds(e){return M(e)&&"clientX"in e&&"clientY"in e&&B(e.clientX)&&B(e.clientY)}class ps{constructor(e){var t;this.rageclicks=new ti,this.Et=!1,this.P=!1,this.It=null,this.instance=e,this.Et=!(null==(t=this.instance.persistence)||!t.props[Je])}get flushIntervalMilliseconds(){var e=5e3;return M(this.instance.config.capture_heatmaps)&&this.instance.config.capture_heatmaps.flush_interval_milliseconds&&(e=this.instance.config.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return L(this.instance.config.capture_heatmaps)?L(this.instance.config.enable_heatmaps)?this.Et:this.instance.config.enable_heatmaps:!1!==this.instance.config.capture_heatmaps}startIfEnabled(){if(this.isEnabled){if(this.P)return;hs.info("starting..."),this.Ct(),this.Ot()}else{var e;clearInterval(null!==(e=this.It)&&void 0!==e?e:void 0),this.Ft(),this.getAndClearBuffer()}}onRemoteConfig(e){var t=!!e.heatmaps;this.instance.persistence&&this.instance.persistence.register({[Je]:t}),this.Et=t,this.startIfEnabled()}getAndClearBuffer(){var e=this.N;return this.N=void 0,e}Mt(e){this.At(e.originalEvent,"deadclick")}Ot(){this.It&&clearInterval(this.It),this.It="visible"===(null==d?void 0:d.visibilityState)?setInterval(this.Dt.bind(this),this.flushIntervalMilliseconds):null}Ct(){o&&d&&(this.jt=this.Dt.bind(this),We(o,"beforeunload",this.jt),this.Lt=e=>this.At(e||(null==o?void 0:o.event)),We(d,"click",this.Lt,{capture:!0}),this.Nt=e=>this.Ut(e||(null==o?void 0:o.event)),We(d,"mousemove",this.Nt,{capture:!0}),this.zt=new Ni(this.instance,Di,this.Mt.bind(this)),this.zt.startIfEnabled(),this.Ht=this.Ot.bind(this),We(d,"visibilitychange",this.Ht),this.P=!0)}Ft(){var e;o&&d&&(this.jt&&o.removeEventListener("beforeunload",this.jt),this.Lt&&d.removeEventListener("click",this.Lt,{capture:!0}),this.Nt&&d.removeEventListener("mousemove",this.Nt,{capture:!0}),this.Ht&&d.removeEventListener("visibilitychange",this.Ht),clearTimeout(this.Bt),null==(e=this.zt)||e.stop(),this.P=!1)}qt(e,t){var i=this.instance.scrollManager.scrollY(),r=this.instance.scrollManager.scrollX(),s=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var r=e;r&&kt(r)&&!It(r,"body");){if(r===i)return!1;if(P(t,null==o?void 0:o.getComputedStyle(r).position))return!0;r=Nt(r)}return!1}(At(e),["fixed","sticky"],s);return{x:e.clientX+(n?0:r),y:e.clientY+(n?0:i),target_fixed:n,type:t}}At(e,t){var i;if(void 0===t&&(t="click"),!xt(e.target)&&ds(e)){var r=this.qt(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&this.Wt(E({},r,{type:"rageclick"})),this.Wt(r)}}Ut(e){!xt(e.target)&&ds(e)&&(clearTimeout(this.Bt),this.Bt=setTimeout(()=>{this.Wt(this.qt(e,"mousemove"))},500))}Wt(e){if(o){var t=o.location.href,i=this.instance.config.mask_personal_data_properties,r=this.instance.config.custom_personal_data_properties,s=i?Ne([],Xr,r||[]):[],n=ai(t,s,Kr);this.N=this.N||{},this.N[n]||(this.N[n]=[]),this.N[n].push(e)}}Dt(){this.N&&!N(this.N)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}}class gs{constructor(e){this._instance=e}doPageView(e,t){var i,r=this.Gt(e,t);return this.Vt={pathname:null!==(i=null==o?void 0:o.location.pathname)&&void 0!==i?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),r}doPageLeave(e){var t;return this.Gt(e,null==(t=this.Vt)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.Vt)?void 0:e.pageViewId}}Gt(e,t){var i=this.Vt;if(!i)return{$pageview_id:t};var r={$pageview_id:t,$prev_pageview_id:i.pageViewId},s=this._instance.scrollManager.getContext();if(s&&!this._instance.config.disable_scroll_properties){var{maxScrollHeight:n,lastScrollY:o,maxScrollY:a,maxContentHeight:l,lastContentY:c,maxContentY:u}=s;if(!(L(n)||L(o)||L(a)||L(l)||L(c)||L(u))){n=Math.ceil(n),o=Math.ceil(o),a=Math.ceil(a),l=Math.ceil(l),c=Math.ceil(c),u=Math.ceil(u);var h=n<=1?1:Z(o/n,0,1,$e),d=n<=1?1:Z(a/n,0,1,$e),p=l<=1?1:Z(c/l,0,1,$e),g=l<=1?1:Z(u/l,0,1,$e);r=Me(r,{$prev_pageview_last_scroll:o,$prev_pageview_last_scroll_percentage:h,$prev_pageview_max_scroll:a,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:c,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:u,$prev_pageview_max_content_percentage:g})}}return i.pathname&&(r.$prev_pageview_pathname=i.pathname),i.timestamp&&(r.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),r}}var _s=Uint8Array,vs=Uint16Array,fs=Uint32Array,ms=new _s([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]),ys=new _s([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]),bs=new _s([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ws=function(e,t){for(var i=new vs(31),r=0;r<31;++r)i[r]=t+=1<<e[r-1];var s=new fs(i[30]);for(r=1;r<30;++r)for(var n=i[r];n<i[r+1];++n)s[n]=n-i[r]<<5|r;return[i,s]},Es=ws(ms,2),Ss=Es[0],xs=Es[1];Ss[28]=258,xs[258]=28;for(var ks=ws(ys,0)[1],Is=new vs(32768),Ps=0;Ps<32768;++Ps){var Ts=(43690&Ps)>>>1|(21845&Ps)<<1;Ts=(61680&(Ts=(52428&Ts)>>>2|(13107&Ts)<<2))>>>4|(3855&Ts)<<4,Is[Ps]=((65280&Ts)>>>8|(255&Ts)<<8)>>>1}var $s=function(e,t,i){for(var r=e.length,s=0,n=new vs(t);s<r;++s)++n[e[s]-1];var o,a=new vs(t);for(s=0;s<t;++s)a[s]=a[s-1]+n[s-1]<<1;for(o=new vs(r),s=0;s<r;++s)o[s]=Is[a[e[s]-1]++]>>>15-e[s];return o},Os=new _s(288);for(Ps=0;Ps<144;++Ps)Os[Ps]=8;for(Ps=144;Ps<256;++Ps)Os[Ps]=9;for(Ps=256;Ps<280;++Ps)Os[Ps]=7;for(Ps=280;Ps<288;++Ps)Os[Ps]=8;var Fs=new _s(32);for(Ps=0;Ps<32;++Ps)Fs[Ps]=5;var Cs=$s(Os,9),Rs=$s(Fs,5),As=function(e){return(e/8|0)+(7&e&&1)},Ds=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var r=new(e instanceof vs?vs:e instanceof fs?fs:_s)(i-t);return r.set(e.subarray(t,i)),r},Ms=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8},Ns=function(e,t,i){i<<=7&t;var r=t/8|0;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},Ls=function(e,t){for(var i=[],r=0;r<e.length;++r)e[r]&&i.push({s:r,f:e[r]});var s=i.length,n=i.slice();if(!s)return[new _s(0),0];if(1==s){var o=new _s(i[0].s+1);return o[i[0].s]=1,[o,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var a=i[0],l=i[1],c=0,u=1,h=2;for(i[0]={s:-1,f:a.f+l.f,l:a,r:l};u!=s-1;)a=i[i[c].f<i[h].f?c++:h++],l=i[c!=u&&i[c].f<i[h].f?c++:h++],i[u++]={s:-1,f:a.f+l.f,l:a,r:l};var d=n[0].s;for(r=1;r<s;++r)n[r].s>d&&(d=n[r].s);var p=new vs(d+1),g=js(i[u-1],p,0);if(g>t){r=0;var _=0,v=g-t,f=1<<v;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<s;++r){var m=n[r].s;if(!(p[m]>t))break;_+=f-(1<<g-p[m]),p[m]=t}for(_>>>=v;_>0;){var y=n[r].s;p[y]<t?_-=1<<t-p[y]++-1:++r}for(;r>=0&&_;--r){var b=n[r].s;p[b]==t&&(--p[b],++_)}g=t}return[new _s(p),g]},js=function(e,t,i){return-1==e.s?Math.max(js(e.l,t,i+1),js(e.r,t,i+1)):t[e.s]=i},Us=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new vs(++t),r=0,s=e[0],n=1,o=function(e){i[r++]=e},a=1;a<=t;++a)if(e[a]==s&&a!=t)++n;else{if(!s&&n>2){for(;n>138;n-=138)o(32754);n>2&&(o(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(o(s),--n;n>6;n-=6)o(8304);n>2&&(o(n-3<<5|8208),n=0)}for(;n--;)o(s);n=1,s=e[a]}return[i.subarray(0,r),t]},Hs=function(e,t){for(var i=0,r=0;r<t.length;++r)i+=e[r]*t[r];return i},qs=function(e,t,i){var r=i.length,s=As(t+2);e[s]=255&r,e[s+1]=r>>>8,e[s+2]=255^e[s],e[s+3]=255^e[s+1];for(var n=0;n<r;++n)e[s+n+4]=i[n];return 8*(s+4+r)},Bs=function(e,t,i,r,s,n,o,a,l,c,u){Ms(t,u++,i),++s[256];for(var h=Ls(s,15),d=h[0],p=h[1],g=Ls(n,15),_=g[0],v=g[1],f=Us(d),m=f[0],y=f[1],b=Us(_),w=b[0],E=b[1],S=new vs(19),x=0;x<m.length;++x)S[31&m[x]]++;for(x=0;x<w.length;++x)S[31&w[x]]++;for(var k=Ls(S,7),I=k[0],P=k[1],T=19;T>4&&!I[bs[T-1]];--T);var $,O,F,C,R=c+5<<3,A=Hs(s,Os)+Hs(n,Fs)+o,D=Hs(s,d)+Hs(n,_)+o+14+3*T+Hs(S,I)+(2*S[16]+3*S[17]+7*S[18]);if(R<=A&&R<=D)return qs(t,u,e.subarray(l,l+c));if(Ms(t,u,1+(D<A)),u+=2,D<A){$=$s(d,p),O=d,F=$s(_,v),C=_;var M=$s(I,P);for(Ms(t,u,y-257),Ms(t,u+5,E-1),Ms(t,u+10,T-4),u+=14,x=0;x<T;++x)Ms(t,u+3*x,I[bs[x]]);u+=3*T;for(var N=[m,w],L=0;L<2;++L){var j=N[L];for(x=0;x<j.length;++x){var U=31&j[x];Ms(t,u,M[U]),u+=I[U],U>15&&(Ms(t,u,j[x]>>>5&127),u+=j[x]>>>12)}}}else $=Cs,O=Os,F=Rs,C=Fs;for(x=0;x<a;++x)if(r[x]>255){U=r[x]>>>18&31,Ns(t,u,$[U+257]),u+=O[U+257],U>7&&(Ms(t,u,r[x]>>>23&31),u+=ms[U]);var H=31&r[x];Ns(t,u,F[H]),u+=C[H],H>3&&(Ns(t,u,r[x]>>>5&8191),u+=ys[H])}else Ns(t,u,$[r[x]]),u+=O[r[x]];return Ns(t,u,$[256]),u+O[256]},Gs=new fs([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),Ws=function(){for(var e=new fs(256),t=0;t<256;++t){for(var i=t,r=9;--r;)i=(1&i&&3988292384)^i>>>1;e[t]=i}return e}(),Vs=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8};var zs=!!_||!!g,Ys="text/plain",Xs=function(e,t,i){var r;void 0===i&&(i=!0);var[s,n]=e.split("?"),o=E({},t),a=null!==(r=null==n?void 0:n.split("&").map(e=>{var t,[r,s]=e.split("="),n=i&&null!==(t=o[r])&&void 0!==t?t:s;return delete o[r],r+"="+n}))&&void 0!==r?r:[],l=function(e,t){var i,r;void 0===t&&(t="&");var s=[];return De(e,function(e,t){L(e)||L(t)||"undefined"===t||(i=encodeURIComponent(e instanceof File?e.name:e.toString()),r=encodeURIComponent(t),s[s.length]=r+"="+i)}),s.join(t)}(o);return l&&a.push(l),s+"?"+a.join("&")},Js=(e,t)=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t),Ks=e=>{var t,{data:i,compression:r}=e;if(i){if(r===si.GZipJS){var s=function(e,t){void 0===t&&(t={});var i=function(){var e=4294967295;return{p:function(t){for(var i=e,r=0;r<t.length;++r)i=Ws[255&i^t[r]]^i>>>8;e=i},d:function(){return 4294967295^e}}}(),r=e.length;i.p(e);var s,n=function(e,t,i){return function(e,t,i,r){var s=e.length,n=new _s(r+s+5*(1+Math.floor(s/7e3))+8),o=n.subarray(r,n.length-8),a=0;if(!t||s<8)for(var l=0;l<=s;l+=65535){var c=l+65535;c<s?a=qs(o,a,e.subarray(l,c)):(o[l]=!0,a=qs(o,a,e.subarray(l,s)))}else{for(var u=Gs[t-1],h=u>>>13,d=8191&u,p=(1<<i)-1,g=new vs(32768),_=new vs(p+1),v=Math.ceil(i/3),f=2*v,m=function(t){return(e[t]^e[t+1]<<v^e[t+2]<<f)&p},y=new fs(25e3),b=new vs(288),w=new vs(32),E=0,S=0,x=(l=0,0),k=0,I=0;l<s;++l){var P=m(l),T=32767&l,$=_[P];if(g[T]=$,_[P]=T,k<=l){var O=s-l;if((E>7e3||x>24576)&&O>423){a=Bs(e,o,0,y,b,w,S,x,I,l-I,a),x=E=S=0,I=l;for(var F=0;F<286;++F)b[F]=0;for(F=0;F<30;++F)w[F]=0}var C=2,R=0,A=d,D=T-$&32767;if(O>2&&P==m(l-D))for(var M=Math.min(h,O)-1,N=Math.min(32767,l),L=Math.min(258,O);D<=N&&--A&&T!=$;){if(e[l+C]==e[l+C-D]){for(var j=0;j<L&&e[l+j]==e[l+j-D];++j);if(j>C){if(C=j,R=D,j>M)break;var U=Math.min(D,j-2),H=0;for(F=0;F<U;++F){var q=l-D+F+32768&32767,B=q-g[q]+32768&32767;B>H&&(H=B,$=q)}}}D+=(T=$)-($=g[T])+32768&32767}if(R){y[x++]=268435456|xs[C]<<18|ks[R];var G=31&xs[C],W=31&ks[R];S+=ms[G]+ys[W],++b[257+G],++w[W],k=l+C,++E}else y[x++]=e[l],++b[e[l]]}}a=Bs(e,o,!0,y,b,w,S,x,I,l-I,a)}return Ds(n,0,r+As(a)+8)}(e,null==t.level?6:t.level,null==t.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(e.length)))):12+t.mem,i)}(e,t,10+((s=t).filename&&s.filename.length+1||0)),o=n.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&&Vs(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var r=0;r<=i.length;++r)e[r+10]=i.charCodeAt(r)}}(n,t),Vs(n,o-8,i.d()),Vs(n,o-4,r),n}(function(e){var t=e.length;if("undefined"!=typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new _s(e.length+(e.length>>>1)),r=0,s=function(e){i[r++]=e},n=0;n<t;++n){if(r+5>i.length){var o=new _s(r+8+(t-n<<1));o.set(i),i=o}var a=e.charCodeAt(n);a<128?s(a):a<2048?(s(192|a>>>6),s(128|63&a)):a>55295&&a<57344?(s(240|(a=65536+(1047552&a)|1023&e.charCodeAt(++n))>>>18),s(128|a>>>12&63),s(128|a>>>6&63),s(128|63&a)):(s(224|a>>>12),s(128|a>>>6&63),s(128|63&a))}return Ds(i,0,r)}(Js(i)),{mtime:0}),n=new Blob([s],{type:Ys});return{contentType:Ys,body:n,estimatedSize:n.size}}if(r===si.Base64){var o=function(e){var t,i,r,s,n,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",a=0,l=0,c="",u=[];if(!e)return e;e=function(e){var t,i,r,s,n="";for(t=i=0,r=(e=(e+"").replace(/\r\n/g,"\n").replace(/\r/g,"\n")).length,s=0;s<r;s++){var o=e.charCodeAt(s),a=null;o<128?i++:a=o>127&&o<2048?String.fromCharCode(o>>6|192,63&o|128):String.fromCharCode(o>>12|224,o>>6&63|128,63&o|128),H(a)||(i>t&&(n+=e.substring(t,i)),n+=a,t=i=s+1)}return i>t&&(n+=e.substring(t,e.length)),n}(e);do{t=(n=e.charCodeAt(a++)<<16|e.charCodeAt(a++)<<8|e.charCodeAt(a++))>>18&63,i=n>>12&63,r=n>>6&63,s=63&n,u[l++]=o.charAt(t)+o.charAt(i)+o.charAt(r)+o.charAt(s)}while(a<e.length);switch(c=u.join(""),e.length%3){case 1:c=c.slice(0,-2)+"==";break;case 2:c=c.slice(0,-1)+"="}return c}(Js(i)),a=(t=o,"data="+encodeURIComponent("string"==typeof t?t:Js(t)));return{contentType:"application/x-www-form-urlencoded",body:a,estimatedSize:new Blob([a]).size}}var l=Js(i);return{contentType:"application/json",body:l,estimatedSize:new Blob([l]).size}}},Zs=[];g&&Zs.push({transport:"fetch",method:e=>{var t,i,{contentType:r,body:s,estimatedSize:n}=null!==(t=Ks(e))&&void 0!==t?t:{},o=new Headers;De(e.headers,function(e,t){o.append(t,e)}),r&&o.append("Content-Type",r);var a=e.url,l=null;if(v){var c=new v;l={signal:c.signal,timeout:setTimeout(()=>c.abort(),e.timeout)}}g(a,E({method:(null==e?void 0:e.method)||"GET",headers:o,keepalive:"POST"===e.method&&(n||0)<52428.8,body:s,signal:null==(i=l)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var r={statusCode:t.status,text:i};if(200===t.status)try{r.json=JSON.parse(i)}catch(s){$e.error(s)}null==e.callback||e.callback(r)})).catch(t=>{$e.error(t),null==e.callback||e.callback({statusCode:0,text:t})}).finally(()=>l?clearTimeout(l.timeout):null)}}),_&&Zs.push({transport:"XHR",method:e=>{var t,i=new _;i.open(e.method||"GET",e.url,!0);var{contentType:r,body:s}=null!==(t=Ks(e))&&void 0!==t?t:{};De(e.headers,function(e,t){i.setRequestHeader(t,e)}),r&&i.setRequestHeader("Content-Type",r),e.timeout&&(i.timeout=e.timeout),e.disableXHRCredentials||(i.withCredentials=!0),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(r){}null==e.callback||e.callback(t)}},i.send(s)}}),null!=h&&h.sendBeacon&&Zs.push({transport:"sendBeacon",method:e=>{var t=Xs(e.url,{beacon:"1"});try{var i,{contentType:r,body:s}=null!==(i=Ks(e))&&void 0!==i?i:{},n="string"==typeof s?new Blob([s],{type:r}):s;h.sendBeacon(t,n)}catch(o){}}});var Qs=function(e,t){if(!function(){return!0}())return!1;try{return new RegExp(t).test(e)}catch(i){return!1}};function en(e,t,i){return Js({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var tn={exact:(e,t)=>t.some(t=>e.some(e=>t===e)),is_not:(e,t)=>t.every(t=>e.every(e=>t!==e)),regex:(e,t)=>t.some(t=>e.some(e=>Qs(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!Qs(t,e))),icontains:(e,t)=>t.map(rn).some(t=>e.map(rn).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(rn).every(t=>e.map(rn).every(e=>!t.includes(e)))},rn=e=>e.toLowerCase(),sn=Oe("[Error tracking]");class nn{constructor(e){var t,i;this.Jt=[],this.Kt=new ve([new fe,new Pe,new ye,new me,new ke,new xe,new we,new Ie],[he,ge]),this._instance=e,this.Jt=null!==(t=null==(i=this._instance.persistence)?void 0:i.get_property(Ze))&&void 0!==t?t:[]}onRemoteConfig(e){var t,i,r,s=null!==(t=null==(i=e.errorTracking)?void 0:i.suppressionRules)&&void 0!==t?t:[],n=null==(r=e.errorTracking)?void 0:r.captureExtensionExceptions;this.Jt=s,this._instance.persistence&&this._instance.persistence.register({[Ze]:this.Jt,[Qe]:n})}get Yt(){var e,t=!!this._instance.get_property(Qe),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!==(e=null!=i?i:t)&&void 0!==e&&e}buildProperties(e,t){return this.Kt.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}sendExceptionEvent(e){var t=e.$exception_list;if(this.Xt(t)){if(this.Qt(t))return void sn.info("Skipping exception capture because a suppression rule matched");if(!this.Yt&&this.Zt(t))return void sn.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ti(t))return void sn.info("Skipping exception capture because it was thrown by the PostHog SDK")}return this._instance.capture("$exception",e,{_noTruncate:!0,_batchKey:"exceptionEvent"})}Qt(e){if(0===e.length)return!1;var t=e.reduce((e,t)=>{var{type:i,value:r}=t;return j(i)&&i.length>0&&e.$exception_types.push(i),j(r)&&r.length>0&&e.$exception_values.push(r),e},{$exception_types:[],$exception_values:[]});return this.Jt.some(e=>{var i=e.values.map(e=>{var i,r=tn[e.operator],s=A(e.value)?e.value:[e.value],n=null!==(i=t[e.key])&&void 0!==i?i:[];return s.length>0&&r(s,n)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}Zt(e){return e.flatMap(e=>{var t,i;return null!==(t=null==(i=e.stacktrace)?void 0:i.frames)&&void 0!==t?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ti(e){if(e.length>0){var t,i,r,s,n=null!==(t=null==(i=e[0].stacktrace)?void 0:i.frames)&&void 0!==t?t:[],o=n[n.length-1];return null!==(r=null==o||null==(s=o.filename)?void 0:s.includes("posthog.com/static"))&&void 0!==r&&r}return!1}Xt(e){return!q(e)&&A(e)}}var on=Oe("[FeatureFlags]"),an="$active_feature_flags",ln="$override_feature_flags",cn="$feature_flag_payloads",un="$override_feature_flag_payloads",hn="$feature_flag_request_id",dn=e=>{var t={};for(var[i,r]of Le(e||{}))r&&(t[i]=r);return t},pn=function(e){return e.FeatureFlags="feature_flags",e.Recordings="recordings",e}({});class gn{constructor(e){this.ii=!1,this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this._instance=e,this.featureFlagEventHandlers=[]}li(){var e=this._instance.config.evaluation_environments;return null!=e&&e.length?e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||on.error("Invalid evaluation environment found:",e,"Expected non-empty string"),t}):[]}ui(){return this.li().length>0}flags(){if(this._instance.config.__preview_remote_config)this.oi=!0;else{var e=!this.hi&&(this._instance.config.advanced_disable_feature_flags||this._instance.config.advanced_disable_feature_flags_on_first_load);this.di({disableFlags:e})}}get hasLoadedFlags(){return this.ei}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this._instance.get_property(lt),t=this._instance.get_property(ln),i=this._instance.get_property(un);if(!i&&!t)return e||{};var r=Me({},e||{}),s=[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])];for(var n of s){var o,a,l=r[n],c=null==t?void 0:t[n],u=L(c)?null!==(o=null==l?void 0:l.enabled)&&void 0!==o&&o:!!c,h=L(c)?l.variant:"string"==typeof c?c:void 0,d=null==i?void 0:i[n],p=E({},l,{enabled:u,variant:u?null!=h?h:null==l?void 0:l.variant:void 0});u!==(null==l?void 0:l.enabled)&&(p.original_enabled=null==l?void 0:l.enabled),h!==(null==l?void 0:l.variant)&&(p.original_variant=null==l?void 0:l.variant),d&&(p.metadata=E({},null==l?void 0:l.metadata,{payload:d,original_payload:null==l||null==(a=l.metadata)?void 0:a.payload})),r[n]=p}return this.ii||(on.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:r}),this.ii=!0),r}getFlagVariants(){var e=this._instance.get_property(ot),t=this._instance.get_property(ln);if(!t)return e||{};for(var i=Me({},e),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this.ii||(on.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.ii=!0),i}getFlagPayloads(){var e=this._instance.get_property(cn),t=this._instance.get_property(un);if(!t)return e||{};for(var i=Me({},e||{}),r=Object.keys(t),s=0;s<r.length;s++)i[r[s]]=t[r[s]];return this.ii||(on.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.ii=!0),i}reloadFeatureFlags(){this.si||this._instance.config.advanced_disable_feature_flags||this.hi||(this.hi=setTimeout(()=>{this.di()},5))}vi(){clearTimeout(this.hi),this.hi=void 0}ensureFlagsLoaded(){this.ei||this.ri||this.hi||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.si=e}di(e){var t;if(this.vi(),!this._instance.M())if(this.ri)this.ni=!0;else{var i={token:this._instance.config.token,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:E({},(null==(t=this._instance.persistence)?void 0:t.get_initial_props())||{},this._instance.get_property(ct)||{}),group_properties:this._instance.get_property(ut)};(null!=e&&e.disableFlags||this._instance.config.advanced_disable_feature_flags)&&(i.disable_flags=!0),this.ui()&&(i.evaluation_environments=this.li());var r=this._instance.config.__preview_remote_config,s=r?"/flags/?v=2":"/flags/?v=2&config=true",n=this._instance.config.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":"",o=this._instance.requestRouter.endpointFor("api",s+n);r&&(i.timezone=os()),this.ri=!0,this._instance.ci({method:"POST",url:o,data:i,compression:this._instance.config.disable_compression?void 0:si.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:e=>{var t,r,s=!0;if(200===e.statusCode&&(this.ni||(this.$anon_distinct_id=void 0),s=!1),this.ri=!1,this.oi||(this.oi=!0,this._instance.fi(null!==(r=e.json)&&void 0!==r?r:{})),!i.disable_flags||this.ni)if(this.ai=!s,e.json&&null!=(t=e.json.quotaLimited)&&t.includes(pn.FeatureFlags))on.warn("You have hit your feature flags quota limit, and will not be able to load feature flags until the quota is reset. Please visit https://posthog.com/docs/billing/limits-alerts to learn more.");else{var n;i.disable_flags||this.receivedFeatureFlags(null!==(n=e.json)&&void 0!==n?n:{},s),this.ni&&(this.ni=!1,this.di())}}})}}getFeatureFlag(e,t){if(void 0===t&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var i=this.getFlagVariants()[e],r=""+i,s=this._instance.get_property(hn)||void 0,n=this._instance.get_property(pt)||{};if((t.send_event||!("send_event"in t))&&(!(e in n)||!n[e].includes(r))){var o,a,l,c,u,h,d,p,g;A(n[e])?n[e].push(r):n[e]=[r],null==(o=this._instance.persistence)||o.register({[pt]:n});var _=this.getFeatureFlagDetails(e),v={$feature_flag:e,$feature_flag_response:i,$feature_flag_payload:this.getFeatureFlagPayload(e)||null,$feature_flag_request_id:s,$feature_flag_bootstrapped_response:(null==(a=this._instance.config.bootstrap)||null==(a=a.featureFlags)?void 0:a[e])||null,$feature_flag_bootstrapped_payload:(null==(l=this._instance.config.bootstrap)||null==(l=l.featureFlagPayloads)?void 0:l[e])||null,$used_bootstrap_value:!this.ai};L(null==_||null==(c=_.metadata)?void 0:c.version)||(v.$feature_flag_version=_.metadata.version);var f,m=null!==(u=null==_||null==(h=_.reason)?void 0:h.description)&&void 0!==u?u:null==_||null==(d=_.reason)?void 0:d.code;m&&(v.$feature_flag_reason=m),null!=_&&null!=(p=_.metadata)&&p.id&&(v.$feature_flag_id=_.metadata.id),L(null==_?void 0:_.original_variant)&&L(null==_?void 0:_.original_enabled)||(v.$feature_flag_original_response=L(_.original_variant)?_.original_enabled:_.original_variant),null!=_&&null!=(g=_.metadata)&&g.original_payload&&(v.$feature_flag_original_payload=null==_||null==(f=_.metadata)?void 0:f.original_payload),this._instance.capture("$feature_flag_called",v)}return i}on.warn('getFeatureFlag for key "'+e+"\" failed. Feature flags didn't load in time.")}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){return this.getFlagPayloads()[e]}getRemoteConfigPayload(e,t){var i=this._instance.config.token,r={distinct_id:this._instance.get_distinct_id(),token:i};this.ui()&&(r.evaluation_environments=this.li()),this._instance.ci({method:"POST",url:this._instance.requestRouter.endpointFor("api","/flags/?v=2&config=true"),data:r,compression:this._instance.config.disable_compression?void 0:si.Base64,timeout:this._instance.config.feature_flag_request_timeout_ms,callback:i=>{var r,s=null==(r=i.json)?void 0:r.featureFlagPayloads;t((null==s?void 0:s[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),this.ei||this.getFlags()&&this.getFlags().length>0){var i=this.getFeatureFlag(e,t);return L(i)?void 0:!!i}on.warn('isFeatureEnabled for key "'+e+"\" failed. Feature flags didn't load in time.")}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t){if(this._instance.persistence){this.ei=!0;var i=this.getFlagVariants(),r=this.getFlagPayloads(),s=this.getFlagsWithDetails();!function(e,t,i,r,s){void 0===i&&(i={}),void 0===r&&(r={}),void 0===s&&(s={});var n=(e=>{var t=e.flags;return t?(e.featureFlags=Object.fromEntries(Object.keys(t).map(e=>{var i;return[e,null!==(i=t[e].variant)&&void 0!==i?i:t[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(t).filter(e=>t[e].enabled).filter(e=>{var i;return null==(i=t[e].metadata)?void 0:i.payload}).map(e=>{var i;return[e,null==(i=t[e].metadata)?void 0:i.payload]}))):on.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e})(e),o=n.flags,a=n.featureFlags,l=n.featureFlagPayloads;if(a){var c=e.requestId;if(A(a)){on.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var u={};if(a)for(var h=0;h<a.length;h++)u[a[h]]=!0;t&&t.register({[an]:a,[ot]:u})}else{var d=a,p=l,g=o;e.errorsWhileComputingFlags&&(d=E({},i,d),p=E({},r,p),g=E({},s,g)),t&&t.register(E({[an]:Object.keys(dn(d)),[ot]:d||{},[cn]:p||{},[lt]:g||{}},c?{[hn]:c}:{}))}}}(e,this._instance.persistence,i,r,s),this.pi(t)}}override(e,t){void 0===t&&(t=!1),on.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this._instance.persistence)return on.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this._instance.persistence.unregister(ln),this._instance.persistence.unregister(un),void this.pi();if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){var t,i=e;if(this.ii=Boolean(null!==(t=i.suppressWarning)&&void 0!==t&&t),"flags"in i)if(!1===i.flags)this._instance.persistence.unregister(ln);else if(i.flags)if(A(i.flags)){for(var r={},s=0;s<i.flags.length;s++)r[i.flags[s]]=!0;this._instance.persistence.register({[ln]:r})}else this._instance.persistence.register({[ln]:i.flags});return"payloads"in i&&(!1===i.payloads?this._instance.persistence.unregister(un):i.payloads&&this._instance.persistence.register({[un]:i.payloads})),void this.pi()}this.pi()}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.ei){var{flags:t,flagVariants:i}=this.gi();e(t,i)}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var r,s=(this._instance.get_property(at)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},o={$feature_flag:e,$feature_enrollment:t,$set:n};s&&(o.$early_access_feature_name=s.name),i&&(o.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",o),this.setPersonPropertiesForFlags(n,!1);var a=E({},this.getFlagVariants(),{[e]:t});null==(r=this._instance.persistence)||r.register({[an]:Object.keys(dn(a)),[ot]:a}),this.pi()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var r=this._instance.get_property(at),s=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(r&&!t)return e(r);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this._instance.config.token+s),method:"GET",callback:t=>{var i,r;if(t.json){var s=t.json.earlyAccessFeatures;return null==(i=this._instance.persistence)||i.unregister(at),null==(r=this._instance.persistence)||r.register({[at]:s}),e(s)}}})}gi(){var e=this.getFlags(),t=this.getFlagVariants();return{flags:e.filter(e=>t[e]),flagVariants:Object.keys(t).filter(e=>t[e]).reduce((e,i)=>(e[i]=t[i],e),{})}}pi(e){var{flags:t,flagVariants:i}=this.gi();this.featureFlagEventHandlers.forEach(r=>r(t,i,{errorsLoading:e}))}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(ct)||{};this._instance.register({[ct]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(){this._instance.unregister(ct)}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this._instance.get_property(ut)||{};0!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=E({},i[t],e[t]),delete e[t]}),this._instance.register({[ut]:E({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this._instance.get_property(ut)||{};this._instance.register({[ut]:E({},t,{[e]:{}})})}else this._instance.unregister(ut)}reset(){this.ei=!1,this.ri=!1,this.si=!1,this.ni=!1,this.oi=!1,this.ai=!1,this.$anon_distinct_id=void 0,this.vi(),this.ii=!1}}var _n=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"];class vn{constructor(e,t){var i,r;this.C=e,this.props={},this.mi=!1,this.yi=(r="",(i=e).token&&(r=i.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),i.persistence_name?"ph_"+i.persistence_name:"ph_"+r+"_posthog"),this.Y=this.bi(e),this.load(),e.debug&&$e.info("Persistence loaded",e.persistence,E({},this.props)),this.update_config(e,e,t),this.save()}isDisabled(){return!!this.wi}bi(e){-1===_n.indexOf(e.persistence.toLowerCase())&&($e.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t=e.persistence.toLowerCase();return"localstorage"===t&&ki.H()?ki:"localstorage+cookie"===t&&Pi.H()?Pi:"sessionstorage"===t&&Fi.H()?Fi:"memory"===t?$i:"cookie"===t?Si:Pi.H()?Pi:Si}properties(){var e={};return De(this.props,function(t,i){if(i===ot&&M(t))for(var r=Object.keys(t),s=0;s<r.length;s++)e["$feature/"+r[s]]=t[r[s]];else o=i,a=!1,(H(n=St)?a:u&&n.indexOf===u?-1!=n.indexOf(o):(De(n,function(e){if(a||(a=e===o))return Re}),a))||(e[i]=t);var n,o,a}),e}load(){if(!this.wi){var e=this.Y.W(this.yi);e&&(this.props=Me({},e))}}save(){this.wi||this.Y.G(this.yi,this.props,this.xi,this.Si,this.Ei,this.C.debug)}remove(){this.Y.V(this.yi,!1),this.Y.V(this.yi,!0)}clear(){this.remove(),this.props={}}register_once(e,t,i){if(M(e)){L(t)&&(t="None"),this.xi=L(i)?this.$i:i;var r=!1;if(De(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.props[i]=e,r=!0)}),r)return this.save(),!0}return!1}register(e,t){if(M(e)){this.xi=L(t)?this.$i:t;var i=!1;if(De(e,(t,r)=>{e.hasOwnProperty(r)&&this.props[r]!==t&&(this.props[r]=t,i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(delete this.props[e],this.save())}update_campaign_params(){if(!this.mi){var e=Qr(this.C.custom_campaign_params,this.C.mask_personal_data_properties,this.C.custom_personal_data_properties);N(He(e))||this.register(e),this.mi=!0}}update_search_keyword(){var e;this.register((e=null==d?void 0:d.referrer)?ts(e):{})}update_referrer_info(){var e;this.register_once({$referrer:rs(),$referring_domain:null!=d&&d.referrer&&(null==(e=ni(d.referrer))?void 0:e.host)||"$direct"},void 0)}set_initial_person_info(){this.props[ft]||this.props[mt]||this.register_once({[yt]:ss(this.C.mask_personal_data_properties,this.C.custom_personal_data_properties)},void 0)}get_initial_props(){var e={};De([mt,ft],t=>{var i=this.props[t];i&&De(i,function(t,i){e["$initial_"+$(i)]=t})});var t,i,r=this.props[yt];if(r){var s=(t=ns(r),i={},De(t,function(e,t){i["$initial_"+$(t)]=e}),i);Me(e,s)}return e}safe_merge(e){return De(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){if(this.$i=this.xi=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie),e.persistence!==t.persistence){var r=this.bi(e),s=this.props;this.clear(),this.Y=r,this.props=s,this.save()}}set_disabled(e){this.wi=e,this.wi?this.remove():this.save()}set_cross_subdomain(e){e!==this.Si&&(this.Si=e,this.remove(),this.save())}set_secure(e){e!==this.Ei&&(this.Ei=e,this.remove(),this.save())}set_event_timer(e,t){var i=this.props[Ye]||{};i[e]=t,this.props[Ye]=i,this.save()}remove_event_timer(e){var t=(this.props[Ye]||{})[e];return L(t)||(delete this.props[Ye][e],this.save()),t}get_property(e){return this.props[e]}set_property(e,t){this.props[e]=t,this.save()}}!function(e){e.Button="button",e.Tab="tab",e.Selector="selector"}({}),function(e){e.TopLeft="top_left",e.TopRight="top_right",e.TopCenter="top_center",e.MiddleLeft="middle_left",e.MiddleRight="middle_right",e.MiddleCenter="middle_center",e.Left="left",e.Center="center",e.Right="right",e.NextToTrigger="next_to_trigger"}({});var fn=function(e){return e.Popover="popover",e.API="api",e.Widget="widget",e.ExternalSurvey="external_survey",e}({});!function(e){e.Open="open",e.MultipleChoice="multiple_choice",e.SingleChoice="single_choice",e.Rating="rating",e.Link="link"}({}),function(e){e.NextQuestion="next_question",e.End="end",e.ResponseBased="response_based",e.SpecificQuestion="specific_question"}({}),function(e){e.Once="once",e.Recurring="recurring",e.Always="always"}({});var mn=function(e){return e.SHOWN="survey shown",e.DISMISSED="survey dismissed",e.SENT="survey sent",e}({}),yn=function(e){return e.SURVEY_ID="$survey_id",e.SURVEY_NAME="$survey_name",e.SURVEY_RESPONSE="$survey_response",e.SURVEY_ITERATION="$survey_iteration",e.SURVEY_ITERATION_START_DATE="$survey_iteration_start_date",e.SURVEY_PARTIALLY_COMPLETED="$survey_partially_completed",e.SURVEY_SUBMISSION_ID="$survey_submission_id",e.SURVEY_QUESTIONS="$survey_questions",e.SURVEY_COMPLETED="$survey_completed",e}({}),bn=function(e){return e.Popover="popover",e.Inline="inline",e}({});class wn{constructor(){this.ki={},this.ki={}}on(e,t){return this.ki[e]||(this.ki[e]=[]),this.ki[e].push(t),()=>{this.ki[e]=this.ki[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.ki[e]||[])i(t);for(var r of this.ki["*"]||[])r(e,t)}}class En{constructor(e){this.Pi=new wn,this.Ti=(e,t)=>this.Ri(e,t)&&this.Ii(e,t)&&this.Ci(e,t),this.Ri=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Oi=new Set,this.Fi=new Set}init(){var e,t;L(null==(e=this._instance)?void 0:e.Mi)||null==(t=this._instance)||t.Mi((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!L(null==(t=this._instance)?void 0:t.Mi)&&(e.forEach(e=>{var t,i;null==(t=this.Fi)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.Oi)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var r,s=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&s.add(null==e?void 0:e.selector)})}),null==(r=this._instance)||r.autocapture.setElementSelectors(s)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Oi.has(e)||this.Oi.has(null==t?void 0:t.event))&&this.Fi&&(null==(i=this.Fi)?void 0:i.size)>0&&this.Fi.forEach(e=>{this.Ai(t,e)&&this.Pi.emit("actionCaptured",e.name)})}Di(e){this.onAction("actionCaptured",t=>e(t))}Ai(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Ti(e,i))return!0;return!1}onAction(e,t){return this.Pi.on(e,t)}Ii(e,t){if(null!=t&&t.url){var i,r=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!r||"string"!=typeof r)return!1;if(!En.ji(r,null==t?void 0:t.url,(null==t?void 0:t.url_matching)||"contains"))return!1}return!0}static ji(e,t,i){switch(i){case"regex":return!!o&&Qs(e,t);case"exact":return t===e;case"contains":var r=En.Li(t).replace(/_/g,".").replace(/%/g,".*");return Qs(e,r);default:return!1}}static Li(e){return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}Ci(e,t){if((null!=t&&t.href||null!=t&&t.tag_name||null!=t&&t.text)&&!this.Ni(e).some(e=>!(null!=t&&t.href&&!En.ji(e.href||"",null==t?void 0:t.href,(null==t?void 0:t.href_matching)||"exact")||null!=t&&t.tag_name&&e.tag_name!==(null==t?void 0:t.tag_name)||null!=t&&t.text&&!En.ji(e.text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact")&&!En.ji(e.$el_text||"",null==t?void 0:t.text,(null==t?void 0:t.text_matching)||"exact"))))return!1;if(null!=t&&t.selector){var i,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(!r)return!1;if(!r.includes(null==t?void 0:t.selector))return!1}return!0}Ni(e){return null==(null==e?void 0:e.properties.$elements)?[]:null==e?void 0:e.properties.$elements}}var Sn=Oe("[Surveys]"),xn="seenSurvey_",kn=(e,t)=>{var i="$survey_"+t+"/"+e.id;return e.current_iteration&&e.current_iteration>0&&(i="$survey_"+t+"/"+e.id+"/"+e.current_iteration),i},In=e=>{var t=""+xn+e.id;return e.current_iteration&&e.current_iteration>0&&(t=""+xn+e.id+"_"+e.current_iteration),t},Pn=[fn.Popover,fn.Widget,fn.API],Tn={ignoreConditions:!1,ignoreDelay:!1,displayType:bn.Popover};class $n{constructor(e){this._instance=e,this.Ui=new Map,this.zi=new Map}register(e){var t;L(null==(t=this._instance)?void 0:t.Mi)||(this.Hi(e),this.Bi(e))}Bi(e){var t=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.actions)&&(null==(i=e.conditions)||null==(i=i.actions)||null==(i=i.values)?void 0:i.length)>0});0!==t.length&&(null==this.qi&&(this.qi=new En(this._instance),this.qi.init(),this.qi.Di(e=>{this.onAction(e)})),t.forEach(e=>{var t,i,r,s,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(r=e.conditions)||null==(r=r.actions)||null==(r=r.values)?void 0:r.length)>0&&(null==(s=this.qi)||s.register(e.conditions.actions.values),null==(n=e.conditions)||null==(n=n.actions)||null==(n=n.values)||n.forEach(t=>{if(t&&t.name){var i=this.zi.get(t.name);i&&i.push(e.id),this.zi.set(t.name,i||[e.id])}}))}))}Hi(e){var t;0!==e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.events)&&(null==(i=e.conditions)||null==(i=i.events)||null==(i=i.values)?void 0:i.length)>0}).length&&(null==(t=this._instance)||t.Mi((e,t)=>{this.onEvent(e,t)}),e.forEach(e=>{var t;null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||t.forEach(t=>{if(t&&t.name){var i=this.Ui.get(t.name);i&&i.push(e.id),this.Ui.set(t.name,i||[e.id])}})}))}onEvent(e,t){var i,r,s=(null==(i=this._instance)||null==(i=i.persistence)?void 0:i.props[dt])||[];if(mn.SHOWN===e&&t&&s.length>0){var n;Sn.info("survey event matched, removing survey from activated surveys",{event:e,eventPayload:t,existingActivatedSurveys:s});var o=null==t||null==(n=t.properties)?void 0:n.$survey_id;if(o){var a=s.indexOf(o);a>=0&&(s.splice(a,1),this.Wi(s))}}else if(this.Ui.has(e)){Sn.info("survey event name matched",{event:e,eventPayload:t,surveys:this.Ui.get(e)});var l=[];null==(r=this._instance)||r.getSurveys(t=>{l=t.filter(t=>{var i;return null==(i=this.Ui.get(e))?void 0:i.includes(t.id)})});var c=l.filter(i=>{var r,s=null==(r=i.conditions)||null==(r=r.events)||null==(r=r.values)?void 0:r.find(t=>t.name===e);return!!s&&(!s.propertyFilters||Object.entries(s.propertyFilters).every(e=>{var i,[r,s]=e,n=null==t||null==(i=t.properties)?void 0:i[r];if(L(n)||H(n))return!1;var o=[String(n)],a=tn[s.operator];return a?a(s.values,o):(Sn.warn("Unknown property comparison operator: "+s.operator),!1)}))});this.Wi(s.concat(c.map(e=>e.id)||[]))}}onAction(e){var t,i=(null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[dt])||[];this.zi.has(e)&&this.Wi(i.concat(this.zi.get(e)||[]))}Wi(e){var t;Sn.info("updating activated surveys",{activatedSurveys:e}),null==(t=this._instance)||null==(t=t.persistence)||t.register({[dt]:[...new Set(e)]})}getSurveys(){var e;return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[dt])||[]}getEventToSurveys(){return this.Ui}Gi(){return this.qi}}class On{constructor(e){this.Vi=void 0,this._surveyManager=null,this.Ji=!1,this.Ki=!1,this.Yi=[],this._instance=e,this._surveyEventReceiver=null}onRemoteConfig(e){if(!this._instance.config.disable_surveys){var t=e.surveys;if(q(t))return Sn.warn("Flags not loaded yet. Not loading surveys.");var i=A(t);this.Vi=i?t.length>0:t,Sn.info("flags response received, isSurveysEnabled: "+this.Vi),this.loadIfEnabled()}}reset(){localStorage.removeItem("lastSeenSurveyDate");for(var e=[],t=0;t<localStorage.length;t++){var i=localStorage.key(t);(null!=i&&i.startsWith(xn)||null!=i&&i.startsWith("inProgressSurvey_"))&&e.push(i)}e.forEach(e=>localStorage.removeItem(e))}loadIfEnabled(){if(!this._surveyManager)if(this.Ki)Sn.info("Already initializing surveys, skipping...");else if(this._instance.config.disable_surveys)Sn.info("Disabled. Not loading surveys.");else if(this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())Sn.info("Not loading surveys in cookieless mode without consent.");else{var e=null==m?void 0:m.__PosthogExtensions__;if(e){if(!L(this.Vi)||this._instance.config.advanced_enable_surveys){var t=this.Vi||this._instance.config.advanced_enable_surveys;this.Ki=!0;try{var i=e.generateSurveys;if(i)return void this.Xi(i,t);var r=e.loadExternalDependency;if(!r)return void this.Qi("PostHog loadExternalDependency extension not found.");r(this._instance,"surveys",i=>{i||!e.generateSurveys?this.Qi("Could not load surveys script",i):this.Xi(e.generateSurveys,t)})}catch(s){throw this.Qi("Error initializing surveys",s),s}finally{this.Ki=!1}}}else Sn.error("PostHog Extensions not found.")}}Xi(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new $n(this._instance),Sn.info("Surveys loaded successfully"),this.Zi({isLoaded:!0})}Qi(e,t){Sn.error(e,t),this.Zi({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Yi.push(e),this._surveyManager&&this.Zi({isLoaded:!0}),()=>{this.Yi=this.Yi.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this._instance.config.disable_surveys)return Sn.info("Disabled. Not loading surveys."),e([]);var i=this._instance.get_property(ht);if(i&&!t)return e(i,{isLoaded:!0});if(this.Ji)return e([],{isLoaded:!1,error:"Surveys are already being loaded"});try{this.Ji=!0,this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this._instance.config.token),method:"GET",timeout:this._instance.config.surveys_request_timeout_ms,callback:t=>{var i;this.Ji=!1;var r=t.statusCode;if(200!==r||!t.json){var s="Surveys API could not be loaded, status: "+r;return Sn.error(s),e([],{isLoaded:!1,error:s})}var n,o=t.json.surveys||[],a=o.filter(e=>{return!(!(t=e).start_date||t.end_date)&&(function(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}(e)||function(e){var t;return!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length)}(e));var t});return a.length>0&&(null==(n=this._surveyEventReceiver)||n.register(a)),null==(i=this._instance.persistence)||i.register({[ht]:o}),e(o,{isLoaded:!0})}})}catch(r){throw this.Ji=!1,r}}Zi(e){for(var t of this.Yi)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(i){Sn.error("Error in survey callback",i)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!q(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);Sn.warn("init was not called")}te(e){var t=null;return this.getSurveys(i=>{var r;t=null!==(r=i.find(t=>t.id===e))&&void 0!==r?r:null}),t}ie(e){if(q(this._surveyManager))return{eligible:!1,reason:"SDK is not enabled or survey functionality is not yet loaded"};var t="string"==typeof e?this.te(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(q(this._surveyManager))return Sn.warn("init was not called"),{visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"};var t=this.ie(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return q(this._surveyManager)?(Sn.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:"SDK is not enabled or survey functionality is not yet loaded"})):new Promise(i=>{this.getSurveys(t=>{var r,s=null!==(r=t.find(t=>t.id===e))&&void 0!==r?r:null;if(s){var n=this.ie(s);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t){var i;if(q(this._surveyManager))Sn.warn("init was not called");else{var r="string"==typeof e?this.te(e):e;if(null!=r&&r.id)if(Pn.includes(r.type)){var s=null==d?void 0:d.querySelector(t);if(s)return null!=(i=r.appearance)&&i.surveyPopupDelaySeconds?(Sn.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;Sn.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,s),Sn.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,s);Sn.warn("Survey element not found")}else Sn.warn("Surveys of type "+r.type+" cannot be rendered in the app");else Sn.warn("Survey not found")}}displaySurvey(e,t){var i;if(q(this._surveyManager))Sn.warn("init was not called");else{var r=this.te(e);if(r){var s=r;if(null!=(i=r.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(s=E({},r,{appearance:E({},r.appearance,{surveyPopupDelaySeconds:0})})),!1===t.ignoreConditions){var n=this.canRenderSurvey(r);if(!n.visible)return void Sn.warn("Survey is not eligible to be displayed: ",n.disabledReason)}t.displayType!==bn.Inline?this._surveyManager.handlePopoverSurvey(s):this.renderSurvey(s,t.selector)}else Sn.warn("Survey not found")}}}var Fn=Oe("[RateLimiter]");class Cn{constructor(e){var t,i;this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{Fn.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(i){return void Fn.warn('could not rate limit - continuing. Error: "'+(null==i?void 0:i.message)+'"',{text:t})}},this.instance=e,this.captureEventsPerSecond=(null==(t=e.config.rate_limiting)?void 0:t.events_per_second)||10,this.captureEventsBurstLimit=Math.max((null==(i=e.config.rate_limiting)?void 0:i.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond),this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}clientRateLimitContext(e){var t,i,r;void 0===e&&(e=!1);var s=(new Date).getTime(),n=null!==(t=null==(i=this.instance.persistence)?void 0:i.get_property(vt))&&void 0!==t?t:{tokens:this.captureEventsBurstLimit,last:s};n.tokens+=(s-n.last)/1e3*this.captureEventsPerSecond,n.last=s,n.tokens>this.captureEventsBurstLimit&&(n.tokens=this.captureEventsBurstLimit);var o=n.tokens<1;return o||e||(n.tokens=Math.max(0,n.tokens-1)),!o||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+this.captureEventsPerSecond+" events per second and "+this.captureEventsBurstLimit+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=o,null==(r=this.instance.persistence)||r.set_property(vt,n),{isRateLimited:o,remainingTokens:n.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var Rn=Oe("[RemoteConfig]");class An{constructor(e){this._instance=e}get remoteConfig(){var e;return null==(e=m._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.config}ee(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.loadExternalDependency?null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"remote-config",()=>e(this.remoteConfig)):(Rn.error("PostHog Extensions not found. Cannot load remote config."),e())}re(e){this._instance.ci({method:"GET",url:this._instance.requestRouter.endpointFor("assets","/array/"+this._instance.config.token+"/config"),callback:t=>{e(t.json)}})}load(){try{if(this.remoteConfig)return Rn.info("Using preloaded remote config",this.remoteConfig),void this.fi(this.remoteConfig);if(this._instance.M())return void Rn.warn("Remote config is disabled. Falling back to local config.");this.ee(e=>{if(!e)return Rn.info("No config found after loading remote JS config. Falling back to JSON."),void this.re(e=>{this.fi(e)});this.fi(e)})}catch(ii){Rn.error("Error loading remote config",ii)}}fi(e){e?this._instance.config.__preview_remote_config?(this._instance.fi(e),!1!==e.hasFeatureFlags&&this._instance.featureFlags.ensureFlagsLoaded()):Rn.info("__preview_remote_config is disabled. Logging config instead",e):Rn.error("Failed to fetch remote config from PostHog.")}}var Dn=3e3;class Mn{constructor(e,t){this.se=!0,this.ne=[],this.oe=Z((null==t?void 0:t.flush_interval_ms)||Dn,250,5e3,$e.createLogger("flush interval"),Dn),this.ae=e}enqueue(e){this.ne.push(e),this.le||this.ue()}unload(){this.he();var e=this.ne.length>0?this.de():{},t=Object.values(e);[...t.filter(e=>0===e.url.indexOf("/e")),...t.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.ae(E({},e,{transport:"sendBeacon"}))})}enable(){this.se=!1,this.ue()}ue(){var e=this;this.se||(this.le=setTimeout(()=>{if(this.he(),this.ne.length>0){var t=this.de(),i=function(){var i=t[r],s=(new Date).getTime();i.data&&A(i.data)&&De(i.data,e=>{e.offset=Math.abs(e.timestamp-s),delete e.timestamp}),e.ae(i)};for(var r in t)i()}},this.oe))}he(){clearTimeout(this.le),this.le=void 0}de(){var e={};return De(this.ne,t=>{var i,r=t,s=(r?r.batchKey:null)||r.url;L(e[s])&&(e[s]=E({},r,{data:[]})),null==(i=e[s].data)||i.push(r.data)}),this.ne=[],e}}var Nn=["retriesPerformedSoFar"];class Ln{constructor(e){this.ve=!1,this.ce=3e3,this.ne=[],this._instance=e,this.ne=[],this.fe=!0,!L(o)&&"onLine"in o.navigator&&(this.fe=o.navigator.onLine,this.pe=()=>{this.fe=!0,this.Dt()},this.ge=()=>{this.fe=!1},We(o,"online",this.pe),We(o,"offline",this.ge))}get length(){return this.ne.length}retriableRequest(e){var{retriesPerformedSoFar:t}=e,i=S(e,Nn);B(t)&&t>0&&(i.url=Xs(i.url,{retry_count:t})),this._instance.ci(E({},i,{callback:e=>{200!==e.statusCode&&(e.statusCode<400||e.statusCode>=500)&&(null!=t?t:0)<10?this._e(E({retriesPerformedSoFar:t},i)):null==i.callback||i.callback(e)}}))}_e(e){var t=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=t+1;var i,r,s,n,o,a=(i=t,s=(r=3e3*Math.pow(2,i))/2,n=Math.min(18e5,r),o=(Math.random()-.5)*(n-s),Math.ceil(n+o)),l=Date.now()+a;this.ne.push({retryAt:l,requestOptions:e});var c="Enqueued failed request for retry in "+a;navigator.onLine||(c+=" (Browser is offline)"),$e.warn(c),this.ve||(this.ve=!0,this.me())}me(){if(this.ye&&clearTimeout(this.ye),0===this.ne.length)return this.ve=!1,void(this.ye=void 0);this.ye=setTimeout(()=>{this.fe&&this.ne.length>0&&this.Dt(),this.me()},this.ce)}Dt(){var e=Date.now(),t=[],i=this.ne.filter(i=>i.retryAt<e||(t.push(i),!1));if(this.ne=t,i.length>0)for(var{requestOptions:r}of i)this.retriableRequest(r)}unload(){for(var{requestOptions:e}of(this.ye&&(clearTimeout(this.ye),this.ye=void 0),this.ve=!1,L(o)||(this.pe&&(o.removeEventListener("online",this.pe),this.pe=void 0),this.ge&&(o.removeEventListener("offline",this.ge),this.ge=void 0)),this.ne))try{this._instance.ci(E({},e,{transport:"sendBeacon"}))}catch(ii){$e.error(ii)}this.ne=[]}}class jn{constructor(e){this.be=()=>{var e,t,i,r;this.we||(this.we={});var s=this.scrollElement(),n=this.scrollY(),o=s?Math.max(0,s.scrollHeight-s.clientHeight):0,a=n+((null==s?void 0:s.clientHeight)||0),l=(null==s?void 0:s.scrollHeight)||0;this.we.lastScrollY=Math.ceil(n),this.we.maxScrollY=Math.max(n,null!==(e=this.we.maxScrollY)&&void 0!==e?e:0),this.we.maxScrollHeight=Math.max(o,null!==(t=this.we.maxScrollHeight)&&void 0!==t?t:0),this.we.lastContentY=a,this.we.maxContentY=Math.max(a,null!==(i=this.we.maxContentY)&&void 0!==i?i:0),this.we.maxContentHeight=Math.max(l,null!==(r=this.we.maxContentHeight)&&void 0!==r?r:0)},this._instance=e}getContext(){return this.we}resetContext(){var e=this.we;return setTimeout(this.be,0),e}startMeasuringScrollPosition(){We(o,"scroll",this.be,{capture:!0}),We(o,"scrollend",this.be,{capture:!0}),We(o,"resize",this.be)}scrollElement(){if(!this._instance.config.scroll_root_selector)return null==o?void 0:o.document.documentElement;var e=A(this._instance.config.scroll_root_selector)?this._instance.config.scroll_root_selector:[this._instance.config.scroll_root_selector];for(var t of e){var i=null==o?void 0:o.document.querySelector(t);if(i)return i}}scrollY(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollTop||0}return o&&(o.scrollY||o.pageYOffset||o.document.documentElement.scrollTop)||0}scrollX(){if(this._instance.config.scroll_root_selector){var e=this.scrollElement();return e&&e.scrollLeft||0}return o&&(o.scrollX||o.pageXOffset||o.document.documentElement.scrollLeft)||0}}var Un=e=>ss(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties);class Hn{constructor(e,t,i,r){this.xe=e=>{var t=this.Se();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.Ee(this._instance)};this.$e.register({[_t]:i})}},this._instance=e,this.ke=t,this.$e=i,this.Ee=r||Un,this.ke.onSessionId(this.xe)}Se(){return this.$e.props[_t]}getSetOnceProps(){var e,t=null==(e=this.Se())?void 0:e.props;return t?"r"in t?ns(t):{$referring_domain:t.referringDomain,$pathname:t.initialPathName,utm_source:t.utm_source,utm_campaign:t.utm_campaign,utm_medium:t.utm_medium,utm_content:t.utm_content,utm_term:t.utm_term}:{}}getSessionProps(){var e={};return De(He(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+$(i)]=t}),e}}var qn=Oe("[SessionId]");class Bn{on(e,t){return this.Pe.on(e,t)}constructor(e,t,i){var r;if(this.Te=[],this.Re=void 0,this.Pe=new wn,this.Ie=(e,t)=>Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw new Error("SessionIdManager requires a PostHogPersistence instance");if("always"===e.config.cookieless_mode)throw new Error('SessionIdManager cannot be used with cookieless_mode="always"');this.C=e.config,this.$e=e.persistence,this.Ce=void 0,this.Oe=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Fe=t||yi,this.Me=i||yi;var s=this.C.persistence_name||this.C.token,n=this.C.session_idle_timeout_seconds||1800;if(this._sessionTimeoutMs=1e3*Z(n,60,36e3,qn.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Ae(),this.De="ph_"+s+"_window_id",this.je="ph_"+s+"_primary_window_exists",this.Le()){var o=Fi.W(this.De),a=Fi.W(this.je);o&&!a?this.Ce=o:Fi.V(this.De),Fi.G(this.je,!0)}if(null!=(r=this.C.bootstrap)&&r.sessionID)try{var l=(()=>{var e=this.C.bootstrap.sessionID.replace(/-/g,"");if(32!==e.length)throw new Error("Not a valid UUID");if("7"!==e[12])throw new Error("Not a UUIDv7");return parseInt(e.substring(0,12),16)})();this.Ne(this.C.bootstrap.sessionID,(new Date).getTime(),l)}catch(c){qn.error("Invalid sessionID in bootstrap",c)}this.Ue()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return L(this.Te)&&(this.Te=[]),this.Te.push(e),this.Oe&&e(this.Oe,this.Ce),()=>{this.Te=this.Te.filter(t=>t!==e)}}Le(){return"memory"!==this.C.persistence&&!this.$e.wi&&Fi.H()}ze(e){e!==this.Ce&&(this.Ce=e,this.Le()&&Fi.G(this.De,e))}He(){return this.Ce?this.Ce:this.Le()?Fi.W(this.De):null}Ne(e,t,i){e===this.Oe&&t===this._sessionActivityTimestamp&&i===this._sessionStartTimestamp||(this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Oe=e,this.$e.register({[st]:[t,e,i]}))}Be(){if(this.Oe&&this._sessionActivityTimestamp&&this._sessionStartTimestamp)return[this._sessionActivityTimestamp,this.Oe,this._sessionStartTimestamp];var e=this.$e.props[st];return A(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Ne(null,null,null)}destroy(){clearTimeout(this.qe),this.qe=void 0,this.Re&&o&&(o.removeEventListener("beforeunload",this.Re,{capture:!1}),this.Re=void 0),this.Te=[]}Ue(){this.Re=()=>{this.Le()&&Fi.V(this.je)},We(o,"beforeunload",this.Re,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),"always"===this.C.cookieless_mode)throw new Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),[r,s,n]=this.Be(),o=this.He(),a=B(n)&&n>0&&Math.abs(i-n)>864e5,l=!1,c=!s,u=!e&&this.Ie(i,r);c||u||a?(s=this.Fe(),o=this.Me(),qn.info("new session ID generated",{sessionId:s,windowId:o,changeReason:{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}}),n=i,l=!0):o||(o=this.Me(),l=!0);var h=0===r||!e||a?i:r,d=0===n?(new Date).getTime():n;return this.ze(o),this.Ne(s,h,d),e||this.Ae(),l&&this.Te.forEach(e=>e(s,o,l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0)),{sessionId:s,windowId:o,sessionStartTimestamp:d,changeReason:l?{noSessionId:c,activityTimeout:u,sessionPastMaximumLength:a}:void 0,lastActivityTimestamp:r}}Ae(){clearTimeout(this.qe),this.qe=setTimeout(()=>{var[e]=this.Be();if(this.Ie((new Date).getTime(),e)){var t=this.Oe;this.resetSessionId(),this.Pe.emit("forcedIdleReset",{idleSessionId:t})}},1.1*this.sessionTimeoutMs)}}var Gn=["$set_once","$set"],Wn=Oe("[SiteApps]");class Vn{constructor(e){this._instance=e,this.We=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ge(e,t){if(t){var i=this.globalsForEvent(t);this.We.push(i),this.We.length>1e3&&(this.We=this.We.slice(10))}}get siteAppLoaders(){var e;return null==(e=m._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}init(){if(this.isEnabled){var e=this._instance.Mi(this.Ge.bind(this));this.Ve=()=>{e(),this.We=[],this.Ve=void 0}}}globalsForEvent(e){var t,i,r,s,n,o,a;if(!e)throw new Error("Event payload is required");var l={},c=this._instance.get_property("$groups")||[],u=this._instance.get_property("$stored_group_properties")||{};for(var[h,d]of Object.entries(u))l[h]={id:c[h],type:h,properties:d};var{$set_once:p,$set:g}=e;return{event:E({},S(e,Gn),{properties:E({},e.properties,g?{$set:E({},null!==(t=null==(i=e.properties)?void 0:i.$set)&&void 0!==t?t:{},g)}:{},p?{$set_once:E({},null!==(r=null==(s=e.properties)?void 0:s.$set_once)&&void 0!==r?r:{},p)}:{}),elements_chain:null!==(n=null==(o=e.properties)?void 0:o.$elements_chain)&&void 0!==n?n:"",distinct_id:null==(a=e.properties)?void 0:a.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.We.length&&(Wn.info("Processing "+this.We.length+" events for site app with id "+e.id),this.We.forEach(e=>null==t.processEvent?void 0:t.processEvent(e)),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.Ve)||i.call(this))},r=!1,s=s=>{t.errored=!s,t.loaded=!0,Wn.info("Site app with id "+e.id+" "+(s?"loaded":"errored")),r&&i()};try{var{processEvent:n}=e.init({posthog:this._instance,callback:e=>{s(e)}});n&&(t.processEvent=n),r=!0}catch(o){Wn.error("Error while initializing PostHog app with config id "+e.id,o),s(!1)}if(r&&t.loaded)try{i()}catch(a){Wn.error("Error while processing buffered events PostHog app with config id "+e.id,a),t.errored=!0}}Je(){var e=this.siteAppLoaders||[];for(var t of e)this.apps[t.id]={id:t.id,loaded:!1,errored:!1,processedBuffer:!1};for(var i of e)this.setupSiteApp(i)}Ke(e){if(0!==Object.keys(this.apps).length){var t=this.globalsForEvent(e);for(var i of Object.values(this.apps))try{null==i.processEvent||i.processEvent(t)}catch(r){Wn.error("Error while processing event "+e.event+" for site app "+i.id,r)}}}onRemoteConfig(e){var t,i,r,s=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Je(),void this._instance.on("eventCaptured",e=>this.Ke(e))):void Wn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Ve)||i.call(this),null!=(r=e.siteApps)&&r.length)if(this.isEnabled){var n=function(e){var t;m["__$$ph_site_app_"+e]=s._instance,null==(t=m.__PosthogExtensions__)||null==t.loadSiteApp||t.loadSiteApp(s._instance,a,t=>{if(t)return Wn.error("Error while initializing PostHog app with config id "+e,t)})};for(var{id:o,url:a}of e.siteApps)n(o)}else Wn.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}var zn=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&k(i,t))return!0;try{var r=null==e?void 0:e.userAgentData;if(null!=r&&r.brands&&r.brands.some(e=>k(null==e?void 0:e.brand,t)))return!0}catch(s){}return!!e.webdriver},Yn=function(e){return e.US="us",e.EU="eu",e.CUSTOM="custom",e}({}),Xn="i.posthog.com";class Jn{constructor(e){this.Ye={},this.instance=e}get apiHost(){var e=this.instance.config.api_host.trim().replace(/\/$/,"");return"https://app.posthog.com"===e?"https://us.i.posthog.com":e}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+Xn,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Ye[this.apiHost]||(/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ye[this.apiHost]=Yn.US:/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?this.Ye[this.apiHost]=Yn.EU:this.Ye[this.apiHost]=Yn.CUSTOM),this.Ye[this.apiHost]}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if(this.region===Yn.CUSTOM)return this.apiHost+t;var i=Xn+t;switch(e){case"assets":return"https://"+this.region+"-assets."+i;case"api":return"https://"+this.region+"."+i}}}var Kn={icontains:(e,t)=>!!o&&t.href.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>!!o&&-1===t.href.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>!!o&&Qs(t.href,e),not_regex:(e,t)=>!!o&&!Qs(t.href,e),exact:(e,t)=>t.href===e,is_not:(e,t)=>t.href!==e};class Zn{constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{Zn.Xe("retrieved web experiments from the server"),t.Qe=new Map,e.forEach(e=>{if(e.feature_flag_key){var i;t.Qe&&(Zn.Xe("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Qe)||i.set(e.feature_flag_key,e));var r=t._instance.getFeatureFlag(e.feature_flag_key);j(r)&&e.variants[r]&&t.Ze(e.name,r,e.variants[r].transforms)}else if(e.variants)for(var s in e.variants){var n=e.variants[s];Zn.tr(n)&&t.Ze(e.name,s,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}onFeatureFlags(e){if(this._is_bot())Zn.Xe("Refusing to render web experiment since the viewer is a likely bot");else if(!this._instance.config.disable_web_experiments){if(q(this.Qe))return this.Qe=new Map,this.loadIfEnabled(),void this.previewWebExperiment();Zn.Xe("applying feature flags",e),e.forEach(e=>{var t;if(this.Qe&&null!=(t=this.Qe)&&t.has(e)){var i,r=this._instance.getFeatureFlag(e),s=null==(i=this.Qe)?void 0:i.get(e);r&&null!=s&&s.variants[r]&&this.Ze(s.name,r,s.variants[r].transforms)}})}}previewWebExperiment(){var e=Zn.getWindowLocation();if(null!=e&&e.search){var t=oi(null==e?void 0:e.search,"__experiment_id"),i=oi(null==e?void 0:e.search,"__experiment_variant");t&&i&&(Zn.Xe("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.ir(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this._instance.config.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this._instance.config.disable_web_experiments&&!i)return e([]);var r=this._instance.get_property("$web_experiments");if(r&&!t)return e(r);this._instance.ci({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this._instance.config.token),method:"GET",callback:t=>{if(200!==t.statusCode||!t.json)return e([]);var i=t.json.experiments||[];return e(i)}})}ir(e,t,i){var r=i.filter(t=>t.id===e);r&&r.length>0&&(Zn.Xe("Previewing web experiment ["+r[0].name+"] with variant ["+t+"]"),this.Ze(r[0].name,t,r[0].variants[t].transforms))}static tr(e){return!q(e.conditions)&&Zn.er(e)&&Zn.rr(e)}static er(e){var t;if(q(e.conditions)||q(null==(t=e.conditions)?void 0:t.url))return!0;var i,r,s,n=Zn.getWindowLocation();return!!n&&(null==(i=e.conditions)||!i.url||Kn[null!==(r=null==(s=e.conditions)?void 0:s.urlMatchType)&&void 0!==r?r:"icontains"](e.conditions.url,n))}static getWindowLocation(){return null==o?void 0:o.location}static rr(e){var t;if(q(e.conditions)||q(null==(t=e.conditions)?void 0:t.utm))return!0;var i=Qr();if(i.utm_source){var r,s,n,o,a,l,c,u,h=null==(r=e.conditions)||null==(r=r.utm)||!r.utm_campaign||(null==(s=e.conditions)||null==(s=s.utm)?void 0:s.utm_campaign)==i.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(o=e.conditions)||null==(o=o.utm)?void 0:o.utm_source)==i.utm_source,p=null==(a=e.conditions)||null==(a=a.utm)||!a.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==i.utm_medium,g=null==(c=e.conditions)||null==(c=c.utm)||!c.utm_term||(null==(u=e.conditions)||null==(u=u.utm)?void 0:u.utm_term)==i.utm_term;return h&&p&&g&&d}return!1}static Xe(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),r=1;r<t;r++)i[r-1]=arguments[r];$e.info("[WebExperiments] "+e,i)}Ze(e,t,i){this._is_bot()?Zn.Xe("Refusing to render web experiment since the viewer is a likely bot"):"control"!==t?i.forEach(i=>{if(i.selector){var r;Zn.Xe("applying transform of variant "+t+" for experiment "+e+" ",i);var s=null==(r=document)?void 0:r.querySelectorAll(i.selector);null==s||s.forEach(e=>{var t=e;i.html&&(t.innerHTML=i.html),i.css&&t.setAttribute("style",i.css)})}}):Zn.Xe("Control variants leave the page unmodified.")}_is_bot(){return h&&this._instance?zn(h,this._instance.config.custom_blocked_useragents):void 0}}var Qn=Oe("[PostHog ExternalIntegrations]"),eo={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class to{constructor(e){this._instance=e}it(e,t){var i;null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return Qn.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e=this,t=function(t){var i,s,n;!r||null!=(i=m.__PosthogExtensions__)&&null!=(i=i.integrations)&&i[t]||e.it(eo[t],()=>{var i;null==(i=m.__PosthogExtensions__)||null==(i=i.integrations)||null==(i=i[t])||i.start(e._instance)}),!r&&null!=(s=m.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[t]&&(null==(n=m.__PosthogExtensions__)||null==(n=n.integrations)||null==(n=n[t])||n.stop())};for(var[i,r]of Object.entries(null!==(s=this._instance.config.integrations)&&void 0!==s?s:{})){var s;t(i)}}}var io="[SessionRecording]",ro=Oe(io);class so{get started(){var e;return!(null==(e=this.sr)||!e.isStarted)}get status(){return this.sr?this.sr.status:this.nr&&!this.ar?"disabled":"lazy_loading"}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.nr=!1,this.lr=void 0,this._instance=e,!this._instance.sessionManager)throw ro.error("started without valid sessionManager"),new Error(io+" started without valid sessionManager. This is a bug.");if("always"===this._instance.config.cookieless_mode)throw new Error(io+' cannot be used with cookieless_mode="always"')}get ar(){var e,t=!(null==(e=this._instance.get_property(rt))||!e.enabled),i=!this._instance.config.disable_session_recording,r=this._instance.config.disable_session_recording||this._instance.consent.isOptedOut();return o&&t&&i&&!r}startIfEnabledOrStop(e){var t;if(!this.ar||null==(t=this.sr)||!t.isStarted){var i=!L(Object.assign)&&!L(Array.from);this.ar&&i?(this.ur(e),ro.info("starting")):this.stopRecording()}}ur(e){var t,i,r;this.ar&&(null!=m&&null!=(t=m.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=m.__PosthogExtensions__)&&i.initSessionRecording?this.hr(e):null==(r=m.__PosthogExtensions__)||null==r.loadExternalDependency||r.loadExternalDependency(this._instance,this.dr,t=>{if(t)return ro.error("could not load recorder",t);this.hr(e)}))}stopRecording(){var e,t;null==(e=this.lr)||e.call(this),this.lr=void 0,null==(t=this.sr)||t.stop()}vr(){var e;null==(e=this._instance.persistence)||e.unregister(nt)}cr(e){if(this._instance.persistence){var t,i,r=this._instance.persistence,s=()=>{var t=!1===e.sessionRecording?void 0:e.sessionRecording,i=null==t?void 0:t.sampleRate,s=q(i)?null:parseFloat(i);q(s)&&this.vr();var n=null==t?void 0:t.minimumDurationMilliseconds;r.register({[rt]:E({enabled:!!t},t,{networkPayloadCapture:E({capturePerformance:e.capturePerformance},null==t?void 0:t.networkPayloadCapture),canvasRecording:{enabled:null==t?void 0:t.recordCanvas,fps:null==t?void 0:t.canvasFps,quality:null==t?void 0:t.canvasQuality},sampleRate:s,minimumDurationMilliseconds:L(n)?null:n,endpoint:null==t?void 0:t.endpoint,triggerMatchType:null==t?void 0:t.triggerMatchType,masking:null==t?void 0:t.masking,urlTriggers:null==t?void 0:t.urlTriggers})})};s(),null==(t=this.lr)||t.call(this),this.lr=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(s)}}onRemoteConfig(e){"sessionRecording"in e?!1!==e.sessionRecording?(this.cr(e),this.nr=!0,this.startIfEnabledOrStop()):this.nr=!0:ro.info("skipping remote config with no sessionRecording",e)}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.sr)&&i.log?this.sr.log(e,t):ro.warn("log called before recorder was ready")}get dr(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(rt);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}hr(e){var t,i;if(null==(t=m.__PosthogExtensions__)||!t.initSessionRecording)throw Error("Called on script loaded before session recording is available");this.sr||(this.sr=null==(i=m.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.sr._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),this.sr.start(e)}onRRwebEmit(e){var t;null==(t=this.sr)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e;null==(e=this.sr)||e.overrideLinkedFlag()}overrideSampling(){var e;null==(e=this.sr)||e.overrideSampling()}overrideTrigger(e){var t;null==(t=this.sr)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.sr)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.sr)||!i.tryAddCustomEvent(e,t))}}var no={},oo=()=>{},ao="posthog",lo=!zs&&-1===(null==f?void 0:f.indexOf("MSIE"))&&-1===(null==f?void 0:f.indexOf("Mozilla")),co=e=>{var t;return{api_host:"https://us.i.posthog.com",ui_host:null,token:"",autocapture:!0,rageclick:!0,cross_subdomain_cookie:Be(null==d?void 0:d.location),persistence:"localStorage+cookie",persistence_name:"",loaded:oo,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageview:"2025-05-24"!==e||"history_change",capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",debug:p&&j(null==p?void 0:p.search)&&-1!==p.search.indexOf("__posthog_debug=true")||!1,cookie_expiration:365,upgrade:!1,disable_session_recording:!1,disable_persistence:!1,disable_web_experiments:!0,disable_surveys:!1,disable_surveys_automatic_display:!1,disable_external_dependency_loading:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==o||null==(t=o.location)?void 0:t.protocol),ip:!1,opt_out_capturing_by_default:!1,opt_out_persistence_by_default:!1,opt_out_useragent_filter:!1,opt_out_capturing_persistence_type:"localStorage",consent_persistence_name:null,opt_out_capturing_cookie_prefix:null,opt_in_site_apps:!1,property_denylist:[],respect_dnt:!1,sanitize_properties:null,request_headers:{},request_batching:!0,properties_string_max_length:65535,session_recording:{},mask_all_element_attributes:!1,mask_all_text:!1,mask_personal_data_properties:!1,custom_personal_data_properties:[],advanced_disable_flags:!1,advanced_disable_decide:!1,advanced_disable_feature_flags:!1,advanced_disable_feature_flags_on_first_load:!1,advanced_only_evaluate_survey_feature_flags:!1,advanced_enable_surveys:!1,advanced_disable_toolbar_metrics:!1,feature_flag_request_timeout_ms:3e3,surveys_request_timeout_ms:1e4,on_request_error:e=>{var t="Bad HTTP status: "+e.statusCode+" "+e.text;$e.error(t)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:"identified_only",before_send:void 0,request_queue_config:{flush_interval_ms:Dn},error_tracking:{},_onCapture:oo,__preview_eager_load_replay:!1}},uo=e=>{var t={};L(e.process_person)||(t.person_profiles=e.process_person),L(e.xhr_headers)||(t.request_headers=e.xhr_headers),L(e.cookie_name)||(t.persistence_name=e.cookie_name),L(e.disable_cookie)||(t.disable_persistence=e.disable_cookie),L(e.store_google)||(t.save_campaign_params=e.store_google),L(e.verbose)||(t.debug=e.verbose);var i=Me({},t,e);return A(e.property_blacklist)&&(L(e.property_denylist)?i.property_denylist=e.property_blacklist:A(e.property_denylist)?i.property_denylist=[...e.property_blacklist,...e.property_denylist]:$e.error("Invalid value for property_denylist config: "+e.property_denylist)),i};class ho{constructor(){this.__forceAllowLocalhost=!1}get pr(){return this.__forceAllowLocalhost}set pr(e){$e.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class po{get decideEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}get flagsEndpointWasHit(){var e,t;return null!==(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&void 0!==e&&e}constructor(){this.webPerformance=new ho,this.gr=!1,this.version=y.LIB_VERSION,this._r=new wn,this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=co(),this.SentryIntegration=Wi,this.sentryIntegration=e=>{return t=Gi(this,e),{name:Bi,processEvent:e=>t(e)};var t},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.mr=!1,this.yr=null,this.br=null,this.wr=null,this.featureFlags=new gn(this),this.toolbar=new Ji(this),this.scrollManager=new jn(this),this.pageViewManager=new gs(this),this.surveys=new On(this),this.experiments=new Zn(this),this.exceptions=new nn(this),this.rateLimiter=new Cn(this),this.requestRouter=new Jn(this),this.consent=new Ri(this),this.externalIntegrations=new to(this),this.people={set:(e,t,i)=>{var r=j(e)?{[e]:t}:e;this.setPersonProperties(r),null==i||i({})},set_once:(e,t,i)=>{var r=j(e)?{[e]:t}:e;this.setPersonProperties(void 0,r),null==i||i({})}},this.on("eventCaptured",e=>$e.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==ao){var r,s=null!==(r=no[i])&&void 0!==r?r:new po;return s._init(e,t,i),no[i]=s,no[ao][i]=s,s}return this._init(e,t,i)}_init(e,t,i){var r,s;if(void 0===t&&(t={}),L(e)||U(e))return $e.critical("PostHog was initialized without a token. This likely indicates a misconfiguration. Please check the first argument passed to posthog.init()"),this;if(this.__loaded)return console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config={},t.debug=this.Sr(t.debug),this.Er=t,this.$r=[],t.person_profiles&&(this.br=t.person_profiles),this.set_config(Me({},co(t.defaults),uo(t),{name:i,token:e})),this.config.on_xhr_error&&$e.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:si.GZipJS;var n=this.kr();this.persistence=new vn(this.config,n),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new vn(E({},this.config,{persistence:"sessionStorage"}),n);var a=E({},this.persistence.props),l=E({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.Pr=new Mn(e=>this.Tr(e),this.config.request_queue_config),this.Rr=new Ln(this),this.__request_queue=[];var c="always"===this.config.cookieless_mode||"on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut();if(c||(this.sessionManager=new Bn(this),this.sessionPropsManager=new Hn(this,this.sessionManager,this.persistence)),new Zi(this).startIfEnabledOrStop(),this.siteApps=new Vn(this),null==(r=this.siteApps)||r.init(),c||(this.sessionRecording=new so(this),this.sessionRecording.startIfEnabledOrStop()),this.config.disable_scroll_properties||this.scrollManager.startMeasuringScrollPosition(),this.autocapture=new di(this),this.autocapture.startIfEnabled(),this.surveys.loadIfEnabled(),this.heatmaps=new ps(this),this.heatmaps.startIfEnabled(),this.webVitalsAutocapture=new us(this),this.exceptionObserver=new ji(this),this.exceptionObserver.startIfEnabled(),this.deadClicksAutocapture=new Ni(this,Mi),this.deadClicksAutocapture.startIfEnabled(),this.historyAutocapture=new Hi(this),this.historyAutocapture.startIfEnabled(),y.DEBUG=y.DEBUG||this.config.debug,y.DEBUG&&$e.info("Starting in debug mode",{this:this,config:t,thisC:E({},this.config),p:a,s:l}),void 0!==(null==(s=t.bootstrap)?void 0:s.distinctID)){var u,h,d=this.config.get_device_id(yi()),p=null!=(u=t.bootstrap)&&u.isIdentifiedID?d:t.bootstrap.distinctID;this.persistence.set_property(gt,null!=(h=t.bootstrap)&&h.isIdentifiedID?"identified":"anonymous"),this.register({distinct_id:t.bootstrap.distinctID,$device_id:p})}if(this.Ir()){var g,_,v=Object.keys((null==(g=t.bootstrap)?void 0:g.featureFlags)||{}).filter(e=>{var i;return!(null==(i=t.bootstrap)||null==(i=i.featureFlags)||!i[e])}).reduce((e,i)=>{var r;return e[i]=(null==(r=t.bootstrap)||null==(r=r.featureFlags)?void 0:r[i])||!1,e},{}),f=Object.keys((null==(_=t.bootstrap)?void 0:_.featureFlagPayloads)||{}).filter(e=>v[e]).reduce((e,i)=>{var r,s;return null!=(r=t.bootstrap)&&null!=(r=r.featureFlagPayloads)&&r[i]&&(e[i]=null==(s=t.bootstrap)||null==(s=s.featureFlagPayloads)?void 0:s[i]),e},{});this.featureFlags.receivedFeatureFlags({featureFlags:v,featureFlagPayloads:f})}if(c)this.register_once({distinct_id:Et,$device_id:null},"");else if(!this.get_distinct_id()){var m=this.config.get_device_id(yi());this.register_once({distinct_id:m,$device_id:m},""),this.persistence.set_property(gt,"anonymous")}return We(o,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),this.toolbar.maybeLoadToolbar(),t.segment?function(e,t){var i=e.config.segment;if(!i)return t();!function(e,t){var i=e.config.segment;if(!i)return t();var r=i=>{var r=()=>i.anonymousId()||yi();e.config.get_device_id=r,i.id()&&(e.register({distinct_id:i.id(),$device_id:r()}),e.persistence.set_property(gt,"identified")),t()},s=i.user();"then"in s&&D(s.then)?s.then(e=>r(e)):r(s)}(e,()=>{i.register((e=>{Promise&&Promise.resolve||qi.warn("This browser does not have Promise support, and can not use the segment integration");var t=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(qi.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(qi.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var r=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},r,t.event.properties),t};return{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>t(e,e.event.event),page:e=>t(e,"$pageview"),identify:e=>t(e,"$identify"),screen:e=>t(e,"$screen")}})(e)).then(()=>{t()})})}(this,()=>this.Cr()):this.Cr(),D(this.config._onCapture)&&this.config._onCapture!==oo&&($e.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&$e.warn('The `ip` config option has NO EFFECT AT ALL and has been deprecated. Use a custom transformation or "Discard IP data" project setting instead. See https://posthog.com/tutorials/web-redact-properties#hiding-customer-ip-address for more information.'),this}fi(e){var t,i,r,s,n,o,a,l;if(!d||!d.body)return $e.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.fi(e)},500);this.compression=void 0,e.supportedCompression&&!this.config.disable_compression&&(this.compression=P(e.supportedCompression,si.GZipJS)?si.GZipJS:P(e.supportedCompression,si.Base64)?si.Base64:void 0),null!=(t=e.analytics)&&t.endpoint&&(this.analyticsDefaultEndpoint=e.analytics.endpoint),this.set_config({person_profiles:this.br?this.br:"identified_only"}),null==(i=this.siteApps)||i.onRemoteConfig(e),null==(r=this.sessionRecording)||r.onRemoteConfig(e),null==(s=this.autocapture)||s.onRemoteConfig(e),null==(n=this.heatmaps)||n.onRemoteConfig(e),this.surveys.onRemoteConfig(e),null==(o=this.webVitalsAutocapture)||o.onRemoteConfig(e),null==(a=this.exceptionObserver)||a.onRemoteConfig(e),this.exceptions.onRemoteConfig(e),null==(l=this.deadClicksAutocapture)||l.onRemoteConfig(e)}Cr(){try{this.config.loaded(this)}catch(ii){$e.critical("`loaded` function failed",ii)}this.Or(),this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||"always"===this.config.cookieless_mode)&&this.Fr()},1),new An(this).load(),this.featureFlags.flags()}Or(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.Pr)||e.enable())}_dom_loaded(){this.is_capturing()&&Ae(this.__request_queue,e=>this.Tr(e)),this.__request_queue=[],this.Or()}_handle_unload(){var e,t;this.config.request_batching?(this.Mr()&&this.capture("$pageleave"),null==(e=this.Pr)||e.unload(),null==(t=this.Rr)||t.unload()):this.Mr()&&this.capture("$pageleave",null,{transport:"sendBeacon"})}ci(e){this.__loaded&&(lo?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)||(e.transport=e.transport||this.config.api_transport,e.url=Xs(e.url,{ip:this.config.ip?1:0}),e.headers=E({},this.config.request_headers),e.compression="best-available"===e.compression?this.compression:e.compression,e.disableXHRCredentials=this.config.__preview_disable_xhr_credentials,this.config.__preview_disable_beacon&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,r,s=E({},e);s.timeout=s.timeout||6e4,s.url=Xs(s.url,{_:(new Date).getTime().toString(),ver:y.LIB_VERSION,compression:s.compression});var n=null!==(t=s.transport)&&void 0!==t?t:"fetch",o=Zs.filter(e=>!s.disableTransport||!e.transport||!s.disableTransport.includes(e.transport)),a=null!==(i=null==(r=Ge(o,e=>e.transport===n))?void 0:r.method)&&void 0!==i?i:o[0].method;if(!a)throw new Error("No available transport method");a(s)})(E({},e,{callback:t=>{var i,r;this.rateLimiter.checkForLimiting(t),t.statusCode>=400&&(null==(i=(r=this.config).on_request_error)||i.call(r,t)),null==e.callback||e.callback(t)}}))))}Tr(e){this.Rr?this.Rr.retriableRequest(e):this.ci(e)}_execute_array(e){var t,i=[],r=[],s=[];Ae(e,e=>{e&&(t=e[0],A(t)?s.push(e):D(e)?e.call(this):A(e)&&"alias"===t?i.push(e):A(e)&&-1!==t.indexOf("capture")&&D(this[t])?s.push(e):r.push(e))});var n=function(e,t){Ae(e,function(e){if(A(e[0])){var i=t;De(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else this[e[0]].apply(this,e.slice(1))},t)};n(i,this),n(r,this),n(s,this)}Ir(){var e,t;return(null==(e=this.config.bootstrap)?void 0:e.featureFlags)&&Object.keys(null==(t=this.config.bootstrap)?void 0:t.featureFlags).length>0||!1}push(e){this._execute_array([e])}capture(e,t,i){var r;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.Pr){if(this.is_capturing())if(!L(e)&&j(e)){var s=!this.config.opt_out_useragent_filter&&this._is_bot();if(!s||this.config.__preview_capture_bot_pageviews){var n=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==n||!n.isRateLimited){null!=t&&t.$current_url&&!j(null==t?void 0:t.$current_url)&&($e.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==t||delete t.$current_url),this.sessionPersistence.update_search_keyword(),this.config.save_campaign_params&&this.sessionPersistence.update_campaign_params(),this.config.save_referrer&&this.sessionPersistence.update_referrer_info(),(this.config.save_campaign_params||this.config.save_referrer)&&this.persistence.set_initial_person_info();var o=new Date,a=(null==i?void 0:i.timestamp)||o,l=yi(),c={uuid:l,event:e,properties:this.calculateEventProperties(e,t||{},a,l)};"$pageview"===e&&this.config.__preview_capture_bot_pageviews&&s&&(c.event="$bot_pageview",c.properties.$browser_type="bot"),n&&(c.properties.$lib_rate_limit_remaining_tokens=n.remainingTokens),(null==i?void 0:i.$set)&&(c.$set=null==i?void 0:i.$set);var u,h=this.Ar(null==i?void 0:i.$set_once);if(h&&(c.$set_once=h),(c=function(e,t){return i=e,r=e=>j(e)&&!H(t)?e.slice(0,t):e,s=new Set,function e(t,i){return t!==Object(t)?r?r(t):t:s.has(t)?void 0:(s.add(t),A(t)?(n=[],Ae(t,t=>{n.push(e(t))})):(n={},De(t,(t,i)=>{s.has(t)||(n[i]=e(t))})),n);var n}(i);var i,r,s}(c,null!=i&&i._noTruncate?null:this.config.properties_string_max_length)).timestamp=a,L(null==i?void 0:i.timestamp)||(c.properties.$event_time_override_provided=!0,c.properties.$event_time_override_system_time=o),e===mn.DISMISSED||e===mn.SENT){var d=null==t?void 0:t[yn.SURVEY_ID],p=null==t?void 0:t[yn.SURVEY_ITERATION];u={id:d,current_iteration:p},localStorage.getItem(In(u))||localStorage.setItem(In(u),"true"),c.$set=E({},c.$set,{[kn({id:d,current_iteration:p},e===mn.SENT?"responded":"dismissed")]:!0})}var g=E({},c.properties.$set,c.$set);if(N(g)||this.setPersonPropertiesForFlags(g),!q(this.config.before_send)){var _=this.Dr(c);if(!_)return;c=_}this._r.emit("eventCaptured",c);var v={method:"POST",url:null!==(r=null==i?void 0:i._url)&&void 0!==r?r:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),data:c,compression:"best-available",batchKey:null==i?void 0:i._batchKey};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.Tr(v):this.Pr.enqueue(v),c}$e.critical("This capture call is ignored due to client rate limiting.")}}else $e.error("No event name provided to posthog.capture")}else $e.uninitializedWarning("posthog.capture")}Mi(e){return this.on("eventCaptured",t=>e(t.event,t))}calculateEventProperties(e,t,i,r,s){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n=s?void 0:this.persistence.remove_event_timer(e),a=E({},t);if(a.token=this.config.token,a.$config_defaults=this.config.defaults,("always"==this.config.cookieless_mode||"on_reject"==this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut())&&(a.$cookieless_mode=!0),"$snapshot"===e){var l=E({},this.persistence.properties(),this.sessionPersistence.properties());return a.distinct_id=l.distinct_id,(!j(a.distinct_id)&&!B(a.distinct_id)||U(a.distinct_id))&&$e.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),a}var c,u=function(e,t){if(!f)return{};var i,r,s,n=e?Ne([],Xr,t||[]):[],[a,l]=function(e){for(var t=0;t<Vr.length;t++){var[i,r]=Vr[t],s=i.exec(e),n=s&&(D(r)?r(s,e):r);if(n)return n}return["",""]}(f);return Me(He({$os:a,$os_version:l,$browser:Br(f,navigator.vendor),$device:zr(f),$device_type:(r=f,s=zr(r),s===sr||s===rr||"Kobo"===s||"Kindle Fire"===s||s===Ar?ir:s===Sr||s===kr||s===xr||s===Fr?"Console":s===or?"Wearable":s?Qi:"Desktop"),$timezone:os(),$timezone_offset:as()}),{$current_url:ai(null==p?void 0:p.href,n,Kr),$host:null==p?void 0:p.host,$pathname:null==p?void 0:p.pathname,$raw_user_agent:f.length>1e3?f.substring(0,997)+"...":f,$browser_version:Wr(f,navigator.vendor),$browser_language:is(),$browser_language_prefix:(i=is(),"string"==typeof i?i.split("-")[0]:void 0),$screen_height:null==o?void 0:o.screen.height,$screen_width:null==o?void 0:o.screen.width,$viewport_height:null==o?void 0:o.innerHeight,$viewport_width:null==o?void 0:o.innerWidth,$lib:"web",$lib_version:y.LIB_VERSION,$insert_id:Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10),$time:Date.now()/1e3})}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties);if(this.sessionManager){var{sessionId:h,windowId:g}=this.sessionManager.checkAndGetSessionAndWindowId(s,i.getTime());a.$session_id=h,a.$window_id=g}this.sessionPropsManager&&Me(a,this.sessionPropsManager.getSessionProps());try{var _;this.sessionRecording&&Me(a,this.sessionRecording.sdkDebugProperties),a.$sdk_debug_retry_queue_size=null==(_=this.Rr)?void 0:_.length}catch(w){a.$sdk_debug_error_capturing_properties=String(w)}if(this.requestRouter.region===Yn.CUSTOM&&(a.$lib_custom_api_host=this.config.api_host),c="$pageview"!==e||s?"$pageleave"!==e||s?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,r),a=Me(a,c),"$pageview"===e&&d&&(a.title=d.title),!L(n)){var v=i.getTime()-n;a.$duration=parseFloat((v/1e3).toFixed(3))}f&&this.config.opt_out_useragent_filter&&(a.$browser_type=this._is_bot()?"bot":"browser"),(a=Me({},u,this.persistence.properties(),this.sessionPersistence.properties(),a)).$is_identified=this._isIdentified(),A(this.config.property_denylist)?De(this.config.property_denylist,function(e){delete a[e]}):$e.error("Invalid value for property_denylist config: "+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var m=this.config.sanitize_properties;m&&($e.error("sanitize_properties is deprecated. Use before_send instead"),a=m(a,e));var b=this.jr();return a.$process_person_profile=b,b&&!s&&this.Lr("_calculate_event_properties"),a}Ar(e){var t;if(!this.persistence||!this.jr())return e;if(this.gr)return e;var i=this.persistence.get_initial_props(),r=null==(t=this.sessionPropsManager)?void 0:t.getSetOnceProps(),s=Me({},i,r||{},e||{}),n=this.config.sanitize_properties;return n&&($e.error("sanitize_properties is deprecated. Use before_send instead"),s=n(s,"$set_once")),this.gr=!0,N(s)?void 0:s}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var r;null==(r=this.persistence)||r.register_once(e,t,i)}register_for_session(e){var t;null==(t=this.sessionPersistence)||t.register(e)}unregister(e){var t;null==(t=this.persistence)||t.unregister(e)}unregister_for_session(e){var t;null==(t=this.sessionPersistence)||t.unregister(e)}Nr(e,t){this.register({[e]:t})}getFeatureFlag(e,t){return this.featureFlags.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t=this.featureFlags.getFeatureFlagPayload(e);try{return JSON.parse(t)}catch(i){return t}}isFeatureEnabled(e,t){return this.featureFlags.isFeatureEnabled(e,t)}reloadFeatureFlags(){this.featureFlags.reloadFeatureFlags()}updateEarlyAccessFeatureEnrollment(e,t,i){this.featureFlags.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){return void 0===t&&(t=!1),this.featureFlags.getEarlyAccessFeatures(e,t,i)}on(e,t){return this._r.on(e,t)}onFeatureFlags(e){return this.featureFlags.onFeatureFlags(e)}onSurveysLoaded(e){return this.surveys.onSurveysLoaded(e)}onSessionId(e){var t,i;return null!==(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))&&void 0!==t?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys.getSurveys(e,t)}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys.getActiveMatchingSurveys(e,t)}renderSurvey(e,t){this.surveys.renderSurvey(e,t)}displaySurvey(e,t){void 0===t&&(t=Tn),this.surveys.displaySurvey(e,t)}canRenderSurvey(e){return this.surveys.canRenderSurvey(e)}canRenderSurveyAsync(e,t){return void 0===t&&(t=!1),this.surveys.canRenderSurveyAsync(e,t)}identify(e,t,i){if(!this.__loaded||!this.persistence)return $e.uninitializedWarning("posthog.identify");if(B(e)&&(e=e.toString(),$e.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),e)if(["distinct_id","distinctid"].includes(e.toLowerCase()))$e.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and not a hardcoded string.');else if(e!==Et){if(this.Lr("posthog.identify")){var r=this.get_distinct_id();if(this.register({$user_id:e}),!this.get_property("$device_id")){var s=r;this.register_once({$had_persisted_distinct_id:!0,$device_id:s},"")}e!==r&&e!==this.get_property(ze)&&(this.unregister(ze),this.register({distinct_id:e}));var n="anonymous"===(this.persistence.get_property(gt)||"anonymous");e!==r&&n?(this.persistence.set_property(gt,"identified"),this.setPersonPropertiesForFlags(E({},i||{},t||{}),!1),this.capture("$identify",{distinct_id:e,$anon_distinct_id:r},{$set:t||{},$set_once:i||{}}),this.wr=en(e,t,i),this.featureFlags.setAnonymousDistinctId(r)):(t||i)&&this.setPersonProperties(t,i),e!==r&&(this.reloadFeatureFlags(),this.unregister(pt))}}else $e.critical('The string "'+Et+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.');else $e.error("Unique user id has not been set in posthog.identify")}setPersonProperties(e,t){if((e||t)&&this.Lr("posthog.setPersonProperties")){var i=en(this.get_distinct_id(),e,t);this.wr!==i?(this.setPersonPropertiesForFlags(E({},t||{},e||{})),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.wr=i):$e.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}group(e,t,i){if(e&&t){if(this.Lr("posthog.group")){var r=this.getGroups();r[e]!==t&&this.resetGroupPropertiesForFlags(e),this.register({$groups:E({},r,{[e]:t})}),i&&(this.capture("$groupidentify",{$group_type:e,$group_key:t,$group_set:i}),this.setGroupPropertiesForFlags({[e]:i})),r[e]===t||i||this.reloadFeatureFlags()}}else $e.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0),this.featureFlags.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(){this.featureFlags.resetPersonPropertiesForFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0),this.Lr("posthog.setGroupPropertiesForFlags")&&this.featureFlags.setGroupPropertiesForFlags(e,t)}resetGroupPropertiesForFlags(e){this.featureFlags.resetGroupPropertiesForFlags(e)}reset(e){var t,i,r,s;if($e.info("reset"),!this.__loaded)return $e.uninitializedWarning("posthog.reset");var n=this.get_property("$device_id");if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),this.surveys.reset(),this.featureFlags.reset(),null==(r=this.persistence)||r.set_property(gt,"anonymous"),null==(s=this.sessionManager)||s.resetSessionId(),this.wr=null,"always"===this.config.cookieless_mode)this.register_once({distinct_id:Et,$device_id:null},"");else{var o=this.config.get_device_id(yi());this.register_once({distinct_id:o,$device_id:e?o:n},"")}this.register({$last_posthog_reset:(new Date).toISOString()},1)}get_distinct_id(){return this.get_property("distinct_id")}getGroups(){return this.get_property("$groups")||{}}get_session_id(){var e,t;return null!==(e=null==(t=this.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0).sessionId)&&void 0!==e?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var{sessionId:t,sessionStartTimestamp:i}=this.sessionManager.checkAndGetSessionAndWindowId(!0),r=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t);if(null!=e&&e.withTimestamp&&i){var s,n=null!==(s=e.timestampLookBack)&&void 0!==s?s:10;if(!i)return r;r+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return r}alias(e,t){return e===this.get_property(Ve)?($e.critical("Attempting to create alias for existing People user - aborting."),-2):this.Lr("posthog.alias")?(L(t)&&(t=this.get_distinct_id()),e!==t?(this.Nr(ze,e),this.capture("$create_alias",{alias:e,distinct_id:t})):($e.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=E({},this.config);if(M(e)){var i,r,s,n,o;Me(this.config,uo(e));var a=this.kr();null==(i=this.persistence)||i.update_config(this.config,t,a),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new vn(E({},this.config,{persistence:"sessionStorage"}),a);var l=this.Sr(this.config.debug);G(l)&&(this.config.debug=l),G(this.config.debug)&&(this.config.debug?(y.DEBUG=!0,ki.H()&&ki.G("ph_debug","true"),$e.info("set_config",{config:e,oldConfig:t,newConfig:E({},this.config)})):(y.DEBUG=!1,ki.H()&&ki.V("ph_debug"))),null==(r=this.sessionRecording)||r.startIfEnabledOrStop(),null==(s=this.autocapture)||s.startIfEnabled(),null==(n=this.heatmaps)||n.startIfEnabled(),this.surveys.loadIfEnabled(),this.Ur(),null==(o=this.externalIntegrations)||o.startIfEnabledOrStop()}}startSessionRecording(e){var t,i,r,s,n,o=!0===e,a={sampling:o||!(null==e||!e.sampling),linked_flag:o||!(null==e||!e.linked_flag),url_trigger:o||!(null==e||!e.url_trigger),event_trigger:o||!(null==e||!e.event_trigger)};Object.values(a).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),a.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),a.linked_flag&&(null==(r=this.sessionRecording)||r.overrideLinkedFlag()),a.url_trigger&&(null==(s=this.sessionRecording)||s.overrideTrigger("url")),a.event_trigger&&(null==(n=this.sessionRecording)||n.overrideTrigger("event"))),this.set_config({disable_session_recording:!1})}stopSessionRecording(){this.set_config({disable_session_recording:!0})}sessionRecordingStarted(){var e;return!(null==(e=this.sessionRecording)||!e.started)}captureException(e,t){var i=new Error("PostHog syntheticException"),r=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(E({},r,t))}loadToolbar(e){return this.toolbar.loadToolbar(e)}get_property(e){var t;return null==(t=this.persistence)?void 0:t.props[e]}getSessionProperty(e){var t;return null==(t=this.sessionPersistence)?void 0:t.props[e]}toString(){var e,t=null!==(e=this.config.name)&&void 0!==e?e:ao;return t!==ao&&(t=ao+"."+t),t}_isIdentified(){var e,t;return"identified"===(null==(e=this.persistence)?void 0:e.get_property(gt))||"identified"===(null==(t=this.sessionPersistence)?void 0:t.get_property(gt))}jr(){var e,t;return!("never"===this.config.person_profiles||"identified_only"===this.config.person_profiles&&!this._isIdentified()&&N(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[ze])&&(null==(t=this.persistence)||null==(t=t.props)||!t[bt]))}Mr(){return!0===this.config.capture_pageleave||"if_capture_pageview"===this.config.capture_pageleave&&(!0===this.config.capture_pageview||"history_change"===this.config.capture_pageview)}createPersonProfile(){this.jr()||this.Lr("posthog.createPersonProfile")&&this.setPersonProperties({},{})}Lr(e){return"never"===this.config.person_profiles?($e.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Nr(bt,!0),!0)}kr(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut(),t=this.config.opt_out_persistence_by_default||"on_reject"===this.config.cookieless_mode;return this.config.disable_persistence||e&&!!t}Ur(){var e,t,i,r,s=this.kr();return(null==(e=this.persistence)?void 0:e.wi)!==s&&(null==(i=this.persistence)||i.set_disabled(s)),(null==(t=this.sessionPersistence)?void 0:t.wi)!==s&&(null==(r=this.sessionPersistence)||r.set_disabled(s)),s}opt_in_capturing(e){var t,i;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isExplicitlyOptedOut()&&(this.reset(!0),null==(t=this.sessionManager)||t.destroy(),this.sessionManager=new Bn(this),this.persistence&&(this.sessionPropsManager=new Hn(this,this.sessionManager,this.persistence)),this.sessionRecording=new so(this),this.sessionRecording.startIfEnabledOrStop()),this.consent.optInOut(!0),this.Ur(),this.Or(),"on_reject"==this.config.cookieless_mode&&this.surveys.loadIfEnabled(),(L(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!==(i=null==e?void 0:e.captureEventName)&&void 0!==i?i:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Fr()):$e.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}opt_out_capturing(){var e,t;"always"!==this.config.cookieless_mode?("on_reject"===this.config.cookieless_mode&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Ur(),"on_reject"===this.config.cookieless_mode&&(this.register({distinct_id:Et,$device_id:null}),null==(e=this.sessionManager)||e.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,null==(t=this.sessionRecording)||t.stopRecording(),this.sessionRecording=void 0,this.Fr())):$e.warn('Consent opt in/out is not valid with cookieless_mode="always" and will be ignored')}has_opted_in_capturing(){return this.consent.isOptedIn()}has_opted_out_capturing(){return this.consent.isOptedOut()}get_explicit_consent_status(){var e=this.consent.consent;return e===Ci.GRANTED?"granted":e===Ci.DENIED?"denied":"pending"}is_capturing(){return"always"===this.config.cookieless_mode||("on_reject"===this.config.cookieless_mode?this.consent.isExplicitlyOptedOut()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Ur()}_is_bot(){return h?zn(h,this.config.custom_blocked_useragents):void 0}Fr(){d&&("visible"===d.visibilityState?this.mr||(this.mr=!0,this.capture("$pageview",{title:d.title},{send_instantly:!0}),this.yr&&(d.removeEventListener("visibilitychange",this.yr),this.yr=null)):this.yr||(this.yr=this.Fr.bind(this),We(d,"visibilitychange",this.yr)))}debug(e){!1===e?(null==o||o.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==o||o.console.log("You're now in debug mode. All calls to PostHog will be logged in your console.\nYou can disable this with `posthog.debug(false)`."),this.set_config({debug:!0}))}M(){var e,t,i,r,s,n,o=this.Er||{};return"advanced_disable_flags"in o?!!o.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?($e.warn("Config field 'advanced_disable_decide' is deprecated. Please use 'advanced_disable_flags' instead. The old field will be removed in a future major version."),!0):(i="advanced_disable_decide",r=$e,s=(t="advanced_disable_flags")in(e=o)&&!L(e[t]),n=i in e&&!L(e[i]),s?e[t]:!!n&&(r&&r.warn("Config field '"+i+"' is deprecated. Please use '"+t+"' instead. The old field will be removed in a future major version."),e[i]))}Dr(e){if(q(this.config.before_send))return e;var t=A(this.config.before_send)?this.config.before_send:[this.config.before_send],i=e;for(var r of t){if(i=r(i),q(i)){var s="Event '"+e.event+"' was rejected in beforeSend function";return W(e.event)?$e.warn(s+". This can cause unexpected behavior."):$e.info(s),null}i.properties&&!N(i.properties)||$e.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}return i}getPageViewId(){var e;return null==(e=this.pageViewManager.Vt)?void 0:e.pageViewId}captureTraceFeedback(e,t){this.capture("$ai_feedback",{$ai_trace_id:String(e),$ai_feedback_text:t})}captureTraceMetric(e,t,i){this.capture("$ai_metric",{$ai_trace_id:String(e),$ai_metric_name:t,$ai_metric_value:String(i)})}Sr(e){var t=G(e)&&!e,i=ki.H()&&"true"===ki.q("ph_debug");return!t&&(!!i||e)}}!function(e,t){for(var i=0;i<t.length;i++)e.prototype[t[i]]=Ue(e.prototype[t[i]])}(po,["identify"]);var go,_o=(go=no[ao]=new po,function(){function e(){e.done||(e.done=!0,lo=!1,De(no,function(e){e._dom_loaded()}))}null!=d&&d.addEventListener?"complete"===d.readyState?e():We(d,"DOMContentLoaded",e,{capture:!1}):o&&$e.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),go);let vo=null,fo=!1;const mo="dori_shopify_end_user_id",yo="dori_shopify_end_user_session",bo=()=>"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now()}_${Math.random().toString(36).slice(2,10)}`;let wo=null;const Eo=()=>{if(wo)return wo;let e;try{const t=window?.DORI_CUSTOMER_ID;if(t){let i=window.localStorage.getItem(yo);i&&i.trim()||(i=bo(),window.localStorage.setItem(yo,i)),e=`shopify_customer_${String(t)}_${i}`}else{const t=window.localStorage.getItem(mo);t&&t.trim()?e=t:(e=`anon_${bo()}`,window.localStorage.setItem(mo,e))}}catch{e=`anon_${bo()}`}return wo=e,e};let So=null;const xo=()=>{try{const e=document.querySelector("script#dori-side-widget");return e?.getAttribute("data-sharing-id")||null}catch{return null}};let ko=null;const Io=()=>{const e={},t=xo();return t&&(e.sharing_id=t),"undefined"!=typeof window&&window.location&&window.location.hostname&&(e.shop_domain=window.location.hostname),e},Po=e=>{if(!e)return;const t=To();if(t)try{t.register({thread_id:e})}catch(i){}},To=()=>(vo||fo||(vo=(()=>{if(_o.__loaded)return _o;if(fo)return null;fo=!0;try{return _o.init("phc_H5oKb44Ke85TJHMvMDD6MzxtjjVeGZZinXVTyC8t0bY",{api_host:"https://us.i.posthog.com",person_profiles:"identified_only",autocapture:!1,capture_pageview:!1,capture_pageleave:!1,capture_performance:!1,capture_dead_clicks:!1,rageclick:!1,disable_session_recording:!0,bootstrap:{distinctID:Eo()},before_send:e=>e?(()=>{if(null===So){const e=xo()??"";So=(e=>{let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=Math.imul(t,16777619);return(t>>>0)/4294967296})(`${e}:${Eo()}`)<.1}return So})()&&("$exception"!==e.event||(e=>{const t=e?.properties??{};if("manual"===t.dori_capture)return!0;const i=(()=>{if(ko)return ko;const e=[];try{const t=document.querySelector("script#dori-side-widget"),i=t?.src;if(i){e.push(i);const t=i.slice(0,i.lastIndexOf("/")+1);t&&t!==i&&e.push(t)}}catch{}return ko=e,e})();if(0===i.length)return!0;const r=t.$exception_list;if(!Array.isArray(r)||0===r.length)return!0;for(const s of r){const e=s?.stacktrace?.frames;if(Array.isArray(e))for(const t of e){const e=t?.filename;if("string"==typeof e&&i.some(t=>e.startsWith(t)))return!0}}return!1})(e))?e:null:e,loaded:e=>{try{e.register({...Io(),surface:"side",flow_version:"1.13.36"})}catch(t){}}}),vo=_o,_o}catch(e){return console.error("[PostHog] Failed to initialize:",e),null}finally{fo=!1}})()),vo),$o=(e,t)=>{const i=To();if(i)try{i.capture(e,t)}catch(r){}},Oo=(e,t)=>{const i=To();if(i)try{console.error("Error captured:",e,t),i.capture("$exception",{$exception_message:e.message,$exception_type:e.name,$exception_stack_trace:e.stack,dori_capture:"manual",...t})}catch(r){console.error("[PostHog] Failed to capture exception:",r)}},Fo=(e,t)=>(...i)=>{try{return console.log("withErrorHandling",e),t(...i)}catch(r){throw console.error("Error in withErrorHandling:",r),Oo(r,{context:e}),r}},Co=(e,t)=>(...i)=>{try{return t(...i).catch(t=>{throw"AbortError"!==t.name&&Oo(t,{context:e}),t})}catch(r){throw"AbortError"!==r.name&&Oo(r,{context:e}),r}},Ro={BOT_DATA:"dori_widget_bot_data",BOT_DATA_ETAG:"dori_widget_bot_data_etag",CHAT_STATE:"dori_widget_chat_state",MESSAGES:"dori_widget_messages",CURRENT_STEP:"dori_widget_current_step",SESSION_TIMESTAMP:"dori_widget_session_timestamp",FAB_ANIMATION_TIMESTAMP:"dori_widget_fab_animation_timestamp",DORI_THREAD_ID:"dori_thread_id",DORI_SESSION_KEY:"dori_session_key",LOADED_FROM_STORAGE:"dori_loaded_from_storage",SHOPIFY_END_USER_ID:"dori_shopify_end_user_id",SHOPIFY_END_USER_SESSION:"dori_shopify_end_user_session"};function Ao(){if("undefined"==typeof window)return"";const e=window;if(e.chatbotData?.sharingID)return String(e.chatbotData.sharingID);const t=document.querySelector("script#dori-side-widget");return t?.getAttribute("data-sharing-id")||""}function Do(){try{const e="__test__";return localStorage.setItem(e,e),localStorage.removeItem(e),!0}catch{return!1}}function Mo(){Do()&&localStorage.setItem(Ro.LOADED_FROM_STORAGE,"true")}function No(){Do()&&localStorage.removeItem(Ro.LOADED_FROM_STORAGE)}function Lo(){try{const e=localStorage.getItem(Ro.SESSION_TIMESTAMP);if(!e)return!1;const t=parseInt(e,10);return Date.now()-t<864e5}catch{return!1}}function jo(){if(Do())try{[Ro.CHAT_STATE,Ro.MESSAGES,Ro.CURRENT_STEP,Ro.DORI_THREAD_ID,Ro.DORI_SESSION_KEY,Ro.LOADED_FROM_STORAGE,Ro.SHOPIFY_END_USER_ID,Ro.SHOPIFY_END_USER_SESSION].forEach(e=>{localStorage.removeItem(e)})}catch(e){console.error("Error clearing local storage:",e)}}function Uo(e){if(Do())try{e?localStorage.setItem(Ro.BOT_DATA,JSON.stringify(e)):localStorage.removeItem(Ro.BOT_DATA)}catch(t){console.error("Error saving bot data:",t)}}function Ho(){if(!Do()||!Lo())return null;try{const e=localStorage.getItem(Ro.BOT_DATA);return e?JSON.parse(e):null}catch(e){return console.error("Error loading bot data:",e),null}}function qo(e){if(Do())try{localStorage.setItem(Ro.CHAT_STATE,JSON.stringify(e))}catch(t){console.error("Error saving chat state:",t)}}function Bo(e){if(Do())try{const t=e.map(e=>({...e,timestamp:e.timestamp instanceof Date?e.timestamp.toISOString():e.timestamp}));localStorage.setItem(Ro.MESSAGES,JSON.stringify(t))}catch(t){console.error("Error saving messages:",t)}}function Go(){if(!Do()||!Lo())return[];try{const e=localStorage.getItem(Ro.MESSAGES);return e?JSON.parse(e).map(e=>({...e,content:"string"==typeof e.content?r(e.content):e.content,timestamp:new Date(e.timestamp)})):[]}catch(e){return console.error("Error loading messages:",e),[]}}function Wo(e){if(Do())try{localStorage.setItem(Ro.CURRENT_STEP,e)}catch(t){console.error("Error saving current step:",t)}}function Vo(){if(!Do()||!Lo())return null;try{const e=Ho(),t=function(){if(!Do()||!Lo())return null;try{const e=localStorage.getItem(Ro.CHAT_STATE);return e?JSON.parse(e):null}catch(e){return console.error("Error loading chat state:",e),null}}(),i=Go(),r=function(){if(!Do()||!Lo())return"welcome";try{return localStorage.getItem(Ro.CURRENT_STEP)||"welcome"}catch(e){return console.error("Error loading current step:",e),"welcome"}}();return e||i.length>0?{botData:e,chatState:t||{repliedProduct:null,focusedProduct:null,threadId:null,isRequestInProgress:!1},messages:i,currentStep:r,sessionTimestamp:Date.now()}:null}catch(e){return console.error("Error loading session data:",e),null}}function zo(){if(!Do()||!Lo())return!1;try{const e=Ho(),t=Go();return!!(e||t.length>0)}catch{return!1}}function Yo(){if(Do())try{localStorage.setItem(Ro.SESSION_TIMESTAMP,Date.now().toString())}catch(e){console.error("Error updating session timestamp:",e)}}function Xo(){if(Do())try{localStorage.setItem(Ro.FAB_ANIMATION_TIMESTAMP,Date.now().toString())}catch(e){console.error("Error saving FAB animation timestamp:",e)}}function Jo(){const e=function(){if(!Do()||!Lo())return null;try{const e=localStorage.getItem(Ro.FAB_ANIMATION_TIMESTAMP);return e?parseInt(e,10):null}catch(e){return console.error("Error loading FAB animation timestamp:",e),null}}();return!e||Date.now()-e>=3e5}function Ko(){if(!Do())return"";try{let e=localStorage.getItem(Ro.DORI_SESSION_KEY);return e||(e="dori_session_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),localStorage.setItem(Ro.DORI_SESSION_KEY,e)),e}catch(e){return console.error("Error generating session key:",e),""}}function Zo(e){if(Do()&&e){try{localStorage.setItem(Ro.DORI_THREAD_ID,e)}catch(t){console.error("Error storing dori thread ID:",t)}Po(e)}}function Qo(){if(!Do())return null;try{const e=localStorage.getItem(Ro.DORI_THREAD_ID);return Po(e),e}catch(e){return console.error("Error retrieving dori thread ID:",e),null}}function ea(e){const t=window?.chatbotData;if("undefined"!=typeof window&&t?.ajaxurl){const i=Ko();fetch(t.ajaxurl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({action:"dori_store_thread_session",thread_id:e,session_key:i,nonce:t.nonce})}).catch(e=>console.warn("Failed to store thread in WooCommerce session:",e))}}const ta="https://standardapi.dori.tech",ia=["pointerdown","keydown"],ra=["pointermove","touchstart","wheel","scroll"],sa=["pointerover","focusin","click"],na="dori-bot-data-ready",oa="dori-bot-data-error",aa=(e,t)=>{window.dispatchEvent(new CustomEvent(e,t?{detail:{error:t}}:void 0))},la=async e=>{const t=await fetch(e);if(200!==t.status)throw new Error(`Failed to fetch bot data: ${t.status}`);const i=await t.json();if(i.error)throw new Error(i.error);if(!i.data)throw new Error("No data received from bot sharing API");return i},ca=(e,t)=>{Uo(e),t&&function(e){if(Do())try{e?localStorage.setItem(Ro.BOT_DATA_ETAG,e):localStorage.removeItem(Ro.BOT_DATA_ETAG)}catch(t){console.error("Error saving ETag:",t)}}(t),Yo()};!async function(){try{const t=(()=>{const e=document.querySelector("script#dori-side-widget");return e?.getAttribute("data-sharing-id")||null})();if(!t)return void aa(oa,"No sharing ID found");const i=Ho(),r=function(){if(!Do()||!Lo())return null;try{return localStorage.getItem(Ro.BOT_DATA_ETAG)}catch(e){return console.error("Error loading ETag:",e),null}}(),s=`${ta}/bot-sharing-data/${t}`;i&&aa(na);const n=i?[]:[1500,4e3];for(let o=0;;o++)try{const e=r?{"If-None-Match":r}:{},t=await fetch(s,{headers:e});if(304===t.status){if(!i){const e=await la(s);ca(e.data,t.headers.get("ETag")),aa(na)}return}if(200===t.status){const e=await t.json();if(e.error)throw new Error(e.error);if(!e.data)throw new Error("No data received");return ca(e.data,t.headers.get("ETag")),void aa(na)}throw new Error(`Failed to fetch bot data: ${t.status}`)}catch(e){if(i)return;if(o<n.length){await new Promise(e=>setTimeout(e,n[o]));continue}const t=e instanceof Error?e.message:String(e);return void aa(oa,t)}}catch(e){const t=e instanceof Error?e.message:String(e);aa(oa,t)}}(),function(e,t={}){let i=!1;try{i=window.self!==window.top}catch{i=!0}if(i)return t.onLoadStart?.(),void e();let r=!1;const s=[],n=()=>{if(!r){r=!0;for(const e of s)e();t.onLoadStart?.(),e()}},o=(e,t)=>{"function"==typeof window.requestIdleCallback?window.requestIdleCallback(()=>e(),{timeout:t}):window.setTimeout(e,200)},a=(e,t,i)=>{e.addEventListener(t,i,{once:!0,passive:!0,capture:!0}),s.push(()=>e.removeEventListener(t,i,!0))};for(const h of ia)a(window,h,n);let l=!1;const c=()=>{l||r||(l=!0,o(n,2e3))};for(const h of ra)a(window,h,c);for(const h of t.immediateTargets??[])if(h)for(const e of sa)a(h,e,n);const u=()=>{if(r)return;const e=window.setTimeout(()=>o(n,1e3),5e3);s.push(()=>window.clearTimeout(e))};"complete"===document.readyState?u():window.addEventListener("load",u,{once:!0})}(()=>{t(async()=>{const{initializeDoriWidget:e}=await import("./assets/main-CO_s2xtp.js").then(e=>e.e);return{initializeDoriWidget:e}},[],import.meta.url).then(({initializeDoriWidget:e})=>e()).catch(e=>{console.error("[Dori Widget] Error initializing widget:",e)})});export{ta as A,Xo as B,Oo as C,Ro as S,t as _,Fo as a,qo as b,$o as c,Bo as d,Wo as e,Vo as f,Qo as g,zo as h,Do as i,s as j,Ao as k,Go as l,Mo as m,jo as n,No as o,Zo as p,ea as q,Ko as r,Uo as s,r as t,Yo as u,Ho as v,Co as w,n as x,To as y,Jo as z};
|
package/dist/widget.js.br
CHANGED
|
Binary file
|
package/dist/widget.js.gz
CHANGED
|
Binary file
|