@replayops/sdk 0.1.3 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/react.cjs +6 -6
- package/dist/adapters/react.js +1 -1
- package/dist/adapters/vue.cjs +6 -6
- package/dist/adapters/vue.js +1 -1
- package/dist/browser/replayops.min.js +41 -41
- package/dist/chunk-HO5DNIXX.js +36 -0
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +29 -2
- package/dist/index.d.ts +29 -2
- package/dist/index.js +1 -1
- package/package.json +13 -12
- package/dist/chunk-KJRPCR2B.js +0 -36
package/dist/index.d.cts
CHANGED
|
@@ -80,6 +80,13 @@ interface SdkConfig {
|
|
|
80
80
|
maxBatchBytes?: number;
|
|
81
81
|
/** Require explicit consent() before any recording. Default false. */
|
|
82
82
|
requireConsent?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The visitor's choice on marketing use, when your consent banner already
|
|
85
|
+
* knows it at init. Projects that require it build campaign reports and
|
|
86
|
+
* segments only from sessions where this is true. Later changes go through
|
|
87
|
+
* `consent(granted, { marketing })`.
|
|
88
|
+
*/
|
|
89
|
+
marketingConsent?: boolean;
|
|
83
90
|
/**
|
|
84
91
|
* End the session after this much user inactivity — recording stops right
|
|
85
92
|
* then (periodic keyframes/telemetry included), and the next interaction
|
|
@@ -118,6 +125,12 @@ declare class SessionController {
|
|
|
118
125
|
private policyUserRules?;
|
|
119
126
|
/** Set once a rule has excluded this visitor, so nothing restarts recording. */
|
|
120
127
|
private ruledOut;
|
|
128
|
+
/**
|
|
129
|
+
* The organization's recording quota is used up, from the config at load
|
|
130
|
+
* or a 402 mid-session. Like ruledOut it holds for the page: nothing
|
|
131
|
+
* restarts recording until the next load asks again.
|
|
132
|
+
*/
|
|
133
|
+
private quotaOut;
|
|
121
134
|
/** Configure the SDK. Does not start recording unless autostart is implied. */
|
|
122
135
|
init(config: SdkConfig): void;
|
|
123
136
|
private bootstrap;
|
|
@@ -138,6 +151,12 @@ declare class SessionController {
|
|
|
138
151
|
*/
|
|
139
152
|
private ruleVerdict;
|
|
140
153
|
/** Stops and discards when a rule turns out to exclude the current visitor. */
|
|
154
|
+
/**
|
|
155
|
+
* The collector refused a batch because the quota is used up. Stop without
|
|
156
|
+
* flushing: the tail would only be refused too. Deferred a tick because it
|
|
157
|
+
* is called from inside the transport's own flush.
|
|
158
|
+
*/
|
|
159
|
+
private haltForQuota;
|
|
141
160
|
private enforceUserRule;
|
|
142
161
|
track(eventName: string, properties?: Record<string, unknown>): void;
|
|
143
162
|
setUserProperties(props: Record<string, unknown>): void;
|
|
@@ -145,8 +164,16 @@ declare class SessionController {
|
|
|
145
164
|
mask(selector: string): void;
|
|
146
165
|
/** Adds a CSS selector whose matched elements are dropped from recording. */
|
|
147
166
|
ignore(selector: string): void;
|
|
148
|
-
/**
|
|
149
|
-
|
|
167
|
+
/**
|
|
168
|
+
* GDPR/KVKK consent gate. Granting consent starts a deferred session.
|
|
169
|
+
* `purposes.marketing` records whether the visitor also agreed to marketing
|
|
170
|
+
* use (campaign reports, segments); it is remembered for later sessions.
|
|
171
|
+
*/
|
|
172
|
+
consent(granted: boolean, purposes?: {
|
|
173
|
+
marketing?: boolean;
|
|
174
|
+
}): void;
|
|
175
|
+
/** Writes the visitor's marketing choice into the recording, where ingest reads it. */
|
|
176
|
+
private announceMarketingConsent;
|
|
150
177
|
/** Opt out permanently and stop recording. */
|
|
151
178
|
optOut(): void;
|
|
152
179
|
getState(): State;
|
package/dist/index.d.ts
CHANGED
|
@@ -80,6 +80,13 @@ interface SdkConfig {
|
|
|
80
80
|
maxBatchBytes?: number;
|
|
81
81
|
/** Require explicit consent() before any recording. Default false. */
|
|
82
82
|
requireConsent?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* The visitor's choice on marketing use, when your consent banner already
|
|
85
|
+
* knows it at init. Projects that require it build campaign reports and
|
|
86
|
+
* segments only from sessions where this is true. Later changes go through
|
|
87
|
+
* `consent(granted, { marketing })`.
|
|
88
|
+
*/
|
|
89
|
+
marketingConsent?: boolean;
|
|
83
90
|
/**
|
|
84
91
|
* End the session after this much user inactivity — recording stops right
|
|
85
92
|
* then (periodic keyframes/telemetry included), and the next interaction
|
|
@@ -118,6 +125,12 @@ declare class SessionController {
|
|
|
118
125
|
private policyUserRules?;
|
|
119
126
|
/** Set once a rule has excluded this visitor, so nothing restarts recording. */
|
|
120
127
|
private ruledOut;
|
|
128
|
+
/**
|
|
129
|
+
* The organization's recording quota is used up, from the config at load
|
|
130
|
+
* or a 402 mid-session. Like ruledOut it holds for the page: nothing
|
|
131
|
+
* restarts recording until the next load asks again.
|
|
132
|
+
*/
|
|
133
|
+
private quotaOut;
|
|
121
134
|
/** Configure the SDK. Does not start recording unless autostart is implied. */
|
|
122
135
|
init(config: SdkConfig): void;
|
|
123
136
|
private bootstrap;
|
|
@@ -138,6 +151,12 @@ declare class SessionController {
|
|
|
138
151
|
*/
|
|
139
152
|
private ruleVerdict;
|
|
140
153
|
/** Stops and discards when a rule turns out to exclude the current visitor. */
|
|
154
|
+
/**
|
|
155
|
+
* The collector refused a batch because the quota is used up. Stop without
|
|
156
|
+
* flushing: the tail would only be refused too. Deferred a tick because it
|
|
157
|
+
* is called from inside the transport's own flush.
|
|
158
|
+
*/
|
|
159
|
+
private haltForQuota;
|
|
141
160
|
private enforceUserRule;
|
|
142
161
|
track(eventName: string, properties?: Record<string, unknown>): void;
|
|
143
162
|
setUserProperties(props: Record<string, unknown>): void;
|
|
@@ -145,8 +164,16 @@ declare class SessionController {
|
|
|
145
164
|
mask(selector: string): void;
|
|
146
165
|
/** Adds a CSS selector whose matched elements are dropped from recording. */
|
|
147
166
|
ignore(selector: string): void;
|
|
148
|
-
/**
|
|
149
|
-
|
|
167
|
+
/**
|
|
168
|
+
* GDPR/KVKK consent gate. Granting consent starts a deferred session.
|
|
169
|
+
* `purposes.marketing` records whether the visitor also agreed to marketing
|
|
170
|
+
* use (campaign reports, segments); it is remembered for later sessions.
|
|
171
|
+
*/
|
|
172
|
+
consent(granted: boolean, purposes?: {
|
|
173
|
+
marketing?: boolean;
|
|
174
|
+
}): void;
|
|
175
|
+
/** Writes the visitor's marketing choice into the recording, where ingest reads it. */
|
|
176
|
+
private announceMarketingConsent;
|
|
150
177
|
/** Opt out permanently and stop recording. */
|
|
151
178
|
optOut(): void;
|
|
152
179
|
getState(): State;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export{b as Session,a as SessionController,c as default}from'./chunk-
|
|
1
|
+
export{b as Session,a as SessionController,c as default}from'./chunk-HO5DNIXX.js';//# sourceMappingURL=index.js.map
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@replayops/sdk",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Session replay SDK for ReplayOps
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "Session replay SDK for ReplayOps \u2014 records DOM, console, network and errors in the browser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"session-replay",
|
|
7
7
|
"rrweb",
|
|
@@ -55,6 +55,15 @@
|
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|
|
57
57
|
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsup",
|
|
60
|
+
"dev": "tsup --watch",
|
|
61
|
+
"typecheck": "tsc --noEmit",
|
|
62
|
+
"test": "vitest run",
|
|
63
|
+
"size": "node scripts/check-size.mjs",
|
|
64
|
+
"clean": "rimraf dist",
|
|
65
|
+
"prepublishOnly": "npm run build"
|
|
66
|
+
},
|
|
58
67
|
"dependencies": {
|
|
59
68
|
"rrweb": "^2.0.0-alpha.4"
|
|
60
69
|
},
|
|
@@ -77,14 +86,6 @@
|
|
|
77
86
|
"tsup": "^8.3.0",
|
|
78
87
|
"typescript": "^5.6.3",
|
|
79
88
|
"vitest": "^2.1.2",
|
|
80
|
-
"@replayops/rrweb-schema": "
|
|
81
|
-
},
|
|
82
|
-
"scripts": {
|
|
83
|
-
"build": "tsup",
|
|
84
|
-
"dev": "tsup --watch",
|
|
85
|
-
"typecheck": "tsc --noEmit",
|
|
86
|
-
"test": "vitest run",
|
|
87
|
-
"size": "node scripts/check-size.mjs",
|
|
88
|
-
"clean": "rimraf dist"
|
|
89
|
+
"@replayops/rrweb-schema": "workspace:*"
|
|
89
90
|
}
|
|
90
|
-
}
|
|
91
|
+
}
|
package/dist/chunk-KJRPCR2B.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {record}from'rrweb';var hn=Object.defineProperty;var mn=(t,e)=>{for(var n in e)hn(t,n,{get:e[n],enumerable:true});};var gn={samplingRate:1,environment:"production",maskInputs:true,maskSelectors:[],ignoreSelectors:[],recordConsole:true,recordNetwork:true,recordNetworkBodies:true,recordErrors:true,capturePerformance:true,captureMemory:true,captureWebVitals:true,tracePropagation:true,tracePropagationTargets:[],live:true,liveChat:true,testerTools:true,googleAnalytics:true,batchSize:100,flushIntervalMs:5e3,maxBatchBytes:1048576,requireConsent:false,idleTimeoutMs:36e5};function St(t){return {...gn,...t}}var Ct="ro_anon_id",Rt="ro_optout",Mt="ro_consent",it="ro_user_id",ot="ro_user_email";function Ue(){return typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{let e=Math.random()*16|0;return (t==="x"?e:e&3|8).toString(16)})}var ze=class{anonymousId;userId;userTraits={};rememberedUserId;rememberedEmail;constructor(){this.anonymousId=this.load(Ct)??Ue(),this.save(Ct,this.anonymousId),this.rememberedUserId=this.load(it)??void 0,this.rememberedEmail=this.load(ot)??void 0;}identify(e,n){this.userId=e,n&&(this.userTraits={...this.userTraits,...n}),this.rememberedUserId=e,this.save(it,e);let r=this.userTraits.email;typeof r=="string"&&r&&(this.rememberedEmail=r,this.save(ot,r));}setUserProperties(e){this.userTraits={...this.userTraits,...e};}subjects(){let e=this.userTraits.email;return [this.userId??this.rememberedUserId,(typeof e=="string"?e:void 0)??this.rememberedEmail]}forgetUser(){this.rememberedUserId=void 0,this.rememberedEmail=void 0,this.save(it,""),this.save(ot,"");}get anonymous(){return this.anonymousId}snapshot(){return {anonymousId:this.anonymousId,userId:this.userId,userTraits:Object.keys(this.userTraits).length?this.userTraits:void 0}}isOptedOut(){return this.load(Rt)==="1"}optOut(){this.save(Rt,"1"),this.forgetUser();}setConsent(e){this.save(Mt,e?"1":"0");}hasConsent(){return this.load(Mt)==="1"}load(e){try{return localStorage.getItem(e)}catch{return null}}save(e,n){try{localStorage.setItem(e,n);}catch{}}};function yn(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function vn(t){return yn(t)/4294967296}function It(t,e="session",n=""){return !Number.isFinite(t)||t>=1?true:t<=0?false:e==="user"&&n?vn(n)<t:Math.random()<t}async function xn(t){let e=t.trim().toLowerCase();if(!e)return null;let n=typeof crypto<"u"?crypto.subtle:void 0;if(!n)return null;try{let r=new TextEncoder().encode(e),s=await n.digest("SHA-256",r);return [...new Uint8Array(s)].map(i=>i.toString(16).padStart(2,"0")).join("")}catch{return null}}async function Ot(t,e){if(!t||t.mode==="off")return;let n=e.filter(a=>!!a&&!!a.trim());if(n.length===0)return t.mode==="allow"?false:void 0;let s=(await Promise.all(n.map(xn))).filter(a=>a!==null);if(s.length===0)return;let i=new Set(t.hashes),o=s.some(a=>i.has(a));return t.mode==="allow"?o:!o}var N;(function(t){t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t[t.NativeFrame=7]="NativeFrame",t[t.NativeInteraction=8]="NativeInteraction";})(N||(N={}));var at;(function(t){t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Selection=11]="Selection",t[t.StyleDeclaration=12]="StyleDeclaration",t[t.Drag=13]="Drag";})(at||(at={}));var ct;(function(t){t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchEnd=9]="TouchEnd";})(ct||(ct={}));var I;(function(t){t.Console="replayops/console",t.Network="replayops/network",t.Performance="replayops/performance",t.WebVitals="replayops/webvitals",t.Error="replayops/error";})(I||(I={}));var At;(function(t){t[t.Tap=0]="Tap",t[t.DoubleTap=1]="DoubleTap",t[t.LongPress=2]="LongPress",t[t.Scroll=3]="Scroll",t[t.Swipe=4]="Swipe",t[t.ScreenChange=5]="ScreenChange",t[t.KeyboardInput=6]="KeyboardInput",t[t.Back=7]="Back";})(At||(At={}));var _={};mn(_,{BRAND:()=>Fn,DIRTY:()=>de,EMPTY_PATH:()=>kn,INVALID:()=>m,NEVER:()=>Mr,OK:()=>O,ParseStatus:()=>M,Schema:()=>w,ZodAny:()=>oe,ZodArray:()=>ne,ZodBigInt:()=>ue,ZodBoolean:()=>pe,ZodBranded:()=>Ne,ZodCatch:()=>ke,ZodDate:()=>fe,ZodDefault:()=>_e,ZodDiscriminatedUnion:()=>Fe,ZodEffects:()=>U,ZodEnum:()=>be,ZodError:()=>L,ZodFirstPartyTypeKind:()=>g,ZodFunction:()=>We,ZodIntersection:()=>ye,ZodIssueCode:()=>d,ZodLazy:()=>ve,ZodLiteral:()=>xe,ZodMap:()=>Ie,ZodNaN:()=>Ae,ZodNativeEnum:()=>we,ZodNever:()=>Z,ZodNull:()=>me,ZodNullable:()=>J,ZodNumber:()=>le,ZodObject:()=>$,ZodOptional:()=>V,ZodParsedType:()=>p,ZodPipeline:()=>Le,ZodPromise:()=>ae,ZodReadonly:()=>Te,ZodRecord:()=>Ze,ZodSchema:()=>w,ZodSet:()=>Oe,ZodString:()=>ie,ZodSymbol:()=>Re,ZodTransformer:()=>U,ZodTuple:()=>X,ZodType:()=>w,ZodUndefined:()=>he,ZodUnion:()=>ge,ZodUnknown:()=>te,ZodVoid:()=>Me,addIssueToContext:()=>u,any:()=>er,array:()=>sr,bigint:()=>Yn,boolean:()=>Bt,coerce:()=>Rr,custom:()=>Vt,date:()=>Xn,datetimeRegex:()=>Ht,defaultErrorMap:()=>Q,discriminatedUnion:()=>cr,effect:()=>br,enum:()=>yr,function:()=>hr,getErrorMap:()=>Ee,getParsedType:()=>Y,instanceof:()=>Wn,intersection:()=>dr,isAborted:()=>Be,isAsync:()=>Se,isDirty:()=>qe,isValid:()=>se,late:()=>Zn,lazy:()=>mr,literal:()=>gr,makeIssue:()=>Pe,map:()=>pr,nan:()=>Kn,nativeEnum:()=>vr,never:()=>nr,null:()=>Qn,nullable:()=>_r,number:()=>Ut,object:()=>ir,objectUtil:()=>dt,oboolean:()=>Cr,onumber:()=>Sr,optional:()=>wr,ostring:()=>Er,pipeline:()=>Tr,preprocess:()=>kr,promise:()=>xr,quotelessJson:()=>bn,record:()=>ur,set:()=>fr,setErrorMap:()=>_n,strictObject:()=>or,string:()=>zt,symbol:()=>Jn,transformer:()=>br,tuple:()=>lr,undefined:()=>Gn,union:()=>ar,unknown:()=>tr,util:()=>k,void:()=>rr});var k;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{let i={};for(let o of s)i[o]=o;return i},t.getValidEnumValues=s=>{let i=t.objectKeys(s).filter(a=>typeof s[s[a]]!="number"),o={};for(let a of i)o[a]=s[a];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{let i=[];for(let o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(let o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i;})(k||(k={}));var dt;(function(t){t.mergeShapes=(e,n)=>({...e,...n});})(dt||(dt={}));var p=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Y=t=>{switch(typeof t){case "undefined":return p.undefined;case "string":return p.string;case "number":return Number.isNaN(t)?p.nan:p.number;case "boolean":return p.boolean;case "function":return p.function;case "bigint":return p.bigint;case "symbol":return p.symbol;case "object":return Array.isArray(t)?p.array:t===null?p.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?p.promise:typeof Map<"u"&&t instanceof Map?p.map:typeof Set<"u"&&t instanceof Set?p.set:typeof Date<"u"&&t instanceof Date?p.date:p.object;default:return p.unknown}};var d=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),bn=t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),L=class t extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r];},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r];};let n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e;}format(e){let n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(let o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else {let a=r,c=0;for(;c<o.path.length;){let l=o.path[c];c===o.path.length-1?(a[l]=a[l]||{_errors:[]},a[l]._errors.push(n(o))):a[l]=a[l]||{_errors:[]},a=a[l],c++;}}};return s(this),r}static assert(e){if(!(e instanceof t))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){let n={},r=[];for(let s of this.issues)if(s.path.length>0){let i=s.path[0];n[i]=n[i]||[],n[i].push(e(s));}else r.push(e(s));return {formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}};L.create=t=>new L(t);var wn=(t,e)=>{let n;switch(t.code){case d.invalid_type:t.received===p.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case d.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,k.jsonStringifyReplacer)}`;break;case d.unrecognized_keys:n=`Unrecognized key(s) in object: ${k.joinValues(t.keys,", ")}`;break;case d.invalid_union:n="Invalid input";break;case d.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${k.joinValues(t.options)}`;break;case d.invalid_enum_value:n=`Invalid enum value. Expected ${k.joinValues(t.options)}, received '${t.received}'`;break;case d.invalid_arguments:n="Invalid function arguments";break;case d.invalid_return_type:n="Invalid function return type";break;case d.invalid_date:n="Invalid date";break;case d.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:k.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case d.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case d.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case d.custom:n="Invalid input";break;case d.invalid_intersection_types:n="Intersection results could not be merged";break;case d.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case d.not_finite:n="Number must be finite";break;default:n=e.defaultError,k.assertNever(t);}return {message:n}},Q=wn;var Pt=Q;function _n(t){Pt=t;}function Ee(){return Pt}var Pe=t=>{let{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return {...s,path:i,message:s.message};let a="",c=r.filter(l=>!!l).slice().reverse();for(let l of c)a=l(o,{data:e,defaultError:a}).message;return {...s,path:i,message:a}},kn=[];function u(t,e){let n=Ee(),r=Pe({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Q?void 0:Q].filter(s=>!!s)});t.common.issues.push(r);}var M=class t{constructor(){this.value="valid";}dirty(){this.value==="valid"&&(this.value="dirty");}abort(){this.value!=="aborted"&&(this.value="aborted");}static mergeArray(e,n){let r=[];for(let s of n){if(s.status==="aborted")return m;s.status==="dirty"&&e.dirty(),r.push(s.value);}return {status:e.value,value:r}}static async mergeObjectAsync(e,n){let r=[];for(let s of n){let i=await s.key,o=await s.value;r.push({key:i,value:o});}return t.mergeObjectSync(e,r)}static mergeObjectSync(e,n){let r={};for(let s of n){let{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return m;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value);}return {status:e.value,value:r}}},m=Object.freeze({status:"aborted"}),de=t=>({status:"dirty",value:t}),O=t=>({status:"valid",value:t}),Be=t=>t.status==="aborted",qe=t=>t.status==="dirty",se=t=>t.status==="valid",Se=t=>typeof Promise<"u"&&t instanceof Promise;var h;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e?.message;})(h||(h={}));var z=class{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s;}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},Nt=(t,e)=>{if(se(e))return {success:true,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return {success:false,get error(){if(this._error)return this._error;let n=new L(t.common.issues);return this._error=n,this._error}}};function v(t){if(!t)return {};let{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,a)=>{let{message:c}=t;return o.code==="invalid_enum_value"?{message:c??a.defaultError}:typeof a.data>"u"?{message:c??r??a.defaultError}:o.code!=="invalid_type"?{message:a.defaultError}:{message:c??n??a.defaultError}},description:s}}var w=class{get description(){return this._def.description}_getType(e){return Y(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:Y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return {status:new M,ctx:{common:e.parent.common,data:e.data,parsedType:Y(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let n=this._parse(e);if(Se(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){let n=this._parse(e);return Promise.resolve(n)}parse(e,n){let r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){let r={common:{issues:[],async:n?.async??false,contextualErrorMap:n?.errorMap},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Nt(r,s)}"~validate"(e){let n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)};if(!this["~standard"].async)try{let r=this._parseSync({data:e,path:[],parent:n});return se(r)?{value:r.value}:{issues:n.common.issues}}catch(r){r?.message?.toLowerCase()?.includes("encountered")&&(this["~standard"].async=true),n.common={issues:[],async:true};}return this._parseAsync({data:e,path:[],parent:n}).then(r=>se(r)?{value:r.value}:{issues:n.common.issues})}async parseAsync(e,n){let r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){let r={common:{issues:[],contextualErrorMap:n?.errorMap,async:true},path:n?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Y(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(Se(s)?s:Promise.resolve(s));return Nt(r,i)}refine(e,n){let r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{let o=e(s),a=()=>i.addIssue({code:d.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?true:(a(),false)):o?true:(a(),false)})}refinement(e,n){return this._refinement((r,s)=>e(r)?true:(s.addIssue(typeof n=="function"?n(r,s):n),false))}_refinement(e){return new U({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)};}optional(){return V.create(this,this._def)}nullable(){return J.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ne.create(this)}promise(){return ae.create(this,this._def)}or(e){return ge.create([this,e],this._def)}and(e){return ye.create(this,e,this._def)}transform(e){return new U({...v(this._def),schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}})}default(e){let n=typeof e=="function"?e:()=>e;return new _e({...v(this._def),innerType:this,defaultValue:n,typeName:g.ZodDefault})}brand(){return new Ne({typeName:g.ZodBranded,type:this,...v(this._def)})}catch(e){let n=typeof e=="function"?e:()=>e;return new ke({...v(this._def),innerType:this,catchValue:n,typeName:g.ZodCatch})}describe(e){let n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Le.create(this,e)}readonly(){return Te.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},Tn=/^c[^\s-]{8,}$/i,En=/^[0-9a-z]+$/,Sn=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Cn=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Rn=/^[a-z0-9_-]{21}$/i,Mn=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,In=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,On=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,An="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",lt,Pn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Nn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Ln=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,$n=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,jn=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Hn=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,$t="((\\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])))",Dn=new RegExp(`^${$t}$`);function jt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);let n=t.precision?"+":"?";return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function Vn(t){return new RegExp(`^${jt(t)}$`)}function Ht(t){let e=`${$t}T${jt(t)}`,n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function zn(t,e){return !!((e==="v4"||!e)&&Pn.test(t)||(e==="v6"||!e)&&Ln.test(t))}function Un(t,e){if(!Mn.test(t))return false;try{let[n]=t.split(".");if(!n)return !1;let r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return !(typeof s!="object"||s===null||"typ"in s&&s?.typ!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return false}}function Bn(t,e){return !!((e==="v4"||!e)&&Nn.test(t)||(e==="v6"||!e)&&$n.test(t))}var ie=class t extends w{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==p.string){let i=this._getOrReturnCtx(e);return u(i,{code:d.invalid_type,expected:p.string,received:i.parsedType}),m}let r=new M,s;for(let i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:d.too_small,minimum:i.value,type:"string",inclusive:true,exact:false,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:d.too_big,maximum:i.value,type:"string",inclusive:true,exact:false,message:i.message}),r.dirty());else if(i.kind==="length"){let o=e.data.length>i.value,a=e.data.length<i.value;(o||a)&&(s=this._getOrReturnCtx(e,s),o?u(s,{code:d.too_big,maximum:i.value,type:"string",inclusive:true,exact:true,message:i.message}):a&&u(s,{code:d.too_small,minimum:i.value,type:"string",inclusive:true,exact:true,message:i.message}),r.dirty());}else if(i.kind==="email")On.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"email",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")lt||(lt=new RegExp(An,"u")),lt.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"emoji",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Cn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"uuid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Rn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"nanoid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Tn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cuid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")En.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cuid2",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Sn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"ulid",code:d.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data);}catch{s=this._getOrReturnCtx(e,s),u(s,{validation:"url",code:d.invalid_string,message:i.message}),r.dirty();}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"regex",code:d.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?Ht(i).test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?Dn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?Vn(i).test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{code:d.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?In.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"duration",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?zn(e.data,i.version)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"ip",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?Un(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"jwt",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?Bn(e.data,i.version)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"cidr",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?jn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64",code:d.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?Hn.test(e.data)||(s=this._getOrReturnCtx(e,s),u(s,{validation:"base64url",code:d.invalid_string,message:i.message}),r.dirty()):k.assertNever(i);return {status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:d.invalid_string,...h.errToObj(r)})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...h.errToObj(e)})}url(e){return this._addCheck({kind:"url",...h.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...h.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...h.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...h.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...h.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...h.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...h.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...h.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...h.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...h.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...h.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...h.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:false,local:false,message:e}):this._addCheck({kind:"datetime",precision:typeof e?.precision>"u"?null:e?.precision,offset:e?.offset??false,local:e?.local??false,...h.errToObj(e?.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof e?.precision>"u"?null:e?.precision,...h.errToObj(e?.message)})}duration(e){return this._addCheck({kind:"duration",...h.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...h.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n?.position,...h.errToObj(n?.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...h.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...h.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...h.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...h.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...h.errToObj(n)})}nonempty(e){return this.min(1,h.errToObj(e))}trim(){return new t({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new t({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return !!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return !!this._def.checks.find(e=>e.kind==="date")}get isTime(){return !!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return !!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return !!this._def.checks.find(e=>e.kind==="email")}get isURL(){return !!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return !!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return !!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return !!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return !!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return !!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return !!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return !!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return !!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return !!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return !!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ie.create=t=>new ie({checks:[],typeName:g.ZodString,coerce:t?.coerce??false,...v(t)});function qn(t,e){let n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}var le=class t extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf;}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==p.number){let i=this._getOrReturnCtx(e);return u(i,{code:d.invalid_type,expected:p.number,received:i.parsedType}),m}let r,s=new M;for(let i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:false,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:false,message:i.message}),s.dirty()):i.kind==="multipleOf"?qn(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_finite,message:i.message}),s.dirty()):k.assertNever(i);return {status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,true,h.toString(n))}gt(e,n){return this.setLimit("min",e,false,h.toString(n))}lte(e,n){return this.setLimit("max",e,true,h.toString(n))}lt(e,n){return this.setLimit("max",e,false,h.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:h.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:h.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:false,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:false,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:true,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:true,message:h.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:h.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:true,value:Number.MIN_SAFE_INTEGER,message:h.toString(e)})._addCheck({kind:"max",inclusive:true,value:Number.MAX_SAFE_INTEGER,message:h.toString(e)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return !!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,n=null;for(let r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return true;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);}return Number.isFinite(n)&&Number.isFinite(e)}};le.create=t=>new le({checks:[],typeName:g.ZodNumber,coerce:t?.coerce||false,...v(t)});var ue=class t extends w{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte;}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data);}catch{return this._getInvalidInput(e)}if(this._getType(e)!==p.bigint)return this._getInvalidInput(e);let r,s=new M;for(let i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),u(r,{code:d.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):k.assertNever(i);return {status:s.value,value:e.data}}_getInvalidInput(e){let n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:p.bigint,received:n.parsedType}),m}gte(e,n){return this.setLimit("min",e,true,h.toString(n))}gt(e,n){return this.setLimit("min",e,false,h.toString(n))}lte(e,n){return this.setLimit("max",e,true,h.toString(n))}lt(e,n){return this.setLimit("max",e,false,h.toString(n))}setLimit(e,n,r,s){return new t({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:h.toString(s)}]})}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:false,message:h.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:false,message:h.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:true,message:h.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:true,message:h.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:h.toString(n)})}get minValue(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}};ue.create=t=>new ue({checks:[],typeName:g.ZodBigInt,coerce:t?.coerce??false,...v(t)});var pe=class extends w{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==p.boolean){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:p.boolean,received:r.parsedType}),m}return O(e.data)}};pe.create=t=>new pe({typeName:g.ZodBoolean,coerce:t?.coerce||false,...v(t)});var fe=class t extends w{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==p.date){let i=this._getOrReturnCtx(e);return u(i,{code:d.invalid_type,expected:p.date,received:i.parsedType}),m}if(Number.isNaN(e.data.getTime())){let i=this._getOrReturnCtx(e);return u(i,{code:d.invalid_date}),m}let r=new M,s;for(let i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:d.too_small,message:i.message,inclusive:true,exact:false,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),u(s,{code:d.too_big,message:i.message,inclusive:true,exact:false,maximum:i.value,type:"date"}),r.dirty()):k.assertNever(i);return {status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new t({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:h.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:h.toString(n)})}get minDate(){let e=null;for(let n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}};fe.create=t=>new fe({checks:[],coerce:t?.coerce||false,typeName:g.ZodDate,...v(t)});var Re=class extends w{_parse(e){if(this._getType(e)!==p.symbol){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:p.symbol,received:r.parsedType}),m}return O(e.data)}};Re.create=t=>new Re({typeName:g.ZodSymbol,...v(t)});var he=class extends w{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:p.undefined,received:r.parsedType}),m}return O(e.data)}};he.create=t=>new he({typeName:g.ZodUndefined,...v(t)});var me=class extends w{_parse(e){if(this._getType(e)!==p.null){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:p.null,received:r.parsedType}),m}return O(e.data)}};me.create=t=>new me({typeName:g.ZodNull,...v(t)});var oe=class extends w{constructor(){super(...arguments),this._any=true;}_parse(e){return O(e.data)}};oe.create=t=>new oe({typeName:g.ZodAny,...v(t)});var te=class extends w{constructor(){super(...arguments),this._unknown=true;}_parse(e){return O(e.data)}};te.create=t=>new te({typeName:g.ZodUnknown,...v(t)});var Z=class extends w{_parse(e){let n=this._getOrReturnCtx(e);return u(n,{code:d.invalid_type,expected:p.never,received:n.parsedType}),m}};Z.create=t=>new Z({typeName:g.ZodNever,...v(t)});var Me=class extends w{_parse(e){if(this._getType(e)!==p.undefined){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:p.void,received:r.parsedType}),m}return O(e.data)}};Me.create=t=>new Me({typeName:g.ZodVoid,...v(t)});var ne=class t extends w{_parse(e){let{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==p.array)return u(n,{code:d.invalid_type,expected:p.array,received:n.parsedType}),m;if(s.exactLength!==null){let o=n.data.length>s.exactLength.value,a=n.data.length<s.exactLength.value;(o||a)&&(u(n,{code:o?d.too_big:d.too_small,minimum:a?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:true,exact:true,message:s.exactLength.message}),r.dirty());}if(s.minLength!==null&&n.data.length<s.minLength.value&&(u(n,{code:d.too_small,minimum:s.minLength.value,type:"array",inclusive:true,exact:false,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(u(n,{code:d.too_big,maximum:s.maxLength.value,type:"array",inclusive:true,exact:false,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,a)=>s.type._parseAsync(new z(n,o,n.path,a)))).then(o=>M.mergeArray(r,o));let i=[...n.data].map((o,a)=>s.type._parseSync(new z(n,o,n.path,a)));return M.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new t({...this._def,minLength:{value:e,message:h.toString(n)}})}max(e,n){return new t({...this._def,maxLength:{value:e,message:h.toString(n)}})}length(e,n){return new t({...this._def,exactLength:{value:e,message:h.toString(n)}})}nonempty(e){return this.min(1,e)}};ne.create=(t,e)=>new ne({type:t,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray,...v(e)});function Ce(t){if(t instanceof $){let e={};for(let n in t.shape){let r=t.shape[n];e[n]=V.create(Ce(r));}return new $({...t._def,shape:()=>e})}else return t instanceof ne?new ne({...t._def,type:Ce(t.element)}):t instanceof V?V.create(Ce(t.unwrap())):t instanceof J?J.create(Ce(t.unwrap())):t instanceof X?X.create(t.items.map(e=>Ce(e))):t}var $=class t extends w{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend;}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),n=k.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==p.object){let l=this._getOrReturnCtx(e);return u(l,{code:d.invalid_type,expected:p.object,received:l.parsedType}),m}let{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),a=[];if(!(this._def.catchall instanceof Z&&this._def.unknownKeys==="strip"))for(let l in s.data)o.includes(l)||a.push(l);let c=[];for(let l of o){let f=i[l],T=s.data[l];c.push({key:{status:"valid",value:l},value:f._parse(new z(s,T,s.path,l)),alwaysSet:l in s.data});}if(this._def.catchall instanceof Z){let l=this._def.unknownKeys;if(l==="passthrough")for(let f of a)c.push({key:{status:"valid",value:f},value:{status:"valid",value:s.data[f]}});else if(l==="strict")a.length>0&&(u(s,{code:d.unrecognized_keys,keys:a}),r.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else {let l=this._def.catchall;for(let f of a){let T=s.data[f];c.push({key:{status:"valid",value:f},value:l._parse(new z(s,T,s.path,f)),alwaysSet:f in s.data});}}return s.common.async?Promise.resolve().then(async()=>{let l=[];for(let f of c){let T=await f.key,H=await f.value;l.push({key:T,value:H,alwaysSet:f.alwaysSet});}return l}).then(l=>M.mergeObjectSync(r,l)):M.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return h.errToObj,new t({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{let s=this._def.errorMap?.(n,r).message??r.defaultError;return n.code==="unrecognized_keys"?{message:h.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new t({...this._def,unknownKeys:"strip"})}passthrough(){return new t({...this._def,unknownKeys:"passthrough"})}extend(e){return new t({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new t({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:g.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new t({...this._def,catchall:e})}pick(e){let n={};for(let r of k.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}omit(e){let n={};for(let r of k.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new t({...this._def,shape:()=>n})}deepPartial(){return Ce(this)}partial(e){let n={};for(let r of k.objectKeys(this.shape)){let s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional();}return new t({...this._def,shape:()=>n})}required(e){let n={};for(let r of k.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else {let i=this.shape[r];for(;i instanceof V;)i=i._def.innerType;n[r]=i;}return new t({...this._def,shape:()=>n})}keyof(){return Dt(k.objectKeys(this.shape))}};$.create=(t,e)=>new $({shape:()=>t,unknownKeys:"strip",catchall:Z.create(),typeName:g.ZodObject,...v(e)});$.strictCreate=(t,e)=>new $({shape:()=>t,unknownKeys:"strict",catchall:Z.create(),typeName:g.ZodObject,...v(e)});$.lazycreate=(t,e)=>new $({shape:t,unknownKeys:"strip",catchall:Z.create(),typeName:g.ZodObject,...v(e)});var ge=class extends w{_parse(e){let{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(let a of i)if(a.result.status==="valid")return a.result;for(let a of i)if(a.result.status==="dirty")return n.common.issues.push(...a.ctx.common.issues),a.result;let o=i.map(a=>new L(a.ctx.common.issues));return u(n,{code:d.invalid_union,unionErrors:o}),m}if(n.common.async)return Promise.all(r.map(async i=>{let o={...n,common:{...n.common,issues:[]},parent:null};return {result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i,o=[];for(let c of r){let l={...n,common:{...n.common,issues:[]},parent:null},f=c._parseSync({data:n.data,path:n.path,parent:l});if(f.status==="valid")return f;f.status==="dirty"&&!i&&(i={result:f,ctx:l}),l.common.issues.length&&o.push(l.common.issues);}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;let a=o.map(c=>new L(c));return u(n,{code:d.invalid_union,unionErrors:a}),m}}get options(){return this._def.options}};ge.create=(t,e)=>new ge({options:t,typeName:g.ZodUnion,...v(e)});var ee=t=>t instanceof ve?ee(t.schema):t instanceof U?ee(t.innerType()):t instanceof xe?[t.value]:t instanceof be?t.options:t instanceof we?k.objectValues(t.enum):t instanceof _e?ee(t._def.innerType):t instanceof he?[void 0]:t instanceof me?[null]:t instanceof V?[void 0,...ee(t.unwrap())]:t instanceof J?[null,...ee(t.unwrap())]:t instanceof Ne||t instanceof Te?ee(t.unwrap()):t instanceof ke?ee(t._def.innerType):[],Fe=class t extends w{_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.object)return u(n,{code:d.invalid_type,expected:p.object,received:n.parsedType}),m;let r=this.discriminator,s=n.data[r],i=this.optionsMap.get(s);return i?n.common.async?i._parseAsync({data:n.data,path:n.path,parent:n}):i._parseSync({data:n.data,path:n.path,parent:n}):(u(n,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,n,r){let s=new Map;for(let i of n){let o=ee(i.shape[e]);if(!o.length)throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let a of o){if(s.has(a))throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(a)}`);s.set(a,i);}}return new t({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:n,optionsMap:s,...v(r)})}};function ut(t,e){let n=Y(t),r=Y(e);if(t===e)return {valid:true,data:t};if(n===p.object&&r===p.object){let s=k.objectKeys(e),i=k.objectKeys(t).filter(a=>s.indexOf(a)!==-1),o={...t,...e};for(let a of i){let c=ut(t[a],e[a]);if(!c.valid)return {valid:false};o[a]=c.data;}return {valid:true,data:o}}else if(n===p.array&&r===p.array){if(t.length!==e.length)return {valid:false};let s=[];for(let i=0;i<t.length;i++){let o=t[i],a=e[i],c=ut(o,a);if(!c.valid)return {valid:false};s.push(c.data);}return {valid:true,data:s}}else return n===p.date&&r===p.date&&+t==+e?{valid:true,data:t}:{valid:false}}var ye=class extends w{_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Be(i)||Be(o))return m;let a=ut(i.value,o.value);return a.valid?((qe(i)||qe(o))&&n.dirty(),{status:n.value,value:a.data}):(u(r,{code:d.invalid_intersection_types}),m)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}};ye.create=(t,e,n)=>new ye({left:t,right:e,typeName:g.ZodIntersection,...v(n)});var X=class t extends w{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.array)return u(r,{code:d.invalid_type,expected:p.array,received:r.parsedType}),m;if(r.data.length<this._def.items.length)return u(r,{code:d.too_small,minimum:this._def.items.length,inclusive:true,exact:false,type:"array"}),m;!this._def.rest&&r.data.length>this._def.items.length&&(u(r,{code:d.too_big,maximum:this._def.items.length,inclusive:true,exact:false,type:"array"}),n.dirty());let i=[...r.data].map((o,a)=>{let c=this._def.items[a]||this._def.rest;return c?c._parse(new z(r,o,r.path,a)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>M.mergeArray(n,o)):M.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new t({...this._def,rest:e})}};X.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new X({items:t,typeName:g.ZodTuple,rest:null,...v(e)})};var Ze=class t extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.object)return u(r,{code:d.invalid_type,expected:p.object,received:r.parsedType}),m;let s=[],i=this._def.keyType,o=this._def.valueType;for(let a in r.data)s.push({key:i._parse(new z(r,a,r.path,a)),value:o._parse(new z(r,r.data[a],r.path,a)),alwaysSet:a in r.data});return r.common.async?M.mergeObjectAsync(n,s):M.mergeObjectSync(n,s)}get element(){return this._def.valueType}static create(e,n,r){return n instanceof w?new t({keyType:e,valueType:n,typeName:g.ZodRecord,...v(r)}):new t({keyType:ie.create(),valueType:e,typeName:g.ZodRecord,...v(n)})}},Ie=class extends w{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.map)return u(r,{code:d.invalid_type,expected:p.map,received:r.parsedType}),m;let s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([a,c],l)=>({key:s._parse(new z(r,a,r.path,[l,"key"])),value:i._parse(new z(r,c,r.path,[l,"value"]))}));if(r.common.async){let a=new Map;return Promise.resolve().then(async()=>{for(let c of o){let l=await c.key,f=await c.value;if(l.status==="aborted"||f.status==="aborted")return m;(l.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(l.value,f.value);}return {status:n.value,value:a}})}else {let a=new Map;for(let c of o){let l=c.key,f=c.value;if(l.status==="aborted"||f.status==="aborted")return m;(l.status==="dirty"||f.status==="dirty")&&n.dirty(),a.set(l.value,f.value);}return {status:n.value,value:a}}}};Ie.create=(t,e,n)=>new Ie({valueType:e,keyType:t,typeName:g.ZodMap,...v(n)});var Oe=class t extends w{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==p.set)return u(r,{code:d.invalid_type,expected:p.set,received:r.parsedType}),m;let s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(u(r,{code:d.too_small,minimum:s.minSize.value,type:"set",inclusive:true,exact:false,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(u(r,{code:d.too_big,maximum:s.maxSize.value,type:"set",inclusive:true,exact:false,message:s.maxSize.message}),n.dirty());let i=this._def.valueType;function o(c){let l=new Set;for(let f of c){if(f.status==="aborted")return m;f.status==="dirty"&&n.dirty(),l.add(f.value);}return {status:n.value,value:l}}let a=[...r.data.values()].map((c,l)=>i._parse(new z(r,c,r.path,l)));return r.common.async?Promise.all(a).then(c=>o(c)):o(a)}min(e,n){return new t({...this._def,minSize:{value:e,message:h.toString(n)}})}max(e,n){return new t({...this._def,maxSize:{value:e,message:h.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}};Oe.create=(t,e)=>new Oe({valueType:t,minSize:null,maxSize:null,typeName:g.ZodSet,...v(e)});var We=class t extends w{constructor(){super(...arguments),this.validate=this.implement;}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.function)return u(n,{code:d.invalid_type,expected:p.function,received:n.parsedType}),m;function r(a,c){return Pe({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ee(),Q].filter(l=>!!l),issueData:{code:d.invalid_arguments,argumentsError:c}})}function s(a,c){return Pe({data:a,path:n.path,errorMaps:[n.common.contextualErrorMap,n.schemaErrorMap,Ee(),Q].filter(l=>!!l),issueData:{code:d.invalid_return_type,returnTypeError:c}})}let i={errorMap:n.common.contextualErrorMap},o=n.data;if(this._def.returns instanceof ae){let a=this;return O(async function(...c){let l=new L([]),f=await a._def.args.parseAsync(c,i).catch(j=>{throw l.addIssue(r(c,j)),l}),T=await Reflect.apply(o,this,f);return await a._def.returns._def.type.parseAsync(T,i).catch(j=>{throw l.addIssue(s(T,j)),l})})}else {let a=this;return O(function(...c){let l=a._def.args.safeParse(c,i);if(!l.success)throw new L([r(c,l.error)]);let f=Reflect.apply(o,this,l.data),T=a._def.returns.safeParse(f,i);if(!T.success)throw new L([s(f,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new t({...this._def,args:X.create(e).rest(te.create())})}returns(e){return new t({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,n,r){return new t({args:e||X.create([]).rest(te.create()),returns:n||te.create(),typeName:g.ZodFunction,...v(r)})}},ve=class extends w{get schema(){return this._def.getter()}_parse(e){let{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}};ve.create=(t,e)=>new ve({getter:t,typeName:g.ZodLazy,...v(e)});var xe=class extends w{_parse(e){if(e.data!==this._def.value){let n=this._getOrReturnCtx(e);return u(n,{received:n.data,code:d.invalid_literal,expected:this._def.value}),m}return {status:"valid",value:e.data}}get value(){return this._def.value}};xe.create=(t,e)=>new xe({value:t,typeName:g.ZodLiteral,...v(e)});function Dt(t,e){return new be({values:t,typeName:g.ZodEnum,...v(e)})}var be=class t extends w{_parse(e){if(typeof e.data!="string"){let n=this._getOrReturnCtx(e),r=this._def.values;return u(n,{expected:k.joinValues(r),received:n.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let n=this._getOrReturnCtx(e),r=this._def.values;return u(n,{received:n.data,code:d.invalid_enum_value,options:r}),m}return O(e.data)}get options(){return this._def.values}get enum(){let e={};for(let n of this._def.values)e[n]=n;return e}get Values(){let e={};for(let n of this._def.values)e[n]=n;return e}get Enum(){let e={};for(let n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return t.create(e,{...this._def,...n})}exclude(e,n=this._def){return t.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}};be.create=Dt;var we=class extends w{_parse(e){let n=k.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==p.string&&r.parsedType!==p.number){let s=k.objectValues(n);return u(r,{expected:k.joinValues(s),received:r.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let s=k.objectValues(n);return u(r,{received:r.data,code:d.invalid_enum_value,options:s}),m}return O(e.data)}get enum(){return this._def.values}};we.create=(t,e)=>new we({values:t,typeName:g.ZodNativeEnum,...v(e)});var ae=class extends w{unwrap(){return this._def.type}_parse(e){let{ctx:n}=this._processInputParams(e);if(n.parsedType!==p.promise&&n.common.async===false)return u(n,{code:d.invalid_type,expected:p.promise,received:n.parsedType}),m;let r=n.parsedType===p.promise?n.data:Promise.resolve(n.data);return O(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}};ae.create=(t,e)=>new ae({type:t,typeName:g.ZodPromise,...v(e)});var U=class extends w{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{u(r,o),o.fatal?n.abort():n.dirty();},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){let o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async a=>{if(n.value==="aborted")return m;let c=await this._def.schema._parseAsync({data:a,path:r.path,parent:r});return c.status==="aborted"?m:c.status==="dirty"?de(c.value):n.value==="dirty"?de(c.value):c});{if(n.value==="aborted")return m;let a=this._def.schema._parseSync({data:o,path:r.path,parent:r});return a.status==="aborted"?m:a.status==="dirty"?de(a.value):n.value==="dirty"?de(a.value):a}}if(s.type==="refinement"){let o=a=>{let c=s.refinement(a,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return a};if(r.common.async===false){let a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return a.status==="aborted"?m:(a.status==="dirty"&&n.dirty(),o(a.value),{status:n.value,value:a.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>a.status==="aborted"?m:(a.status==="dirty"&&n.dirty(),o(a.value).then(()=>({status:n.value,value:a.value}))))}if(s.type==="transform")if(r.common.async===false){let o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!se(o))return m;let a=s.transform(o.value,i);if(a instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return {status:n.value,value:a}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>se(o)?Promise.resolve(s.transform(o.value,i)).then(a=>({status:n.value,value:a})):m);k.assertNever(s);}};U.create=(t,e,n)=>new U({schema:t,typeName:g.ZodEffects,effect:e,...v(n)});U.createWithPreprocess=(t,e,n)=>new U({schema:e,effect:{type:"preprocess",transform:t},typeName:g.ZodEffects,...v(n)});var V=class extends w{_parse(e){return this._getType(e)===p.undefined?O(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};V.create=(t,e)=>new V({innerType:t,typeName:g.ZodOptional,...v(e)});var J=class extends w{_parse(e){return this._getType(e)===p.null?O(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};J.create=(t,e)=>new J({innerType:t,typeName:g.ZodNullable,...v(e)});var _e=class extends w{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return n.parsedType===p.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}};_e.create=(t,e)=>new _e({innerType:t,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...v(e)});var ke=class extends w{_parse(e){let{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Se(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new L(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new L(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}};ke.create=(t,e)=>new ke({innerType:t,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...v(e)});var Ae=class extends w{_parse(e){if(this._getType(e)!==p.nan){let r=this._getOrReturnCtx(e);return u(r,{code:d.invalid_type,expected:p.nan,received:r.parsedType}),m}return {status:"valid",value:e.data}}};Ae.create=t=>new Ae({typeName:g.ZodNaN,...v(t)});var Fn=Symbol("zod_brand"),Ne=class extends w{_parse(e){let{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}},Le=class t extends w{_parse(e){let{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return (async()=>{let i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?m:i.status==="dirty"?(n.dirty(),de(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{let s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?m:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new t({in:e,out:n,typeName:g.ZodPipeline})}},Te=class extends w{_parse(e){let n=this._def.innerType._parse(e),r=s=>(se(s)&&(s.value=Object.freeze(s.value)),s);return Se(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}};Te.create=(t,e)=>new Te({innerType:t,typeName:g.ZodReadonly,...v(e)});function Lt(t,e){let n=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof n=="string"?{message:n}:n}function Vt(t,e={},n){return t?oe.create().superRefine((r,s)=>{let i=t(r);if(i instanceof Promise)return i.then(o=>{if(!o){let a=Lt(e,r),c=a.fatal??n??true;s.addIssue({code:"custom",...a,fatal:c});}});if(!i){let o=Lt(e,r),a=o.fatal??n??true;s.addIssue({code:"custom",...o,fatal:a});}}):oe.create()}var Zn={object:$.lazycreate},g;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly";})(g||(g={}));var Wn=(t,e={message:`Input not instance of ${t.name}`})=>Vt(n=>n instanceof t,e),zt=ie.create,Ut=le.create,Kn=Ae.create,Yn=ue.create,Bt=pe.create,Xn=fe.create,Jn=Re.create,Gn=he.create,Qn=me.create,er=oe.create,tr=te.create,nr=Z.create,rr=Me.create,sr=ne.create,ir=$.create,or=$.strictCreate,ar=ge.create,cr=Fe.create,dr=ye.create,lr=X.create,ur=Ze.create,pr=Ie.create,fr=Oe.create,hr=We.create,mr=ve.create,gr=xe.create,yr=be.create,vr=we.create,xr=ae.create,br=U.create,wr=V.create,_r=J.create,kr=U.createWithPreprocess,Tr=Le.create,Er=()=>zt().optional(),Sr=()=>Ut().optional(),Cr=()=>Bt().optional(),Rr={string:(t=>ie.create({...t,coerce:true})),number:(t=>le.create({...t,coerce:true})),boolean:(t=>pe.create({...t,coerce:true})),bigint:(t=>ue.create({...t,coerce:true})),date:(t=>fe.create({...t,coerce:true}))};var Mr=m;var Ir=_.object({type:_.nativeEnum(N),timestamp:_.number().int().nonnegative(),data:_.unknown()}),Or=_.object({browser:_.string(),browserVersion:_.string(),os:_.string(),osVersion:_.string(),deviceType:_.enum(["desktop","mobile","tablet","unknown"]),userAgent:_.string().max(1024),platform:_.enum(["web","ios","android"]).optional()}),Ar=_.object({entryUrl:_.string().url().max(2048),currentUrl:_.string().url().max(2048),referrer:_.string().max(2048),device:Or,screen:_.object({width:_.number().int().nonnegative(),height:_.number().int().nonnegative(),dpr:_.number().nonnegative()}),language:_.string().max(35),timezone:_.string().max(64),environment:_.enum(["production","staging","development"]),releaseVersion:_.string().max(128).optional(),sdkVersion:_.string().max(32)});_.object({v:_.literal(1),projectId:_.string().min(1).max(64),sessionId:_.string().uuid(),seq:_.number().int().nonnegative(),anonymousId:_.string().min(1).max(64),userId:_.string().max(256).optional(),userTraits:_.record(_.unknown()).optional(),events:_.array(Ir).min(1).max(5e3),meta:Ar,sentAt:_.number().int().nonnegative()});function ft(t){let e=/Edg\/|EdgiOS\//.test(t)?"Edge":/OPR\/|OPiOS\//.test(t)?"Opera":/Chrome\/|CriOS\//.test(t)?"Chrome":/Firefox\/|FxiOS\//.test(t)?"Firefox":/Safari\//.test(t)?"Safari":"Unknown",n=t.match(/(?:EdgiOS|Edg|OPiOS|OPR|CriOS|Chrome|FxiOS|Firefox|Version)\/(\d+)/)?.[1]??"0",r=/Windows/.test(t)?"Windows":/(iPhone|iPad|iPod)/.test(t)?"iOS":/Android/.test(t)?"Android":/Mac OS X|Macintosh/.test(t)?"macOS":/Linux/.test(t)?"Linux":"Unknown",s=/iPad|Tablet/.test(t)||/Android/.test(t)&&!/Mobi/.test(t)?"tablet":/Mobi|Android|iPhone|iPod/.test(t)?"mobile":"desktop",i=(t.match(/(?:iPhone OS|CPU OS) ([\d_]+)/)?.[1]??t.match(/(?:Windows NT|Mac OS X|Android) ([\d._]+)/)?.[1]??"").replace(/_/g,".");return {browser:e,browserVersion:n,os:r,osVersion:i,deviceType:s,userAgent:t.slice(0,1024)}}var Nr=new Set(["password","email","tel","number","hidden"]),Lr=["cc-number","cc-csc","cc-exp","cc-name","current-password","new-password","one-time-code"],$r=/(pass(word)?|card|cvv|cvc|ccv|iban|ssn|tckn|national|secret|token|pin)/i;function qt(t){if(t instanceof HTMLInputElement&&Nr.has(t.type))return true;let e=t.getAttribute("autocomplete")?.toLowerCase()??"";if(Lr.some(r=>e.includes(r)))return true;let n=`${t.getAttribute("name")??""} ${t.id??""} ${t.getAttribute("aria-label")??""}`;return $r.test(n)}var Ft="0123456789abcdef";function Zt(t){let e=new Uint8Array(t),n=globalThis.crypto;if(n?.getRandomValues)n.getRandomValues(e);else for(let s=0;s<t;s++)e[s]=Math.floor(Math.random()*256);let r="";for(let s of e)r+=Ft[s>>4&15]+Ft[s&15];return r}function Wt(){let t=Zt(16);return t==="0".repeat(32)?Wt():t}function Kt(){let t=Zt(8);return t==="0".repeat(16)?Kt():t}function jr(t,e,n=true){return `00-${t}-${e}-${n?"01":"00"}`}function ht(t,e,n){let r;try{r=new URL(t,n);}catch{return true}return r.origin===n?true:e.some(s=>typeof s=="string"?r.href.includes(s):s.test(r.href))}function mt(t){let e=Wt();return {traceId:e,traceparent:jr(e,Kt()),baggage:`replayops.session_id=${encodeURIComponent(t)}`}}function B(t,e){return {type:N.Plugin,timestamp:Date.now(),data:{plugin:t,payload:e}}}function Xt(t){let e=["log","info","warn","error","debug"],n={};for(let r of e)n[r]=console[r].bind(console),console[r]=(...s)=>{t(B(I.Console,{level:r,args:s.map(Dr).slice(0,10)})),n[r](...s);};return ()=>{for(let r of e)console[r]=n[r];}}function Jt(t){let e=r=>{let s=r.target,i=s&&s!==r.currentTarget?s.src||s.href:void 0;if(!r.message&&i){t(B(I.Error,{kind:"resource",message:"Failed to load resource",source:i}));return}r.message&&t(B(I.Error,{kind:"error",message:r.message,source:r.filename,line:r.lineno,column:r.colno,stack:r.error?.stack?.slice(0,4e3)}));},n=r=>t(B(I.Error,{kind:"unhandledrejection",message:String(r.reason?.message??r.reason),stack:r.reason?.stack?.slice(0,4e3)}));return window.addEventListener("error",e,true),window.addEventListener("unhandledrejection",n),()=>{window.removeEventListener("error",e,true),window.removeEventListener("unhandledrejection",n);}}function Gt(t,e,n={}){let r=!!n.bodies,s=n.selfEndpoint?n.selfEndpoint.replace(/\/$/,""):void 0,i=x=>{if(!s)return false;try{return new URL(x,location.href).href.startsWith(s)}catch{return x.startsWith(s)}},o=window.fetch;window.fetch=async(...x)=>{let b=Date.now(),S=typeof x[0]=="string"?x[0]:x[0].url;if(i(S))return o(...x);let A=(x[1]?.method??x[0]?.method??"GET").toUpperCase(),D=e?Hr(x,S,e):void 0,K={};if(r){let F=Ur(x[1]?.headers??(x[0]instanceof Request?x[0].headers:void 0)),ce=typeof x[1]?.body=="string"?x[1].body:void 0;K=Yt(ce,F);}try{let F=await o(...x),ce={};return r&&(ce=await qr(F)),t(B(I.Network,{type:"fetch",url:S,method:A,status:F.status,durationMs:Date.now()-b,...D?{traceId:D}:{},...K,...ce})),F}catch(F){throw t(B(I.Network,{type:"fetch",url:S,method:A,status:0,error:String(F),durationMs:Date.now()-b,...D?{traceId:D}:{},...K})),F}};let c=window.XMLHttpRequest.prototype,l=c.open,f=c.send,T=c.setRequestHeader;c.open=function(x,b,...S){return this.__ro={method:x,url:b,started:0,reqHeaders:{}},l.call(this,x,b,...S)},c.setRequestHeader=function(x,b){let S=this.__ro;return S&&r&&(S.reqHeaders[x]=b),T.call(this,x,b)},c.send=function(...x){let b=this.__ro,S={};if(b){if(b.started=Date.now(),r){let A=typeof x[0]=="string"?x[0]:void 0;S=Yt(A,Ye(b.reqHeaders));}if(e&&ht(b.url,e.targets,location.origin)){let A=mt(e.sessionId);try{this.setRequestHeader("traceparent",A.traceparent),this.setRequestHeader("baggage",A.baggage),b.traceId=A.traceId;}catch{}}}return this.addEventListener("loadend",()=>{if(!b||i(b.url))return;let A={};if(r){let D=this.getResponseHeader("content-type")??void 0,K=this.responseType===""||this.responseType==="text"?this.responseText:void 0;A={...K!=null?{resBody:gt(yt(K,D))}:{},resHeaders:Br(this.getAllResponseHeaders())};}t(B(I.Network,{type:"xhr",url:b.url,method:b.method,status:this.status,durationMs:Date.now()-b.started,...b.traceId?{traceId:b.traceId}:{},...S,...A}));}),f.apply(this,x)};let H=1500,j=0,W;try{W=new PerformanceObserver(x=>{for(let b of x.getEntries()){if(j>=H)return;let S=b.initiatorType;S==="fetch"||S==="xmlhttprequest"||b.name.startsWith("data:")||i(b.name)||(j++,t({type:N.Plugin,timestamp:Math.round(performance.timeOrigin+b.startTime+b.duration),data:{plugin:I.Network,payload:{type:"resource",initiator:S,url:b.name,status:b.responseStatus??0,durationMs:Math.round(b.duration),...b.transferSize?{sizeBytes:b.transferSize}:{}}}}));}}),W.observe({type:"resource",buffered:!0});}catch{}return ()=>{window.fetch=o,c.open=l,c.send=f,c.setRequestHeader=T,W?.disconnect();}}function Hr(t,e,n){if(!ht(e,n.targets,location.origin))return;let r=mt(n.sessionId);if(t[0]instanceof Request){let o=new Headers(t[0].headers);return o.set("traceparent",r.traceparent),o.set("baggage",r.baggage),t[0]=new Request(t[0],{headers:o}),r.traceId}let s=t[1]??={},i=new Headers(s.headers);return i.set("traceparent",r.traceparent),i.set("baggage",r.baggage),s.headers=i,r.traceId}function Qt(t){let e=new PerformanceObserver(n=>{for(let r of n.getEntries())(r.entryType==="longtask"||r.entryType==="navigation")&&t(B(I.Performance,{entryType:r.entryType,name:r.name,startTime:Math.round(r.startTime),duration:Math.round(r.duration)}));});try{e.observe({entryTypes:["longtask","navigation"]});}catch{}return ()=>e.disconnect()}function en(t){let e=[],n=(s,i)=>{try{let o=new PerformanceObserver(a=>a.getEntries().forEach(i));o.observe({type:s,buffered:!0}),e.push(()=>o.disconnect());}catch{}};n("largest-contentful-paint",s=>t(B(I.WebVitals,{metric:"LCP",value:Math.round(s.startTime)}))),n("first-input",s=>{let i=s.processingStart-s.startTime;t(B(I.WebVitals,{metric:"FID",value:Math.round(i)}));});let r=0;return n("layout-shift",s=>{let i=s;i.hadRecentInput||(r+=i.value,t(B(I.WebVitals,{metric:"CLS",value:Number(r.toFixed(4))})));}),()=>e.forEach(s=>s())}function Dr(t){try{return typeof t=="string"?t:JSON.stringify(t)}catch{return String(t)}}var Ke=8192,Vr=/^(authorization|cookie|set-cookie|proxy-authorization|x-api-key|x-auth-token|x-csrf-token)$/i,zr=/(pass|secret|token|auth|credit|card|cvv|ssn|api[-_]?key)/i;function gt(t){return t.length>Ke?`${t.slice(0,Ke)}\u2026[truncated]`:t}function yt(t,e){if(!(e&&/json/i.test(e)||/^\s*[[{]/.test(t)))return t;try{let r=s=>{if(Array.isArray(s))return s.map(r);if(s&&typeof s=="object"){let i={};for(let o of Object.keys(s))i[o]=zr.test(o)?"***":r(s[o]);return i}return s};return JSON.stringify(r(JSON.parse(t)))}catch{return t}}function Ur(t){let e={};return t?(new Headers(t).forEach((n,r)=>e[r]=n),Ye(e)):e}function Ye(t){let e={};for(let n of Object.keys(t))e[n]=Vr.test(n)?"***":t[n];return e}function Br(t){let e={};for(let n of t.trim().split(/\r?\n/)){let r=n.indexOf(":");r>0&&(e[n.slice(0,r).trim()]=n.slice(r+1).trim());}return Ye(e)}function Yt(t,e,n){let r={reqHeaders:e};if(t!=null){r.reqBody=gt(yt(t,e["content-type"]));let s=Zr(t);s&&Object.assign(r,s);}return r}async function qr(t){let e={resHeaders:Fr(t.headers)},n=t.headers.get("content-type")??"",r=Number(t.headers.get("content-length")??0);if((/json|text|xml|javascript|graphql/i.test(n)||!n&&r>0&&r<Ke*8)&&r<Ke*8)try{let i=await t.clone().text();e.resBody=gt(yt(i,n));}catch{}return e}function Fr(t){let e={};return t.forEach((n,r)=>e[r]=n),Ye(e)}function Zr(t){try{let e=JSON.parse(t),n=Array.isArray(e)?e[0]:e,r=n?.query;if(typeof r!="string")return;let s=r.match(/\b(query|mutation|subscription)\b\s+([A-Za-z0-9_]+)?/),i=typeof n.operationName=="string"?n.operationName:s?.[2];return {operationType:s?.[1]??"query",...i?{operationName:i}:{}}}catch{return}}function tn(t){let e=0,n=0,r=()=>{e++,n=requestAnimationFrame(r);};n=requestAnimationFrame(r);let s=setInterval(()=>{let i=performance.memory;t(B(I.Performance,{sample:true,fps:e/2,domNodes:document.getElementsByTagName("*").length,...i?{memoryMB:Math.round(i.usedJSHeapSize/1048576*10)/10}:{}})),e=0;},2e3);return ()=>{clearInterval(s),cancelAnimationFrame(n);}}var Xe=class{constructor(e,n,r=""){this.config=e;this.emit=n;this.sessionId=r;}config;emit;sessionId;stopFns=[];rrwebStop;start(){this.beginRecording();}beginRecording(){if(this.rrwebStop)return;let e=["[data-mask]","[data-private]",...this.config.maskSelectors].filter(Boolean).join(","),n=["[data-ignore]",...this.config.ignoreSelectors].filter(Boolean).join(",");if(this.rrwebStop=record({emit:r=>this.emit(r),checkoutEveryNms:6e4,maskAllInputs:this.config.maskInputs,maskTextSelector:e||void 0,blockSelector:n||void 0,maskInputFn:(r,s)=>this.config.maskInputs||qt(s)?"\u2022".repeat(r.length):r,recordCanvas:false,sampling:{mousemove:true,scroll:150,input:"last"}}),this.config.recordConsole&&this.stopFns.push(Xt(this.emit)),this.config.recordErrors&&this.stopFns.push(Jt(this.emit)),this.config.recordNetwork){let r=this.config.tracePropagation&&this.sessionId?{sessionId:this.sessionId,targets:this.config.tracePropagationTargets}:void 0;this.stopFns.push(Gt(this.emit,r,{bodies:this.config.recordNetworkBodies,selfEndpoint:this.config.endpoint}));}this.config.capturePerformance&&this.stopFns.push(Qt(this.emit)),this.config.captureMemory&&this.stopFns.push(tn(this.emit)),this.config.captureWebVitals&&this.stopFns.push(en(this.emit));}emitCustom(e,n){this.emit({type:N.Custom,timestamp:Date.now(),data:{tag:e,payload:n}});}takeFullSnapshot(){try{record.takeFullSnapshot(!0);}catch{}}stop(){this.rrwebStop?.(),this.rrwebStop=void 0;for(let e of this.stopFns)e();this.stopFns=[];}};var Wr=1024*1024,Kr=64,Yr=60*1024,Je=class t{constructor(e,n){this.sessionId=e;this.opts=n;this.url=`${n.endpoint.replace(/\/$/,"")}/v1/collect`,this.maxBatchBytes=n.maxBatchBytes??Wr;}sessionId;opts;buffer=[];seq=0;timer;url;maxBatchBytes;flushing;flushAgain=false;start(){this.timer=setInterval(()=>this.flush(),this.opts.flushIntervalMs),window.addEventListener("pagehide",this.flushBeacon),document.addEventListener("visibilitychange",this.onVisibility);}enqueue(e){this.buffer.push(e),(e.type===N.FullSnapshot||this.buffer.length>=this.opts.batchSize)&&this.flush();}stop(){this.timer&&clearInterval(this.timer),window.removeEventListener("pagehide",this.flushBeacon),document.removeEventListener("visibilitychange",this.onVisibility),this.flushBeacon();}discard(){this.timer&&clearInterval(this.timer),window.removeEventListener("pagehide",this.flushBeacon),document.removeEventListener("visibilitychange",this.onVisibility),this.buffer=[];}onVisibility=()=>{document.visibilityState==="hidden"&&this.flushBeacon();};drain(e=this.maxBatchBytes){if(this.buffer.length===0)return null;let n=[],r=0;for(;this.buffer.length>0;){let i=JSON.stringify(this.buffer[0]).length;if(n.length>0&&r+i>e)break;n.push(this.buffer.shift()),r+=i;}let s=this.opts.getIdentity();return {v:1,projectId:this.opts.projectId,sessionId:this.sessionId,seq:this.seq++,anonymousId:s.anonymousId,userId:s.userId,userTraits:s.userTraits,events:n,meta:this.opts.getMeta(),sentAt:Date.now()}}requeue(e){this.buffer.unshift(...e.events),this.seq--;}static GZIP_THRESHOLD_BYTES=64*1024;preferPlain=false;plainRetrySeq=null;static gzipDeadlineMs(e){return Math.min(15e3,2e3+Math.ceil(e/1e6)*1e3)}async encodeBody(e,n=false){if(n||this.preferPlain||e.length<t.GZIP_THRESHOLD_BYTES||typeof CompressionStream>"u")return {body:e};try{let r=await new Promise(s=>{let i=setTimeout(()=>s(null),t.gzipDeadlineMs(e.length));try{let o=new Blob([e]).stream().pipeThrough(new CompressionStream("gzip"));new Response(o).blob().then(a=>{clearTimeout(i),s(a);}).catch(()=>{clearTimeout(i),s(null);});}catch{clearTimeout(i),s(null);}});return r?{body:r,encoding:"gzip"}:(this.preferPlain=!0,{body:e})}catch{return {body:e}}}flush(){return this.flushing?(this.flushAgain=true,this.flushing):(this.flushing=this.drainAll().finally(()=>{this.flushing=void 0;}),this.flushing)}async drainAll(){do{this.flushAgain=false;for(let e=0;e<Kr;e++){let n=this.drain();if(!n)break;if(!await this.send(n))return}}while(this.flushAgain)}async send(e){let n=this.plainRetrySeq===e.seq,{body:r,encoding:s}=await this.encodeBody(JSON.stringify(e),n);try{let i=await fetch(this.url,{method:"POST",headers:{"content-type":"application/json",...s?{"content-encoding":s}:{},"x-api-key":this.opts.apiKey},body:r,credentials:"omit",mode:"cors",signal:typeof AbortSignal<"u"&&"timeout"in AbortSignal?AbortSignal.timeout(6e4):void 0});return i.ok?(n&&(this.preferPlain=!0,this.plainRetrySeq=null),!0):s&&(i.status===400||i.status===415)?(this.plainRetrySeq=e.seq,this.requeue(e),!1):i.status===429||i.status>=500?(this.requeue(e),!1):(console.warn(`[replayops] collector rejected batch seq=${e.seq} with ${i.status}`+(i.status===413?": payload too large, so this session may not be replayable. Raise the ingest body limit.":"")),!0)}catch{return s?this.plainRetrySeq=e.seq:n&&(this.plainRetrySeq=null),this.requeue(e),false}}flushBeacon=()=>{let e=this.drain(Yr);e&&fetch(this.url,{method:"POST",headers:{"content-type":"application/json","x-api-key":this.opts.apiKey},body:JSON.stringify(e),keepalive:true,credentials:"omit",mode:"cors"}).catch(()=>{});}};var rn=["#ef4444","#f59e0b","#22c55e","#3b82f6"],Ge=null;function Xr(t){let e=window;return e.html2canvas?Promise.resolve(e.html2canvas):Ge||(Ge=new Promise((n,r)=>{let s=document.createElement("script");s.src=`${t}/sdk/v1/html2canvas.min.js`,s.async=true,s.onload=()=>e.html2canvas?n(e.html2canvas):r(new Error("html2canvas missing")),s.onerror=()=>r(new Error("html2canvas failed to load")),document.head.appendChild(s);}),Ge)}var vt=null;async function sn(t){if(vt)return;let e=t.endpoint.replace(/\/$/,""),n=await Gr();if(!n){let s=q("","position:fixed;left:50%;top:16px;transform:translateX(-50%);z-index:2147483646;background:#111827;color:#fff;font:600 13px system-ui,sans-serif;padding:8px 14px;border-radius:8px;box-shadow:0 6px 24px rgba(0,0,0,.3)");s.textContent="\u{1F41E} Capturing the screen\u2026",s.setAttribute("data-ignore",""),document.body.appendChild(s);try{n=await(await Xr(e))(document.documentElement,{backgroundColor:"#ffffff",useCORS:!0,logging:!1,scale:Math.min(2,window.devicePixelRatio||1),ignoreElements:o=>o instanceof HTMLElement&&o.hasAttribute("data-ignore"),x:window.scrollX,y:window.scrollY,width:window.innerWidth,height:window.innerHeight,windowWidth:document.documentElement.scrollWidth,windowHeight:document.documentElement.scrollHeight});}catch{s.remove(),on(e,t,null);return}s.remove();}let r=rs(n,1600);Qr(e,t,r);}var je=null;async function Jr(t){Qe();try{let e=await t.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include",surfaceSwitching:"exclude"});return e.getVideoTracks().forEach(n=>n.onended=()=>{je===e&&(je=null);}),je=e,e}catch{return null}}async function Gr(){let t=navigator.mediaDevices;if(!t?.getDisplayMedia)return null;let e=await Jr(t);if(!e)return null;let n=document.createElement("style");n.setAttribute("data-ignore",""),n.textContent="[data-ignore]{visibility:hidden !important}",document.head.appendChild(n);try{let r=document.createElement("video");r.srcObject=e,r.muted=!0,await r.play(),await new Promise(a=>setTimeout(a,200));let s=r.videoWidth||window.innerWidth,i=r.videoHeight||window.innerHeight,o=document.createElement("canvas");return o.width=s,o.height=i,o.getContext("2d").drawImage(r,0,0,s,i),r.srcObject=null,o}catch{return null}finally{n.remove(),Qe();}}function Qe(){je?.getTracks().forEach(t=>t.stop()),je=null;}function Qr(t,e,n){let r=document.createElement("style");r.setAttribute("data-ignore",""),r.textContent="@media (max-width:760px){.ro-tester-root{flex-direction:column !important}.ro-tester-stage{flex:1 1 45% !important;min-height:0;padding:8px !important}.ro-tester-panel{width:100% !important;flex:1 1 55% !important;min-height:0}}",document.head.appendChild(r);let s=q("ro-tester-root","position:fixed;inset:0;z-index:2147483646;background:rgba(15,23,42,.82);display:flex;font-family:system-ui,-apple-system,sans-serif");s.setAttribute("data-ignore","");let i=q("ro-tester-stage","flex:1;min-width:0;display:grid;place-items:center;padding:16px;overflow:auto"),o=document.createElement("canvas");o.width=n.width,o.height=n.height,o.style.cssText="max-width:100%;max-height:100%;box-shadow:0 8px 40px rgba(0,0,0,.5);cursor:crosshair;touch-action:none;background:#fff",i.appendChild(o);let a=o.getContext("2d"),c=[],l="rect",f=rn[0],T=null,H=()=>Math.max(2,Math.round(o.width/320)),j=()=>Math.max(16,Math.round(o.width/40)),W=y=>{if(a.strokeStyle=y.color,a.fillStyle=y.color,a.lineWidth=H(),a.lineJoin=a.lineCap="round",y.tool==="text"){let P=y.points[0];P&&y.text&&(a.font=`700 ${j()}px system-ui,sans-serif`,a.textBaseline="top",y.text.split(`
|
|
2
|
-
`).forEach((re,fn)=>a.fillText(re,P.x,P.y+fn*j()*1.25)));return}if(y.tool==="pen"){a.beginPath(),y.points.forEach((P,re)=>re?a.lineTo(P.x,P.y):a.moveTo(P.x,P.y)),a.stroke();return}if(y.points.length<2)return;let E=y.points[0],C=y.points[y.points.length-1];if(y.tool==="rect")a.strokeRect(E.x,E.y,C.x-E.x,C.y-E.y);else {a.beginPath(),a.moveTo(E.x,E.y),a.lineTo(C.x,C.y),a.stroke();let P=Math.atan2(C.y-E.y,C.x-E.x),re=H()*4;a.beginPath(),a.moveTo(C.x,C.y),a.lineTo(C.x-re*Math.cos(P-Math.PI/6),C.y-re*Math.sin(P-Math.PI/6)),a.lineTo(C.x-re*Math.cos(P+Math.PI/6),C.y-re*Math.sin(P+Math.PI/6)),a.closePath(),a.fill();}},x=()=>{a.clearRect(0,0,o.width,o.height),a.drawImage(n,0,0),c.forEach(W),T&&W(T);};x();let b=y=>{let E=o.getBoundingClientRect();return {x:(y.clientX-E.left)/E.width*o.width,y:(y.clientY-E.top)/E.height*o.height}};o.addEventListener("pointerdown",y=>{if(l==="text"){y.preventDefault();let E=b(y);ns(y.clientX,y.clientY,f,C=>{C.trim()&&(c.push({tool:"text",color:f,points:[E],text:C}),x());});return}o.setPointerCapture(y.pointerId),T={tool:l,color:f,points:[b(y)]};}),o.addEventListener("pointermove",y=>{if(!T)return;let E=b(y);T.tool==="pen"?T.points.push(E):T.points[1]=E,x();}),o.addEventListener("pointerup",()=>{if(!T)return;let y=T;T=null,(y.tool==="pen"?y.points.length>1:y.points.length>=2)&&c.push(y),x();});let S=q("ro-tester-panel","width:320px;flex-shrink:0;background:#fff;display:flex;flex-direction:column;color:#0f172a;min-height:0");S.innerHTML='<div style="padding:14px 16px;display:flex;align-items:center;gap:8px;border-bottom:1px solid #e2e8f0"><span style="font-size:18px">\u{1F41E}</span><b style="font-size:16px">Tester mode</b></div>';let A=q("","padding:14px 16px;overflow-y:auto;flex:1");S.appendChild(A);let D=q("","display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:12px"),K={};[["rect","\u25AD"],["arrow","\u2197"],["pen","\u270E"],["text","T"]].forEach(([y,E])=>{let C=$e(E,"width:34px;height:32px;border:1px solid #cbd5e1;background:#fff;border-radius:8px;font-size:15px;cursor:pointer");C.onclick=()=>{l=y,Object.values(K).forEach(P=>P.style.background="#fff"),C.style.background="#e0e7ff";},K[y]=C,D.appendChild(C);}),K.rect.style.background="#e0e7ff",rn.forEach(y=>{let E=q("",`width:22px;height:22px;border-radius:50%;background:${y};cursor:pointer;border:2px solid ${y===f?"#fff":"transparent"};outline:2px solid ${y===f?y:"transparent"}`);E.onclick=()=>{f=y,[...D.querySelectorAll("[data-swatch]")].forEach(C=>{C.style.border="2px solid transparent",C.style.outline="2px solid transparent";}),E.style.border="2px solid #fff",E.style.outline=`2px solid ${y}`;},E.setAttribute("data-swatch",""),D.appendChild(E);});let F=$e("\u21B6","margin-left:auto;width:32px;height:32px;border:1px solid #cbd5e1;background:#fff;border-radius:8px;cursor:pointer");F.onclick=()=>{c.pop(),x();};let ce=$e("\u{1F5D1}","width:32px;height:32px;border:1px solid #cbd5e1;background:#fff;border-radius:8px;cursor:pointer");ce.onclick=()=>{c.length=0,x();},D.append(F,ce),A.appendChild(D);let De=document.createElement("textarea");De.placeholder="What's wrong on this page? (optional, AI will draft it)",De.style.cssText="width:100%;box-sizing:border-box;padding:8px 10px;border:1px solid #cbd5e1;border-radius:8px;font:inherit;min-height:90px;resize:vertical";let kt=q("","font-size:12px;color:#64748b;margin-top:10px;word-break:break-all"),rt=document.createElement("b");rt.style.color="#334155",rt.textContent="URL ",kt.append(rt,document.createTextNode(location.href)),A.append(ts("What's wrong?",De),kt);let Tt=q("","display:flex;gap:8px;padding:14px 16px;border-top:1px solid #e2e8f0"),Et=$e("Cancel","flex:1;padding:10px;border:1px solid #cbd5e1;background:#fff;border-radius:8px;font:inherit;cursor:pointer"),Ve=$e("Open ticket","flex:1;padding:10px;border:0;background:#0d9488;color:#fff;border-radius:8px;font:600 14px system-ui;cursor:pointer");Tt.append(Et,Ve),S.appendChild(Tt),s.append(i,S),document.body.appendChild(s);let st=()=>{s.remove(),r.remove(),vt=null;};vt=st,Et.onclick=st,Ve.onclick=()=>{Ve.disabled=true,Ve.textContent="Opening\u2026";let y=o.toDataURL("image/jpeg",.85);on(t,e,{title:"",note:De.value.trim(),screenshot:y}),st();};}function on(t,e,n){let r=new URLSearchParams({key:e.apiKey,url:location.href,sid:e.sessionId}),s=`${t}/tester-report.html?${r.toString()}`,i=window.open(s,"replayops-tester","width=480,height=680");if(!i){es(s);return}if(!n)return;let o=a=>{a.origin!==t||!a.data||a.data.type!=="ro-tester:popup-ready"||(window.removeEventListener("message",o),i.postMessage({type:"ro-tester:payload",...n},t));};window.addEventListener("message",o);}function es(t){let e=q("","position:fixed;left:50%;bottom:24px;transform:translateX(-50%);z-index:2147483647;max-width:min(420px,calc(100vw - 32px));background:#0f172a;color:#fff;padding:14px 16px;border-radius:12px;font:14px system-ui;box-shadow:0 12px 40px rgba(0,0,0,.35)");e.setAttribute("data-ignore","");let n=document.createElement("div");n.textContent="ReplayOps could not open the report window. Your browser or app blocked it.";let r=document.createElement("a");r.href=t,r.target="_blank",r.rel="noopener",r.textContent="Open the report form",r.style.cssText="color:#5eead4;display:inline-block;margin-top:8px",e.append(n,r),document.body.appendChild(e),setTimeout(()=>e.remove(),12e3);}function q(t,e){let n=document.createElement("div");return t&&(n.className=t),n.style.cssText=e,n}function $e(t,e){let n=document.createElement("button");return n.type="button",n.textContent=t,n.style.cssText=e,n}function ts(t,e){let n=q("","margin-bottom:4px"),r=q("","font-size:12px;font-weight:700;color:#475569;margin:8px 0 4px");return r.textContent=t,n.append(r,e),n}function ns(t,e,n,r){let s=document.createElement("input");s.setAttribute("data-ignore",""),s.placeholder="Type, then Enter";let i=Math.min(t,window.innerWidth-180),o=Math.min(e,window.innerHeight-40);s.style.cssText=`position:fixed;left:${i}px;top:${o}px;z-index:2147483647;font:700 15px system-ui;color:${n};background:rgba(255,255,255,.98);border:2px solid ${n};border-radius:4px;padding:4px 8px;outline:none;min-width:140px;box-shadow:0 4px 16px rgba(0,0,0,.25)`;let a=false,c=()=>{if(a)return;a=true;let l=s.value;s.remove(),r(l);};s.addEventListener("keydown",l=>{l.stopPropagation(),l.key==="Enter"&&(l.preventDefault(),c()),l.key==="Escape"&&(s.value="",c());}),document.body.appendChild(s),setTimeout(()=>{s.focus(),setTimeout(()=>s.addEventListener("blur",c),60);},0);}function rs(t,e){if(t.width<=e)return t;let n=e/t.width,r=document.createElement("canvas");return r.width=e,r.height=Math.round(t.height*n),r.getContext("2d").drawImage(t,0,0,r.width,r.height),r}var ss=1e4,is=3e3;function os(){let t=new Uint8Array(16);return crypto.getRandomValues(t),Array.from(t,e=>e.toString(16).padStart(2,"0")).join("")}var et=class{constructor(e){this.opts=e;}opts;ws;heartbeat;watching=false;closed=false;claim=os();lifecycleOff=[];widget;control;start(){(this.opts.chat||this.opts.tester)&&(this.widget=new xt({chat:!!this.opts.chat,onSend:e=>this.sendChat(e),onTester:this.opts.tester?()=>this.openTesterMode():void 0})),this.connect(),this.patchHistory(),this.watchLifecycle();}watchLifecycle(){let e=()=>{if(this.closed)return;let i=this.ws?.readyState;i===WebSocket.OPEN||i===WebSocket.CONNECTING||this.connect();},n=()=>{this.heartbeat&&clearInterval(this.heartbeat),this.ws?.close();},r=()=>document.visibilityState==="visible"?e():void 0,s=(i,o,a)=>{i.addEventListener(o,a),this.lifecycleOff.push(()=>i.removeEventListener(o,a));};s(window,"pagehide",n),s(window,"pageshow",e),s(window,"online",e),s(document,"visibilitychange",r);}openTesterMode(){sn({endpoint:this.opts.endpoint,apiKey:this.opts.apiKey,sessionId:this.opts.sessionId});}feedEvent(e){this.watching&&this.send({t:"evt",e});}stop(){this.closed=true;for(let e of this.lifecycleOff)e();this.lifecycleOff=[],this.heartbeat&&clearInterval(this.heartbeat),this.ws?.close(),this.widget?.destroy(),Qe(),this.endControl();}wsUrl(){return `${this.opts.endpoint.replace(/^http/,"ws").replace(/\/$/,"")}/ws/live?key=${encodeURIComponent(this.opts.apiKey)}`}connect(){if(this.closed)return;let e=this.ws?.readyState;if(e===WebSocket.OPEN||e===WebSocket.CONNECTING)return;let n;try{n=new WebSocket(this.wsUrl());}catch{return}this.ws=n,n.onopen=()=>{this.send({t:"hello",sessionId:this.opts.sessionId,claim:this.claim,url:location.href,identity:this.opts.getIdentity(),meta:this.opts.getMeta()}),this.heartbeat=setInterval(()=>this.send({t:"ping"}),ss);},n.onmessage=r=>{let s;try{s=JSON.parse(String(r.data));}catch{return}s.t==="watch"?(this.watching=!!s.on,s.on?(this.send({t:"evt",e:{type:4,timestamp:Date.now(),data:{href:location.href,width:window.innerWidth,height:window.innerHeight}}}),this.opts.onWatchStart()):this.endControl()):s.t==="chat"&&typeof s.text=="string"?this.widget?.receive(s.text):s.t==="control-request"?this.onControlRequest():s.t==="control-cmd"&&s.cmd?this.control?.apply(s.cmd):s.t==="control-end"&&this.endControl();},n.onclose=()=>{this.heartbeat&&clearInterval(this.heartbeat),this.watching=false,this.closed||setTimeout(()=>this.connect(),is);},n.onerror=()=>n.close();}sendChat(e){this.send({t:"chat",text:e});}onControlRequest(){this.opts.remoteControl===false||this.control||as(()=>this.grantControl(),()=>this.send({t:"control",on:false}));}grantControl(){this.control||(this.send({t:"control",on:true}),this.control=new bt(()=>{this.send({t:"control",on:false}),this.endControl();}));}endControl(){this.control?.destroy(),this.control=void 0;}send(e){this.ws&&this.ws.readyState===WebSocket.OPEN&&this.ws.send(JSON.stringify(e));}patchHistory(){let e=()=>this.send({t:"nav",url:location.href}),n=r=>{let s=history[r];history[r]=function(...i){let o=s.apply(this,i);return e(),o};};n("pushState"),n("replaceState"),window.addEventListener("popstate",e);}},xt=class{root;panel;log;badge;open=false;onSend;constructor(e){let{chat:n,onTester:r}=e;if(this.onSend=e.onSend,wt(),this.root=R("div","ro-live-root"),this.root.setAttribute("data-ignore",""),n&&this.buildChat(),r){let s=R("button","ro-live-tester-launcher");s.type="button",s.setAttribute("aria-label","Report a bug (tester)"),s.title="Tester tools",s.textContent="\u{1F41E}",s.onclick=()=>r(),this.root.append(s);}this.isolateFromHost(),document.body.appendChild(this.root);}isolateFromHost(){let e=n=>{let r=n.target;return !!r&&this.root.contains(r)};for(let n of ["pointerdown","mousedown","touchstart","click"])window.addEventListener(n,r=>{e(r)&&(r.stopImmediatePropagation(),r.type==="click"&&this.runOwnClick(r));},true);}runOwnClick(e){let n=e.target;for(;n&&n!==this.root;){if(typeof n.onclick=="function"){n.onclick(e);return}n=n.parentElement;}}buildChat(){let e=R("button","ro-live-launcher");e.setAttribute("aria-label","Chat"),e.innerHTML="\u{1F4AC}",this.badge=R("span","ro-live-badge"),this.badge.style.display="none",e.appendChild(this.badge),e.onclick=()=>this.toggle(),this.panel=R("div","ro-live-panel");let n=R("div","ro-live-header");n.textContent="Chat with us",this.log=R("div","ro-live-log");let r=R("form","ro-live-form"),s=R("input","ro-live-input");s.placeholder="Type a message\u2026";let i=R("button","ro-live-send");i.type="submit",i.textContent="Send",r.append(s,i),r.onsubmit=o=>{o.preventDefault();let a=s.value.trim();a&&(s.value="",this.append(a,"me"),this.onSend(a));},this.panel.append(n,this.log,r),this.panel.style.display="none",this.root.append(this.panel,e);}toggle(){this.panel&&(this.open=!this.open,this.panel.style.display=this.open?"flex":"none",this.open&&this.badge&&(this.badge.style.display="none",this.badge.textContent=""));}receive(e){if(!(!this.log||!this.badge)&&(this.append(e,"agent"),!this.open)){let n=(parseInt(this.badge.textContent||"0",10)||0)+1;this.badge.textContent=String(n),this.badge.style.display="grid";}}append(e,n){if(!this.log)return;let r=R("div",`ro-live-msg ro-live-${n}`);r.textContent=e,this.log.appendChild(r),this.log.scrollTop=this.log.scrollHeight;}destroy(){this.root.remove();}};function as(t,e){wt();let n=R("div","ro-ctl-consent");n.setAttribute("data-ignore","");let r=R("div","ro-ctl-card");r.innerHTML='<div class="ro-ctl-title">Allow support to control your screen?</div><div class="ro-ctl-body">A support agent is asking to take control of this page to help you. They can move your cursor, click, scroll and type. You can stop this at any time.</div>';let s=R("div","ro-ctl-actions"),i=R("button","ro-ctl-btn ro-ctl-decline");i.textContent="Not now";let o=R("button","ro-ctl-btn ro-ctl-allow");o.textContent="Allow control",s.append(i,o),r.appendChild(s),n.appendChild(r),document.body.appendChild(n);let a=()=>n.remove();i.onclick=()=>{a(),e();},o.onclick=()=>{a(),t();};}var bt=class{constructor(e){this.onStop=e;wt(),this.banner=R("div","ro-ctl-banner"),this.banner.setAttribute("data-ignore","");let n=R("span","ro-ctl-banner-text");n.textContent="A support agent is controlling your screen";let r=R("button","ro-ctl-stop");r.textContent="Stop",r.onclick=()=>this.onStop(),this.banner.append(n,r),this.cursor=R("div","ro-ctl-cursor"),this.cursor.setAttribute("data-ignore",""),this.cursor.innerHTML='<span class="ro-ctl-cursor-label">Agent</span>',document.body.append(this.banner,this.cursor);}onStop;banner;cursor;apply(e){switch(e.c){case "cursor":this.moveCursor(e.x,e.y);break;case "click":this.moveCursor(e.x,e.y),this.clickAt(e.x*window.innerWidth,e.y*window.innerHeight);break;case "scroll":window.scrollBy({left:e.x,top:e.y,behavior:"auto"});break;case "key":this.typeKey(e.key);break;case "nav":e.url&&e.url!==location.href&&/^https?:\/\//i.test(e.url)&&(location.href=e.url);break}}moveCursor(e,n){this.cursor.style.left=`${e*window.innerWidth}px`,this.cursor.style.top=`${n*window.innerHeight}px`;}clickAt(e,n){let r=document.elementFromPoint(e,n);if(!r||this.isOurs(r))return;let s={bubbles:true,cancelable:true,clientX:e,clientY:n,view:window};r.dispatchEvent(new MouseEvent("mousedown",s)),r.dispatchEvent(new MouseEvent("mouseup",s)),r.dispatchEvent(new MouseEvent("click",s));let i=r.tagName;(i==="INPUT"||i==="TEXTAREA"||i==="SELECT"||r.isContentEditable)&&r.focus(),this.pulse(e,n);}typeKey(e){let n=document.activeElement;if(!(!n||this.isOurs(n)||!(n.tagName==="INPUT"||n.tagName==="TEXTAREA"))&&!(n.tagName==="INPUT"&&n.type==="password")){if(e==="Enter"){n.dispatchEvent(new KeyboardEvent("keydown",{key:"Enter",bubbles:true})),n.form?.requestSubmit?.();return}if(e==="Backspace")n.value=n.value.slice(0,-1);else if(e.length===1)n.value+=e;else return;n.dispatchEvent(new Event("input",{bubbles:true})),n.dispatchEvent(new Event("change",{bubbles:true}));}}pulse(e,n){let r=R("div","ro-ctl-pulse");r.setAttribute("data-ignore",""),r.style.left=`${e}px`,r.style.top=`${n}px`,document.body.appendChild(r),setTimeout(()=>r.remove(),600);}isOurs(e){return !!e.closest("[data-ignore]")}destroy(){this.banner.remove(),this.cursor.remove();}};function R(t,e){let n=document.createElement(t);return n.className=e,n}var an=false;function wt(){if(an)return;an=true;let t=document.createElement("style");t.setAttribute("data-ignore",""),t.textContent=`
|
|
3
|
-
.ro-live-root{position:fixed;right:20px;bottom:20px;max-width:calc(100vw - 24px);z-index:2147483000;font-family:system-ui,-apple-system,sans-serif;display:flex;flex-direction:column;align-items:flex-end;gap:12px}
|
|
4
|
-
.ro-live-launcher{width:56px;height:56px;border-radius:50%;border:none;background:#6366f1;color:#fff;font-size:24px;cursor:pointer;box-shadow:0 6px 20px rgba(0,0,0,.25);position:relative}
|
|
5
|
-
.ro-live-badge{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;border-radius:10px;background:#ef4444;color:#fff;font-size:12px;display:grid;place-items:center;padding:0 5px}
|
|
6
|
-
/* Caps keep the panel inside a small phone viewport (a 320px panel plus
|
|
7
|
-
the 20px offsets overflows an iPhone SE) without changing the desktop look. */
|
|
8
|
-
.ro-live-panel{width:min(320px,calc(100vw - 32px));height:min(420px,calc(100vh - 160px));background:#fff;color:#111;border-radius:14px;box-shadow:0 12px 40px rgba(0,0,0,.28);flex-direction:column;overflow:hidden}
|
|
9
|
-
.ro-live-header{padding:14px 16px;background:#6366f1;color:#fff;font-weight:600}
|
|
10
|
-
.ro-live-log{flex:1;padding:12px;overflow-y:auto;display:flex;flex-direction:column;gap:8px;background:#f7f8fa}
|
|
11
|
-
.ro-live-msg{max-width:78%;padding:8px 12px;border-radius:14px;font-size:14px;line-height:1.35;word-break:break-word}
|
|
12
|
-
.ro-live-me{align-self:flex-end;background:#6366f1;color:#fff;border-bottom-right-radius:4px}
|
|
13
|
-
.ro-live-agent{align-self:flex-start;background:#e8eaf1;color:#111;border-bottom-left-radius:4px}
|
|
14
|
-
.ro-live-form{display:flex;gap:8px;padding:10px;border-top:1px solid #e3e6ee;background:#fff}
|
|
15
|
-
.ro-live-input{flex:1;border:1px solid #cdd2df;border-radius:10px;padding:9px 12px;font-size:14px;outline:none}
|
|
16
|
-
.ro-live-send{border:none;background:#6366f1;color:#fff;border-radius:10px;padding:0 14px;font-size:14px;cursor:pointer}
|
|
17
|
-
.ro-live-tester-launcher{width:44px;height:44px;border-radius:50%;border:none;background:#0d9488;color:#fff;font-size:20px;cursor:pointer;box-shadow:0 6px 20px rgba(0,0,0,.25);display:grid;place-items:center;padding:0;line-height:1}
|
|
18
|
-
.ro-live-tester-launcher:hover{background:#0f766e}
|
|
19
|
-
.ro-ctl-consent{position:fixed;inset:0;z-index:2147483600;background:rgba(10,14,22,.55);display:grid;place-items:center;font-family:system-ui,-apple-system,sans-serif}
|
|
20
|
-
.ro-ctl-card{width:min(420px,92vw);background:#fff;color:#111;border-radius:16px;box-shadow:0 20px 60px rgba(0,0,0,.35);padding:22px}
|
|
21
|
-
.ro-ctl-title{font-size:17px;font-weight:700;margin-bottom:8px}
|
|
22
|
-
.ro-ctl-body{font-size:14px;line-height:1.5;color:#444}
|
|
23
|
-
.ro-ctl-actions{display:flex;justify-content:flex-end;gap:10px;margin-top:18px}
|
|
24
|
-
.ro-ctl-btn{border:none;border-radius:10px;padding:10px 16px;font-size:14px;font-weight:600;cursor:pointer}
|
|
25
|
-
.ro-ctl-decline{background:#eceef4;color:#333}
|
|
26
|
-
.ro-ctl-allow{background:#6366f1;color:#fff}
|
|
27
|
-
.ro-ctl-banner{position:fixed;top:0;left:0;right:0;z-index:2147483500;background:#111827;color:#fff;display:flex;align-items:center;justify-content:center;gap:14px;padding:9px 16px;font-family:system-ui,-apple-system,sans-serif;font-size:13px;box-shadow:0 2px 12px rgba(0,0,0,.3)}
|
|
28
|
-
.ro-ctl-banner-text::before{content:'\u25CF';color:#f87171;margin-right:7px}
|
|
29
|
-
.ro-ctl-stop{border:1px solid rgba(255,255,255,.5);background:transparent;color:#fff;border-radius:8px;padding:4px 12px;font-size:13px;font-weight:600;cursor:pointer}
|
|
30
|
-
.ro-ctl-cursor{position:fixed;z-index:2147483400;width:14px;height:14px;pointer-events:none;transform:translate(-2px,-2px);transition:left .06s linear,top .06s linear}
|
|
31
|
-
.ro-ctl-cursor::before{content:'';position:absolute;width:0;height:0;border-left:10px solid #6366f1;border-top:6px solid transparent;border-bottom:6px solid transparent;transform:rotate(-38deg)}
|
|
32
|
-
.ro-ctl-cursor-label{position:absolute;left:14px;top:12px;background:#6366f1;color:#fff;font:600 11px system-ui,sans-serif;padding:1px 6px;border-radius:6px;white-space:nowrap}
|
|
33
|
-
.ro-ctl-pulse{position:fixed;z-index:2147483400;width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;background:rgba(99,102,241,.5);pointer-events:none;animation:ro-ctl-pulse .6s ease-out forwards}
|
|
34
|
-
@keyframes ro-ctl-pulse{from{transform:scale(.4);opacity:.9}to{transform:scale(2.6);opacity:0}}
|
|
35
|
-
`,document.head.appendChild(t);}function cn(){let t=document.cookie.match(/(?:^|;\s*)_ga=([^;]+)/);if(!t)return;let e=decodeURIComponent(t[1]).split(".");if(!(e.length<4))return `${e[e.length-2]}.${e[e.length-1]}`}function dn(t){let e=window.gtag;if(typeof e=="function")try{e("event","replayops_session",{replayops_session_id:t});}catch{}}function _t(t,e,n,r){return {entryUrl:r,currentUrl:location.href,referrer:document.referrer,device:ft(navigator.userAgent),screen:{width:window.innerWidth||document.documentElement?.clientWidth||window.screen?.width||1,height:window.innerHeight||document.documentElement?.clientHeight||window.screen?.height||1,dpr:window.devicePixelRatio||1},language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,environment:t,releaseVersion:e,sdkVersion:n}}function cs(t){switch((t.inputType??"text").toLowerCase()){case "email":return "rerun@replayops.test";case "password":return "ReRunTest!12345";case "tel":case "number":return "4242424242";default:return "ReplayOps re-run"}}function ds(){let t=/ro_rerun=([^&]+)/.exec(location.hash);if(!t)return null;let[e,n]=t[1].split("|");if(!e||!n)return null;let r=decodeURIComponent(e).replace(/\/$/,"");try{let s=new URL(r);if(s.protocol!=="https:"&&s.protocol!=="http:")return null;let i=s.hostname==="localhost"||s.hostname==="127.0.0.1";if(location.protocol==="https:"&&s.protocol!=="https:"&&!i)return null}catch{return null}return {api:r,token:n}}function G(t,e,n){let r=document.createElement(t);return r.setAttribute("style",e),n&&(r.textContent=n),r}var ls="position:fixed;z-index:2147483646;bottom:16px;left:16px;max-width:340px;padding:14px 16px;background:#0f172a;color:#f1f5f9;border-radius:12px;font:13px/1.45 system-ui,sans-serif;box-shadow:0 8px 30px rgba(0,0,0,.35);",nt="margin-top:10px;margin-right:8px;padding:6px 14px;border:none;border-radius:8px;cursor:pointer;font:600 13px system-ui,sans-serif;background:#2ec2b3;color:#04211d;",tt=nt+"background:transparent;color:#94a3b8;border:1px solid #334155;";async function us(t,e){let n=Date.now()+t;for(;!e.stopped&&(Date.now()<n||e.paused);)await new Promise(r=>setTimeout(r,100));}async function ps(t,e){let n=Date.now()+5e3;for(;Date.now()<n&&!e.stopped;){if(e.paused){await new Promise(r=>setTimeout(r,150));continue}for(let r of t.selectors??[]){let s=[];try{s=[...document.querySelectorAll(r)];}catch{continue}if(!s.length)continue;return (t.text?s.find(o=>(o.textContent??"").replace(/\s+/g," ").trim().includes(t.text)):void 0)??s[0]}if(typeof t.x=="number"&&typeof t.y=="number"){let r=document.elementFromPoint(t.x,t.y);if(r)return r}await new Promise(r=>setTimeout(r,250));}return null}function fs(t,e){let n=t instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype;Object.getOwnPropertyDescriptor(n,"value")?.set?.call(t,e),t.dispatchEvent(new Event("input",{bubbles:true})),t.dispatchEvent(new Event("change",{bubbles:true}));}function hs(t){try{let e=new URL(t,location.href);return e.origin!==location.origin?!1:(location.href=e.href,!0)}catch{return false}}async function ms(t,e,n){let r=0,s=0,i=0,o;for(let a=0;a<t.steps.length&&!n.stopped;a++){let c=t.steps[a];i=a+1,e.textContent=`Re-run ${a+1}/${t.steps.length}: ${c.label}`;let l=o===void 0?300:c.offsetMs-o;if(o=c.offsetMs,await us(Math.min(Math.max(l,300),2500),n),n.stopped)break;if(c.kind==="open"){r++;continue}if(c.kind==="navigate"&&c.url){hs(c.url)?r++:s++;continue}let f=await ps(c,n);if(n.stopped)break;if(!f){s++;continue}f.scrollIntoView({block:"center",behavior:"instant"}),c.kind==="click"?(f.click(),r++):c.kind==="input"&&(fs(f,c.masked?cs(c):c.value??""),r++);}return {ok:r,failed:s,done:i}}function ln(t){let e=ds();if(!e)return;history.replaceState(null,"",location.href.replace(/#?ro_rerun=[^&]+&?/,"").replace(/#$/,""));let n=async()=>{let r;try{let f=await fetch(`${e.api}/v1/public/rerun/${encodeURIComponent(e.token)}`);if(!f.ok)return;r=await f.json();}catch{return}if(!r.steps?.length)return;let s=G("div",ls),i=G("div","font-weight:700;margin-bottom:4px;","ReplayOps scenario re-run"),o=G("div","color:#cbd5e1;",`${r.steps.length} recorded steps from session ${r.sessionId.slice(0,8)} (via ${new URL(e.api).host}) will be replayed on this page.`),a=G("button",nt,"Run scenario"),c=G("button",tt,"Dismiss");s.append(i,o,a,c),document.body.appendChild(s),c.addEventListener("click",()=>s.remove());let l=async()=>{let f={paused:false,stopped:false},T=false,H=G("button",nt,"Pause"),j=G("button",tt,"Restart"),W=G("button",tt,"Stop");s.append(H,j,W),H.addEventListener("click",()=>{f.paused=!f.paused,H.textContent=f.paused?"Resume":"Pause";}),j.addEventListener("click",()=>{T=true,f.stopped=true;}),W.addEventListener("click",()=>{f.stopped=true;}),t("replayops_rerun",{sourceSessionId:r.sessionId,steps:r.steps.length});let x=await ms(r,o,f);if(H.remove(),j.remove(),W.remove(),T)return l();o.textContent=f.stopped?`Re-run stopped at step ${x.done}/${r.steps.length}.`:`Re-run finished: ${x.ok}/${r.steps.length} steps succeeded`+(x.failed?`, ${x.failed} failed.`:".");let b=G("button",nt,"Run again"),S=G("button",tt,"Dismiss");s.append(b,S),b.addEventListener("click",()=>{b.remove(),S.remove(),l();}),S.addEventListener("click",()=>s.remove());};a.addEventListener("click",()=>{a.remove(),c.remove(),l();});};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{n();},{once:true}):n();}var un="0.1.2",He=class{config;identity;recorder;transport;live;state="idle";sessionId="";entryUrl="";extraMask=[];extraIgnore=[];policyMaskInputs;policyLiveChat;policyTesterTools;policyLive;policySamplingRate;policySamplingMode;policyUserRules;ruledOut=false;init(e){this.config||(this.config=St(e),this.identity=new ze,this.sessionId=Ue(),this.entryUrl=location.href,!this.identity.isOptedOut()&&(this.config.requireConsent&&!this.identity.hasConsent()||this.bootstrap()));}async bootstrap(){await this.fetchPolicy();let e=Math.min(this.config.samplingRate,this.policySamplingRate??1),n=this.policySamplingMode??"session";if(It(e,n,this.identity.anonymous)){if(await this.ruleVerdict()===false){this.ruledOut=true;return}this.start(),this.watchIdle(),ln((r,s)=>this.track(r,s));}}lastActivityAt=Date.now();watchIdle(){let e=this.config?.idleTimeoutMs??0;if(e<=0)return;let n=0,r=()=>{let i=Date.now();(this.state==="suspended"||this.state==="recording"&&i-this.lastActivityAt>e)&&this.rotate(),i-n>1e3&&(n=i,this.lastActivityAt=i);};for(let i of ["pointerdown","keydown","mousemove","scroll","touchstart"])window.addEventListener(i,r,{capture:true,passive:true});let s=()=>{this.state==="recording"&&(Date.now()-this.lastActivityAt<=e||(this.recorder?.stop(),this.transport?.stop(),this.live?.stop(),this.recorder=void 0,this.transport=void 0,this.live=void 0,this.state="suspended"));};setInterval(s,6e4),document.addEventListener("visibilitychange",s);}rotate(){this.recorder?.stop(),this.transport?.stop(),this.live?.stop(),this.recorder=void 0,this.transport=void 0,this.live=void 0,this.sessionId=Ue(),this.entryUrl=location.href,this.state="idle",this.start();}async fetchPolicy(){if(this.config)try{let e=`${this.config.endpoint.replace(/\/$/,"")}/v1/config`,n=new AbortController,r=setTimeout(()=>n.abort(),1500),s=await fetch(e,{headers:{"x-api-key":this.config.apiKey},signal:n.signal}).finally(()=>clearTimeout(r));if(s.ok){let i=await s.json();typeof i.maskInputs=="boolean"&&(this.policyMaskInputs=i.maskInputs),typeof i.samplingRate=="number"&&(this.policySamplingRate=i.samplingRate),(i.samplingMode==="user"||i.samplingMode==="session")&&(this.policySamplingMode=i.samplingMode),(i.userRuleMode==="allow"||i.userRuleMode==="deny")&&Array.isArray(i.userRuleHashes)&&(this.policyUserRules={mode:i.userRuleMode,hashes:i.userRuleHashes.filter(o=>typeof o=="string")}),typeof i.liveChat=="boolean"&&(this.policyLiveChat=i.liveChat),typeof i.testerTools=="boolean"&&(this.policyTesterTools=i.testerTools),typeof i.live=="boolean"&&(this.policyLive=i.live);}}catch{}}start(){if(!this.config||!this.identity||this.state==="recording"||this.ruledOut)return;let e={...this.config,maskInputs:this.policyMaskInputs??this.config.maskInputs,live:(this.policyLive??this.config.live)&&this.config.live,liveChat:(this.policyLiveChat??this.config.liveChat)&&this.config.liveChat,testerTools:(this.policyTesterTools??this.config.testerTools)&&this.config.testerTools,maskSelectors:[...this.config.maskSelectors,...this.extraMask],ignoreSelectors:[...this.config.ignoreSelectors,...this.extraIgnore]};if(this.transport=new Je(this.sessionId,{endpoint:e.endpoint,projectId:e.projectId,apiKey:e.apiKey,batchSize:e.batchSize,flushIntervalMs:e.flushIntervalMs,maxBatchBytes:e.maxBatchBytes,getMeta:()=>_t(e.environment,e.releaseVersion,un,this.entryUrl),getIdentity:()=>this.identity.snapshot()}),e.live&&(this.live=new et({endpoint:e.endpoint,apiKey:e.apiKey,sessionId:this.sessionId,chat:e.liveChat,tester:e.testerTools,getIdentity:()=>{let n=this.identity.snapshot();return {anonymousId:n.anonymousId,userId:n.userId,email:n.userTraits?.email}},getMeta:()=>{let n=_t(e.environment,e.releaseVersion,un,this.entryUrl).device;return {browser:n.browser,os:n.os,deviceType:n.deviceType}},onWatchStart:()=>this.recorder?.takeFullSnapshot()})),this.recorder=new Xe(e,n=>{this.transport.enqueue(n),this.live?.feedEvent(n);},this.sessionId),this.transport.start(),this.recorder.start(),this.live?.start(),e.googleAnalytics){let n=cn();n&&(this.recorder.emitCustom("$ga",{clientId:n}),dn(this.sessionId));}this.state="recording";}pause(){this.state==="recording"&&(this.recorder?.stop(),this.recorder=void 0,this.live?.stop(),this.live=void 0,this.state="paused");}resume(){this.state==="paused"&&this.start();}stop(){this.recorder?.stop(),this.transport?.stop(),this.live?.stop(),this.recorder=void 0,this.transport=void 0,this.live=void 0,this.state="stopped";}identify(e,n){this.identity?.identify(e,n),this.recorder?.emitCustom("$identify",{userId:e,...n??{}}),this.enforceUserRule();}async ruleVerdict(){if(this.identity)return Ot(this.policyUserRules,this.identity.subjects())}async enforceUserRule(){this.ruledOut||!this.policyUserRules||await this.ruleVerdict()===false&&(this.ruledOut=true,this.recorder?.stop(),this.live?.stop(),this.transport?.discard(),this.state="stopped");}track(e,n={}){this.recorder?.emitCustom(e,n);}setUserProperties(e){this.identity?.setUserProperties(e);}mask(e){this.extraMask.push(e);}ignore(e){this.extraIgnore.push(e);}consent(e){this.identity?.setConsent(e),e&&this.state==="idle"&&this.config&&this.start(),e||this.stop();}optOut(){this.identity?.optOut(),this.stop();}getState(){return this.state}getSessionId(){return this.sessionId}};var pn=new He;typeof window<"u"&&(window.ReplayOps=pn);var Gi=pn;export{He as a,pn as b,Gi as c};//# sourceMappingURL=chunk-KJRPCR2B.js.map
|
|
36
|
-
//# sourceMappingURL=chunk-KJRPCR2B.js.map
|