@heycatch/sdk 0.7.0-dev.714 → 0.7.0-dev.974

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 H=Object.defineProperty;var Fe=Object.getOwnPropertyDescriptor;var Le=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Ue=(e,t)=>{for(var r in t)H(e,r,{get:t[r],enumerable:!0})},He=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Le(t))!De.call(e,i)&&i!==r&&H(e,i,{get:()=>t[i],enumerable:!(n=Fe(t,i))||n.enumerable});return e};var Ke=e=>He(H({},"__esModule",{value:!0}),e);var ht={};Ue(ht,{HeyCatchProvider:()=>Oe,SDK_VERSION:()=>v,STAGE:()=>x,analytics:()=>dt});module.exports=Ke(ht);var re="project",Be="[a-z0-9]",gt=new RegExp(`^${Be}$`);var Pe=require("posthog-react-native");var ne;function f(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=o.prototype,p=Object.keys(a);for(let m=0;m<p.length;m++){let l=p[m];l in s||(s[l]=a[l].bind(s))}}let i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function o(s){var u;let a=r?.Parent?new c:this;n(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ne=globalThis).__zod_globalConfig??(ne.__zod_globalConfig={});var K=globalThis.__zod_globalConfig;function z(e){return e&&Object.assign(K,e),K}function ie(e,t){return typeof t=="bigint"?t.toString():t}function se(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var oe=Symbol("evaluating");function $(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==oe)return n===void 0&&(n=oe,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var V="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ce(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(M(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function W(e){return ce(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function G(e,t,r){let n=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(n._zod.parent=e),n}function y(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 ue(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var vt={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]};function E(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 ae(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 J(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function b(e,t,r){let n=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}var pe=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,ie,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},le=f("$ZodError",pe),C=f("$ZodError",pe,{Parent:Error});var We=e=>(t,r,n,i)=>{let c=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise)throw new _;if(o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>b(u,c,z())));throw V(s,i?.callee),s}return o.value},R=We(C),Ge=e=>async(t,r,n,i)=>{let c=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>b(u,c,z())));throw V(s,i?.callee),s}return o.value},N=Ge(C),Je=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new _;return c.issues.length?{success:!1,error:new(e??le)(c.issues.map(o=>b(o,i,z())))}:{success:!0,data:c.value}},S=Je(C),Ye=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(o=>b(o,i,z())))}:{success:!0,data:c.value}},T=Ye(C);var qe="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Xe=new RegExp(`^${qe}$`);var fe=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var Y=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Qe=f("$ZodCheckStringFormat",(e,t)=>{var r,n;Y.init(e,t),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),de=f("$ZodCheckRegex",(e,t)=>{Qe.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 he={major:4,minor:4,patch:3};var w=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=he;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let c of i._zod.onattach)c(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,s,u)=>{let a=E(o),p;for(let m of s){if(m._zod.def.when){if(ae(o)||!m._zod.def.when(o))continue}else if(a)continue;let l=o.issues.length,d=m._zod.check(o);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,o.issues.length!==l&&(a||(a=E(o,l)))});else{if(o.issues.length===l)continue;a||(a=E(o,l))}}return p?p.then(()=>o):o},c=(o,s,u)=>{if(E(o))return o.aborted=!0,o;let a=i(s,n,u);if(a instanceof Promise){if(u.async===!1)throw new _;return a.then(p=>e._zod.parse(p,u))}return e._zod.parse(a,u)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let a=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,o,s)):c(a,o,s)}let u=e._zod.parse(o,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,n,s))}return i(u,n,s)}}$(e,"~standard",()=>({validate:i=>{try{let c=S(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return T(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),xe=f("$ZodString",(e,t)=>{w.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??fe(e._zod.bag),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}});function _e(e,t,r){e.issues.length&&t.issues.push(...J(r,e.issues)),t.value[r]=e.value}var ve=f("$ZodArray",(e,t)=>{w.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let c=[];for(let o=0;o<i.length;o++){let s=i[o],u=t.element._zod.run({value:s,issues:[]},n);u instanceof Promise?c.push(u.then(a=>_e(a,r,o))):_e(u,r,o)}return c.length?Promise.all(c).then(()=>r):r}});function O(e,t,r,n,i,c){let o=r in n;if(e.issues.length){if(i&&c&&!o)return;t.issues.push(...J(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function rt(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ue(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function nt(e,t,r,n,i,c){let o=[],s=i.keySet,u=i.catchall._zod,a=u.def.type,p=u.optin==="optional",m=u.optout==="optional";for(let l in t){if(l==="__proto__"||s.has(l))continue;if(a==="never"){o.push(l);continue}let d=u.run({value:t[l],issues:[]},n);d instanceof Promise?e.push(d.then(g=>O(g,r,l,t,p,m))):O(d,r,l,t,p,m)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var ze=f("$ZodObject",(e,t)=>{if(w.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=se(()=>rt(t));$(e._zod,"propValues",()=>{let s=t.shape,u={};for(let a in s){let p=s[a]._zod;if(p.values){u[a]??(u[a]=new Set);for(let m of p.values)u[a].add(m)}}return u});let i=M,c=t.catchall,o;e._zod.parse=(s,u)=>{o??(o=n.value);let a=s.value;if(!i(a))return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;s.value={};let p=[],m=o.shape;for(let l of o.keys){let d=m[l],g=d._zod.optin==="optional",te=d._zod.optout==="optional",U=d._zod.run({value:a[l],issues:[]},u);U instanceof Promise?p.push(U.then(je=>O(je,s,l,a,g,te))):O(U,s,l,a,g,te)}return c?nt(p,a,s,u,n.value,e):p.length?Promise.all(p).then(()=>s):s}});var $e=f("$ZodDefault",(e,t)=>{w.init(e,t),e._zod.optin="optional",$(e._zod,"values",()=>t.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 i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(c=>ge(c,t)):ge(i,t)}});function ge(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function ye(e,t){return new e({type:"string",...y(t)})}function q(e,t){return new de({check:"string_format",format:"regex",...y(t),pattern:e})}var j=f("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");w.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>R(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>S(e,r,n),e.parseAsync=async(r,n)=>N(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>T(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>G(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),it=f("ZodMiniString",(e,t)=>{xe.init(e,t),j.init(e,t)});function Z(e){return ye(it,e)}var st=f("ZodMiniArray",(e,t)=>{ve.init(e,t),j.init(e,t)});function be(e,t){return new st({type:"array",element:e,...y(t)})}var ct=f("ZodMiniObject",(e,t)=>{ze.init(e,t),j.init(e,t),$(e,"shape",()=>t.shape)});function X(e,t){let r={type:"object",shape:e??{},...y(t)};return new ct(r)}var ut=f("ZodMiniDefault",(e,t)=>{$e.init(e,t),j.init(e,t)});function k(e,t){return new ut({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():W(t)}})}var F="https://in.dev.heycatch.ai",x="dev",v="0.7.0-dev.714",we="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ze(e=x){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${v}). 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 P="unknown",ke=X({projectKey:Z({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(q(/^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:k(be(Z()),[]),install:k(X({framework:k(Z(),P),frameworkVersion:k(Z(),P),agent:k(Z(),P)}),{framework:P,frameworkVersion:P,agent:P})});var Q=null;function h(){return Q}var ee=null;function Ee(){ee?.()}function Ae(e){if(Q!==null)return;let t=ke.safeParse(e);if(!t.success){let o=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${o}`);return}let r=new Pe.PostHog(we,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:n}=t.data,i={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};ee=()=>{r.register({heycatch_sdk_version:v,heycatch_sdk_stage:x,heycatch_project_key:t.data.projectKey,...i}),r.group(re,t.data.projectKey,{key:t.data.projectKey,sdk_version:v,sdk_stage:x,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:F})},ee(),Q=r,console.info(`[HeyCatch] SDK v${v} (${x}) initialized \u2192 ${F}`);let c=Ze();c!==null&&console.warn(c)}function Ce(e,t,r){let n=h();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.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function Se(){let e=h();e!==null&&(e.reset(),Ee())}function L(e,t){let r=h();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 Te(e,t,r){let n=h();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 Ie(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var Re=require("posthog-react-native"),Ne=require("react");var D=require("react/jsx-runtime");function lt(){try{if(typeof require!="function")return null;let e=require("expo-router");return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"?{usePathname:e.usePathname,useGlobalSearchParams:e.useGlobalSearchParams}:null}catch{return null}}var Me=lt();function ft(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[n]=i;continue}Array.isArray(i)&&(r[n]=i.filter(c=>typeof c=="string").join(","))}return r}function mt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),i=JSON.stringify(t());return(0,Ne.useEffect)(()=>{L(n,ft(i))},[n,i]),null}function Oe({children:e}){let t=h();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,D.jsxs)(Re.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Me===null?null:(0,D.jsx)(mt,{router:Me}),e]})}var dt={init:Ae,resetIdentity:Se,setIdentity:Ce,setPersonProperties:Ie,trackEvent:Te,trackScreen:L};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
1
+ "use strict";var V=Object.defineProperty;var ft=Object.getOwnPropertyDescriptor;var dt=Object.getOwnPropertyNames;var mt=Object.prototype.hasOwnProperty;var ht=(e,t)=>{for(var r in t)V(e,r,{get:t[r],enumerable:!0})},_t=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of dt(t))!mt.call(e,n)&&n!==r&&V(e,n,{get:()=>t[n],enumerable:!(o=ft(t,n))||o.enumerable});return e};var gt=e=>_t(V({},"__esModule",{value:!0}),e);var Kt={};ht(Kt,{HeyCatchProvider:()=>pt,SDK_VERSION:()=>k,STAGE:()=>Z,analytics:()=>Bt});module.exports=gt(Kt);var ce="project",xt="[a-z0-9]",Wt=new RegExp(`^${xt}$`);var qe=require("posthog-react-native");var ue;function p(e,t,r){function o(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let a=i.prototype,l=Object.keys(a);for(let d=0;d<l.length;d++){let f=l[d];f in c||(c[f]=a[f].bind(c))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(c){var u;let a=r?.Parent?new s:this;o(a,c),(u=a._zod).deferred??(u.deferred=[]);for(let l of a._zod.deferred)l();return a}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var v=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ue=globalThis).__zod_globalConfig??(ue.__zod_globalConfig={});var W=globalThis.__zod_globalConfig;function P(e){return e&&Object.assign(W,e),W}function pe(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function le(e,t){return typeof t=="bigint"?t.toString():t}function fe(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function de(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var ae=Symbol("evaluating");function $(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==ae)return o===void 0&&(o=ae,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}var J="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function me(e){if(j(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(j(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function Y(e){return me(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var he=new Set(["string","number","symbol"]);function _e(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function q(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function x(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 ge(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Jt={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]};function S(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 xe(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 X(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function N(e){return typeof e=="string"?e:e?.message}function E(e,t,r){let o=e.message?e.message:N(e.inst?._zod.def?.error?.(e))??N(t?.error?.(e))??N(r.customError?.(e))??N(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...c}=e;return c.path??(c.path=[]),c.message=o,t?.reportInput&&(c.input=i),c}function Q(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}var ve=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,le,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ze=p("$ZodError",ve),T=p("$ZodError",ve,{Parent:Error});var zt=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new v;if(i.issues.length){let c=new(n?.Err??e)(i.issues.map(u=>E(u,s,P())));throw J(c,n?.callee),c}return i.value},D=zt(T),$t=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let c=new(n?.Err??e)(i.issues.map(u=>E(u,s,P())));throw J(c,n?.callee),c}return i.value},F=$t(T),yt=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new v;return s.issues.length?{success:!1,error:new(e??ze)(s.issues.map(i=>E(i,n,P())))}:{success:!0,data:s.value}},M=yt(T),bt=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>E(i,n,P())))}:{success:!0,data:s.value}},R=bt(T);var wt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",Zt=new RegExp(`^${wt}$`);var $e=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var ye=/^-?\d+(?:\.\d+)?$/,be=/^(?:true|false)$/i;var O=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ze=p("$ZodCheckStringFormat",(e,t)=>{var r,o;O.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),ke=p("$ZodCheckRegex",(e,t)=>{Ze.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 Ee={major:4,minor:4,patch:3};var g=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Ee;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,c,u)=>{let a=S(i),l;for(let d of c){if(d._zod.def.when){if(xe(i)||!d._zod.def.when(i))continue}else if(a)continue;let f=i.issues.length,_=d._zod.check(i);if(_ instanceof Promise&&u?.async===!1)throw new v;if(l||_ instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await _,i.issues.length!==f&&(a||(a=S(i,f)))});else{if(i.issues.length===f)continue;a||(a=S(i,f))}}return l?l.then(()=>i):i},s=(i,c,u)=>{if(S(i))return i.aborted=!0,i;let a=n(c,o,u);if(a instanceof Promise){if(u.async===!1)throw new v;return a.then(l=>e._zod.parse(l,u))}return e._zod.parse(a,u)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let a=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return a instanceof Promise?a.then(l=>s(l,i,c)):s(a,i,c)}let u=e._zod.parse(i,c);if(u instanceof Promise){if(c.async===!1)throw new v;return u.then(a=>n(a,o,c))}return n(u,o,c)}}$(e,"~standard",()=>({validate:n=>{try{let s=M(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return R(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Te=p("$ZodString",(e,t)=>{g.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??$e(e._zod.bag),e._zod.parse=(r,o)=>{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 Me=p("$ZodNumber",(e,t)=>{g.init(e,t),e._zod.pattern=e._zod.bag.pattern??ye,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}});var Re=p("$ZodBoolean",(e,t)=>{g.init(e,t),e._zod.pattern=be,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});function Ce(e,t,r){e.issues.length&&t.issues.push(...X(r,e.issues)),t.value[r]=e.value}var Oe=p("$ZodArray",(e,t)=>{g.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let c=n[i],u=t.element._zod.run({value:c,issues:[]},o);u instanceof Promise?s.push(u.then(a=>Ce(a,r,i))):Ce(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function L(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...X(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function kt(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=ge(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Pt(e,t,r,o,n,s){let i=[],c=n.keySet,u=n.catchall._zod,a=u.def.type,l=u.optin==="optional",d=u.optout==="optional";for(let f in t){if(f==="__proto__"||c.has(f))continue;if(a==="never"){i.push(f);continue}let _=u.run({value:t[f],issues:[]},o);_ instanceof Promise?e.push(_.then(y=>L(y,r,f,t,l,d))):L(_,r,f,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var Ne=p("$ZodObject",(e,t)=>{if(g.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}let o=fe(()=>kt(t));$(e._zod,"propValues",()=>{let c=t.shape,u={};for(let a in c){let l=c[a]._zod;if(l.values){u[a]??(u[a]=new Set);for(let d of l.values)u[a].add(d)}}return u});let n=j,s=t.catchall,i;e._zod.parse=(c,u)=>{i??(i=o.value);let a=c.value;if(!n(a))return c.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),c;c.value={};let l=[],d=i.shape;for(let f of i.keys){let _=d[f],y=_._zod.optin==="optional",se=_._zod.optout==="optional",K=_._zod.run({value:a[f],issues:[]},u);K instanceof Promise?l.push(K.then(lt=>L(lt,c,f,a,y,se))):L(K,c,f,a,y,se)}return s?Pt(l,a,c,u,o.value,e):l.length?Promise.all(l).then(()=>c):c}});var je=p("$ZodEnum",(e,t)=>{g.init(e,t);let r=pe(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>he.has(typeof n)).map(n=>typeof n=="string"?_e(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}});function Ae(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var De=p("$ZodOptional",(e,t)=>{g.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${de(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>Ae(i,n)):Ae(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}});var Fe=p("$ZodDefault",(e,t)=>{g.init(e,t),e._zod.optin="optional",$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Se(s,t)):Se(n,t)}});function Se(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Le=p("$ZodCustom",(e,t)=>{O.init(e,t),g.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Ie(s,r,o,e));Ie(n,r,o,e)}});function Ie(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(Q(n))}}function Ue(e,t){return new e({type:"string",...x(t)})}function He(e,t){return new e({type:"number",checks:[],...x(t)})}function Be(e,t){return new e({type:"boolean",...x(t)})}function ee(e,t){return new ke({check:"string_format",format:"regex",...x(t),pattern:e})}function Ke(e,t,r){let o=x(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}var z=p("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");g.init(e,t),e.def=t,e.type=t.type,e.parse=(r,o)=>D(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>M(e,r,o),e.parseAsync=async(r,o)=>F(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>R(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(r,o)=>q(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.apply=r=>r(e)}),Ct=p("ZodMiniString",(e,t)=>{Te.init(e,t),z.init(e,t)});function b(e){return Ue(Ct,e)}var At=p("ZodMiniNumber",(e,t)=>{Me.init(e,t),z.init(e,t)});function Ve(e){return He(At,e)}var St=p("ZodMiniBoolean",(e,t)=>{Re.init(e,t),z.init(e,t)});function w(e){return Be(St,e)}var It=p("ZodMiniArray",(e,t)=>{Oe.init(e,t),z.init(e,t)});function te(e,t){return new It({type:"array",element:e,...x(t)})}var Tt=p("ZodMiniObject",(e,t)=>{Ne.init(e,t),z.init(e,t),$(e,"shape",()=>t.shape)});function re(e,t){let r={type:"object",shape:e??{},...x(t)};return new Tt(r)}var Mt=p("ZodMiniEnum",(e,t)=>{je.init(e,t),z.init(e,t),e.options=Object.values(t.entries)});function We(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new Mt({type:"enum",entries:r,...x(t)})}var Rt=p("ZodMiniOptional",(e,t)=>{De.init(e,t),z.init(e,t)});function h(e){return new Rt({type:"optional",innerType:e})}var Ot=p("ZodMiniDefault",(e,t)=>{Fe.init(e,t),z.init(e,t)});function C(e,t){return new Ot({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():Y(t)}})}var Nt=p("ZodMiniCustom",(e,t)=>{Le.init(e,t),z.init(e,t)});function oe(e,t){return Ke(Nt,e??(()=>!0),t)}var U="https://in.dev.heycatch.ai",Z="dev",k="0.7.0-dev.974",Ge="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Je(e=Z){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${k}). 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 A="unknown",Ft=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var Ye=re({projectKey:b({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(ee(/^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:C(te(b()),[]),install:C(re({framework:C(b(),A),frameworkVersion:C(b(),A),agent:C(b(),A)}),{framework:A,frameworkVersion:A,agent:A}),autocapture:h(w()),maskAllText:h(w()),maskAllElementAttributes:h(w()),propertyDenylist:h(te(b())),sanitizeProperties:h(oe(e=>typeof e=="function")),beforeSend:h(oe(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:h(We(Ft)),disablePersistence:h(w()),cookieExpirationDays:h(Ve()),optOutCapturingByDefault:h(w()),respectDnt:h(w())});var ne=null;function m(){return ne}var ie=null;function Xe(){ie?.()}function Qe(e){if(ne!==null)return;let t=Ye.safeParse(e);if(!t.success){let i=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${i}`);return}let r=new qe.PostHog(Ge,{host:U,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault}}),{install:o}=t.data,n={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent};ie=()=>{r.register({heycatch_sdk_version:k,heycatch_sdk_stage:Z,heycatch_project_key:t.data.projectKey,...n}),r.group(ce,t.data.projectKey,{key:t.data.projectKey,sdk_version:k,sdk_stage:Z,framework:o.framework,framework_version:o.frameworkVersion,agent:o.agent,api_host:U})},ie(),ne=r,console.info(`[HeyCatch] SDK v${k} (${Z}) initialized \u2192 ${U}`);let s=Je();s!==null&&console.warn(s)}function et(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function tt(){m()?.optIn().catch(et("opt-in"))}function rt(){m()?.optOut().catch(et("opt-out"))}function ot(e,t,r){let o=m();if(o!==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}o.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function nt(){let e=m();e!==null&&(e.reset(),Xe())}function H(e,t){let r=m();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 it(e,t,r){let o=m();if(o!==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}o.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function st(e,t){let r=m();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var ut=require("posthog-react-native"),at=require("react");var B=require("react/jsx-runtime");function Lt(){try{if(typeof require!="function")return null;let e=require("expo-router");return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"?{usePathname:e.usePathname,useGlobalSearchParams:e.useGlobalSearchParams}:null}catch{return null}}var ct=Lt();function Ut(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[o,n]of Object.entries(t)){if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){r[o]=n;continue}Array.isArray(n)&&(r[o]=n.filter(s=>typeof s=="string").join(","))}return r}function Ht({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,o=r(),n=JSON.stringify(t());return(0,at.useEffect)(()=>{H(o,Ut(n))},[o,n]),null}function pt({children:e}){let t=m();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):(0,B.jsxs)(ut.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[ct===null?null:(0,B.jsx)(Ht,{router:ct}),e]})}var Bt={init:Qe,optInCapturing:tt,optOutCapturing:rt,resetIdentity:nt,setIdentity:ot,setPersonProperties:st,trackEvent:it,trackScreen:H};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
2
2
  //# sourceMappingURL=react-native.cjs.map
@@ -1,7 +1,23 @@
1
- import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, T as TrackOptions } from './shared-X3O5yyhh.cjs';
2
- export { P as PersonPropertyUpdate, S as SDK_VERSION, d as STAGE, e as ServerTrackOptions } from './shared-X3O5yyhh.cjs';
1
+ import { d as HeyCatchPersonProperties, b as HeyCatchConfig, e as HeyCatchProperties, T as TrackOptions } from './shared-CaIZ-Tgs.cjs';
2
+ export { H as HeyCatchBeforeSend, a as HeyCatchCapturedEvent, c as HeyCatchPersistence, f as HeyCatchSanitizeProperties, P as PersonPropertyUpdate, S as SDK_VERSION, h as STAGE, i as ServerTrackOptions } from './shared-CaIZ-Tgs.cjs';
3
3
  import { ReactNode } from 'react';
4
4
 
5
+ /**
6
+ * The consent pair on native, where it is a REAL gate, not a no-op: the
7
+ * native transport has its own persisted opt-out, and `init()` wires
8
+ * `optOutCapturingByDefault` to it. A native app under GDPR needs a consent
9
+ * banner exactly as much as a web app does.
10
+ *
11
+ * Synchronous, matching the web spelling, so one signature serves shared
12
+ * code. Nothing awaits the write - the transport queues captures behind its
13
+ * own storage load - but a failure is reported rather than dropped.
14
+ *
15
+ * No-op before `init()`.
16
+ */
17
+ declare function optInCapturing(): void;
18
+ /** The withdraw half. No-op before `init()`. */
19
+ declare function optOutCapturing(): void;
20
+
5
21
  /**
6
22
  * Link the device's anonymous visitor to the authenticated user. Same
7
23
  * contract as the web entry: a stable internal user id - never an email or
@@ -82,6 +98,8 @@ declare function HeyCatchProvider({ children, }: {
82
98
  */
83
99
  declare const analytics: {
84
100
  readonly init: typeof init;
101
+ readonly optInCapturing: typeof optInCapturing;
102
+ readonly optOutCapturing: typeof optOutCapturing;
85
103
  readonly resetIdentity: typeof resetIdentity;
86
104
  readonly setIdentity: typeof setIdentity;
87
105
  readonly setPersonProperties: typeof setPersonProperties;
@@ -1,7 +1,23 @@
1
- import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, T as TrackOptions } from './shared-X3O5yyhh.js';
2
- export { P as PersonPropertyUpdate, S as SDK_VERSION, d as STAGE, e as ServerTrackOptions } from './shared-X3O5yyhh.js';
1
+ import { d as HeyCatchPersonProperties, b as HeyCatchConfig, e as HeyCatchProperties, T as TrackOptions } from './shared-CaIZ-Tgs.js';
2
+ export { H as HeyCatchBeforeSend, a as HeyCatchCapturedEvent, c as HeyCatchPersistence, f as HeyCatchSanitizeProperties, P as PersonPropertyUpdate, S as SDK_VERSION, h as STAGE, i as ServerTrackOptions } from './shared-CaIZ-Tgs.js';
3
3
  import { ReactNode } from 'react';
4
4
 
5
+ /**
6
+ * The consent pair on native, where it is a REAL gate, not a no-op: the
7
+ * native transport has its own persisted opt-out, and `init()` wires
8
+ * `optOutCapturingByDefault` to it. A native app under GDPR needs a consent
9
+ * banner exactly as much as a web app does.
10
+ *
11
+ * Synchronous, matching the web spelling, so one signature serves shared
12
+ * code. Nothing awaits the write - the transport queues captures behind its
13
+ * own storage load - but a failure is reported rather than dropped.
14
+ *
15
+ * No-op before `init()`.
16
+ */
17
+ declare function optInCapturing(): void;
18
+ /** The withdraw half. No-op before `init()`. */
19
+ declare function optOutCapturing(): void;
20
+
5
21
  /**
6
22
  * Link the device's anonymous visitor to the authenticated user. Same
7
23
  * contract as the web entry: a stable internal user id - never an email or
@@ -82,6 +98,8 @@ declare function HeyCatchProvider({ children, }: {
82
98
  */
83
99
  declare const analytics: {
84
100
  readonly init: typeof init;
101
+ readonly optInCapturing: typeof optInCapturing;
102
+ readonly optOutCapturing: typeof optOutCapturing;
85
103
  readonly resetIdentity: typeof resetIdentity;
86
104
  readonly setIdentity: typeof setIdentity;
87
105
  readonly setPersonProperties: typeof setPersonProperties;
@@ -1,2 +1,2 @@
1
- var U=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var te="project",Me="[a-z0-9]",pt=new RegExp(`^${Me}$`);import{PostHog as et}from"posthog-react-native";var re;function f(e,t,r){function n(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:o,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=o.prototype,p=Object.keys(a);for(let m=0;m<p.length;m++){let l=p[m];l in s||(s[l]=a[l].bind(s))}}let i=r?.Parent??Object;class c extends i{}Object.defineProperty(c,"name",{value:e});function o(s){var u;let a=r?.Parent?new c:this;n(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(o,"init",{value:n}),Object.defineProperty(o,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(re=globalThis).__zod_globalConfig??(re.__zod_globalConfig={});var H=globalThis.__zod_globalConfig;function x(e){return e&&Object.assign(H,e),H}function oe(e,t){return typeof t=="bigint"?t.toString():t}function ie(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}var ne=Symbol("evaluating");function v(e,t,r){let n;Object.defineProperty(e,t,{get(){if(n!==ne)return n===void 0&&(n=ne,n=r()),n},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var B="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function M(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function se(e){if(M(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(M(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function V(e){return se(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}function W(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 ce(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var ft={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]};function E(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 ue(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 G(e,t){return t.map(r=>{var n;return(n=r).path??(n.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function $(e,t,r){let n=e.message?e.message:I(e.inst?._zod.def?.error?.(e))??I(t?.error?.(e))??I(r.customError?.(e))??I(r.localeError?.(e))??"Invalid input",{inst:i,continue:c,input:o,...s}=e;return s.path??(s.path=[]),s.message=n,t?.reportInput&&(s.input=o),s}var ae=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,oe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pe=f("$ZodError",ae),C=f("$ZodError",ae,{Parent:Error});var Ne=e=>(t,r,n,i)=>{let c=n?{...n,async:!1}:{async:!1},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise)throw new _;if(o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>$(u,c,x())));throw B(s,i?.callee),s}return o.value},R=Ne(C),Oe=e=>async(t,r,n,i)=>{let c=n?{...n,async:!0}:{async:!0},o=t._zod.run({value:r,issues:[]},c);if(o instanceof Promise&&(o=await o),o.issues.length){let s=new(i?.Err??e)(o.issues.map(u=>$(u,c,x())));throw B(s,i?.callee),s}return o.value},N=Oe(C),je=e=>(t,r,n)=>{let i=n?{...n,async:!1}:{async:!1},c=t._zod.run({value:r,issues:[]},i);if(c instanceof Promise)throw new _;return c.issues.length?{success:!1,error:new(e??pe)(c.issues.map(o=>$(o,i,x())))}:{success:!0,data:c.value}},S=je(C),Fe=e=>async(t,r,n)=>{let i=n?{...n,async:!0}:{async:!0},c=t._zod.run({value:r,issues:[]},i);return c instanceof Promise&&(c=await c),c.issues.length?{success:!1,error:new e(c.issues.map(o=>$(o,i,x())))}:{success:!0,data:c.value}},T=Fe(C);var Le="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",De=new RegExp(`^${Le}$`);var le=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var J=f("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var Ue=f("$ZodCheckStringFormat",(e,t)=>{var r,n;J.init(e,t),e._zod.onattach.push(i=>{let c=i._zod.bag;c.format=t.format,t.pattern&&(c.patterns??(c.patterns=new Set),c.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=i=>{t.pattern.lastIndex=0,!t.pattern.test(i.value)&&i.issues.push({origin:"string",code:"invalid_format",format:t.format,input:i.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(n=e._zod).check??(n.check=()=>{})}),me=f("$ZodCheckRegex",(e,t)=>{Ue.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 de={major:4,minor:4,patch:3};var y=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=de;let n=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&n.unshift(e);for(let i of n)for(let c of i._zod.onattach)c(e);if(n.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let i=(o,s,u)=>{let a=E(o),p;for(let m of s){if(m._zod.def.when){if(ue(o)||!m._zod.def.when(o))continue}else if(a)continue;let l=o.issues.length,d=m._zod.check(o);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,o.issues.length!==l&&(a||(a=E(o,l)))});else{if(o.issues.length===l)continue;a||(a=E(o,l))}}return p?p.then(()=>o):o},c=(o,s,u)=>{if(E(o))return o.aborted=!0,o;let a=i(s,n,u);if(a instanceof Promise){if(u.async===!1)throw new _;return a.then(p=>e._zod.parse(p,u))}return e._zod.parse(a,u)};e._zod.run=(o,s)=>{if(s.skipChecks)return e._zod.parse(o,s);if(s.direction==="backward"){let a=e._zod.parse({value:o.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,o,s)):c(a,o,s)}let u=e._zod.parse(o,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,n,s))}return i(u,n,s)}}v(e,"~standard",()=>({validate:i=>{try{let c=S(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return T(e,i).then(o=>o.success?{value:o.data}:{issues:o.error?.issues})}},vendor:"zod",version:1}))}),ge=f("$ZodString",(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??le(e._zod.bag),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}});function he(e,t,r){e.issues.length&&t.issues.push(...G(r,e.issues)),t.value[r]=e.value}var xe=f("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,n)=>{let i=r.value;if(!Array.isArray(i))return r.issues.push({expected:"array",code:"invalid_type",input:i,inst:e}),r;r.value=Array(i.length);let c=[];for(let o=0;o<i.length;o++){let s=i[o],u=t.element._zod.run({value:s,issues:[]},n);u instanceof Promise?c.push(u.then(a=>he(a,r,o))):he(u,r,o)}return c.length?Promise.all(c).then(()=>r):r}});function O(e,t,r,n,i,c){let o=r in n;if(e.issues.length){if(i&&c&&!o)return;t.issues.push(...G(r,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?o&&(t.value[r]=void 0):t.value[r]=e.value}function Be(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${n}": expected a Zod schema`);let r=ce(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ve(e,t,r,n,i,c){let o=[],s=i.keySet,u=i.catchall._zod,a=u.def.type,p=u.optin==="optional",m=u.optout==="optional";for(let l in t){if(l==="__proto__"||s.has(l))continue;if(a==="never"){o.push(l);continue}let d=u.run({value:t[l],issues:[]},n);d instanceof Promise?e.push(d.then(g=>O(g,r,l,t,p,m))):O(d,r,l,t,p,m)}return o.length&&r.issues.push({code:"unrecognized_keys",keys:o,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var ve=f("$ZodObject",(e,t)=>{if(y.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let s=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...s};return Object.defineProperty(t,"shape",{value:u}),u}})}let n=ie(()=>Be(t));v(e._zod,"propValues",()=>{let s=t.shape,u={};for(let a in s){let p=s[a]._zod;if(p.values){u[a]??(u[a]=new Set);for(let m of p.values)u[a].add(m)}}return u});let i=M,c=t.catchall,o;e._zod.parse=(s,u)=>{o??(o=n.value);let a=s.value;if(!i(a))return s.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),s;s.value={};let p=[],m=o.shape;for(let l of o.keys){let d=m[l],g=d._zod.optin==="optional",ee=d._zod.optout==="optional",D=d._zod.run({value:a[l],issues:[]},u);D instanceof Promise?p.push(D.then(Ie=>O(Ie,s,l,a,g,ee))):O(D,s,l,a,g,ee)}return c?Ve(p,a,s,u,n.value,e):p.length?Promise.all(p).then(()=>s):s}});var ze=f("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",v(e._zod,"values",()=>t.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 i=t.innerType._zod.run(r,n);return i instanceof Promise?i.then(c=>_e(c,t)):_e(i,t)}});function _e(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}function $e(e,t){return new e({type:"string",...z(t)})}function Y(e,t){return new me({check:"string_format",format:"regex",...z(t),pattern:e})}var j=f("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");y.init(e,t),e.def=t,e.type=t.type,e.parse=(r,n)=>R(e,r,n,{callee:e.parse}),e.safeParse=(r,n)=>S(e,r,n),e.parseAsync=async(r,n)=>N(e,r,n,{callee:e.parseAsync}),e.safeParseAsync=async(r,n)=>T(e,r,n),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(n=>typeof n=="function"?{_zod:{check:n,def:{check:"custom"},onattach:[]}}:n)]},{parent:!0}),e.with=e.check,e.clone=(r,n)=>W(e,r,n),e.brand=()=>e,e.register=((r,n)=>(r.add(e,n),e)),e.apply=r=>r(e)}),Ge=f("ZodMiniString",(e,t)=>{ge.init(e,t),j.init(e,t)});function b(e){return $e(Ge,e)}var Je=f("ZodMiniArray",(e,t)=>{xe.init(e,t),j.init(e,t)});function ye(e,t){return new Je({type:"array",element:e,...z(t)})}var Ye=f("ZodMiniObject",(e,t)=>{ve.init(e,t),j.init(e,t),v(e,"shape",()=>t.shape)});function q(e,t){let r={type:"object",shape:e??{},...z(t)};return new Ye(r)}var qe=f("ZodMiniDefault",(e,t)=>{ze.init(e,t),j.init(e,t)});function w(e,t){return new qe({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():V(t)}})}var F="https://in.dev.heycatch.ai",k="dev",P="0.7.0-dev.714",be="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function we(e=k){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${P}). 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 Z="unknown",Ze=q({projectKey:b({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(Y(/^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:w(ye(b()),[]),install:w(q({framework:w(b(),Z),frameworkVersion:w(b(),Z),agent:w(b(),Z)}),{framework:Z,frameworkVersion:Z,agent:Z})});var X=null;function h(){return X}var Q=null;function ke(){Q?.()}function Pe(e){if(X!==null)return;let t=Ze.safeParse(e);if(!t.success){let o=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${o}`);return}let r=new et(be,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:n}=t.data,i={heycatch_framework:n.framework,heycatch_framework_version:n.frameworkVersion,heycatch_agent:n.agent};Q=()=>{r.register({heycatch_sdk_version:P,heycatch_sdk_stage:k,heycatch_project_key:t.data.projectKey,...i}),r.group(te,t.data.projectKey,{key:t.data.projectKey,sdk_version:P,sdk_stage:k,framework:n.framework,framework_version:n.frameworkVersion,agent:n.agent,api_host:F})},Q(),X=r,console.info(`[HeyCatch] SDK v${P} (${k}) initialized \u2192 ${F}`);let c=we();c!==null&&console.warn(c)}function Ee(e,t,r){let n=h();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.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function Ae(){let e=h();e!==null&&(e.reset(),ke())}function L(e,t){let r=h();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 Ce(e,t,r){let n=h();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 Se(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}import{PostHogProvider as tt}from"posthog-react-native";import{useEffect as rt}from"react";import{jsx as ct,jsxs as ut}from"react/jsx-runtime";function nt(){try{if(typeof U!="function")return null;let e=U("expo-router");return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"?{usePathname:e.usePathname,useGlobalSearchParams:e.useGlobalSearchParams}:null}catch{return null}}var Te=nt();function ot(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[n,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[n]=i;continue}Array.isArray(i)&&(r[n]=i.filter(c=>typeof c=="string").join(","))}return r}function it({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,n=r(),i=JSON.stringify(t());return rt(()=>{L(n,ot(i))},[n,i]),null}function st({children:e}){let t=h();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):ut(tt,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Te===null?null:ct(it,{router:Te}),e]})}var Li={init:Pe,resetIdentity:Ae,setIdentity:Ee,setPersonProperties:Se,trackEvent:Ce,trackScreen:L};export{st as HeyCatchProvider,P as SDK_VERSION,k as STAGE,Li as analytics};
1
+ var K=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,r)=>(typeof require<"u"?require:t)[r]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var se="project",ct="[a-z0-9]",Ft=new RegExp(`^${ct}$`);import{PostHog as At}from"posthog-react-native";var ce;function p(e,t,r){function o(c,u){if(c._zod||Object.defineProperty(c,"_zod",{value:{def:u,constr:i,traits:new Set},enumerable:!1}),c._zod.traits.has(e))return;c._zod.traits.add(e),t(c,u);let a=i.prototype,l=Object.keys(a);for(let d=0;d<l.length;d++){let f=l[d];f in c||(c[f]=a[f].bind(c))}}let n=r?.Parent??Object;class s extends n{}Object.defineProperty(s,"name",{value:e});function i(c){var u;let a=r?.Parent?new s:this;o(a,c),(u=a._zod).deferred??(u.deferred=[]);for(let l of a._zod.deferred)l();return a}return Object.defineProperty(i,"init",{value:o}),Object.defineProperty(i,Symbol.hasInstance,{value:c=>r?.Parent&&c instanceof r.Parent?!0:c?._zod?.traits?.has(e)}),Object.defineProperty(i,"name",{value:e}),i}var v=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(ce=globalThis).__zod_globalConfig??(ce.__zod_globalConfig={});var V=globalThis.__zod_globalConfig;function Z(e){return e&&Object.assign(V,e),V}function ae(e){let t=Object.values(e).filter(o=>typeof o=="number");return Object.entries(e).filter(([o,n])=>t.indexOf(+o)===-1).map(([o,n])=>n)}function pe(e,t){return typeof t=="bigint"?t.toString():t}function le(e){return{get value(){{let r=e();return Object.defineProperty(this,"value",{value:r}),r}throw new Error("cached value already set")}}}function fe(e){let t=e.startsWith("^")?1:0,r=e.endsWith("$")?e.length-1:e.length;return e.slice(t,r)}var ue=Symbol("evaluating");function $(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==ue)return o===void 0&&(o=ue,o=r()),o},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}var G="captureStackTrace"in Error?Error.captureStackTrace:(...e)=>{};function j(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function de(e){if(j(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!="function")return!0;let r=t.prototype;return!(j(r)===!1||Object.prototype.hasOwnProperty.call(r,"isPrototypeOf")===!1)}function J(e){return de(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var me=new Set(["string","number","symbol"]);function he(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Y(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function x(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 _e(e){return Object.keys(e).filter(t=>e[t]._zod.optin==="optional"&&e[t]._zod.optout==="optional")}var Ut={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]};function S(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 ge(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 q(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function N(e){return typeof e=="string"?e:e?.message}function k(e,t,r){let o=e.message?e.message:N(e.inst?._zod.def?.error?.(e))??N(t?.error?.(e))??N(r.customError?.(e))??N(r.localeError?.(e))??"Invalid input",{inst:n,continue:s,input:i,...c}=e;return c.path??(c.path=[]),c.message=o,t?.reportInput&&(c.input=i),c}function X(...e){let[t,r,o]=e;return typeof t=="string"?{message:t,code:"custom",input:r,inst:o}:{...t}}var xe=(e,t)=>{e.name="$ZodError",Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,pe,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},ve=p("$ZodError",xe),T=p("$ZodError",xe,{Parent:Error});var at=e=>(t,r,o,n)=>{let s=o?{...o,async:!1}:{async:!1},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise)throw new v;if(i.issues.length){let c=new(n?.Err??e)(i.issues.map(u=>k(u,s,Z())));throw G(c,n?.callee),c}return i.value},D=at(T),pt=e=>async(t,r,o,n)=>{let s=o?{...o,async:!0}:{async:!0},i=t._zod.run({value:r,issues:[]},s);if(i instanceof Promise&&(i=await i),i.issues.length){let c=new(n?.Err??e)(i.issues.map(u=>k(u,s,Z())));throw G(c,n?.callee),c}return i.value},F=pt(T),lt=e=>(t,r,o)=>{let n=o?{...o,async:!1}:{async:!1},s=t._zod.run({value:r,issues:[]},n);if(s instanceof Promise)throw new v;return s.issues.length?{success:!1,error:new(e??ve)(s.issues.map(i=>k(i,n,Z())))}:{success:!0,data:s.value}},M=lt(T),ft=e=>async(t,r,o)=>{let n=o?{...o,async:!0}:{async:!0},s=t._zod.run({value:r,issues:[]},n);return s instanceof Promise&&(s=await s),s.issues.length?{success:!1,error:new e(s.issues.map(i=>k(i,n,Z())))}:{success:!0,data:s.value}},R=ft(T);var dt="(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))",mt=new RegExp(`^${dt}$`);var ze=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??""}}`:"[\\s\\S]*";return new RegExp(`^${t}$`)};var $e=/^-?\d+(?:\.\d+)?$/,ye=/^(?:true|false)$/i;var O=p("$ZodCheck",(e,t)=>{var r;e._zod??(e._zod={}),e._zod.def=t,(r=e._zod).onattach??(r.onattach=[])});var we=p("$ZodCheckStringFormat",(e,t)=>{var r,o;O.init(e,t),e._zod.onattach.push(n=>{let s=n._zod.bag;s.format=t.format,t.pattern&&(s.patterns??(s.patterns=new Set),s.patterns.add(t.pattern))}),t.pattern?(r=e._zod).check??(r.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:"string",code:"invalid_format",format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(o=e._zod).check??(o.check=()=>{})}),Ze=p("$ZodCheckRegex",(e,t)=>{we.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 Pe={major:4,minor:4,patch:3};var g=p("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Pe;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);for(let n of o)for(let s of n._zod.onattach)s(e);if(o.length===0)(r=e._zod).deferred??(r.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let n=(i,c,u)=>{let a=S(i),l;for(let d of c){if(d._zod.def.when){if(ge(i)||!d._zod.def.when(i))continue}else if(a)continue;let f=i.issues.length,_=d._zod.check(i);if(_ instanceof Promise&&u?.async===!1)throw new v;if(l||_ instanceof Promise)l=(l??Promise.resolve()).then(async()=>{await _,i.issues.length!==f&&(a||(a=S(i,f)))});else{if(i.issues.length===f)continue;a||(a=S(i,f))}}return l?l.then(()=>i):i},s=(i,c,u)=>{if(S(i))return i.aborted=!0,i;let a=n(c,o,u);if(a instanceof Promise){if(u.async===!1)throw new v;return a.then(l=>e._zod.parse(l,u))}return e._zod.parse(a,u)};e._zod.run=(i,c)=>{if(c.skipChecks)return e._zod.parse(i,c);if(c.direction==="backward"){let a=e._zod.parse({value:i.value,issues:[]},{...c,skipChecks:!0});return a instanceof Promise?a.then(l=>s(l,i,c)):s(a,i,c)}let u=e._zod.parse(i,c);if(u instanceof Promise){if(c.async===!1)throw new v;return u.then(a=>n(a,o,c))}return n(u,o,c)}}$(e,"~standard",()=>({validate:n=>{try{let s=M(e,n);return s.success?{value:s.data}:{issues:s.error?.issues}}catch{return R(e,n).then(i=>i.success?{value:i.data}:{issues:i.error?.issues})}},vendor:"zod",version:1}))}),Ie=p("$ZodString",(e,t)=>{g.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??ze(e._zod.bag),e._zod.parse=(r,o)=>{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 Te=p("$ZodNumber",(e,t)=>{g.init(e,t),e._zod.pattern=e._zod.bag.pattern??$e,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=Number(r.value)}catch{}let n=r.value;if(typeof n=="number"&&!Number.isNaN(n)&&Number.isFinite(n))return r;let s=typeof n=="number"?Number.isNaN(n)?"NaN":Number.isFinite(n)?void 0:"Infinity":void 0;return r.issues.push({expected:"number",code:"invalid_type",input:n,inst:e,...s?{received:s}:{}}),r}});var Me=p("$ZodBoolean",(e,t)=>{g.init(e,t),e._zod.pattern=ye,e._zod.parse=(r,o)=>{if(t.coerce)try{r.value=!!r.value}catch{}let n=r.value;return typeof n=="boolean"||r.issues.push({expected:"boolean",code:"invalid_type",input:n,inst:e}),r}});function Ee(e,t,r){e.issues.length&&t.issues.push(...q(r,e.issues)),t.value[r]=e.value}var Re=p("$ZodArray",(e,t)=>{g.init(e,t),e._zod.parse=(r,o)=>{let n=r.value;if(!Array.isArray(n))return r.issues.push({expected:"array",code:"invalid_type",input:n,inst:e}),r;r.value=Array(n.length);let s=[];for(let i=0;i<n.length;i++){let c=n[i],u=t.element._zod.run({value:c,issues:[]},o);u instanceof Promise?s.push(u.then(a=>Ee(a,r,i))):Ee(u,r,i)}return s.length?Promise.all(s).then(()=>r):r}});function L(e,t,r,o,n,s){let i=r in o;if(e.issues.length){if(n&&s&&!i)return;t.issues.push(...q(r,e.issues))}if(!i&&!n){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?i&&(t.value[r]=void 0):t.value[r]=e.value}function ht(e){let t=Object.keys(e.shape);for(let o of t)if(!e.shape?.[o]?._zod?.traits?.has("$ZodType"))throw new Error(`Invalid element at key "${o}": expected a Zod schema`);let r=_e(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function _t(e,t,r,o,n,s){let i=[],c=n.keySet,u=n.catchall._zod,a=u.def.type,l=u.optin==="optional",d=u.optout==="optional";for(let f in t){if(f==="__proto__"||c.has(f))continue;if(a==="never"){i.push(f);continue}let _=u.run({value:t[f],issues:[]},o);_ instanceof Promise?e.push(_.then(y=>L(y,r,f,t,l,d))):L(_,r,f,t,l,d)}return i.length&&r.issues.push({code:"unrecognized_keys",keys:i,input:t,inst:s}),e.length?Promise.all(e).then(()=>r):r}var Oe=p("$ZodObject",(e,t)=>{if(g.init(e,t),!Object.getOwnPropertyDescriptor(t,"shape")?.get){let c=t.shape;Object.defineProperty(t,"shape",{get:()=>{let u={...c};return Object.defineProperty(t,"shape",{value:u}),u}})}let o=le(()=>ht(t));$(e._zod,"propValues",()=>{let c=t.shape,u={};for(let a in c){let l=c[a]._zod;if(l.values){u[a]??(u[a]=new Set);for(let d of l.values)u[a].add(d)}}return u});let n=j,s=t.catchall,i;e._zod.parse=(c,u)=>{i??(i=o.value);let a=c.value;if(!n(a))return c.issues.push({expected:"object",code:"invalid_type",input:a,inst:e}),c;c.value={};let l=[],d=i.shape;for(let f of i.keys){let _=d[f],y=_._zod.optin==="optional",ie=_._zod.optout==="optional",B=_._zod.run({value:a[f],issues:[]},u);B instanceof Promise?l.push(B.then(st=>L(st,c,f,a,y,ie))):L(B,c,f,a,y,ie)}return s?_t(l,a,c,u,o.value,e):l.length?Promise.all(l).then(()=>c):c}});var Ne=p("$ZodEnum",(e,t)=>{g.init(e,t);let r=ae(t.entries),o=new Set(r);e._zod.values=o,e._zod.pattern=new RegExp(`^(${r.filter(n=>me.has(typeof n)).map(n=>typeof n=="string"?he(n):n.toString()).join("|")})$`),e._zod.parse=(n,s)=>{let i=n.value;return o.has(i)||n.issues.push({code:"invalid_value",values:r,input:i,inst:e}),n}});function Ce(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var je=p("$ZodOptional",(e,t)=>{g.init(e,t),e._zod.optin="optional",e._zod.optout="optional",$(e._zod,"values",()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),$(e._zod,"pattern",()=>{let r=t.innerType._zod.pattern;return r?new RegExp(`^(${fe(r.source)})?$`):void 0}),e._zod.parse=(r,o)=>{if(t.innerType._zod.optin==="optional"){let n=r.value,s=t.innerType._zod.run(r,o);return s instanceof Promise?s.then(i=>Ce(i,n)):Ce(s,n)}return r.value===void 0?r:t.innerType._zod.run(r,o)}});var De=p("$ZodDefault",(e,t)=>{g.init(e,t),e._zod.optin="optional",$(e._zod,"values",()=>t.innerType._zod.values),e._zod.parse=(r,o)=>{if(o.direction==="backward")return t.innerType._zod.run(r,o);if(r.value===void 0)return r.value=t.defaultValue,r;let n=t.innerType._zod.run(r,o);return n instanceof Promise?n.then(s=>Ae(s,t)):Ae(n,t)}});function Ae(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Fe=p("$ZodCustom",(e,t)=>{O.init(e,t),g.init(e,t),e._zod.parse=(r,o)=>r,e._zod.check=r=>{let o=r.value,n=t.fn(o);if(n instanceof Promise)return n.then(s=>Se(s,r,o,e));Se(n,r,o,e)}});function Se(e,t,r,o){if(!e){let n={code:"custom",input:r,inst:o,path:[...o._zod.def.path??[]],continue:!o._zod.def.abort};o._zod.def.params&&(n.params=o._zod.def.params),t.issues.push(X(n))}}function Le(e,t){return new e({type:"string",...x(t)})}function Ue(e,t){return new e({type:"number",checks:[],...x(t)})}function He(e,t){return new e({type:"boolean",...x(t)})}function Q(e,t){return new Ze({check:"string_format",format:"regex",...x(t),pattern:e})}function Be(e,t,r){let o=x(r);return o.abort??(o.abort=!0),new e({type:"custom",check:"custom",fn:t,...o})}var z=p("ZodMiniType",(e,t)=>{if(!e._zod)throw new Error("Uninitialized schema in ZodMiniType.");g.init(e,t),e.def=t,e.type=t.type,e.parse=(r,o)=>D(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>M(e,r,o),e.parseAsync=async(r,o)=>F(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>R(e,r,o),e.check=(...r)=>e.clone({...t,checks:[...t.checks??[],...r.map(o=>typeof o=="function"?{_zod:{check:o,def:{check:"custom"},onattach:[]}}:o)]},{parent:!0}),e.with=e.check,e.clone=(r,o)=>Y(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.apply=r=>r(e)}),xt=p("ZodMiniString",(e,t)=>{Ie.init(e,t),z.init(e,t)});function b(e){return Le(xt,e)}var vt=p("ZodMiniNumber",(e,t)=>{Te.init(e,t),z.init(e,t)});function Ke(e){return Ue(vt,e)}var zt=p("ZodMiniBoolean",(e,t)=>{Me.init(e,t),z.init(e,t)});function w(e){return He(zt,e)}var $t=p("ZodMiniArray",(e,t)=>{Re.init(e,t),z.init(e,t)});function ee(e,t){return new $t({type:"array",element:e,...x(t)})}var yt=p("ZodMiniObject",(e,t)=>{Oe.init(e,t),z.init(e,t),$(e,"shape",()=>t.shape)});function te(e,t){let r={type:"object",shape:e??{},...x(t)};return new yt(r)}var bt=p("ZodMiniEnum",(e,t)=>{Ne.init(e,t),z.init(e,t),e.options=Object.values(t.entries)});function Ve(e,t){let r=Array.isArray(e)?Object.fromEntries(e.map(o=>[o,o])):e;return new bt({type:"enum",entries:r,...x(t)})}var wt=p("ZodMiniOptional",(e,t)=>{je.init(e,t),z.init(e,t)});function h(e){return new wt({type:"optional",innerType:e})}var Zt=p("ZodMiniDefault",(e,t)=>{De.init(e,t),z.init(e,t)});function P(e,t){return new Zt({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():J(t)}})}var kt=p("ZodMiniCustom",(e,t)=>{Fe.init(e,t),z.init(e,t)});function re(e,t){return Be(kt,e??(()=>!0),t)}var U="https://in.dev.heycatch.ai",C="dev",A="0.7.0-dev.974",We="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";function Ge(e=C){return e!=="dev"?null:`[HeyCatch] WARNING: this is an internal development build (v${A}). 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 E="unknown",Ct=["localStorage","cookie","memory","localStorage+cookie","sessionStorage"];var Je=te({projectKey:b({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(Q(/^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:P(ee(b()),[]),install:P(te({framework:P(b(),E),frameworkVersion:P(b(),E),agent:P(b(),E)}),{framework:E,frameworkVersion:E,agent:E}),autocapture:h(w()),maskAllText:h(w()),maskAllElementAttributes:h(w()),propertyDenylist:h(ee(b())),sanitizeProperties:h(re(e=>typeof e=="function")),beforeSend:h(re(e=>typeof e=="function"||Array.isArray(e)&&e.every(t=>typeof t=="function"))),persistence:h(Ve(Ct)),disablePersistence:h(w()),cookieExpirationDays:h(Ke()),optOutCapturingByDefault:h(w()),respectDnt:h(w())});var oe=null;function m(){return oe}var ne=null;function Ye(){ne?.()}function qe(e){if(oe!==null)return;let t=Je.safeParse(e);if(!t.success){let i=t.error.issues[0]?.message??"init() requires a config object with { projectKey }.";console.error(`[HeyCatch] ${i}`);return}let r=new At(We,{host:U,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0,...t.data.optOutCapturingByDefault===void 0?{}:{defaultOptIn:!t.data.optOutCapturingByDefault}}),{install:o}=t.data,n={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent};ne=()=>{r.register({heycatch_sdk_version:A,heycatch_sdk_stage:C,heycatch_project_key:t.data.projectKey,...n}),r.group(se,t.data.projectKey,{key:t.data.projectKey,sdk_version:A,sdk_stage:C,framework:o.framework,framework_version:o.frameworkVersion,agent:o.agent,api_host:U})},ne(),oe=r,console.info(`[HeyCatch] SDK v${A} (${C}) initialized \u2192 ${U}`);let s=Ge();s!==null&&console.warn(s)}function Xe(e){return t=>{console.error(`[HeyCatch] consent ${e} could not be saved - capture state may reset on the next app launch:`,t)}}function Qe(){m()?.optIn().catch(Xe("opt-in"))}function et(){m()?.optOut().catch(Xe("opt-out"))}function tt(e,t,r){let o=m();if(o!==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}o.identify(e,{...t?{$set:t}:{},...r?{$set_once:r}:{}})}}function rt(){let e=m();e!==null&&(e.reset(),Ye())}function H(e,t){let r=m();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 ot(e,t,r){let o=m();if(o!==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}o.capture(e,{...t,...r?.set?{$set:r.set}:{},...r?.setOnce?{$set_once:r.setOnce}:{},heycatch_custom_user_event:!0})}}function nt(e,t){let r=m();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}import{PostHogProvider as St}from"posthog-react-native";import{useEffect as It}from"react";import{jsx as Nt,jsxs as jt}from"react/jsx-runtime";function Tt(){try{if(typeof K!="function")return null;let e=K("expo-router");return typeof e=="object"&&e!==null&&"usePathname"in e&&typeof e.usePathname=="function"&&"useGlobalSearchParams"in e&&typeof e.useGlobalSearchParams=="function"?{usePathname:e.usePathname,useGlobalSearchParams:e.useGlobalSearchParams}:null}catch{return null}}var it=Tt();function Mt(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[o,n]of Object.entries(t)){if(typeof n=="string"||typeof n=="number"||typeof n=="boolean"){r[o]=n;continue}Array.isArray(n)&&(r[o]=n.filter(s=>typeof s=="string").join(","))}return r}function Rt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,o=r(),n=JSON.stringify(t());return It(()=>{H(o,Mt(n))},[o,n]),null}function Ot({children:e}){let t=m();return t===null?(console.error("[HeyCatch] HeyCatchProvider mounted before init() - call analytics.init({ projectKey }) at module scope of the root layout."),e):jt(St,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[it===null?null:Nt(Rt,{router:it}),e]})}var cs={init:qe,optInCapturing:Qe,optOutCapturing:et,resetIdentity:rt,setIdentity:tt,setPersonProperties:nt,trackEvent:ot,trackScreen:H};export{Ot as HeyCatchProvider,A as SDK_VERSION,C as STAGE,cs as analytics};
2
2
  //# sourceMappingURL=react-native.js.map