PageSourceSearch

https://glechyan.com/_next/static/chunks/9da6db1e-e4ebb50742320f15.js

js glechyan.com collected 2026-10-02 01:30:29 UTC 232,258 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[229],{2535:(e,t,i)=>{i.d(t,{Ay:()=>oa});var s,r,n,a="u">typeof window?window:void 0,o="u">typeof globalThis?globalThis:a,l=null==o?void 0:o.navigator,u=null==o?void 0:o.document,h=null==o?void 0:o.location,c=null==o?void 0:o.fetch,d=null!=o&&o.XMLHttpRequest&&"withCredentials"in new o.XMLHttpRequest?o.XMLHttpRequest:void 0,p=null==o?void 0:o.AbortController,v=null==o?void 0:o.CompressionStream,g=null==l?void 0:l.userAgent;function f(){return!(!a||!1===a.navigator.onLine)}var _="u">typeof globalThis?globalThis:a;_&&"u"<typeof self&&(_.self=_),_&&"u"<typeof File&&(_.File=function(){});var m=null!=a?a:{},y={DEBUG:!1,LIB_VERSION:"0.3.1",LIB_NAME:"browser-common"};function b(e,t,i,s,r,n,a){try{var o=e[n](a),l=o.value}catch(e){return void i(e)}o.done?t(l):Promise.resolve(l).then(s,r)}function w(e){return function(){var t=this,i=arguments;return new Promise(function(s,r){var n=e.apply(t,i);function a(e){b(n,s,r,a,o,"next",e)}function o(e){b(n,s,r,a,o,"throw",e)}a(void 0)})}}function x(){return(x=Object.assign?Object.assign.bind():function(e){for(var t=1;arguments.length>t;t++){var i=arguments[t];for(var s in i)({}).hasOwnProperty.call(i,s)&&(e[s]=i[s])}return e}).apply(null,arguments)}function E(e,t){if(null==e)return{};var i={};for(var s in e)if(({}).hasOwnProperty.call(e,s)){if(-1!==t.indexOf(s))continue;i[s]=e[s]}return i}var k=e=>{if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(t){return e}};function S(e){return"string"==typeof e||e}function P(e){return"string"==typeof e?e:void 0}var F,$,I,C,R=["$feature_flag","$feature_flag_response","$feature_flag_has_experiment","$feature_flag_id","$feature_flag_version","$feature_flag_reason","$feature_flag_request_id","$feature_flag_evaluated_at","$feature_flag_error","locally_evaluated","$groups","$process_person_profile","$geoip_disable","$current_url","$pathname","$session_id","$window_id","$lib","$lib_version","$device_id","$is_server"],M=((F={}).AnonymousId="anonymous_id",F.DistinctId="distinct_id",F.Props="props",F.EnablePersonProcessing="enable_person_processing",F.PersonMode="person_mode",F.FeatureFlagDetails="feature_flag_details",F.FeatureFlags="feature_flags",F.FeatureFlagPayloads="feature_flag_payloads",F.BootstrapFeatureFlagDetails="bootstrap_feature_flag_details",F.BootstrapFeatureFlags="bootstrap_feature_flags",F.BootstrapFeatureFlagPayloads="bootstrap_feature_flag_payloads",F.OverrideFeatureFlags="override_feature_flags",F.Queue="queue",F.AiQueue="ai_queue",F.LogsQueue="logs_queue",F.OptedOut="opted_out",F.SessionId="session_id",F.SessionStartTimestamp="session_start_timestamp",F.SessionLastTimestamp="session_timestamp",F.PersonProperties="person_properties",F.GroupProperties="group_properties",F.InstalledAppBuild="installed_app_build",F.InstalledAppVersion="installed_app_version",F.SessionReplay="session_replay",F.SessionReplayEventTriggerActivatedSession="session_replay_event_trigger_activated_session",F.SurveyLastSeenDate="survey_last_seen_date",F.SurveysSeen="surveys_seen",F.Surveys="surveys",F.RemoteConfig="remote_config",F.FlagsEndpointWasHit="flags_endpoint_was_hit",F.DeviceId="device_id",F),T=(($={}).GZipJS="gzip-js",$.Base64="base64",$),O=["$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"],A=["token"],L="NativeGzipValidationError",D=e=>e.length>=2&&31===e[0]&&139===e[1],N=(e,t)=>e===T.GZipJS||t===T.GZipJS||"gzip"===t,j=e=>!(!e||"object"!=typeof e)&&"NotReadableError"===("name"in e?String(e.name):""),q=e=>{var t=Error("Native gzip produced invalid output: "+e);throw t.name=L,t},H=(I=w(function*(e,t){18>e.size&&q("too-short");var i=new Uint8Array((yield e.slice(0,10).arrayBuffer()));D(i)&&8===i[2]||q("invalid-header");var s=new DataView((yield e.slice(e.size-8).arrayBuffer()));s.getUint32(0,!0)!==(e=>{for(var t=(()=>{if(C)return C;C=[];for(var e=0;256>e;e++){for(var t=e,i=0;8>i;i++)t=1&t?0xedb88320^t>>>1:t>>>1;C[e]=t>>>0}return C})(),i=0xffffffff,s=0;e.length>s;s++)i=t[255&(i^e[s])]^i>>>8;return(0xffffffff^i)>>>0})(t)&&q("invalid-crc");var r=t.length>>>0;s.getUint32(4,!0)!==r&&q("invalid-size")}),function(e,t){return I.apply(this,arguments)});function z(){return(z=w(function*(e,t,i){void 0===t&&(t=!0);try{var s,r=(new TextEncoder).encode(e),n=new globalThis.CompressionStream("gzip"),a=n.writable.getWriter(),o=a.write(r).then(()=>a.close()).catch((s=w(function*(e){try{yield a.abort(e)}catch(e){}throw e}),function(e){return s.apply(this,arguments)})),l=new Response(n.readable).blob(),u=(yield Promise.all([l,o]))[0];return yield H(u,r),u}catch(e){if(null!=i&&i.rethrow)throw e;return t&&console.error("Failed to gzip compress data",e),null}})).apply(this,arguments)}var B=["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","hub
1spot","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"],U=function(e,t){if(void 0===t&&(t=[]),!e)return!1;var i=e.toLowerCase();return B.concat(t).some(e=>{var t=e.toLowerCase();return -1!==i.indexOf(t)})};function V(e,t){return -1!==e.indexOf(t)}var G=function(e){return e.trim()},W=function(e){return e.replace(/^\$/,"")};function Y(e){var t,i=[];return null!=(t=JSON.stringify(e,function(e,t){if("bigint"==typeof t)return t.toString();if("function"!=typeof t&&"symbol"!=typeof t){if(t instanceof Error)return{name:t.name,message:t.message,stack:t.stack};if(t&&"object"==typeof t){for(;i.length>0&&i[i.length-1]!==this;)i.pop();if(i.includes(t))return"[Circular]";i.push(t)}return t}}))?t:"null"}var J=Object.prototype,K=J.hasOwnProperty,X=J.toString,Q=Array.isArray||function(e){return"[object Array]"===X.call(e)},Z=e=>"function"==typeof e,ee=e=>e===Object(e)&&!Q(e),et=e=>{if(ee(e)){for(var t in e)if(K.call(e,t))return!1;return!0}return!1},ei=e=>void 0===e,es=e=>"[object String]"==X.call(e),er=e=>es(e)&&0===e.trim().length,en=e=>null===e,ea=e=>ei(e)||en(e),eo=e=>"[object Number]"==X.call(e)&&e==e,el=e=>eo(e)&&e>0,eu=e=>"[object Boolean]"===X.call(e),eh=e=>V(O,e),ec=e=>V(A,e);function ed(e){return null===e||"object"!=typeof e}function ep(e,t){return({}).toString.call(e)==="[object "+t+"]"}function ev(e){return"u">typeof Event&&eg(e,Event)}function eg(e,t){try{return e instanceof t}catch(e){return!1}}var ef=[!0,"true",1,"1","yes"],e_=[!1,"false",0,"0","no"];function em(e,t,i,s,r){return t>i&&(s.warn("min cannot be greater than max."),t=i),eo(e)?e>i?(s.warn(" cannot be  greater than max: "+i+". Using max value instead."),i):t>e?(s.warn(" cannot be less than min: "+t+". Using min value instead."),t):e:(s.warn(" must be a number. using max or fallback. max: "+i+", fallback: "+r),em(r||i,t,i,s))}class ey{constructor(e){this.tt={},this.et=e.et,this.rt=em(e.bucketSize,0,100,e.it),this.nt=em(e.refillRate,0,this.rt,e.it),this.st=em(e.refillInterval,0,864e5,e.it)}ot(e,t){var i=Math.floor((t-e.lastAccess)/this.st);i>0&&(e.tokens=Math.min(e.tokens+i*this.nt,this.rt),e.lastAccess=e.lastAccess+i*this.st)}consumeRateLimit(e){var t,i=Date.now(),s=String(e),r=this.tt[s];return r?this.ot(r,i):this.tt[s]=r={tokens:this.rt,lastAccess:i},0===r.tokens||(r.tokens--,0===r.tokens&&(null==(t=this.et)||t.call(this,e)),0===r.tokens)}stop(){this.tt={}}}var eb="Mobile",ew="Android",ex="Tablet",eE=ew+" "+ex,ek="iPad",eS="Apple",eP=eS+" Watch",eF="Safari",e$="BlackBerry",eI="Samsung",eC=eI+"Browser",eR=eI+" Internet",eM="Chrome",eT=eM+" OS",eO=eM+" iOS",eA="Internet Explorer",eL=eA+" "+eb,eD="Opera",eN=eD+" Mini",ej="Edge",eq="Microsoft "+ej,eH="Firefox",ez=eH+" iOS",eB="Nintendo",eU="PlayStation",eV="Xbox",eG=ew+" "+eb,eW=eb+" "+eF,eY="Windows",eJ=eY+" Phone",eK="Nokia",eX="Ouya",eQ="Generic",eZ=eQ+" "+eb.toLowerCase(),e0=eQ+" "+ex.toLowerCase(),e1="Konqueror",e2="Oculus Browser",e3="Vivaldi",e5="Yandex",e8="Whale",e6="DuckDuckGo",e4="Pale Moon",e9="Waterfox",e7="Brave",te="Google Search App",tt="(\\d+(\\.\\d+)?)",ti=RegExp("Version/"+tt),ts=RegExp(eV,"i"),tr=RegExp(eU+" \\w+","i"),tn=RegExp(eB+" \\w+","i"),ta=RegExp(e$+"|PlayBook|BB10","i"),to={"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"},tl=function(e,t,i,s){var r;return t=t||"",(null!=i&&i.brave?e7:null)||(null!=s&&s.detectGoogleSearchApp&&V(e,"GSA/")?te:V(e," OPR/")&&V(e,"Mini")?eN:V(e," OPR/")?eD:ta.test(e)?e$:V(e,"IE"+eb)||V(e,"WPDesktop")?eL:V(e,"OculusBrowser")?e2:V(e,eC)?eR:V(e,ej)||V(e,"Edg/")?eq:V(e,e3+"/")?e3:V(e,"YaBrowser/")?e5:V(e,e8+"/")?e8:V(e,e6+"/")||V(e,"Ddg/")?e6:V(e,"FBIOS")?"Facebook "+eb:V(e,"UCWEB")||V(e,"UCBrowser")?"UC Browser":V(e,"CriOS")?eO:V(e,"CrMo")||V(e,eM)?eM:V(e,ew)&&V(e,eF)?eG:V(e,"FxiOS")?ez:V(e.toLowerCase(),e1.toLowerCase())?e
11:V(e,e7+"/")?e7:(r=t)&&V(r,eS)||V(e,eF)&&!V(e,eM)&&!V(e,ew)?V(e,eb)?eW:eF:V(e,"PaleMoon/")?e4:V(e,e9+"/")?e9:V(e,eH)?eH:V(e,"MSIE")||V(e,"Trident/")?eA:V(e,"Gecko")?eH:"")},tu={[eL]:[RegExp("rv:"+tt)],[eq]:[RegExp(ej+"?\\/"+tt)],[eM]:[RegExp("("+eM+"|CrMo)\\/"+tt)],[eO]:[RegExp("CriOS\\/"+tt)],"UC Browser":[RegExp("(UCBrowser|UCWEB)\\/"+tt)],[eF]:[ti],[eW]:[ti],[eD]:[RegExp("(Opera|OPR)\\/"+tt)],[eH]:[RegExp(eH+"\\/"+tt)],[ez]:[RegExp("FxiOS\\/"+tt)],[e1]:[RegExp("Konqueror[:/]?"+tt,"i")],[e$]:[RegExp(e$+" "+tt),ti],[eG]:[RegExp("android\\s"+tt,"i")],[eR]:[RegExp(eC+"\\/"+tt)],[e2]:[RegExp("OculusBrowser\\/"+tt)],[e3]:[RegExp(e3+"\\/"+tt)],[e5]:[RegExp("YaBrowser\\/"+tt)],[e8]:[RegExp(e8+"\\/"+tt)],[e7]:[RegExp(e7+"\\/"+tt)],[e6]:[RegExp("(DuckDuckGo|Ddg)\\/"+tt)],[e4]:[RegExp("PaleMoon\\/"+tt)],[e9]:[RegExp(e9+"\\/"+tt)],[te]:[RegExp("GSA\\/"+tt)],[eA]:[RegExp("(rv:|MSIE )"+tt)],Mozilla:[RegExp("rv:"+tt)]},th=function(e,t,i,s){var r=tu[tl(e,t,i,s)];if(ei(r))return null;for(var n=0;r.length>n;n++){var a=e.match(r[n]);if(a)return parseFloat(a[a.length-2])}return null},tc=[[RegExp(eV+"; "+eV+" (.*?)[);]","i"),e=>[eV,e&&e[1]||""]],[RegExp(eB,"i"),[eB,""]],[RegExp(eU,"i"),[eU,""]],[ta,[e$,""]],[RegExp(eY,"i"),(e,t)=>{if(/Phone/.test(t)||/WPDesktop/.test(t))return[eJ,""];if(new RegExp(eb).test(t)&&!/IEMobile\b/.test(t))return[eY+" "+eb,""];var i=/Windows NT ([0-9.]+)/i.exec(t);if(i&&i[1]){var s=to[i[1]]||"";return/arm/i.test(t)&&(s="RT"),[eY,s]}return[eY,""]}],[/((iPhone|iPad|iPod).*?OS (\d+)_(\d+)_?(\d+)?|iPhone)/,e=>e&&e[3]?["iOS",[e[3],e[4],e[5]||"0"].join(".")]:["iOS",""]],[/(watch.*\/(\d+\.\d+\.\d+)|watch os,(\d+\.\d+),)/i,e=>{var t="";return e&&e.length>=3&&(t=ei(e[2])?e[3]:e[2]),["watchOS",t]}],[RegExp("("+ew+" (\\d+)\\.(\\d+)\\.?(\\d+)?|"+ew+")","i"),e=>e&&e[2]?[ew,[e[2],e[3],e[4]||"0"].join(".")]:[ew,""]],[/Mac OS X (\d+)[_.](\d+)[_.]?(\d+)?/i,e=>{var t=["Mac OS X",""];return e&&e[1]&&(t[1]=[e[1],e[2],e[3]||"0"].join(".")),t}],[/Mac/i,["Mac OS X",""]],[/CrOS/,[eT,""]],[/Linux|debian/i,["Linux",""]]],td=function(e){return tn.test(e)?eB:tr.test(e)?eU:ts.test(e)?eV:RegExp(eX,"i").test(e)?eX:RegExp("("+eJ+"|WPDesktop)","i").test(e)?eJ:/iPad/.test(e)?ek:/iPod/.test(e)?"iPod Touch":/iPhone/.test(e)?"iPhone":/(watch)(?: ?os[,/]|\d,\d\/)[\d.]+/i.test(e)?eP:ta.test(e)?e$:/(kobo)\s(ereader|touch)/i.test(e)?"Kobo":RegExp(eK,"i").test(e)?eK:/(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(eb).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)?ew:eE:RegExp("(pda|"+eb+")","i").test(e)?eZ:RegExp(ex,"i").test(e)&&!RegExp(ex+" pc","i").test(e)?e0:""},tp=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;function tv(e,t){return"string"==typeof e&&tp.test(e)?e:t()}function tg(e){return e?e.split("#")[0]:e}function tf(e,t){var i=setTimeout(e,t);return(null==i?void 0:i.unref)&&(null==i||i.unref()),i}function t_(e,t,i){return tm.apply(this,arguments)}function tm(){return(tm=w(function*(e,t,i){var s;try{return yield Promise.race([e,new Promise((e,r)=>{s=tf(()=>{try{null==i||i(),e()}catch(e){r(e)}},t)})])}finally{clearTimeout(s)}})).apply(this,arguments)}var ty=e=>e instanceof Error,tb={trace:{text:"TRACE",number:1},debug:{text:"DEBUG",number:5},info:{text:"INFO",number:9},warn:{text:"WARN",number:13},error:{text:"ERROR",number:17},fatal:{text:"FATAL",number:21}},tw=tb.info;function tx(e){var t=[];for(var i in e){var s=e[i];en(s)||ei(s)||t.push({key:i,value:function e(t){if(eu(t))return{boolValue:t};if("number"==typeof t)return Number.isFinite(t)?Number.isInteger(t)?{intValue:t}:{doubleValue:t}:{stringValue:String(t)};if("string"==typeof t)return{stringValue:t};if(Q(t))return{arrayValue:{values:t.map(t=>e(t))}};try{return{stringValue:JSON.stringify(t)}}catch(e){return{stringValue:String(t)}}}(s)})}return t}function tE(e,t,i){return x({},e.resourceAttributes,{"service.name":e.serviceName||"unknown_service"},e.environment&&{"deployment.environment":e.environment},e.serviceVersion&&{"service.version":e.serviceVersion},{"telemetry.sdk.name":t,"telemetry.sdk.version":i})}function tk(e,t,i,s){return{resourceLogs:[{resource:{attributes:tx(t)},scopeLogs:[{scope:{name:i,version:s},logRecords:e}]}]}}let tS=class{constructor(e,t,i,s,r,n,a){var o;void 0===n&&(n=()=>Promise.resolve()),this._instance=e,this.Ee=t,this.it=i,this.ut=s,this.ht=r,this.dt=n,this.ct=a,this.vt=null,this.ft=0,this.yt=0,this.bt=0,this._t=0,this.wt=!1,this.xt=t.maxBufferSize,this.kt=Math.max(null!=(o=t.maxQueueSize)?o:t.maxBufferSize,t.maxBufferSize),this.St=t.flushIntervalMs,this.Ct=t.maxBatchRecordsPerPost,this.Mt=t.rateCapWindowMs,this.It=t.maxLogsPerInterval}reset(){this.Tt(),this.vt=null,this.bt=0,this._t=0,this.wt=!1,this.ft=0,this.yt=0,this.Ct=this.Ee.max
1BatchRecordsPerPost}onReconnect(){this.yt=0,this.Et()}captureLog(e){if(!this._instance.isDisabled&&!this._instance.optedOut&&null!=e&&e.body){var t=this.Rt(e);if(null!==t)if(t.body){if(this.Pt()){var i,s,r,n,a,o,l,u,h={record:(i=this.ut(),r=(s=tb[t.level||"info"]||tw).text,n=s.number,a=String(Date.now())+"000000",o={},i.distinctId&&(o.posthogDistinctId=i.distinctId),i.sessionId&&(o.sessionId=i.sessionId),i.windowId&&(o["window.id"]=i.windowId),ea(i.sessionStartTimestamp)||(o.sessionStartTimestamp=String(i.sessionStartTimestamp)),ea(i.lastActivityTimestamp)||(o.lastActivityTimestamp=String(i.lastActivityTimestamp)),i.currentUrl&&(o["url.full"]=i.currentUrl),i.screenName&&(o["screen.name"]=i.screenName),i.appState&&(o["app.state"]=i.appState),i.activeFeatureFlags&&i.activeFeatureFlags.length>0&&(o.feature_flags=i.activeFeatureFlags),l=x({},o,t.attributes||{}),u={timeUnixNano:a,observedTimeUnixNano:a,severityNumber:n,severityText:r,body:{stringValue:t.body},attributes:tx(l)},t.trace_id&&(u.traceId=t.trace_id),t.span_id&&(u.spanId=t.span_id),ei(t.trace_flags)||(u.flags=t.trace_flags),u)};this.ht(()=>this.Ot(h))}}else this.it.info("Log was rejected in beforeSend function")}}Rt(e){var t=this.Ee.beforeSend;if(!t)return e;var i=Q(t)?t:[t],s=e;for(var r of i)try{var n=r(s);if(!n)return this.it.info("Log was rejected in beforeSend function"),null;s=n}catch(e){return this.it.error("Error in beforeSend function for log:",e),null}return s}Pt(){if(void 0===this.It)return!0;var e=Date.now(),t=e-this.bt;return this.Mt>t&&t>=0||(this.bt=e,this._t=0,this.wt=!1),this.It>this._t?(this._t++,!0):(this.wt||(this.it.warn("captureLog dropping logs: exceeded "+this.It+" logs per "+this.Mt+"ms"),this.wt=!0),!1)}flush(){var e=this;return w(function*(){if(!e._instance.isDisabled)return e.vt||(e.vt=e.Ft().finally(()=>{e.vt=null})),e.vt})()}Ft(){var e=this;return w(function*(){e.Tt();var t=null!=(r=e._instance.getPersistedProperty(M.LogsQueue))?r:[];if(0!==t.length)for(var i=t.length,s=0;t.length>0&&i>s;){e.ft=0;var r,n,a,o=Math.min(t.length,e.Ct),l=t.slice(0,o),u=tk(l.map(e=>e.record),e.At(),null!=(n=e.ct)?n:e._instance.getLibraryId(),e._instance.getLibraryVersion()),h=yield e._instance.$t(u);
1if("too-large"===h.kind&&l.length>1)e.Ct=Math.max(1,Math.floor(l.length/2)),e.it.warn("Received 413 when sending logs batch of size "+l.length+", reducing batch size to "+e.Ct);else if("retry-later"===h.kind||("too-large"===h.kind?e.it.warn("Dropping a single log record after 413 with batch size 1 — the record is larger than the server cap and cannot be split further."):"ok"===h.kind&&e.Ee.maxBatchRecordsPerPost>e.Ct&&(e.Ct=Math.min(e.Ee.maxBatchRecordsPerPost,e.Ct+1)),yield e.Lt(l.length),t=null!=(a=e._instance.getPersistedProperty(M.LogsQueue))?a:[],s+=l.length,"fatal"===h.kind))throw h.error}})()}Lt(e){var t=this;return w(function*(){var i,s=Math.max(0,e-t.ft),r=null!=(i=t._instance.getPersistedProperty(M.LogsQueue))?i:[];t._instance.setPersistedProperty(M.LogsQueue,r.slice(s)),yield t.dt()})()}At(){return tE(this.Ee,this._instance.getLibraryId(),this._instance.getLibraryVersion())}Ot(e){var t;if(!this._instance.optedOut){var i=null!=(t=this._instance.getPersistedProperty(M.LogsQueue))?t:[];this.kt>i.length||(i.shift(),this.ft++,this.it.info("Logs queue is full, dropping oldest record.")),i.push(e),this._instance.setPersistedProperty(M.LogsQueue,i),this.xt>i.length?this.Dt():this.Et()}}Dt(e){void 0===e&&(e=this.St),this.Nt||(this.Nt=tf(()=>{this.Nt=void 0,this.Et()},e))}qt(){var e=Math.min(Math.max(0,this.yt-1),6);return this.St*Math.pow(2,e)}jt(){var e=this._instance.getPersistedProperty(M.LogsQueue);return!!e&&e.length>0}shutdown(e){var t=this;return w(function*(){t.Tt();var i=t.flush().catch(()=>{});void 0!==e?yield t_(i,e):yield i})()}flushWithTimeout(e){var t=this;return w(function*(){var i=t.flush();yield t_(i,e,()=>{i.catch(()=>{})})})()}Et(){this.flush().then(()=>{this.yt=0},e=>{this.yt++,this.it.error("PostHog logs flush failed:",e)}).finally(()=>{!this._instance.isDisabled&&this.jt()&&this.Dt(this.qt())})}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}};var tP=[0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4];function tF(e){return String(e)+"000000"}function t$(e,t,i,s){var r="";return s&&(r=Object.keys(s).sort().map(e=>JSON.stringify(e)+":"+JSON.stringify(s[e])).join(",")),e+"\0"+t+"\0"+(null!=i?i:"")+"\0"+r}let tI=class{constructor(e,t,i){this._instance=e,this.Ee=t,this.it=i,this.Ht=new Map,this.vt=null,this.Bt=!1,this.Ut=new Map,this.zt=new Set,this.Vt=0}count(e,t,i){void 0===t&&(t=1),this.Wt({name:e,type:"count",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}gauge(e,t,i){this.Wt({name:e,type:"gauge",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}histogram(e,t,i){this.Wt({name:e,type:"histogram",value:t,unit:null==i?void 0:i.unit,attributes:null==i?void 0:i.attributes})}flush(){var e,t=this,i=this.vt,s=(e=w(function*(){i&&(yield i.catch(()=>{})),yield t.Zt()}),function(){return e.apply(this,arguments)})().finally(()=>{this.vt===s&&(this.vt=null)});return this.vt=s,s}drainWindow(){if(0===this.Ht.size)return null;var e=this.Ht;return this.Ht=new Map,this.Bt=!1,this.Ut=new Map,this.zt=new Set,this.Gt(e)}reset(){this.Vt++,this.Tt(),this.Ht=new Map,this.vt=null,this.Bt=!1,this.Ut=new Map,this.zt=new Set}Wt(e){if(!this._instance.isDisabled&&!this._instance.optedOut){var t=this.Rt(e);if(null!==t)if(t.name&&"string"==typeof t.name)if("number"==typeof t.value&&Number.isFinite(t.value))if("count"===t.type&&0>t.value)this.it.warn("Dropping count '"+t.name+"': counters are monotonic, value must be >= 0");else{try{i=t.attributes?x({},t.attributes):void 0,s=t$(t.type,t.name,t.unit,i)}catch(e){return void this.it.warn("Dropping metric '"+t.name+"': attributes could not be serialized",e)}var i,s,r=this.Ht.get(s);if(!r){if(!this.Qt())return;r={name:t.name,type:t.type,unit:t.unit,attributes:i,windowStartMs:Date.now()},this.Ht.set(s,r)}var n=this.Ut.get(t.name);void 0===n?this.Ut.set(t.name,t.type):n===t.type||this.zt.has(t.name)||(this.zt.add(t.name),this.it.warn("Metric name '"+t.name+"' is already used as a "+n+"; recording it as a "+t.type+" too will blend both series in charts. Use a distinct name.")),this.Jt(r,t.value),this.Dt()}else this.it.warn("Dropping metric '"+t.name+"': value must be a finite number");else this.it.warn("Dropping metric with empty name")}}Qt(){return this.Ee.maxSeriesPerFlush>this.Ht.size||(this.Bt||(this.Bt=!0,this.it.warn("Metric series cap reached ("+this.Ee.maxSeriesPerFlush+" per flush window); dropping new series until the next flush. Reduce attribute cardinality.")),!1)}Jt(e,t){var i;switch(e.type){case"count":e.total=(null!=(i=e.total)?i:0)+t;break;case"gauge":e.last=t;break;case"histogram":e.hist||(e.hist={count:0,sum:0,min:t,max:t,bucketCounts:Array(tP.length+1).fill(0)});var s=e.hist;s.count+=1,s.sum+=t,s.min=Math.min(s.min,t),s.max=Math.max(s.max,t),s.bucketCounts[function(e,t){for(var i=0;t.length>i;i++)if(t[i]>=e)return i;return t.length}(t,tP)]+=1}}Rt(e){var t=this.Ee.beforeSend;if(!t)return e;var i=Q(t)?t:[t],s=e;for(var r of i)try{var n=r(s);if(!n)return this.it.info("Metric was rejected in beforeSend function"),null;s=n}catch(e){return this.it.error("Error in beforeSend function for metric:",e),null}return s}Dt(){this.Nt||(this.Nt=tf(()=>{this.Nt=void 0,this.flush().catch(e=>{this.it.error("Metrics flush failed:",e)})},this.Ee.flushIntervalMs))}Tt(){this.Nt&&(clearTimeout(this.Nt),this.Nt=void 0)}
1Zt(){var e=this;return w(function*(){if(0!==e.Ht.size){var t=e.Ht;e.Ht=new Map,e.Bt=!1,e.Ut=new Map,e.zt=new Set;var i=e.Vt,s=yield e._instance.Kt(e.Gt(t));if(i===e.Vt)switch(s.kind){case"ok":return;case"retry-later":return e.Yt(t),void e.Dt();case"too-large":return void e.it.warn("Metrics batch exceeded the server size limit and was dropped");case"fatal":return void e.it.error("Failed to send metrics batch:",s.error)}}})()}Gt(e){var t,i,s,r,n,a,o;return t=this.Xt(e),n=this.Ee,a=this._instance.getLibraryId(),o=this._instance.getLibraryVersion(),i=x({},n.resourceAttributes,{"service.name":n.serviceName||"unknown_service"},n.environment&&{"deployment.environment":n.environment},n.serviceVersion&&{"service.version":n.serviceVersion},{"telemetry.sdk.name":a,"telemetry.sdk.version":o}),s=this._instance.getLibraryId(),r=this._instance.getLibraryVersion(),{resourceMetrics:[{resource:{attributes:tx(i)},scopeMetrics:[{scope:{name:s,version:r},metrics:t}]}]}}Xt(e){var t=tF(Date.now()),i=new Map;for(var s of e.values()){var r,n=t$(s.type,s.name,s.unit,void 0),a=i.get(n);a||(a=x({name:s.name},s.unit&&{unit:s.unit}),"count"===s.type?a.sum={aggregationTemporality:1,isMonotonic:!0,dataPoints:[]}:"gauge"===s.type?a.gauge={dataPoints:[]}:a.histogram={aggregationTemporality:1,dataPoints:[]},i.set(n,a));var o=tx(null!=(r=s.attributes)?r:{}),l=tF(s.windowStartMs);if("count"===s.type){var u,h={attributes:o,startTimeUnixNano:l,timeUnixNano:t,asDouble:null!=(u=s.total)?u:0};a.sum.dataPoints.push(h)}else if("gauge"===s.type){var c,d={attributes:o,timeUnixNano:t,asDouble:null!=(c=s.last)?c:0};a.gauge.dataPoints.push(d)}else s.hist&&a.histogram.dataPoints.push({attributes:o,startTimeUnixNano:l,timeUnixNano:t,count:s.hist.count,sum:s.hist.sum,min:s.hist.min,max:s.hist.max,bucketCounts:s.hist.bucketCounts,explicitBounds:tP})}return Array.from(i.values())}Yt(e){var t,i;for(var s of e){var r=s[0],n=s[1],a=this.Ht.get(r);if(a)switch(a.windowStartMs=Math.min(a.windowStartMs,n.windowStartMs),a.type){case"count":a.total=(null!=(t=a.total)?t:0)+(null!=(i=n.total)?i:0);break;case"gauge":break;case"histogram":if(n.hist)if(a.hist){a.hist.count+=n.hist.count,a.hist.sum+=n.hist.sum,a.hist.min=Math.min(a.hist.min,n.hist.min),a.hist.max=Math.max(a.hist.max,n.hist.max);for(var o=0;a.hist.bucketCounts.length>o;o++)a.hist.bucketCounts[o]+=n.hist.bucketCounts[o]}else a.hist=n.hist}else this.Qt()&&this.Ht.set(r,n)}}};class tC{constructor(e,t,i){void 0===i&&(i=[]),this.coercers=e,this.stackParser=t,this.modifiers=i}buildFromUnknown(e,t){void 0===t&&(t={});var i=t&&t.mechanism||{handled:!0,type:"generic"},s=this.buildCoercingContext(i,t,0).apply(e),r=this.buildParsingContext(t),n=this.parseStacktrace(s,r);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&&Q(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,s;return null!=e.cause&&(i=this.parseStacktrace(e.cause,t)),""!=e.stack&&null!=e.stack&&(s=this.applyChunkIds(this.stackParser(e.stack,e.synthetic?t.skipFirstLines:0),t.chunkIdMap)),x({},e,{cause:i,stack:s})}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 s of t.modifiers)i=yield s(i);return i})()}convertToExceptionList(e,t){var i,s,r,n={type:e.type,value:e.value,mechanism:{type:null!=(i=t.type)?i:"generic",handled:null==(s=t.handled)||s,synthetic:null!=(r=e.synthetic)&&r}};e.stack&&(n.stacktrace={type:"raw",frames:e.stack});var a=[n];return null!=e.cause&&a.push(...this.convertToExceptionList(e.cause,x({},t,{handled:!0}))),a}buildParsingContext(e){var t;return{chunkIdMap:function(e){var t=globalThis._posthogChunkIds;if(t){var i=Object.keys(t);return sm&&i.length===s_||(s_=i.length,sm=i.reduce((i,s)=>{sf||(sf={});var r=sf[s];if(r)i[r[0]]=r[1];else for(var n=e(s),a=n.length-1;a>=0;a--){var o=n[a],l=null==o?void 0:o.filename,u=t[s];if(l&&u){i[l]=u,sf[s]=[l,u];break}}return i},{})),sm}}(this.stackParser),skipFirstLines:null!=(t=e.skipFirstLines)?t:1}}buildCoercingContext(e,t,i){void 0===i&&(i=0);var s=(i,s)=>{if(4>
1=s){var r=this.buildCoercingContext(e,t,s);return this.applyCoercers(i,r)}};return x({},t,{syntheticException:0==i?t.syntheticException:void 0,mechanism:e,apply:e=>s(e,i),next:e=>s(e,i+1)})}}function tR(e,t,i,s,r){var n={platform:e,filename:t,function:"<anonymous>"===i?"?":i,in_app:!0};return ei(s)||(n.lineno=s),ei(r)||(n.colno=r),n}var tM=(e,t)=>{var i=-1!==e.indexOf("safari-extension"),s=-1!==e.indexOf("safari-web-extension");return i||s?[-1!==e.indexOf("@")?e.split("@")[0]:"?",i?"safari-extension:"+t:"safari-web-extension:"+t]:[e,t]},tT=/^\s*at (\S+?)(?::(\d+))(?::(\d+))\s*$/i,tO=/^\s*at (?:(.+?\)(?: \[.+\])?|.*?) ?\((?:address at )?)?(?:async )?((?:<anonymous>|[-a-z]+:|.*bundle|\/)?.*?)(?::(\d+))?(?::(\d+))?\)?\s*$/i,tA=/\((\S*)(?::(\d+))(?::(\d+))\)/,tL=(e,t)=>{var i=tT.exec(e);if(i)return tR(t,i[1],"?",+i[2],+i[3]);var s=tO.exec(e);if(s){if(s[2]&&0===s[2].indexOf("eval")){var r=tA.exec(s[2]);r&&(s[2]=r[1],s[3]=r[2],s[4]=r[3])}var n=tM(s[1]||"?",s[2]);return tR(t,n[1],n[0],s[3]?+s[3]:void 0,s[4]?+s[4]:void 0)}},tD=/^\s*(.*?)(?:\((.*?)\))?(?:^|@)?((?:[-a-z]+)?:\/.*?|\[native code\]|[^@]*(?:bundle|\d+\.js)|\/[\w\-. /=]+)(?::(\d+))?(?::(\d+))?\s*$/i,tN=/(\S+) line (\d+)(?: > eval line \d+)* > eval/i,tj=(e,t)=>{var i=tD.exec(e);if(i){if(i[3]&&i[3].indexOf(" > eval")>-1){var s=tN.exec(i[3]);s&&(i[1]=i[1]||"eval",i[3]=s[1],i[4]=s[2],i[5]="")}var r=i[3],n=i[1]||"?",a=tM(n,r);return tR(t,r=a[1],n=a[0],i[4]?+i[4]:void 0,i[5]?+i[5]:void 0)}},tq=/\(error: (.*)\)/;class tH{match(e){return this.isDOMException(e)||this.isDOMError(e)}coerce(e,t){var i=es(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 ep(e,"DOMException")}isDOMError(e){return ep(e,"DOMError")}}class tz{match(e){switch(({}).toString.call(e)){case"[object Error]":case"[object Exception]":case"[object DOMException]":case"[object DOMError]":case"[object WebAssembly.Exception]":return!0;default:return eg(e,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 String(i.error&&"string"==typeof i.error.message?i.error.message:i)}getStack(e){return e.stacktrace||e.stack||void 0}}class tB{match(e){return!!ep(e,"ErrorEvent")&&(null!=e.error||this.ce(e))}coerce(e,t){if(null!=e.error)return t.apply(e.error);var i,s=t.apply(e.message);return x({},s,{stack:null!=(i=this.de(e))?i:s.stack,synthetic:!0})}ce(e){return es(e.message)&&e.message.length>0}de(e){if(es(e.filename)&&e.filename.length>0){var t,i,s=null!=(t=e.lineno)?t:0,r=null!=(i=e.colno)?i:0;return"Error\n    at "+e.filename+":"+s+":"+r}}}var tU=/^(?:[Uu]ncaught (?:exception: )?)?(?:((?:Eval|Internal|Range|Reference|Syntax|Type|URI|)Error): )?(.*)$/i;class tV{match(e){return"string"==typeof e}coerce(e,t){var i,s=this.getInfos(e),r=s[0],n=s[1];return{type:null!=r?r:"Error",value:null!=n?n:e,stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}getInfos(e){var t="Error",i=e,s=e.match(tU);return s&&(t=s[1],i=s[2]),[t,i]}}var tG=["fatal","error","warning","log","info","debug"];function tW(e,t){void 0===t&&(t=40);var i=Object.keys(e);if(i.sort(),!i.length)return"[object has no keys]";for(var s=i.length;s>0;s--){var r=i.slice(0,s).join(", ");if(t>=r.length)return s===i.length?r:r.length>t?r.slice(0,t)+"...":r}return""}class tY{match(e){return"object"==typeof e&&null!==e}coerce(e,t){var i,s,r=this.getErrorPropertyFromObject(e);return r?t.apply(r):{type:this.getType(e),value:this.getValue(e),stack:null!=(i=this.getStack(e))?i:null==(s=t.syntheticException)?void 0:s.stack,level:this.isSeverityLevel(e.level)?e.level:"error",synthetic:!0}}getType(e){return ev(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: "+tW(e)}isSeverityLevel(e){return es(e)&&!er(e)&&tG.indexOf(e)>=0}getStack(e){try{return es(e.stacktrace)&&e.stacktrace.length>0?e.stacktrace:es(e.stack)&&e.stack.length>0?e.stack:void 0}catch(e){return}}getErrorPropertyFromObject(e){for(var t in e)if(({}).hasOwnProperty.call(e,t)){var i=e[t];if(ty(i))return i}}getObjectClassName(e){try{var t=Object.getPrototypeOf(e);return t?t.constructor.name:void 0}catch(e){return}}}class tJ{match(e){return ev(e)}coerce(e,t){var i,s=e.constructor.name;return{type:s,value:s+" captured as exception with keys: "+tW(e),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}}}class tK{match(e){return ed(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 tX{match(e){return ep(e,"PromiseRejectionEvent")||this.isCu
1stomEventWrappingRejection(e)}isCustomEventWrappingRejection(e){if(!ev(e))return!1;try{var t=e.detail;return null!=t&&"object"==typeof t&&"reason"in t}catch(e){return!1}}coerce(e,t){var i,s=this.getUnhandledRejectionReason(e);return ed(s)?{type:"UnhandledRejection",value:"Non-Error promise rejection captured with value: "+String(s),stack:null==(i=t.syntheticException)?void 0:i.stack,synthetic:!0}:t.apply(s)}getUnhandledRejectionReason(e){try{if("reason"in e)return e.reason;if("detail"in e&&null!=e.detail&&"object"==typeof e.detail&&"reason"in e.detail)return e.detail.reason}catch(e){}return e}}var tQ="$message",tZ="$timestamp",t0=new Set([tQ,tZ]),t1={enabled:!0,max_bytes:32768};function t2(e){var t;return e?{enabled:null!=(t=e.enabled)?t:t1.enabled,max_bytes:function(e,t){if(!eo(e)||e===1/0||e===-1/0)return t;var i=Math.floor(e);return 0>i?t:i}(e.max_bytes,t1.max_bytes)}:x({},t1)}class t3{constructor(e){this.$e=[],this.Ge=0,this.Ee=t2(e)}setConfig(e){this.Ee=t2(e),this.Qe()}add(e){var t=function(e){var t;try{t=Y(e)}catch(e){return}try{var i=JSON.parse(t);if(!ee(i))return;var s=i[tQ],r=i[tZ];if(!es(s)||0===s.trim().length||!es(r)&&!eo(r))return;return{step:i,json:t}}catch(e){return}}(e);if(t){var i=function(e){if("u">typeof TextEncoder)return(new TextEncoder).encode(e).length;for(var t=encodeURIComponent(e),i=0,s=0;t.length>s;s++)"%"===t[s]?(i+=1,s+=2):i+=1;return i}(t.json);i>this.Ee.max_bytes||(this.$e.push({step:t.step,bytes:i}),this.Ge+=i,this.Qe())}}getAttachable(){return this.$e.map(e=>e.step)}clear(){this.$e=[],this.Ge=0}size(){return this.$e.length}Qe(){for(;this.Ge>this.Ee.max_bytes&&this.$e.length>0;){var e=this.$e.shift();e&&(this.Ge-=e.bytes)}}}var t5=function(e,t){var i=(void 0===t?{}:t).debugEnabled,s={k(t){if(a&&(y.DEBUG||a.POSTHOG_DEBUG||i)&&!ei(a.console)&&a.console){for(var s=("__rrweb_original__"in a.console[t])?a.console[t].__rrweb_original__:a.console[t],r=arguments.length,n=Array(r>1?r-1:0),o=1;r>o;o++)n[o-1]=arguments[o];s(e,...n)}},debug(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];s.k("debug",...t)},info(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];s.k("log",...t)},warn(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];s.k("warn",...t)},error(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];s.k("error",...t)},critical(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];console.error(e,...i)},uninitializedWarning(e){s.error("You must initialize PostHog before calling "+e)},createLogger:(t,i)=>t5(e+" "+t,i)};return s},t8=t5("[PostHog.js]"),t6=t8.createLogger,t4=t6("[ExternalScriptsLoader]"),t9=(e,t,i)=>{if(e.config.disable_external_dependency_loading)return t4.warn(t+" was requested but loading of external scripts is disabled."),i("Loading of external scripts is disabled");var s=null==u?void 0:u.querySelectorAll("script");if(s){for(var r,n=0;s.length>n;n++)if(r=function(){if(s[n].src===t){var e=s[n];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})}}())return r.v}var a=()=>{if(!u)return i("document not found");var s=u.createElement("script");if(s.type="text/javascript",s.crossOrigin="anonymous",s.src=t,s.onload=e=>{s.__posthog_loading_callback_fired=!0,i(void 0,e)},s.onerror=e=>i(e),e.config.prepare_external_dependency_script&&(s=e.config.prepare_external_dependency_script(s)),!s)return i("prepare_external_dependency_script returned null");if("head"===e.config.external_scripts_inject_target)u.head.appendChild(s);else{var r,n=u.querySelectorAll("body > script");n.length>0?null==(r=n[0].parentNode)||r.insertBefore(s,n[0]):u.body.appendChild(s)}};null!=u&&u.body?a():null==u||u.addEventListener("DOMContentLoaded",a)};m.__PosthogExtensions__=m.__PosthogExtensions__||{},m.__PosthogExtensions__.loadExternalDependency=(e,t,i)=>{if("remote-config"!==t){var s;if(e.config.strict_script_versioning)s=e.requestRouter.endpointFor("assets","/static/"+e.version+"/"+t+".js");else{var r="/static/"+t+".js?v="+e.version;"toolbar"===t&&(r=r+"&t="+3e5*Math.floor(Date.now()/3e5)),s=e.requestRouter.endpointFor("assets",r)}t9(e,s,i)}else{var n=e.requestRouter.endpointFor("assets","/array/"+e.config.token+"/config.js");t9(e,n,i)}},m.__PosthogExtensions__.loadSiteApp=(e,t,i)=>{var s=e.requestRouter.endpointFor("api",t);t9(e,s,i)},y.DEBUG=!1,y.LIB_VERSION="1.410.4",y.LIB_NAME="web";
1var t7="$people_distinct_id",ie="$device_id",it="$device_model",ii="__alias",is="__timers",ir="$autocapture_disabled_server_side",ia="$heatmaps_enabled_server_side",io="$exception_capture_enabled_server_side",il="$error_tracking_suppression_rules",iu="$error_tracking_capture_extension_exceptions",ih="$web_vitals_enabled_server_side",ic="$dead_clicks_enabled_server_side",id="$product_tours_enabled_server_side",ip="$web_vitals_allowed_metrics",iv="$session_recording_remote_config",ig="$replay_sample_rate",i_="$replay_override_sampling",im="$replay_override_linked_flag",iy="$replay_override_url_trigger",ib="$replay_override_event_trigger",iw="$sesid",ix="$session_is_sampled",iE="$enabled_feature_flags",ik="$active_feature_flags",iS="$early_access_features",iP="$feature_flag_details",iF="$feature_flag_payloads",i$="$feature_flag_request_id",iI="$minimal_flag_called_events",iC="$override_feature_flags",iR="$override_feature_flag_payloads",iM="$stored_person_properties",iT="$stored_group_properties",iO="$surveys",iA="$surveys_loaded_at",iL="$surveys_activated",iD="$surveys_activated_session",iN="ph_product_tours",ij="$flag_call_reported",iq="$flag_call_reported_session_id",iH="$feature_flag_errors",iz="$feature_flag_evaluated_at",iB="$user_state",iU="$client_session_props",iV="$capture_rate_limit",iG="$initial_campaign_params",iW="$initial_referrer_info",iY="$initial_person_info",iJ="$epp",iK="$posthog_cookieless",iX="$cookieless_mode",iQ="$sdk_debug_extensions_init_method",iZ="$sdk_debug_extensions_init_time_ms",i0="$sdk_debug_recording_script_not_loaded",i1="PostHog loadExternalDependency extension not found.",i2="on_reject",i3="always",i5="anonymous",i8="identified",i6="identified_only",i4="visibilitychange",i9="beforeunload",i7="$pageview",se="$pageleave",st="$identify",si="$groupidentify";function ss(e,t){Q(e)&&e.forEach(t)}function sr(e,t){if(!ea(e))if(Q(e))e.forEach(t);else if(e instanceof FormData)e.forEach((e,i)=>t(e,i));else for(var i in e)K.call(e,i)&&t(e[i],i)}var sn=function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];for(var r of i)for(var n in r)void 0!==r[n]&&(e[n]=r[n]);return e};function sa(e){for(var t=Object.keys(e),i=t.length,s=Array(i);i--;)s[i]=[t[i],e[t[i]]];return s}var so=function(e){try{return e()}catch(e){return}},sl=function(e){return function(){try{for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,i)}catch(e){t8.critical("Implementation error. Please turn on debug mode and open a ticket on https://app.posthog.com/home#panel=support%3Asupport%3A."),t8.critical(e)}}},su=function(e){var t={};return sr(e,function(e,i){(es(e)&&e.length>0||eo(e))&&(t[i]=e)}),t},sh=["herokuapp.com","vercel.app","netlify.app"];function sc(e,t,i,s){var r=null!=s?s:{},n=r.capture,a=r.passive;null==e||e.addEventListener(t,i,{capture:void 0!==n&&n,passive:void 0===a||a})}function sd(e){return"ph_toolbar_internal"===e.name}var sp=e=>{if(u){try{for(var t=e+"=",i=u.cookie.split(";").filter(e=>e.length),s=0;i.length>s;s++){for(var r=i[s];" "==r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return decodeURIComponent(r.substring(t.length,r.length))}}catch(e){}return null}};Math.trunc||(Math.trunc=function(e){return 0>e?Math.ceil(e):Math.floor(e)}),Number.isInteger||(Number.isInteger=function(e){return eo(e)&&isFinite(e)&&Math.floor(e)===e});class sv{constructor(e){if(this.bytes=e,16!==e.length)throw TypeError("not 128-bit length")}static fromFieldsV7(e,t,i,s){if(!Number.isInteger(e)||!Number.isInteger(t)||!Number.isInteger(i)||!Number.isInteger(s)||0>e||0>t||0>i||0>s||e>0xffffffffffff||t>4095||i>0x3fffffff||s>0xffffffff)throw RangeError("invalid field value");var r=new Uint8Array(16);return r[0]=e/0x10000000000,r[1]=e/0x100000000,r[2]=e/0x1000000,r[3]=e/65536,r[4]=e/256,r[5]=e,r[6]=112|t>>>8,r[7]=t,r[8]=128|i>>>24,r[9]=i>>>16,r[10]=i>>>8,r[11]=i,r[12]=s>>>24,r[13]=s>>>16,r[14]=s>>>8,r[15]=s,new sv(r)}toString(){for(var e="",t=0;this.bytes.length>t;t++)e=e+(this.bytes[t]>>>4).toString(16)+(15&this.bytes[t]).toString(16),3!==t&&5!==t&&7!==t&&9!==t||(e+="-");if(36!==e.length)throw Error("Invalid UUIDv7 was generated");return e}clone(){return new sv(this.bytes.slice(0))}equals(e){return 0===this.compareTo(e)}compareTo(e){for(var t=0;16>t;t++){var i=this.bytes[t]-e.bytes[t];if(0!==i)return Math.sign(i)}return 0}}class sg{generate(){var e=this.generateOrAbort();if(!ei(e))return e;this.S=0;var t=this.generateOrAbort();if(ei(t))throw Error("Could not generate UUID after timestamp reset");return t}generateOrAbort(){var e=Date.now();if(e>this.S)this.S=e,this.C();else{if(this.S>=e+1e4)return;this.M++,this.M>0x3ffffffffff&&(this.S++,this.C())}return sv.fromFieldsV7(this.S,Math.trunc(this.M/0x40000000),0x3fffffff&this.M,this.I.nextUint32())}C(){this.M=1024*this.I.nextUint32()+(1023&this.I.nextUint32())}constructor(){this.S=0,this.M=0,this.I=new sw}}var sf,s_,sm,sy,sb=e=>{if("u">typeof UUIDV7_DENY_WEAK_RNG&&UUIDV7_DENY_WEAK_RNG)throw Error("no cryptographically strong RNG available");for(var t=0;e.length>t;t++)e[t]=65536*Math.trunc(65536*Math.random())+Math.trunc(65536*Math.random());return e};a&&!ei(a.crypto)&&crypto.getRandomValues&&(sb=e=>crypto.getRandomValues(e));class sw{nextUint32(){return this.R.length>this.O||(sb(this.R),this.O=0),this.R[this.O++]}constructor(){this.R=new Uint32Array(8),this.O=1/0}}var sx=()=>sE().toString(),sE=()=>(sy||(sy=new sg)).generate(),sk="",sS=/[a-z0-9][a-z0-9-]+\.[a-z]{2,}$/i,sP={N:()=>!!u,P(e){t8.error("cookieStore error: "+e)},q:sp,F(e){var t;try{t=JSON.parse(sP.q(e))||{}}catch(e){}return t},A(e,t,i,s,r){if(!u)return!1;try{var n="",a="",o=function(e,t){if(t){var i=function(e,t){if(void 0===t&&(t=u),sk)return sk;
1if(!t||["localhost","127.0.0.1"].includes(e))return"";for(var i=e.split("."),s=Math.min(i.length,8),r="dmn_chk_"+sx();!sk&&s--;){var n=i.slice(s).join("."),a=r+"=1;domain=."+n+";path=/";t.cookie=a+";max-age=3",t.cookie.includes(r)&&(t.cookie=a+";max-age=0",sk=n)}return sk}(e);if(!i){var s,r=(s=e.match(sS))?s[0]:"";r!==i&&t8.info("Warning: cookie subdomain discovery mismatch",r,i),i=r}return i?"; domain=."+i:""}return""}(u.location.hostname,s);if(i){var l=new Date;l.setTime(l.getTime()+864e5*i),n="; expires="+l.toUTCString()}r&&(a="; secure");var h=e+"="+encodeURIComponent(JSON.stringify(t))+n+"; SameSite=Lax; path=/"+o+a;return h.length>3686.4&&t8.warn("cookieStore warning: large cookie, len="+h.length),u.cookie=h,!0}catch(e){return!1}},D(e,t){if(null!=u&&u.cookie)try{sP.A(e,"",-1,t)}catch(e){return}}},sF=null,s$={N(){if(!en(sF))return sF;var e=!0;if(ei(a))e=!1;else try{var t="__mplssupport__";s$.A(t,"xyz"),'"xyz"'!==s$.q(t)&&(e=!1),s$.D(t)}catch(t){e=!1}return e||t8.error("localStorage unsupported; falling back to cookie store"),sF=e,e},P(e){t8.error("localStorage error: "+e)},q(e){try{return null==a?void 0:a.localStorage.getItem(e)}catch(e){s$.P(e)}return null},F(e){try{return JSON.parse(s$.q(e))||{}}catch(e){}return null},A(e,t){try{return null==a||a.localStorage.setItem(e,JSON.stringify(t)),!0}catch(e){s$.P(e)}return!1},D(e){try{null==a||a.localStorage.removeItem(e)}catch(e){s$.P(e)}}},sI=[ie,"distinct_id",iw,ix,iJ,iY,iB],sC={},sR={N:()=>!0,P(e){t8.error("memoryStorage error: "+e)},q:e=>sC[e]||null,F:e=>sC[e]||null,A:(e,t)=>(sC[e]=t,!0),D(e){delete sC[e]}},sM=null,sT={N(){if(!en(sM))return sM;if(sM=!0,ei(a))sM=!1;else try{var e="__support__";sT.A(e,"xyz"),'"xyz"'!==sT.q(e)&&(sM=!1),sT.D(e)}catch(e){sM=!1}return sM},P(e){t8.error("sessionStorage error: ",e)},q(e){try{return null==a?void 0:a.sessionStorage.getItem(e)}catch(e){sT.P(e)}return null},F(e){try{return JSON.parse(sT.q(e))||null}catch(e){}return null},A(e,t){try{return null==a||a.sessionStorage.setItem(e,JSON.stringify(t)),!0}catch(e){sT.P(e)}return!1},D(e){try{null==a||a.sessionStorage.removeItem(e)}catch(e){sT.P(e)}}};class sO{constructor(e){this._instance=e}get Ee(){return this._instance.config}get consent(){return this.Je()?0:this.Ke}isOptedOut(){return this.Ee.cookieless_mode===i3||this.isRejected()||-1===this.consent&&this.Ee.cookieless_mode===i2}isOptedIn(){return!this.isOptedOut()}isExplicitlyOptedOut(){return 0===this.consent}isRejected(){return 0===this.consent||-1===this.consent&&this.Ee.opt_out_capturing_by_default}optInOut(e){this.Ye.A(this.Xe,+!!e,this.Ee.cookie_expiration,this.Ee.cross_subdomain_cookie,this.Ee.secure_cookie)}reset(){this.Ye.D(this.Xe,this.Ee.cross_subdomain_cookie)}get Xe(){var e=this._instance.config,t=e.token,i=e.opt_out_capturing_cookie_prefix;return e.consent_persistence_name||(i?i+t:"__ph_opt_in_out_"+t)}get Ke(){var e=this.Ye.q(this.Xe);return V(ef,e)?1:V(e_,e)?0:-1}get Ye(){var e=this.Ee.opt_out_capturing_persistence_type,t="localStorage"===e?s$:sP;if(!this.tr||this.tr!==t){this.tr=t;var i="localStorage"===e?sP:s$;i.q(this.Xe)&&(this.tr.q(this.Xe)||this.optInOut(V(ef,i.q(this.Xe))),i.D(this.Xe,this.Ee.cross_subdomain_cookie))}return this.tr}Je(){return!!this.Ee.respect_dnt&&[null==l?void 0:l.doNotTrack,null==l?void 0:l.msDoNotTrack,m.doNotTrack].some(e=>V(ef,e))}}function sA(e,t){var i,s=null==e||null==(i=e.config)?void 0:i.get_current_url;if(!Z(s))return t;try{var r=s(t);return es(r)&&r?r:t}catch(e){return t8.error("Error in get_current_url, falling back to window.location.href",e),t}}var sL="__POSTHOG_TOOLBAR__";function sD(e){return e instanceof Element&&(e.id===sL||!(null==e.closest||!e.closest(".toolbar-global-fade-container")))}function sN(e){return!!e&&1===e.nodeType}function sj(e,t){return!!e&&!!e.tagName&&e.tagName.toLowerCase()===t.toLowerCase()}function sq(e){return!!e&&3===e.nodeType}function sH(e){return!!e&&11===e.nodeType&&sN(e.host)}function sz(e){return e?G(e).split(/\s+/):[]}function sB(e,t){var i,s,r=ei(s=null==a||null==(i=a.location)?void 0:i.href)?void 0:sA(t,s);return!!(r&&e&&e.some(e=>r.match(e)))}function sU(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 sz(t)}function sV(e){return ea(e)?null:G(e).split(/(\s+)/).filter(e=>rr(e)).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255)}function sG(e){var t="";return s6(e)&&!s4(e)&&e.childNodes&&e.childNodes.length&&sr(e.childNodes,function(e){var i;sq(e)&&e.textContent&&(t+=null!=(i=sV(e.textContent))?i:"")}),G(t)}function sW(e){var t;return ei(e.target)?e.srcElement||null:null!=(t=e.target)&&t.shadowRoot?e.composedPath()[0]||null:e.target||null}var sY=["a","button","form","input","select","textarea","label"];function sJ(e,t){if(ei(t))return!0;var i,s=function(e){if(t.some(t=>(function(e,t){var i=e.matches||e.matchesSelector||e.msMatchesSelector||e.mozMatchesSelector||e.webkitMatchesSelector||e.oMatchesSelector;try{return!!i&&i.call(e,t)}catch(e){return!1}})(e,t)))return{v:!0}};for(var r of e)if(i=s(r))return i.v;return!1}function sK(e){var t=e.parentNode;return!(!t||!sN(t))&&t}var sX=[".ph-no-autocapture","[data-ph-no-autocapture]"],sQ=["next","previous","prev",">","<"],sZ=[...sQ,"+","-","−","–"],s0=(e,t)=>/[a-z0-9]/i.test(t)?e.includes(t):e===t,s1=[".ph-no-rageclick",".ph-no-capture"],s2=["","text","search","email","password","url","tel","number"];function s3(e,t){if(!a||s5(e)||(eu(t)?(s=!!t&&s1,r=void 0,n=!1):(s=null!=(o=null==t?void 0:t.css_selector_ignorelist)?o:s1,r=null==t?void 0:t.content_ignorelist,n=null!=(l=null==t?void 0:t.ignore_text_selection)&&l),!1===s)||n&&!(!(i=e)||!sN(i))&&(sj(i,"textarea")||(sj(i,"input")?V(s2,(i.getAttribute("type")||"").toLowerCase()):function(e){if(e.isContentEditable)return!0;var t=null==e.getAttribute?void 0:e.getAttribute("contenteditable");return"true"===t||""===t}(i))))return!1;var i,s,r,n,o,l,u=s8(e,!1).targetElementList;return!function(e,t){var i;if(!1===e||ei(e))return!1;if(!0===e)i=sQ;else{if(!Q(e))return!1;if(e.length>10)return t8.error("[PostHog] content_ignorelist array cannot exceed 10 items. Use css_selector_ignorelist for more complex matching."),!1;i=e.map(e=>e.toLowerCase())}return t.some(e=>{var t=e.safeText,s=e.ariaLabel;return i.some(e=>s0(t,e)||s0(s,e))})}(r,u.map(e=>{var t;return{safeText:sG(e).toLowerCase(),ariaLabel:(null==(t=e.getAttribute("aria-label"))?void 0:t.toLowerCase().trim())||""}}))&&!sJ(u,s)}var s5=e=>!e||sj(e,"html")||!sN(e),s8=(e,t)=>{if(!a||s5(e))return{parentIsUsefulElement:!1,targetElementList:[]};for(var i=!1,s=[e],r=e;r.parentNode&&!sj(r,"body");)if(sH(r.parentNode))s.push(r.parentNode.host),r=r.parentNode.host;else{var n=sK(r);if(!n)break;if(t||sY.indexOf(n.tagName.toLowerCase())>-1)i=!0;else try{var o=a.getComputedStyle(n);o&&"pointer"===o.getPropertyValue("cursor")&&(i=!0)}catch(e){}s.push(n),r=n}return{parentIsUsefulElement:i,targetElementList:s}};function s6(e){for(var t=new Set,i=0,s=e;s.parentNode&&!sj(s,"body");s=s.parentNode){if(i++>=1e3||t.has(s))return!1;t.add(s);var r=sU(s);if(V(r,"ph-sensitive")||V(r,"ph-no-capture"))return!1}if(V(sU(e),"ph-include"))return!0;var n=e.type||"";if(es(n))switch(n.toLowerCase()){case"hidden":case"password":return!1}
1var a=e.name||e.id||"";return!es(a)||!/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i.test(a.replace(/[^a-zA-Z0-9]/g,""))}function s4(e){return!!(sj(e,"input")&&!["button","checkbox","submit","reset"].includes(e.type)||sj(e,"select")||sj(e,"textarea")||"true"===e.getAttribute("contenteditable"))}var s9=RegExp("^(?:(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}))$"),s7=/(^|[^0-9A-Za-z_])([0-9][0-9 -]*[0-9])(?=$|[^0-9A-Za-z_])/g,re=[16,15,14,13],rt=RegExp("^(\\d{3}-?\\d{2}-?\\d{4})$"),ri=RegExp("(^|[^0-9])((?!000|666)[0-9]{3}-?(?!00)[0-9]{2}-?(?!0000)[0-9]{4})(?=$|([^0-9]))","g"),rs=/[0-9A-Za-z_]/;function rr(e,t){return void 0===t&&(t=!0),!(ea(e)||es(e)&&(e=G(e),(t?s9.test((e||"").replace(/[- ]/g,"")):function(e){var t;for(s7.lastIndex=0;t=s7.exec(e);){var i=t[2];if(i)for(var s=i.replace(/[- ]/g,""),r=0;s.length>r;r++)for(var n of re){var a=r+n;if(s.length>=a){var o=s.slice(r,a);if(s9.test(o)&&function(e){for(var t=0,i=!1,s=e.length-1;s>=0;s--){var r=e.charCodeAt(s)-48;i&&(r*=2)>9&&(r-=9),t+=r,i=!i}return t%10==0}(o))return!0}}}return!1}(e))||(t?rt.test(e):function(e){var t;for(ri.lastIndex=0;t=ri.exec(e);){var i=t[1],s=t[3];if(!(i&&s&&rs.test(i)&&rs.test(s)))return!0}return!1}(e))))&&!0}function rn(e){var t=sG(e);return rr(t=(t+" "+function e(t){var i="";return t&&t.childNodes&&t.childNodes.length&&sr(t.childNodes,function(t){var s;if(t&&"span"===(null==(s=t.tagName)?void 0:s.toLowerCase()))try{var r=sG(t);i=(i+" "+r).trim(),t.childNodes&&t.childNodes.length&&(i=(i+" "+e(t)).trim())}catch(e){t8.error("[AutoCapture]",e)}}),i}(e)).trim())?t:""}function ra(e){return e.replace(/"|\\"/g,'\\"')}var ro=t6("[Dead Clicks]"),rl=()=>!0,ru=e=>{var t,i=!(null==(t=e.instance.persistence)||!t.get_property(ic)),s=e.instance.config.capture_dead_clicks;return eu(s)?s:!!ee(s)||i};class rh{get lazyLoadedDeadClicksAutocapture(){return this.er}constructor(e,t,i){this.instance=e,this.isEnabled=t,this.onCapture=i,this.startIfEnabledOrStop()}onRemoteConfig(e){if(e.ok){var t=e.config;"captureDeadClicks"in t&&(this.instance.persistence&&this.instance.persistence.register({[ic]:t.captureDeadClicks}),this.startIfEnabledOrStop())}}startIfEnabledOrStop(){this.isEnabled(this)?this.rr(()=>{this.ir()}):this.stop()}rr(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?ro.error("failed to load script",t):e()})}ir(){var e;if(u){if(!this.er&&null!=(e=m.__PosthogExtensions__)&&e.initDeadClicksAutocapture){var t=ee(this.instance.config.capture_dead_clicks)?x({},this.instance.config.capture_dead_clicks):{};t.__onCapture=this.onCapture,this.onCapture&&(t.capture_dead_swipes=!1),this.er=m.__PosthogExtensions__.initDeadClicksAutocapture(this.instance,t),this.er.start(u),ro.info("starting...")}}else ro.error("`document` not found. Cannot start.")}stop(){this.er&&(this.er.stop(),this.er=void 0,ro.info("stopping..."))}}var rc=t6("[SegmentIntegration]"),rd="posthog-js";function rp(e,t){var i=void 0===t?{}:t,s=i.organization,r=i.projectId,n=i.prefix,a=i.severityAllowList,o=void 0===a?["error"]:a,l=i.sendExceptionsToPostHog,u=void 0===l||l;return t=>{if("*"!==o&&!o.includes(t.level)||!e.__loaded)return t;t.tags||(t.tags={});var i=e.requestRouter.endpointFor("ui","/project/"+e.config.token+"/person/"+e.get_distinct_id());t.tags["PostHog Person URL"]=i,e.sessionRecordingStarted()&&(t.tags["PostHog Recording URL"]=e.get_session_replay_url({withTimestamp:!0}));var a,l,h,c,d,p,v=(null==(a=t.exception)?void 0:a.values)||[],g=v.map(e=>x({},e,{stacktrace:e.stacktrace?x({},e.stacktrace,{type:"raw",frames:(e.stacktrace.frames||[]).map(e=>x({},e,{platform:"web:javascript"}))}):void 0})),f={$exception_message:(null==(l=v[0])?void 0:l.value)||t.message,$exception_type:null==(h=v[0])?void 0:h.type,$exception_level:t.level,$exception_list:g,$sentry_event_id:t.event_id,$sentry_exception:t.exception,$sentry_exception_message:(null==(c=v[0])?void 0:c.value)||t.message,$sentry_exception_type:null==(d=v[0])?void 0:d.type,$sentry_tags:t.tags};return s&&r&&(f.$sentry_url=(n||"https://sentry.io/organizations/")+s+"/issues/?project="+r+"&query="+t.event_id),u&&(null==(p=e.exceptions)||p.sendExceptionEvent(f)),t}}class rv{constructor(e,t,i,s,r,n){this.name=rd,this.setupOnce=function(a){a(rp(e,{organization:t,projectId:i,prefix:s,severityAllowList:r,sendExceptionsToPostHog:null==n||n}))}}}class rg{constructor(e){this.nr=(e,t,i)=>{i&&(i.noSessionId||i.activityTimeout||i.sessionPastMaximumLength||i.crossTabAdoption)&&(t8.
1info("[PageViewManager] Session rotated, clearing pageview state",{sessionId:e,changeReason:i}),this.sr=void 0,this._instance.scrollManager.resetContext())},this._instance=e,this.ar()}ar(){var e;this.lr=null==(e=this._instance.sessionManager)?void 0:e.onSessionId(this.nr)}destroy(){var e;null==(e=this.lr)||e.call(this),this.lr=void 0}doPageView(e,t){var i,s=this.ur(e,t);return this.sr={pathname:null!=(i=null==a?void 0:a.location.pathname)?i:"",pageViewId:t,timestamp:e},this._instance.scrollManager.resetContext(),s}doPageLeave(e){var t;return this.ur(e,null==(t=this.sr)?void 0:t.pageViewId)}doEvent(){var e;return{$pageview_id:null==(e=this.sr)?void 0:e.pageViewId}}ur(e,t){var i=this.sr;if(!i)return{$pageview_id:t};var s={$pageview_id:t,$prev_pageview_id:i.pageViewId},r=this._instance.scrollManager.getContext();if(r&&!this._instance.config.disable_scroll_properties){var n=r.maxScrollHeight,a=r.lastScrollY,o=r.maxScrollY,l=r.maxContentHeight,u=r.lastContentY,h=r.maxContentY;if(!(ei(n)||ei(a)||ei(o)||ei(l)||ei(u)||ei(h))){n=Math.ceil(n),a=Math.ceil(a),o=Math.ceil(o),l=Math.ceil(l),u=Math.ceil(u),h=Math.ceil(h);var c=n>1?em(a/n,0,1,t8):1,d=n>1?em(o/n,0,1,t8):1,p=l>1?em(u/l,0,1,t8):1,v=l>1?em(h/l,0,1,t8):1;s=sn(s,{$prev_pageview_last_scroll:a,$prev_pageview_last_scroll_percentage:c,$prev_pageview_max_scroll:o,$prev_pageview_max_scroll_percentage:d,$prev_pageview_last_content:u,$prev_pageview_last_content_percentage:p,$prev_pageview_max_content:h,$prev_pageview_max_content_percentage:v})}}return i.pathname&&(s.$prev_pageview_pathname=i.pathname),i.timestamp&&(s.$prev_pageview_duration=(e.getTime()-i.timestamp.getTime())/1e3),s}}var rf=["flags","surveys"],r_={[t7]:{exposure:"hidden"},[ii]:{exposure:"hidden"},__cmpns:{exposure:"hidden"},[is]:{exposure:"hidden"},[ir]:{exposure:"event"},[ia]:{exposure:"hidden"},[io]:{exposure:"event"},[il]:{exposure:"hidden"},[iu]:{exposure:"event"},[ih]:{exposure:"event"},[ic]:{exposure:"event"},[id]:{exposure:"hidden"},[ip]:{exposure:"event"},[iv]:{exposure:"hidden"},$session_recording_enabled_server_side:{exposure:"hidden"},[iw]:{exposure:"hidden"},[ix]:{exposure:"event"},[ig]:{exposure:"event",shouldSkipFromEventProperties:e=>en(e)},$session_past_minimum_duration:{exposure:"event"},$session_recording_url_trigger_activated_session:{exposure:"event"},$session_recording_event_trigger_activated_session:{exposure:"event"},$debug_first_full_snapshot_timestamp:{exposure:"event"},$sess_rec_flush_size:{exposure:"hidden"},[iE]:{exposure:"derived",storageGroup:"flags",shouldSkipFromEventProperties:(e,t)=>t(),transformToEventProperties(e){if(!ee(e))return{};for(var t={},i=Object.keys(e),s=0;i.length>s;s++)t["$feature/"+i[s]]=e[i[s]];return t}},[ik]:{exposure:"event",storageGroup:"flags"},[iS]:{exposure:"hidden"},[iP]:{exposure:"hidden",storageGroup:"flags"}
1,[iF]:{exposure:"event",storageGroup:"flags"},[i$]:{exposure:"event",storageGroup:"flags",volatile:!0},[iI]:{exposure:"hidden",storageGroup:"flags"},[iC]:{exposure:"event"},[iR]:{exposure:"hidden"},[iM]:{exposure:"hidden"},[iT]:{exposure:"hidden"},[iO]:{exposure:"hidden",storageGroup:"surveys"},[iA]:{exposure:"hidden",storageGroup:"surveys",volatile:!0},[iL]:{exposure:"event"},[iD]:{exposure:"hidden"},[iN]:{exposure:"hidden"},$product_tours_activated:{exposure:"hidden"},$product_tours_activated_session:{exposure:"hidden"},$conversations_widget_session_id:{exposure:"event"},$conversations_ticket_id:{exposure:"event"},$conversations_widget_state:{exposure:"event"},$conversations_user_traits:{exposure:"event"},[ij]:{exposure:"hidden"},[iq]:{exposure:"hidden"},[iH]:{exposure:"hidden"},[iz]:{exposure:"hidden",storageGroup:"flags",volatile:!0},[iB]:{exposure:"hidden"},[iU]:{exposure:"hidden"},[iV]:{exposure:"hidden"},[iG]:{exposure:"hidden"},[iW]:{exposure:"hidden"},[iY]:{exposure:"hidden"},[iJ]:{exposure:"hidden"},[i_]:{exposure:"event"},[im]:{exposure:"event"},[iy]:{exposure:"event"},[ib]:{exposure:"event"},[iQ]:{exposure:"event"},[iZ]:{exposure:"event"},[i0]:{exposure:"event"},$sdk_debug_replay_event_trigger_status:{exposure:"event"},$sdk_debug_replay_linked_flag_trigger_status:{exposure:"event"},$sdk_debug_replay_matched_recording_trigger_groups:{exposure:"event"},$sdk_debug_replay_remote_trigger_matching_config:{exposure:"event"},$sdk_debug_replay_trigger_groups_count:{exposure:"event"},$sdk_debug_replay_url_trigger_status:{exposure:"event"},$session_recording_start_reason:{exposure:"event"}},rm=[["$posthog_sr_group_event_trigger_",{exposure:"hidden"}],["$posthog_sr_group_url_trigger_",{exposure:"hidden"}],["$posthog_sr_group_sampling_",{exposure:"hidden"}]],ry=e=>{var t=r_[e];if(t)return t;for(var i of rm){var s=i[1];if(0===e.indexOf(i[0]))return s}},rb=(e,t)=>{try{return JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString():t,t)}catch(t){return Y(e)}},rw=e=>{var t=null==u?void 0:u.createElement("a");return ei(t)?null:(t.href=e,t)},rx=function(e,t){for(var i,s=((e.split("#")[0]||"").split(/\?(.*)/)[1]||"").replace(/^\?+/g,"").split("&"),r=0;s.length>r;r++){var n=s[r].split("=");if(n[0]===t){i=n;break}}if(!Q(i)||2>i.length)return"";var a=i[1];try{a=decodeURIComponent(a)}catch(e){t8.error("Skipping decoding for malformed query param: "+a)}return a.replace(/\+/g," ")},rE=function(e,t,i){if(!e||!t||!t.length)return e;for(var s=e.split("#"),r=s[1],n=(s[0]||"").split("?"),a=n[1],o=n[0],l=(a||"").split("&"),u=[],h=0;l.length>h;h++){var c=l[h].split("=");Q(c)&&(t.includes(c[0])?u.push(c[0]+"="+i):u.push(l[h]))}var d=o;return null!=a&&(d+="?"+u.join("&")),null!=r&&(d+="#"+r),d},rk=function(e,t){var i=e.match(RegExp(t+"=([^&]*)"));return i?i[1]:null},rS=(e,t)=>e>=t&&f(),rP=(e,t,i,s)=>{if(0===e){if(f()){var r=t+1;return r===i&&s(),r}return t}return 0},rF="https?://(.*)",r$=["gclid","gclsrc","dclid","gbraid","wbraid","fbclid","msclkid","twclid","li_fat_id","igshid","ttclid","rdt_cid","epik","qclid","sccid","irclid","_kx"],rI=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","gad_source","mc_cid",...r$],rC="<masked>",rR=["li_fat_id"];function rM(e,t,i){if(!u)return{};var s,r=t?[...r$,...i||[]]:[],n=rT(rE(u.URL,r,rC),e);return sn((s={},sr(rR,function(e){var t=sp(e);s[e]=t||null}),s),n)}function rT(e,t){var i=rI.concat(t||[]),s={};return sr(i,function(t){var i=rx(e,t);s[t]=i||null}),s}function rO(e){var t=e?0===e.search(rF+"google.([^/?]*)")?"google":0===e.search(rF+"bing.com")?"bing":0===e.search(rF+"yahoo.com")?"yahoo":0===e.search(rF+"duckduckgo.com")?"duckduckgo":null:null,i={};if(!en(t)){i.$search_engine=t;var s=u?rx(u.referrer,"yahoo"!=t?"q":"p"):"";s.length&&(i.ph_keyword=s)}return i}function rA(){return navigator.language||navigator.userLanguage}var rL="$direct";function rD(){return(null==u?void 0:u.referrer)||rL}function rN(e,t,i){void 0===i&&(i=!1);var s=e?[...r$,...t||[]]:[],r=i?tg(null==h?void 0:h.href):null==h?void 0:h.href,n=null==r?void 0:r.substring(0,1e3);return{r:rD().substring(0,1e3),u:n?rE(n,s,rC):void 0}}function rj(e,t){void 0===t&&(t=!1);var i,s=e.r,r=e.u,n=t?tg(r):r,a={$referrer:s,$referring_domain:null==s?void 0:s==rL?rL:null==(i=rw(s))?void 0:i.host};
1if(n){a.$current_url=n;var o=rw(n);a.$host=null==o?void 0:o.host,a.$pathname=null==o?void 0:o.pathname,sn(a,rT(n))}return s&&sn(a,rO(s)),a}function rq(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch(e){return}}var rH={flags:iz,surveys:iA},rz=["cookie","localstorage","localstorage+cookie","sessionstorage","memory"],rB="main";class rU{constructor(e,t,i){if(void 0===i&&(i=!0),this.hr={},this.dr=!1,this.cr=!1,this.Ee=e,this.vr=i,this.props={},this.pr=void 0,this.gr=(e=>{var t="";return e.token&&(t=e.token.replace(/\+/g,"PL").replace(/\//g,"SL").replace(/=/g,"EQ")),e.persistence_name?"ph_"+e.persistence_name:"ph_"+t+"_posthog"})(e),this.Ye=this.mr(e),this.cr=this.yr(e),this.load(),e.debug&&t8.info("Persistence loaded",e.persistence,x({},this.props)),this.update_config(e,e,t),this.save(),a){var s=()=>this.flush();sc(a,"beforeunload",s,{capture:!1}),sc(a,"pagehide",s,{capture:!1})}}br(){var e,t=null==(e=this.Ee)?void 0:e.persistence_save_debounce_ms;return eo(t)&&t>0?t:0}isDisabled(){return!!this._r}mr(e){-1===rz.indexOf(e.persistence.toLowerCase())&&(t8.critical("Unknown persistence type "+e.persistence+"; falling back to localStorage+cookie"),e.persistence="localStorage+cookie");var t,i,s,r,n=(t=e.cookie_persisted_properties||[],i=e.__preview_cookie_wins_on_conflict||!1,void 0===t&&(t=[]),void 0===i&&(i=!1),s=[...sI,...t],x({},s$,{F(e){try{var t={};try{t=sP.F(e)||{}}catch(e){}var s,r=JSON.parse(s$.q(e)||"{}");if(i){var n={};for(var a in t){var o=t[a];en(o)||""===o||(n[a]=o)}s=sn(r,n)}else s=sn(t,r);return s$.A(e,s),s}catch(e){}return null},A(e,t,i,r,n,a){var o=s$.A(e,t,void 0,void 0,a);try{var l={};s.forEach(e=>{t[e]&&(l[e]=t[e])}),Object.keys(l).length&&sP.A(e,l,i,r,n,a)}catch(e){s$.P(e)}return o},D(e,t){try{null==a||a.localStorage.removeItem(e),sP.D(e,t)}catch(e){s$.P(e)}}})),o=!1,l=e.persistence.toLowerCase();return"localstorage"===l&&s$.N()?(r=s$,o=!0):"localstorage+cookie"===l&&n.N()?(r=n,o=!0):"sessionstorage"===l&&sT.N()?r=sT:"memory"===l?r=sR:"cookie"===l?r=sP:n.N()?(r=n,o=!0):r=sP,this.dr=o,r}wr(e){return this.gr+"__"+e}yr(e){return this.dr&&!!e.split_storage}kr(e){var t=null!=e?e:this.Ee.feature_flag_cache_ttl_ms;if(!t||0>=t)return!1;var i=this.props[iz];return!i||"number"!=typeof i||Date.now()-i>t}properties(){var e={};return sr(this.props,(t,i)=>{var s=ry(i);if("derived"===(null==s?void 0:s.exposure)){if(null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,i===iE?()=>this.kr():()=>!1))return;s.transformToEventProperties&&sn(e,s.transformToEventProperties(t))}else if(!s||"event"===s.exposure){if(null!=s&&null!=s.shouldSkipFromEventProperties&&s.shouldSkipFromEventProperties(t,()=>!1))return;e[i]=t}}),e}load(){if(!this._r){var e=this.Ye.F(this.gr);e&&(this.props=sn({},e)),this.cr&&this.Sr()}}Sr(){for(var e of rf){var t=s$.F(this.wr(e));if(t&&!et(t)){var i=this.Cr(e);i.persisted=!0,this.Mr(e)||(i.fingerprint=this.Ir(t,e)),this.Tr(e,t)||sn(this.props,t)}}}Mr(e){return Object.keys(this.props).some(t=>{var i;return(null==(i=ry(t))?void 0:i.storageGroup)===e})}Tr(e,t){var i=rH[e];if(!i)return!1;var s=t[i],r=this.props[i];return eo(s)&&eo(r)&&r>s}refreshKey(e){var t;if(!this._r){var i=this.cr?null==(t=ry(e))?void 0:t.storageGroup:void 0,s=i?s$.F(this.wr(i)):this.Ye.F(this.gr);if(s&&e in s)this.Er(e,s[e]);else{if(i){var r=this.Ye.F(this.gr);if(r&&e in r)return void this.Er(e,r[e])}this.Rr(e)}}}save(){if(!this._r){var e=this.br();e>0?ei(this.Pr)&&(this.Pr=setTimeout(()=>{this.Pr=void 0,this.Or()},e)):this.Or()}}flush(){ei(this.Pr)||(clearTimeout(this.Pr),this.Pr=void 0,this.Or())}Or(){this._r||(this.cr?this.Fr():this.Ar(this.Ye,this.gr,this.props,rB))}Fr(){var e=this.$r(),t=e.main,i=e.groups;for(var s of(this.Ar(this.Ye,this.gr,t,rB),rf)){var r,n=i[s];(!et(n)||null!=(r=this.hr[s])&&r.persisted)&&this.Ar(s$,this.wr(s),n,s)}}$r(){var e={},t={flags:{},surveys:{}};return sr(this.props,(i,s)=>{var r,n=null==(r=ry(s))?void 0:r.storageGroup;n?t[n][s]=i:e[s]=i}),{main:e,groups:t}}Ir(e,t){if(t===rB)return JSON.stringify(e)+"|"+this.Lr+"|"+this.Dr+"|"+this.Nr;var i={};return sr(e,(e,t)=>{var s;i[t]=null!=(s=ry(t))&&s.volatile?"__volatile__":e}),JSON.stringify(i)}Ar(e,t,i,s){var r,n=this.Cr(s);if(s===rB||n.dirty||ei(n.fingerprint)){try{if((r=this.Ir(i,s))===n.fingerprint)return void(n.dirty=!1)}catch(e){r=void 0}e.A(t,i,this.Lr,this.Dr,this.Nr,this.Ee.debug)?(n.dirty=!1,s!==rB&&(n.persisted=!0),ei(r)||(n.fingerprint=r)):this.Ee.debug&&t8.warn('failed to persist storage entry "'+t+'"; will retry on next save')}}remove(e){var t=(void 0===e?{}:e).keepGroupEntries,i=void 0!==t&&t;if(ei(this.Pr)||(clearTimeout(this.Pr),this.Pr=void 0),this.Ye.D(this.gr,!1),this.Ye.D(this.gr,!0),!i&&this.vr)for(var s of rf)s$.D(this.wr(s));i?delete this.hr[rB]:this.hr={}}clear(){this.remove(),this.props={}}register_once(e,t,i){if(ee(e)){ei(t)&&(t="None"),this.Lr=ei(i)?this.qr:i;var s=!1;if(sr(e,(e,i)=>{this.props.hasOwnProperty(i)&&this.props[i]!==t||(this.Er(i,e),s=!0)}),s)return this.save(),!0}return!1}register(e,t){if(ee(e)){this.Lr=ei(t)?this.qr:t;var i=!1;if(sr(e,(t,s)=>{e.hasOwnProperty(s)&&this.props[s]!==t&&(this.Er(s,t),i=!0)}),i)return this.save(),!0}return!1}unregister(e){e in this.props&&(this.Rr(e),this.save())}update_campaign_params(){var e=null==u?void 0:u.URL;if(e!==this.pr){var t=rM(this.Ee.custom_campaign_params,this.Ee.mask_personal_data_properties,this.Ee.custom_personal_data_properties);et(su(t))||this.register(t),this.pr=e}}update_search_keyword(){var e;this.register((e=null==u?void 0:u.referrer)?rO(e):{})}update_referrer_info(){var e;this.register_once({$referrer:rD(),$referring_domain:null!=u&&u.referrer&&(null==(e=rw(u.referrer))?void 0:e.host)||rL},void 0)}set_initial_person_info(){this.props[iG]||this.props[iW]||this.register_once({[iY]:rN(this.Ee.mask_personal_data_properties,this.Ee.custom_personal_data_properties,this.Ee.disable_capture_url_hashes
1)},void 0)}get_initial_props(){var e,t,i,s={};sr([iW,iG],e=>{var t=this.props[e];t&&sr(t,function(e,t){s["$initial_"+W(t)]=e})});var r=this.props[iY];return r&&sn(s,(void 0===(e=this.Ee.disable_capture_url_hashes)&&(e=!1),t=rj(r,e),i={},sr(t,function(e,t){i["$initial_"+W(t)]=e}),i)),s}safe_merge(e){return sr(this.props,function(t,i){i in e||(e[i]=t)}),e}update_config(e,t,i){this.qr=this.Lr=e.cookie_expiration,this.set_disabled(e.disable_persistence||!!i),this.set_cross_subdomain(e.cross_subdomain_cookie),this.set_secure(e.secure_cookie);var s=e.persistence!==t.persistence||!((e,t)=>{if(e.length!==t.length)return!1;var i=[...e].sort(),s=[...t].sort();return i.every((e,t)=>e===s[t])})(e.cookie_persisted_properties||[],t.cookie_persisted_properties||[]),r=s?this.mr(e):this.Ye,n=this.yr(e);if(s||n!==this.cr){var a=this.props;this.clear(),this.Ye=r,this.cr=n,this.props=a,this.save()}}set_disabled(e){this._r=e,this._r?this.remove():this.save()}set_cross_subdomain(e){e!==this.Dr&&(this.Dr=e,this.remove({keepGroupEntries:!0}),this.save())}set_secure(e){e!==this.Nr&&(this.Nr=e,this.remove({keepGroupEntries:!0}),this.save())}set_event_timer(e,t){var i=this.props[is]||{};i[e]=t,this.Er(is,i),this.save()}remove_event_timer(e){var t=this.props[is]||{},i=t[e];return ei(i)||(delete t[e],this.Er(is,t),this.save()),i}get_property(e){return this.props[e]}set_property(e,t){this.Er(e,t),this.save()}Er(e,t){var i;this.props[e]=t,null!=(i=ry(e))&&i.volatile||this.jr(e)}Rr(e){delete this.props[e],this.jr(e)}jr(e){var t,i=null==(t=ry(e))?void 0:t.storageGroup;i&&(this.Cr(i).dirty=!0)}Cr(e){return this.hr[e]||(this.hr[e]={})}}function rV(e){var t=!0;return{dispose(){if(t){t=!1;var i=e();i&&Z(i.then)&&i.then(void 0,()=>{})}}}}var rG="gzip-js",rW="base64",rY="events",rJ="cancelEvents",rK="survey shown",rX="survey dismissed",rQ="survey sent",rZ="popover",r0=t6("[RateLimiter]");class r1{constructor(e){this.serverLimits={},this.lastEventRateLimited=!1,this.checkForLimiting=e=>{var t=e.text;if(t&&t.length)try{(JSON.parse(t).quota_limited||[]).forEach(e=>{r0.info((e||"events")+" is quota limited."),this.serverLimits[e]=(new Date).getTime()+6e4})}catch(e){return void r0.warn('could not rate limit - continuing. Error: "'+(null==e?void 0:e.message)+'"',{text:t})}},this.instance=e,this.lastEventRateLimited=this.clientRateLimitContext(!0).isRateLimited}get captureEventsPerSecond(){var e;return(null==(e=this.instance.config.rate_limiting)?void 0:e.events_per_second)||10}get captureEventsBurstLimit(){var e;return Math.max((null==(e=this.instance.config.rate_limiting)?void 0:e.events_burst_limit)||10*this.captureEventsPerSecond,this.captureEventsPerSecond)}clientRateLimitContext(e){void 0===e&&(e=!1);var t,i,s,r=this.captureEventsBurstLimit,n=this.captureEventsPerSecond,a=(new Date).getTime(),o=null!=(t=null==(i=this.instance.persistence)?void 0:i.get_property(iV))?t:{tokens:r,last:a};o.tokens+=(a-o.last)/1e3*n,o.last=a,o.tokens>r&&(o.tokens=r);var l=1>o.tokens;return l||e||(o.tokens=Math.max(0,o.tokens-1)),!l||this.lastEventRateLimited||e||this.instance.capture("$$client_ingestion_warning",{$$client_ingestion_warning_message:"posthog-js client rate limited. Config is set to "+n+" events per second and "+r+" events burst limit."},{skip_client_rate_limiting:!0}),this.lastEventRateLimited=l,null==(s=this.instance.persistence)||s.set_property(iV,o),{isRateLimited:l,remainingTokens:o.tokens}}isServerRateLimited(e){var t=this.serverLimits[e||"events"]||!1;return!1!==t&&(new Date).getTime()<t}}var r2=t6("[RemoteConfig]");class r3{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}Hr(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)):e()}Br(e){this._instance._send_request({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 r2.info("Using preloaded remote config",this.remoteConfig),this.Ur(this.remoteConfig),void this.zr();if(this._instance.Vr())return void r2.warn("Remote config is disabled. Falling back to local config.");this.Hr(e=>{e?(this.Ur(e),this.zr()):(r2.info("No config found after loading remote JS config. Falling back to JSON."),this.Br(e=>{this.Ur(e),this.zr()}))})}catch(e){r2.error("Error loading remote config",e),this.Ur()}}stop(){this.Wr&&(clearInterval(this.Wr),this.Wr=void 0)}
vendor: 4,382 bytes, line 1
1refresh(){!this._instance.Vr()&&u&&"hidden"!==u.visibilityState&&this._instance.reloadFeatureFlags()}zr(){var e;if(!this.Wr){var t=null!=(e=this._instance.config.remote_config_refresh_interval_ms)?e:3e5;0!==t&&(this.Wr=setInterval(()=>{this.refresh()},t))}}Ur(e){e||r2.error("Failed to fetch remote config from PostHog.");try{this._instance.Ur(e?{ok:!0,config:e}:{ok:!1})}catch(e){r2.error("Error applying remote config",e)}if(!1!==(null==e?void 0:e.hasFeatureFlags)&&!this._instance.config.advanced_disable_feature_flags_on_first_load)try{var t;null==(t=this._instance.featureFlags)||t.ensureFlagsLoaded()}catch(e){r2.error("Error loading feature flags",e)}}}var r5=Uint8Array,r8=Uint16Array,r6=Uint32Array,r4=new r5([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]),r9=new r5([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]),r7=new r5([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ne=function(e,t){for(var i=new r8(31),s=0;31>s;++s)i[s]=t+=1<<e[s-1];var r=new r6(i[30]);for(s=1;30>s;++s)for(var n=i[s];i[s+1]>n;++n)r[n]=n-i[s]<<5|s;return[i,r]},nt=ne(r4,2),ni=nt[1];nt[0][28]=258,ni[258]=28;for(var ns=ne(r9,0)[1],nr=new r8(32768),nn=0;32768>nn;++nn){var na=(43690&nn)>>>1|(21845&nn)<<1;nr[nn]=((65280&(na=(61680&(na=(52428&na)>>>2|(13107&na)<<2))>>>4|(3855&na)<<4))>>>8|(255&na)<<8)>>>1}var no=function(e,t,i){for(var s=e.length,r=0,n=new r8(t);s>r;++r)++n[e[r]-1];var a,o=new r8(t);for(r=0;t>r;++r)o[r]=o[r-1]+n[r-1]<<1;if(i){a=new r8(1<<t);var l=15-t;for(r=0;s>r;++r)if(e[r])for(var u=r<<4|e[r],h=t-e[r],c=o[e[r]-1]++<<h,d=c|(1<<h)-1;d>=c;++c)a[nr[c]>>>l]=u}else for(a=new r8(s),r=0;s>r;++r)a[r]=nr[o[e[r]-1]++]>>>15-e[r];return a},nl=new r5(288);for(nn=0;144>nn;++nn)nl[nn]=8;for(nn=144;256>nn;++nn)nl[nn]=9;for(nn=256;280>nn;++nn)nl[nn]=7;for(nn=280;288>nn;++nn)nl[nn]=8;var nu=new r5(32);for(nn=0;32>nn;++nn)nu[nn]=5;var nh=no(nl,9,0),nc=no(nu,5,0),nd=function(e){return(e/8|0)+(7&e&&1)},np=function(e,t,i){(null==i||i>e.length)&&(i=e.length);var s=new(e instanceof r8?r8:e instanceof r6?r6:r5)(i-t);return s.set(e.subarray(t,i)),s},nv=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8},ng=function(e,t,i){var s=t/8|0;e[s]|=i<<=7&t,e[s+1]|=i>>>8,e[s+2]|=i>>>16},nf=function(e,t){for(var i=[],s=0;e.length>s;++s)e[s]&&i.push({s:s,f:e[s]});var r=i.length,n=i.slice();if(!r)return[new r5(0),0];if(1==r){var a=new r5(i[0].s+1);return a[i[0].s]=1,[a,1]}i.sort(function(e,t){return e.f-t.f}),i.push({s:-1,f:25001});var o=i[0],l=i[1],u=0,h=1,c=2;for(i[0]={s:-1,f:o.f+l.f,l:o,r:l};h!=r-1;)o=i[i[c].f>i[u].f?u++:c++],l=i[u!=h&&i[c].f>i[u].f?u++:c++],i[h++]={s:-1,f:o.f+l.f,l:o,r:l};var d=n[0].s;for(s=1;r>s;++s)n[s].s>d&&(d=n[s].s);var p=new r8(d+1),v=n_(i[h-1],p,0);if(v>t){s=0;var g=0,f=v-t,_=1<<f;for(n.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r>s;++s){var m=n[s].s;if(t>=p[m])break;g+=_-(1<<v-p[m]),p[m]=t}for(g>>>=f;g>0;){var y=n[s].s;t>p[y]?g-=1<<t-p[y]++-1:++s}for(;s>=0&&g;--s){var b=n[s].s;p[b]==t&&(--p[b],++g)}v=t}return[new r5(p),v]},n_=function(e,t,i){return -1==e.s?Math.max(n_(e.l,t,i+1),n_(e.r,t,i+1)):t[e.s]=i},nm=function(e){for(var t=e.length;t&&!e[--t];);for(var i=new r8(++t),s=0,r=e[0],n=1,a=function(e){i[s++]=e},o=1;t>=o;++o)if(e[o]==r&&o!=t)++n;else{if(!r&&n>2){for(;n>138;n-=138)a(32754);n>2&&(a(n>10?n-11<<5|28690:n-3<<5|12305),n=0)}else if(n>3){for(a(r),--n;n>6;n-=6)a(8304);n>2&&(a(n-3<<5|8208),n=0)}for(;n--;)a(r);n=1,r=e[o]}return[i.subarray(0,s),t]},ny=function(e,t){for(var i=0,s=0;t.length>s;++s)i+=e[s]*t[s];return i},nb=function(e,t,i){var s=i.length,r=nd(t+2);e[r]=255&s,e[r+1]=s>>>8,e[r+2]=255^e[r],e[r+3]=255^e[r+1];for(var n=0;s>n;++n)e[r+n+4]=i[n];return 8*(r+4+s)},nw=function(e,t,i,s,r,n,a,o,l,u,h){nv(t,h++,i),++r[256];for(var c=nf(r,15),d=c[0],p=c[1],v=nf(n,15),g=v[0],f=v[1],_=nm(d),m=_[0],y=_[1],b=nm(g),w=b[0],x=b[1],E=new r8(19),k=0;m.length>k;++k)E[31&m[k]]++;for(k=0;w.length>k;++k)E[31&w[k]]++;for(var S=nf(E,7),P=S[0],F=S[1],$=19;$>4&&!P[r7[$-1]];--$);var I,C,R,M,T=u+5<<3,O=ny(r,nl)+ny(n,nu)+a,A=ny(r,d)+ny(n,g)+a+14+3*$+ny(E,P)+(2*E[16]+3*E[17]+7*E[18]);if(O>=T&&A>=T)return nb(t,h,e.subarray(l,l+u));if(nv(t,h,1+(O>A)),h+=2,O>A){I=no(d,p,0),C=d,R=no(g,f,0),M=g;var L=no(P,F,0);for(nv(t,h,y-257),nv(t,h+5,x-1),nv(t,h+10,$-4),h+=14,k=0;$>k;++k)nv(t,h+3*k,P[r7[k]]);h+=3*$;for(var D=[m,w],N=0;2>N;++N){var j=D[N];for(k=0;j.length>k;++k)nv(t,h,L[q=31&j[k]]),h+=P[q],q>
115&&(nv(t,h,j[k]>>>5&127),h+=j[k]>>>12)}}else I=nh,C=nl,R=nc,M=nu;for(k=0;o>k;++k)if(s[k]>255){ng(t,h,I[257+(q=s[k]>>>18&31)]),h+=C[q+257],q>7&&(nv(t,h,s[k]>>>23&31),h+=r4[q]);var q,H=31&s[k];ng(t,h,R[H]),h+=M[H],H>3&&(ng(t,h,s[k]>>>5&8191),h+=r9[H])}else ng(t,h,I[s[k]]),h+=C[s[k]];return ng(t,h,I[256]),h+C[256]},nx=new r6([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),nE=function(){for(var e=new r6(256),t=0;256>t;++t){for(var i=t,s=9;--s;)i=(1&i&&0xedb88320)^i>>>1;e[t]=i}return e}(),nk=function(e,t,i){for(;i;++t)e[t]=i,i>>>=8},nS=!!d||!!c,nP="text/plain",nF=!1,n$=(e,t)=>{var i=e.split("#"),s=i[1],r=i[0].split("?"),n=r[0],a=r[1];if(!a)return e;var o=a.split("&").filter(e=>e.split("=")[0]!==t).join("&");return n+(o?"?"+o:"")+(s?"#"+s:"")},nI=function(e,t,i){void 0===i&&(i=!0);var s,r,n,a,o,l=e.split("?"),u=l[0],h=l[1],c=x({},t),d=null!=(o=null==h?void 0:h.split("&").map(e=>{var t,s=e.split("="),r=s[0],n=i&&null!=(t=c[r])?t:s[1];return delete c[r],r+"="+n}))?o:[],p=(void 0===s&&(s="&"),a=[],sr(c,function(e,t){ei(e)||ei(t)||"undefined"===t||(r=encodeURIComponent(e instanceof File?e.name:e.toString()),n=encodeURIComponent(t),a[a.length]=n+"="+r)}),a.join(s));return p&&d.push(p),d.length>0?u+"?"+d.join("&"):u},nC=e=>{if(e.Zr)return e.Zr;var t=e.data,i=e.compression;if(t){if(i===rG){var s,r,n,a,o,l,u,h,c=(s=function(e){var t=e.length;if("u">typeof TextEncoder)return(new TextEncoder).encode(e);for(var i=new r5(e.length+(e.length>>>1)),s=0,r=function(e){i[s++]=e},n=0;t>n;++n){if(s+5>i.length){var a=new r5(s+8+(t-n<<1));a.set(i),i=a}var o=e.charCodeAt(n);128>o?r(o):(2048>o?r(192|o>>>6):(o>55295&&57344>o?(r(240|(o=65536+(1047552&o)|1023&e.charCodeAt(++n))>>>18),r(128|o>>>12&63)):r(224|o>>>12),r(128|o>>>6&63)),r(128|63&o))}return np(i,0,s)}(rb(t)),r={mtime:0},n=0xffffffff,a={p(e){for(var t=n,i=0;e.length>i;++i)t=nE[255&t^e[i]]^t>>>8;n=t},d:()=>0xffffffff^n},o=s.length,a.p(s),h=(l=10+(r.filename&&r.filename.length+1||0),u=function(e,t,i,s){var r=e.length,n=new r5(s+r+5*(1+Math.floor(r/7e3))+8),a=n.subarray(s,n.length-8),o=0;if(!t||8>r)for(var l=0;r>=l;l+=65535){var u=l+65535;r>u?o=nb(a,o,e.subarray(l,u)):(a[l]=!0,o=nb(a,o,e.subarray(l,r)))}else{for(var h=nx[t-1],c=h>>>13,d=8191&h,p=(1<<i)-1,v=new r8(32768),g=new r8(p+1),f=Math.ceil(i/3),_=2*f,m=function(t){return(e[t]^e[t+1]<<f^e[t+2]<<_)&p},y=new r6(25e3),b=new r8(288),w=new r8(32),x=0,E=0,k=(l=0,0),S=0,P=0;r>l;++l){var F=m(l),$=32767&l,I=g[F];if(v[$]=I,g[F]=$,l>=S){var C=r-l;if((x>7e3||k>24576)&&C>
1423){o=nw(e,a,0,y,b,w,E,k,P,l-P,o),k=x=E=0,P=l;for(var R=0;286>R;++R)b[R]=0;for(R=0;30>R;++R)w[R]=0}var M=2,T=0,O=d,A=$-I&32767;if(C>2&&F==m(l-A))for(var L=Math.min(c,C)-1,D=Math.min(32767,l),N=Math.min(258,C);D>=A&&--O&&$!=I;){if(e[l+M]==e[l+M-A]){for(var j=0;N>j&&e[l+j]==e[l+j-A];++j);if(j>M){if(M=j,T=A,j>L)break;var q=Math.min(A,j-2),H=0;for(R=0;q>R;++R){var z=l-A+R+32768&32767,B=z-v[z]+32768&32767;B>H&&(H=B,I=z)}}}A+=($=I)-(I=v[$])+32768&32767}if(T){y[k++]=0x10000000|ni[M]<<18|ns[T];var U=31&ni[M],V=31&ns[T];E+=r4[U]+r9[V],++b[257+U],++w[V],S=l+M,++x}else y[k++]=e[l],++b[e[l]]}}o=nw(e,a,!0,y,b,w,E,k,P,l-P,o)}return np(n,0,s+nd(o)+8)}(s,null==r.level?6:r.level,null==r.mem?Math.ceil(1.5*Math.max(8,Math.min(13,Math.log(s.length)))):12+r.mem,l)).length,function(e,t){var i=t.filename;if(e[0]=31,e[1]=139,e[2]=8,e[8]=2>t.level?4:2*(9==t.level),e[9]=3,0!=t.mtime&&nk(e,4,Math.floor(new Date(t.mtime||Date.now())/1e3)),i){e[3]=8;for(var s=0;i.length>=s;++s)e[s+10]=i.charCodeAt(s)}}(u,r),nk(u,h-8,a.d()),nk(u,h-4,o),u);return{contentType:nP,body:c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength),estimatedSize:c.byteLength}}if(i===rW){let e;var d,p="data="+encodeURIComponent("string"==typeof(e=(d=rb(t))?btoa(encodeURIComponent(d).replace(/%([0-9A-F]{2})/g,(e,t)=>String.fromCharCode(parseInt(t,16)))):d)?e:rb(e));return{contentType:"application/x-www-form-urlencoded",body:p,estimatedSize:new Blob([p]).size}}var v=rb(t);return{contentType:"application/json",body:v,estimatedSize:new Blob([v]).size}}},nR=e=>{var t,i,s=()=>"sendBeacon"===e.transport?{url:nI(e.url,{compression:rW}),encodedBody:nC(x({},e,{compression:rW,Zr:void 0}))}:{url:n$(e.url,"compression"),encodedBody:nC(x({},e,{compression:void 0,Zr:void 0}))};try{t=nC(e)}catch(t){if(N(e.compression,rx(e.url,"compression")))return t8.error("Failed to gzip request body, sending uncompressed payload",t),s();throw t}return!(t&&N(e.compression,rx(e.url,"compression")))||((i=t.body)instanceof ArrayBuffer?D(new Uint8Array(i)):ArrayBuffer.isView(i)&&D(new Uint8Array(i.buffer,i.byteOffset,i.byteLength)))?{url:e.url,encodedBody:t}:(nF=!0,s())},nM=e=>{try{return nR(e)}catch(t){return t8.error(t),void(null==e.callback||e.callback({statusCode:0,error:t}))}},nT=(s=w(function*(e){var t=rb(e.data),i=yield function(e,t,i){return z.apply(this,arguments)}(t,y.DEBUG,{rethrow:!0});if(!i)return e;var s=yield i.arrayBuffer();return x({},e,{Zr:{contentType:nP,body:s,estimatedSize:s.byteLength}})}),function(e){return s.apply(this,arguments)}),nO=/Failed to fetch|NetworkError|Load failed/i,nA=e=>{var t=nM(e);if(t){var i,s=t.url,r=t.encodedBody,n=null!=r?r:{},a=n.contentType,o=n.body,l=n.estimatedSize,u=new Headers;sr(e.headers,function(e,t){u.append(t,e)}),a&&u.append("Content-Type",a);var h=null,d=!1;if(p){var v=new p;h={signal:v.signal,timeout:setTimeout(()=>{var t,i;d=!0,v.abort(((i=Error("PostHog request timed out"+((t=e.timeout)?" after "+t+"ms":""))).name="AbortError",i))},e.timeout)}}var g=t=>{d&&"AbortError"===(null==t?void 0:t.name)||"TypeError"===(null==t?void 0:t.name)&&nO.test((null==t?void 0:t.message)||"")?t8.warn(t):t8.error(t),null==e.callback||e.callback({statusCode:0,error:t})};try{c(s,x({method:(null==e?void 0:e.method)||"GET",headers:u,keepalive:"POST"===e.method&&!e.Gr&&52428.8>(l||0),body:o,signal:null==(i=h)?void 0:i.signal},e.fetchOptions)).then(t=>t.text().then(i=>{var s={statusCode:t.status,text:i};if(200===t.status)try{s.json=JSON.parse(i)}catch(e){t8.error(e)}null==e.callback||e.callback(s)})).catch(g).finally(()=>h?clearTimeout(h.timeout):null)}catch(e){h&&clearTimeout(h.timeout),g(e)}}},nL=e=>{try{var t,i=nR(e),s=i.url,r=i.encodedBody,n=null!=r?r:{},a=n.body,o=n.estimatedSize;if(!a)return;var u=a instanceof Blob?a:new Blob([a],{type:n.contentType});if(l.sendBeacon(s,u))return;var h=Q(e.data)?e.data:null==(t=e.data)?void 0:t.batch;if(Q(h)&&h.length>1&&(null!=o?o:0)>16384){var c=Math.ceil(h.length/2),d=t=>Q(e.data)?t:x({},e.data,{batch:t});return nL(x({},e,{data:d(h.slice(0,c))})),void nL(x({},e,{data:d(h.slice(c))}))}t8.warn("Beacon of ~"+(null!=o?o:0)+" bytes was rejected by the browser, falling back to fetch"),nA(x({},e,{Gr:!0}))}catch(e){t8.warn("Beacon send failed",e)}},nD=(e,t,i,s)=>{var r="query"===s?"POST"===t?"sent_at":"_":void 0;return nI(i===rG?n$(e,"compression"):e,x({},r?{[r]:Date.now().toString()}:{},i===rG?{}:{compression:i}))},nN=[];c&&nN.push({transport:"fetch",method:nA}),d&&nN.push({transport:"XHR",method(e){var t=nM(e);if(t){var i=new d,s=t.encodedBody;i.open(e.method||"GET",t.url,!0);var r=null!=s?s:{},n=r.contentType,a=r.body;sr(e.headers,function(e,t){i.setRequestHeader(t,e)}),n&&i.setRequestHeader("Content-Type",n),e.timeout&&(i.timeout=e.timeout),i.onreadystatechange=()=>{if(4===i.readyState){var t={statusCode:i.status,text:i.responseText};
1if(200===i.status)try{t.json=JSON.parse(i.responseText)}catch(e){}null==e.callback||e.callback(t)}},i.send(a)}}}),null!=l&&l.sendBeacon&&nN.push({transport:"sendBeacon",method:nL});class nj{constructor(e,t){this.Qr=!0,this.Jr=[],this.Kr=em((null==t?void 0:t.flush_interval_ms)||3e3,250,5e3,t8.createLogger("flush interval"),3e3),this.Yr=e}enqueue(e){this.Jr.push(e),this.Xr||this.ti()}unload(){this.ei();var e=Object.values(this.Jr.length>0?this.ri():{});[...e.filter(e=>0===e.url.indexOf("/e")),...e.filter(e=>0!==e.url.indexOf("/e"))].map(e=>{this.ii(x({},e,{transport:"sendBeacon"}))})}enable(){this.Qr=!1,this.ti()}ti(){var e=this;this.Qr||(this.Xr=setTimeout(()=>{if(this.ei(),this.Jr.length>0){var t=this.ri();for(var i in t)!function(){var s=t[i],r=(new Date).getTime();s.data&&Q(s.data)&&sr(s.data,e=>{e.offset=Math.abs(e.timestamp-r),delete e.timestamp}),e.ii(s)}()}},this.Kr))}ii(e){try{this.Yr(e)}catch(e){t8.error(e)}}ei(){clearTimeout(this.Xr),this.Xr=void 0}ri(){var e={};return sr(this.Jr,t=>{var i,s=(t?t.batchKey:null)||t.url;ei(e[s])&&(e[s]=x({},t,{data:[]})),null==(i=e[s].data)||i.push(t.data)}),this.Jr=[],e}}var nq=["retriesPerformedSoFar"];class nH{constructor(e){this.ni=!1,this.si=3e3,this.Jr=[],this._instance=e,this.Jr=[],this.oi=!0,!ei(a)&&"onLine"in a.navigator&&(this.oi=a.navigator.onLine,this.ai=()=>{this.oi=!0,this.li()},this.ui=()=>{this.oi=!1},sc(a,"online",this.ai),sc(a,"offline",this.ui))}get length(){return this.Jr.length}retriableRequest(e){var t=e.retriesPerformedSoFar,i=E(e,nq);el(t)&&(i.url=nI(i.url,{retry_count:t})),this._instance._send_request(x({},i,{callback:e=>{if(200!==e.statusCode&&(400>e.statusCode||e.statusCode>=500)){if((0===e.statusCode?3:10)>(null!=t?t:0))return void this.Ot(x({retriesPerformedSoFar:t},i));0===e.statusCode&&t8.warn("Request failed before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped retrying after "+(null!=t?t:0)+" retries.")}null==i.callback||i.callback(e)}}))}Ot(e){var t,i,s=e.retriesPerformedSoFar||0;e.retriesPerformedSoFar=s+1;var r=Math.ceil((i=Math.min(18e5,t=3e3*Math.pow(2,s)))+(Math.random()-.5)*(i-t/2)),n=Date.now()+r;this.Jr.push({retryAt:n,requestOptions:e});var a="Enqueued failed request for retry in "+r;navigator.onLine||(a+=" (Browser is offline)"),t8.warn(a),this.ni||(this.ni=!0,this.hi())}hi(){(this.di&&clearTimeout(this.di),0===this.Jr.length)?(this.ni=!1,this.di=void 0):this.di=setTimeout(()=>{this.oi&&this.Jr.length>0&&this.li(),this.hi()},this.si)}li(){var e=Date.now(),t=[],i=this.Jr.filter(i=>e>i.retryAt||(t.push(i),!1));if(this.Jr=t,i.length>0)for(var s of i)this.retriableRequest(s.requestOptions)}unload(){for(var e of(this.di&&(clearTimeout(this.di),this.di=void 0),this.ni=!1,ei(a)||(this.ai&&(a.removeEventListener("online",this.ai),this.ai=void 0),this.ui&&(a.removeEventListener("offline",this.ui),this.ui=void 0)),this.Jr)){var t=e.requestOptions;try{this._instance._send_request(x({},t,{transport:"sendBeacon"}))}catch(e){t8.error(e)}}this.Jr=[]}}class nz{constructor(e){this.ci=()=>{this.vi||(this.vi={});var e,t,i,s,r=this.scrollElement(),n=this.scrollY(),a=r?Math.max(0,r.scrollHeight-r.clientHeight):0,o=n+((null==r?void 0:r.clientHeight)||0),l=(null==r?void 0:r.scrollHeight)||0;this.vi.lastScrollY=Math.ceil(n),this.vi.maxScrollY=Math.max(n,null!=(e=this.vi.maxScrollY)?e:0),this.vi.maxScrollHeight=Math.max(a,null!=(t=this.vi.maxScrollHeight)?t:0),this.vi.lastContentY=o,this.vi.maxContentY=Math.max(o,null!=(i=this.vi.maxContentY)?i:0),this.vi.maxContentHeight=Math.max(l,null!=(s=this.vi.maxContentHeight)?s:0)},this._instance=e}get fi(){return this._instance.config.scroll_root_selector}getContext(){return this.vi}resetContext(){var e=this.vi;return setTimeout(this.ci,0),e}startMeasuringScrollPosition(){sc(a,"scroll",this.ci,{capture:!0}),sc(a,"scrollend",this.ci,{capture:!0}),sc(a,"resize",this.ci)}scrollElement(){if(!this.fi)return null==a?void 0:a.document.documentElement;for(var e of Q(this.fi)?this.fi:[this.fi]){var t=null==a?void 0:a.document.querySelector(e);if(t)return t}}pi(e){if(this.fi){var t=this.scrollElement();return t&&t["y"===e?"scrollTop":"scrollLeft"]||0}return a?"y"===e?a.scrollY||a.pageYOffset||a.document.documentElement.scrollTop||0:a.scrollX||a.pageXOffset||a.document.documentElement.scrollLeft||0:0}scrollY(){return this.pi("y")}scrollX(){return this.pi("x")}}var nB=e=>rN(null==e?void 0:e.config.mask_personal_data_properties,null==e?void 0:e.config.custom_personal_data_properties,null==e?void 0:e.config.disable_capture_url_hashes
1);class nU{constructor(e,t,i,s){this.gi=e=>{var t=this.mi();if(!t||t.sessionId!==e){var i={sessionId:e,props:this.yi(this._instance)};this.bi.register({[iU]:i})}},this._instance=e,this.wi=t,this.bi=i,this.yi=s||nB,this.wi.onSessionId(this.gi)}mi(){return this.bi.props[iU]}getSetOnceProps(){var e,t=null==(e=this.mi())?void 0:e.props;return t?"r"in t?rj(t,this._instance.config.disable_capture_url_hashes):{$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 sr(su(this.getSetOnceProps()),(t,i)=>{"$current_url"===i&&(i="url"),e["$session_entry_"+W(i)]=t}),e}}class nV{on(e,t){return this.xi[e]||(this.xi[e]=[]),this.xi[e].push(t),()=>{this.xi[e]=this.xi[e].filter(e=>e!==t)}}emit(e,t){for(var i of this.xi[e]||[])i(t);for(var s of this.xi["*"]||[])s(e,t)}constructor(){this.xi={}}}var nG=t6("[SessionId]");class nW{on(e,t){return this.ki.on(e,t)}constructor(e,t,i){if(this.Si=null,this.Ci=[],this.Mi=void 0,this.Ii=!1,this.ki=new nV,this.Ti=(e,t)=>!(!el(e)||!el(t))&&Math.abs(e-t)>this.sessionTimeoutMs,!e.persistence)throw Error("SessionIdManager requires a PostHogPersistence instance");if(e.config.cookieless_mode===i3)throw Error('SessionIdManager cannot be used with cookieless_mode="always"');this.Ee=e.config,this.bi=e.persistence,this.Ei=void 0,this.Ri=void 0,this._sessionStartTimestamp=null,this._sessionActivityTimestamp=null,this.Pi=t||sx,this.Oi=i||sx;var s,r=this.Ee.persistence_name||this.Ee.token;if(this._sessionTimeoutMs=1e3*em(this.Ee.session_idle_timeout_seconds||1800,60,36e3,nG.createLogger("session_idle_timeout_seconds"),1800),e.register({$configured_session_timeout_ms:this._sessionTimeoutMs}),this.Fi(),this.Ai="ph_"+r+"_window_id",this.$i="ph_"+r+"_primary_window_exists",this.Li()){var n=sT.F(this.Ai),a=sT.F(this.$i);n&&!a?this.Ei=n:sT.D(this.Ai),sT.A(this.$i,!0)}if(null!=(s=this.Ee.bootstrap)&&s.sessionID)try{var o=(e=>{var t=this.Ee.bootstrap.sessionID.replace(/-/g,"");if(32!==t.length)throw Error("Not a valid UUID");if("7"!==t[12])throw Error("Not a UUIDv7");return parseInt(t.substring(0,12),16)})();this.Di(this.Ee.bootstrap.sessionID,(new Date).getTime(),o)}catch(e){nG.error("Invalid sessionID in bootstrap",e)}this.Ni()}get sessionTimeoutMs(){return this._sessionTimeoutMs}onSessionId(e){return ei(this.Ci)&&(this.Ci=[]),this.Ci.push(e),this.Ri&&e(this.Ri,this.Ei),()=>{this.Ci=this.Ci.filter(t=>t!==e)}}Li(){return"memory"!==this.Ee.persistence&&!this.bi._r&&sT.N()}qi(e){e!==this.Ei&&(this.Ei=e,this.Li()&&sT.A(this.Ai,e))}ji(){return this.Ei?this.Ei:this.Li()?sT.F(this.Ai):null}Hi(e){var t=this.Si;return!en(t)&&!en(e)&&5e3>Math.abs(e-t)}Di(e,t,i){var s=t!==this._sessionActivityTimestamp,r=e===this.Ri&&i===this._sessionStartTimestamp;this._sessionStartTimestamp=i,this._sessionActivityTimestamp=t,this.Ri=e,r&&!s||r&&this.Hi(t)||(this.Si=t,this.bi.register({[iw]:[t,e,i]}))}Bi(){var e,t=null==(e=this.Ee)?void 0:e.persistence_save_debounce_ms;return el(t)&&t>0}Ui(){this.Bi()?this.bi.refreshKey(iw):(this.bi.flush(),this.bi.load())}zi(){var e;if(!en(this._sessionActivityTimestamp)&&this._sessionActivityTimestamp!==this.Si){this.Ui();var t=this.Vi();t[1]===this.Ri&&t[2]===this._sessionStartTimestamp&&(this.Si=this._sessionActivityTimestamp,this.bi.register({[iw]:[this._sessionActivityTimestamp,null!=(e=this.Ri)?e:null,this._sessionStartTimestamp]}),this.bi.flush())}}Wi(){var e=this.Vi()[0];return Math.max(el(e)?e:0,el(this._sessionActivityTimestamp)?this._sessionActivityTimestamp:0)}Zi(e){return this.Ui(),this.Ti(e,this.Wi())}Vi(){var e=this.bi.props[iw];return Q(e)&&2===e.length&&e.push(e[0]),e||[0,null,0]}resetSessionId(){this.Si=null,clearTimeout(this.Gi),this.Gi=void 0,this.Di(null,null,null)}destroy(){this.Ii=!0,this.zi(),clearTimeout(this.Gi),this.Gi=void 0,this.Mi&&a&&(a.removeEventListener(i9,this.Mi,{capture:!1}),this.Mi=void 0),this.Ci=[]}Ni(){this.Mi=()=>{this.zi(),this.Li()&&sT.D(this.$i)},sc(a,i9,this.Mi,{capture:!1})}checkAndGetSessionAndWindowId(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=null),this.Ee.cookieless_mode===i3)throw Error('checkAndGetSessionAndWindowId should not be called with cookieless_mode="always"');var i=t||(new Date).getTime(),s=this.Vi(),r=s[1],n=s[2],a=this.Wi(),o=this.ji(),l=el(n)&&Math.abs(i-n)>864e5,u=!1,h=!1,c=!r,d=r,p=!c&&!e&&this.Ti(i,a);if(p){(p=this.Zi(i))||nG.info("cross-tab refresh kept the session alive",{sessionId:r});var v=this.Vi();r=v[1],n=v[2]}c||p||l?(r=this.Pi(),o=this.Oi(),nG.info("new session ID generated",{sessionId:r,windowId:o,changeReason:{noSessionId:c,activityTimeout:p,sessionPastMaximumLength:l}}),n=i,u=!0):(o||(o=this.Oi(),u=!0),(h=r!==d)&&(nG.info("adopted cross-tab session id",{sessionId:r,windowId:o}),u=!0));var g=el(a)&&e&&!l?a:i,f=el(n)?n:(new Date).getTime();this.qi(o),this.Di(r,g,f),e||this.Fi();var _={noSessionId:c,activityTimeout:p,sessionPastMaximumLength:l,crossTabAdoption:h};
1return u&&this.Ci.forEach(e=>e(r,o,_)),{sessionId:r,windowId:o,sessionStartTimestamp:f,changeReason:u?_:void 0,lastActivityTimestamp:a}}Fi(){this.Ii||(clearTimeout(this.Gi),this.Gi=setTimeout(()=>{if(!this.Ii)if(this.Zi((new Date).getTime())){var e=this.Ri;this.resetSessionId(),this.ki.emit("forcedIdleReset",{idleSessionId:e})}else this.Fi()},1.1*this.sessionTimeoutMs))}}var nY=function(e,t){if(!e)return!1;var i=e.userAgent;if(i&&U(i,t))return!0;try{var s=null==e?void 0:e.userAgentData;if(null!=s&&s.brands&&s.brands.some(e=>U(null==e?void 0:e.brand,t)))return!0}catch(e){}return!!e.webdriver};function nJ(){return(nJ=w(function*(){var e=null==l?void 0:l.userAgentData;if(null!=e&&e.getHighEntropyValues)try{var t=yield e.getHighEntropyValues(["model"]),i=null==t?void 0:t.model;return es(i)&&i.length>0?i:void 0}catch(e){return void t8.info("Unable to resolve $device_model from userAgentData.getHighEntropyValues",e)}})).apply(this,arguments)}var nK=function(e,t){if(!function(e){try{new RegExp(e)}catch(e){return!1}return!0}(t))return!1;try{return new RegExp(t).test(e)}catch(e){return!1}};function nX(e,t,i){return rb({distinct_id:e,userPropertiesToSet:t,userPropertiesToSetOnce:i})}var nQ={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=>nK(t,e))),not_regex:(e,t)=>t.every(t=>e.every(e=>!nK(t,e))),icontains:(e,t)=>t.map(nZ).some(t=>e.map(nZ).some(e=>t.includes(e))),not_icontains:(e,t)=>t.map(nZ).every(t=>e.map(nZ).every(e=>!t.includes(e))),gt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i>parseFloat(e))}),lt:(e,t)=>t.some(t=>{var i=parseFloat(t);return!isNaN(i)&&e.some(e=>i<parseFloat(e))})},nZ=e=>e.toLowerCase();function n0(e,t){return!e||Object.entries(e).every(e=>{var i=e[1],s=null==t?void 0:t[e[0]];if(ei(s)||en(s))return!1;var r=[String(s)],n=nQ[i.operator];return!!n&&n(i.values,r)})}var n1="custom",n2="i.posthog.com",n3=/^\/static\//;class n5{constructor(e){this.Qi={},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 flagsApiHost(){var e=this.instance.config.flags_api_host;return e?e.trim().replace(/\/$/,""):this.apiHost}get uiHost(){var e,t=null==(e=this.instance.config.ui_host)?void 0:e.replace(/\/$/,"");return t||(t=this.apiHost.replace("."+n2,".posthog.com")),"https://app.posthog.com"===t?"https://us.posthog.com":t}get region(){return this.Qi[this.apiHost]||(this.Qi[this.apiHost]=/https:\/\/(app|us|us-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"us":/https:\/\/(eu|eu-assets)(\.i)?\.posthog\.com/i.test(this.apiHost)?"eu":n1),this.Qi[this.apiHost]}Ji(e){if(n3.test(e)){var t=this.instance.config.asset_host;if("string"==typeof t)return t.trim().replace(/\/$/,"")||void 0}}endpointFor(e,t){if(void 0===t&&(t=""),t&&(t="/"===t[0]?t:"/"+t),"ui"===e)return this.uiHost+t;if("flags"===e)return this.flagsApiHost+t;if("assets"===e){var i=this.Ji(t);if(i)return""+i+t}if(this.region===n1)return this.apiHost+t;var s=n2+t;switch(e){case"assets":return"https://"+this.region+"-assets."+s;case"api":return"https://"+this.region+"."+s}}}function n8(e){var t;return!(null==(t=e.conditions)||null==(t=t.events)||null==(t=t.values)||!t.length)}var n6=t6("[Surveys]"),n4="seenSurvey_",n9=e=>{try{var t=""+n4+(e.current_iteration&&e.current_iteration>0?e.id+"_"+e.current_iteration:e.id);if(localStorage.getItem(t))return;localStorage.setItem(t,"true")}catch(e){n6.error("Failed to persist survey seen state",e)}},n7=["popover","widget","api"],ae={ignoreConditions:!1,ignoreDelay:!1,displayType:rZ},at=t6("[PostHog ExternalIntegrations]"),ai={intercom:"intercom-integration",crispChat:"crisp-chat-integration"};class as{constructor(e){this._instance=e}rr(e,t){var i;null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,e,e=>{if(e)return at.error("failed to load script",e);t()})}startIfEnabledOrStop(){var e,t=this;for(var i of Object.entries(null!=(e=this._instance.config.integrations)?e:{}))!function(){var e,s,r,n=i[0],a=i[1];!a||null!=(e=m.__PosthogExtensions__)&&null!=(e=e.integrations)&&e[n]||t.rr(ai[n],()=>{var e;null==(e=m.__PosthogExtensions__)||null==(e=e.integrations)||null==(e=e[n])||e.start(t._instance)}),!a&&null!=(s=m.__PosthogExtensions__)&&null!=(s=s.integrations)&&s[n]&&(null==(r=m.__PosthogExtensions__)||null==(r=r.integrations)||null==(r=r[n])||r.stop())}()}}class ar{constructor(e,t){this.it=e,this.Ki=t,this.Yi=new Map,this.Xi=!1}add(e){var t=this;return w(function*(){if(t.Xi)throw Error("Cannot add an extension to a disposed ExtensionRuntime");if(t.Yi.has(e.name))throw Error('Browser extension "'+e.name+'" is already registered');t.Yi.set(e.name,e);try{var i=e.setup(t.Ki);i&&(yield i)}catch(i){var s=t.Yi.get(e.name)===e;s&&t.Yi.delete(e.name),t.it.error('Failed to set up browser extension "'+e.name+'"',i),s&&t.tn(e)}})()}dispose(){if(!this.Xi){this.Xi=!0;var e=Array.from(this.Yi.values()).reverse();for(var t of(this.Yi.clear(),e))this.tn(t)}}tn(e){try{var t=null==e.dispose?void 0:e.dispose();t&&Z(t.then)&&t.then(void 0,t=>{this.it.error('Failed to dispose browser extension "'+e.name+'"',t)})}catch(t){this.it.error('Failed to dispose browser extension "'+e.name+'"',t)}}}class an{constructor(e){this._instance=e}get(e){var t;return null==(t=this._instance.persistence)?void 0:t.get_property(e)}set(e,t){var i;null==(i=this._instance.persistence)||i.set_property(e,t)}remove(e){var t;null==(t=this._instance.persistence)||t.unregister(e)}}var aa="extensionsRemoteConfig";class ao{constructor(e){this.Xi=!1,this.instance=e,this.it=t8.createLogger("[BrowserExtensions]"),this.en=e.rn,this.kv=new an(e),this.onEvent=e=>rV(this.instance.on("eventCaptured",t=>{try{e({event:t.event,properties:t.properties})}catch(e){this.it.error("Browser extension event listener failed",e)}})),this.onRemoteConfig=e=>{if(this.Xi)return rV(()=>{});var t=t=>{try{e(t)}catch(e){this.it.error("Browser extension remote config listener failed",e)}},i=this.instance.nn.on(aa,t);return this.en&&t(this.en),rV(i)},this.sn=new ar(this.it,this)}get logger(){return this.it}get distinctId(){return this.instance.get_distinct_id()}get anonymousId(){var e;return null!=(e=this.instance.get_property(ie))?e:this.distinctId}get groups(){return this.instance.getGroups()}get session(){try{var e,t,i,s,r=null==(e=this.instance.sessionManager)?void 0:e.checkAndGetSessionAndWindowId(!0);return{sessionId:null!=(t=null==r?void 0:r.sessionId)?t:"",windowId:null!=(i=null==r?void 0:r.windowId)?i:"",sessionStartTimestamp:null!=(s=null==r?void 0:r.sessionStartTimestamp)?s:0}}catch(e){return{sessionId:"",windowId:"",sessionStartTimestamp:0}}}get projectToken(){return this.instance.config.token}add(e){return this.sn.add(e)}capture(e,t,i){var s=this;return w(function*(){i?s.instance.capture(e,t,{timestamp:i.timestamp,uuid:i.uuid,$set:i.set,$set_once:i.setOnce}):s.instance.capture(e,t)})()}registerDynamicEventProperties(e){return rV(this.instance.an(e))}handleRemoteConfig(e){this.Xi||(this.en=e,this.instance.nn.emit(aa,e))}sendRequest(e,t){var i=this;return w(function*(){void 0===t&&(t={});var s,r=i.instance.requestRouter.endpointFor(null!=(s=t.target)?s:"api",e),n={method:t.method,url:t.query?nI(r,t.query):r,data:t.body,headers:t.headers,timeout:t.timeoutMs,fireCallbackOnDrop:!0,transport:t.transport};return"sendBeacon"===t.transport?(i.instance._send_request(n),{statusCode:202}):new Promise(e=>{n.callback=e,i.instance._send_request(n)})})()}dispose(){this.Xi||(this.Xi=!0,this.sn.dispose())}}var al={},au=0,ah=()=>{}
1,ac='Consent opt in/out is not valid with cookieless_mode="always" and will be ignored',ad="Surveys module not available",ap="sanitize_properties is deprecated. Use before_send instead",av="Invalid value for property_denylist config: ",ag=["token","distinct_id",iX],af="posthog",a_=!nS&&-1===(null==g?void 0:g.indexOf("MSIE"))&&-1===(null==g?void 0:g.indexOf("Mozilla")),am=e=>{var t;return x({api_host:"https://us.i.posthog.com",flags_api_host:null,ui_host:null,asset_host:null,token:"",autocapture:!0,cross_subdomain_cookie:function(e){var t=null==e?void 0:e.hostname;if(!es(t))return!1;var i=t.split(".").slice(-2).join(".");for(var s of sh)if(i===s)return!1;return!0}(null==u?void 0:u.location),persistence:"localStorage+cookie",persistence_name:"",cookie_persisted_properties:[],loaded:ah,save_campaign_params:!0,custom_campaign_params:[],custom_blocked_useragents:[],save_referrer:!0,capture_pageleave:"if_capture_pageview",defaults:null!=e?e:"unset",__preview_deferred_init_extensions:!1,__preview_external_dependency_versioned_paths:!1,__preview_cookie_wins_on_conflict:!1,debug:h&&es(null==h?void 0:h.search)&&-1!==h.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_conversations:!1,disable_product_tours:!1,disableDeviceModel:!1,disable_external_dependency_loading:!1,strict_script_versioning:!1,enable_recording_console_log:void 0,secure_cookie:"https:"===(null==a||null==(t=a.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,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_feature_flags_dedup_per_session:!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){t8.error("Bad HTTP status: "+e.statusCode+" "+e.text)},get_device_id:e=>e,capture_performance:void 0,name:"posthog",bootstrap:{},disable_compression:!1,session_idle_timeout_seconds:1800,person_profiles:i6,before_send:void 0,get_current_url:void 0,request_queue_config:{flush_interval_ms:3e3},error_tracking:{},_onCapture:ah},{rageclick:e&&e>="2026-05-30"?{content_ignorelist:sZ,ignore_text_selection:!0}
1:!e||"2025-11-30">e||{content_ignorelist:!0},capture_pageview:!e||"2025-05-24">e||"history_change",session_recording:e&&e>="2026-06-25"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6},streamNetworkBody:!0}:e&&e>="2026-05-30"?{strictMinimumDuration:!0,canvasCapture:{resolutionScale:.6}}:e&&e>="2025-11-30"?{strictMinimumDuration:!0}:{},external_scripts_inject_target:e&&e>="2026-01-30"?"head":"body",internal_or_test_user_hostname:e&&e>="2026-01-30"?/^(localhost|127\.0\.0\.1)$/:void 0,persistence_save_debounce_ms:e&&e>="2026-05-30"?250:0,split_storage:!(!e||"2026-05-30">e),detect_google_search_app:!(!e||"2026-05-30">e),disable_capture_url_hashes:!(!e||"2026-06-25">e)})},ay=[["process_person","person_profiles"],["xhr_headers","request_headers"],["cookie_name","persistence_name"],["disable_cookie","disable_persistence"],["__preview_disable_beacon","disable_beacon"],["store_google","save_campaign_params"],["verbose","debug"]],ab=e=>{var t={};for(var i of ay){var s=i[0],r=i[1];ei(e[s])||(t[r]=e[s])}var n=sn({},t,e),a=e.__preview_external_dependency_versioned_paths;return ei(a)||(ei(e.strict_script_versioning)&&(n.strict_script_versioning=!!a),es(a)&&ei(e.asset_host)&&(n.asset_host=a)),Q(e.property_blacklist)&&(ei(e.property_denylist)?n.property_denylist=e.property_blacklist:Q(e.property_denylist)?n.property_denylist=[...e.property_blacklist,...e.property_denylist]:t8.error(av+e.property_denylist)),n};class aw{constructor(){this.__forceAllowLocalhost=!1}get ln(){return this.__forceAllowLocalhost}set ln(e){t8.error("WebPerformanceObserver is deprecated and has no impact on network capture. Use `_forceAllowLocalhostNetworkCapture` on `posthog.sessionRecording`"),this.__forceAllowLocalhost=e}}class ax{un(e,t){if(e){var i=this.Yi.indexOf(e);-1!==i&&this.Yi.splice(i,1)}return this.Yi.push(t),null==t.initialize||t.initialize(),t}hn(){return this.config.cookieless_mode===i3||this.config.cookieless_mode===i2&&this.consent.isRejected()}get decideEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}get flagsEndpointWasHit(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.hasLoadedFlags)&&e}constructor(){this.webPerformance=new aw,this.dn=!1,this.version=y.LIB_VERSION,this.nn=new nV,this.Yi=[],this.cn=[],this._calculate_event_properties=this.calculateEventProperties.bind(this),this.config=am(),this.SentryIntegration=rv,this.sentryIntegration=e=>{var t;return t=rp(this,e),{name:rd,processEvent:e=>t(e)}},this.__request_queue=[],this.__loaded=!1,this.analyticsDefaultEndpoint="/e/",this.vn=!1,this.fn=null,this.pn=null,this.gn=null,this.scrollManager=new nz(this),this.pageViewManager=new rg(this),this.rateLimiter=new r1(this),this.requestRouter=new n5(this),this.consent=new sO(this),this.externalIntegrations=new as(this);var e,t=null!=(e=ax.__defaultExtensionClasses)?e:{};this.featureFlags=t.featureFlags&&new t.featureFlags(this),this.toolbar=t.toolbar&&new t.toolbar(this),this.surveys=t.surveys&&new t.surveys(this),this.conversations=t.conversations&&new t.conversations(this),this.logs=t.logs&&new t.logs(this),this.metrics=t.metrics&&new t.metrics(this),this.experiments=t.experiments&&new t.experiments(this),this.exceptions=t.exceptions&&new t.exceptions(this),this.people={set:(e,t,i)=>{var s=es(e)?{[e]:t}:e;this.setPersonProperties(s),null==i||i({})},set_once:(e,t,i)=>{var s=es(e)?{[e]:t}:e;this.setPersonProperties(void 0,s),null==i||i({})}},this.on("eventCaptured",e=>t8.info('send "'+(null==e?void 0:e.event)+'"',e))}init(e,t,i){if(i&&i!==af){var s,r=null!=(s=al[i])?s:new ax;return r._init(e,t,i),al[i]=r,al[af][i]=r,r}return this._init(e,t,i)}_init(e,t,i){void 0===t&&(t={});var s,r,n,o=es(e)?e.trim():"";if(!o)return t8.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 o!==(null==(n=this.config)?void 0:n.token)?console.warn("[PostHog.js]","You have already initialized PostHog with a different project token! Re-initializing is a no-op, so events will keep going to the project this instance was initialized with. To capture into a second project, load PostHog once, then initialize a named instance after the SDK has loaded, e.g. posthog.init('"+o+"', { ... }, 'project2')"):console.warn("[PostHog.js]","You have already initialized PostHog! Re-initializing is a no-op"),this;this.__loaded=!0,this.config=am(t.defaults),t.debug=this.mn(t.debug),this.yn=t,this.bn=[],t.person_profiles?this.pn=t.person_profiles:t.process_person&&(this.pn=t.process_person);var l=am(t.defaults),u=ab(t),h=sn({},l,u,{name:i,token:o});ee(l.rageclick)&&ee(u.rageclick)&&(h.rageclick=sn({},l.rageclick,u.rageclick)),ee(l.session_recording)&&ee(u.session_recording)&&(h.session_recording=sn({},l.session_recording,u.session_recording)),this.set_config(h),this.config.on_xhr_error&&t8.error("on_xhr_error is deprecated. Use on_request_error instead"),this.compression=t.disable_compression?void 0:rG;var c=this._n();this.persistence=new rU(this.config,c),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new rU(x({},this.config,{persistence:"sessionStorage"}),c,!1);var d=x({},this.persistence.props),p=x({},this.sessionPersistence.props);this.register({$initialization_time:(new Date).toISOString()}),this.wn=new nj(e=>this.xn(e),this.config.request_queue_config),this.kn=new nH(this),this.__request_queue=[];var v=this.hn();if(v||(this.sessionManager=new nW(this),this.sessionPropsManager=new nU(this,this.sessionManager,this.persistence)),this.config.__preview_deferred_init_extensions?(t8.info("Deferring extension initialization to improve startup performance"),setTimeout(()=>{this.Sn(v)},0)):(t8.info("Initializing extensions synchronously"),this.Sn(v)),y.DEBUG=y.DEBUG||this.config.debug,y.DEBUG&&t8.info("Starting in debug mode",{this:this,config:t,thisC:x({},this.config),p:d,s:p}),!this.config.identity_distinct_id||null!=(s=t.bootstrap)&&s.distinctID||(t.bootstrap=x({},t.bootstrap,{distinctID:this.config.identity_distinct_id,isIdentifiedID:!0}
1)),void 0!==(null==(r=t.bootstrap)?void 0:r.distinctID)){var g=t.bootstrap.distinctID,f=this.get_distinct_id(),_=this.persistence.get_property(iB);if(t.bootstrap.isIdentifiedID&&null!=f&&f!==g&&_===i5)this.identify(g);else if(t.bootstrap.isIdentifiedID&&null!=f&&f!==g&&_===i8)t8.warn("Bootstrap distinctID differs from an already-identified user. The existing identity is preserved. Call reset() before reinitializing if you intend to switch users.");else{var m=this.config.get_device_id(sx()),b=t.bootstrap.isIdentifiedID?m:g;this.persistence.set_property(iB,t.bootstrap.isIdentifiedID?i8:i5),this.register({distinct_id:g,$device_id:b})}}if(v)this.register_once({distinct_id:iK,$device_id:null},"");else if(!this.get_distinct_id()){var w=this.config.get_device_id(sx());this.register_once({distinct_id:w,$device_id:w},""),this.persistence.set_property(iB,i5)}return sc(a,"onpagehide"in self?"pagehide":"unload",this._handle_unload.bind(this),{passive:!1}),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 s=i=>{var s=()=>i.anonymousId()||sx();e.config.get_device_id=s,i.id()&&(e.register({distinct_id:i.id(),$device_id:s()}),e.persistence.set_property(iB,i8)),t()},r=i.user();"then"in r&&Z(r.then)?r.then(s):s(r)}(e,()=>{var s;i.register(("u">typeof Promise&&Promise.resolve||rc.warn("This browser does not have Promise support, and can not use the segment integration"),s=(t,i)=>{if(!i)return t;t.event.userId||t.event.anonymousId===e.get_distinct_id()||(rc.info("No userId set, resetting PostHog"),e.reset()),t.event.userId&&t.event.userId!==e.get_distinct_id()&&(rc.info("UserId set, identifying with PostHog"),e.identify(t.event.userId));var s=e.calculateEventProperties(i,t.event.properties);return t.event.properties=Object.assign({},s,t.event.properties),t},{name:"PostHog JS",type:"enrichment",version:"1.0.0",isLoaded:()=>!0,load:()=>Promise.resolve(),track:e=>s(e,e.event.event),page:e=>s(e,i7),identify:e=>s(e,st),screen:e=>s(e,"$screen")})).then(()=>{t()})})}(this,()=>this.Cn()):this.Cn(),Z(this.config._onCapture)&&this.config._onCapture!==ah&&(t8.warn("onCapture is deprecated. Please use `before_send` instead"),this.on("eventCaptured",e=>this.config._onCapture(e.event,e))),this.config.ip&&t8.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.config.disableDeviceModel||(function(){return nJ.apply(this,arguments)})().then(e=>{e&&this.register({[it]:e})}).catch(ah),this}Sn(e){var t,i,s,r,n,a,o,l,u=performance.now(),h=x({},ax.__defaultExtensionClasses,this.config.__extensionClasses),c=[];h.featureFlags&&this.Yi.push(this.featureFlags=null!=(t=this.featureFlags)?t:new h.featureFlags(this)),h.exceptions&&this.Yi.push(this.exceptions=null!=(i=this.exceptions)?i:new h.exceptions(this)),h.historyAutocapture&&this.Yi.push(this.historyAutocapture=new h.historyAutocapture(this)),h.tracingHeaders&&this.Yi.push(this.tracingHeaders=new h.tracingHeaders(this)),h.siteApps&&this.Yi.push(this.siteApps=new h.siteApps(this)),h.sessionRecording&&!e&&this.Yi.push(this.sessionRecording=new h.sessionRecording(this)),this.config.disable_scroll_properties||c.push(()=>{this.scrollManager.startMeasuringScrollPosition()}),h.autocapture&&this.Yi.push(this.autocapture=new h.autocapture(this)),h.surveys&&this.Yi.push(this.surveys=null!=(s=this.surveys)?s:new h.surveys(this)),h.logs&&this.Yi.push(this.logs=null!=(r=this.logs)?r:new h.logs(this)),h.metrics&&this.Yi.push(this.metrics=null!=(n=this.metrics)?n:new h.metrics(this)),h.conversations&&this.Yi.push(this.conversations=null!=(a=this.conversations)?a:new h.conversations(this)),h.productTours&&this.Yi.push(this.productTours=new h.productTours(this)),h.heatmaps&&this.Yi.push(this.heatmaps=new h.heatmaps(this)),h.webVitalsAutocapture&&this.Yi.push(this.webVitalsAutocapture=new h.webVitalsAutocapture(this)),h.exceptionObserver&&this.Yi.push(this.exceptionObserver=new h.exceptionObserver(this)),h.deadClicksAutocapture&&this.Yi.push(this.deadClicksAutocapture=new h.deadClicksAutocapture(this,ru)),h.toolbar&&this.Yi.push(this.toolbar=null!=(o=this.toolbar)?o:new h.toolbar(this)),h.experiments&&this.Yi.push(this.experiments=null!=(l=this.experiments)?l:new h.experiments(this)),this.Yi.forEac
1h(e=>{e.initialize&&c.push(()=>{null==e.initialize||e.initialize()})}),c.push(()=>{if(this.Mn){var e=this.Mn;this.Mn=void 0,this.Yi.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}}),this.In(c,u)}In(e,t){for(;e.length>0;){if(this.config.__preview_deferred_init_extensions&&performance.now()-t>=30&&e.length>0)return void setTimeout(()=>{this.In(e,t)},0);var i=e.shift();if(i)try{i()}catch(e){t8.error("Error initializing extension:",e)}}var s=Math.round(performance.now()-t);this.register_for_session({[iQ]:this.config.__preview_deferred_init_extensions?"deferred":"synchronous",[iZ]:s}),this.config.__preview_deferred_init_extensions&&t8.info("PostHog extensions initialized ("+s+"ms)")}Ur(e){var t;if(!u||!u.body)return t8.info("document not ready yet, trying again in 500 milliseconds..."),void setTimeout(()=>{this.Ur(e)},500);if(this.config.__preview_deferred_init_extensions&&(this.Mn=e),this.rn=e,this.compression=void 0,e.ok){var i,s=e.config;s.supportedCompression&&!this.config.disable_compression&&(this.compression=V(s.supportedCompression,rG)?rG:V(s.supportedCompression,rW)?rW:void 0),null!=(i=s.analytics)&&i.endpoint&&(this.analyticsDefaultEndpoint=s.analytics.endpoint)}this.set_config({person_profiles:this.pn?this.pn:i6}),null==(t=this.Tn)||t.handleRemoteConfig(e),this.Yi.forEach(t=>null==t.onRemoteConfig?void 0:t.onRemoteConfig(e))}Cn(){try{this.config.loaded(this)}catch(e){t8.critical("`loaded` function failed",e)}if(this.En(),this.config.internal_or_test_user_hostname&&null!=h&&h.hostname){var e=h.hostname,t=this.config.internal_or_test_user_hostname;("string"==typeof t?e===t:t.test(e))&&this.setInternalOrTestUser()}this.config.capture_pageview&&setTimeout(()=>{(this.consent.isOptedIn()||this.hn())&&this.Rn()},1),this.Pn=new r3(this),this.Pn.load()}En(){var e;this.is_capturing()&&this.config.request_batching&&(null==(e=this.wn)||e.enable())}_dom_loaded(){this.is_capturing()&&ss(this.__request_queue,e=>this.xn(e)),this.__request_queue=[],this.En()}_handle_unload(){var e,t,i,s,r;null==(e=this.surveys)||null==e.handlePageUnload||e.handlePageUnload(),null==(t=this.metrics)||t.flush("sendBeacon"),this.config.request_batching?(this.On()&&this.capture(se),null==(i=this.logs)||i.flushLogs("sendBeacon"),null==(s=this.wn)||s.unload(),null==(r=this.kn)||r.unload()):this.On()&&this.capture(se,null,{transport:"sendBeacon"})}_send_request(e){this.__loaded?a_?this.__request_queue.push(e):this.rateLimiter.isServerRateLimited(e.batchKey)?e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:429})):(e.transport=e.transport||this.config.api_transport,e.headers=x({},this.config.request_headers,e.headers),e.compression="best-available"===e.compression?this.compression:e.compression,(ei(this.config.disable_beacon)?this.config.__preview_disable_beacon:this.config.disable_beacon)&&(e.disableTransport=["sendBeacon"]),e.fetchOptions=e.fetchOptions||this.config.fetch_options,(e=>{var t,i,s,r,n,a=x({},e);a.timeout=a.timeout||6e4;var o,l,u,h,c,d=null!=(s=a.transport)?s:"fetch";"sendBeacon"===d&&ei(a.compression)&&a.data&&(a.compression=rW),"POST"===a.method&&a.data&&("capture-body"===a.timestampMode?a.data={api_key:null!=(l=null==(c=(h=Q(o=a.data)?o:[o])[0])||null==(u=c.properties)?void 0:u.token)?l:null==c?void 0:c.token,batch:h,sent_at:(new Date).toISOString()}:"body"===a.timestampMode&&(t=a.data,void 0===i&&(i=(new Date).toISOString()),a.data=Q(t)?t.map(e=>x({},e,{sent_at:i})):x({},t,{sent_at:i}))),a.url=nD(a.url,a.method,a.compression,a.timestampMode);var p=nN.filter(e=>!a.disableTransport||!e.transport||!a.disableTransport.includes(e.transport)),g=null!=(r=null==(n=function(e){for(var t=0;e.length>t;t++)if(e[t].transport===d)return e[t]}(p))?void 0:n.method)?r:p[0].method;if(!g)throw Error("No available transport method");"sendBeacon"!==d&&a.data&&a.compression===rG&&v&&"u">typeof Promise&&!nF?nT(a).then(e=>{g(e)}).catch(t=>{j(t)?(nF=!0,g(x({},a,{compression:void 0,url:nD(e.url,e.method,void 0,e.timestampMode)}))):((e=>{if(!e||"object"!=typeof e)return!1;var t="name"in e?String(e.name):"";return j(e)||t===L})(t)&&(nF=!0),g(a))}):g(a)})(x({},e,{callback:t=>{var i,s;this.rateLimiter.checkForLimiting(t),400>t.statusCode||null==(i=(s=this.config).on_request_error)||i.call(s,t),null==e.callback||e.callback(t)}}))):e.fireCallbackOnDrop&&(null==e.callback||e.callback({statusCode:0}))}xn(e){this.kn?this.kn.retriableRequest(e):this._send_request(e)}_execute_array(e){au++;try{var t,i=[],s=[],r=[];ss(e,e=>{if(e)if(Q(t=e[0]))r.push(e);else if(Z(e))try{e.call(this)}catch(t){t8.error("Error executing queued PostHog call",e,t)}else Q(e)&&"alias"===t?i.push(e):Q(e)&&-1!==t.indexOf("capture")&&Z(this[t])?r.pu
1sh(e):s.push(e)});var n=function(e,t){ss(e,function(e){try{if(Q(e[0])){var i=t;sr(e,function(e){i=i[e[0]].apply(i,e.slice(1))})}else t[e[0]].apply(t,e.slice(1))}catch(t){t8.error("Error executing queued PostHog call",e,t)}})};n(i,this),n(s,this),n(r,this)}finally{au--}}push(e){if(au>0&&Q(e)&&es(e[0])){var t=ax.prototype[e[0]];Z(t)&&t.apply(this,e.slice(1))}else this._execute_array([e])}capture(e,t,i){var s,r,n,a,o,l,u;if(this.__loaded&&this.persistence&&this.sessionPersistence&&this.wn){if(this.is_capturing())if(!ei(e)&&es(e)){var h=!this.config.opt_out_useragent_filter&&this._is_bot();if(!h||this.config.__preview_capture_bot_pageviews){var c=null!=i&&i.skip_client_rate_limiting?void 0:this.rateLimiter.clientRateLimitContext();if(null==c||!c.isRateLimited){if(this.cn.length>0){var d={};for(var p of this.cn.slice())try{sn(d,p())}catch(e){t8.error("Failed to produce browser extension event properties",e)}t=x({},d,null!=t?t:{})}null!=(s=t)&&s.$current_url&&!es(null==(r=t)?void 0:r.$current_url)&&(t8.error("Invalid `$current_url` property provided to `posthog.capture`. Input must be a string. Ignoring provided value."),null==(b=t)||delete b.$current_url),"$exception"!==e||null!=i&&i.Fn||t8.warn("Using `posthog.capture('$exception')` is unreliable because it does not attach required metadata. Use `posthog.captureException(error)` instead, which attaches required metadata automatically."),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 v=new Date,g=(null==i?void 0:i.timestamp)||v,f=tv(null==i?void 0:i.uuid,sx),_={uuid:f,event:e,properties:this.calculateEventProperties(e,t||{},g,f)};e===i7&&this.config.__preview_capture_bot_pageviews&&h&&(_.event="$bot_pageview",_.properties.$browser_type="bot"),c&&(_.properties.$lib_rate_limit_remaining_tokens=c.remainingTokens);var m="$feature_flag_called"===e&&!1===_.properties.$feature_flag_has_experiment&&!0===this.get_property(iI);(null==i?void 0:i.$set)&&!m&&(_.$set=null==i?void 0:i.$set);var y=null==i?void 0:i.$unset;y&&(_.$unset=y);var b,w,E,k,S=m?void 0:this.An(null==i?void 0:i.$set_once,e!==si,e===st);if(S&&(_.$set_once=S),null!=i&&i._noTruncate||(a=this.config.properties_string_max_length,o=_,l=e=>es(e)?e.slice(0,a):e,u=new Set,_=function e(t,i){if(t!==Object(t))return l?l(t):t;if(!u.has(t)){var s;if(u.add(t),Q(t))s=[],ss(t,t=>{s.push(e(t))});else{var r={};sr(t,(t,i)=>{u.has(t)||(r[i]=e(t,i))}),s=r}return s}}(o)),_.timestamp=g,ei(null==i?void 0:i.timestamp)||(_.properties.$event_time_override_provided=!0,_.properties.$event_time_override_system_time=v),m&&(_.properties=(P=_.properties,void 0===(F=ag)&&(F=[]),$={},I=e=>{void 0!==P[e]&&($[e]=P[e])},R.forEach(I),F.forEach(I),$)),e===rX||e===rQ){var P,F,$,I,C,M,T=null==(C=t)?void 0:C.$survey_id,O=null==(M=t)?void 0:M.$survey_iteration;n9({id:T,current_iteration:O}),_.$set=x({},_.$set,{[(w={id:T,current_iteration:O},k="$survey_"+(E=e===rQ?"responded":"dismissed")+"/"+w.id,w.current_iteration&&w.current_iteration>0&&(k="$survey_"+E+"/"+w.id+"/"+w.current_iteration),k)]:!0})}else e===rK&&(_.$set=x({},_.$set,{$survey_last_seen_date:(new Date).toISOString()}));if("product tour shown"===e){var A,L=null==(A=t)?void 0:A.$product_tour_type;L&&(_.$set=x({},_.$set,{["$product_tour_last_seen_date/"+L]:(new Date).toISOString()}))}var D=x({},_.properties.$set,_.$set);if(et(D)||this.setPersonPropertiesForFlags(D),!ea(this.config.before_send)){var N=this.Rt(_);if(!N)return;(_=N).uuid=tv(_.uuid,sx)}this.nn.emit("eventCaptured",_);var j=null!=(n=null==i?void 0:i._url)?n:this.requestRouter.endpointFor("api",this.analyticsDefaultEndpoint),q={method:"POST",url:j,data:_,compression:"best-available",timestampMode:"recordings"===(null==i?void 0:i._batchKey)||/\/s\/(?:\?|$)/.test(j)?"body":"capture-body",batchKey:null==i?void 0:i._batchKey,transport:null==i?void 0:i.transport};return!this.config.request_batching||i&&(null==i||!i._batchKey)||null!=i&&i.send_instantly?this.xn(q):this.wn.enqueue(q),_}t8.critical("This capture call is ignored due to client rate limiting.")}}else t8.error("No event name provided to posthog.capture")}else t8.uninitializedWarning("posthog.capture")}_addCaptureHook(e){return this.on("eventCaptured",t=>e(t.event,t))}$n(){var e;return null!=(e=this.Tn)?e:this.Tn=new ao(this)}an(e){this.cn.push(e);var t=!0;return()=>{if(t){t=!1;var i=this.cn.indexOf(e);-1!==i&&this.cn.splice(i,1)}}}calculateEventProperties(e,t,i,s,r){if(i=i||new Date,!this.persistence||!this.sessionPersistence)return t;var n,o=r?void 0:this.persistence.remove_event_timer(e),l=x({},t);if(l.token=this.config.token,l.$config_defaults=this.config.defaults,this.hn()&&(l[iX]=!0),"$snapshot"===e){var c=x({},this.persistence.properties(),this.sessionPersistence.properties());return l.distinct_id=c.distinct_id,(!es(l.distinct_id)&&!eo(l.distinct_id)||er(l.distinct_id))&&t8.error("Invalid distinct_id for replay event. This indicates a bug in your implementation"),l}var d,p=function(e,t,i,s){if(void 0===s&&(s=!1),!g)return{};var r,n,o,l,u,c=e?[...r$,...t||[]]:[],d=function(e){for(var t=0;tc.length>t;t++){var i=tc[t],s=i[1],r=i[0].exec(e),n=r&&(Z(s)?s(r,e):s);if(n)return n}return["",""]}(g),p=d[0],v=d[1],f=null!=(u="u">typeof navigator?navigator:void 0)&&u.brave?{brave:!0}:{},_={};ei(i)||(_.detectGoogleSearchApp=i);var m={},b=null==(r=navigator)||null==(r=r.userAgentData)?void 0:r.platform,w=null==(n=navigator)?void 0:n.maxTouchPoints,x=null==a||null==(o=a.screen)?void 0:o.width,E=null==a||null==(l=a.screen)?void 0:l.height,k=null==a?void 0:a.devicePixelRatio;ei(b)||(m.userAgentDataPlatform=b),ei(w)||(m.maxTouchPoints=w),ei(x)||
1(m.screenWidth=x),ei(E)||(m.screenHeight=E),ei(k)||(m.devicePixelRatio=k);var S,P,F,$,I,C,R=sn(su({$os:p,$os_version:v,$browser:tl(g,navigator.vendor,f,_),$device:td(g),$device_type:(C=td(g))===ek||C===eE||"Kobo"===C||"Kindle Fire"===C||C===e0?ex:C===eB||C===eV||C===eU||C===eX?"Console":C===eP?"Wearable":C?eb:"Android"===(null==m?void 0:m.userAgentDataPlatform)&&(null!=(P=null==m?void 0:m.maxTouchPoints)?P:0)>0?600>Math.min(null!=(F=null==m?void 0:m.screenWidth)?F:0,null!=($=null==m?void 0:m.screenHeight)?$:0)/(null!=(I=null==m?void 0:m.devicePixelRatio)?I:1)?eb:ex:"Desktop",$timezone:rq(),$timezone_offset:function(){try{return(new Date).getTimezoneOffset()}catch(e){return}}()}),{$current_url:rE(s?tg(null==h?void 0:h.href):null==h?void 0:h.href,c,rC),$host:null==h?void 0:h.host,$pathname:null==h?void 0:h.pathname,$raw_user_agent:g.length>1e3?g.substring(0,997)+"...":g,$browser_version:th(g,navigator.vendor,f,_),$browser_language:rA(),$browser_language_prefix:"string"==typeof(S=rA())?S.split("-")[0]:void 0,$screen_height:null==a?void 0:a.screen.height,$screen_width:null==a?void 0:a.screen.width,$viewport_height:null==a?void 0:a.innerHeight,$viewport_width:null==a?void 0:a.innerWidth,$lib:y.LIB_NAME,$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});return y.SDK_DIST_CHANNEL&&(R.$sdk_dist_channel=y.SDK_DIST_CHANNEL),R}(this.config.mask_personal_data_properties,this.config.custom_personal_data_properties,this.config.detect_google_search_app,this.config.disable_capture_url_hashes);if(this.sessionManager){var v=this.sessionManager.checkAndGetSessionAndWindowId(r,i.getTime()),f=v.windowId;l.$session_id=v.sessionId,l.$window_id=f}this.sessionPropsManager&&sn(l,this.sessionPropsManager.getSessionProps());try{this.sessionRecording&&sn(l,this.sessionRecording.sdkDebugProperties),l.$sdk_debug_retry_queue_size=null==(n=this.kn)?void 0:n.length}catch(e){l.$sdk_debug_error_capturing_properties=String(e)}if(this.requestRouter.region===n1&&(l.$lib_custom_api_host=this.config.api_host),d=e!==i7||r?e!==se||r?this.pageViewManager.doEvent():this.pageViewManager.doPageLeave(i):this.pageViewManager.doPageView(i,s),l=sn(l,d),e===i7&&u&&(l.title=u.title),!ei(o)){var _=i.getTime()-o;l.$duration=parseFloat((_/1e3).toFixed(3))}g&&this.config.opt_out_useragent_filter&&(l.$browser_type=this._is_bot()?"bot":"browser");var m=this.persistence.properties(),b=this.sessionPersistence.properties();sr(["$referrer","$referring_domain"],e=>{e in m&&delete b[e]}),(l=sn({},p,m,b,l)).$is_identified=this._isIdentified(),Q(this.config.property_denylist)?sr(this.config.property_denylist,function(e){delete l[e]}):t8.error(av+this.config.property_denylist+" or property_blacklist config: "+this.config.property_blacklist);var w=this.config.sanitize_properties;w&&(t8.error(ap),l=w(l,e));var E=this.Ln();return l.$process_person_profile=E,E&&!r&&this.Dn("_calculate_event_properties"),l}An(e,t,i){if(void 0===t&&(t=!0),void 0===i&&(i=!1),!this.persistence||!this.Ln()||this.dn&&!i)return e;var s,r=sn({},this.persistence.get_initial_props(),(null==(s=this.sessionPropsManager)?void 0:s.getSetOnceProps())||{},e||{}),n=this.config.sanitize_properties;return n&&(t8.error(ap),r=n(r,"$set_once")),t&&(this.dn=!0),et(r)?void 0:r}register(e,t){var i;null==(i=this.persistence)||i.register(e,t)}register_once(e,t,i){var s;null==(s=this.persistence)||s.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)}Nn(e,t){this.register({[e]:t})}getFeatureFlag(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlag(e,t)}getFeatureFlagPayload(e){var t;return null==(t=this.featureFlags)?void 0:t.getFeatureFlagPayload(e)}getFeatureFlagResult(e,t){var i;return null==(i=this.featureFlags)?void 0:i.getFeatureFlagResult(e,t)}getAllFeatureFlags(){var e,t;return null!=(e=null==(t=this.featureFlags)?void 0:t.getAllFeatureFlags())?e:[]}isFeatureEnabled(e,t){var i,s;return null!=(i=null==(s=this.featureFlags)?void 0:s.isFeatureEnabled(e,t))?i:null==t?void 0:t.defaultValue}reloadFeatureFlags(){var e;null==(e=this.featureFlags)||e.reloadFeatureFlags()}updateFlags(e,t,i){var s;null==(s=this.featureFlags)||s.updateFlags(e,t,i)}updateEarlyAccessFeatureEnrollment(e,t,i){var s;null==(s=this.featureFlags)||s.updateEarlyAccessFeatureEnrollment(e,t,i)}getEarlyAccessFeatures(e,t,i){var s;return void 0===t&&(t=!1),null==(s=this.featureFlags)?void 0:s.getEarlyAccessFeatures(e,t,i)}on(e,t){return this.nn.on(e,t)}onFeatureFlags(e){return this.featureFlags?this.featureFlags.onFeatureFlags(e):(e([],{},{errorsLoading:!0}),()=>{})}onSurveysLoaded(e){return this.surveys?this.surveys.onSurveysLoaded(e):(e([],{isLoaded:!1,error:ad}),()=>{})}onSessionId(e){var t,i;return null!=(t=null==(i=this.sessionManager)?void 0:i.onSessionId(e))?t:()=>{}}getSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getSurveys(e,t):e([],{isLoaded:!1,error:ad})}getActiveMatchingSurveys(e,t){void 0===t&&(t=!1),this.surveys?this.surveys.getActiveMatchingSurveys(e,t):e([],{isLoaded:!1,error:ad})}renderSurvey(e,t){var i;null==(i=this.surveys)||i.renderSurvey(e,t)}displaySurvey(e,t){var i;void 0===t&&(t=ae),null==(i=this.surveys)||i.displaySurvey(e,t)}cancelPendingSurvey(e){var t;null==(t=this.surveys)||t.cancelPendingSurvey(e)}canRenderSurvey(e){var t,i;return null!=(t=null==(i=this.surveys)?void 0:i.canRenderSurvey(e))?t:{visible:!1,disabledReason:ad}}canRenderSurveyAsync(e,t){var i,s;return void 0===t&&(t=!1),null!=(i=null==(s=this.surveys)?void 0:s.canRenderSurveyAsync(e,t))?i:Promise.resolve({visible:!1,disabledReason:ad})}qn(e){return!e||er(e)?(t8.critical("Unique user id has not been set in posthog.identify"),!1):e===iK?(t8.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID is only used as a sentinel value.'),!1):!["distinct_id","distinctid"].includes(e.toLowerCase())&&!["undefined","null"].includes(e.toLowerCase())||(t8.critical('The string "'+e+'" was set in posthog.identify which indicates an error. This ID should be unique to the user and n
1ot a hardcoded string.'),!1)}identify(e,t,i){if(!this.__loaded||!this.persistence)return t8.uninitializedWarning("posthog.identify");if(eo(e)&&(e=e.toString(),t8.warn("The first argument to posthog.identify was a number, but it should be a string. It has been converted to a string.")),this.qn(e)&&this.Dn("posthog.identify")){var s=this.get_distinct_id();this.register({$user_id:e}),this.get_property(ie)||this.register_once({$had_persisted_distinct_id:!0,$device_id:s},""),e!==s&&e!==this.get_property(ii)&&(this.unregister(ii),this.register({distinct_id:e}));var r,n=(this.persistence.get_property(iB)||i5)===i5,a=e!==s,o=!a&&n;if(a&&n)this.persistence.set_property(iB,i8),this.setPersonPropertiesForFlags({$set:t||{},$set_once:i||{}},!1),this.capture(st,{distinct_id:e,$anon_distinct_id:s},{$set:t||{},$set_once:i||{}}),this.gn=nX(e,t,i),null==(r=this.featureFlags)||r.setAnonymousDistinctId(s);else if(o){this.persistence.set_property(iB,i8);var l=t||{},u=i||{};this.setPersonPropertiesForFlags({$set:l,$set_once:u},!1),this.capture("$set",{$set:l,$set_once:u}),this.gn=nX(e,t,i)}else(t||i)&&this.setPersonProperties(t,i);a?(this.reloadFeatureFlags(),this.unregister(ij)):o&&(t||i)&&this.reloadFeatureFlags()}}setPersonProperties(e,t){if((e||t)&&this.Dn("posthog.setPersonProperties")){var i=nX(this.get_distinct_id(),e,t);this.gn!==i?(this.setPersonPropertiesForFlags({$set:e||{},$set_once:t||{}},!0),this.capture("$set",{$set:e||{},$set_once:t||{}}),this.gn=i):t8.info("A duplicate setPersonProperties call was made with the same properties. It has been ignored.")}}unsetPersonProperties(e){var t,i=(Q(e)?e:[e]).filter(e=>es(e)&&e.length>0);0!==i.length&&this.Dn("posthog.unsetPersonProperties")&&(null==(t=this.featureFlags)||t.unsetPersonPropertiesForFlags(i,!0),this.capture("$set",{$unset:i}),this.gn=null)}group(e,t,i){if(e&&t){var s=this.getGroups(),r=s[e]!==t;if(r&&this.resetGroupPropertiesForFlags(e),this.register({$groups:x({},s,{[e]:t})}),r||i){var n={$group_type:e,$group_key:t};i&&(n.$group_set=i),this.capture(si,n)}i&&this.setGroupPropertiesForFlags({[e]:i}),r&&!i&&this.reloadFeatureFlags()}else t8.error("posthog.group requires a group type and group key")}resetGroups(){this.register({$groups:{}}),this.resetGroupPropertiesForFlags(),this.reloadFeatureFlags()}setPersonPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),null==(i=this.featureFlags)||i.setPersonPropertiesForFlags(e,t)}resetPersonPropertiesForFlags(e){var t;void 0===e&&(e=!0),null==(t=this.featureFlags)||t.resetPersonPropertiesForFlags(e)}setGroupPropertiesForFlags(e,t){var i;void 0===t&&(t=!0),this.Dn("posthog.setGroupPropertiesForFlags")&&(null==(i=this.featureFlags)||i.setGroupPropertiesForFlags(e,t))}resetGroupPropertiesForFlags(e){var t;null==(t=this.featureFlags)||t.resetGroupPropertiesForFlags(e)}reset(e){if(t8.info("reset"),!this.__loaded)return t8.uninitializedWarning("posthog.reset");var t,i,s,r,n,a,o,l,u,h,c,d=this.get_property(ie),p=this.get_property(it),v=this.get_property(iv);if(this.consent.reset(),null==(t=this.persistence)||t.clear(),null==(i=this.sessionPersistence)||i.clear(),ei(v)||null==(c=this.persistence)||c.register({[iv]:v}),null==(s=this.surveys)||s.reset(),null==(r=this.Pn)||r.stop(),null==(n=this.featureFlags)||n.reset(),null==(a=this.conversations)||a.reset(),null==(o=this.logs)||o.reset(),null==(l=this.metrics)||l.reset(),null==(u=this.persistence)||u.set_property(iB,i5),null==(h=this.sessionManager)||h.resetSessionId(),this.gn=null,this.config.cookieless_mode===i3)this.register_once({distinct_id:iK,$device_id:null},"");else{var g=this.config.get_device_id(sx());this.register_once({distinct_id:g,$device_id:e?g:d},""),e||ei(p)||this.register({[it]:p})}this.register({$last_posthog_reset:(new Date).toISOString()},1),delete this.config.identity_distinct_id,delete this.config.identity_hash,this.reloadFeatureFlags()}shutdown(e){var t=this;return w(function*(){var e,i,s,r,n,a,o;t.__loaded?(null==(e=t.Pn)||e.stop(),null==(i=t.Tn)||i.dispose(),null==(s=t.logs)||s.flushLogs("sendBeacon"),null==(r=t.metrics)||r.flush("sendBeacon"),null==(n=t.wn)||n.unload(),null==(a=t.kn)||a.unload(),null==(o=t.featureFlags)||o.destroy()):t8.uninitializedWarning("posthog.shutdown")})()}setIdentity(e,t){var i;this.config.identity_distinct_id=e,this.config.identity_hash=t,this.alias(e),null==(i=this.conversations)||i.jn()}clearIdentity(){var e;delete this.config.identity_distinct_id,delete this.config.identity_hash,null==(e=this.conversations)||e.Hn()}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)?e:""}get_session_replay_url(e){if(!this.sessionManager)return"";var t=this.sessionManager.checkAndGetSessionAndWindowId(!0),i=t.sessionStartTimestamp,s=this.requestRouter.endpointFor("ui","/project/"+this.config.token+"/replay/"+t.sessionId);if(null!=e&&e.withTimestamp&&i){var r,n=null!=(r=e.timestampLookBack)?r:10;if(!i)return s;s+="?t="+Math.max(Math.floor(((new Date).getTime()-i)/1e3)-n,0)}return s}alias(e,t){return e===this.get_property(t7)?(t8.critical("Attempting to create alias for existing People user - aborting."),-2):this.Dn("posthog.alias")?(ei(t)&&(t=this.get_distinct_id()),e!==t?(this.Nn(ii,e),this.capture("$create_alias",{alias:e,distinct_id:t})):(t8.warn("alias matches current distinct_id - skipping api call."),this.identify(e),-1)):void 0}set_config(e){var t=x({},this.config);if(ee(e)){sn(this.config,ab(e));var i,s,r,n,a,o,l,u,h,c,d,p=this._n();null==(i=this.persistence)||i.update_config(this.config,t,p),this.sessionPersistence="sessionStorage"===this.config.persistence||"memory"===this.config.persistence?this.persistence:new rU(x({},this.config,{persistence:"sessionStorage"}),p,!1);var v=this.mn(this.config.debug);eu(v)&&(this.config.debug=v),eu(this.config.debug)&&(this.config.debug?(y.DEBUG=!0,s$.N()&&s$.A("ph_debug",!0),t8.info("set_config",{config:e,oldConfig:t,newConfig:x({},this.config)})):(y.DEBUG=!1,s$.N()&&s$.D("ph_debug"))),null==(s=this.exceptionObserver)||s.onConfigChange(),null==(r=this.exceptions)||r.onConfigChange(),null==(n=this.sessionRecording)||n.startIfEnabledOrStop(),null==(a=this.tracingHeaders)||a.startIfEnabledOrStop(),null==(o=this.autocapture)||o.startIfEnabled(),null==(l=this.heatmaps)||l.startIfEnabled(),null==(u=this.exceptionObserver)||u.startIfEnabledOrStop(),null==(h=this.deadClicksAutocapture)||h.startIfEnabledOrStop(),null==(c=this.surveys)||c.loadIfEnabled(),this.Bn(),null==(d=this.externalIntegrations)||d.startIfEnabledOrStop()}}_overrideSDKInfo(e,t){y.LIB_NAME=e,y.LIB_VERSION=t}startSessionRecording(e){var t,i,s,r,n,a=!0===e,o={sampling:a||!(null==e||!e.sampling),linked_flag:a||!(null==e||!e.linked_flag),url_trigger:a||!(null==e||!e.url_trigger),event_trigger:a||!(null==e||!e.event_trigger)};Object.values(o).some(Boolean)&&(null==(t=this.sessionManager)||t.checkAndGetSessionAndWindowId(),o.sampling&&(null==(i=this.sessionRecording)||i.overrideSampling()),o.linked_flag&&(null==(s=this.sessionRecording)||s.overrideLinkedFlag()),o.url_trigger&&(null==(r=this.sessionRecording)||r.overrideTrigger("url")),o.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){if(this.exceptions){var i=Error("PostHog syntheticException"),s=this.exceptions.buildProperties(e,{handled:!0,syntheticException:i});return this.exceptions.sendExceptionEvent(x({},s,t))}}addExceptionStep(e,t){var i;null==(i=this.exceptions)||i.addExceptionStep(e,t)}captureLog(e){var t;null==(t=this.logs)||t.captureLog(e)}get logger(){var e,t;return null!=(e=null==(t=this.logs)?void 0:t.logger)?e:ax.Un}startExceptionAutocapture(e){this.set_config({capture_exceptions:null==e||e})}stopExceptionAutocapture(){this.set_config({capture_exceptions:!1})}loadToolbar(e){var t,i;return null!=(t=null==(i=this.toolbar)?void 0:i.loadToolbar(e))&&t}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)?e:af;return t!==af&&(t=af+"."+t),t}_isIdentified(){var e,t;return(null==(e=this.persistence)?void 0:e.get_property(iB))===i8||(null==(t=this.sessionPersistence)?void 0:t.get_property(iB))===i8}Ln(){var e,t;return!("never"===this.config.person_profiles||this.config.person_profiles===i6&&!this._isIdentified()&&et(this.getGroups())&&(null==(e=this.persistence)||null==(e=e.props)||!e[ii])&&(null==(t=this.persistence)||null==(t=t.props)||!t[iJ]))}On(){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.Ln()||this.Dn("posthog.createPersonProfile")&&this.setPersonProperties({},{})}setInternalOrTestUser(){this.Dn("posthog.setInternalOrTestUser")&&this.setPersonProperties({$internal_or_test_user:!0})}Dn(e){return"never"===this.config.person_profiles?(t8.error(e+' was called, but process_person is set to "never". This call will be ignored.'),!1):(this.Nn(iJ,!0),!0)}_n(){if("always"===this.config.cookieless_mode)return!0;var e=this.consent.isOptedOut();return this.config.disable_persistence||e&&!(!this.config.opt_out_persistence_by_default&&this.config.cookieless_mode!==i2)}Bn(){var e,t,i,s,r=this._n();return(null==(e=this.persistence)?void 0:e._r)!==r&&(null==(i=this.persistence)||i.set_disabled(r)),(null==(t=this.sessionPersistence)?void 0:t._r)!==r&&(null==(s=this.sessionPersistence)||s.set_disabled(r)),r}opt_in_capturing(e){var t;if(this.config.cookieless_mode!==i3){if(this.hn()){this.reset(!0),null==(r=this.sessionManager)||r.destroy(),null==(n=this.pageViewM
1anager)||n.destroy(),this.sessionManager=new nW(this),this.pageViewManager=new rg(this),this.persistence&&(this.sessionPropsManager=new nU(this,this.sessionManager,this.persistence));var i,s,r,n,a,o,l,u,h=null!=(a=null==(o=this.config.__extensionClasses)?void 0:o.sessionRecording)?a:null==(l=ax.__defaultExtensionClasses)?void 0:l.sessionRecording;h&&(this.sessionRecording=this.un(this.sessionRecording,new h(this)),this.rn&&(null==(u=this.sessionRecording)||null==u.onRemoteConfig||u.onRemoteConfig(this.rn)))}this.consent.optInOut(!0),this.Bn(),this.En(),null==(t=this.sessionRecording)||t.startIfEnabledOrStop(),this.config.cookieless_mode==i2&&(null==(i=this.surveys)||i.loadIfEnabled()),(ei(null==e?void 0:e.captureEventName)||null!=e&&e.captureEventName)&&this.capture(null!=(s=null==e?void 0:e.captureEventName)?s:"$opt_in",null==e?void 0:e.captureProperties,{send_instantly:!0}),this.config.capture_pageview&&this.Rn()}else t8.warn(ac)}opt_out_capturing(){var e,t,i;this.config.cookieless_mode!==i3?(this.config.cookieless_mode===i2&&this.consent.isOptedIn()&&this.reset(!0),this.consent.optInOut(!1),this.Bn(),this.config.cookieless_mode===i2&&(this.register({distinct_id:iK,$device_id:null}),null==(e=this.sessionRecording)||e.stopRecording(),this.sessionRecording=void 0,null==(t=this.sessionManager)||t.destroy(),null==(i=this.pageViewManager)||i.destroy(),this.sessionManager=void 0,this.sessionPropsManager=void 0,this.config.capture_pageview&&this.Rn(),this.En())):t8.warn(ac)}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 1===e?"granted":0===e?"denied":"pending"}is_capturing(){return this.config.cookieless_mode===i3||(this.config.cookieless_mode===i2?this.consent.isRejected()||this.consent.isOptedIn():!this.has_opted_out_capturing())}clear_opt_in_out_capturing(){this.consent.reset(),this.Bn()}_is_bot(){return l?nY(l,this.config.custom_blocked_useragents):void 0}Rn(){u&&("visible"===u.visibilityState?this.vn||(this.vn=!0,this.capture(i7,{title:u.title},{send_instantly:!0}),this.fn&&(u.removeEventListener(i4,this.fn),this.fn=null)):this.fn||(this.fn=this.Rn.bind(this),sc(u,i4,this.fn)))}debug(e){!1===e?(null==a||a.console.log("You've disabled debug mode."),this.set_config({debug:!1})):(null==a||a.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}))}Vr(){var e,t,i,s,r=this.yn||{};return"advanced_disable_flags"in r?!!r.advanced_disable_flags:!1!==this.config.advanced_disable_flags?!!this.config.advanced_disable_flags:!0===this.config.advanced_disable_decide?(t8.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):(t="advanced_disable_decide",i=(e="advanced_disable_flags")in r&&!ea(r[e]),s=t in r&&!ea(r[t]),i?r[e]:!!s&&(t8&&t8.warn("Config field '"+t+"' is deprecated. Please use '"+e+"' instead. The old field will be removed in a future major version."),r[t]))}Rt(e){if(ea(this.config.before_send))return e;var t,i=Object.keys(null!=(t=e.properties)?t:{}).filter(ec),s=Q(this.config.before_send)?this.config.before_send:[this.config.before_send],r=e;for(var n of s){if(ea(r=n(r))){var a="Event '"+e.event+"' was rejected in beforeSend function";return eh(e.event)?t8.warn(a+". This can cause unexpected behavior."):t8.info(a),null}r.properties&&!et(r.properties)||t8.warn("Event '"+e.event+"' has no properties after beforeSend function, this is likely an error.")}for(var o of i)if(r.properties&&ea(r.properties[o]))return t8.warn("Event '"+e.event+"' had its '"+o+"' property removed in a beforeSend function. This property is required for ingestion, so the event will be dropped."),null;return r}getPageViewId(){var e;return null==(e=this.pageViewManager.sr)?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)})}mn(e){var t=eu(e)&&!e,i=s$.N()&&"true"===s$.q("ph_debug");return!t&&(!!i||e)}}ax.__defaultExtensionClasses={},ax.Un={trace:r=()=>{},debug:r,info:r,warn:r,error:r,fatal:r},function(e,t){for(var i=0;t.length>i;i++)e.prototype[t[i]]=sl(e.prototype[t[i]])}(ax,["identify"]);class aE{constructor(e){this.disabled=!1===e;var t=ee(e)?e:{};this.thresholdPx=t.threshold_px||30,this.timeoutMs=t.timeout_ms||1e3,this.clickCount=t.click_count||3,this.clicks=[]}isRageClick(e,t,i){if(this.disabled)return!1;var s=this.clicks[this.clicks.length-1];if(s&&Math.abs(e-s.x)+Math.abs(t-s.y)<this.thresholdPx&&this.timeoutMs>i-s.timestamp){if(this.clicks.push({x:e,y:t,timestamp:i}),this.clicks.length===this.clickCount)return!0}else this.clicks=[{x:e,y:t,timestamp:i}];return!1}}var ak="$copy_autocapture",aS=t6("[AutoCapture]");function aP(e,t){return t.length>e?t.slice(0,e)+"...":t}var aF=t6("[ExceptionAutocapture]"),a$=()=>{},aI=t6("[TracingHeaders]"),aC=t6("[Web Vitals]"),aR="disabled",aM="lazy_loading",aT="awaiting_config",aO="missing_config";t6("[SessionRecording]"),t6("[SessionRecording]");var aA="[SessionRecording]",aL=t6(aA),aD=t6("[Heatmaps]");function aN(e){return ee(e)&&"clientX"in e&&"clientY"in e&&eo(e.clientX)&&eo(e.clientY)}var aj=t6("[Product Tours]"),aq=e=>{var t;return!e.config.disable_product_tours&&!(null==(t=e.persistence)||!t.get_property(id))}
1,aH=["$set_once","$set"],az=t6("[SiteApps]"),aB="Error while initializing PostHog app with config id ";function aU(e,t,i){if(ea(e))return!1;switch(i){case"exact":return e===t;case"contains":return RegExp(t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/_/g,".").replace(/%/g,".*"),"i").test(e);case"regex":try{return new RegExp(t).test(e)}catch(e){return!1}default:return!1}}class aV{constructor(e){this.zn=new nV,this.Vn=(e,t)=>this.Wn(e,t)&&this.Zn(e,t)&&this.Gn(e,t)&&this.Qn(e,t),this.Wn=(e,t)=>null==t||!t.event||(null==e?void 0:e.event)===(null==t?void 0:t.event),this._instance=e,this.Jn=new Set,this.Kn=new Set}init(){var e,t;ei(null==(e=this._instance)?void 0:e._addCaptureHook)||null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.on(e,t)})}register(e){var t,i;if(!ei(null==(t=this._instance)?void 0:t._addCaptureHook)&&(e.forEach(e=>{var t,i;null==(t=this.Kn)||t.add(e),null==(i=e.steps)||i.forEach(e=>{var t;null==(t=this.Jn)||t.add((null==e?void 0:e.event)||"")})}),null!=(i=this._instance)&&i.autocapture)){var s,r=new Set;e.forEach(e=>{var t;null==(t=e.steps)||t.forEach(e=>{null!=e&&e.selector&&r.add(null==e?void 0:e.selector)})}),null==(s=this._instance)||s.autocapture.setElementSelectors(r)}}on(e,t){var i;null!=t&&0!=e.length&&(this.Jn.has(e)||this.Jn.has(t.event))&&this.Kn&&(null==(i=this.Kn)?void 0:i.size)>0&&this.Kn.forEach(e=>{this.Yn(t,e)&&this.zn.emit("actionCaptured",e.name)})}Xn(e){this.onAction("actionCaptured",t=>e(t))}Yn(e,t){if(null==(null==t?void 0:t.steps))return!1;for(var i of t.steps)if(this.Vn(e,i))return!0;return!1}onAction(e,t){return this.zn.on(e,t)}Zn(e,t){if(null!=t&&t.url){var i,s=null==e||null==(i=e.properties)?void 0:i.$current_url;if(!s||"string"!=typeof s||!aU(s,t.url,t.url_matching||"contains"))return!1}return!0}Gn(e,t){return!!this.ts(e,t)&&!!this.es(e,t)&&!!this.rs(e,t)}ts(e,t){if(null==t||!t.href)return!0;var i=this.ns(e);if(i.length>0)return i.some(e=>aU(e.href,t.href,t.href_matching||"exact"));var s,r,n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!n&&aU((r=n.match(/(?::|")href="(.*?)"/))?r[1]:"",t.href,t.href_matching||"exact")}es(e,t){if(null==t||!t.text)return!0;var i=this.ns(e);if(i.length>0)return i.some(e=>aU(e.text,t.text,t.text_matching||"exact")||aU(e.$el_text,t.text,t.text_matching||"exact"));var s,r,n,a,o=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";return!!o&&(r=function(e){for(var t,i=[],s=/(?::|")text="(.*?)"/g;!ea(t=s.exec(e));)i.includes(t[1])||i.push(t[1]);return i}(o),n=t.text,a=t.text_matching||"exact",r.some(e=>aU(e,n,a)))}rs(e,t){if(null==t||!t.selector)return!0;var i,s,r=null==e||null==(i=e.properties)?void 0:i.$element_selectors;if(null!=r&&r.includes(t.selector))return!0;var n=(null==e||null==(s=e.properties)?void 0:s.$elements_chain)||"";if(t.selector_regex&&n)try{return new RegExp(t.selector_regex).test(n)}catch(e){}return!1}ns(e){var t;return null==(null==e||null==(t=e.properties)?void 0:t.$elements)?[]:null==e?void 0:e.properties.$elements}Qn(e,t){return null==t||!t.properties||0===t.properties.length||n0(t.properties.reduce((e,t)=>{var i=Q(t.value)?t.value.map(String):null!=t.value?[String(t.value)]:[];return e[t.key]={values:i,operator:t.operator||"exact"},e},{}),null==e?void 0:e.properties)}}class aG{constructor(e){var t;this.ss=[],this._instance=e,this.os=new Map,this.ls=new Map,this.us=new Map,null==(t=this._instance)||null==t.onSessionId||t.onSessionId(e=>this.hs(e))}ds(e,t){return!!e&&n0(e.propertyFilters,null==t?void 0:t.properties)}cs(e,t){var i=new Map;return e.forEach(e=>{var s;null==(s=e.conditions)||null==(s=s[t])||null==(s=s.values)||s.forEach(t=>{if(null!=t&&t.name){var s=i.get(t.name)||[];s.push(e.id),i.set(t.name,s)}})}),i}vs(e,t,i){var s=(i===rY?this.os:this.ls).get(e),r=[];return this.fs(e=>{r=e.filter(e=>null==s?void 0:s.includes(e.id))}),r.filter(s=>{var r,n=null==(r=s.conditions)||null==(r=r[i])||null==(r=r.values)?void 0:r.find(t=>t.name===e);return this.ds(n,t)})}register(e){var t;ei(null==(t=this._instance)?void 0:t._addCaptureHook)||(this.ps(e),this.gs(e))}gs(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.ys&&(this.ys=new aV(this._instance),this.ys.init(),this.ys.Xn(e=>{this.onAction(e)}
1)),t.forEach(e=>{var t,i,s,r,n;e.conditions&&null!=(t=e.conditions)&&t.actions&&null!=(i=e.conditions)&&null!=(i=i.actions)&&i.values&&(null==(s=e.conditions)||null==(s=s.actions)||null==(s=s.values)?void 0:s.length)>0&&(null==(r=this.ys)||r.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.us.get(t.name);i&&i.push(e.id),this.us.set(t.name,i||[e.id])}}))}))}ps(e){var t,i=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}),s=e.filter(e=>{var t,i;return(null==(t=e.conditions)?void 0:t.cancelEvents)&&(null==(i=e.conditions)||null==(i=i.cancelEvents)||null==(i=i.values)?void 0:i.length)>0});0===i.length&&0===s.length||(null==(t=this._instance)||t._addCaptureHook((e,t)=>{this.onEvent(e,t)}),this.os=this.cs(e,rY),this.ls=this.cs(e,rJ))}onEvent(e,t){var i,s,r=this.bs(),n=(null==t||null==(i=t.properties)?void 0:i.$survey_id)||(null==t||null==(s=t.properties)?void 0:s.$product_tour_id);if(n&&this.getActivatedIds().includes(n)){var a=this._s(e,n);if("consume"===a)return r.info("event consumed activated item, removing it",{event:e,itemId:n}),void this.ws([n]);if("persist"===a)return r.info("shown item promoted to persisted activation",{event:e,itemId:n}),void this.xs(n)}if(this.ls.has(e)){var o=this.vs(e,t,rJ);o.length>0&&(r.info("cancel event matched, cancelling items",{event:e,itemsToCancel:o.map(e=>e.id)}),this.ws(o.map(e=>e.id)),o.forEach(e=>this.ks(e.id)))}if(this.os.has(e)){r.info("event name matched",{event:e,eventPayload:t,items:this.os.get(e)});var l=this.vs(e,t,rY);this.Ss(l.map(e=>e.id))}}onAction(e){this.us.has(e)&&this.Ss(this.us.get(e)||[])}Ss(e){0!==e.length&&(this.ss=[...new Set([...this.ss,...e])],this.bs().info("updating activated items",{activatedItems:this.getActivatedIds()}))}xs(e){this.ss=this.ss.filter(t=>t!==e);var t=this.Cs();t.includes(e)||(this.Ms([...t,e]),this.Is())}ws(e){var t=new Set(e);this.ss=this.ss.filter(e=>!t.has(e));var i=this.Ts(),s=i.filter(e=>!t.has(e));s.length!==i.length&&(this.Ms(s),0===s.length&&this.Es())}Ts(){var e,t=this.Rs();return(null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[t])||[]}Cs(){var e,t,i=this.Ts();if(0===i.length)return[];var s=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.props[this.Ps()],r=null==(t=this._instance)||null==t.get_session_id?void 0:t.get_session_id();return r&&s===r?i:[]}Is(){var e,t=null==(e=this._instance)||null==e.get_session_id?void 0:e.get_session_id();t&&this.Os(t)}Es(){this.Fs()}hs(e){var t,i=null==(t=this._instance)||null==(t=t.persistence)?void 0:t.props[this.Ps()];i&&i!==e&&(this.Ts().length>0&&this.Ms([]),this.Es())}getActivatedIds(){return[...new Set([...this.Cs(),...this.ss])].filter(e=>!this.As(e))}reset(){this.ss=[],this.Ts().length>0&&this.Ms([]),this.Es()}getEventToItemsMap(){return this.os}$s(){return this.ys}}class aW extends aG{constructor(e){super(e)}Rs(){return iL}Ps(){return iD}Ls(){return rK}fs(e){var t;null==(t=this._instance)||t.getSurveys(e)}ks(e){var t;null==(t=this._instance)||t.cancelPendingSurvey(e)}bs(){return n6}Ms(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[iL]:e})}Os(e){var t;null==(t=this._instance)||null==(t=t.persistence)||t.register({[iD]:e})}Fs(){var e;null==(e=this._instance)||null==(e=e.persistence)||e.unregister(iD)}As(){return!1}_s(e,t){var i,s,r;return this.fs(e=>{r=e.find(e=>e.id===t)}),!r||n8(i=r)&&!(null==(s=i.conditions)||null==(s=s.events)||!s.repeatedActivation)||"always"===i.schedule?e===rK?"consume":"ignore":e===rK?"persist":e===rX||e===rQ?"consume":"ignore"}getSurveys(){return this.getActivatedIds()}getEventToSurveys(){return this.getEventToItemsMap()}}var aY="SDK is not enabled or survey functionality is not yet loaded",aJ="Disabled. Not loading surveys.",aK=null!=a&&a.location?rk(a.location.hash,"__posthog")||rk(location.hash,"state"):null,aX="_postHogToolbarParams",aQ=t6("[Toolbar]"),aZ=t6("[FeatureFlags]"),a0=t6("[FeatureFlags]",{debugEnabled:!0}),a1="\" failed. Feature flags didn't load in time.",a2=e=>{for(var t={},i=0;e.length>i;i++)t[e[i]]=!0;return t},a3=e=>{var t={};for(var i of sa(e||{})){var s=i[1];s&&(t[i[0]]=s)}return t},a5=t6("[Error tracking]"),a8="Refusing to render web experiment since the viewer is a likely bot",a6={icontains:(e,t)=>t.toLowerCase().indexOf(e.toLowerCase())>-1,not_icontains:(e,t)=>-1===t.toLowerCase().indexOf(e.toLowerCase()),regex:(e,t)=>nK(t,e),not_regex:(e,t)=>!nK(t,e),exact:(e,t)=>
1t===e,is_not:(e,t)=>t!==e};class a4{get Ee(){return this._instance.config}constructor(e){var t=this;this.getWebExperimentsAndEvaluateDisplayLogic=function(e){void 0===e&&(e=!1),t.getWebExperiments(e=>{a4.Ds("retrieved web experiments from the server"),t.Ns=new Map,e.forEach(e=>{if(e.feature_flag_key){t.Ns&&(a4.Ds("setting flag key ",e.feature_flag_key," to web experiment ",e),null==(i=t.Ns)||i.set(e.feature_flag_key,e));var i,s=t._instance.getFeatureFlag(e.feature_flag_key);es(s)&&e.variants[s]&&t.qs(e.name,s,e.variants[s].transforms)}else if(e.variants)for(var r in e.variants){var n=e.variants[r];a4.js(n,t._instance)&&t.qs(e.name,r,n.transforms)}})},e)},this._instance=e,this._instance.onFeatureFlags(e=>{this.onFeatureFlags(e)})}initialize(){}onFeatureFlags(e){if(this._is_bot())a4.Ds(a8);else if(!this.Ee.disable_web_experiments){if(ea(this.Ns))return this.Ns=new Map,this.loadIfEnabled(),void this.previewWebExperiment();a4.Ds("applying feature flags",e),e.forEach(e=>{var t;if(this.Ns&&null!=(t=this.Ns)&&t.has(e)){var i,s=this._instance.getFeatureFlag(e),r=null==(i=this.Ns)?void 0:i.get(e);s&&null!=r&&r.variants[s]&&this.qs(r.name,s,r.variants[s].transforms)}})}}previewWebExperiment(){var e=a4.getWindowLocation();if(null!=e&&e.search){var t=rx(null==e?void 0:e.search,"__experiment_id"),i=rx(null==e?void 0:e.search,"__experiment_variant");t&&i&&(a4.Ds("previewing web experiments "+t+" && "+i),this.getWebExperiments(e=>{this.Hs(parseInt(t),i,e)},!1,!0))}}loadIfEnabled(){this.Ee.disable_web_experiments||this.getWebExperimentsAndEvaluateDisplayLogic()}getWebExperiments(e,t,i){if(this.Ee.disable_web_experiments&&!i)return e([]);var s=this._instance.get_property("$web_experiments");if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/web_experiments/?token="+this.Ee.token),method:"GET",timestampMode:"query",callback:t=>e(200===t.statusCode&&t.json&&t.json.experiments||[])})}Hs(e,t,i){var s=i.filter(t=>t.id===e);s&&s.length>0&&(a4.Ds("Previewing web experiment ["+s[0].name+"] with variant ["+t+"]"),this.qs(s[0].name,t,s[0].variants[t].transforms))}static js(e,t){return!ea(e.conditions)&&a4.Bs(e,t)&&a4.Us(e)}static Bs(e,t){if(ea(e.conditions)||ea(null==(s=e.conditions)?void 0:s.url))return!0;var i=a4.getWindowLocation();if(i){var s,r,n,a,o=sA(t,i.href);return null==(r=e.conditions)||!r.url||a6[null!=(n=null==(a=e.conditions)?void 0:a.urlMatchType)?n:"icontains"](e.conditions.url,o)}return!1}
1static getWindowLocation(){return null==a?void 0:a.location}static Us(e){if(ea(e.conditions)||ea(null==(i=e.conditions)?void 0:i.utm))return!0;var t=rM();if(t.utm_source){var i,s,r,n,a,o,l,u,h,c=null==(s=e.conditions)||null==(s=s.utm)||!s.utm_campaign||(null==(r=e.conditions)||null==(r=r.utm)?void 0:r.utm_campaign)==t.utm_campaign,d=null==(n=e.conditions)||null==(n=n.utm)||!n.utm_source||(null==(a=e.conditions)||null==(a=a.utm)?void 0:a.utm_source)==t.utm_source,p=null==(o=e.conditions)||null==(o=o.utm)||!o.utm_medium||(null==(l=e.conditions)||null==(l=l.utm)?void 0:l.utm_medium)==t.utm_medium,v=null==(u=e.conditions)||null==(u=u.utm)||!u.utm_term||(null==(h=e.conditions)||null==(h=h.utm)?void 0:h.utm_term)==t.utm_term;return c&&p&&v&&d}return!1}static Ds(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];t8.info("[WebExperiments] "+e,i)}qs(e,t,i){this._is_bot()?a4.Ds(a8):"control"!==t?i.forEach(i=>{if(i.selector){a4.Ds("applying transform of variant "+t+" for experiment "+e+" ",i);var s,r=null==(s=document)?void 0:s.querySelectorAll(i.selector);null==r||r.forEach(e=>{i.html&&(e.innerHTML=i.html),i.css&&e.setAttribute("style",i.css)})}}):a4.Ds("Control variants leave the page unmodified.")}_is_bot(){return l&&this._instance?nY(l,this.Ee.custom_blocked_useragents):void 0}}var a9=t6("[Conversations]"),a7="Conversations not available yet.",oe="console",ot={featureFlags:class{constructor(e){this.zs=!1,this.Vs=!1,this.Ws=!1,this.Zs=!1,this.Gs=!1,this.Qs=!1,this.Js=!1,this.Ks=!1,this.Ys=0,this.Xs=()=>{var e=this.eo();this.Ys=0,e&&this.reloadFeatureFlags()},this._instance=e,this.featureFlagEventHandlers=[],a&&sc(a,"online",this.Xs)}destroy(){null==a||a.removeEventListener("online",this.Xs)}get Ee(){return this._instance.config}get bi(){return this._instance.persistence}ro(e){return this._instance.get_property(e)}io(){var e,t;return null!=(e=null==(t=this.bi)?void 0:t.kr(this.Ee.feature_flag_cache_ttl_ms))&&e}no(){return!!this.io()&&(this.Ks||this.Ws||(this.Ks=!0,aZ.warn("Feature flag cache is stale, triggering refresh..."),this.reloadFeatureFlags()),!0)}so(){var e,t=null!=(e=this.Ee.evaluation_contexts)?e:this.Ee.evaluation_environments;return!this.Ee.evaluation_environments||this.Ee.evaluation_contexts||this.Js||(aZ.warn("evaluation_environments is deprecated. Use evaluation_contexts instead. evaluation_environments will be removed in a future version."),this.Js=!0),null!=t&&t.length?t.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||aZ.error("Invalid evaluation context found:",e,"Expected non-empty string"),t}):[]}oo(){return this.so().length>0}ao(){var e=this.Ee.flag_keys;if(!ei(e)){if(Q(e))return e.filter(e=>{var t=e&&"string"==typeof e&&e.trim().length>0;return t||aZ.error("Invalid flag key found:",e,"Expected non-empty string"),t});aZ.error("Invalid flag_keys found:",e,"Expected array of non-empty strings")}}initialize(){var e,t,i=this._instance.config,s=null!=(e=null==(t=i.bootstrap)?void 0:t.featureFlags)?e:{};if(Object.keys(s).length){var r,n,a=null!=(r=null==(n=i.bootstrap)?void 0:n.featureFlagPayloads)?r:{},o=Object.keys(s).filter(e=>!!s[e]).reduce((e,t)=>(e[t]=s[t]||!1,e),{}),l=Object.keys(a).filter(e=>o[e]).reduce((e,t)=>(a[t]&&(e[t]=a[t]),e),{});this.receivedFeatureFlags({featureFlags:o,featureFlagPayloads:l})}}updateFlags(e,t,i){var s,r,n=null!=i&&i.merge&&null!=(s=this.ro(iE))?s:{},a=null!=i&&i.merge&&null!=(r=this.ro(iF))?r:{},o=x({},n,e),l=x({},a,t),u={};for(var h of Object.entries(o)){var c=h[0],d=h[1];u[c]={key:c,enabled:S(d),variant:P(d),reason:void 0,metadata:ei(null==l?void 0:l[c])?void 0:{id:0,version:void 0,description:void 0,payload:l[c]}}}this.receivedFeatureFlags({flags:u})}get hasLoadedFlags(){return this.Vs}getFlags(){return Object.keys(this.getFlagVariants())}getFlagsWithDetails(){var e=this.ro(iP),t=this.ro(iC),i=this.ro(iR);if(!i&&!t)return e||{};var s=sn({},e||{});for(var r of[...new Set([...Object.keys(i||{}),...Object.keys(t||{})])]){var n,a,o=s[r],l=null==t?void 0:t[r],u=ei(l)?null!=(n=null==o?void 0:o.enabled)&&n:!!l,h=ei(l)?o.variant:"string"==typeof l?l:void 0,c=null==i?void 0:i[r],d=x({},o,{enabled:u,variant:u?null!=h?h:null==o?void 0:o.variant:void 0});u!==(null==o?void 0:o.enabled)&&(d.original_enabled=null==o?void 0:o.enabled),h!==(null==o?void 0:o.variant)&&(
1d.original_variant=null==o?void 0:o.variant),c&&(d.metadata=x({},null==o?void 0:o.metadata,{payload:c,original_payload:null==o||null==(a=o.metadata)?void 0:a.payload})),s[r]=d}return this.zs||(aZ.warn(" Overriding feature flag details!",{flagDetails:e,overriddenPayloads:i,finalDetails:s}),this.zs=!0),s}getAllFeatureFlags(){var e=this.getFlagVariants(),t=this.getFlagPayloads();return Object.keys(e).map(i=>{var s=e[i];return{key:i,enabled:S(s),variant:P(s),payload:k(t[i])}})}getFlagVariants(){var e=this.ro(iE),t=this.ro(iC);if(!t)return e||{};for(var i=sn({},e),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.zs||(aZ.warn(" Overriding feature flags!",{enabledFlags:e,overriddenFlags:t,finalFlags:i}),this.zs=!0),i}getFlagPayloads(){var e=this.ro(iF),t=this.ro(iR);if(!t)return e||{};for(var i=sn({},e||{}),s=Object.keys(t),r=0;s.length>r;r++)i[s[r]]=t[s[r]];return this.zs||(aZ.warn(" Overriding feature flag payloads!",{flagPayloads:e,overriddenPayloads:t,finalPayloads:i}),this.zs=!0),i}reloadFeatureFlags(){this.Zs||this.Ee.advanced_disable_feature_flags||this.eo()||this.lo||(this._instance.nn.emit("featureFlagsReloading",!0),this.lo=setTimeout(()=>{this.uo()},5))}ho(){clearTimeout(this.lo),this.lo=void 0}ensureFlagsLoaded(){this.Vs||this.Ws||this.lo||this.reloadFeatureFlags()}setAnonymousDistinctId(e){this.$anon_distinct_id=e}setReloadingPaused(e){this.Zs=e}uo(e){var t;if(this.ho(),!this._instance.Vr()&&!this.eo())if(this.Ws)this.Gs=!0;else{var i=this.Ee.token,s=this.ro(ie),r={token:i,distinct_id:this._instance.get_distinct_id(),groups:this._instance.getGroups(),$anon_distinct_id:this.$anon_distinct_id,person_properties:x({},(null==(t=this.bi)?void 0:t.get_initial_props())||{},this.ro(iM)||{},{$lib:y.LIB_NAME,$lib_version:y.LIB_VERSION}),group_properties:this.ro(iT),timezone:rq()};en(s)||ei(s)||(r.$device_id=s),(null!=e&&e.disableFlags||this.Ee.advanced_disable_feature_flags)&&(r.disable_flags=!0),this.oo()&&(r.evaluation_contexts=this.so());var n=this.ao();ei(n)||(r.flag_keys=n);var a=!!this.Ee.advanced_only_evaluate_survey_feature_flags,o=this._instance.requestRouter.endpointFor("flags","/flags/?v=2"+(this.Ee.advanced_only_evaluate_survey_feature_flags?"&only_evaluate_survey_feature_flags=true":""));this.Ws=!0,this._instance._send_request({method:"POST",url:o,data:r,compression:this.Ee.disable_compression?void 0:rW,timestampMode:"body",timeout:this.Ee.feature_flag_request_timeout_ms,callback:e=>{var t,i,s,n=!0;if(this.do(e.statusCode),200===e.statusCode&&(this.Gs||(this.$anon_distinct_id=void 0),n=!1),this.Ws=!1,!r.disable_flags||this.Gs){this.Qs=!n;var o=[];e.error?e.error instanceof Error?o.push("AbortError"===e.error.name?"timeout":"connection_error"):o.push("unknown_error"):200!==e.statusCode&&o.push("api_error_"+e.statusCode),null!=(t=e.json)&&t.errorsWhileComputingFlags&&o.push("errors_while_computing_flags");var l,u=!(null==(i=e.json)||null==(i=i.quotaLimited)||!i.includes("feature_flags"));(u&&o.push("quota_limited"),null==(s=this.bi)||s.register({[iH]:o}),u)?aZ.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."):(r.disable_flags||this.receivedFeatureFlags(null!=(l=e.json)?l:{},n,{partialResponse:a}),this.Gs&&(this.Gs=!1,this.uo()))}}})}}eo(){return rS(this.Ys,3)}do(e){this.Ys=rP(e,this.Ys,3,()=>aZ.warn("Feature flag requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped refreshing feature flags; will try again when connectivity changes."))}getFeatureFlag(e,t){var i;if(void 0===t&&(t={}),!t.fresh||this.Qs)if(this.Vs||this.getFlags()&&this.getFlags().length>0){if(!this.no()){var s=this.getFeatureFlagResult(e,t);return null!=(i=null==s?void 0:s.variant)?i:null==s?void 0:s.enabled}}else aZ.warn('getFeatureFlag for key "'+e+a1)}getFeatureFlagDetails(e){return this.getFlagsWithDetails()[e]}getFeatureFlagPayload(e){var t=this.getFeatureFlagResult(e,{send_event:!1});return null==t?void 0:t.payload}getFeatureFlagResult(e,t){if(void 0===t&&(t={}),!t.fresh||this.Qs)if(this.Vs||this.getFlags()&&this.getFlags().length>0){if(!this.no()){var i=this.getFlagVariants(),s=e in i,r=i[e],n=this.getFlagPayloads()[e],a=String(r),o=this.ro(i$)||void 0,l=this.ro(iz)||void 0,u=this.ro(ij)||{};if(this.Ee.advanced_feature_flags_dedup_per_session){var h,c=this._instance.get_session_id(),d=this.ro(iq);c&&c!==d&&(u={},null==(h=this.bi)||h.register({[ij]:u,[iq]:c}))}if((t.send_event||!("send_event"in t))&&(!(e in u)||!u[e].includes(a))){Q(u[e])?u[e].push(a):u[e]=[a],null==(f=this.bi)||f.register({[ij]:u});var p=this.getFeatureFlagDetails(e),v=[...null!=(_=this.ro(iH))?_:[]];ei(r)&&v.push("flag_missing");var g={$feature_flag:e,$feature_flag_response:r,$feature_flag_payload:n||null,$feature_flag_request_id:o,$feature_flag_evaluated_at:l,$feature_flag_bootstrapped_response:(null==(m=this.Ee.bootstrap)||null==(m
1=m.featureFlags)?void 0:m[e])||null,$feature_flag_bootstrapped_payload:(null==(y=this.Ee.bootstrap)||null==(y=y.featureFlagPayloads)?void 0:y[e])||null,$used_bootstrap_value:!this.Qs};ei(null==p||null==(b=p.metadata)?void 0:b.has_experiment)||(g.$feature_flag_has_experiment=p.metadata.has_experiment),ei(null==p||null==(w=p.metadata)?void 0:w.version)||(g.$feature_flag_version=p.metadata.version);var f,_,m,y,b,w,x,E,S,P,F,$,I=null!=(x=null==p||null==(E=p.reason)?void 0:E.description)?x:null==p||null==(S=p.reason)?void 0:S.code;I&&(g.$feature_flag_reason=I),null!=p&&null!=(P=p.metadata)&&P.id&&(g.$feature_flag_id=p.metadata.id),ei(null==p?void 0:p.original_variant)&&ei(null==p?void 0:p.original_enabled)||(g.$feature_flag_original_response=ei(p.original_variant)?p.original_enabled:p.original_variant),null!=p&&null!=(F=p.metadata)&&F.original_payload&&(g.$feature_flag_original_payload=null==p||null==($=p.metadata)?void 0:$.original_payload),v.length&&(g.$feature_flag_error=v.join(",")),this._instance.capture("$feature_flag_called",g)}if(s)return{key:e,enabled:!!r,variant:"string"==typeof r?r:void 0,payload:k(n)}}}else aZ.warn('getFeatureFlagResult for key "'+e+a1)}getRemoteConfigPayload(e,t){var i=this.Ee.token,s={distinct_id:this._instance.get_distinct_id(),token:i,person_properties:{$lib:y.LIB_NAME,$lib_version:y.LIB_VERSION}};this.oo()&&(s.evaluation_contexts=this.so());var r=this.ao();ei(r)||(s.flag_keys=r),this._instance._send_request({method:"POST",url:this._instance.requestRouter.endpointFor("flags","/flags/?v=2"),data:s,compression:this.Ee.disable_compression?void 0:rW,timestampMode:"body",timeout:this.Ee.feature_flag_request_timeout_ms,callback(i){var s,r=null==(s=i.json)?void 0:s.featureFlagPayloads;t((null==r?void 0:r[e])||void 0)}})}isFeatureEnabled(e,t){if(void 0===t&&(t={}),t.fresh&&!this.Qs)return t.defaultValue;if(!(this.Vs||this.getFlags()&&this.getFlags().length>0))return aZ.warn('isFeatureEnabled for key "'+e+a1),t.defaultValue;var i=this.getFeatureFlag(e,t);return ei(i)?t.defaultValue:!!i}addFeatureFlagsHandler(e){this.featureFlagEventHandlers.push(e)}removeFeatureFlagsHandler(e){this.featureFlagEventHandlers=this.featureFlagEventHandlers.filter(t=>t!==e)}receivedFeatureFlags(e,t,i){if(this.bi){this.Vs=!0;var s=this.getFlagVariants(),r=this.getFlagPayloads(),n=this.getFlagsWithDetails();!function(e,t,i,s,r,n){void 0===i&&(i={}),void 0===s&&(s={}),void 0===r&&(r={});var a,o=((a=e.flags)?(e.featureFlags=Object.fromEntries(Object.keys(a).map(e=>{var t;return[e,null!=(t=a[e].variant)?t:a[e].enabled]})),e.featureFlagPayloads=Object.fromEntries(Object.keys(a).filter(e=>a[e].enabled).filter(e=>{var t;return null==(t=a[e].metadata)?void 0:t.payload}).map(e=>{var t;return[e,null==(t=a[e].metadata)?void 0:t.payload]}))):e.featureFlags&&aZ.warn("Using an older version of the feature flags endpoint. Please upgrade your PostHog server to the latest version"),e),l=o.flags,u=o.featureFlags,h=o.featureFlagPayloads;if(u){var c=e.requestId,d=e.evaluatedAt;if(Q(u)){aZ.warn("v1 of the feature flags endpoint is deprecated. Please use the latest version.");var p={};if(u)for(var v=0;u.length>v;v++)p[u[v]]=!0;t&&t.register({[ik]:u,[iE]:p,[iI]:!1})}else{var g=u,f=h,_=l;if(null!=n&&n.partialResponse)g=x({},i,g),f=x({},s,f),_=x({},r,_);else if(e.errorsWhileComputingFlags)if(l){var m=new Set(Object.keys(l).filter(e=>{var t;return!(null!=(t=l[e])&&t.failed)}));g=x({},i,Object.fromEntries(Object.entries(g).filter(e=>m.has(e[0])))),f=x({},s,Object.fromEntries(Object.entries(f||{}).filter(e=>m.has(e[0])))),_=x({},r,Object.fromEntries(Object.entries(_||{}).filter(e=>m.has(e[0]))))}else g=x({},i,g),f=x({},s,f),_=x({},r,_);t&&t.register(x({[ik]:Object.keys(a3(g)),[iE]:g||{},[iF]:f||{},[iP]:_||{},[iI]:!0===e.minimalFlagCalledEvents},c?{[i$]:c}:{},d?{[iz]:d}:{}))}}}(e,this.bi,s,r,n,i),t||(this.Ks=!1),this.co(t)}}override(e,t){void 0===t&&(t=!1),aZ.warn("override is deprecated. Please use overrideFeatureFlags instead."),this.overrideFeatureFlags({flags:e,suppressWarning:t})}overrideFeatureFlags(e){if(!this._instance.__loaded||!this.bi)return aZ.uninitializedWarning("posthog.featureFlags.overrideFeatureFlags");if(!1===e)return this.bi.unregister(iC),this.bi.unregister(iR),this.co(),a0.info("All overrides cleared");if(Q(e)){var t,i=a2(e);return this.bi.register({[iC]:i}
1),this.co(),a0.info("Flag overrides set",{flags:e})}if(e&&"object"==typeof e&&("flags"in e||"payloads"in e)){if(this.zs=!!(null!=(t=e.suppressWarning)&&t),"flags"in e){if(!1===e.flags)this.bi.unregister(iC),a0.info("Flag overrides cleared");else if(e.flags){if(Q(e.flags)){var s=a2(e.flags);this.bi.register({[iC]:s})}else this.bi.register({[iC]:e.flags});a0.info("Flag overrides set",{flags:e.flags})}}return"payloads"in e&&(!1===e.payloads?(this.bi.unregister(iR),a0.info("Payload overrides cleared")):e.payloads&&(this.bi.register({[iR]:e.payloads}),a0.info("Payload overrides set",{payloads:e.payloads}))),void this.co()}if(e&&"object"==typeof e)return this.bi.register({[iC]:e}),this.co(),a0.info("Flag overrides set",{flags:e});aZ.warn("Invalid overrideOptions provided to overrideFeatureFlags",{overrideOptions:e})}onFeatureFlags(e){if(this.addFeatureFlagsHandler(e),this.Vs){var t=this.vo(),i=t.flags,s=t.flagVariants;try{e(i,s)}catch(e){aZ.error("Error while running feature flags callback",e)}}return()=>this.removeFeatureFlagsHandler(e)}updateEarlyAccessFeatureEnrollment(e,t,i){var s,r=(this.ro(iS)||[]).find(t=>t.flagKey===e),n={["$feature_enrollment/"+e]:t},a={$feature_flag:e,$feature_enrollment:t,$set:n};r&&(a.$early_access_feature_name=r.name),i&&(a.$feature_enrollment_stage=i),this._instance.capture("$feature_enrollment_update",a),this.setPersonPropertiesForFlags(n,!1);var o=x({},this.getFlagVariants(),{[e]:t});null==(s=this.bi)||s.register({[ik]:Object.keys(a3(o)),[iE]:o}),this.co()}getEarlyAccessFeatures(e,t,i){void 0===t&&(t=!1);var s=this.ro(iS),r=i?"&"+i.map(e=>"stage="+e).join("&"):"";if(s&&!t)return e(s);this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/early_access_features/?token="+this.Ee.token+r),method:"GET",timestampMode:"query",callback:t=>{var i,s;if(t.json){var r=t.json.earlyAccessFeatures;return null==(i=this.bi)||i.unregister(iS),null==(s=this.bi)||s.register({[iS]:r}),e(r)}}})}vo(){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),{})}}co(e){var t=this.vo(),i=t.flags,s=t.flagVariants;this.featureFlagEventHandlers.forEach(t=>{try{t(i,s,{errorsLoading:e})}catch(e){aZ.error("Error while running feature flags callback",e)}})}setPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.ro(iM)||{},s=(null==e?void 0:e.$set)||(null!=e&&e.$set_once?{}:e),r=null==e?void 0:e.$set_once,n={};if(r)for(var a in r)({}).hasOwnProperty.call(r,a)&&(a in i||(n[a]=r[a]));this._instance.register({[iM]:x({},i,n,s)}),t&&this._instance.reloadFeatureFlags()}unsetPersonPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=x({},this.ro(iM)||{});e.forEach(e=>{delete i[e]}),this._instance.register({[iM]:i}),t&&this._instance.reloadFeatureFlags()}resetPersonPropertiesForFlags(e){void 0===e&&(e=!0),this._instance.unregister(iM),e&&this._instance.reloadFeatureFlags()}setGroupPropertiesForFlags(e,t){void 0===t&&(t=!0);var i=this.ro(iT)||{};
10!==Object.keys(i).length&&Object.keys(i).forEach(t=>{i[t]=x({},i[t],e[t]),delete e[t]}),this._instance.register({[iT]:x({},i,e)}),t&&this._instance.reloadFeatureFlags()}resetGroupPropertiesForFlags(e){if(e){var t=this.ro(iT)||{};this._instance.register({[iT]:x({},t,{[e]:{}})})}else this._instance.unregister(iT)}reset(){this.Vs=!1,this.Ws=!1,this.Zs=!1,this.Gs=!1,this.Qs=!1,this.$anon_distinct_id=void 0,this.ho(),this.zs=!1,this.Ys=0}}},oi=x({productTours:class{get bi(){return this._instance.persistence}constructor(e){this.Ca=null,this.Ma=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(e.ok){var t,i,s=e.config;if("productTours"in s){if(this.bi&&this.bi.register({[id]:!!s.productTours}),!aq(this._instance))return!this.Ca&&ea(null==(t=this.bi)?void 0:t.props[iN])||aj.info("product tours disabled; stopping and clearing cached tours"),null==(i=this.Ca)||i.stop(),this.Ca=null,void this.clearCache();this.loadIfEnabled()}}}loadIfEnabled(){!this.Ca&&aq(this._instance)&&this.rr(()=>this.Ia())}rr(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.generateProductTours?e():null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,"product-tours",t=>{t?aj.error("Could not load product tours script",t):e()})}Ia(){var e;!this.Ca&&null!=(e=m.__PosthogExtensions__)&&e.generateProductTours&&(this.Ca=m.__PosthogExtensions__.generateProductTours(this._instance,!0))}getProductTours(e,t){if(void 0===t&&(t=!1),!Q(this.Ma)||t){var i=this.bi;if(i){var s=i.props[iN];if(Q(s)&&!t)return this.Ma=s,void e(s,{isLoaded:!0})}this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/product_tours/?token="+this._instance.config.token),method:"GET",timestampMode:"query",callback:t=>{if(aq(this._instance)){var s=t.statusCode;if(200!==s||!t.json){var r="Product Tours API could not be loaded, status: "+s;return aj.error(r),void e([],{isLoaded:!1,error:r})}var n=Q(t.json.product_tours)?t.json.product_tours:[];this.Ma=n,i&&i.register({[iN]:n}),e(n,{isLoaded:!0})}else e([],{isLoaded:!0})}})}else e(this.Ma,{isLoaded:!0})}getActiveProductTours(e){ea(this.Ca)?e([],{isLoaded:!1,error:"Product tours not loaded"}):this.Ca.getActiveProductTours(e)}showProductTour(e){var t;null==(t=this.Ca)||t.showTourById(e)}previewTour(e){this.Ca?this.Ca.previewTour(e):this.rr(()=>{var t;this.Ia(),null==(t=this.Ca)||t.previewTour(e)})}dismissProductTour(){var e;null==(e=this.Ca)||e.dismissTour("user_clicked_skip")}nextStep(){var e;null==(e=this.Ca)||e.nextStep()}previousStep(){var e;null==(e=this.Ca)||e.previousStep()}clearCache(){var e;this.Ma=null,null==(e=this.bi)||e.unregister(iN)}resetTour(e){var t;null==(t=this.Ca)||t.resetTour(e)}resetAllTours(){var e;null==(e=this.Ca)||e.resetAllTours()}cancelPendingTour(e){var t;null==(t=this.Ca)||t.cancelPendingTour(e)}}},ot),os=x({surveys:class{get Ee(){return this._instance.config}constructor(e){this.za=void 0,this._surveyManager=null,this.Va=!1,this.Wa=[],this.Za=null,this.Ga=null,this._instance=e,this._surveyEventReceiver=null}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this.Ee.disable_surveys){if(!e.ok)return n6.warn("Remote config unavailable. Not loading surveys.");var t=e.config.surveys;if(ea(t))return n6.warn("Flags not loaded yet. Not loading surveys.");var i=Q(t);this.za=i?t.length>0:t,n6.info("flags response received, isSurveysEnabled: "+this.za),this.loadIfEnabled()}}reset(){try{var e;null==(e=this._surveyEventReceiver)||e.reset(),localStorage.removeItem("lastSeenSurveyDate");for(var t=[],i=0;i<localStorage.length;i++){var s=localStorage.key(i);(null!=s&&s.startsWith(n4)||null!=s&&s.startsWith("inProgressSurvey_"))&&t.push(s)}t.forEach(e=>localStorage.removeItem(e))}catch(e){}}loadIfEnabled(){if(!this._surveyManager)if(this.Va)n6.info("Already initializing surveys, skipping...");else if(this.Ee.disable_surveys)n6.info(aJ);else if(this.Ee.cookieless_mode&&this._instance.consent.isOptedOut())n6.info("Not loading surveys in cookieless mode without consent.");else{var e=null==m?void 0:m.__PosthogExtensions__;if(e){if(!ei(this.za)||this.Ee.advanced_enable_surveys){var t=this.za||this.Ee.advanced_enable_surveys;this.Va=!0;try{var i=e.generateSurveys;if(i)return void this.Qa(i,t);var s=e.loadExternalDependency;if(!s)return void this.Ja(i1);s(this._instance,"surveys",i=>{i||!e.generateSurveys?this.Ja("Could not load surveys script",i):this.Qa(e.generateSurveys,t)})}catch(e){throw this.Ja("Error initializing surveys",e),e}finally{this.Va=!1}}}else n6.error("PostHog Extensions not found.")}}Qa(e,t){this._surveyManager=e(this._instance,t),this._surveyEventReceiver=new aW(this._instance),n6.info("Surveys loaded successfully"),this.Ka({isLoaded:!0})}Ja(e,t){n6.error(e,t),this.Ka({isLoaded:!1,error:e})}onSurveysLoaded(e){return this.Wa.push(e),this._surveyManager&&this.Ka({isLoaded:!0}),()=>{this.Wa=this.Wa.filter(t=>t!==e)}}getSurveys(e,t){if(void 0===t&&(t=!1),this.Ee.disable_surveys)return n6.info(aJ),e([]);var i,s=this._instance.get_property(iO);s&&!t?(e(s,{isLoaded:!0}
1),this.Ya()&&this.getSurveys(()=>{},!0)):"u">typeof Promise&&this.Za?this.Za.then(t=>e(t.surveys,t.context)):("u">typeof Promise&&(this.Za=new Promise(e=>{i=e})),this._instance._send_request({url:this._instance.requestRouter.endpointFor("api","/api/surveys/?token="+this.Ee.token),method:"GET",timestampMode:"query",timeout:this.Ee.surveys_request_timeout_ms,callback:t=>{this.Za=null;var s=t.statusCode;if(200!==s||!t.json){var r="Surveys API could not be loaded, status: "+s;n6.error(r),this.Ga=Date.now();var n={isLoaded:!1,error:r};return e([],n),void(null==i||i({surveys:[],context:n}))}this.Ga=null;var a,o,l=t.json.surveys||[],u=l.filter(e=>{var t;return!(!e.start_date||e.end_date)&&(n8(e)||!(null==(t=e.conditions)||null==(t=t.actions)||null==(t=t.values)||!t.length))});u.length>0&&(null==(o=this._surveyEventReceiver)||o.register(u)),null==(a=this._instance.persistence)||a.register({[iO]:l,[iA]:Date.now()});var h={isLoaded:!0};e(l,h),null==i||i({surveys:l,context:h})}}))}Ya(){return this.Xa()&&!this.Za&&!this.tl()}Xa(){var e=this._instance.get_property(iA);return eo(e)&&Date.now()-e>3e5}tl(){return eo(this.Ga)&&3e5>Date.now()-this.Ga}markSurveyAsSeen(e,t){var i;n9({id:e,current_iteration:null!=(i=null==t?void 0:t.iteration)?i:null});try{localStorage.setItem("lastSeenSurveyDate",(new Date).toISOString())}catch(e){}}Ka(e){for(var t of this.Wa)try{if(!e.isLoaded)return t([],e);this.getSurveys(t)}catch(e){n6.error("Error in survey callback",e)}}getActiveMatchingSurveys(e,t){if(void 0===t&&(t=!1),!ea(this._surveyManager))return this._surveyManager.getActiveMatchingSurveys(e,t);n6.warn("init was not called")}el(e){var t=null;return this.getSurveys(i=>{var s;t=null!=(s=i.find(t=>t.id===e))?s:null}),t}rl(e){if(ea(this._surveyManager))return{eligible:!1,reason:aY};var t="string"==typeof e?this.el(e):e;return t?this._surveyManager.checkSurveyEligibility(t):{eligible:!1,reason:"Survey not found"}}il(e){if(ea(this._surveyManager))return{eligible:!1,reason:aY};var t="string"==typeof e?this.el(e):e;return t?this._surveyManager.checkSurveyRenderability(t):{eligible:!1,reason:"Survey not found"}}canRenderSurvey(e){if(ea(this._surveyManager))return n6.warn("init was not called"),{visible:!1,disabledReason:aY};var t=this.il(e);return{visible:t.eligible,disabledReason:t.reason}}canRenderSurveyAsync(e,t){return ea(this._surveyManager)?(n6.warn("init was not called"),Promise.resolve({visible:!1,disabledReason:aY})):new Promise(i=>{this.getSurveys(t=>{var s,r=null!=(s=t.find(t=>t.id===e))?s:null;if(r){var n=this.il(r);i({visible:n.eligible,disabledReason:n.reason})}else i({visible:!1,disabledReason:"Survey not found"})},t)})}renderSurvey(e,t,i){var s;if(ea(this._surveyManager))n6.warn("init was not called");else{var r="string"==typeof e?this.el(e):e;if(null!=r&&r.id)if(n7.includes(r.type)){var n=null==u?void 0:u.querySelector(t);if(n)return null!=(s=r.appearance)&&s.surveyPopupDelaySeconds?(n6.info("Rendering survey "+r.id+" with delay of "+r.appearance.surveyPopupDelaySeconds+" seconds"),void setTimeout(()=>{var e,t;n6.info("Rendering survey "+r.id+" with delay of "+(null==(e=r.appearance)?void 0:e.surveyPopupDelaySeconds)+" seconds"),null==(t=this._surveyManager)||t.renderSurvey(r,n,i),n6.info("Survey "+r.id+" rendered")},1e3*r.appearance.surveyPopupDelaySeconds)):void this._surveyManager.renderSurvey(r,n,i);n6.warn("Survey element not found")}else n6.warn("Surveys of type "+r.type+" cannot be rendered in the app");else n6.warn("Survey not found")}}displaySurvey(e,t){var i;if(ea(this._surveyManager))n6.warn("init was not called");else{var s=this.el(e);if(s){var r=s;if(null!=(i=s.appearance)&&i.surveyPopupDelaySeconds&&t.ignoreDelay&&(r=x({},s,{appearance:x({},s.appearance,{surveyPopupDelaySeconds:0})})),t.displayType!==rZ&&t.initialResponses&&n6.warn("initialResponses is only supported for popover surveys. prefill will not be applied."),!1===t.ignoreConditions){var n=this.rl(s);if(!n.eligible)return void n6.warn("Survey is not eligible to be displayed: ",n.reason)}"inline"!==t.displayType?this._surveyManager.handlePopoverSurvey(r,t):this.renderSurvey(r,t.selector,t.properties)}else n6.warn("Survey not found")}}cancelPendingSurvey(e){ea(this._surveyManager)?n6.warn("init was not called"):this._surveyManager.cancelSurvey(e)}handlePageUnload(){var e;null==(e=this._surveyManager)||null==e.handlePageUnload||e.handlePageUnload()}}},ot),or=x({experiments:a4},ot),on=x({},ot,{sessionRecording:class{get Ee(){return this._instance.config}get bi(){return this._instance.persistence}get started(){var e;return!(null==(e=this.fo)||!e.isStarted)}get status(){var e,t;return this.po===aT||this.po===aO?this.po:null!=(e=null==(t=this.fo)?void 0:t.status)?e:this.po}constructor(e){if(this._forceAllowLocalhostNetworkCapture=!1,this.po=aR,this.mo=void 0,this._instance=e,!this._instance.sessionManager)throw aL.error("started without valid sessionManager"),Error(aA+" started without valid sessionManager. This is a bug.");if(this.Ee.cookieless_mode===i3)throw Error(aA+' cannot be used with cookieless_mode="always"')}initialize(){this.startIfEnabledOrStop()}get yo(){var e,t=!(null==(e=this._instance.get_property(iv))||!e.enabled),i=!this.Ee.disable_session_recording,s=this.Ee.disable_session_recording||this._instance.consent.isOptedOut();return a&&t&&i&&!s}startIfEnabledOrStop(e){var t;if(!this.yo||null==(t=this.fo)||!t.isStarted){var i=!ei(Object.assign)&&!ei(Array.from);this.yo&&i?(this.bo(e),aL.info("starting")):(this.po=aR,this.stopRecording())}}bo(e){var t,i,s;this.yo&&(this.po!==aT&&this.po!==aO&&(this.po=aM),null!=m&&null!=(t=m.__PosthogExtensions__)&&null!=(t=t.rrweb)&&t.record&&null!=(i=m.__PosthogExtensions__)&&i.initSessionRecording?this._o(e):null==(s=m.__PosthogExtensions__)||null==s.loadExternalDependency||s.loadExternalDependency(this._instance,this.wo,t=>{if(t)return aL.error("could not load recorder",t);this._o(e)}))}stopRecording(){var e,t;null==(e=this.mo)||e.call(this),this.mo=void 0,null==(t=this.fo)||t.stop()}xo(){var e,t;null==(e=this.mo)||e.call(this),this.mo=void 0,null==(t=this.fo)||t.discard()}ko(){var e,t;null==(e=this.bi)||e.unregister(ix),null==(t=this.bi)||t.unregister(ig)}So(e,t){if(ea(e))return null;var i=eo(e)?e:parseFloat(e);return"number"!=typeof i||!Number.isFinite(i)||0>i||i>1?(aL.warn(t+" must be between 0 and 1. Ignoring invalid value:",e),null):i}Co(e){if(this.bi){var t,i,s=this.bi,r=()=>{var t,i=!1===e.sessionRecording?void 0:e.sessionRecording,r=this.So(null==(t=this.Ee.session_recording)?void 0:t.sampleRate,"session_recording.sampleRate"),n=this.So(null==i?void 0:i.sampleRate,"remote config sampleRate"),a=null!=r?r:n;ea(a)&&this.ko();var o=null==i?void 0:i.minimumDurationMilliseconds;s.register({[iv]:x({cache_timestamp:Date.now(),enabled:!!i},i,{networkPayloadCapture:x({capturePerformance:e.capturePerformance},null==i?void 0:i.networkPayloadCapture),canvasRecording:{enabled:null==i?void 0:i.recordCanvas,fps:null==i?void 0:i.canvasFps,quality:null==i?void 0:i.canvasQuality},sampleRate:a,minimumDurationMilliseconds:ei(o)?null:o,endpoint:null==i?void 0:i.endpoint,triggerMatchType:null==i?void 0:i.triggerMatchType,masking:null==i?void 0:i.masking,urlTriggers:null==i?void 0:i.urlTriggers,version:null==i?void 0:i.version,triggerGroups:null==i?void 0:i.triggerGroups})})};r(),null==(t=this.mo)||t.call(this),this.mo=null==(i=this._instance.sessionManager)?void 0:i.onSessionId(r)}}onRemoteConfig(e){var t=e.ok?e.config:void 0;return t&&"sessionRecording"in t?!1===t.sessionRecording?(this.Co(t),void this.xo()):(this.Co(t),void this.startIfEnabledOrStop()):(this.po===aT&&(this.po=aO,aL.warn("config refresh failed, recording will not start until page reload")),void this.startIfEnabledOrStop())}log(e,t){var i;void 0===t&&(t="log"),null!=(i=this.fo)&&i.log?this.fo.log(e,t):aL.warn("log called before recorder was ready")}get wo(){var e,t,i=null==(e=this._instance)||null==(e=e.persistence)?void 0:e.get_property(iv);return(null==i||null==(t=i.scriptConfig)?void 0:t.script)||"lazy-recorder"}Mo(){var e,t,i=this._instance.get_property(iv);if(!i)return!1;try{t="object"==typeof i?i:JSON.parse(i)}catch(e){return aL.warn("persisted remote config for session recording is invali
1d and will be ignored",e),!1}var s=null!=(e=t.cache_timestamp)?e:Date.now();return 36e5>=Date.now()-s}_o(e){var t,i;if(null==(t=m.__PosthogExtensions__)||!t.initSessionRecording)return aL.warn("Called on script loaded before session recording is available. This can be caused by adblockers."),void this._instance.register_for_session({[i0]:!0});if(this.fo||(this.fo=null==(i=m.__PosthogExtensions__)?void 0:i.initSessionRecording(this._instance),this.fo._forceAllowLocalhostNetworkCapture=this._forceAllowLocalhostNetworkCapture),!this.Mo()){if(this.po===aO||this.po===aT)return;return this.po=aT,aL.info("persisted remote config is stale, requesting fresh config before starting"),void new r3(this._instance).load()}this.po=aM,this.fo.start(e)}onRRwebEmit(e){var t;null==(t=this.fo)||null==t.onRRwebEmit||t.onRRwebEmit(e)}overrideLinkedFlag(){var e,t;this.fo||null==(t=this.bi)||t.register({[im]:!0}),null==(e=this.fo)||e.overrideLinkedFlag()}overrideSampling(){var e,t;this.fo||null==(t=this.bi)||t.register({[i_]:!0}),null==(e=this.fo)||e.overrideSampling()}overrideTrigger(e){var t,i;this.fo||null==(i=this.bi)||i.register({["url"===e?iy:ib]:!0}),null==(t=this.fo)||t.overrideTrigger(e)}get sdkDebugProperties(){var e;return(null==(e=this.fo)?void 0:e.sdkDebugProperties)||{$recording_status:this.status}}tryAddCustomEvent(e,t){var i;return!(null==(i=this.fo)||!i.tryAddCustomEvent(e,t))}}},{autocapture:class{constructor(e){this.Io=!1,this.To=null,this.Eo=!1,this.Ro=!1,this.instance=e,this.rageclicks=new aE(e.config.rageclick),this.Po=null}initialize(){this.startIfEnabled()}get Ee(){var e,t,i=ee(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}Oo(){if(this.isBrowserSupported()){if(a&&u){var e=e=>{e=e||(null==a?void 0:a.event);try{this.Fo(e)}catch(e){aS.error("Failed to capture event",e)}};if(sc(u,"submit",e,{capture:!0}),sc(u,"change",e,{capture:!0}),sc(u,"click",e,{capture:!0}),this.Ee.capture_copied_text){var t=e=>{e=e||(null==a?void 0:a.event);try{this.Fo(e,ak)}catch(e){aS.error("Failed to capture copy/cut event",e)}};sc(u,"copy",t,{capture:!0}),sc(u,"cut",t,{capture:!0})}}}else aS.info("Disabling Automatic Event Collection because this browser is not supported")}startIfEnabled(){this.isEnabled&&!this.Io&&(this.Oo(),this.Io=!0)}onRemoteConfig(e){if(this.Eo=!0,e.ok){var t=e.config;t.elementsChainAsString&&(this.Ro=t.elementsChainAsString);var i=t.autocapture_opt_out;eu(i)&&(this.instance.persistence&&this.instance.persistence.register({[ir]:i}),this.To=i),this.startIfEnabled()}else this.startIfEnabled()}setElementSelectors(e){this.Po=e}getElementSelectors(e){var t,i=[];return null==(t=this.Po)||t.forEach(t=>{var s=null==u?void 0:u.querySelectorAll(t);null==s||s.forEach(s=>{e===s&&i.push(t)})}),i}get isEnabled(){var e,t,i=null==(e=this.instance.persistence)?void 0:e.props[ir],s=this.To,r=this.instance.Vr()&&!this.Eo;if(en(s)&&!eu(i)&&!r)return!1;var n=null!=(t=this.To)?t:!!i;return!!this.instance.config.autocapture&&!n}Fo(e,t){if(void 0===t&&(t="$autocapture"),this.isEnabled){var i,s=sW(e);sq(s)&&(s=s.parentNode||null),"$autocapture"===t&&"click"===e.type&&e instanceof MouseEvent&&this.instance.config.rageclick&&null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,e.timeStamp||(new Date).getTime())&&s3(s,this.instance.config.rageclick)&&this.Fo(e,"$rageclick");var r=t===ak;if(s&&function(e,t,i,s,r,n){if(!a||s5(e)||null!=i&&i.url_allowlist&&!sB(i.url_allowlist,n)||null!=i&&i.url_ignorelist&&sB(i.url_ignorelist,n))return!1;if(null!=i&&i.dom_event_allowlist){var o,l=i.dom_event_allowlist;if(l&&!l.some(e=>t.type===e))return!1}var u=s8(e,s),h=u.parentIsUsefulElement,c=u.targetElementList;if(!function(e,t){var i=null==t?void 0:t.element_allowlist;if(ei(i))return!0;var s,r=function(e){if(i.some(t=>e.tagName.toLowerCase()===t))return{v:!0}};for(var n of e)if(s=r(n))return s.v;return!1}(c,i)||!sJ(c,null==i?void 0:i.css_selector_allowlist)||sJ(c,null!=(o=null==i?void 0:i.css_selector_ignorelist)?o:sX))return!1;try{var d=a.getComputedStyle(e);
1if(d&&"pointer"===d.getPropertyValue("cursor")&&"click"===t.type)return!0}catch(e){}var p=e.tagName.toLowerCase();switch(p){case"html":return!1;case"form":return(r||["submit"]).indexOf(t.type)>=0;case"input":case"select":case"textarea":return(r||["change","click"]).indexOf(t.type)>=0;default:return h?(r||["click"]).indexOf(t.type)>=0:(r||["click"]).indexOf(t.type)>=0&&(sY.indexOf(p)>-1||"true"===e.getAttribute("contenteditable"))}}(s,e,this.Ee,r,r?["copy","cut"]:void 0,this.instance)){var n=function(e,t){var i,s,r=t.e,n=t.maskAllElementAttributes,o=t.maskAllText,l=t.elementAttributeIgnoreList,u=t.elementsChainAsString,h=t.disableCaptureUrlHashes;if(!sN(e))return{props:{}};for(var c=[e],d=new Set([e]),p=e;p.parentNode&&!sj(p,"body")&&1e3>c.length;)if(sH(p.parentNode)){var v=p.parentNode.host;if(d.has(v))break;d.add(v),c.push(v),p=v}else{if(!sN(p.parentNode)||d.has(p.parentNode))break;d.add(p.parentNode),c.push(p.parentNode),p=p.parentNode}var g,f=[],_={},m=!1,y=!1;if(sr(c,e=>{var t=s6(e);if(sj(e,"a")){var i=e.getAttribute("href");m=!!(t&&i&&rr(i))&&(h?tg(i):i)}V(sU(e),"ph-no-capture")&&(y=!0),f.push(function(e,t,i,s,r){void 0===r&&(r=!1);var n=e.tagName.toLowerCase(),a={tag_name:n};sY.indexOf(n)>-1&&!i&&(a.$el_text="a"===n.toLowerCase()||"button"===n.toLowerCase()?aP(1024,rn(e)):aP(1024,sG(e)));var o=sU(e);o.length>0&&(a.classes=o.filter(function(e){return""!==e})),sr(e.attributes,function(i){var n;if((!s4(e)||-1!==["name","id","class","aria-label"].indexOf(i.name))&&(null==s||!s.includes(i.name))&&!t&&rr(i.value)&&(!es(n=i.name)||"_ngcontent"!==n.substring(0,10)&&"_nghost"!==n.substring(0,7))){var o=i.value;"class"===i.name&&(o=sz(o).join(" ")),a["attr__"+i.name]=aP(1024,"href"===i.name&&r?tg(o):o)}});for(var l=1,u=1,h=e;h=function(e){if(e.previousElementSibling)return e.previousElementSibling;var t=e;do t=t.previousSibling;while(t&&!sN(t));return t}(h);)l++,h.tagName===e.tagName&&u++;return a.nth_child=l,a.nth_of_type=u,a}(e,n,o,l,h)),sn(_,function(e){if(!s6(e))return{};var t={};return sr(e.attributes,function(e){if(e.name&&0===e.name.indexOf("data-ph-capture-attribute")){var i=e.name.replace("data-ph-capture-attribute-",""),s=e.value;i&&s&&rr(s)&&(t[i]=s)}}),t}(e))}),y)return{props:{},explicitNoCapture:y};if(o||(f[0].$el_text=sj(e,"a")||sj(e,"button")?rn(e):sG(e)),m){f[0].attr__href=m;var b,w,E=null==(b=rw(m))?void 0:b.host,k=null==a||null==(w=a.location)?void 0:w.host;E&&k&&E!==k&&(g=m)}return{props:sn({$event_type:r.type,$ce_version:1},u?{}:{$elements:f},{$elements_chain:f.map(e=>{var t,i,s={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:function(e){var t=e.attr__class;if(t)return Q(t)?t:sz(t)}(e),attr_id:e.attr__id,nth_child:e.nth_child,nth_of_type:e.nth_of_type,attributes:{}};return sa(e).filter(e=>0===e[0].indexOf("attr__")).forEach(e=>s.attributes[e[0]]=e[1]),s}).map(e=>{var t,i,s="";if(e.tag_name&&(s+=e.tag_name),e.attr_class)for(var r of(e.attr_class.sort(),e.attr_class))s+="."+r.replace(/"/g,"");var n=x({},e.text?{text:e.text}:{},{"nth-child":null!=(t=e.nth_child)?t:0,"nth-of-type":null!=(i=e.nth_of_type)?i:0},e.href?{href:e.href}:{},e.attr_id?{attr_id:e.attr_id}:{},e.attributes),a={};return sa(n).sort((e,t)=>e[0].localeCompare(t[0])).forEach(e=>{var t=e[1];return a[ra(e[0].toString())]=ra(t.toString())}),(s+=":")+sa(a).map(e=>e[0]+'="'+e[1]+'"').join("")}).join(";")},null!=(i=f[0])&&i.$el_text?{$el_text:null==(s=f[0])?void 0:s.$el_text}:{},g&&"click"===r.type?{$external_click_url:g}:{},_)}}(s,{e:e,maskAllElementAttributes:this.instance.config.mask_all_element_attributes,maskAllText:this.instance.config.mask_all_text,elementAttributeIgnoreList:this.Ee.element_attribute_ignorelist,elementsChainAsString:this.Ro,disableCaptureUrlHashes:this.instance.config.disable_capture_url_hashes}),o=n.props;if(n.explicitNoCapture)return!1;var l=this.getElementSelectors(s);if(l&&l.length>0&&(o.$element_selectors=l),t===ak){var u,h=sV(null==a||null==(u=a.getSelection())?void 0:u.toString()),c=e.type||"clipboard";if(!h)return!1;o.$selected_content=h,o.$copy_type=c}return this.instance.capture(t,o),!0}}}isBrowserSupported(){return Z(null==u?void 0:u.querySelectorAll)}},historyAutocapture:class{constructor(e){var t;this._instance=e,this.Ao=(null==a||null==(t=a.location)?void 0:t.pathname)||""}initialize(){this.startIfEnabled()}get isEnabled(){return"history_change"===this._instance.config.capture_pageview}startIfEnabled(){this.isEnabled&&(t8.info("History API monitoring enabled, starting..."),this.monitorHistoryChanges())}stop(){this.$o&&this.$o(),this.$o=void 0,t8.info("History API monitoring stopped")}monitorHistoryChanges(){a&&a.history&&(this.Lo("pushState"),this.Lo("replaceState"),this.Do())}Lo(e){var t;if(a&&(null==(t=a.history[e])||!t.__posthog_wrapped__)){var i=this;!function(e,t,i){try{if(!(t in e))return a$;var s={next:e[t]},r=i(function(){for(var e=arguments.length,t=Array(e),i=0;e>i;i++)t[i]=arguments[i];return s.next.apply(this,t)});Z(r)&&(r.prototype=r.prototype||{},Object.defineProperties(r,{__posthog_wrapped__:{enumerable:!1,value:!0},__posthog_layer__:{enumerable:!1,value:s}})),e[t]=r}catch(e){return a$}}(a.history,e,t=>
1function(s,r,n){t.call(this,s,r,n),i.No(e)})}}No(e){try{var t,i=null==a||null==(t=a.location)?void 0:t.pathname;if(!i)return;i!==this.Ao&&this.isEnabled&&this._instance.capture(i7,{navigation_type:e}),this.Ao=i}catch(t){t8.error("Error capturing "+e+" pageview",t)}}Do(){if(!this.$o){var e=()=>{this.No("popstate")};sc(a,"popstate",e),this.$o=()=>{a&&a.removeEventListener("popstate",e)}}}},heatmaps:class{get Ee(){return this.instance.config}constructor(e){var t;this.qo=!1,this.Io=!1,this.jo=null,this.instance=e,this.qo=!(null==(t=this.instance.persistence)||!t.props[ia]),this.rageclicks=new aE(e.config.rageclick)}initialize(){this.startIfEnabled()}get flushIntervalMilliseconds(){var e=5e3;return ee(this.Ee.capture_heatmaps)&&this.Ee.capture_heatmaps.flush_interval_milliseconds&&(e=this.Ee.capture_heatmaps.flush_interval_milliseconds),e}get isEnabled(){return ea(this.Ee.capture_heatmaps)?ea(this.Ee.enable_heatmaps)?this.qo:this.Ee.enable_heatmaps:!1!==this.Ee.capture_heatmaps}startIfEnabled(){if(this.isEnabled)this.Io||(aD.info("starting..."),this.Ho(),this.Ce());else{var e;clearInterval(null!=(e=this.jo)?e:void 0),this.Bo(),this.getAndClearBuffer()}}onRemoteConfig(e){if(e.ok){var t=e.config;if("heatmaps"in t){var i=!!t.heatmaps;this.instance.persistence&&this.instance.persistence.register({[ia]:i}),this.qo=i,this.startIfEnabled()}}}getAndClearBuffer(){var e=this.R;return this.R=void 0,e}Uo(e){aN(e.originalEvent)&&this.ye(e.originalEvent,"deadclick")}Ce(){this.jo&&clearInterval(this.jo),this.jo="visible"===(null==u?void 0:u.visibilityState)?setInterval(this.li.bind(this),this.flushIntervalMilliseconds):null}Ho(){a&&u&&(this.zo=this.li.bind(this),sc(a,i9,this.zo),this.Vo=e=>this.ye(e||(null==a?void 0:a.event)),sc(u,"click",this.Vo,{capture:!0}),this.Wo=e=>this.Zo(e||(null==a?void 0:a.event)),sc(u,"mousemove",this.Wo,{capture:!0}),this.Go=new rh(this.instance,rl,this.Uo.bind(this)),this.Go.startIfEnabledOrStop(),this.Qo=this.Ce.bind(this),sc(u,i4,this.Qo),this.Io=!0)}Bo(){var e;a&&u&&(this.zo&&a.removeEventListener(i9,this.zo),this.Vo&&u.removeEventListener("click",this.Vo,{capture:!0}),this.Wo&&u.removeEventListener("mousemove",this.Wo,{capture:!0}),this.Qo&&u.removeEventListener(i4,this.Qo),clearTimeout(this.Jo),null==(e=this.Go)||e.stop(),this.Io=!1)}Ko(e,t){var i=this.instance.scrollManager.scrollY(),s=this.instance.scrollManager.scrollX(),r=this.instance.scrollManager.scrollElement(),n=function(e,t,i){for(var s=e;s&&sN(s)&&!sj(s,"body")&&s!==i;){var r,n,o,l=void 0;try{l=null==(r=null!=(n=null==(o=s.ownerDocument)?void 0:o.defaultView)?n:a)?void 0:r.getComputedStyle(s).position}catch(e){break}if(V(t,l))return!0;s=sK(s)}return!1}(sW(e),["fixed","sticky"],r);return{x:e.clientX+(n?0:s),y:e.clientY+(n?0:i),target_fixed:n,type:t}}ye(e,t){var i;if(void 0===t&&(t="click"),!sD(e.target)&&aN(e)){var s=this.Ko(e,t);null!=(i=this.rageclicks)&&i.isRageClick(e.clientX,e.clientY,(new Date).getTime())&&s3(sW(e),this.instance.config.rageclick)&&this.Wt(x({},s,{type:"rageclick"})),this.Wt(s)}}Zo(e){!sD(e.target)&&aN(e)&&(clearTimeout(this.Jo),this.Jo=setTimeout(()=>{this.Wt(this.Ko(e,"mousemove"))},500))}Wt(e){if(a){var t=this.Ee.disable_capture_url_hashes?tg(a.location.href):a.location.href,i=this.Ee.custom_personal_data_properties,s=rE(t,this.Ee.mask_personal_data_properties?[...r$,...i||[]]:[],rC);this.R=this.R||{},this.R[s]||(this.R[s]=[]),this.R[s].push(e)}}li(){this.R&&!et(this.R)&&this.instance.capture("$$heatmap",{$heatmap_data:this.getAndClearBuffer()})}},deadClicksAutocapture:rh,webVitalsAutocapture:class{constructor(e){var t;this.qo=!1,this.Io=!1,this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0},this.Yo=()=>{clearTimeout(this.Xo),0!==this.R.metrics.length&&(this._instance.capture("$web_vitals",this.R.metrics.reduce((e,t)=>x({},e,{["$web_vitals_"+t.name+"_event"]:x({},t),["$web_vitals_"+t.name+"_value"]:t.value}),{})),this.R={url:void 0,metrics:[],firstMetricTimestamp:void 0})},this.ta=e=>{this.R=this.R||{url:void 0,metrics:[],firstMetricTimestamp:void 0};var t,i=this.ea();if(!ei(i))if(ea(null==e?void 0:e.name)||ea(null==e?void 0:e.value))aC.error("Invalid metric received",e);else if(!this.ra||this.ra>e.value){this.R.url!==i&&(this.Yo(),this.Xo=setTimeout(this.Yo,this.flushToCaptureTimeoutMs)),ei(this.R.url)&&(this.R.url=i),this.R.firstMetricTimestamp=ei(this.R.firstMetricTimestamp)?Date.now():this.R.firstMetricTimestamp,e.attribution&&e.attribution.interactionTargetElement&&(e.attribution.interactionTargetElement=void 0);var s=null==(t=this._instance.sessionManager)?void 0:t.checkAndGetSessionAndWindowId(!0),r=x({},e,{$current_url:i,timestamp:Date.now()});ei(s)||(r.$session_id=s.sessionId,r.$window_id=s.windowId),this.R.metrics.push(r),this.R.metrics.length===this.allowedMetrics.length&&this.Yo()}else aC.error("Ignoring metric with value >= "+this.ra,e)},this.ia=()=>
1{if(!this.Io){var e,t,i,s,r=m.__PosthogExtensions__;if(!ei(r)&&!ei(r.postHogWebVitalsCallbacks)){var n=r.postHogWebVitalsCallbacks;e=n.onLCP,t=n.onCLS,i=n.onFCP,s=n.onINP}e&&t&&i&&s?(this.allowedMetrics.indexOf("LCP")>-1&&e(this.ta.bind(this)),this.allowedMetrics.indexOf("CLS")>-1&&t(this.ta.bind(this)),this.allowedMetrics.indexOf("FCP")>-1&&i(this.ta.bind(this)),this.allowedMetrics.indexOf("INP")>-1&&s(this.ta.bind(this)),this.Io=!0):aC.error("web vitals callbacks not loaded - not starting")}},this._instance=e,this.qo=!(null==(t=this._instance.persistence)||!t.props[ih]),this.startIfEnabled()}get na(){return this._instance.config.capture_performance}get allowedMetrics(){var e,t,i=ee(this.na)?null==(e=this.na)?void 0:e.web_vitals_allowed_metrics:void 0;return ea(i)?(null==(t=this._instance.persistence)?void 0:t.props[ip])||["CLS","FCP","INP","LCP"]:i}get flushToCaptureTimeoutMs(){return(ee(this.na)?this.na.web_vitals_delayed_flush_ms:void 0)||5e3}get useAttribution(){var e=ee(this.na)?this.na.web_vitals_attribution:void 0;return null!=e&&e}get ra(){var e=ee(this.na)&&eo(this.na.__web_vitals_max_value)?this.na.__web_vitals_max_value:9e5;return e>0&&6e4>=e?9e5:e}get isEnabled(){var e=null==h?void 0:h.protocol;if("http:"!==e&&"https:"!==e)return aC.info("Web Vitals are disabled on non-http/https protocols"),!1;var t=ee(this.na)?this.na.web_vitals:eu(this.na)?this.na:void 0;return eu(t)?t:this.qo}startIfEnabled(){this.isEnabled&&!this.Io&&(aC.info("enabled, starting..."),this.rr(this.ia))}onRemoteConfig(e){if(e.ok){var t=e.config;if("capturePerformance"in t){var i=ee(t.capturePerformance)&&!!t.capturePerformance.web_vitals,s=ee(t.capturePerformance)?t.capturePerformance.web_vitals_allowed_metrics:void 0;this._instance.persistence&&(this._instance.persistence.register({[ih]:i}),this._instance.persistence.register({[ip]:s})),this.qo=i,this.startIfEnabled()}}}rr(e){var t,i;null!=(t=m.__PosthogExtensions__)&&t.postHogWebVitalsCallbacks?e():null==(i=m.__PosthogExtensions__)||null==i.loadExternalDependency||i.loadExternalDependency(this._instance,this.useAttribution?"web-vitals-with-attribution":"web-vitals",t=>{t?aC.error("failed to load script",t):e()})}ea(){var e=a?this._instance.config.disable_capture_url_hashes?tg(a.location.href):a.location.href:void 0;if(e){var t=this._instance.config.custom_personal_data_properties;return rE(e,this._instance.config.mask_personal_data_properties?[...r$,...t||[]]:[],rC)}aC.error("Could not determine current URL")}}},{exceptionObserver:class{constructor(e){var t;this.ia=()=>{var e;if(a&&this.isEnabled&&null!=(e=m.__PosthogExtensions__)&&e.errorWrappingFunctions){var t=m.__PosthogExtensions__.errorWrappingFunctions.wrapOnError,i=m.__PosthogExtensions__.errorWrappingFunctions.wrapUnhandledRejection,s=m.__PosthogExtensions__.errorWrappingFunctions.wrapConsoleError;try{!this.sa&&this.Ee.capture_unhandled_errors&&(this.sa=t(this.captureException.bind(this))),!this.oa&&this.Ee.capture_unhandled_rejections&&(this.oa=i(this.captureException.bind(this))),!this.aa&&this.Ee.capture_console_errors&&(this.aa=s(this.captureException.bind(this)))}catch(e){aF.error("failed to start",e),this.la()}}},this._instance=e,this.ua=!(null==(t=this._instance.persistence)||!t.props[io]),this.ha=new ey(x({},function(e){var t,i,s,r;return void 0===e&&(e={}),{refillRate:null!=(t=null!=(i=e.exceptionRateLimiterRefillRate)?i:e.__exceptionRateLimiterRefillRate)?t:1,bucketSize:null!=(s=null!=(r=e.exceptionRateLimiterBucketSize)?r:e.__exceptionRateLimiterBucketSize)?s:10}}(this._instance.config.error_tracking),{refillInterval:1e4,it:aF})),this.Ee=this.da(),this.startIfEnabledOrStop()}da(){var e=this._instance.config.capture_exceptions,t={capture_unhandled_errors:!1,capture_unhandled_rejections:!1,capture_console_errors:!1};return ee(e)?t=x({},t,e):(ei(e)?this.ua:e)&&(t=x({},t,{capture_unhandled_errors:!0,capture_unhandled_rejections:!0})),t}get isEnabled(){return this.Ee.capture_console_errors||this.Ee.capture_unhandled_errors||this.Ee.capture_unhandled_rejections}startIfEnabledOrStop(){this.isEnabled?(aF.info("enabled"),this.la(),this.rr(this.ia)):this.la()}rr(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 aF.error("failed to load script",t);e()})}la(){var e,t,i;null==(e=this.sa)||e.call(this),this.sa=void 0,null==(t=this.oa)||t.call(this),this.oa=void 0,null==(i=this.aa)||i.call(this),this.aa=void 0}onRemoteConfig(e){if(e.ok){var t=e.config;"autocaptureExceptions"in t&&(this.ua=!!t.autocaptureExceptions,this._instance.persistence&&this._instance.persistence.register({[io]:this.ua}),this.Ee=this.da(),this.startIfEnabledOrStop())}}onConfigChange(){this.Ee=this.da()}captureException(e){var t,i,s,r=null!=(t=null==e||null==(i=e.$exception_list)||null==(i=i[0])?void 0:i.type)?t:"Exception";this.ha.consumeRateLimit(r)?aF.info("Skipping exception capture because of client rate limiting.",{exception:r}):null==(s=this._instance.exceptions)||s.sendExceptionEvent(e)}},exceptions:class{constructor(e){var t,i;this.ca=[],this.va=new tC([new tH,new tX,new tB,new tz,new tJ,new tY,new tV,new tK],function(e){for(var t=arguments.length,i=Array(t>1?t-1:0),s=1;t>s;s++)i[s-1]=arguments[s];return function(t,s){void 0===s&&(s=0);for(var r=[],n=t.split("\n"),a=s;n.length>a;a++){var o=n[a];if(1024>=o.length){var l=tq.test(o)?o.replace(tq,"$1"):o;if(!l.match(/\S*Error: /)){for(var u of i){var h=u(l,e);if(h){r.push(h);break}}if(r.length>=50)break}}}if(!r.length)return[];var c=Array.from(r);return c.reverse(),c.slice(0,50).map(e=>x({},e,{filename:e.filename||(c[c.length-1]||{}).filename,function:e.function||"?"}))}}("web:javascript",tL,tj)),this._instance=e,this.ca=null!=(t=null==(i=this._instance.persistence)?void 0:i.get_property(il))?t:[],this.fa=t2(this.pa()),this.ga=new t3(this.fa)}onConfigChange(){this.fa=t2(this.pa()),this.ga.setConfig(this.fa)}onRemoteConfig(e){var t,i,s;if(e.ok){var r=e.config;if("errorTracking"in r){var n=null!=(t=null==(i=r.errorTracking)?void 0:i.suppressionRules)?t:[],a=null==(s=r.errorTracking)?void 0:s.captureExtensionExceptions;this.ca=n,this._instance.persistence&&this._instance.persistence.register({[il]:this.ca,[iu]:a})}}}get ma(){var e,t=!!this._instance.get_property(iu),i=this._instance.config.error_tracking.captureExtensionExceptions;return null!=(e=null!=i?i:t)&&e}buildProperties(e,t){return this.va.buildFromUnknown(e,{syntheticException:null==t?void 0:t.syntheticException,mechanism:{handled:null==t?void 0:t.handled}})}addExceptionStep(e,t){if(this.fa.enabled)try{if(!es(e)||0===e.trim().length)return void a5.warn("Ignoring exception step because message must be a non-empty string");var i=function(e){if(!e)return{sanitizedProperties:{},droppedKeys:[]};var t=[];return{sanitizedProperties:Object.keys(e).reduce((i,s)=>(t0.has(s)?t.push(s):i[s]=e[s],i),{}),droppedKeys:t}}(this.ya(t)),s=i.sanitizedProperties,r=i.droppedKeys;r.length>0&&a5.warn("Ignoring reserved exception step fields",{droppedKeys:r}),this.ga.add(x({[tQ]:e,[tZ]:(new Date).toISOString()}
1,s))}catch(e){a5.error("Failed to add exception step. Ignoring breadcrumb.",e)}}sendExceptionEvent(e){var t;try{var i=e.$exception_list;if(this.ba(i)){if(this._a(i))return this.wa("Exception dropped: matched a suppression rule"),void a5.info("Skipping exception capture because a suppression rule matched");if(!this.ma&&this.xa(i))return this.wa("Exception dropped: thrown by a browser extension"),void a5.info("Skipping exception capture because it was thrown by an extension");if(!this._instance.config.error_tracking.__capturePostHogExceptions&&this.ka(i))return this.wa("Exception dropped: thrown by the PostHog SDK"),void a5.info("Skipping exception capture because it was thrown by the PostHog SDK")}var s=this.fa.enabled&&ea(e.$exception_steps)?this.Sa(e):e,r="string"==typeof(t=globalThis._posthogReleaseId)&&t.length>0?t:void 0;r&&(s.$release_id=r);try{var n=this._instance.capture("$exception",s,{_noTruncate:!0,_batchKey:"exceptionEvent",Fn:!0});return n&&this.ga.clear(),n}catch(e){return a5.error("Failed to capture exception event. Dropping this exception.",e),void this.ga.clear()}}catch(e){return void a5.error("Failed to process exception event. Ignoring this exception.",e)}}Sa(e){try{var t=this.ga.getAttachable();return 0===t.length?e:x({},e,{$exception_steps:t})}catch(t){return a5.error("Failed to read buffered exception steps. Capturing exception without steps.",t),e}}wa(e){this.fa.enabled&&this.ga.add({[tQ]:e,[tZ]:(new Date).toISOString()})}ya(e){return ee(e)?x({},e):{}}pa(){var e,t;return null!=(e=null==(t=this._instance.config.error_tracking)?void 0:t.exception_steps)?e:{}}_a(e){if(0===e.length)return!1;try{var t=e.reduce((e,t)=>{var i=t.type,s=t.value;return es(i)&&i.length>0&&e.$exception_types.push(i),es(s)&&s.length>0&&e.$exception_values.push(s),e},{$exception_types:[],$exception_values:[]});return this.ca.some(e=>{var i=e.values.map(e=>{var i=nQ[e.operator],s=t[e.key];if(!i||!s)return!1;var r=Q(e.value)?e.value:[e.value];return r.length>0&&i(r,s)});return"OR"===e.type?i.some(Boolean):i.every(Boolean)})}catch(e){return a5.warn("Failed to evaluate suppression rules. Capturing the exception.",e),!1}}xa(e){return e.flatMap(e=>{var t,i;return null!=(t=null==(i=e.stacktrace)?void 0:i.frames)?t:[]}).some(e=>e.filename&&e.filename.startsWith("chrome-extension://"))}ka(e){if(e.length>0){var t,i,s,r,n=null!=(t=null==(i=e[0].stacktrace)?void 0:i.frames)?t:[],a=n[n.length-1];return null!=(s=null==a||null==(r=a.filename)?void 0:r.includes("posthog.com/static"))&&s}return!1}ba(e){return!ea(e)&&Q(e)}}},oi,{siteApps:class{constructor(e){this.Ta=0,this._instance=e,this.Ea=[],this.apps={}}get isEnabled(){return!!this._instance.config.opt_in_site_apps}Ra(e,t){if(t){var i=this.globalsForEvent(t);this.Ea.push(i),this.Ea.length>1e3&&(this.Ea=this.Ea.slice(10))}}get siteAppLoaders(){var e;return null==(e=m._POSTHOG_REMOTE_CONFIG)||null==(e=e[this._instance.config.token])?void 0:e.siteApps}initialize(){if(this.isEnabled){var e=this._instance._addCaptureHook(this.Ra.bind(this));this.Pa=()=>{e(),this.Ea=[],this.Pa=void 0}}}globalsForEvent(e){if(!e)throw Error("Event payload is required");var t,i,s,r,n,a,o,l={},u=this._instance.get_property("$groups")||[];for(var h of Object.entries(this._instance.get_property("$stored_group_properties")||{})){var c=h[0];l[c]={id:u[c],type:c,properties:h[1]}}var d=e.$set_once,p=e.$set;return{event:x({},E(e,aH),{properties:x({},e.properties,p?{$set:x({},null!=(t=null==(i=e.properties)?void 0:i.$set)?t:{},p)}:{},d?{$set_once:x({},null!=(s=null==(r=e.properties)?void 0:r.$set_once)?s:{},d)}:{}),elements_chain:null!=(n=null==(a=e.properties)?void 0:a.$elements_chain)?n:"",distinct_id:null==(o=e.properties)?void 0:o.distinct_id}),person:{properties:this._instance.get_property("$stored_person_properties")},groups:l}}Oa(e){var t,i=null==(t=e.tagName)?void 0:t.toLowerCase();return"style"===i&&this._instance.config.prepare_external_dependency_stylesheet?this._instance.config.prepare_external_dependency_stylesheet(e)||(az.error("prepare_external_dependency_stylesheet returned null"),null):"script"===i&&this._instance.config.prepare_external_dependency_script?this._instance.config.prepare_external_dependency_script(e)||(az.error("prepare_external_dependency_script returned null"),null):e}Fa(){if(!this._instance.config.prepare_external_dependency_stylesheet&&!this._instance.config.prepare_external_dependency_script)return()=>{};var e,t,i,s,r,n,a,o,l=null==u?void 0:u.defaultView,h=null==l||null==(e=l.Node)?void 0:e.prototype;if(!l||!h)return()=>{};if(this.Ta++,this.Aa)return this.$a();var c=[],d=this,p=new WeakSet,v=(e,t,i)=>{if(null!=e&&e[t]){var s=e[t];e[t]=i(s),c.push(()=>{e[t]=s})}},g=e=>{if(p.has(e))return e;var t=d.Oa(e);return t&&p.add(t),t},f=e=>e.map(e=>"string"==typeof e?e:g(e)).filter(e=>!en(e));return v(h,"appendChild",e=>function(t){var i=g(t);return i?e.call(this,i):t}),v(h,"insertBefore",e=>function(t,i){var s=g(t);return s?e.call(this,s,i):t}),v(h,"replaceChild",e=>function(t,i){var s=g(t);return s?e.call(this,s,i):i}),[null==(t=l.Element)?void 0:t.prototype,null==(i=l.Document)?void 0:i.prototype,null==(s=l.DocumentFragment)?void 0:s.prototype].forEach(e
1=>{v(e,"append",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,f(i))}),v(e,"prepend",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,f(i))})}),[null==(r=l.Element)?void 0:r.prototype,null==(n=l.CharacterData)?void 0:n.prototype,null==(a=l.DocumentType)?void 0:a.prototype].forEach(e=>{v(e,"before",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,f(i))}),v(e,"after",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];return e.apply(this,f(i))}),v(e,"replaceWith",e=>function(){for(var t=arguments.length,i=Array(t),s=0;t>s;s++)i[s]=arguments[s];var r=f(i);return i.length&&!r.length?void 0:e.apply(this,r)})}),v(null==(o=l.Element)?void 0:o.prototype,"insertAdjacentElement",e=>function(t,i){var s=g(i);return s?e.call(this,t,s):null}),this.Aa=()=>{c.forEach(e=>e()),this.Aa=void 0},this.$a()}$a(){var e=!1;return()=>{var t;e||(e=!0,this.Ta--,0===this.Ta&&(null==(t=this.Aa)||t.call(this)))}}La(e,t){void 0===t&&(t=!0);var i=this.Fa();try{var s=e(i);return t&&i(),s}catch(e){throw i(),e}}setupSiteApp(e){var t=this.apps[e.id],i=()=>{var i;!t.errored&&this.Ea.length&&(az.info("Processing "+this.Ea.length+" events for site app with id "+e.id),this.Ea.forEach(e=>this.La(()=>null==t.processEvent?void 0:t.processEvent(e))),t.processedBuffer=!0),Object.values(this.apps).every(e=>e.processedBuffer||e.errored)&&(null==(i=this.Pa)||i.call(this))},s=!1,r=r=>{t.errored=!r,t.loaded=!0,az.info("Site app with id "+e.id+" "+(r?"loaded":"errored")),s&&i()};try{var n=this.La(t=>e.init({posthog:this._instance,callback(e){t(),r(e)}}),!1).processEvent;n&&(t.processEvent=n),s=!0}catch(t){az.error(aB+e.id,t),r(!1)}if(s&&t.loaded)try{i()}catch(i){az.error("Error while processing buffered events PostHog app with config id "+e.id,i),t.errored=!0}}Da(){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)}Na(e){var t=this;if(0!==Object.keys(this.apps).length){var i=this.globalsForEvent(e),s=function(s){try{t.La(()=>null==s.processEvent?void 0:s.processEvent(i))}catch(t){az.error("Error while processing event "+e.event+" for site app "+s.id,t)}};for(var r of Object.values(this.apps))s(r)}}onRemoteConfig(e){var t,i,s,r=this;if(null!=(t=this.siteAppLoaders)&&t.length)return this.isEnabled?(this.Da(),void this._instance.on("eventCaptured",e=>this.Na(e))):void az.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.');if(null==(i=this.Pa)||i.call(this),e.ok){var n=e.config;if(null!=(s=n.siteApps)&&s.length)if(this.isEnabled)for(var a of n.siteApps)!function(){var e,t=a.id,i=a.url;m["__$$ph_site_app_"+t]=r._instance,null==(e=m.__PosthogExtensions__)||null==e.loadSiteApp||e.loadSiteApp(r._instance,i,e=>{if(e)return az.error(aB+t,e)})}();else az.error('PostHog site apps are disabled. Enable the "opt_in_site_apps" config to proceed.')}}}},os,{tracingHeaders:class{constructor(e){this.qa=void 0,this.ja=void 0,this.Ha=void 0,this.ia=()=>{var e,t,i=this.Ba();i?(ei(this.qa)&&(this.qa=null==(e=m.__PosthogExtensions__)||null==(e=e.tracingHeadersPatchFns)?void 0:e._patchXHR(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager)),ei(this.ja)&&(this.ja=null==(t=m.__PosthogExtensions__)||null==(t=t.tracingHeadersPatchFns)?void 0:t._patchFetch(i,()=>this._instance.get_distinct_id(),this._instance.sessionManager))):this.la()},this._instance=e}initialize(){this.startIfEnabledOrStop()}rr(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 aI.error("failed to load script",t);e()})}Ua(){var e,t;return null!=(e=null!=(t=this._instance.config.tracing_headers)?t:this._instance.config.addTracingHeaders)?e:this._instance.config.__add_tracing_headers}Ba(){var e=this.Ua();return Q(e)?(Q(this.Ha)?this.Ha.splice(0,this.Ha.length,...e):this.Ha=[...e],e.length>0?this.Ha:void 0):(Q(this.Ha)&&this.Ha.splice(0),this.Ha=e||void 0,this.Ha)}la(){var e,t;null==(e=this.qa)||e.call(this),null==(t=this.ja)||t.call(this),this.qa=void 0,this.ja=void 0}startIfEnabledOrStop(){this.Ba()?this.rr(this.ia):this.la()}}},{toolbar:class{constructor(e){this.instance=e}nl(e){m.ph_toolbar_state=e}sl(){var e;return null!=(e=m.ph_toolbar_state)?e:0}initialize(){return this.maybeLoadToolbar()}maybeLoadToolbar(e,t,i){if(void 0===e&&(e=void 0),void 0===t&&(t=void 0),void 0===i&&(i=void 0),sd(this.instance.config)||!a||!u)return!1;e=null!=e?e:a.location,i=null!=i?i:a.history;try{if(!t){try{a.localStorage.setItem("test","test"),a.localStorage.removeItem("test")}catch(e){return!1}t=null==a?void 0:a.localStorage}var s,r=aK||rk(e.hash,"__posthog")||rk(e.hash,"state"),n=r?so(()=>JSON.parse(atob(decodeURIComponent(r))))||so(()=>JSON.parse(decodeURIComponent(r))):null;return n&&"ph_authorize"===n.action?((s=n).source="url",s&&Object.keys(s).length>0&&(n.desiredHash?e.hash=n.desiredHash:i?i.replaceState(i.state,"",e.pathname+e.search):e.hash="")):((s=JSON.parse(t.getItem(aX)||"{}")).source="localstorage",delete s.userIntent),!(!s.token||this.instance.config.token!==s.token||(this.loadToolbar(s),0))}catch(e){return!1}}ol(e){var t=m.ph_load_toolbar||m.ph_load_editor;!ea(t)&&Z(t)?t(e,this.instance):aQ.warn("No toolbar load function found")}loadToolbar(e){var t,i=!(null==u||!u.getElementById(sL));if(!a||i)return!1;var s="custom"===this.instance.requestRouter.region&&this.instance.config.advanced_disable_toolbar_metrics,r=x({token:this.instance.config.token},e,{apiURL:this.instance.requestRouter.endpointFor("ui")},s?{instrument:!1}:{});return(a.localStorage.setItem(aX,JSON.stringify(x({},r,{source:void 0}))),2===this.sl())?this.ol(r):0===this.sl()&&(this.nl(1),null==(t=m.__PosthogExtensions__)||null==t.loadExternalDependency||t.loadExternalDependency(this.instance,"toolbar",e=>{e?(aQ.error("[Toolbar] Failed to load",e),this.nl(0)):(this.nl(2),this.ol(r))}),sc(a,"turbolinks:load",()=>{this.nl(0),this.loadToolbar(r)})),!0}al(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)}}},or,{conversations:class{constructor(e){this.ll=void 0,this._conversationsManager=null,this.ul=!1,this.hl=null,this._instance=e}initialize(){this.loadIfEnabled()}onRemoteConfig(e){if(!this._instance.config.disable_conversations&&e.ok){var t=e.config.conversations;ea(t)||(eu(t)?this.ll=t:(this.ll=t.enabled,this.hl=t),this.loadIfEnabled())}}reset(){var e;null==(e=this._conversationsManager)||e.reset(),this._conversationsManager=null,this.ll=void 0,this.hl=null}loadIfEnabled(){if(!(this._conversationsManager||this.ul||this._instance.config.disable_conversations||sd(this._instance.config)||this._instance.config.cookieless_mode&&this._instance.consent.isOptedOut())){var e=null==m?void 0:m.__PosthogExtensions__;if(e&&!ei(this.ll)&&this.ll)if(this.hl&&this.hl.token){this.ul=!0;try{var t=e.initConversations;if(t)return this.dl(t),void(this.ul=!1);var i=e.loadExternalDependency;if(!i)return void this.cl(i1);i(this._instance,"conversations",t=>{t||!e.initConversations?this.cl("Could not load conversations script",t):this.dl(e.initConversations),this.ul=!1})}catch(e){this.cl("Error initializing conversations",e),this.ul=!1}}else a9.error("Conversations enabled but missing token in remote config.")}}dl(e){if(this.hl)try{this._conversationsManager=e(this.hl,this._instance),a9.info("Conversations loaded successfully")}catch(e){this.cl("Error completing conversations initialization",e)}else a9.error("Cannot complete initialization: remote config is null")}cl(e,t){a9.error(e,t),this._conversationsManager=null,this.ul=!1}show(){this._conversationsManager?this._conversationsManager.show():a9.warn("Conversations not loaded yet.")}hide(){this._conversationsManager&&this._conversationsManager.hide()}isAvailable(){return!0===this.ll&&!en(this._conversationsManager)}isVisible(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.isVisible())&&e}sendMessage(e,t,i){var s=this;return w(function*(){return s._conversationsManager?s._conversationsManager.sendMessage(e,t,i):(a9.warn(a7),null)})()}getMessages(e,t){var i=this;return w(function*(){return i._conversationsManager?i._conversationsManager.getMessages(e,t):(a9.warn(a7),null)})()}markAsRead(e){var t=this;return w(function*(){return t._conversationsManager?t._conversationsManager.markAsRead(e):(a9.warn(a7),null)})()}getTickets(e){var t=this;return w(function*(){return t._conversationsManager?t._conversationsManager.getTickets(e):(a9.warn(a7),null)})()}requestRestoreLink(e){var t=this;return w(function*(){return t._conversationsManager?t._conversationsManager.requestRestoreLink(e):(a9.warn(a7),null)})()}restoreFromToken(e){var t=this;return w(function*(){return t._conversationsManager?t._conversationsManager.restoreFromToken(e):(a9.warn(a7),null)})()}restoreFromUrlToken(){var e=this;return w(function*(){return e._conversationsManager?e._conversationsManager.restoreFromUrlToken():(a9.warn(a7),null)})()}getCurrentTicketId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getCurrentTicketId())?e:null}getWidgetSessionId(){var e,t;return null!=(e=null==(t=this._conversationsManager)?void 0:t.getWidgetSessionId())?e:null}jn(){var e;null==(e=this._conversationsManager)||e.setIdentity()}Hn(){var e;null==(e=this._conversationsManager)||e.clearIdentity()}}},{logs:class{constructor(e){var t;this.vl=!1,this.fl=!1,this.it=t6("[logs]"),this.Jr=[],this.pl=[],this.Ys=0,this.gl=()=>{var e,t;this.Ys=0,null==(e=this.ml)||e.onReconnect(),null==(t=this.yl)||t.onReconnect()},this._instance=e,this._instance&&null!=(t=this._instance.config.logs)&&t.captureConsoleLogs&&(this.vl=!0),a&&sc(a,"online",this.gl)}bl(e,t,i,s){var r,n,a,o,l,u,h,c,d,p,v,g,f,_,m=(r=null==(_=this._instance)||null==(_=_.config)?void 0:_.logs,d=null!=(n=null==r?void 0:r.flushIntervalMs)?n:3e3,p=null!=(a=null==r?void 0:r.maxBufferSize)?a:100,g=ei(v=null!=i&&i.consoleCapture?void 0:null!=(o=null==r?void 0:r.maxLogsPerInterval)?o:1e3)?Math.max(p,2048):Math.max(p,v),{serviceName:null!=(l=null!=(u=null==(f=null==r?void 0:r.resourceAttributes)?void 0:f["service.name"])?u:null==r?void 0:r.serviceName)?l:null==i?void 0:i.serviceNameDefault,serviceVersion:null!=(h=null==f?void 0:f["service.version"])?h:null==r?void 0:r.serviceVersion,environment:null!=(c=null==f?void 0:f["deployment.environment"])?c:null==r?void 0:r.environment,resourceAttributes:f,beforeSend:null==r?void 0:r.beforeSend,flushIntervalMs:d,maxBufferSize:p,maxQueueSize:g,maxBatchRecordsPerPost:100,rateCapWindowMs:d,maxLogsPerInterval:v,backgroundFlushBudgetMs:0,terminationFlushBudgetMs:0});return[new tS(this._l(e,t),m,this.it,()=>this.wl(),e=>e(),void 0,s),m]}xl(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this.ml||this.kl!==t){null==(i=this.ml)||i.reset(),this.kl=t;var i,s=this.bl(()=>this.Jr,e=>{this.Jr=e});this.ml=s[0],this.Sl=s[1]}return this.ml}Cl(){var e,t=null==(e=this._instance)||null==(e=e.config)?void 0:e.logs;if(!this.yl||this.Ml!==t){null==(i=this.yl)||i.reset(),this.Ml=t;var i,s=this.bl(()=>this.pl,e=>{this.pl=e},{serviceNameDefault:"posthog-browser-logs",consoleCapture:!0},oe);this.yl=s[0],this.Il=s[1]}return this.yl}initialize(){this.loadIfEnabled()}onRemoteConfig(e){var t;if(e.ok){var i=null==(t=e.config.logs)?void 0:t.captureConsoleLogs;!ea(i)&&i&&(this.vl=!0,this.loadIfEnabled())}}reset(){var e,t;this.Jr=[],null==(e=this.ml)||e.reset(),this.pl=[],null==(t=this.yl)||t.reset(),this.Ys=0}captureLog(e){this.xl().captureLog(e)}le(e){this.Cl().captureLog(e)}get logger(){return this.Tl||(this.Tl={trace:(e,t)=>this.captureLog({body:e,level:"trace",attributes:t}),debug:(e,t)=>this.captureLog({body:e,level:"debug",attributes:t}),info:(e,t)=>this.captureLog({body:e,level:"info",attributes:t}),warn:(e,t)=>this.captureLog({body:e,level:"warn",attributes:t}),error:(e,t)=>
1this.captureLog({body:e,level:"error",attributes:t}),fatal:(e,t)=>this.captureLog({body:e,level:"fatal",attributes:t})}),this.Tl}flushLogs(e){e?this.El(e):(this.ml&&this.ml.flush().catch(e=>this.it.error("PostHog logs flush failed:",e)),this.yl&&this.yl.flush().catch(e=>this.it.error("PostHog logs flush failed:",e)))}loadIfEnabled(){if(this.vl&&!this.fl){var e=null==m?void 0:m.__PosthogExtensions__;if(e){var t=e.loadExternalDependency;t?t(this._instance,"logs",t=>{var i;t||null==(i=e.logs)||!i.initializeLogs?this.it.error("Could not load logs script",t):(e.logs.initializeLogs(this._instance),this.fl=!0)}):this.it.error(i1)}else this.it.error("PostHog Extensions not found.")}}_l(e,t){var i=this._instance;return{get isDisabled(){return!1},get optedOut(){return!i.is_capturing()},getPersistedProperty:t=>t===M.LogsQueue?e():void 0,setPersistedProperty(e,i){e===M.LogsQueue&&t(null!=i?i:[])},$t:e=>this.$t(e),getLibraryId:()=>y.LIB_NAME,getLibraryVersion:()=>y.LIB_VERSION}}$t(e){return new Promise(t=>{if(rS(this.Ys,3))t({kind:"fatal",error:Error("logs endpoint is unreachable, dropping batch")});else{var i=!1,s=e=>{i||(i=!0,clearTimeout(r),t(e))},r=setTimeout(()=>s({kind:"retry-later",error:Error("logs request timed out")}),9e4);this._instance._send_request({method:"POST",url:this.Rl(),data:e,compression:"best-available",batchKey:"logs",fireCallbackOnDrop:!0,callback:e=>{var t,i=e.statusCode;(this.Pl(i),i>=200&&300>i)?s({kind:"ok"}):413===i?s({kind:"too-large"}):0!==i&&429!==i&&500>i?s({kind:"fatal",error:Error("logs request failed with status "+i)}):s({kind:"retry-later",error:null!=(t=e.error)?t:Error("logs request failed with status "+i)})}})}})}Pl(e){(0!==e||this._instance.__loaded)&&(this.Ys=rP(e,this.Ys,3,()=>this.it.warn("Log requests are failing before receiving an HTTP response; this can happen due to network issues, CORS, browser blocking, or ad blockers. Stopped sending logs; will try again when connectivity changes.")))}El(e){this.Jr.length>0&&this.Ol(e,this.Jr,this.Sl,y.LIB_NAME,e=>{this.Jr=e}),this.pl.length>0&&this.Ol(e,this.pl,this.Il,oe,e=>{this.pl=e})}Ol(e,t,i,s,r){if(0!==t.length){var n=t.map(e=>e.record);r([]);var a=tk(n,tE(i,y.LIB_NAME,y.LIB_VERSION),s,y.LIB_VERSION);this._instance._send_request({method:"POST",url:this.Rl(),data:a,compression:"best-available",batchKey:"logs",transport:e})}}Rl(){return this._instance.requestRouter.endpointFor("api","/i/v1/logs")+"?token="+encodeURIComponent(this._instance.config.token)}wl(){var e,t={};if(t.distinctId=this._instance.get_distinct_id(),this._instance.sessionManager){var i=this._instance.sessionManager.checkAndGetSessionAndWindowId(!0),s=i.windowId,r=i.sessionStartTimestamp,n=i.lastActivityTimestamp;t.sessionId=i.sessionId,t.windowId=s,ea(r)||(t.sessionStartTimestamp=r),ea(n)||(t.lastActivityTimestamp=n)}if(null!=m&&null!=(e=m.location)&&e.href&&(t.currentUrl=this._instance.config.disable_capture_url_hashes?tg(m.location.href):m.location.href),this._instance.featureFlags){var a=this._instance.featureFlags.getFlags();a&&a.length>0&&(t.activeFeatureFlags=a)}return t}}},{metrics:class{constructor(e){this.it=t6("[metrics]"),this._instance=e}initialize(){}xl(){var e,t,i,s,r,n,a,o,l=null==(a=this._instance)||null==(a=a.config)?void 0:a.metrics;return this.ml&&this.kl===l||(null==(o=this.ml)||o.reset(),this.kl=l,this.ml=new tI(this._l(),{serviceName:null!=(e=null==(n=null==l?void 0:l.resourceAttributes)?void 0:n["service.name"])?e:null==l?void 0:l.serviceName,serviceVersion:null!=(t=null==n?void 0:n["service.version"])?t:null==l?void 0:l.serviceVersion,environment:null!=(i=null==n?void 0:n["deployment.environment"])?i:null==l?void 0:l.environment,resourceAttributes:n,beforeSend:null==l?void 0:l.beforeSend,flushIntervalMs:null!=(s=null==l?void 0:l.flushIntervalMs)?s:1e4,maxSeriesPerFlush:null!=(r=null==l?void 0:l.maxSeriesPerFlush)?r:1e3},this.it)),this.ml}count(e,t,i){void 0===t&&(t=1),this.xl().count(e,t,i)}gauge(e,t,i){this.xl().gauge(e,t,i)}histogram(e,t,i){this.xl().histogram(e,t,i)}flush(e){if(!this.ml)return Promise.resolve();if(e){var t=this.ml.drainWindow();return t&&this.Kt(t,e),Promise.resolve()}return this.ml.flush().catch(e=>this.it.error("PostHog metrics flush failed:",e))}reset(){var e;null==(e=this.ml)||e.reset()}_l(){var e=this._instance,t=this;return{get isDisabled(){return!1},get optedOut(){return!e.is_capturing()},Kt:e=>t.Kt(e),getLibraryId:()=>y.LIB_NAME,getLibraryVersion:()=>y.LIB_VERSION}}Kt(e,t){return new Promise(i=>{var s=!1,r=e=>{s||(s=!0,clearTimeout(n),i(e))},n=setTimeout(()=>r({kind:"retry-later",error:Error("metrics request timed out")}),9e4);this._instance._send_request(x({method:"POST",url:this.Fl(),data:e,compression:"best-available",batchKey:"metrics"},t&&{transport:t},{fireCallbackOnDrop:!0,callback(e){var t,i=e.statusCode;i>=200&&300>i?r({kind:"ok"}):413===i?r({kind:"too-large"}):0!==i&&429!==i&&500>i?r({kind:"fatal",error:Error("metrics request failed with status "+i)}):r({kind:"retry-later",error:null!=(t=e.error)?t:Error("metrics request failed with status "+i)})}}))})}Fl(){return this._instance.requestRouter.endpointFor("api","/i/v1/metrics")+"?token="+encodeURIComponent(this._instance.config.token)}}});ax.__defaultExtensionClasses=x({},on);var oa=(y.SDK_DIST_CHANNEL="npm",n=al[af]=new ax,function(){function e(){e.done||(e.done=!0,a_=!1,sr(al,function(e){e._dom_loaded()}))}null!=u&&u.addEventListener?"complete"===u.readyState?e():sc(u,"DOMContentLoaded",e,{capture:!1}):a&&t8.error("Browser doesn't support `document.addEventListener` so PostHog couldn't be initialized")}(),n)}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.