@heycatch/sdk 0.8.5-dev.2562 → 0.8.5-dev.2662

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var be=Object.defineProperty;var Hr=Object.getOwnPropertyDescriptor;var Ur=Object.getOwnPropertyNames;var Br=Object.prototype.hasOwnProperty;var tt=(e,t)=>{for(var r in t)be(e,r,{get:t[r],enumerable:!0})},Kr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ur(t))!Br.call(e,o)&&o!==r&&be(e,o,{get:()=>t[o],enumerable:!(n=Hr(t,o))||n.enumerable});return e};var Vr=e=>Kr(be({},"__esModule",{value:!0}),e);var Uo={};tt(Uo,{HeyCatchProvider:()=>Fr,SDK_VERSION:()=>X,STAGE:()=>J,analytics:()=>Ho});module.exports=Vr(Uo);var Zr=require("posthog-react-native");var Gr="[a-z0-9]",Ko=new RegExp(`^${Gr}$`);var Wr=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function ve(e){let t=Wr.exec(e);if(t===null)return!1;let[,r="",n=""]=t,o=Number(r),i=Number(n);return o>255||i>255?!1:o===0||o===10||o===127||o===100&&i>=64&&i<=127||o===169&&i===254||o===172&&i>=16&&i<=31||o===192&&i===168}var Jr=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/;function Xr(e){if(e==="::1"||e==="::")return!0;if(e.startsWith("::ffff:")){let t=Jr.exec(e);if(t===null)return ve(e.slice(7));let[,r="",n=""]=t,o=Number.parseInt(r,16),i=Number.parseInt(n,16);return ve(`${Math.floor(o/256)}.${o%256}.${Math.floor(i/256)}.${i%256}`)}return/^f[cd][0-9a-f]{2}:/.test(e)||/^fe[89ab][0-9a-f]:/.test(e)}function Yr(e){return e.toLowerCase().replace(/^\[/,"").replace(/\]$/,"").replace(/\.+$/,"")}function rt(e){let t=Yr(e);return t==="localhost"||t.endsWith(".localhost")||ve(t)||Xr(t)}var nt="0.0.0.0",ot="$ip",it="$geoip_disable";function st(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function rn(e){return st(e)?{...e,properties:{...st(e.properties)?e.properties:{},[ot]:nt,[it]:!0}}:e}function ct(e){let t=e;return{link:r=>t?r:rn(r),set:r=>{t=r}}}function ut(e,t){if(typeof t!="boolean"){console.warn("[HeyCatch] setIpCollection() takes true or false - the call was ignored.");return}if(e===null){console.warn(`[HeyCatch] setIpCollection(${String(t)}) was called before init(), so it was NOT applied. Pass collectIp to init() instead, or call setIpCollection() after it.`);return}e.set(t)}var O={};tt(O,{BIGINT_FORMAT_RANGES:()=>zn,CONSTANT_CATCH:()=>St,Class:()=>we,NUMBER_FORMAT_RANGES:()=>$n,aborted:()=>R,allowsEval:()=>ht,assert:()=>an,assertEqual:()=>nn,assertIs:()=>cn,assertNever:()=>un,assertNotEqual:()=>on,assignProp:()=>ee,attachSchema:()=>ne,base64ToUint8Array:()=>Pt,base64urlToUint8Array:()=>Cn,cached:()=>ae,captureStackTrace:()=>le,cleanEnum:()=>En,cleanRegex:()=>Pe,clone:()=>P,cloneDef:()=>hn,codePointLength:()=>Pn,constantCatch:()=>Et,createTransparentProxy:()=>vn,defineLazy:()=>lt,defineLazyInternal:()=>S,derived:()=>On,esc:()=>dt,escapeRegex:()=>re,explicitlyAborted:()=>Ce,extend:()=>bt,finalizeIssue:()=>D,floatSafeRemainder:()=>fn,getElementAtPath:()=>gn,getEnumValues:()=>ue,getLengthableOrigin:()=>Zn,getParsedType:()=>bn,getSizableOrigin:()=>wn,hexToUint8Array:()=>In,hide:()=>Ie,installLazyProp:()=>Re,isObject:()=>Q,isPlainObject:()=>te,issue:()=>he,joinValues:()=>ln,jsonStringifyReplacer:()=>ke,members:()=>Ae,merge:()=>zt,mergeDefs:()=>A,normalizeParams:()=>Z,nullish:()=>pn,numKeys:()=>yn,objectClone:()=>dn,omit:()=>yt,optionalKeys:()=>Ee,own:()=>C,parsedType:()=>Sn,partial:()=>wt,pick:()=>xt,prefixIssues:()=>de,primitiveTypes:()=>gt,promiseAllObject:()=>_n,propertyKeyTypes:()=>Se,randomString:()=>xn,rawShape:()=>Ze,required:()=>kt,safeExtend:()=>$t,shallowClone:()=>pe,sizeCaps:()=>me,slugify:()=>mt,stringifyPrimitive:()=>_t,toZod:()=>sn,uint8ArrayToBase64:()=>Zt,uint8ArrayToBase64url:()=>An,uint8ArrayToHex:()=>Rn,unwrapMessage:()=>V});function nn(e){return e}function on(e){return e}function sn(){return e=>e}function cn(e){}function un(e){throw new Error("Unexpected value in exhaustive check")}function an(e){}function ue(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function ln(e,t="|"){return e.map(r=>_t(r)).join(t)}function ke(e,t){return typeof t=="bigint"?t.toString():t}var ze=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function ae(e){return new ze(e)}function pn(e){return e==null}function Pe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function fn(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var at=Symbol("evaluating");function lt(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==at)return n===void 0&&(n=at,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function dn(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ee(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ze(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function I(e){return Ze(e._zod.def)??e._zod.def.shape}function pt(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ee(this,t,n),n},enumerable:!0,configurable:!0})}function ft(e,t,r){t in e?ee(e,t,r):e[t]=r}function j(e,t,r,n){let o=I(t);for(let i of r){let c=Object.getOwnPropertyDescriptor(o,i);c.enumerable&&(c.get?pt(e,i,()=>{let s=t._zod.def.shape[i];return n?n(s,i):s}):ft(e,i,n?n(c.value,i):c.value))}}function mn(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?pt(e,r,()=>t[r]):ft(e,r,n.value))}}function A(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function hn(e){return A(e._zod.def)}function gn(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function _n(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function xn(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function dt(e){return JSON.stringify(e)}function mt(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var le="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var ht=ae(()=>{if(F.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function te(e){if(Q(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Q(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function pe(e){return te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function yn(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var bn=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Se=new Set(["string","number","symbol"]),gt=new Set(["string","number","bigint","boolean","symbol","undefined"]);function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function vn(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function _t(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ee(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var $n={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},zn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function xt(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return j(i,e,fe(e,t)),P(e,A(r,{shape:i,checks:[]}))}function fe(e,t){let r=I(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function yt(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(fe(e,t)),c={};return j(c,e,Reflect.ownKeys(I(e)).filter(s=>!i.has(s))),P(e,A(r,{shape:c,checks:[]}))}function bt(e,t){if(!te(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=I(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return P(e,A(e._zod.def,{shape:vt(e,t)}))}function vt(e,t){let r={};return j(r,e,Reflect.ownKeys(I(e))),mn(r,t),r}function $t(e,t){if(!te(t))throw new Error("Invalid input to safeExtend: expected a plain object");return P(e,A(e._zod.def,{shape:vt(e,t)}))}function zt(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};j(r,e,Reflect.ownKeys(I(e))),j(r,t,Reflect.ownKeys(I(t)));let n=A(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return P(e,n)}function wt(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let s=r?new Set(fe(t,r)):void 0,u={};return j(u,t,Reflect.ownKeys(I(t)),e&&((a,l)=>s&&!s.has(l)?a:new e({type:"optional",innerType:a}))),P(t,A(t._zod.def,{shape:u,checks:[]}))}function kt(e,t,r){let n=r?new Set(fe(t,r)):void 0,o={};return j(o,t,Reflect.ownKeys(I(t)),(i,c)=>n&&!n.has(c)?i:new e({type:"nonoptional",innerType:i})),P(t,A(t._zod.def,{shape:o}))}function R(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ce(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function de(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function V(e){return typeof e=="string"?e:e?.message}function me(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function ne(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function D(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,c=e.message?e.message:V(e.inst?._zod.def?.error?.(e))??V(i?.(e))??V(t?.error?.(e))??V(r.customError?.(e))??V(r.localeError?.(e))??"Invalid input",s={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(s[u]=e[u]);return s.path??(s.path=[]),s.message=c,t?.reportInput&&(s.input=e.input),s}function wn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var kn=/[\uD800-\uDBFF]/;function Pn(e){let t=e.length;if(!kn.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function Zn(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Sn(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function he(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function En(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Pt(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function Zt(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function Cn(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Pt(t+r)}function An(e){return Zt(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function In(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Rn(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var we=class{constructor(...t){}};function Ae(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Tn(e,r,n.value)}}function C(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Ie(e,t,r){return C(e,t,r,!1)}function On(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return C(this,r,n(this))},set(o){C(this,r,o)}})}return t}function Tn(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:C(this,t,r.bind(this))},set(n){C(this,t,n)}})}function Mn(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var $e,N=!1,Nn={configurable:!0,get(){N=!0}};function S(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&$e!==e._zod){$e=void 0;return}$e=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Nn);let o=N;N=!1;try{let i=r(this);return N?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),N=N||o,i}catch(i){throw delete this[t],N=N||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Re(e,t,r,n){let o=Mn(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var St="~constantCatch";function Et(e){let t=()=>e;return t[St]=!0,t}var Ct;var Oe={value:void 0,enumerable:!1},At="captureStackTrace"in Error?Error:null;function Dn(e){let t=At;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return At=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function d(e,t,r,n){let o={};function i(p){this.def=p,this.constr=f,this.traits=new Set}i.prototype=o;let c=r,s=c&&new WeakSet;function u(p,g){if(p._zod){if(p._zod.traits.has(e))return}else{Oe.value=new i(g);try{Object.defineProperty(p,"_zod",Oe)}finally{Oe.value=void 0}}if(p._zod.traits.add(e),t(p,g),s){let x=Object.getPrototypeOf(p),z=p._zod.constr.prototype,_=x;for(;_&&_!==z;)_=Object.getPrototypeOf(_);let y=_??x;s.has(y)||(s.add(y),Ae(y,c))}let h=f.prototype;for(let x in h)Object.prototype.hasOwnProperty.call(h,x)&&(x in p||(p[x]=h[x].bind(p)))}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(p){let g=n?.Parent?Dn(l):this;u(g,p);let h=g._zod.deferred;if(h){for(let z of h)z();g._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(g),g}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var T=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(Ct=globalThis).__zod_globalConfig??(Ct.__zod_globalConfig={});var F=globalThis.__zod_globalConfig;function H(e){return e&&Object.assign(F,e),F}function Ln(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ke,2)),e.message}function jn(e){this._zod.message=e}var Fn={get:Ln,set:jn,enumerable:!0,configurable:!0},Me={value:void 0,enumerable:!1},It=new WeakSet([Object.prototype,Error.prototype]),Rt=(e,t)=>{e.name="$ZodError",Me.value=t,Object.defineProperty(e,"issues",Me),Me.value=void 0,Object.defineProperty(e,"message",Fn);let r=Object.getPrototypeOf(e);It.has(r)||(It.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},ni=d("$ZodError",Rt),oe=d("$ZodError",Rt,void 0,{Parent:Error});var Un=e=>{let t=(r,n,o,i)=>{let c=o?{...o,async:!1}:{async:!1},s=r._zod.run({value:n,issues:[]},c);if(s instanceof Promise)throw new T;if(s.issues.length){let u=new(i?.Err??e)(s.issues.map(a=>D(a,c,H())));throw le(u,i?.callee??t),u}return s.value};return t},Ne=Un(oe),Bn=e=>{let t=async(r,n,o,i)=>{let c=o?{...o,async:!0}:{async:!0},s=r._zod.run({value:n,issues:[]},c);if(s instanceof Promise&&(s=await s),s.issues.length){let u=new(i?.Err??e)(s.issues.map(a=>D(a,c,H())));throw le(u,i?.callee??t),u}return s.value};return t},De=Bn(oe),Kn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new T;return i.issues.length?Ot(e,i.issues,o):{success:!0,data:i.value}},Le=Kn(oe);function Ot(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>D(o,r,H()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var Vn=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?Ot(e,i.issues,o):{success:!0,data:i.value}},je=Vn(oe);var Tt=/^[\s\S]{0,}$/;var Mt=/^-?\d+(?:\.\d+)?$/,Nt=/^(?:true|false)$/i;var ie=d("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Dt=d("$ZodCheckStringFormat",(e,t)=>{var r,n;ie.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),Lt=d("$ZodCheckRegex",(e,t)=>{Dt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Ft={major:4,minor:6,patch:6};var w=d("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ft;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let c of i._zod.onattach)c(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,u,a)=>{if(s.memo)return s;let l=R(s),f;for(let p of u){if(p._zod.def.when){if(Ce(s)||!p._zod.def.when(s))continue}else if(l)continue;let g=s.issues.length,h=p._zod.check(s);if(h instanceof Promise&&a?.async===!1)throw new T;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,s.issues.length!==g&&(ne(s.issues,g,e),l||(l=R(s,g)))});else{if(s.issues.length===g)continue;ne(s.issues,g,e),l||(l=R(s,g))}}return f?f.then(()=>s):s},c=(s,u,a)=>{if(R(s))return s.aborted=!0,s;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new T;return l.then(f=>e._zod.parse(f,a))}return e._zod.parse(l,a)};e._zod.run=(s,u)=>{if(u.skipChecks)return e._zod.parse(s,u);if(u.direction==="backward"){let l=e._zod.parse({value:s.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(f=>c(f,s,u)):c(l,s,u)}let a=e._zod.parse(s,u);if(a instanceof Promise){if(u.async===!1)throw new T;return a.then(l=>i(l,o,u))}return i(a,o,u)}}},{get"~standard"(){return Ie(this,"~standard",Wn(this))},set"~standard"(e){C(this,"~standard",e)}}),Gt=(e,t)=>e.issues.length?{issues:e.issues.map(r=>D(r,t,H()))}:{value:e.value};async function Gn(e,t){let r={async:!0};return Gt(await e._zod.run({value:t,issues:[]},r),r)}function Wn(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Gt(n,r)}catch{}return Gn(e,t)},vendor:"zod",version:1}}var Wt=d("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??Tt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var Jt=d("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=Mt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}});var Xt=d("$ZodBoolean",(e,t)=>{w.init(e,t),e._zod.pattern=Nt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});function Jn(e,t){let r=me(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,c)=>{let s=t(i.value);if(s>n&&!c?.skipChecks&&c?.direction!=="backward"){for(let[u,a]of me(e._zod.def.checks))if(s>u&&a._zod.def.when(i)){let l=i.issues.length;return a._zod.check(i),i.issues[l].continue=!1,ne(i.issues,l,e),i}}return o(i,c)}}var Xn=e=>Array.isArray(e)?e.length:-1;function Ht(e,t,r){e.issues.length&&t.issues.push(...de(r,e.issues)),t.value[r]=e.value}var Yt=d("$ZodArray",(e,t)=>{w.init(e,t);let r=F.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let c=[],s=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)c.push(l.then(f=>Ht(f,n,u)));else if(Ht(l,n,u),s&&l.issues.length!==0&&R(l))break}return c.length?Promise.all(c).then(()=>n):n},Jn(e,Xn)});function ge(e,t,r,n,o,i){let c=r in n,s=i==="optional";if(!(!c&&s&&o==="optional")){if(e.issues.length){if(o!==void 0&&s&&!c)return;t.issues.push(...de(r,e.issues))}if(!c&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(c||o==="defaulted"&&!s)&&(t.value[r]=void 0):t.value[r]=e.value}}var Yn=[];function qn(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Yn,o=n.length?[...t,...n]:t;for(let c of o)if(!e.shape?.[c]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(c)}": expected a Zod schema`);let i=Ee(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function Qn(e,t,r,n,o,i,c){let s=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,f=a.optin,p=a.optout,g=0;for(let h in t){if(c&&r.issues.length!==g){if(R(r,g))break;g=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){l==="never"&&s.push(h);continue}if(l==="never"){s.push(h);continue}let x=a.run({value:t[h],issues:[]},n);x instanceof Promise?e.push(x.then(z=>ge(z,r,h,t,f,p))):ge(x,r,h,t,f,p)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var qt=d("$ZodObject",(e,t)=>{w.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=ae(()=>qn(t));S(e,"propValues",a=>{let l=a.def.shape,f={};for(let p in l){let g=l[p]._zod;if(g.values){Object.prototype.hasOwnProperty.call(f,p)||ee(f,p,new Set);for(let h of g.values)f[p].add(h);g.optin!==void 0&&f[p].add(void 0)}}return f});let i=Q,c=t.catchall,s,u=F.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{s??(s=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let p=[],g=s.shape,h=l?.abortEarly,x=a.issues.length;for(let z of s.allKeys){if(h&&a.issues.length!==x){if(R(a,x))break;x=a.issues.length}if(z==="__proto__")continue;let _=g[z],y=_._zod.optin,m=_._zod.optout,b=_._zod.run({value:f[z],issues:[]},l);b instanceof Promise?p.push(b.then(B=>ge(B,a,z,f,y,m))):ge(b,a,z,f,y,m)}return c?Qn(p,f,a,l,o.value,e,h===!0):p.length?Promise.all(p).then(()=>a):a}});var Qt=d("$ZodEnum",(e,t)=>{w.init(e,t);let r=ue(t.entries),n=new Set(r);e._zod.values=n,S(e,"pattern",o=>{let i=ue(o.def.entries).filter(c=>Se.has(typeof c));return new RegExp(i.length?`^(${i.map(c=>re(c.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let c=o.value;return n.has(c)||o.issues.push({code:"invalid_value",values:r,input:c,inst:e}),o}}),er=d("$ZodLiteral",(e,t)=>{w.init(e,t);let r=new Set(t.values);e._zod.values=r,S(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?re(i):i?re(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});function Ut(e,t){return e.value=t.issues.length?void 0:t.value,e}var tr=d("$ZodOptional",(e,t)=>{w.init(e,t),S(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",S(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),S(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Pe(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Ut(r,i)):Ut(r,o)}return t.innerType._zod.run(r,n)}});var rr=d("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",S(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Bt(i,t)):Bt(o,t)}});function Bt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function Kt(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>D(o,n,H()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var nr=d("$ZodCatch",(e,t)=>{w.init(e,t),S(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),S(e,"optout",r=>r.def.innerType._zod.optout),S(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Kt(r,i,t,n)):Kt(r,o,t,n)}});var or=d("$ZodCustom",(e,t)=>{ie.init(e,t),w.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Vt(i,r,n,e));Vt(o,r,n,e)}});function Vt(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(he(o))}}function ir(e){return e.checks&&(e.checks=[...e.checks]),e}function sr(e,t){return new e(ir({type:"string",...Z(t)}))}function cr(e,t){return new e(ir({type:"number",checks:[],...Z(t)}))}function ur(e,t){return new e({type:"boolean",...Z(t)})}function He(e,t){return new Lt({check:"string_format",format:"regex",...Z(t),pattern:e})}function ar(e,t,r){let n=Z(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}var E=d("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");w.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){C(this,"with",e)},parse(e,t){return Ne(this,e,t,{callee:this.parse})},parseAsync(e,t){return De(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Le(this,e,t)},safeParseAsync(e,t){return je(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return P(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),ro=d("ZodMiniString",(e,t)=>{Wt.init(e,t),E.init(e,t)});function U(e){return sr(ro,e)}var no=d("ZodMiniNumber",(e,t)=>{Jt.init(e,t),E.init(e,t)});function Ue(e){return cr(no,e)}var oo=d("ZodMiniBoolean",(e,t)=>{Xt.init(e,t),E.init(e,t)});function M(e){return ur(oo,e)}var io=d("ZodMiniArray",(e,t)=>{Yt.init(e,t),E.init(e,t)});function Be(e,t){return new io({type:"array",element:e,...Z(t)})}var so=d("ZodMiniObject",(e,t)=>{qt.init(e,t),E.init(e,t),Re(e,"shape",r=>r._zod.def.shape,!1)});function Ke(e,t){let r={type:"object",shape:e??{},...Z(t)};return new so(r)}var co=d("ZodMiniEnum",(e,t)=>{Qt.init(e,t),E.init(e,t),e.options=[...e._zod.values]});function lr(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new co({type:"enum",entries:r,...Z(t)})}var uo=d("ZodMiniLiteral",(e,t)=>{er.init(e,t),E.init(e,t)});function pr(e,t){return new uo({type:"literal",values:Array.isArray(e)?e:[e],...Z(t)})}var ao=d("ZodMiniOptional",(e,t)=>{tr.init(e,t),E.init(e,t)});function v(e){return new ao({type:"optional",innerType:e})}var lo=d("ZodMiniDefault",(e,t)=>{rr.init(e,t),E.init(e,t)});function G(e,t){return new lo({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pe(t)}})}var po=d("ZodMiniCatch",(e,t)=>{nr.init(e,t),E.init(e,t)});function fr(e,t){return new po({type:"catch",innerType:e,catchValue:typeof t=="function"?t:O.constantCatch(t)})}var fo=d("ZodMiniCustom",(e,t)=>{or.init(e,t),E.init(e,t)});function Ve(e,t){return ar(fo,e??(()=>!0),t)}var Ge="https://in.dev.heycatch.ai",J="dev",X="0.8.5-dev.2562",dr="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function mr(e=J){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${X}). Events are being sent to the HeyCatch development environment and will NEVER appear in your dashboard. Reinstall the latest stable version - resolve it with \`npm view @heycatch/sdk version\` - or re-run the install guide: https://heycatch.ai/agents.md`}var W="unknown",_o=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var hr=Ke({projectKey:U({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(He(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:G(Be(U()),[]),install:G(Ke({framework:G(U(),W),frameworkVersion:G(U(),W),agent:G(U(),W)}),{framework:W,frameworkVersion:W,agent:W}),autocapture:v(M()),maskAllText:v(M()),maskAllElementAttributes:v(M()),propertyDenylist:v(Be(U())),sanitizeProperties:v(Ve(e=>typeof e=="function")),beforeSend:v(Ve(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:v(lr(_o)),disablePersistence:v(M()),cookieExpirationDays:v(Ue()),optOutCapturingByDefault:v(M()),respectDnt:v(M()),collectIp:v(M()),requestBatching:v(M()),flushIntervalMs:v(Ue()),site:fr(v(pr("landing")),e=>{let t=typeof e.value=="string"?JSON.stringify(e.value):`a ${typeof e.value}`;console.error(`[HeyCatch] config.site must be 'landing' or omitted - got ${t}. Ignoring it; this project is reported as untagged.`)})});var gr="[redacted]",xo=/(^|[#&?])(access_token|refresh_token|token_hash|token)=[^\s#&"'<>]+/gi,yo=/(^|[^\w-])eyJ[\w-]+\.[\w-]+\.[\w-]+/g;function _r(e){return e.replaceAll(xo,`$1$2=${gr}`).replaceAll(yo,`$1${gr}`)}var bo=new Set(["$anon_distinct_id","distinct_id"]),vo=["$set","$set_once"];function We(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Je(e){return typeof e=="string"?_r(e):Array.isArray(e)?$o(e):We(e)?xr(e,()=>!0):e}function $o(e){let t=e.map(r=>Je(r));return t.some((r,n)=>r!==e[n])?t:e}function xr(e,t){let r=!1,n=[];for(let[o,i]of Object.entries(e)){let c=t(o)?Je(i):i;c!==i&&(r=!0),n.push([o,c])}return r?Object.fromEntries(n):e}function yr(e){if(!We(e))return e;try{let t=!1,r={...e},{properties:n}=e;if(We(n)){let o=xr(n,i=>!bo.has(i));o!==n&&(t=!0,r.properties=o)}for(let o of vo){let i=e[o],c=Je(i);c!==i&&(t=!0,r[o]=c)}return t?r:e}catch{return e}}function br(e){return t=>{if(t?.event!=="$autocapture")return t;let r=e();if(r===null)return t;let n=t.properties??{};return"$process_person_profile"in n?t:{...t,properties:{...n,$process_person_profile:r._hasPersonProcessing()}}}}var zo=5e3,wo=60,ko=1e3,Po=60,Zo=new Set(["$set"]),Xe="heycatch_volume_cap_reached",vr=3,So=6e4;function _e({bucket:e,perMinute:t,now:r}){if(e===void 0)return t;let n=Math.max(0,r-e.at);return Math.min(t,e.tokens+n*t/So)}function Eo(e){return e===void 0||e.length===0?!1:rt(Co(e))}function Co(e){if(e.startsWith("[")){let r=e.indexOf("]");return r===-1?e:e.slice(0,r+1)}let t=e.indexOf(":");return t!==-1&&t===e.lastIndexOf(":")?e.slice(0,t):e}function $r(e){let{$session_id:t,$host:r}=e.properties;return{sessionId:typeof t=="string"?t:"",host:typeof r=="string"?r:void 0}}var wr=4;function zr(e){if(e!==void 0)return typeof e=="object"&&e!==null&&"tokens"in e&&typeof e.tokens=="number"&&Number.isFinite(e.tokens)&&e.tokens>=0&&"at"in e&&typeof e.at=="number"&&Number.isFinite(e.at)?{tokens:e.tokens,at:e.at}:!1}function Ao(e){if(typeof e=="object"&&e!==null&&"sessionId"in e&&typeof e.sessionId=="string"&&"count"in e&&typeof e.count=="number"&&Number.isInteger(e.count)&&e.count>=0&&"markerAttempts"in e&&typeof e.markerAttempts=="number"&&Number.isInteger(e.markerAttempts)&&e.markerAttempts>=0){let t=zr("person"in e?e.person:void 0),r=zr("localhost"in e?e.localhost:void 0);if(t!==!1&&r!==!1)return{sessionId:e.sessionId,count:e.count,markerAttempts:e.markerAttempts,person:t,localhost:r}}return null}function Io(e){if(e===null)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.flatMap(r=>{let n=Ao(r);return n===null?[]:[n]}).slice(0,wr)}catch{}return[]}function kr({store:e,warn:t,emitMarker:r,cap:n=zo,personUpdateBudget:o=wo,localhostFreeEvents:i=ko,localhostRatePerMinute:c=Po,now:s=Date.now}){let u=[],a=!1,l=!1,f=!1,p=!1;function g(){if(e===void 0||a)return u;try{return Io(e.read())}catch{return u}}function h(_){let y=g().filter(m=>m.sessionId!==_.sessionId);u=[_,...y].slice(0,wr);try{e?.write(JSON.stringify(u))}catch{a=!0}}function x(_){let y=g().find($=>$.sessionId===_),m=u.find($=>$.sessionId===_),b=[y,m].filter($=>$!==void 0),B=s();function Y($,q){let L;for(let{[$]:K}of b)K!==void 0&&_e({bucket:K,perMinute:q,now:B})<_e({bucket:L,perMinute:q,now:B})&&(L=K);return L}return{sessionId:_,count:Math.max(0,...b.map($=>$.count)),markerAttempts:Math.max(0,...b.map($=>$.markerAttempts)),person:Y("person",o),localhost:Y("localhost",c)}}function z(_,y){let m=y,b=s(),{sessionId:B,host:Y}=$r(_);m.person!==void 0&&m.person.at>b&&(m={...m,person:{...m.person,at:b}},h(m)),m.localhost!==void 0&&m.localhost.at>b&&(m={...m,localhost:{...m.localhost,at:b}},h(m));let $=Zo.has(_.event),q=$?_e({bucket:m.person,perMinute:o,now:b}):0;if($&&q<1)return f||(f=!0,t(`[HeyCatch] setPersonProperties is being called more than ${o} times a minute - call it when a property changes, not on every render. Dropping the extra updates for now; other events are unaffected.`)),null;let L=m.count>=i&&Eo(Y),K=L?_e({bucket:m.localhost,perMinute:c,now:b}):0;return L&&K<1?(p||(p=!0,t(`[HeyCatch] this local dev session (${Y??"unknown host"}, session ${B||"unknown"}) sent ${i} events - throttling it to ${c} a minute so a dev loop cannot flood your analytics. Production traffic is unaffected.`)),null):(h({...m,count:m.count+1,...$?{person:{tokens:q-1,at:b}}:{},...L?{localhost:{tokens:K-1,at:b}}:{}}),_)}return _=>{if(_===null||_.event===Xe)return _;let{sessionId:y}=$r(_),m=x(y);return m.count<n?z(_,m):(l||(l=!0,t(`[HeyCatch] this session sent ${n} events, the per-session cap - dropping the rest until a new session starts (session ${y||"unknown"}). A tracking call inside a render loop or an effect is the usual cause.`)),m.markerAttempts<vr&&(h({...m,markerAttempts:vr}),r({cap:n,sessionId:y})||h({...m,markerAttempts:m.markerAttempts+1})),null)}}function Pr(e){let t=kr({warn:r=>{console.warn(r)},emitMarker:({cap:r})=>{let n=e();return n?.capture(Xe,{heycatch_session_event_cap:r}),n!==null}});return r=>r===null||t({event:r.event,properties:r.properties??{}})===null?null:r}var se=null,Sr=null;function k(){return se}var Ye=null;function Er(){Ye?.()}function Cr(e){if(se!==null)return;let t=hr.safeParse(e);if(!t.success){let s=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${s}`);return}let r=ct(t.data.collectIp!==!1),n=new Zr.PostHog(dr,{host:Ge,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault},before_send:[br(()=>se),Pr(()=>se),r.link,yr]}),{install:o}=t.data,i={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent};Ye=()=>{n.register({heycatch_sdk_version:X,heycatch_sdk_stage:J,heycatch_project_key:t.data.projectKey,...i})},Ye(),se=n,Sr=r,console.info(`[HeyCatch] SDK v${X} (${J}) initialized \u2192 ${Ge}`);let c=mr();c!==null&&console.warn(c)}function Ar(e){ut(Sr,e)}function Ir(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function Rr(){k()?.optIn().catch(Ir("opt-in"))}function Or(){k()?.optOut().catch(Ir("opt-out"))}var Tr=require("posthog-react-native");function Mr(e,t,r){let n=k();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}n.getPersistedProperty(Tr.PostHogPersistedProperty.PersonMode)==="identified"&&n.getDistinctId()!==e&&qe(),n.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function qe(){let e=k();e!==null&&(e.reset(),Er())}function xe(e,t){let r=k();if(r!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackScreen() requires a non-empty screen name.");return}r.screen(e,t?t:void 0)}}function Nr(e,t,r){let n=k();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackEvent() requires a non-empty event name.");return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}n.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function Dr(e,t){let r=k();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var jr=require("posthog-react-native"),ye=require("react");function Ro(e){return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"}function Oo(){try{if(typeof require!="function")return null;let e=require("expo-router");return Ro(e)?e:null}catch{return null}}var Qe=Oo();var To=new Set(["code","jwt","otp","pin","pwd","sid","sig"]),Mo=["credential","email","passcode","passwd","password","secret","session","signature","token"],No="#",Do=/[^\s@,]+@[^\s@,]+\.[^\s@,]+/;function Lo(e){return e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[\s_-]+/).filter(t=>t.length>0)}function jo(e,t){if(e===No)return!0;let r=e.toLowerCase().replaceAll(/[_-]/g,"");return r.startsWith("auth")||r.includes("key")||Mo.some(n=>r.includes(n))||Lo(e).some(n=>To.has(n))?!0:typeof t=="string"&&Do.test(t)}function Lr(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,o]of Object.entries(t)){let i;if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")i=o;else if(Array.isArray(o))i=o.filter(c=>typeof c=="string").join(",");else continue;jo(n,i)||(r[n]=i)}return r}var ce=require("react/jsx-runtime");function Fo({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),o=JSON.stringify(t());return(0,ye.useEffect)(()=>{xe(n,Lr(o))},[n,o]),null}var et=class extends ye.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.error("[HeyCatch] Automatic screen views are off: an Expo Router hook threw. Call analytics.trackScreen(name) from your navigation instead.",t)}render(){return this.state.failed?null:this.props.children}};function Fr({children:e,trackScreens:t=!0}){let r=k();return r===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,ce.jsxs)(jr.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:r,children:[!t||Qe===null?null:(0,ce.jsx)(et,{children:(0,ce.jsx)(Fo,{router:Qe})}),e]})}var Ho={init:Cr,optInCapturing:Rr,optOutCapturing:Or,resetIdentity:qe,setIdentity:Mr,setIpCollection:Ar,setPersonProperties:Dr,trackEvent:Nr,trackScreen:xe};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
1
+ "use strict";var be=Object.defineProperty;var Br=Object.getOwnPropertyDescriptor;var Kr=Object.getOwnPropertyNames;var Vr=Object.prototype.hasOwnProperty;var rt=(e,t)=>{for(var r in t)be(e,r,{get:t[r],enumerable:!0})},Gr=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kr(t))!Vr.call(e,o)&&o!==r&&be(e,o,{get:()=>t[o],enumerable:!(n=Br(t,o))||n.enumerable});return e};var Wr=e=>Gr(be({},"__esModule",{value:!0}),e);var Ko={};rt(Ko,{HeyCatchProvider:()=>Ur,SDK_VERSION:()=>X,STAGE:()=>J,analytics:()=>Bo});module.exports=Wr(Ko);var Er=require("posthog-react-native");var Jr="[a-z0-9]",Go=new RegExp(`^${Jr}$`);var Xr=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function ve(e){let t=Xr.exec(e);if(t===null)return!1;let[,r="",n=""]=t,o=Number(r),i=Number(n);return o>255||i>255?!1:o===0||o===10||o===127||o===100&&i>=64&&i<=127||o===169&&i===254||o===172&&i>=16&&i<=31||o===192&&i===168}var Yr=/^::ffff:([0-9a-f]{1,4}):([0-9a-f]{1,4})$/;function qr(e){if(e==="::1"||e==="::")return!0;if(e.startsWith("::ffff:")){let t=Yr.exec(e);if(t===null)return ve(e.slice(7));let[,r="",n=""]=t,o=Number.parseInt(r,16),i=Number.parseInt(n,16);return ve(`${Math.floor(o/256)}.${o%256}.${Math.floor(i/256)}.${i%256}`)}return/^f[cd][0-9a-f]{2}:/.test(e)||/^fe[89ab][0-9a-f]:/.test(e)}function Qr(e){return e.toLowerCase().replace(/^\[/,"").replace(/\]$/,"").replace(/\.+$/,"")}function nt(e){let t=Qr(e);return t==="localhost"||t.endsWith(".localhost")||ve(t)||qr(t)}var ot="0.0.0.0",it="$ip",st="$geoip_disable";function ct(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function on(e){return ct(e)?{...e,properties:{...ct(e.properties)?e.properties:{},[it]:ot,[st]:!0}}:e}function ut(e){let t=e;return{link:r=>t?r:on(r),set:r=>{t=r}}}function at(e,t){if(typeof t!="boolean"){console.warn("[HeyCatch] setIpCollection() takes true or false - the call was ignored.");return}if(e===null){console.warn(`[HeyCatch] setIpCollection(${String(t)}) was called before init(), so it was NOT applied. Pass collectIp to init() instead, or call setIpCollection() after it.`);return}e.set(t)}var O={};rt(O,{BIGINT_FORMAT_RANGES:()=>kn,CONSTANT_CATCH:()=>Et,Class:()=>we,NUMBER_FORMAT_RANGES:()=>wn,aborted:()=>R,allowsEval:()=>gt,assert:()=>pn,assertEqual:()=>sn,assertIs:()=>an,assertNever:()=>ln,assertNotEqual:()=>cn,assignProp:()=>ee,attachSchema:()=>ne,base64ToUint8Array:()=>Zt,base64urlToUint8Array:()=>In,cached:()=>ae,captureStackTrace:()=>le,cleanEnum:()=>An,cleanRegex:()=>Pe,clone:()=>P,cloneDef:()=>_n,codePointLength:()=>Sn,constantCatch:()=>Ct,createTransparentProxy:()=>zn,defineLazy:()=>pt,defineLazyInternal:()=>S,derived:()=>Mn,esc:()=>mt,escapeRegex:()=>re,explicitlyAborted:()=>Ce,extend:()=>vt,finalizeIssue:()=>D,floatSafeRemainder:()=>mn,getElementAtPath:()=>xn,getEnumValues:()=>ue,getLengthableOrigin:()=>En,getParsedType:()=>$n,getSizableOrigin:()=>Pn,hexToUint8Array:()=>On,hide:()=>Ie,installLazyProp:()=>Re,isObject:()=>Q,isPlainObject:()=>te,issue:()=>he,joinValues:()=>fn,jsonStringifyReplacer:()=>ke,members:()=>Ae,merge:()=>wt,mergeDefs:()=>A,normalizeParams:()=>Z,nullish:()=>dn,numKeys:()=>vn,objectClone:()=>hn,omit:()=>bt,optionalKeys:()=>Ee,own:()=>C,parsedType:()=>Cn,partial:()=>kt,pick:()=>yt,prefixIssues:()=>de,primitiveTypes:()=>_t,promiseAllObject:()=>yn,propertyKeyTypes:()=>Se,randomString:()=>bn,rawShape:()=>Ze,required:()=>Pt,safeExtend:()=>zt,shallowClone:()=>pe,sizeCaps:()=>me,slugify:()=>ht,stringifyPrimitive:()=>xt,toZod:()=>un,uint8ArrayToBase64:()=>St,uint8ArrayToBase64url:()=>Rn,uint8ArrayToHex:()=>Tn,unwrapMessage:()=>V});function sn(e){return e}function cn(e){return e}function un(){return e=>e}function an(e){}function ln(e){throw new Error("Unexpected value in exhaustive check")}function pn(e){}function ue(e){let t=Object.values(e).filter(n=>typeof n=="number");return Object.entries(e).filter(([n,o])=>t.indexOf(+n)===-1).map(([n,o])=>o)}function fn(e,t="|"){return e.map(r=>xt(r)).join(t)}function ke(e,t){return typeof t=="bigint"?t.toString():t}var ze=class{constructor(t){this._getter=t,this._value=void 0}get value(){let t=this._getter;return t!==void 0&&(this._value=t(),this._getter=void 0),this._value}};function ae(e){return new ze(e)}function dn(e){return e==null}function Pe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}function mn(e,t){let r=e/t,n=Math.round(r),o=4*Number.EPSILON*Math.max(Math.abs(r),1);return Math.abs(r-n)<o?0:r-n}var lt=Symbol("evaluating");function pt(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==lt)return n===void 0&&(n=lt,n=r()),n},set(o){Object.defineProperty(e,t,{value:o})},configurable:!0})}function hn(e){return Object.create(Object.getPrototypeOf(e),Object.getOwnPropertyDescriptors(e))}function ee(e,t,r){Object.defineProperty(e,t,{value:r,writable:!0,enumerable:!0,configurable:!0})}function Ze(e){let t=Object.getOwnPropertyDescriptor(e,"shape");return t?.get?t.get.raw:t?.value}function I(e){return Ze(e._zod.def)??e._zod.def.shape}function ft(e,t,r){Object.defineProperty(e,t,{get(){let n=r();return ee(this,t,n),n},enumerable:!0,configurable:!0})}function dt(e,t,r){t in e?ee(e,t,r):e[t]=r}function j(e,t,r,n){let o=I(t);for(let i of r){let c=Object.getOwnPropertyDescriptor(o,i);c.enumerable&&(c.get?ft(e,i,()=>{let s=t._zod.def.shape[i];return n?n(s,i):s}):dt(e,i,n?n(c.value,i):c.value))}}function gn(e,t){for(let r of Reflect.ownKeys(t)){let n=Object.getOwnPropertyDescriptor(t,r);n.enumerable&&(n.get?ft(e,r,()=>t[r]):dt(e,r,n.value))}}function A(...e){let t={};for(let r of e){let n=Object.getOwnPropertyDescriptors(r);Object.assign(t,n)}return Object.defineProperties({},t)}function _n(e){return A(e._zod.def)}function xn(e,t){return t?t.reduce((r,n)=>r?.[n],e):e}function yn(e){let t=Object.keys(e),r=t.map(n=>e[n]);return Promise.all(r).then(n=>{let o={};for(let i=0;i<t.length;i++)o[t[i]]=n[i];return o})}function bn(e=10){let t="abcdefghijklmnopqrstuvwxyz",r="";for(let n=0;n<e;n++)r+=t[Math.floor(Math.random()*t.length)];return r}function mt(e){return JSON.stringify(e)}function ht(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,"").replace(/[\s_-]+/g,"-").replace(/^-+|-+$/g,"")}var le="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function Q(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}var gt=ae(()=>{if(F.jitless||typeof navigator<"u"&&navigator?.userAgent?.includes("Cloudflare"))return!1;try{let e=Function;return new e(""),!0}catch{return!1}});function te(e){if(Q(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(Q(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function pe(e){return te(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function vn(e){let t=0;for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t++;return t}var $n=e=>{let t=typeof e;switch(t){case"undefined":return"undefined";case"string":return"string";case"number":return Number.isNaN(e)?"nan":"number";case"boolean":return"boolean";case"function":return"function";case"bigint":return"bigint";case"symbol":return"symbol";case"object":return Array.isArray(e)?"array":e===null?"null":e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?"promise":typeof Map<"u"&&e instanceof Map?"map":typeof Set<"u"&&e instanceof Set?"set":typeof Date<"u"&&e instanceof Date?"date":typeof File<"u"&&e instanceof File?"file":"object";default:throw new Error(`Unknown data type: ${t}`)}},Se=new Set(["string","number","symbol"]),_t=new Set(["string","number","bigint","boolean","symbol","undefined"]);function re(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function P(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function Z(e){let t=e;if(!t)return{};if(typeof t=="string")return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw new Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error=="string"?{...t,error:()=>t.error}:t}function zn(e){let t;return new Proxy({},{get(r,n,o){return t??(t=e()),Reflect.get(t,n,o)},set(r,n,o,i){return t??(t=e()),Reflect.set(t,n,o,i)},has(r,n){return t??(t=e()),Reflect.has(t,n)},deleteProperty(r,n){return t??(t=e()),Reflect.deleteProperty(t,n)},ownKeys(r){return t??(t=e()),Reflect.ownKeys(t)},getOwnPropertyDescriptor(r,n){return t??(t=e()),Reflect.getOwnPropertyDescriptor(t,n)},defineProperty(r,n,o){return t??(t=e()),Reflect.defineProperty(t,n,o)}})}function xt(e){return typeof e=="bigint"?e.toString()+"n":typeof e=="string"?`"${e}"`:`${e}`}function Ee(e){return Object.keys(e).filter(t=>e[t]._zod.optin!==void 0&&e[t]._zod.optout==="optional")}var wn={safeint:[Number.MIN_SAFE_INTEGER,Number.MAX_SAFE_INTEGER],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]},kn={int64:[BigInt("-9223372036854775808"),BigInt("9223372036854775807")],uint64:[BigInt(0),BigInt("18446744073709551615")]};function yt(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".pick() cannot be used on object schemas containing refinements");let i={};return j(i,e,fe(e,t)),P(e,A(r,{shape:i,checks:[]}))}function fe(e,t){let r=I(e),n=[];for(let o of Reflect.ownKeys(t)){if(!Object.getOwnPropertyDescriptor(r,o)?.enumerable)throw new Error(`Unrecognized key: "${String(o)}"`);t[o]&&n.push(o)}return n}function bt(e,t){let r=e._zod.def,n=r.checks;if(n&&n.length>0)throw new Error(".omit() cannot be used on object schemas containing refinements");let i=new Set(fe(e,t)),c={};return j(c,e,Reflect.ownKeys(I(e)).filter(s=>!i.has(s))),P(e,A(r,{shape:c,checks:[]}))}function vt(e,t){if(!te(t))throw new Error("Invalid input to extend: expected a plain object");let r=e._zod.def.checks;if(r&&r.length>0){let o=I(e);for(let i of Reflect.ownKeys(t))if(Object.getOwnPropertyDescriptor(o,i)!==void 0)throw new Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return P(e,A(e._zod.def,{shape:$t(e,t)}))}function $t(e,t){let r={};return j(r,e,Reflect.ownKeys(I(e))),gn(r,t),r}function zt(e,t){if(!te(t))throw new Error("Invalid input to safeExtend: expected a plain object");return P(e,A(e._zod.def,{shape:$t(e,t)}))}function wt(e,t){if(!t?._zod?.def)throw new Error("Invalid input to merge: expected an object schema. To merge a plain shape, use `.extend()`.");if(e._zod.def.checks?.length)throw new Error(".merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.");let r={};j(r,e,Reflect.ownKeys(I(e))),j(r,t,Reflect.ownKeys(I(t)));let n=A(e._zod.def,{shape:r,get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]});return P(e,n)}function kt(e,t,r,n="partial"){let i=t._zod.def.checks;if(i&&i.length>0)throw new Error(`.${n}() cannot be used on object schemas containing refinements`);let s=r?new Set(fe(t,r)):void 0,u={};return j(u,t,Reflect.ownKeys(I(t)),e&&((a,l)=>s&&!s.has(l)?a:new e({type:"optional",innerType:a}))),P(t,A(t._zod.def,{shape:u,checks:[]}))}function Pt(e,t,r){let n=r?new Set(fe(t,r)):void 0,o={};return j(o,t,Reflect.ownKeys(I(t)),(i,c)=>n&&!n.has(c)?i:new e({type:"nonoptional",innerType:i})),P(t,A(t._zod.def,{shape:o}))}function R(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue!==!0)return!0;return!1}function Ce(e,t=0){if(e.aborted===!0)return!0;for(let r=t;r<e.issues.length;r++)if(e.issues[r]?.continue===!1)return!0;return!1}function de(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function V(e){return typeof e=="string"?e:e?.message}function me(e){let t=[];for(let r of e??[]){let n=r._zod.def;if(!/_(length|size)$|_equals$/.test(n.check))break;let o=n.maximum??n.length??n.size;o>=0&&t.push([o,r])}return t}function ne(e,t,r){var n;for(let o=t;o<e.length;o++)(n=e[o]).schema??(n.schema=r)}function D(e,t,r){var n;let o=e.inst?._zod?.traits;o?.has("$ZodType")&&(o.has("$ZodCheck")?(n=e).schema??(n.schema=e.inst):e.schema=e.inst);let i=e.schema!==e.inst?e.schema?._zod.def?.error:void 0,c=e.message?e.message:V(e.inst?._zod.def?.error?.(e))??V(i?.(e))??V(t?.error?.(e))??V(r.customError?.(e))??V(r.localeError?.(e))??"Invalid input",s={};for(let u of Object.keys(e))u==="inst"||u==="schema"||u==="continue"||u==="input"||u==="__proto__"||(s[u]=e[u]);return s.path??(s.path=[]),s.message=c,t?.reportInput&&(s.input=e.input),s}function Pn(e){return e instanceof Set?"set":e instanceof Map?"map":e instanceof File?"file":"unknown"}var Zn=/[\uD800-\uDBFF]/;function Sn(e){let t=e.length;if(!Zn.test(e))return t;let r=t;for(let n=0;n<t-1;n++)(e.charCodeAt(n)&64512)===55296&&(e.charCodeAt(n+1)&64512)===56320&&(r--,n++);return r}function En(e){return Array.isArray(e)?"array":typeof e=="string"?"string":"unknown"}function Cn(e){let t=typeof e;switch(t){case"number":return Number.isNaN(e)?"nan":"number";case"object":{if(e===null)return"null";if(Array.isArray(e))return"array";let r=e;if(r&&Object.getPrototypeOf(r)!==Object.prototype&&"constructor"in r&&r.constructor)return r.constructor.name}}return t}function he(...e){let[t,r,n]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:n}:{...t}}function An(e){return Object.entries(e).filter(([t,r])=>Number.isNaN(Number.parseInt(t,10))).map(t=>t[1])}function Zt(e){let t=atob(e),r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}function St(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function In(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r="=".repeat((4-t.length%4)%4);return Zt(t+r)}function Rn(e){return St(e).replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function On(e){let t=e.replace(/^0x/,"");if(t.length%2!==0)throw new Error("Invalid hex string length");let r=new Uint8Array(t.length/2);for(let n=0;n<t.length;n+=2)r[n/2]=Number.parseInt(t.slice(n,n+2),16);return r}function Tn(e){return Array.from(e).map(t=>t.toString(16).padStart(2,"0")).join("")}var we=class{constructor(...t){}};function Ae(e,t){for(let r in t){let n=Object.getOwnPropertyDescriptor(t,r);n.get?Object.defineProperty(e,r,{...n,enumerable:!1}):Nn(e,r,n.value)}}function C(e,t,r,n=!0){return Object.defineProperty(e,t,{configurable:!0,writable:!0,enumerable:n,value:r}),r}function Ie(e,t,r){return C(e,t,r,!1)}function Mn(e,t){for(let r in e){let n=e[r];Object.defineProperty(t,r,{configurable:!0,enumerable:!0,get(){return C(this,r,n(this))},set(o){C(this,r,o)}})}return t}function Nn(e,t,r){Object.defineProperty(e,t,{configurable:!0,get(){return this==null?r:C(this,t,r.bind(this))},set(n){C(this,t,n)}})}function Dn(e,t){let r=Object.getPrototypeOf(e);return t in r?void 0:r}var $e,N=!1,Ln={configurable:!0,get(){N=!0}};function S(e,t,r){let n=Object.getPrototypeOf(e._zod);if(t in n&&$e!==e._zod){$e=void 0;return}$e=e._zod,Object.defineProperty(n,t,{configurable:!0,get(){Object.defineProperty(this,t,Ln);let o=N;N=!1;try{let i=r(this);return N?delete this[t]:Object.defineProperty(this,t,{configurable:!0,writable:!0,value:i}),N=N||o,i}catch(i){throw delete this[t],N=N||o,i}},set(o){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:o})}})}function Re(e,t,r,n){let o=Dn(e,t);o&&Object.defineProperty(o,t,{configurable:!0,get(){let i={configurable:!0,writable:!0,enumerable:n,value:void 0};return Object.defineProperty(this,t,i),i.value=r(this),Object.defineProperty(this,t,i),i.value},set(i){Object.defineProperty(this,t,{configurable:!0,writable:!0,enumerable:n,value:i})}})}var Et="~constantCatch";function Ct(e){let t=()=>e;return t[Et]=!0,t}var At;var Oe={value:void 0,enumerable:!1},It="captureStackTrace"in Error?Error:null;function jn(e){let t=It;if(t){let r=t.stackTraceLimit;if(typeof r=="number"){try{t.stackTraceLimit=0}catch{return It=null,new e}try{return new e}finally{t.stackTraceLimit=r}}}return new e}function d(e,t,r,n){let o={};function i(p){this.def=p,this.constr=f,this.traits=new Set}i.prototype=o;let c=r,s=c&&new WeakSet;function u(p,g){if(p._zod){if(p._zod.traits.has(e))return}else{Oe.value=new i(g);try{Object.defineProperty(p,"_zod",Oe)}finally{Oe.value=void 0}}if(p._zod.traits.add(e),t(p,g),s){let x=Object.getPrototypeOf(p),z=p._zod.constr.prototype,_=x;for(;_&&_!==z;)_=Object.getPrototypeOf(_);let y=_??x;s.has(y)||(s.add(y),Ae(y,c))}let h=f.prototype;for(let x in h)Object.prototype.hasOwnProperty.call(h,x)&&(x in p||(p[x]=h[x].bind(p)))}let a=n?.Parent??Object;class l extends a{}Object.defineProperty(l,"name",{value:e});function f(p){let g=n?.Parent?jn(l):this;u(g,p);let h=g._zod.deferred;if(h){for(let z of h)z();g._zod.deferred=void 0}let x=globalThis.__zod_globalConfig?.postProcessor;return x&&x(g),g}return Object.defineProperty(f,"init",{value:u}),Object.defineProperty(f,Symbol.hasInstance,{value:p=>n?.Parent&&p instanceof n.Parent?!0:p?._zod?.traits?.has(e)}),Object.defineProperty(f,"name",{value:e}),f}var T=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(At=globalThis).__zod_globalConfig??(At.__zod_globalConfig={});var F=globalThis.__zod_globalConfig;function H(e){return e&&Object.assign(F,e),F}function Fn(){let e=this._zod;return e.message??(e.message=JSON.stringify(e.def,ke,2)),e.message}function Hn(e){this._zod.message=e}var Un={get:Fn,set:Hn,enumerable:!0,configurable:!0},Me={value:void 0,enumerable:!1},Rt=new WeakSet([Object.prototype,Error.prototype]),Ot=(e,t)=>{e.name="$ZodError",Me.value=t,Object.defineProperty(e,"issues",Me),Me.value=void 0,Object.defineProperty(e,"message",Un);let r=Object.getPrototypeOf(e);Rt.has(r)||(Rt.add(r),Object.defineProperty(r,"toString",{configurable:!0,enumerable:!1,get(){let n=()=>this.message;return Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0}),n},set(n){Object.defineProperty(this,"toString",{value:n,configurable:!0,writable:!0})}}))},ii=d("$ZodError",Ot),oe=d("$ZodError",Ot,void 0,{Parent:Error});var Kn=e=>{let t=(r,n,o,i)=>{let c=o?{...o,async:!1}:{async:!1},s=r._zod.run({value:n,issues:[]},c);if(s instanceof Promise)throw new T;if(s.issues.length){let u=new(i?.Err??e)(s.issues.map(a=>D(a,c,H())));throw le(u,i?.callee??t),u}return s.value};return t},Ne=Kn(oe),Vn=e=>{let t=async(r,n,o,i)=>{let c=o?{...o,async:!0}:{async:!0},s=r._zod.run({value:n,issues:[]},c);if(s instanceof Promise&&(s=await s),s.issues.length){let u=new(i?.Err??e)(s.issues.map(a=>D(a,c,H())));throw le(u,i?.callee??t),u}return s.value};return t},De=Vn(oe),Gn=e=>(t,r,n)=>{let o=n?{...n,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},o);if(i instanceof Promise)throw new T;return i.issues.length?Tt(e,i.issues,o):{success:!0,data:i.value}},Le=Gn(oe);function Tt(e,t,r){let n;return{success:!1,get error(){return n||(n=new e(t.map(o=>D(o,r,H()))),t=void 0,r=void 0),n},set error(o){n=o,t=void 0,r=void 0}}}var Wn=e=>async(t,r,n)=>{let o=n?{...n,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},o);return i instanceof Promise&&(i=await i),i.issues.length?Tt(e,i.issues,o):{success:!0,data:i.value}},je=Wn(oe);var Mt=/^[\s\S]{0,}$/;var Nt=/^-?\d+(?:\.\d+)?$/,Dt=/^(?:true|false)$/i;var ie=d("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Lt=d("$ZodCheckStringFormat",(e,t)=>{var r,n;ie.init(e,t),t.pattern?(r=e._zod).check??(r.check=o=>{t.pattern.lastIndex=0,!t.pattern.test(o.value)&&o.issues.push({origin:"string",code:"invalid_format",format:t.format,input:o.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),jt=d("$ZodCheckRegex",(e,t)=>{Lt.init(e,t),e._zod.check=r=>{t.pattern.lastIndex=0,!t.pattern.test(r.value)&&r.issues.push({origin:"string",code:"invalid_format",format:"regex",input:r.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}});var Ht={major:4,minor:6,patch:6};var w=d("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ht;let n=e._zod.def.checks,o=e._zod.traits.has("$ZodCheck")?[e,...n??[]]:n?.length?[...n]:[];for(let i of o)for(let c of i._zod.onattach)c(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(s,u,a)=>{if(s.memo)return s;let l=R(s),f;for(let p of u){if(p._zod.def.when){if(Ce(s)||!p._zod.def.when(s))continue}else if(l)continue;let g=s.issues.length,h=p._zod.check(s);if(h instanceof Promise&&a?.async===!1)throw new T;if(f||h instanceof Promise)f=(f??Promise.resolve()).then(async()=>{await h,s.issues.length!==g&&(ne(s.issues,g,e),l||(l=R(s,g)))});else{if(s.issues.length===g)continue;ne(s.issues,g,e),l||(l=R(s,g))}}return f?f.then(()=>s):s},c=(s,u,a)=>{if(R(s))return s.aborted=!0,s;let l=i(u,o,a);if(l instanceof Promise){if(a.async===!1)throw new T;return l.then(f=>e._zod.parse(f,a))}return e._zod.parse(l,a)};e._zod.run=(s,u)=>{if(u.skipChecks)return e._zod.parse(s,u);if(u.direction==="backward"){let l=e._zod.parse({value:s.value,issues:[]},{...u,skipChecks:!0});return l instanceof Promise?l.then(f=>c(f,s,u)):c(l,s,u)}let a=e._zod.parse(s,u);if(a instanceof Promise){if(u.async===!1)throw new T;return a.then(l=>i(l,o,u))}return i(a,o,u)}}},{get"~standard"(){return Ie(this,"~standard",Xn(this))},set"~standard"(e){C(this,"~standard",e)}}),Wt=(e,t)=>e.issues.length?{issues:e.issues.map(r=>D(r,t,H()))}:{value:e.value};async function Jn(e,t){let r={async:!0};return Wt(await e._zod.run({value:t,issues:[]},r),r)}function Xn(e){return{validate:t=>{let r={async:!1};try{let n=e._zod.run({value:t,issues:[]},r);if(!(n instanceof Promise))return Wt(n,r)}catch{}return Jn(e,t)},vendor:"zod",version:1}}var Jt=d("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=t.pattern??Mt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=String(r.value)}catch{}return typeof r.value=="string"||r.issues.push({expected:"string",code:"invalid_type",input:r.value,inst:e}),r}});var Xt=d("$ZodNumber",(e,t)=>{w.init(e,t),e._zod.pattern=Nt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let o=r.value;if(typeof o=="number"&&!Number.isNaN(o)&&Number.isFinite(o))return r;let i=typeof o=="number"?Number.isNaN(o)?"NaN":Number.isFinite(o)?void 0:String(o):void 0;return r.issues.push({expected:"number",code:"invalid_type",input:o,inst:e,...i?{received:i}:{}}),r}});var Yt=d("$ZodBoolean",(e,t)=>{w.init(e,t),e._zod.pattern=Dt,e._zod.parse=(r,n)=>{if(t.coerce)try{r.value=!!r.value}catch{}let o=r.value;return typeof o=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:o,inst:e}),r}});function Yn(e,t){let r=me(e._zod.def.checks);if(!r.length)return;let n=Math.min(...r.map(i=>i[0])),o=e._zod.parse;e._zod.parse=(i,c)=>{let s=t(i.value);if(s>n&&!c?.skipChecks&&c?.direction!=="backward"){for(let[u,a]of me(e._zod.def.checks))if(s>u&&a._zod.def.when(i)){let l=i.issues.length;return a._zod.check(i),i.issues[l].continue=!1,ne(i.issues,l,e),i}}return o(i,c)}}var qn=e=>Array.isArray(e)?e.length:-1;function Ut(e,t,r){e.issues.length&&t.issues.push(...de(r,e.issues)),t.value[r]=e.value}var qt=d("$ZodArray",(e,t)=>{w.init(e,t);let r=F.memoizer;r?.attach(e),e._zod.parse=(n,o)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),n;n.value=r?r.alloc(e,n,Array(i.length),o):Array(i.length);let c=[],s=o?.abortEarly;for(let u=0;u<i.length;u++){let a=i[u],l=t.element._zod.run({value:a,issues:[]},o);if(l instanceof Promise)c.push(l.then(f=>Ut(f,n,u)));else if(Ut(l,n,u),s&&l.issues.length!==0&&R(l))break}return c.length?Promise.all(c).then(()=>n):n},Yn(e,qn)});function ge(e,t,r,n,o,i){let c=r in n,s=i==="optional";if(!(!c&&s&&o==="optional")){if(e.issues.length){if(o!==void 0&&s&&!c)return;t.issues.push(...de(r,e.issues))}if(!c&&o===void 0){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?(c||o==="defaulted"&&!s)&&(t.value[r]=void 0):t.value[r]=e.value}}var Qn=[];function eo(e){let t=Object.keys(e.shape),r=Object.getOwnPropertySymbols(e.shape),n=r.length?r:Qn,o=n.length?[...t,...n]:t;for(let c of o)if(!e.shape?.[c]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${String(c)}": expected a Zod schema`);let i=Ee(e.shape);return{...e,allKeys:o,symbolKeys:n,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(i)}}function to(e,t,r,n,o,i,c){let s=[],u=o.keySet,a=o.catchall._zod,l=a.def.type,f=a.optin,p=a.optout,g=0;for(let h in t){if(c&&r.issues.length!==g){if(R(r,g))break;g=r.issues.length}if(u.has(h))continue;if(h==="__proto__"){l==="never"&&s.push(h);continue}if(l==="never"){s.push(h);continue}let x=a.run({value:t[h],issues:[]},n);x instanceof Promise?e.push(x.then(z=>ge(z,r,h,t,f,p))):ge(x,r,h,t,f,p)}return s.length&&r.issues.push({code:"unrecognized_keys",keys:s,input:t,inst:i,continue:!0}),e.length?Promise.all(e).then(()=>r):r}var Qt=d("$ZodObject",(e,t)=>{w.init(e,t);let r=Object.getOwnPropertyDescriptor(t,"shape"),n=r?.get?r.get.raw:t.shape??{};if(n){let a=()=>{let l={...n};return Object.defineProperty(t,"shape",{value:l}),a.raw=l,l};a.raw=n,Object.defineProperty(t,"shape",{get:a})}let o=ae(()=>eo(t));S(e,"propValues",a=>{let l=a.def.shape,f={};for(let p in l){let g=l[p]._zod;if(g.values){Object.prototype.hasOwnProperty.call(f,p)||ee(f,p,new Set);for(let h of g.values)f[p].add(h);g.optin!==void 0&&f[p].add(void 0)}}return f});let i=Q,c=t.catchall,s,u=F.memoizer;u?.attach(e),e._zod.parse=(a,l)=>{s??(s=o.value);let f=a.value;if(!i(f))return a.issues.push({expected:"object",code:"invalid_type",input:f,inst:e}),a;a.value=u?u.alloc(e,a,{},l):{};let p=[],g=s.shape,h=l?.abortEarly,x=a.issues.length;for(let z of s.allKeys){if(h&&a.issues.length!==x){if(R(a,x))break;x=a.issues.length}if(z==="__proto__")continue;let _=g[z],y=_._zod.optin,m=_._zod.optout,b=_._zod.run({value:f[z],issues:[]},l);b instanceof Promise?p.push(b.then(B=>ge(B,a,z,f,y,m))):ge(b,a,z,f,y,m)}return c?to(p,f,a,l,o.value,e,h===!0):p.length?Promise.all(p).then(()=>a):a}});var er=d("$ZodEnum",(e,t)=>{w.init(e,t);let r=ue(t.entries),n=new Set(r);e._zod.values=n,S(e,"pattern",o=>{let i=ue(o.def.entries).filter(c=>Se.has(typeof c));return new RegExp(i.length?`^(${i.map(c=>re(c.toString())).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(o,i)=>{let c=o.value;return n.has(c)||o.issues.push({code:"invalid_value",values:r,input:c,inst:e}),o}}),tr=d("$ZodLiteral",(e,t)=>{w.init(e,t);let r=new Set(t.values);e._zod.values=r,S(e,"pattern",n=>{let o=n.def.values;return new RegExp(o.length?`^(${o.map(i=>typeof i=="string"?re(i):i?re(i.toString()):String(i)).join("|")})$`:"^[^\\s\\S]$")}),e._zod.parse=(n,o)=>{let i=n.value;return r.has(i)||n.issues.push({code:"invalid_value",values:t.values,input:i,inst:e}),n}});function Bt(e,t){return e.value=t.issues.length?void 0:t.value,e}var rr=d("$ZodOptional",(e,t)=>{w.init(e,t),S(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),e._zod.optout="optional",S(e,"values",r=>{let n=r.def.innerType._zod.values;return n?new Set([...n,void 0]):void 0}),S(e,"pattern",r=>{let n=r.def.innerType._zod.pattern;return n?new RegExp(`^(${Pe(n.source)})?$`):void 0}),e._zod.parse=(r,n)=>{if(r.value===void 0){if(t.innerType._zod.optin!=="defaulted")return r;let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Bt(r,i)):Bt(r,o)}return t.innerType._zod.run(r,n)}});var nr=d("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="defaulted",S(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);if(r.value===void 0)return r.value=t.defaultValue,r;let o=t.innerType._zod.run(r,n);return o instanceof Promise?o.then(i=>Kt(i,t)):Kt(o,t)}});function Kt(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function Vt(e,t,r,n){return t.issues.length?(e.value=r.catchValue({...t,value:e.value,error:{issues:t.issues.map(o=>D(o,n,H()))},input:e.value}),e):(e.value=t.value,t.memo&&(e.memo=!0),e)}var or=d("$ZodCatch",(e,t)=>{w.init(e,t),S(e,"optin",r=>r.def.innerType._zod.optin==="defaulted"?"defaulted":"optional"),S(e,"optout",r=>r.def.innerType._zod.optout),S(e,"values",r=>r.def.innerType._zod.values),e._zod.parse=(r,n)=>{if(n.direction==="backward")return t.innerType._zod.run(r,n);let o=t.innerType._zod.run({value:r.value,issues:[]},n);return o instanceof Promise?o.then(i=>Vt(r,i,t,n)):Vt(r,o,t,n)}});var ir=d("$ZodCustom",(e,t)=>{ie.init(e,t),w.init(e,t),e._zod.parse=(r,n)=>r,e._zod.check=r=>{let n=r.value,o=t.fn(n);if(o instanceof Promise)return o.then(i=>Gt(i,r,n,e));Gt(o,r,n,e)}});function Gt(e,t,r,n){if(!e){let o={code:"custom",input:r,inst:n,path:[...n._zod.def.path??[]],continue:!n._zod.def.abort};n._zod.def.params&&(o.params=n._zod.def.params),t.issues.push(he(o))}}function sr(e){return e.checks&&(e.checks=[...e.checks]),e}function cr(e,t){return new e(sr({type:"string",...Z(t)}))}function ur(e,t){return new e(sr({type:"number",checks:[],...Z(t)}))}function ar(e,t){return new e({type:"boolean",...Z(t)})}function He(e,t){return new jt({check:"string_format",format:"regex",...Z(t),pattern:e})}function lr(e,t,r){let n=Z(r);return n.abort??(n.abort=!0),new e({type:"custom",check:"custom",fn:t,...n})}var E=d("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");w.init(e,t),e.def=t,e.type=t.type},{get with(){return this.check},set with(e){C(this,"with",e)},parse(e,t){return Ne(this,e,t,{callee:this.parse})},parseAsync(e,t){return De(this,e,t,{callee:this.parseAsync})},safeParse(e,t){return Le(this,e,t)},safeParseAsync(e,t){return je(this,e,t)},check(...e){let t=this.def;return this.clone({...t,checks:[...t.checks??[],...e.map(r=>typeof r=="function"?{_zod:{check:r,def:{check:"custom"},onattach:[]}}:r)]},{parent:!0})},clone(e,t){return P(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},apply(e,...t){return t.length===0?e(this):e(this,...t)}}),oo=d("ZodMiniString",(e,t)=>{Jt.init(e,t),E.init(e,t)});function U(e){return cr(oo,e)}var io=d("ZodMiniNumber",(e,t)=>{Xt.init(e,t),E.init(e,t)});function Ue(e){return ur(io,e)}var so=d("ZodMiniBoolean",(e,t)=>{Yt.init(e,t),E.init(e,t)});function M(e){return ar(so,e)}var co=d("ZodMiniArray",(e,t)=>{qt.init(e,t),E.init(e,t)});function Be(e,t){return new co({type:"array",element:e,...Z(t)})}var uo=d("ZodMiniObject",(e,t)=>{Qt.init(e,t),E.init(e,t),Re(e,"shape",r=>r._zod.def.shape,!1)});function Ke(e,t){let r={type:"object",shape:e??{},...Z(t)};return new uo(r)}var ao=d("ZodMiniEnum",(e,t)=>{er.init(e,t),E.init(e,t),e.options=[...e._zod.values]});function pr(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(n=>[n,n])):e;return new ao({type:"enum",entries:r,...Z(t)})}var lo=d("ZodMiniLiteral",(e,t)=>{tr.init(e,t),E.init(e,t)});function fr(e,t){return new lo({type:"literal",values:Array.isArray(e)?e:[e],...Z(t)})}var po=d("ZodMiniOptional",(e,t)=>{rr.init(e,t),E.init(e,t)});function v(e){return new po({type:"optional",innerType:e})}var fo=d("ZodMiniDefault",(e,t)=>{nr.init(e,t),E.init(e,t)});function G(e,t){return new fo({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():pe(t)}})}var mo=d("ZodMiniCatch",(e,t)=>{or.init(e,t),E.init(e,t)});function dr(e,t){return new mo({type:"catch",innerType:e,catchValue:typeof t=="function"?t:O.constantCatch(t)})}var ho=d("ZodMiniCustom",(e,t)=>{ir.init(e,t),E.init(e,t)});function Ve(e,t){return lr(ho,e??(()=>!0),t)}var We="https://in.dev.heycatch.ai",J="dev",X="0.8.5-dev.2662",mr="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function hr(e=J){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${X}). Events are being sent to the HeyCatch development environment and will NEVER appear in your dashboard. Reinstall the latest stable version - resolve it with \`npm view @heycatch/sdk version\` - or re-run the install guide: https://heycatch.ai/agents.md`}var Ge=/^hck_pk_[\w-]{32}$/;function gr(e){if(Ge.test(e))return null;let t=e.trim(),r="Copy the key again from the Install page in your HeyCatch dashboard.";if(t!==e&&Ge.test(t))r="Fix: remove the surrounding whitespace.";else if(Ge.test(t.replace(/[.,;:]$/,""))){let n=`the trailing "${t.at(-1)??""}"`;r=t===e?`Fix: remove ${n}.`:`Fix: remove ${n} and the surrounding whitespace.`}return`[HeyCatch] WARNING: config.projectKey ${JSON.stringify(e)} does not look like a HeyCatch project key (expected "hck_pk_" followed by 32 letters, digits, "-" or "_"). Events sent with it will NEVER appear in your dashboard. ${r}`}var W="unknown",yo=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var _r=Ke({projectKey:U({error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'}).check(He(/^hck_pk_/,{error:'config.projectKey is missing or malformed \u2014 expected a string starting with "hck_pk_". Copy it from your project page in the HeyCatch dashboard.'})),tracingHosts:G(Be(U()),[]),install:G(Ke({framework:G(U(),W),frameworkVersion:G(U(),W),agent:G(U(),W)}),{framework:W,frameworkVersion:W,agent:W}),autocapture:v(M()),maskAllText:v(M()),maskAllElementAttributes:v(M()),propertyDenylist:v(Be(U())),sanitizeProperties:v(Ve(e=>typeof e=="function")),beforeSend:v(Ve(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:v(pr(yo)),disablePersistence:v(M()),cookieExpirationDays:v(Ue()),optOutCapturingByDefault:v(M()),respectDnt:v(M()),collectIp:v(M()),requestBatching:v(M()),flushIntervalMs:v(Ue()),site:dr(v(fr("landing")),e=>{let t=typeof e.value=="string"?JSON.stringify(e.value):`a ${typeof e.value}`;console.error(`[HeyCatch] config.site must be 'landing' or omitted - got ${t}. Ignoring it; this project is reported as untagged.`)})});var xr="[redacted]",bo=/(^|[#&?])(access_token|refresh_token|token_hash|token)=[^\s#&"'<>]+/gi,vo=/(^|[^\w-])eyJ[\w-]+\.[\w-]+\.[\w-]+/g;function yr(e){return e.replaceAll(bo,`$1$2=${xr}`).replaceAll(vo,`$1${xr}`)}var $o=new Set(["$anon_distinct_id","distinct_id"]),zo=["$set","$set_once"];function Je(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Xe(e){return typeof e=="string"?yr(e):Array.isArray(e)?wo(e):Je(e)?br(e,()=>!0):e}function wo(e){let t=e.map(r=>Xe(r));return t.some((r,n)=>r!==e[n])?t:e}function br(e,t){let r=!1,n=[];for(let[o,i]of Object.entries(e)){let c=t(o)?Xe(i):i;c!==i&&(r=!0),n.push([o,c])}return r?Object.fromEntries(n):e}function vr(e){if(!Je(e))return e;try{let t=!1,r={...e},{properties:n}=e;if(Je(n)){let o=br(n,i=>!$o.has(i));o!==n&&(t=!0,r.properties=o)}for(let o of zo){let i=e[o],c=Xe(i);c!==i&&(t=!0,r[o]=c)}return t?r:e}catch{return e}}function $r(e){return t=>{if(t?.event!=="$autocapture")return t;let r=e();if(r===null)return t;let n=t.properties??{};return"$process_person_profile"in n?t:{...t,properties:{...n,$process_person_profile:r._hasPersonProcessing()}}}}var ko=5e3,Po=60,Zo=1e3,So=60,Eo=new Set(["$set"]),Ye="heycatch_volume_cap_reached",zr=3,Co=6e4;function _e({bucket:e,perMinute:t,now:r}){if(e===void 0)return t;let n=Math.max(0,r-e.at);return Math.min(t,e.tokens+n*t/Co)}function Ao(e){return e===void 0||e.length===0?!1:nt(Io(e))}function Io(e){if(e.startsWith("[")){let r=e.indexOf("]");return r===-1?e:e.slice(0,r+1)}let t=e.indexOf(":");return t!==-1&&t===e.lastIndexOf(":")?e.slice(0,t):e}function wr(e){let{$session_id:t,$host:r}=e.properties;return{sessionId:typeof t=="string"?t:"",host:typeof r=="string"?r:void 0}}var Pr=4;function kr(e){if(e!==void 0)return typeof e=="object"&&e!==null&&"tokens"in e&&typeof e.tokens=="number"&&Number.isFinite(e.tokens)&&e.tokens>=0&&"at"in e&&typeof e.at=="number"&&Number.isFinite(e.at)?{tokens:e.tokens,at:e.at}:!1}function Ro(e){if(typeof e=="object"&&e!==null&&"sessionId"in e&&typeof e.sessionId=="string"&&"count"in e&&typeof e.count=="number"&&Number.isInteger(e.count)&&e.count>=0&&"markerAttempts"in e&&typeof e.markerAttempts=="number"&&Number.isInteger(e.markerAttempts)&&e.markerAttempts>=0){let t=kr("person"in e?e.person:void 0),r=kr("localhost"in e?e.localhost:void 0);if(t!==!1&&r!==!1)return{sessionId:e.sessionId,count:e.count,markerAttempts:e.markerAttempts,person:t,localhost:r}}return null}function Oo(e){if(e===null)return[];try{let t=JSON.parse(e);if(Array.isArray(t))return t.flatMap(r=>{let n=Ro(r);return n===null?[]:[n]}).slice(0,Pr)}catch{}return[]}function Zr({store:e,warn:t,emitMarker:r,cap:n=ko,personUpdateBudget:o=Po,localhostFreeEvents:i=Zo,localhostRatePerMinute:c=So,now:s=Date.now}){let u=[],a=!1,l=!1,f=!1,p=!1;function g(){if(e===void 0||a)return u;try{return Oo(e.read())}catch{return u}}function h(_){let y=g().filter(m=>m.sessionId!==_.sessionId);u=[_,...y].slice(0,Pr);try{e?.write(JSON.stringify(u))}catch{a=!0}}function x(_){let y=g().find($=>$.sessionId===_),m=u.find($=>$.sessionId===_),b=[y,m].filter($=>$!==void 0),B=s();function Y($,q){let L;for(let{[$]:K}of b)K!==void 0&&_e({bucket:K,perMinute:q,now:B})<_e({bucket:L,perMinute:q,now:B})&&(L=K);return L}return{sessionId:_,count:Math.max(0,...b.map($=>$.count)),markerAttempts:Math.max(0,...b.map($=>$.markerAttempts)),person:Y("person",o),localhost:Y("localhost",c)}}function z(_,y){let m=y,b=s(),{sessionId:B,host:Y}=wr(_);m.person!==void 0&&m.person.at>b&&(m={...m,person:{...m.person,at:b}},h(m)),m.localhost!==void 0&&m.localhost.at>b&&(m={...m,localhost:{...m.localhost,at:b}},h(m));let $=Eo.has(_.event),q=$?_e({bucket:m.person,perMinute:o,now:b}):0;if($&&q<1)return f||(f=!0,t(`[HeyCatch] setPersonProperties is being called more than ${o} times a minute - call it when a property changes, not on every render. Dropping the extra updates for now; other events are unaffected.`)),null;let L=m.count>=i&&Ao(Y),K=L?_e({bucket:m.localhost,perMinute:c,now:b}):0;return L&&K<1?(p||(p=!0,t(`[HeyCatch] this local dev session (${Y??"unknown host"}, session ${B||"unknown"}) sent ${i} events - throttling it to ${c} a minute so a dev loop cannot flood your analytics. Production traffic is unaffected.`)),null):(h({...m,count:m.count+1,...$?{person:{tokens:q-1,at:b}}:{},...L?{localhost:{tokens:K-1,at:b}}:{}}),_)}return _=>{if(_===null||_.event===Ye)return _;let{sessionId:y}=wr(_),m=x(y);return m.count<n?z(_,m):(l||(l=!0,t(`[HeyCatch] this session sent ${n} events, the per-session cap - dropping the rest until a new session starts (session ${y||"unknown"}). A tracking call inside a render loop or an effect is the usual cause.`)),m.markerAttempts<zr&&(h({...m,markerAttempts:zr}),r({cap:n,sessionId:y})||h({...m,markerAttempts:m.markerAttempts+1})),null)}}function Sr(e){let t=Zr({warn:r=>{console.warn(r)},emitMarker:({cap:r})=>{let n=e();return n?.capture(Ye,{heycatch_session_event_cap:r}),n!==null}});return r=>r===null||t({event:r.event,properties:r.properties??{}})===null?null:r}var se=null,Cr=null;function k(){return se}var qe=null;function Ar(){qe?.()}function Ir(e){if(se!==null)return;let t=_r.safeParse(e);if(!t.success){let c=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${c}`);return}let r=ut(t.data.collectIp!==!1),n=new Er.PostHog(mr,{host:We,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault},before_send:[$r(()=>se),Sr(()=>se),r.link,vr]}),{install:o}=t.data,i={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent};qe=()=>{n.register({heycatch_sdk_version:X,heycatch_sdk_stage:J,heycatch_project_key:t.data.projectKey,...i})},qe(),se=n,Cr=r,console.info(`[HeyCatch] SDK v${X} (${J}) initialized \u2192 ${We}`);for(let c of[hr(),gr(t.data.projectKey)])c!==null&&console.warn(c)}function Rr(e){at(Cr,e)}function Or(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function Tr(){k()?.optIn().catch(Or("opt-in"))}function Mr(){k()?.optOut().catch(Or("opt-out"))}var Nr=require("posthog-react-native");function Dr(e,t,r){let n=k();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] setIdentity() requires a non-empty string user id. Pass a stable internal user id from your auth provider \u2014 not an email or session token.");return}n.getPersistedProperty(Nr.PostHogPersistedProperty.PersonMode)==="identified"&&n.getDistinctId()!==e&&Qe(),n.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function Qe(){let e=k();e!==null&&(e.reset(),Ar())}function xe(e,t){let r=k();if(r!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackScreen() requires a non-empty screen name.");return}r.screen(e,t?t:void 0)}}function Lr(e,t,r){let n=k();if(n!==null){if(typeof e!="string"||e.length===0){console.error("[HeyCatch] trackEvent() requires a non-empty event name.");return}if(e.startsWith("$")){console.error(`[HeyCatch] trackEvent() event names cannot start with "$" (got "${e}") - that prefix is reserved for built-in events.`);return}n.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function jr(e,t){let r=k();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var Hr=require("posthog-react-native"),ye=require("react");function To(e){return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"}function Mo(){try{if(typeof require!="function")return null;let e=require("expo-router");return To(e)?e:null}catch{return null}}var et=Mo();var No=new Set(["code","jwt","otp","pin","pwd","sid","sig"]),Do=["credential","email","passcode","passwd","password","secret","session","signature","token"],Lo="#",jo=/[^\s@,]+@[^\s@,]+\.[^\s@,]+/;function Fo(e){return e.replaceAll(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[\s_-]+/).filter(t=>t.length>0)}function Ho(e,t){if(e===Lo)return!0;let r=e.toLowerCase().replaceAll(/[_-]/g,"");return r.startsWith("auth")||r.includes("key")||Do.some(n=>r.includes(n))||Fo(e).some(n=>No.has(n))?!0:typeof t=="string"&&jo.test(t)}function Fr(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,o]of Object.entries(t)){let i;if(typeof o=="string"||typeof o=="number"||typeof o=="boolean")i=o;else if(Array.isArray(o))i=o.filter(c=>typeof c=="string").join(",");else continue;Ho(n,i)||(r[n]=i)}return r}var ce=require("react/jsx-runtime");function Uo({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),o=JSON.stringify(t());return(0,ye.useEffect)(()=>{xe(n,Fr(o))},[n,o]),null}var tt=class extends ye.Component{state={failed:!1};static getDerivedStateFromError(){return{failed:!0}}componentDidCatch(t){console.error("[HeyCatch] Automatic screen views are off: an Expo Router hook threw. Call analytics.trackScreen(name) from your navigation instead.",t)}render(){return this.state.failed?null:this.props.children}};function Ur({children:e,trackScreens:t=!0}){let r=k();return r===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,ce.jsxs)(Hr.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:r,children:[!t||et===null?null:(0,ce.jsx)(tt,{children:(0,ce.jsx)(Uo,{router:et})}),e]})}var Bo={init:Ir,optInCapturing:Tr,optOutCapturing:Mr,resetIdentity:Qe,setIdentity:Dr,setIpCollection:Rr,setPersonProperties:jr,trackEvent:Lr,trackScreen:xe};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
2
2
  //# sourceMappingURL=react-native.cjs.map