@heycatch/sdk 0.7.0-dev.43 → 0.7.0-dev.433

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 je=Object.getOwnPropertyDescriptor;var Fe=Object.getOwnPropertyNames;var De=Object.prototype.hasOwnProperty;var Le=(e,t)=>{for(var r in t)H(e,r,{get:t[r],enumerable:!0})},Ue=(e,t,r,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Fe(t))!De.call(e,i)&&i!==r&&H(e,i,{get:()=>t[i],enumerable:!(o=je(t,i))||o.enumerable});return e};var He=e=>Ue(H({},"__esModule",{value:!0}),e);var dt={};Le(dt,{HeyCatchProvider:()=>Oe,SDK_VERSION:()=>P,STAGE:()=>k,analytics:()=>mt});module.exports=He(dt);var re="project",Be="[a-z0-9]",_t=new RegExp(`^${Be}$`);var ke=require("posthog-react-native");var oe;function f(e,t,r){function o(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:n,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=n.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 n(s){var u;let a=r?.Parent?new c:this;o(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(n,"init",{value:o}),Object.defineProperty(n,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}var _=class extends Error{constructor(){super("Encountered Promise during synchronous parse. Use .parseAsync() instead.")}};(oe=globalThis).__zod_globalConfig??(oe.__zod_globalConfig={});var B=globalThis.__zod_globalConfig;function x(e){return e&&Object.assign(B,e),B}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 ne=Symbol("evaluating");function z(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==ne)return o===void 0&&(o=ne,o=r()),o},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 G(e){return ce(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 o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function v(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 xt={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 o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function $(e,t,r){let o=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:n,...s}=e;return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=n),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),A=f("$ZodError",pe,{Parent:Error});var Ve=e=>(t,r,o,i)=>{let c=o?{...o,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},c);if(n instanceof Promise)throw new _;if(n.issues.length){let s=new(i?.Err??e)(n.issues.map(u=>$(u,c,x())));throw V(s,i?.callee),s}return n.value},R=Ve(A),Ge=e=>async(t,r,o,i)=>{let c=o?{...o,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},c);if(n instanceof Promise&&(n=await n),n.issues.length){let s=new(i?.Err??e)(n.issues.map(u=>$(u,c,x())));throw V(s,i?.callee),s}return n.value},O=Ge(A),We=e=>(t,r,o)=>{let i=o?{...o,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(n=>$(n,i,x())))}:{success:!0,data:c.value}},S=We(A),Je=e=>async(t,r,o)=>{let i=o?{...o,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(n=>$(n,i,x())))}:{success:!0,data:c.value}},T=Je(A);var Ye="(?:(?:\\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])))",qe=new RegExp(`^${Ye}$`);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 Xe=f("$ZodCheckStringFormat",(e,t)=>{var r,o;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})}):(o=e._zod).check??(o.check=()=>{})}),de=f("$ZodCheckRegex",(e,t)=>{Xe.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 y=f("$ZodType",(e,t)=>{var r;e??(e={}),e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=he;let o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);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=(n,s,u)=>{let a=E(n),p;for(let m of s){if(m._zod.def.when){if(ae(n)||!m._zod.def.when(n))continue}else if(a)continue;let l=n.issues.length,d=m._zod.check(n);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,n.issues.length!==l&&(a||(a=E(n,l)))});else{if(n.issues.length===l)continue;a||(a=E(n,l))}}return p?p.then(()=>n):n},c=(n,s,u)=>{if(E(n))return n.aborted=!0,n;let a=i(s,o,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=(n,s)=>{if(s.skipChecks)return e._zod.parse(n,s);if(s.direction==="backward"){let a=e._zod.parse({value:n.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,n,s)):c(a,n,s)}let u=e._zod.parse(n,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,o,s))}return i(u,o,s)}}z(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(n=>n.success?{value:n.data}:{issues:n.error?.issues})}},vendor:"zod",version:1}))}),xe=f("$ZodString",(e,t)=>{y.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??fe(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}});function _e(e,t,r){e.issues.length&&t.issues.push(...J(r,e.issues)),t.value[r]=e.value}var ze=f("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,o)=>{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 n=0;n<i.length;n++){let s=i[n],u=t.element._zod.run({value:s,issues:[]},o);u instanceof Promise?c.push(u.then(a=>_e(a,r,n))):_e(u,r,n)}return c.length?Promise.all(c).then(()=>r):r}});function N(e,t,r,o,i,c){let n=r in o;if(e.issues.length){if(i&&c&&!n)return;t.issues.push(...J(r,e.issues))}if(!n&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?n&&(t.value[r]=void 0):t.value[r]=e.value}function tt(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=ue(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function rt(e,t,r,o,i,c){let n=[],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"){n.push(l);continue}let d=u.run({value:t[l],issues:[]},o);d instanceof Promise?e.push(d.then(g=>N(g,r,l,t,p,m))):N(d,r,l,t,p,m)}return n.length&&r.issues.push({code:"unrecognized_keys",keys:n,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 o=se(()=>tt(t));z(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,n;e._zod.parse=(s,u)=>{n??(n=o.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=n.shape;for(let l of n.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(Ne=>N(Ne,s,l,a,g,te))):N(U,s,l,a,g,te)}return c?rt(p,a,s,u,o.value,e):p.length?Promise.all(p).then(()=>s):s}});var $e=f("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",z(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 i=t.innerType._zod.run(r,o);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",...v(t)})}function q(e,t){return new de({check:"string_format",format:"regex",...v(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,o)=>R(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>S(e,r,o),e.parseAsync=async(r,o)=>O(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>T(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)=>W(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),e)),e.apply=r=>r(e)}),nt=f("ZodMiniString",(e,t)=>{xe.init(e,t),j.init(e,t)});function b(e){return ye(nt,e)}var it=f("ZodMiniArray",(e,t)=>{ze.init(e,t),j.init(e,t)});function be(e,t){return new it({type:"array",element:e,...v(t)})}var st=f("ZodMiniObject",(e,t)=>{ve.init(e,t),j.init(e,t),z(e,"shape",()=>t.shape)});function X(e,t){let r={type:"object",shape:e??{},...v(t)};return new st(r)}var ct=f("ZodMiniDefault",(e,t)=>{$e.init(e,t),j.init(e,t)});function Z(e,t){return new ct({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():G(t)}})}var F="https://in.dev.heycatch.ai",k="dev",P="0.7.0-dev.43",Ze="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";var w="unknown",we=X({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:Z(be(b()),[]),install:Z(X({framework:Z(b(),w),frameworkVersion:Z(b(),w),agent:Z(b(),w)}),{framework:w,frameworkVersion:w,agent:w})});var Q=null;function h(){return Q}var ee=null;function Pe(){ee?.()}function Ee(e){if(Q!==null)return;let t=we.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=new ke.PostHog(Ze,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:o}=t.data,i={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent};ee=()=>{r.register({heycatch_sdk_version:P,heycatch_sdk_stage:k,heycatch_project_key:t.data.projectKey,...i}),r.group(re,t.data.projectKey,{key:t.data.projectKey,sdk_version:P,sdk_stage:k,framework:o.framework,framework_version:o.frameworkVersion,agent:o.agent,api_host:F})},ee(),Q=r,console.info(`[HeyCatch] SDK v${P} (${k}) initialized \u2192 ${F}`)}function Ce(e,t,r){let o=h();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 Ae(){let e=h();e!==null&&(e.reset(),Pe())}function D(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 Se(e,t,r){let o=h();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 Te(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}var Me=require("posthog-react-native"),Re=require("react");var L=require("react/jsx-runtime");function pt(){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 Ie=pt();function lt(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[o,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[o]=i;continue}Array.isArray(i)&&(r[o]=i.filter(c=>typeof c=="string").join(","))}return r}function ft({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,o=r(),i=JSON.stringify(t());return(0,Re.useEffect)(()=>{D(o,lt(i))},[o,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,L.jsxs)(Me.PostHogProvider,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Ie===null?null:(0,L.jsx)(ft,{router:Ie}),e]})}var mt={init:Ee,resetIdentity:Ae,setIdentity:Ce,setPersonProperties:Te,trackEvent:Se,trackScreen:D};0&&(module.exports={HeyCatchProvider,SDK_VERSION,STAGE,analytics});
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.433",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});
2
2
  //# sourceMappingURL=react-native.cjs.map
@@ -1,5 +1,5 @@
1
- import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, T as TrackOptions } from './shared-B8y8fJCD.cjs';
2
- export { P as PersonPropertyUpdate, S as SDK_VERSION, c as STAGE, d as ServerTrackOptions } from './shared-B8y8fJCD.cjs';
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';
3
3
  import { ReactNode } from 'react';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { a as HeyCatchPersonProperties, H as HeyCatchConfig, b as HeyCatchProperties, T as TrackOptions } from './shared-B8y8fJCD.js';
2
- export { P as PersonPropertyUpdate, S as SDK_VERSION, c as STAGE, d as ServerTrackOptions } from './shared-B8y8fJCD.js';
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';
3
3
  import { ReactNode } from 'react';
4
4
 
5
5
  /**
@@ -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",Ie="[a-z0-9]",at=new RegExp(`^${Ie}$`);import{PostHog as Qe}from"posthog-react-native";var re;function f(e,t,r){function o(s,u){if(s._zod||Object.defineProperty(s,"_zod",{value:{def:u,constr:n,traits:new Set},enumerable:!1}),s._zod.traits.has(e))return;s._zod.traits.add(e),t(s,u);let a=n.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 n(s){var u;let a=r?.Parent?new c:this;o(a,s),(u=a._zod).deferred??(u.deferred=[]);for(let p of a._zod.deferred)p();return a}return Object.defineProperty(n,"init",{value:o}),Object.defineProperty(n,Symbol.hasInstance,{value:s=>r?.Parent&&s instanceof r.Parent?!0:s?._zod?.traits?.has(e)}),Object.defineProperty(n,"name",{value:e}),n}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 ne(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 oe=Symbol("evaluating");function z(e,t,r){let o;Object.defineProperty(e,t,{get(){if(o!==oe)return o===void 0&&(o=oe,o=r()),o},set(i){Object.defineProperty(e,t,{value:i})},configurable:!0})}var K="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 G(e,t,r){let o=new e._zod.constr(t??e._zod.def);return(!t||r?.parent)&&(o._zod.parent=e),o}function v(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 lt={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 k(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 W(e,t){return t.map(r=>{var o;return(o=r).path??(o.path=[]),r.path.unshift(e),r})}function I(e){return typeof e=="string"?e:e?.message}function $(e,t,r){let o=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:n,...s}=e;return s.path??(s.path=[]),s.message=o,t?.reportInput&&(s.input=n),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,ne,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},pe=f("$ZodError",ae),E=f("$ZodError",ae,{Parent:Error});var Re=e=>(t,r,o,i)=>{let c=o?{...o,async:!1}:{async:!1},n=t._zod.run({value:r,issues:[]},c);if(n instanceof Promise)throw new _;if(n.issues.length){let s=new(i?.Err??e)(n.issues.map(u=>$(u,c,x())));throw K(s,i?.callee),s}return n.value},R=Re(E),Oe=e=>async(t,r,o,i)=>{let c=o?{...o,async:!0}:{async:!0},n=t._zod.run({value:r,issues:[]},c);if(n instanceof Promise&&(n=await n),n.issues.length){let s=new(i?.Err??e)(n.issues.map(u=>$(u,c,x())));throw K(s,i?.callee),s}return n.value},O=Oe(E),Ne=e=>(t,r,o)=>{let i=o?{...o,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(n=>$(n,i,x())))}:{success:!0,data:c.value}},C=Ne(E),je=e=>async(t,r,o)=>{let i=o?{...o,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(n=>$(n,i,x())))}:{success:!0,data:c.value}},A=je(E);var Fe="(?:(?:\\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(`^${Fe}$`);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 Le=f("$ZodCheckStringFormat",(e,t)=>{var r,o;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})}):(o=e._zod).check??(o.check=()=>{})}),me=f("$ZodCheckRegex",(e,t)=>{Le.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 o=[...e._zod.def.checks??[]];e._zod.traits.has("$ZodCheck")&&o.unshift(e);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=(n,s,u)=>{let a=k(n),p;for(let m of s){if(m._zod.def.when){if(ue(n)||!m._zod.def.when(n))continue}else if(a)continue;let l=n.issues.length,d=m._zod.check(n);if(d instanceof Promise&&u?.async===!1)throw new _;if(p||d instanceof Promise)p=(p??Promise.resolve()).then(async()=>{await d,n.issues.length!==l&&(a||(a=k(n,l)))});else{if(n.issues.length===l)continue;a||(a=k(n,l))}}return p?p.then(()=>n):n},c=(n,s,u)=>{if(k(n))return n.aborted=!0,n;let a=i(s,o,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=(n,s)=>{if(s.skipChecks)return e._zod.parse(n,s);if(s.direction==="backward"){let a=e._zod.parse({value:n.value,issues:[]},{...s,skipChecks:!0});return a instanceof Promise?a.then(p=>c(p,n,s)):c(a,n,s)}let u=e._zod.parse(n,s);if(u instanceof Promise){if(s.async===!1)throw new _;return u.then(a=>i(a,o,s))}return i(u,o,s)}}z(e,"~standard",()=>({validate:i=>{try{let c=C(e,i);return c.success?{value:c.data}:{issues:c.error?.issues}}catch{return A(e,i).then(n=>n.success?{value:n.data}:{issues:n.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,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}});function he(e,t,r){e.issues.length&&t.issues.push(...W(r,e.issues)),t.value[r]=e.value}var xe=f("$ZodArray",(e,t)=>{y.init(e,t),e._zod.parse=(r,o)=>{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 n=0;n<i.length;n++){let s=i[n],u=t.element._zod.run({value:s,issues:[]},o);u instanceof Promise?c.push(u.then(a=>he(a,r,n))):he(u,r,n)}return c.length?Promise.all(c).then(()=>r):r}});function N(e,t,r,o,i,c){let n=r in o;if(e.issues.length){if(i&&c&&!n)return;t.issues.push(...W(r,e.issues))}if(!n&&!i){e.issues.length||t.issues.push({code:"invalid_type",expected:"nonoptional",input:void 0,path:[r]});return}e.value===void 0?n&&(t.value[r]=void 0):t.value[r]=e.value}function Be(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=ce(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(r)}}function Ke(e,t,r,o,i,c){let n=[],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"){n.push(l);continue}let d=u.run({value:t[l],issues:[]},o);d instanceof Promise?e.push(d.then(g=>N(g,r,l,t,p,m))):N(d,r,l,t,p,m)}return n.length&&r.issues.push({code:"unrecognized_keys",keys:n,input:t,inst:c}),e.length?Promise.all(e).then(()=>r):r}var ze=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 o=ie(()=>Be(t));z(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,n;e._zod.parse=(s,u)=>{n??(n=o.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=n.shape;for(let l of n.keys){let d=m[l],g=d._zod.optin==="optional",ee=d._zod.optout==="optional",L=d._zod.run({value:a[l],issues:[]},u);L instanceof Promise?p.push(L.then(Te=>N(Te,s,l,a,g,ee))):N(L,s,l,a,g,ee)}return c?Ke(p,a,s,u,o.value,e):p.length?Promise.all(p).then(()=>s):s}});var ve=f("$ZodDefault",(e,t)=>{y.init(e,t),e._zod.optin="optional",z(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 i=t.innerType._zod.run(r,o);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",...v(t)})}function Y(e,t){return new me({check:"string_format",format:"regex",...v(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,o)=>R(e,r,o,{callee:e.parse}),e.safeParse=(r,o)=>C(e,r,o),e.parseAsync=async(r,o)=>O(e,r,o,{callee:e.parseAsync}),e.safeParseAsync=async(r,o)=>A(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)=>G(e,r,o),e.brand=()=>e,e.register=((r,o)=>(r.add(e,o),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 We=f("ZodMiniArray",(e,t)=>{xe.init(e,t),j.init(e,t)});function ye(e,t){return new We({type:"array",element:e,...v(t)})}var Je=f("ZodMiniObject",(e,t)=>{ze.init(e,t),j.init(e,t),z(e,"shape",()=>t.shape)});function q(e,t){let r={type:"object",shape:e??{},...v(t)};return new Je(r)}var Ye=f("ZodMiniDefault",(e,t)=>{ve.init(e,t),j.init(e,t)});function Z(e,t){return new Ye({type:"default",innerType:e,get defaultValue(){return typeof t=="function"?t():V(t)}})}var F="https://in.dev.heycatch.ai",S="dev",T="0.7.0-dev.43",be="phc_CqKdgm7xbFBs3mSdtqzrHNTfzTRKrwRmCrEB9aftENY9";var w="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:Z(ye(b()),[]),install:Z(q({framework:Z(b(),w),frameworkVersion:Z(b(),w),agent:Z(b(),w)}),{framework:w,frameworkVersion:w,agent:w})});var X=null;function h(){return X}var Q=null;function we(){Q?.()}function ke(e){if(X!==null)return;let t=Ze.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=new Qe(be,{host:F,preloadFeatureFlags:!1,disableRemoteFeatureFlags:!0,sendFeatureFlagEvent:!1,disableSurveys:!0}),{install:o}=t.data,i={heycatch_framework:o.framework,heycatch_framework_version:o.frameworkVersion,heycatch_agent:o.agent};Q=()=>{r.register({heycatch_sdk_version:T,heycatch_sdk_stage:S,heycatch_project_key:t.data.projectKey,...i}),r.group(te,t.data.projectKey,{key:t.data.projectKey,sdk_version:T,sdk_stage:S,framework:o.framework,framework_version:o.frameworkVersion,agent:o.agent,api_host:F})},Q(),X=r,console.info(`[HeyCatch] SDK v${T} (${S}) initialized \u2192 ${F}`)}function Pe(e,t,r){let o=h();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 Ee(){let e=h();e!==null&&(e.reset(),we())}function D(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 o=h();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 Ae(e,t){let r=h();r!==null&&(!e&&!t||r.capture("$set",{...e?{$set:e}:{},...t?{$set_once:t}:{}}))}import{PostHogProvider as et}from"posthog-react-native";import{useEffect as tt}from"react";import{jsx as st,jsxs as ct}from"react/jsx-runtime";function rt(){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 Se=rt();function ot(e){let t=JSON.parse(e);if(typeof t!="object"||t===null)return{};let r={};for(let[o,i]of Object.entries(t)){if(typeof i=="string"||typeof i=="number"||typeof i=="boolean"){r[o]=i;continue}Array.isArray(i)&&(r[o]=i.filter(c=>typeof c=="string").join(","))}return r}function nt({router:e}){let{useGlobalSearchParams:t,usePathname:r}=e,o=r(),i=JSON.stringify(t());return tt(()=>{D(o,ot(i))},[o,i]),null}function it({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):ct(et,{autocapture:{captureScreens:!1,captureTouches:!0},client:t,children:[Se===null?null:st(nt,{router:Se}),e]})}var Fi={init:ke,resetIdentity:Ee,setIdentity:Pe,setPersonProperties:Ae,trackEvent:Ce,trackScreen:D};export{it as HeyCatchProvider,T as SDK_VERSION,S as STAGE,Fi as analytics};
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.433",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};
2
2
  //# sourceMappingURL=react-native.js.map