@prodantix/sdk 0.7.0-beta.438 → 0.7.0-beta.440
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/chat.cjs +5 -107
- package/dist/chat.d.cts +93 -8
- package/dist/chat.d.ts +93 -8
- package/dist/chat.js +5 -107
- package/dist/chunk-L4P6GMBC.js +2 -0
- package/dist/client-Cz7M6XJC.d.ts +477 -0
- package/dist/client-vogZuHfD.d.cts +477 -0
- package/dist/{config-C9Njc6-j.d.ts → config-Dmk59mPh.d.ts} +40 -2
- package/dist/{config-CpfUyEw8.d.cts → config-Dxf1vAMu.d.cts} +40 -2
- package/dist/consent.iife.js +20 -0
- package/dist/ctas.iife.js +37 -0
- package/dist/forms.iife.js +16 -0
- package/dist/guides.iife.js +3 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +5 -4
- package/dist/index.d.ts +5 -4
- package/dist/index.js +1 -1
- package/dist/messenger-help.iife.js +1 -1
- package/dist/messenger-tickets.iife.js +3 -0
- package/dist/messenger.cjs +1 -1
- package/dist/messenger.d.cts +1 -1
- package/dist/messenger.d.ts +1 -1
- package/dist/messenger.iife.js +5 -107
- package/dist/messenger.js +1 -1
- package/dist/node.cjs +1 -1
- package/dist/node.d.cts +3 -2
- package/dist/node.d.ts +3 -2
- package/dist/node.js +1 -1
- package/dist/pages.iife.js +2 -0
- package/dist/prodantix-push-sw.js +3 -0
- package/dist/surveys.iife.js +2 -0
- package/dist/{transport-DKFvkfX4.d.ts → transport-C4mkCaix.d.ts} +1 -1
- package/dist/{transport-DN9pXyrX.d.cts → transport-C9C4hqlF.d.cts} +1 -1
- package/dist/{types-Q2VNlJbG.d.cts → types-BUXFV_aE.d.cts} +11 -0
- package/dist/{types-Q2VNlJbG.d.ts → types-BUXFV_aE.d.ts} +11 -0
- package/dist/web.cjs +36 -1
- package/dist/web.d.cts +185 -4
- package/dist/web.d.ts +185 -4
- package/dist/web.js +36 -1
- package/package.json +1 -1
- package/dist/chunk-D6PMLUYA.js +0 -2
- package/dist/client-CL6Xvhay.d.cts +0 -135
- package/dist/client-QyKW0LFW.d.ts +0 -135
package/dist/web.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as ProdantixClient } from './client-
|
|
2
|
-
import { T as Transport, i as TransportRequest, a as StorageAdapter, b as Consent, P as ProdantixConfig } from './types-
|
|
3
|
-
import { a as FetchTransportOptions } from './transport-
|
|
1
|
+
import { P as ProdantixClient, N as ServedForm, O as FormChallenge, Q as FormAfterSubmit, R as ServedCta, T as CtaDevice } from './client-Cz7M6XJC.js';
|
|
2
|
+
import { T as Transport, i as TransportRequest, a as StorageAdapter, b as Consent, P as ProdantixConfig } from './types-BUXFV_aE.js';
|
|
3
|
+
import { a as FetchTransportOptions } from './transport-C4mkCaix.js';
|
|
4
4
|
import { F as FetchLike } from './http-BCh716Vs.js';
|
|
5
5
|
|
|
6
6
|
declare const ANNOTATION_ATTRIBUTE = "data-prodantix";
|
|
@@ -11,6 +11,9 @@ declare const ANNOTATION_MAX_LENGTH = 300;
|
|
|
11
11
|
interface AutocaptureOptions {
|
|
12
12
|
captureElementText?: boolean;
|
|
13
13
|
clicks?: boolean;
|
|
14
|
+
/** Captures submissions of the site's own forms as `$form_submitted`; on
|
|
15
|
+
* when the project collects forms. */
|
|
16
|
+
collectForms?: boolean;
|
|
14
17
|
maskSelectors?: readonly string[];
|
|
15
18
|
onError?: (error: unknown) => void;
|
|
16
19
|
pageviews?: boolean;
|
|
@@ -104,6 +107,102 @@ interface CookieStorageOptions {
|
|
|
104
107
|
declare function resolveCookieDomain(hostname: string, jar: CookieJar, secure: boolean, random?: () => string): string | undefined;
|
|
105
108
|
declare function createCookieStorage(options: CookieStorageOptions): StorageAdapter | null;
|
|
106
109
|
|
|
110
|
+
type FormLanguage = 'am' | 'ar' | 'bn' | 'de' | 'en' | 'es' | 'et' | 'fil' | 'fr' | 'hi' | 'id' | 'ja' | 'ko' | 'pt' | 'ru' | 'sw' | 'vi' | 'zh';
|
|
111
|
+
/** The page's language when the renderer speaks it, else English. */
|
|
112
|
+
declare const formLanguage: (tag: string | null | undefined) => FormLanguage;
|
|
113
|
+
|
|
114
|
+
/** What the renderer needs from the SDK: the published form, a submission,
|
|
115
|
+
* and the two analytics events. */
|
|
116
|
+
interface FormsHost {
|
|
117
|
+
capture(event: string, properties: Record<string, unknown>): void;
|
|
118
|
+
form(formId: string): Promise<ServedForm>;
|
|
119
|
+
submit(formId: string, answers: Record<string, unknown>, challenge: FormChallenge, solution: string): Promise<FormAfterSubmit>;
|
|
120
|
+
}
|
|
121
|
+
interface RenderFormOptions {
|
|
122
|
+
formId: string;
|
|
123
|
+
host: FormsHost;
|
|
124
|
+
language: FormLanguage;
|
|
125
|
+
/** Whether the form carries the "Powered by Prodantix" line. */
|
|
126
|
+
poweredBy?: boolean;
|
|
127
|
+
}
|
|
128
|
+
interface RenderedForm {
|
|
129
|
+
destroy(): void;
|
|
130
|
+
ready: Promise<void>;
|
|
131
|
+
}
|
|
132
|
+
/** Draws a published form into `target` and takes its submission. */
|
|
133
|
+
declare const renderForm: (target: HTMLElement, options: RenderFormOptions) => RenderedForm;
|
|
134
|
+
|
|
135
|
+
interface RenderCtaOptions {
|
|
136
|
+
language: FormLanguage;
|
|
137
|
+
/** A button was pressed, by its index in the variant's buttons. */
|
|
138
|
+
onButton: (index: number) => void;
|
|
139
|
+
/** The visitor closed the CTA without pressing a button. */
|
|
140
|
+
onDismiss: () => void;
|
|
141
|
+
}
|
|
142
|
+
interface RenderedCta {
|
|
143
|
+
destroy(): void;
|
|
144
|
+
/** The element each copy of the CTA was drawn into. */
|
|
145
|
+
elements: HTMLElement[];
|
|
146
|
+
}
|
|
147
|
+
/** Draws a CTA as its kind asks: into each `[data-prodantix-cta]` slot named
|
|
148
|
+
* for it, as a banner, as a slide-in, or as a pop-up that holds focus until
|
|
149
|
+
* it closes and then hands focus back. */
|
|
150
|
+
declare const renderCta: (cta: ServedCta, options: RenderCtaOptions) => RenderedCta;
|
|
151
|
+
|
|
152
|
+
/** What the CTAs need from the SDK: the page's CTAs, their events, flags as
|
|
153
|
+
* the client decides them, and forms for a button that opens one. */
|
|
154
|
+
interface CtasHost {
|
|
155
|
+
capture(event: string, cta: ServedCta, button?: number): void;
|
|
156
|
+
ctas(page: {
|
|
157
|
+
device: CtaDevice;
|
|
158
|
+
language: string;
|
|
159
|
+
url: string;
|
|
160
|
+
}): Promise<ServedCta[]>;
|
|
161
|
+
forms: FormsHost;
|
|
162
|
+
isEnabled(flag: string): Promise<boolean>;
|
|
163
|
+
variant(flag: string): Promise<string | null>;
|
|
164
|
+
}
|
|
165
|
+
declare const ctasHost: (client: ProdantixClient) => CtasHost;
|
|
166
|
+
/** The device class a viewport width reads as. */
|
|
167
|
+
declare const deviceOf: (width: number) => CtaDevice;
|
|
168
|
+
/** Whether the CTA's flag rule lets it show: no rule, the flag on, or the
|
|
169
|
+
* flag answering the named variant. */
|
|
170
|
+
declare const flagAllows: (host: CtasHost, cta: ServedCta) => Promise<boolean>;
|
|
171
|
+
interface RunCtasOptions {
|
|
172
|
+
language: FormLanguage;
|
|
173
|
+
now?: () => number;
|
|
174
|
+
/** Opens an address; the page's own navigation by default. */
|
|
175
|
+
open?: (url: string) => void;
|
|
176
|
+
}
|
|
177
|
+
/** Reads the page's CTAs and shows each one its flag, frequency and trigger
|
|
178
|
+
* allow, sending its view, clicks and dismissal. Answers a function that
|
|
179
|
+
* takes every CTA of this page down and stops waiting on their triggers. */
|
|
180
|
+
declare const runCtas: (host: CtasHost, options: RunCtasOptions) => Promise<() => void>;
|
|
181
|
+
declare const startCtas: (client: ProdantixClient, language?: string) => (() => void);
|
|
182
|
+
|
|
183
|
+
type PopupTrigger = {
|
|
184
|
+
kind: 'delay';
|
|
185
|
+
seconds: number;
|
|
186
|
+
} | {
|
|
187
|
+
kind: 'exit';
|
|
188
|
+
} | {
|
|
189
|
+
kind: 'scroll';
|
|
190
|
+
percent: number;
|
|
191
|
+
};
|
|
192
|
+
interface PopupRules {
|
|
193
|
+
formId: string;
|
|
194
|
+
/** Days before the pop-up may open again for this visitor. */
|
|
195
|
+
periodDays: number;
|
|
196
|
+
trigger: PopupTrigger;
|
|
197
|
+
}
|
|
198
|
+
/** Opens the pop-up once its trigger fires, once per visitor per period, and
|
|
199
|
+
* answers a function that stops waiting. */
|
|
200
|
+
declare const watchPopup: (rules: PopupRules, open: () => void, now?: () => number) => (() => void);
|
|
201
|
+
|
|
202
|
+
/** The renderer's view of a client: its forms, its submissions and its
|
|
203
|
+
* events, under the visitor the client holds. */
|
|
204
|
+
declare const formsHost: (client: ProdantixClient) => FormsHost;
|
|
205
|
+
|
|
107
206
|
interface Carry {
|
|
108
207
|
anonymousId: string;
|
|
109
208
|
sessionId: string;
|
|
@@ -140,6 +239,86 @@ declare function readCarry(search: string): Carry | undefined;
|
|
|
140
239
|
declare function stripCarry(history: HistoryLike, location: LocationLike): void;
|
|
141
240
|
declare function installLinkCarry(doc: DocumentLike, client: CarryClient, linkedDomains: readonly string[]): () => void;
|
|
142
241
|
|
|
242
|
+
type PushPlatform = 'android' | 'ios' | 'web';
|
|
243
|
+
type PushPermission = 'denied' | 'granted' | 'provisional';
|
|
244
|
+
interface PushDevice {
|
|
245
|
+
appId: string;
|
|
246
|
+
distinctId: string;
|
|
247
|
+
permission?: PushPermission;
|
|
248
|
+
platform: PushPlatform;
|
|
249
|
+
/** The APNs or FCM token, or the browser's Push API subscription as JSON. */
|
|
250
|
+
token: string;
|
|
251
|
+
}
|
|
252
|
+
interface PushClientOptions {
|
|
253
|
+
fetch?: FetchLike;
|
|
254
|
+
host: string;
|
|
255
|
+
projectKey: string;
|
|
256
|
+
requestTimeoutMs?: number;
|
|
257
|
+
}
|
|
258
|
+
/** The edge's push routes: an app's Web Push key, a device's registration
|
|
259
|
+
* and the report that a person opened a notification. */
|
|
260
|
+
declare class PushClient {
|
|
261
|
+
private readonly fetch?;
|
|
262
|
+
private readonly host;
|
|
263
|
+
private readonly projectKey;
|
|
264
|
+
private readonly requestTimeoutMs;
|
|
265
|
+
constructor(options: PushClientOptions);
|
|
266
|
+
private request;
|
|
267
|
+
/** The public key a browser subscribes to the app's Web Push with. */
|
|
268
|
+
vapidKey(appId: string): Promise<string>;
|
|
269
|
+
/** Registers a device for the person, answering its id. */
|
|
270
|
+
register(device: PushDevice): Promise<string>;
|
|
271
|
+
/** Reports the notification carrying `sendId` in its data as opened. */
|
|
272
|
+
opened(sendId: string): Promise<void>;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/** The service worker file a site serves from its own origin, copied from
|
|
276
|
+
* this package's `dist/prodantix-push-sw.js`. */
|
|
277
|
+
declare const DEFAULT_SERVICE_WORKER = "/prodantix-push-sw.js";
|
|
278
|
+
type PushRegistration = {
|
|
279
|
+
deviceId: string;
|
|
280
|
+
status: 'registered';
|
|
281
|
+
} | {
|
|
282
|
+
status: 'denied';
|
|
283
|
+
} | {
|
|
284
|
+
status: 'unsupported';
|
|
285
|
+
};
|
|
286
|
+
interface SubscriptionLike {
|
|
287
|
+
toJSON(): unknown;
|
|
288
|
+
}
|
|
289
|
+
interface PushManagerLike {
|
|
290
|
+
getSubscription(): Promise<SubscriptionLike | null>;
|
|
291
|
+
subscribe(options: {
|
|
292
|
+
applicationServerKey: Uint8Array;
|
|
293
|
+
userVisibleOnly: boolean;
|
|
294
|
+
}): Promise<SubscriptionLike>;
|
|
295
|
+
}
|
|
296
|
+
interface WorkerRegistrationLike {
|
|
297
|
+
pushManager: PushManagerLike;
|
|
298
|
+
}
|
|
299
|
+
interface PushBrowser {
|
|
300
|
+
register(url: string): Promise<WorkerRegistrationLike>;
|
|
301
|
+
requestPermission(): Promise<'default' | 'denied' | 'granted'>;
|
|
302
|
+
}
|
|
303
|
+
interface RegisterPushOptions {
|
|
304
|
+
/** The project's public key, the one the SDK client is built with. */
|
|
305
|
+
apiKey: string;
|
|
306
|
+
/** The push app, from Settings > Push in the console. */
|
|
307
|
+
appId: string;
|
|
308
|
+
/** The test seam for the Notification and service worker APIs; the page's
|
|
309
|
+
* own when left out. */
|
|
310
|
+
browser?: PushBrowser;
|
|
311
|
+
distinctId: string;
|
|
312
|
+
fetch?: FetchLike;
|
|
313
|
+
/** The edge host the SDK client reads flags from. */
|
|
314
|
+
host: string;
|
|
315
|
+
serviceWorker?: string;
|
|
316
|
+
}
|
|
317
|
+
/** Asks the person to allow notifications, subscribes the browser to the
|
|
318
|
+
* app's Web Push and registers the subscription for them. Call it from a
|
|
319
|
+
* click: browsers refuse a permission prompt the person did not start. */
|
|
320
|
+
declare const registerPush: (options: RegisterPushOptions) => Promise<PushRegistration>;
|
|
321
|
+
|
|
143
322
|
/** Tunables for the built-in session replay, minus the identity fields
|
|
144
323
|
* `createWebClient` fills in (apiKey, distinctId, replayHost). */
|
|
145
324
|
type WebSessionReplayOptions = Pick<SessionReplayOptions, 'flushIntervalMs' | 'mask' | 'maxEvents' | 'sessionId'>;
|
|
@@ -157,8 +336,10 @@ interface WebClientOptions extends ProdantixConfig {
|
|
|
157
336
|
/** Enable session replay (DOM + interaction capture, inputs masked by default).
|
|
158
337
|
* Requires `replayHost`. */
|
|
159
338
|
sessionReplay?: boolean;
|
|
339
|
+
surveys?: boolean;
|
|
340
|
+
guides?: boolean;
|
|
160
341
|
sessionReplayOptions?: WebSessionReplayOptions;
|
|
161
342
|
}
|
|
162
343
|
declare function createWebClient(options: WebClientOptions): ProdantixClient;
|
|
163
344
|
|
|
164
|
-
export { ACTION_ATTRIBUTE, ANNOTATION_ATTRIBUTE, ANNOTATION_MAX_LENGTH, type AutocaptureOptions, type Carry, Consent, type CookieJar, type CookieStorageOptions, IGNORE_ATTRIBUTE, type MaskOptions, type SessionReplayOptions, type WebClientOptions, type WebSessionReplayOptions, WebTransport, createCookieStorage, createWebClient, decorateLink, installAutocapture, installLinkCarry, installSessionReplay, readCarry, resolveCookieDomain, stripCarry };
|
|
345
|
+
export { ACTION_ATTRIBUTE, ANNOTATION_ATTRIBUTE, ANNOTATION_MAX_LENGTH, type AutocaptureOptions, type Carry, Consent, type CookieJar, type CookieStorageOptions, type CtasHost, DEFAULT_SERVICE_WORKER, type FormsHost, IGNORE_ATTRIBUTE, type MaskOptions, type PopupRules, type PopupTrigger, type PushBrowser, PushClient, type PushDevice, type PushPermission, type PushPlatform, type PushRegistration, type RegisterPushOptions, type RenderCtaOptions, type RenderFormOptions, type RenderedCta, type RenderedForm, type RunCtasOptions, type SessionReplayOptions, type WebClientOptions, type WebSessionReplayOptions, WebTransport, createCookieStorage, createWebClient, ctasHost, decorateLink, deviceOf, flagAllows, formLanguage, formsHost, installAutocapture, installLinkCarry, installSessionReplay, readCarry, registerPush, renderCta, renderForm, resolveCookieDomain, runCtas, startCtas, stripCarry, watchPopup };
|
package/dist/web.js
CHANGED
|
@@ -1,2 +1,37 @@
|
|
|
1
|
-
import {x as x$1,e,d,b as b$1,c,h as h$1,y,q as q$1,s,t}from'./chunk-D6PMLUYA.js';import'./chunk-V77KYPOF.js';import {e as e$1,h as h$2,a as a$1}from'./chunk-ODN4ZELX.js';import {a}from'./chunk-5XGN7UAV.js';var ce="data-prodantix",le="data-prodantix-action",de="data-prodantix-ignore",h=300,$="data-pdx-no-capture",D="pdx-no-capture",Re=new Set(["a","button","input","label","option","select","summary","textarea"]),Me=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function $e(t){return Re.has(t.tagName.toLowerCase())||Me.has((t.getAttribute("role")??"").trim().toLowerCase())}function H(t){for(let e=t;e!==null;e=e.parentElement)if($e(e))return e;return t}function U(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(de)!==null)return true;return false}function F(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute($)!==null||typeof e.className=="string"&&e.className.split(/\s+/).includes(D))return true;return false}function b(t){let e=new Set;return n=>{e.has(n.message)||(e.add(n.message),t(n));}}function ue(t,e,n){let r=t.getAttribute(e);if(r===null)return;let o=r.trim();if(o!==""){if(o.length>h){n(new a$1("validation",`${e} on a <${t.tagName.toLowerCase()}> is ${o.length} characters, over the ${h}-character limit, so it was ignored: "${o.slice(0,40)}\u2026"`));return}return o}}function V(t,e){let n={},r=ue(t,ce,e);r!==void 0&&(n.$el_description=r,n.$el_description_source="annotation");let o=ue(t,le,e);return o!==void 0&&(n.$el_action=o),n}function pe(t,e){return !De(t)||U(t)||F(t)?{}:V(H(t),e)}function De(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"&&typeof t.getAttribute=="function"}var He=new Set(["input","select","textarea"]),Ue=new Set(["email","password","tel"]);function x(){return globalThis.location}function fe(){return globalThis.document}function Fe(){return globalThis.window??globalThis}function Ve(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"}function T(t,e){let n;try{n=new URL(t,e);}catch{return}return n.protocol==="http:"||n.protocol==="https:"?`${n.origin}${n.pathname}`:n.protocol}function me(){let t=x(),e=fe(),n={};if(t){let r=T(t.href);r&&(n.$current_url=r),n.$pathname=t.pathname,n.$host=t.host;}if(e){e.title&&(n.$title=e.title);let r=e.referrer?T(e.referrer):void 0;r&&(n.$referrer=r);}return n}function je(t){return typeof t.className=="string"?t.className:""}function Be(t){return He.has(t.tagName.toLowerCase())||Ue.has((t.getAttribute("type")??"").toLowerCase())}function Ke(t,e,n){let r={$el_tag:t.tagName.toLowerCase(),$event_type:"click"};if(e)return r;let o=n?t.textContent?.trim():void 0;o&&(r.$el_text=o.slice(0,255)),t.id&&(r.$el_id=t.id);let i=je(t);i&&(r.$el_classes=i);let a=t.getAttribute("href"),s=a?T(a,x()?.href):void 0;return s&&(r.$el_href=s),r}function j(t){return (t??"").replace(/\s+/g," ").trim()}function g(t,e){return {$el_description:t,$el_description_source:e}}function Je(t,e,n){if(!e&&n){let a=j(t.getAttribute("aria-label"));if(a!==""&&a.length<=h)return g(a,"aria_label");let s=j(t.textContent);if(s!==""&&s.length<=h)return g(s,"text")}let r=e?null:t.getAttribute("href"),o=r?T(r,x()?.href):void 0;if(o)return g(o,"href");let i=j(t.getAttribute("role")).toLowerCase();return i===""?g(t.tagName.toLowerCase(),"tag"):g(i,"role")}function We(t,e){let n=new Set,r=(u,c)=>{if(n.has(u))return false;try{return c()}catch(d){return n.add(u),e(new a$1("config",`autocapture maskSelectors entry "${u}" is not a valid selector`,{cause:d})),false}},o=(u,c)=>u.matches?r(c,()=>u.matches?.(c)===!0):false,i=u=>{let c=u.querySelector?.bind(u);return c?c(`[${$}], .${D}`)!==null||t.some(d=>r(d,()=>c(d)!==null)):false},a=u=>{for(let c=u;c;c=c.parentElement){let d=c;if(t.some(f=>o(d,f)))return true}return false},s=u=>{for(let c=u;c;c=c.parentElement)if(Be(c))return true;return false},p=u=>F(u)||a(u);return {holdsMasked:i,isMasked:u=>p(u)||s(u),isOptedOut:p}}function qe(t$1){let e=globalThis.history,n=Fe(),r="",o=()=>{let s=x(),p=s?`${s.pathname}${s.search}`:"";p!==r&&(r=p,t$1.capture(t.pageview,{properties:me()}));};if(o(),!e||!n)return ()=>{};let i=e.pushState.bind(e),a=e.replaceState.bind(e);return e.pushState=(...s)=>{i(...s),o();},e.replaceState=(...s)=>{a(...s),o();},n.addEventListener("popstate",o),()=>{e.pushState=i,e.replaceState=a,n.removeEventListener("popstate",o);}}function ze(t$1,e){let n=fe();if(!n)return ()=>{};let r=e.onError??(()=>{}),o=We(e.maskSelectors??[],r),i=b(r),a=e.captureElementText??false,s=p=>{let u=p.target;if(!Ve(u)||U(u))return;let c=H(u),d=o.isMasked(u)||o.holdsMasked(c),f=o.isOptedOut(u)?{}:V(c,i),P=f.$el_description===void 0?Je(c,d,a):{};t$1.capture(t.autocapture,{properties:{...me(),...Ke(c,d,a),...P,...f}});};return n.addEventListener("click",s,true),()=>n.removeEventListener("click",s,true)}function he(t,e={}){let n=[];return (e.pageviews??true)&&n.push(qe(t)),(e.clicks??true)&&n.push(ze(t,e)),()=>{for(let r of n)r();}}function Ge(){return globalThis.document?.visibilityState==="hidden"}function Xe(t){let e=globalThis.navigator,n=globalThis.Blob;if(!e?.sendBeacon||!n)return false;let r=JSON.stringify({...t.body,api_key:t.projectKey});try{let o=new n([r],{type:"application/json"});return e.sendBeacon(t.url,o)}catch{return false}}var L=class{constructor(e={}){a(this,"fetchTransport");this.fetchTransport=new x$1(e);}async send(e){Ge()&&Xe(e)||await this.fetchTransport.send(e);}};var Ye=/^\d{1,3}(\.\d{1,3}){3}$/,Qe=/^[a-z0-9.-]+$/i;function ge(){return Math.random().toString(36).slice(2,12)}function S(t,e){let n=`${e}=`,r=[];for(let o of t.cookie.split(";")){let i=o.trim();i.startsWith(n)&&r.push(i.slice(n.length));}return r}function k(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function ke(t,e,n,r){try{let o=`pdx_probe_${r()}`,i=r();t.cookie=`${o}=${i}; ${k(e,60,n)}`;let a=S(t,o).includes(i);t.cookie=`${o}=; ${k(e,0,n)}`;let s=S(t,o).includes(i);return a&&!s}catch{return false}}function K(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||Ye.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let o=n.length-2;o>=0;o-=1)r.push(n.slice(o).join("."));return r}function ye(t,e,n,r=ge){for(let o of K(t))if(ke(e,o,n,r))return o}function Ze(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,o]of Object.entries(n))typeof o=="string"&&e.set(r,o);return e}var B=class{constructor(e,n,r,o){this.jar=e;this.name=n;this.domain=r;this.secure=o;}getItem(e){return this.read().get(e)??null}setItem(e,n){let r=this.read();r.set(e,n),this.write(r);}removeItem(e){let n=this.read();n.delete(e)&&this.write(n);}read(){try{let e=S(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${k(void 0,0,this.secure)}`,e=S(this.jar,this.name));let n=e[0];return n?Ze(n):new Map}catch{return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${k(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${k(this.domain,31536e3,this.secure)}`;}catch{return}}};function et(){return globalThis.document}function tt(){return globalThis.location?.hostname??""}function nt(){return globalThis.location?.protocol==="https:"}function rt(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return Qe.test(e)?e.toLowerCase():void 0}function J(t){let e="jar"in t?t.jar:et();if(!e||globalThis.navigator?.cookieEnabled===false)return null;let r=t.random??ge,o=t.secure??nt(),i=t.hostname??tt();try{let a=rt(t.domain)??ye(i,e,o,r);return ke(e,a,o,r)?new B(e,t.name,a,o):null}catch{return null}}var be="_pdx",Te="~",ot=200,it=/^\d+$/;function xe(t,e,n,r){let o=at(t.href);if(o===void 0||q(o.search).some(z))return;let i=ve(o.hostname,n);i===void 0||i===ve(r,n)||(o.search=`${o.search}${o.search?"&":"?"}${be}=${st(e)}`,t.href=o.href);}function st(t){return [t.anonymousId,t.sessionId,String(t.sessionStartedAt)].map(ct).join(Te)}function Le(t){let e=q(t).find(z);if(e===void 0)return;let n=ut(e).split(Te);if(n.length!==3)return;let r=A(n[0]),o=A(n[1]),i=A(n[2]);if(!(!Ee(r)||!Ee(o)||!lt(i)))return {anonymousId:r,sessionId:o,sessionStartedAt:Number(i)}}function Se(t,e){let n=q(e.search),r=n.filter(i=>!z(i));if(r.length===n.length)return;let o=r.length>0?`?${r.join("&")}`:"";t.replaceState(t.state,"",`${e.pathname}${o}${e.hash}`);}function Ae(t){if(t.location===void 0||typeof t.location.search!="string")return;let e=Le(t.location.search);if(e===void 0)return;let n=q$1(t.storage,t.shared,t.namespace,e.anonymousId);return s(t.shared,t.namespace,{id:e.sessionId,startedAt:e.sessionStartedAt},t.now),t.history!==void 0&&Se(t.history,t.location),n}function W(t,e,n){if(n.length===0)return ()=>{};let r=o=>{let i=ft(o.target);if(i===void 0)return;let a=dt(e);a!==void 0&&xe(i,a,n,t.location?.hostname??"");};return t.addEventListener("click",r,true),t.addEventListener("auxclick",r,true),()=>{t.removeEventListener("click",r,true),t.removeEventListener("auxclick",r,true);}}function at(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"?e:void 0}catch{return}}function ve(t,e){let n=e.map(r=>r.replace(/^\./,"").toLowerCase());return K(t).find(r=>n.includes(r))}function q(t){return t.replace(/^\?/,"").split("&").filter(e=>e!=="")}function z(t){let e=t.indexOf("=");return A(e===-1?t:t.slice(0,e))===be}function ut(t){let e=t.indexOf("=");return e===-1?"":t.slice(e+1)}function ct(t){return encodeURIComponent(t).replace(/~/g,"%7E")}function A(t){try{return decodeURIComponent(t)}catch{return}}function Ee(t){if(t===void 0)return false;let e$1=e(t);return e$1>=1&&e$1<=ot}function lt(t){return t!==void 0&&it.test(t)&&Number.isSafeInteger(Number(t))}function dt(t){if(t.consent?.()?.identityLink===false)return;let e=t.sessionId,n=t.sessionStartedAt;if(!(e===void 0||n===void 0))return {anonymousId:t.anonymousId,sessionId:e,sessionStartedAt:n}}function pt(t){return typeof t.tagName=="string"&&t.tagName.toUpperCase()==="A"&&typeof t.href=="string"}function ft(t){let e=typeof t=="object"?t:null;for(;e;){if(pt(e))return e;e=e.parentElement??null;}}var we={maskAllInputs:true,maskAllText:false},mt=new Set(["email","password","tel"]);function Ne(t){return t.replace(/\S/g,"*")}function w(t,e,n){return ht(e)||n.maskAllInputs?Ne(t):t}function N(t,e){return e.maskAllText?Ne(t):t}function ht(t){return mt.has((t??"").toLowerCase())}var gt=5e3,O=class{constructor(e){this.options=e;a(this,"buffer",[]);a(this,"seq",0);a(this,"maxEvents");this.maxEvents=Math.min(Math.max(1,e.maxEvents),gt);}add(e){return this.buffer.push(e),this.buffer.length>=this.maxEvents?this.flush():null}flush(){if(this.buffer.length===0)return null;let e=this.buffer;this.buffer=[];let n={distinct_id:this.options.distinctId(),events:e,masked:this.options.masked,schema_version:1,seq:this.seq,session_id:this.options.sessionId,timestamp:new Date(this.options.now()).toISOString()};return this.seq+=1,n}};var G=1,X=3,kt=9,C=class{constructor(){a(this,"next",1);}allocate(){let e=this.next;return this.next+=1,e}},yt=new Set(["NOSCRIPT","SCRIPT"]);function I(t,e,n,r){if(t.nodeType===X){let o=e.allocate();return r?.(t,o),{id:o,textContent:N(t.textValue??"",n),type:"text"}}if(t.nodeType===kt){let o=e.allocate();return r?.(t,o),{childNodes:Oe(t,e,n,r),id:o,type:"document"}}if(t.nodeType===G){let o=t.tagName??"";if(yt.has(o))return null;let i=e.allocate();return r?.(t,i),{attributes:vt(t,n),childNodes:Oe(t,e,n,r),id:i,tagName:o,type:"element"}}return null}function Oe(t,e,n,r){let o=[];for(let i of t.childNodes??[]){let a=I(i,e,n,r);a&&o.push(a);}return o}function vt(t,e){let n={};for(let r of t.attributes??[])n[r.name]=r.value;return t.inputValue!==void 0&&(n.value=w(t.inputValue,t.inputType,e)),n}async function Ce(t,e){let n=`${h$2(e.replayHost)}/v1/replay`;return (await e.fetch(n,{body:JSON.stringify(t),headers:{authorization:`Bearer ${e.apiKey}`,"content-type":"application/json"},method:"POST"})).ok}var Ie=new Set(["INPUT","SELECT","TEXTAREA"]),_=class{constructor(e){this.options=e;a(this,"allocator",new C);a(this,"mirror",new Map);a(this,"chunker");a(this,"fetchImpl");a(this,"observer");a(this,"timer");a(this,"started",false);this.chunker=new O({distinctId:e.distinctId,masked:e.mask.maskAllInputs,maxEvents:e.maxEvents,now:e.now,sessionId:e.sessionId}),this.fetchImpl=e$1(e.fetch);}start(){if(this.started)return;let e=Et(),n=e?.documentElement;!e||!n||!this.fetchImpl||(this.started=true,this.captureFullSnapshot(n),this.observeMutations(n),this.observeInteractions(e),this.timer=setInterval(()=>this.upload(this.chunker.flush()),this.options.flushIntervalMs));}stop(){this.started&&(this.started=false,this.observer?.disconnect(),this.timer&&clearInterval(this.timer),this.upload(this.chunker.flush()));}captureFullSnapshot(e){let n=I(this.adapt(e),this.allocator,this.options.mask,(r,o)=>{let i=r.ref;i&&this.mirror.set(i,o);});n&&this.push(2,{node:n});}observeMutations(e){let n=globalThis.MutationObserver;n&&(this.observer=new n(r=>{for(let o of r)this.handleMutation(o);}),this.observer.observe(e,{attributes:true,characterData:true,childList:true,subtree:true}));}handleMutation(e){if(e.type==="characterData"){let n=this.mirror.get(e.target);n!==void 0&&this.push(3,{texts:[{id:n,value:N(e.target.textContent??"",this.options.mask)}]});return}if(e.type==="attributes"&&e.attributeName){let n=this.mirror.get(e.target),r=e.target;n!==void 0&&this.push(3,{attributes:[{attributes:{[e.attributeName]:r.getAttribute(e.attributeName)??""},id:n}]});return}if(e.type==="childList"){let n=this.mirror.get(e.target);if(n===void 0)return;for(let r of Array.from(e.addedNodes)){let o=I(this.adapt(r),this.allocator,this.options.mask,(i,a)=>{let s=i.ref;s&&this.mirror.set(s,a);});o&&this.push(3,{adds:[{node:o,parentId:n}]});}for(let r of Array.from(e.removedNodes)){let o=this.mirror.get(r);o!==void 0&&(this.push(3,{removes:[{id:o,parentId:n}]}),this.mirror.delete(r));}}}observeInteractions(e){e.addEventListener("input",n=>{let r=n.target;if(!r||!Ie.has(r.tagName))return;let o=this.mirror.get(r);o!==void 0&&this.push(3,{input:{id:o,value:w(r.value??"",r.type,this.options.mask)}});},true),e.addEventListener("scroll",n=>{let r=n.target,o=r?this.mirror.get(r):void 0;this.push(3,{scroll:{id:o??0,x:r?.scrollLeft??0,y:r?.scrollTop??0}});},true);}adapt(e){let n={childNodes:[],nodeType:e.nodeType,ref:e};if(e.nodeType===X)return n.textValue=e.textContent??"",n;if(e.nodeType===G){let r=e;if(n.tagName=r.tagName,n.attributes=Array.from(r.attributes).map(o=>({name:o.name,value:o.value})),Ie.has(r.tagName)){let o=r;n.inputType=o.type,n.inputValue=o.value??"";}}return n.childNodes=Array.from(e.childNodes).map(r=>this.adapt(r)),n}push(e,n){let r=this.chunker.add({data:n,timestamp:this.options.now(),type:e});r&&this.upload(r);}upload(e){!e||!this.fetchImpl||Ce(e,{apiKey:this.options.apiKey,fetch:this.fetchImpl,replayHost:this.options.replayHost}).catch(n=>this.options.onError?.(n));}};function Et(){return globalThis.document}function _e(t){let e=new _({apiKey:t.apiKey,distinctId:t.distinctId,flushIntervalMs:t.flushIntervalMs??5e3,mask:{...we,...t.mask},maxEvents:t.maxEvents??200,now:t.now??(()=>Date.now()),onError:t.onError,replayHost:t.replayHost,sessionId:t.sessionId??d()});return e.start(),e}function bt(){return globalThis.navigator}function Tt(){return globalThis.document}function xt(){return globalThis.history}function Lt(){return globalThis.location}function St(t){let e=t?.userAgentData?.platform??t?.platform;return e?e.slice(0,50):void 0}function At(t){let e=()=>{t.flush();};globalThis.document?.addEventListener?.("visibilitychange",e),globalThis.addEventListener?.("pagehide",e);}function wt(t,e,n){try{return J({domain:e,name:`pdx_${h$1(t)}`})??n}catch{return n}}function bn(t){let{autocaptureOptions:e,cookieDomain:n,linkedDomains:r,replayHost:o,sessionReplay:i,sessionReplayOptions:a,...s}=t,p=bt(),u=b$1(),c$1=s.storage??u,d=s.sharedStorage??wt(s.apiKey,n,u),f=Ae({history:xt(),location:Lt(),namespace:h$1(s.apiKey),now:(s.clock??c).now().getTime(),shared:d,storage:c$1}),P=b(s.onError??(()=>{})),v={...s,describeElement:s.describeElement??(Pe=>pe(Pe,P)),locale:s.locale??(p?.language?p.language.slice(0,20):void 0),os:s.os??St(p),sessionTracking:s.sessionTracking??true,sharedStorage:d,storage:c$1,transport:s.transport??new L({maxRetries:s.maxRetries,requestTimeoutMs:s.requestTimeoutMs})},m=new y(v);f!==void 0&&m.alias(f),At(m),(t.autocapture??true)&&he(m,{onError:v.onError,...e});let Y=Tt();return Y&&r&&W(Y,m,r),i&&o&&_e({apiKey:v.apiKey,distinctId:()=>m.distinctId,onError:v.onError,replayHost:o,...a,sessionId:a?.sessionId??m.sessionId}),m}export{le as ACTION_ATTRIBUTE,ce as ANNOTATION_ATTRIBUTE,h as ANNOTATION_MAX_LENGTH,de as IGNORE_ATTRIBUTE,L as WebTransport,J as createCookieStorage,bn as createWebClient,xe as decorateLink,he as installAutocapture,W as installLinkCarry,_e as installSessionReplay,Le as readCarry,ye as resolveCookieDomain,Se as stripCarry};//# sourceMappingURL=web.js.map
|
|
1
|
+
import {Z as Z$1,e,d,u,s,b,c,h as h$1,_,t,S as S$1,U,V,P,M,L,J as J$1,O,H,B as B$1,N,E,I,F,G,z,k,j,i}from'./chunk-L4P6GMBC.js';import'./chunk-V77KYPOF.js';import {e as e$1,h,d as d$1,f,a as a$1}from'./chunk-ODN4ZELX.js';import {a}from'./chunk-5XGN7UAV.js';var lt="data-prodantix",pt="data-prodantix-action",mt="data-prodantix-ignore",D=300,ke="data-pdx-no-capture",be="pdx-no-capture",cn=new Set(["a","button","input","label","option","select","summary","textarea"]),ln=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function pn(e){return cn.has(e.tagName.toLowerCase())||ln.has((e.getAttribute("role")??"").trim().toLowerCase())}function we(e){for(let t=e;t!==null;t=t.parentElement)if(pn(t))return t;return e}function Ee(e){for(let t=e;t!==null;t=t.parentElement)if(t.getAttribute(mt)!==null)return true;return false}function Se(e){for(let t=e;t!==null;t=t.parentElement)if(t.getAttribute(ke)!==null||typeof t.className=="string"&&t.className.split(/\s+/).includes(be))return true;return false}function J(e){let t=new Set;return n=>{t.has(n.message)||(t.add(n.message),e(n));}}function ct(e,t,n){let r=e.getAttribute(t);if(r===null)return;let o=r.trim();if(o!==""){if(o.length>D){n(new a$1("validation",`${t} on a <${e.tagName.toLowerCase()}> is ${o.length} characters, over the ${D}-character limit, so it was ignored: "${o.slice(0,40)}\u2026"`));return}return o}}function Te(e,t){let n={},r=ct(e,lt,t);r!==void 0&&(n.$el_description=r,n.$el_description_source="annotation");let o=ct(e,pt,t);return o!==void 0&&(n.$el_action=o),n}function ft(e,t){return !mn(e)||Ee(e)||Se(e)?{}:Te(we(e),t)}function mn(e){return typeof e=="object"&&e!==null&&typeof e.tagName=="string"&&typeof e.getAttribute=="function"}var fn="$form_submitted",gn=new Set(["button","file","hidden","image","password","reset","submit"]),gt=/(card|cc-?num|cvc|cvv|iban|security.?code)/i,hn=e=>(e.getAttribute("autocomplete")??"").startsWith("cc-")||gt.test(e.name)||gt.test(e.id),yn=e=>{let t=e.name.toLowerCase();return e instanceof HTMLInputElement&&e.type==="email"||t==="email"||e.getAttribute("autocomplete")==="email"?"$email":t==="name"||t==="full_name"||t==="fullname"||e.getAttribute("autocomplete")==="name"?"$name":null},xn=(e,t)=>{if(e.closest("[data-prodantix-ignore]")||e.hasAttribute("data-prodantix-form"))return null;let n={},r={};for(let o of Array.from(e.elements)){if(!(o instanceof HTMLInputElement||o instanceof HTMLSelectElement||o instanceof HTMLTextAreaElement)||!o.name||o.closest("[data-prodantix-ignore]")||hn(o)||o instanceof HTMLInputElement&&(gn.has(o.type)||(o.type==="checkbox"||o.type==="radio")&&!o.checked))continue;let a=o.value.trim();if(a==="")continue;n[o.name]=a;let i=yn(o);i&&(r[i]=a);}return {$answers:n,$form_id:e.id||`${t}#${Array.from(e.ownerDocument.forms).indexOf(e)}`,$page_url:e.ownerDocument.location?.href??"",$set:r,collected:true}},ht=(e,t=document)=>{let n=r=>{if(r.target instanceof HTMLFormElement){let o=xn(r.target,t.location?.pathname??"");o&&e.capture(fn,{properties:o});}};return t.addEventListener("submit",n,true),()=>t.removeEventListener("submit",n,true)};var vn=new Set(["input","select","textarea"]),kn=new Set(["email","password","tel"]);function X(){return globalThis.location}function yt(){return globalThis.document}function bn(){return globalThis.window??globalThis}function wn(e){return typeof e=="object"&&e!==null&&typeof e.tagName=="string"}function Y(e,t){let n;try{n=new URL(e,t);}catch{return}return n.protocol==="http:"||n.protocol==="https:"?`${n.origin}${n.pathname}`:n.protocol}function xt(){let e=X(),t=yt(),n={};if(e){let r=Y(e.href);r&&(n.$current_url=r),n.$pathname=e.pathname,n.$host=e.host;}if(t){t.title&&(n.$title=t.title);let r=t.referrer?Y(t.referrer):void 0;r&&(n.$referrer=r);}return n}function En(e){return typeof e.className=="string"?e.className:""}function Sn(e){return vn.has(e.tagName.toLowerCase())||kn.has((e.getAttribute("type")??"").toLowerCase())}function Tn(e,t,n){let r={$el_tag:e.tagName.toLowerCase(),$event_type:"click"};if(t)return r;let o=n?e.textContent?.trim():void 0;o&&(r.$el_text=o.slice(0,255)),e.id&&(r.$el_id=e.id);let a=En(e);a&&(r.$el_classes=a);let i=e.getAttribute("href"),s=i?Y(i,X()?.href):void 0;return s&&(r.$el_href=s),r}function Ce(e){return (e??"").replace(/\s+/g," ").trim()}function q(e,t){return {$el_description:e,$el_description_source:t}}function Cn(e,t,n){if(!t&&n){let i=Ce(e.getAttribute("aria-label"));if(i!==""&&i.length<=D)return q(i,"aria_label");let s=Ce(e.textContent);if(s!==""&&s.length<=D)return q(s,"text")}let r=t?null:e.getAttribute("href"),o=r?Y(r,X()?.href):void 0;if(o)return q(o,"href");let a=Ce(e.getAttribute("role")).toLowerCase();return a===""?q(e.tagName.toLowerCase(),"tag"):q(a,"role")}function Ln(e,t){let n=new Set,r=(d,u)=>{if(n.has(d))return false;try{return u()}catch(l){return n.add(d),t(new a$1("config",`autocapture maskSelectors entry "${d}" is not a valid selector`,{cause:l})),false}},o=(d,u)=>d.matches?r(u,()=>d.matches?.(u)===!0):false,a=d=>{let u=d.querySelector?.bind(d);return u?u(`[${ke}], .${be}`)!==null||e.some(l=>r(l,()=>u(l)!==null)):false},i=d=>{for(let u=d;u;u=u.parentElement){let l=u;if(e.some(k=>o(l,k)))return true}return false},s=d=>{for(let u=d;u;u=u.parentElement)if(Sn(u))return true;return false},c=d=>Se(d)||i(d);return {holdsMasked:a,isMasked:d=>c(d)||s(d),isOptedOut:c}}function Pn(e){let t=globalThis.history,n=bn(),r="",o=()=>{let s=X(),c=s?`${s.pathname}${s.search}`:"";c!==r&&(r=c,e.capture(V.pageview,{properties:xt()}));};if(o(),!t||!n)return ()=>{};let a=t.pushState.bind(t),i=t.replaceState.bind(t);return t.pushState=(...s)=>{a(...s),o();},t.replaceState=(...s)=>{i(...s),o();},n.addEventListener("popstate",o),()=>{t.pushState=a,t.replaceState=i,n.removeEventListener("popstate",o);}}function An(e,t){let n=yt();if(!n)return ()=>{};let r=t.onError??(()=>{}),o=Ln(t.maskSelectors??[],r),a=J(r),i=t.captureElementText??false,s=c=>{let d=c.target;if(!wn(d)||Ee(d))return;let u=we(d),l=o.isMasked(d)||o.holdsMasked(u),k=o.isOptedOut(d)?{}:Te(u,a),L=k.$el_description===void 0?Cn(u,l,i):{};e.capture(V.autocapture,{properties:{...xt(),...Tn(u,l,i),...L,...k}});};return n.addEventListener("click",s,true),()=>n.removeEventListener("click",s,true)}function vt(e,t={}){let n=[];return (t.pageviews??true)&&n.push(Pn(e)),(t.clicks??true)&&n.push(An(e,t)),t.collectForms===true&&typeof document<"u"&&n.push(ht(e)),()=>{for(let r of n)r();}}function In(){return globalThis.document?.visibilityState==="hidden"}function Nn(e){let t=globalThis.navigator,n=globalThis.Blob;if(!t?.sendBeacon||!n)return false;let r=JSON.stringify({...e.body,api_key:e.projectKey});try{let o=new n([r],{type:"application/json"});return t.sendBeacon(e.url,o)}catch{return false}}var Q=class{constructor(t={}){a(this,"fetchTransport");this.fetchTransport=new Z$1(t);}async send(t){In()&&Nn(t)||await this.fetchTransport.send(t);}};var Le="prodantix:consent-ready",Pe="prodantix:consent",kt="__prodantixConsent";var bt=(e,t)=>{e.takeCookielessId(t.anonymousId),t.consent!==null?e.setConsent(t.consent):t.rule==="notice"&&e.allowStorage();},wt=(e,t)=>{let n=t[kt];n&&bt(e,n);let r=a=>{let i=a.detail;i&&bt(e,i);},o=a=>{let i=a.detail;i&&e.setConsent(i);};return t.addEventListener(Le,r),t.addEventListener(Pe,o),()=>{t.removeEventListener(Le,r),t.removeEventListener(Pe,o);}};var On=/^\d{1,3}(\.\d{1,3}){3}$/,Rn=/^[a-z0-9.-]+$/i;function Et(){return Math.random().toString(36).slice(2,12)}function Z(e,t){let n=`${t}=`,r=[];for(let o of e.cookie.split(";")){let a=o.trim();a.startsWith(n)&&r.push(a.slice(n.length));}return r}function K(e,t,n){let r=["Path=/",`Max-Age=${t}`,"SameSite=Lax"];return e&&r.push(`Domain=${e}`),n&&r.push("Secure"),r.join("; ")}function St(e,t,n,r){try{let o=`pdx_probe_${r()}`,a=r();e.cookie=`${o}=${a}; ${K(t,60,n)}`;let i=Z(e,o).includes(a);e.cookie=`${o}=; ${K(t,0,n)}`;let s=Z(e,o).includes(a);return i&&!s}catch{return false}}function Ie(e){let t=e.replace(/^\[|\]$/g,"").toLowerCase();if(t.includes(":")||On.test(t)||!t.includes("."))return [];let n=t.split("."),r=[];for(let o=n.length-2;o>=0;o-=1)r.push(n.slice(o).join("."));return r}function Tt(e,t,n,r=Et){for(let o of Ie(e))if(St(t,o,n,r))return o}function Mn(e){let t=new Map,n=JSON.parse(decodeURIComponent(e));if(n===null||typeof n!="object"||Array.isArray(n))return t;for(let[r,o]of Object.entries(n))typeof o=="string"&&t.set(r,o);return t}var Ae=class{constructor(t,n,r,o){this.jar=t;this.name=n;this.domain=r;this.secure=o;}getItem(t){return this.read().get(t)??null}setItem(t,n){let r=this.read();r.set(t,n),this.write(r);}removeItem(t){let n=this.read();n.delete(t)&&this.write(n);}read(){try{let t=Z(this.jar,this.name);t.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${K(void 0,0,this.secure)}`,t=Z(this.jar,this.name));let n=t[0];return n?Mn(n):new Map}catch{return new Map}}write(t){try{if(t.size===0){this.jar.cookie=`${this.name}=; ${K(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(t)));this.jar.cookie=`${this.name}=${n}; ${K(this.domain,31536e3,this.secure)}`;}catch{return}}};function _n(){return globalThis.document}function $n(){return globalThis.location?.hostname??""}function Fn(){return globalThis.location?.protocol==="https:"}function Dn(e){if(e===void 0)return;let t=e.startsWith(".")?e.slice(1):e;return Rn.test(t)?t.toLowerCase():void 0}function Ne(e){let t="jar"in e?e.jar:_n();if(!t||globalThis.navigator?.cookieEnabled===false)return null;let r=e.random??Et,o=e.secure??Fn(),a=e.hostname??$n();try{let i=Dn(e.domain)??Tt(a,t,o,r);return St(t,i,o,r)?new Ae(t,e.name,i,o):null}catch{return null}}var Bn=["am","ar","bn","de","en","es","et","fil","fr","hi","id","ja","ko","pt","ru","sw","vi","zh"],Ct=e=>{let t=(e??"").toLowerCase().split("-")[0]??"";return Bn.find(n=>n===t)??"en"};var Hn=/^\$(survey|guide|checklist)_/,Lt=()=>({guides:{done:[],settled:[]},surveys:{settled:[]}});function qn(e,t){try{let n=e.getItem(t);if(n===null)return Lt();let r=JSON.parse(n);return {guides:{done:r.guides?.done??[],lastShownAt:r.guides?.lastShownAt,settled:r.guides?.settled??[]},surveys:{lastShownAt:r.surveys?.lastShownAt,settled:r.surveys?.settled??[]}}}catch{return Lt()}}function Pt(e,t,n){let r=n();return r?Promise.resolve(r):new Promise(o=>{let a=e.document.createElement("script");a.src=t,a.async=true,a.onload=()=>o(n()??null),a.onerror=()=>o(null),e.document.head.append(a);})}function At(e,t,n){let r=`pdx_engage_${n.namespace}`,o=qn(n.storage,r),a=()=>{try{n.storage.setItem(r,JSON.stringify(o));}catch(h){n.onError(h);}},i=Ct(t.document.documentElement.lang||t.navigator.language),s=[],c=[],d=false,u=false,l=new Map,k=()=>Pt(t,`${n.edgeHost}/surveys.js`,()=>t.prodantixSurveys),L$1=()=>Pt(t,`${n.edgeHost}/guides.js`,()=>t.prodantixGuides),T=async h=>{if(d)return;let f=s.find(C=>B$1(C,o.surveys,t.location.href,Date.now(),h));if(!f)return;d=true;let E=await k();if(!E){d=false;return}let b=()=>{o.surveys.settled=[...o.surveys.settled.filter(C=>C!==z(f)),z(f)],a(),d=false;};E.showSurvey(t.document,f,i,{onDismissed:()=>{e.captureSurveyDismissed(f),b();},onSent:C=>{e.captureSurveySent(f,C),b();},onShown:()=>{o.surveys.lastShownAt=Date.now(),a(),e.captureSurveyShown(f);}});},I$1=h=>{o.guides.settled=[...o.guides.settled.filter(f=>f!==L(h)),L(h)],a();},O$1=async h=>{let f=c.filter(g=>!l.has(g.id)&&N(g,o.guides,t.location.href,Date.now(),h)),E$1=f.filter(g=>g.kind==="checklist"),b=u?void 0:f.find(g=>g.kind!=="checklist");if(E$1.length===0&&!b)return;b&&(u=true);let C=await L$1();if(!C){u=false;return}for(let g of E$1)l.has(g.id)||l.set(g.id,C.showChecklist(t.document,g,i,O(g,o.guides),{onDismissed:()=>{e.captureGuide(I,g),I$1(g),l.delete(g.id);},onShown:()=>e.captureGuide(E,g)}));if(!b)return;(b.kind==="tooltip"?C.showTooltip:C.showTour)(t.document,b,i,{onCompleted:()=>{e.captureGuide(H,b),I$1(b),u=false;},onDismissed:()=>{e.captureGuide(I,b),I$1(b),u=false;},onMissed:g=>e.captureGuide(G,b,g),onShown:()=>{o.guides.lastShownAt=Date.now(),a(),e.captureGuide(E,b);},onStep:g=>e.captureGuide(F,b,g)});},A=h=>{for(let f of c){let E=P(f,h);!E||o.guides.done.includes(M(f,E.id))||o.guides.settled.includes(L(f))||(o.guides.done=[...o.guides.done,M(f,E.id)],e.captureGuide(J$1,f,E.id),l.get(f.id)?.markDone(E.id),O(f,o.guides).length===f.steps.length&&(e.captureGuide(H,f),I$1(f),l.get(f.id)?.close(),l.delete(f.id)),a());}},N$1=h=>{n.surveys&&T(h).catch(n.onError),n.guides&&O$1(h).catch(n.onError);},F$1=e.onCapture(h=>{Hn.test(h)||(A(h),N$1(h));}),R=()=>N$1();t.addEventListener("popstate",R);let _=async()=>{let h=b=>(n.onError(b),[]),[f,E]=await Promise.all([n.surveys?e.getSurveys(t.document.documentElement.lang||t.navigator.language).catch(h):[],n.guides?e.getGuides().catch(h):[]]);s=f,c=E,N$1();};return t.document.readyState==="loading"?t.document.addEventListener("DOMContentLoaded",()=>void _(),{once:true}):_(),()=>{F$1(),t.removeEventListener("popstate",R);for(let h of l.values())h.close();l.clear();}}var Ot="_pdx",Rt="~",Kn=200,Gn=/^\d+$/;function Mt(e,t,n,r){let o=Vn(e.href);if(o===void 0||Re(o.search).some(Me))return;let a=It(o.hostname,n);a===void 0||a===It(r,n)||(o.search=`${o.search}${o.search?"&":"?"}${Ot}=${Un(t)}`,e.href=o.href);}function Un(e){return [e.anonymousId,e.sessionId,String(e.sessionStartedAt)].map(Wn).join(Rt)}function _t(e){let t=Re(e).find(Me);if(t===void 0)return;let n=jn(t).split(Rt);if(n.length!==3)return;let r=ee(n[0]),o=ee(n[1]),a=ee(n[2]);if(!(!Nt(r)||!Nt(o)||!zn(a)))return {anonymousId:r,sessionId:o,sessionStartedAt:Number(a)}}function $t(e,t){let n=Re(t.search),r=n.filter(a=>!Me(a));if(r.length===n.length)return;let o=r.length>0?`?${r.join("&")}`:"";e.replaceState(e.state,"",`${t.pathname}${o}${t.hash}`);}function Ft(e){if(e.location===void 0||typeof e.location.search!="string")return;let t=_t(e.location.search);if(t===void 0)return;let n=S$1(e.storage,e.shared,e.namespace,t.anonymousId);return U(e.shared,e.namespace,{id:t.sessionId,startedAt:t.sessionStartedAt},e.now),e.history!==void 0&&$t(e.history,e.location),n}function Oe(e,t,n){if(n.length===0)return ()=>{};let r=o=>{let a=Xn(o.target);if(a===void 0)return;let i=Jn(t);i!==void 0&&Mt(a,i,n,e.location?.hostname??"");};return e.addEventListener("click",r,true),e.addEventListener("auxclick",r,true),()=>{e.removeEventListener("click",r,true),e.removeEventListener("auxclick",r,true);}}function Vn(e){try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"?t:void 0}catch{return}}function It(e,t){let n=t.map(r=>r.replace(/^\./,"").toLowerCase());return Ie(e).find(r=>n.includes(r))}function Re(e){return e.replace(/^\?/,"").split("&").filter(t=>t!=="")}function Me(e){let t=e.indexOf("=");return ee(t===-1?e:e.slice(0,t))===Ot}function jn(e){let t=e.indexOf("=");return t===-1?"":e.slice(t+1)}function Wn(e){return encodeURIComponent(e).replace(/~/g,"%7E")}function ee(e){try{return decodeURIComponent(e)}catch{return}}function Nt(e$1){if(e$1===void 0)return false;let t=e(e$1);return t>=1&&t<=Kn}function zn(e){return e!==void 0&&Gn.test(e)&&Number.isSafeInteger(Number(e))}function Jn(e){if(e.consent?.()?.identityLink===false)return;let t=e.sessionId,n=e.sessionStartedAt;if(!(t===void 0||n===void 0))return {anonymousId:e.anonymousId,sessionId:t,sessionStartedAt:n}}function Yn(e){return typeof e.tagName=="string"&&e.tagName.toUpperCase()==="A"&&typeof e.href=="string"}function Xn(e){let t=typeof e=="object"?e:null;for(;t;){if(Yn(t))return t;t=t.parentElement??null;}}var Dt={maskAllInputs:true,maskAllText:false},Qn=new Set(["email","password","tel"]);function Bt(e){return e.replace(/\S/g,"*")}function te(e,t,n){return Zn(t)||n.maskAllInputs?Bt(e):e}function ne(e,t){return t.maskAllText?Bt(e):e}function Zn(e){return Qn.has((e??"").toLowerCase())}var er=5e3,re=class{constructor(t){this.options=t;a(this,"buffer",[]);a(this,"seq",0);a(this,"maxEvents");this.maxEvents=Math.min(Math.max(1,t.maxEvents),er);}add(t){return this.buffer.push(t),this.buffer.length>=this.maxEvents?this.flush():null}flush(){if(this.buffer.length===0)return null;let t=this.buffer;this.buffer=[];let n={distinct_id:this.options.distinctId(),events:t,masked:this.options.masked,schema_version:1,seq:this.seq,session_id:this.options.sessionId,timestamp:new Date(this.options.now()).toISOString()};return this.seq+=1,n}};var _e=1,$e=3,tr=9,oe=class{constructor(){a(this,"next",1);}allocate(){let t=this.next;return this.next+=1,t}},nr=new Set(["NOSCRIPT","SCRIPT"]);function ie(e,t,n,r){if(e.nodeType===$e){let o=t.allocate();return r?.(e,o),{id:o,textContent:ne(e.textValue??"",n),type:"text"}}if(e.nodeType===tr){let o=t.allocate();return r?.(e,o),{childNodes:Ht(e,t,n,r),id:o,type:"document"}}if(e.nodeType===_e){let o=e.tagName??"";if(nr.has(o))return null;let a=t.allocate();return r?.(e,a),{attributes:rr(e,n),childNodes:Ht(e,t,n,r),id:a,tagName:o,type:"element"}}return null}function Ht(e,t,n,r){let o=[];for(let a of e.childNodes??[]){let i=ie(a,t,n,r);i&&o.push(i);}return o}function rr(e,t){let n={};for(let r of e.attributes??[])n[r.name]=r.value;return e.inputValue!==void 0&&(n.value=te(e.inputValue,e.inputType,t)),n}async function qt(e,t){let n=`${h(t.replayHost)}/v1/replay`;return (await t.fetch(n,{body:JSON.stringify(e),headers:{authorization:`Bearer ${t.apiKey}`,"content-type":"application/json"},method:"POST"})).ok}var Kt=new Set(["INPUT","SELECT","TEXTAREA"]),se=class{constructor(t){this.options=t;a(this,"allocator",new oe);a(this,"mirror",new Map);a(this,"chunker");a(this,"fetchImpl");a(this,"observer");a(this,"timer");a(this,"started",false);this.chunker=new re({distinctId:t.distinctId,masked:t.mask.maskAllInputs,maxEvents:t.maxEvents,now:t.now,sessionId:t.sessionId}),this.fetchImpl=e$1(t.fetch);}start(){if(this.started)return;let t=or(),n=t?.documentElement;!t||!n||!this.fetchImpl||(this.started=true,this.captureFullSnapshot(n),this.observeMutations(n),this.observeInteractions(t),this.timer=setInterval(()=>this.upload(this.chunker.flush()),this.options.flushIntervalMs));}stop(){this.started&&(this.started=false,this.observer?.disconnect(),this.timer&&clearInterval(this.timer),this.upload(this.chunker.flush()));}captureFullSnapshot(t){let n=ie(this.adapt(t),this.allocator,this.options.mask,(r,o)=>{let a=r.ref;a&&this.mirror.set(a,o);});n&&this.push(2,{node:n});}observeMutations(t){let n=globalThis.MutationObserver;n&&(this.observer=new n(r=>{for(let o of r)this.handleMutation(o);}),this.observer.observe(t,{attributes:true,characterData:true,childList:true,subtree:true}));}handleMutation(t){if(t.type==="characterData"){let n=this.mirror.get(t.target);n!==void 0&&this.push(3,{texts:[{id:n,value:ne(t.target.textContent??"",this.options.mask)}]});return}if(t.type==="attributes"&&t.attributeName){let n=this.mirror.get(t.target),r=t.target;n!==void 0&&this.push(3,{attributes:[{attributes:{[t.attributeName]:r.getAttribute(t.attributeName)??""},id:n}]});return}if(t.type==="childList"){let n=this.mirror.get(t.target);if(n===void 0)return;for(let r of Array.from(t.addedNodes)){let o=ie(this.adapt(r),this.allocator,this.options.mask,(a,i)=>{let s=a.ref;s&&this.mirror.set(s,i);});o&&this.push(3,{adds:[{node:o,parentId:n}]});}for(let r of Array.from(t.removedNodes)){let o=this.mirror.get(r);o!==void 0&&(this.push(3,{removes:[{id:o,parentId:n}]}),this.mirror.delete(r));}}}observeInteractions(t){t.addEventListener("input",n=>{let r=n.target;if(!r||!Kt.has(r.tagName))return;let o=this.mirror.get(r);o!==void 0&&this.push(3,{input:{id:o,value:te(r.value??"",r.type,this.options.mask)}});},true),t.addEventListener("scroll",n=>{let r=n.target,o=r?this.mirror.get(r):void 0;this.push(3,{scroll:{id:o??0,x:r?.scrollLeft??0,y:r?.scrollTop??0}});},true);}adapt(t){let n={childNodes:[],nodeType:t.nodeType,ref:t};if(t.nodeType===$e)return n.textValue=t.textContent??"",n;if(t.nodeType===_e){let r=t;if(n.tagName=r.tagName,n.attributes=Array.from(r.attributes).map(o=>({name:o.name,value:o.value})),Kt.has(r.tagName)){let o=r;n.inputType=o.type,n.inputValue=o.value??"";}}return n.childNodes=Array.from(t.childNodes).map(r=>this.adapt(r)),n}push(t,n){let r=this.chunker.add({data:n,timestamp:this.options.now(),type:t});r&&this.upload(r);}upload(t){!t||!this.fetchImpl||qt(t,{apiKey:this.options.apiKey,fetch:this.fetchImpl,replayHost:this.options.replayHost}).catch(n=>this.options.onError?.(n));}};function or(){return globalThis.document}function Gt(e){let t=new se({apiKey:e.apiKey,distinctId:e.distinctId,flushIntervalMs:e.flushIntervalMs??5e3,mask:{...Dt,...e.mask},maxEvents:e.maxEvents??200,now:e.now??(()=>Date.now()),onError:e.onError,replayHost:e.replayHost,sessionId:e.sessionId??d()});return t.start(),t}var ae=e=>`prodantix-cta:${e}`,Ut=e=>{try{let t=window.localStorage.getItem(ae(e));return t===null?null:Number(t)}catch{return null}},Vt=e=>{try{return window.sessionStorage.getItem(ae(e))!==null}catch{return false}},jt=(e,t)=>{try{window.localStorage.setItem(ae(e),String(t)),window.sessionStorage.setItem(ae(e),String(t));}catch{return}},Wt=(e,t,n,r)=>t===null?true:e.kind==="once"?false:e.kind==="session"?!n:r-t>=e.value*864e5;var $={am:{back:"\u1270\u1218\u1208\u1235",close:"\u12DD\u130B",closed:"\u12ED\u1205 \u1245\u133D \u12A0\u1201\u1295 \u121D\u120B\u123E\u127D\u1295 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",failed:"\u1218\u120B\u12AD \u12A0\u120D\u1270\u127B\u1208\u121D\u1362 \u12A5\u1295\u12F0\u1308\u1293 \u12ED\u121E\u12AD\u1229\u1362",invalid:"\u12ED\u1205 \u1218\u120D\u1235 \u12A0\u12ED\u1240\u1260\u120D\u121D\u1362",next:"\u1240\u1323\u12ED",poweredBy:"\u1260Prodantix \u12E8\u1270\u1230\u122B",required:"\u12ED\u1205 \u12EB\u1235\u1348\u120D\u130B\u120D\u1362",sending:"\u1260\u1218\u120B\u12AD \u120B\u12ED\u2026",step:"\u12F0\u1228\u1303 {step} \u12A8{total}",submit:"\u120B\u12AD",thanks:"\u12A5\u1293\u1218\u1230\u130D\u1293\u1208\u1295\u1362"},ar:{back:"\u0631\u062C\u0648\u0639",close:"\u0625\u063A\u0644\u0627\u0642",closed:"\u0644\u0627 \u064A\u0642\u0628\u0644 \u0647\u0630\u0627 \u0627\u0644\u0646\u0645\u0648\u0630\u062C \u0631\u062F\u0648\u062F\u064B\u0627 \u0627\u0644\u0622\u0646.",failed:"\u062A\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644. \u062D\u0627\u0648\u0644 \u0645\u0631\u0629 \u0623\u062E\u0631\u0649.",invalid:"\u0647\u0630\u0647 \u0627\u0644\u0625\u062C\u0627\u0628\u0629 \u063A\u064A\u0631 \u0645\u0642\u0628\u0648\u0644\u0629.",next:"\u0627\u0644\u062A\u0627\u0644\u064A",poweredBy:"\u0645\u062F\u0639\u0648\u0645 \u0645\u0646 Prodantix",required:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628.",sending:"\u062C\u0627\u0631\u064D \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u2026",step:"\u0627\u0644\u062E\u0637\u0648\u0629 {step} \u0645\u0646 {total}",submit:"\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064B\u0627 \u0644\u0643."},bn:{back:"\u09AA\u09C7\u099B\u09A8\u09C7",close:"\u09AC\u09A8\u09CD\u09A7 \u0995\u09B0\u09C1\u09A8",closed:"\u098F\u0987 \u09AB\u09B0\u09CD\u09AE\u099F\u09BF \u098F\u0996\u09A8 \u0989\u09A4\u09CD\u09A4\u09B0 \u09A8\u09BF\u099A\u09CD\u099B\u09C7 \u09A8\u09BE\u0964",failed:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09AF\u09BE\u09AF\u09BC\u09A8\u09BF\u0964 \u0986\u09AC\u09BE\u09B0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09B0\u09C1\u09A8\u0964",invalid:"\u098F\u0987 \u0989\u09A4\u09CD\u09A4\u09B0\u099F\u09BF \u0997\u09CD\u09B0\u09B9\u09A3\u09AF\u09CB\u0997\u09CD\u09AF \u09A8\u09AF\u09BC\u0964",next:"\u09AA\u09B0\u09AC\u09B0\u09CD\u09A4\u09C0",poweredBy:"Prodantix \u09A6\u09CD\u09AC\u09BE\u09B0\u09BE \u099A\u09BE\u09B2\u09BF\u09A4",required:"\u098F\u099F\u09BF \u0986\u09AC\u09B6\u09CD\u09AF\u0995\u0964",sending:"\u09AA\u09BE\u09A0\u09BE\u09A8\u09CB \u09B9\u099A\u09CD\u099B\u09C7\u2026",step:"\u09A7\u09BE\u09AA {step} / {total}",submit:"\u099C\u09AE\u09BE \u09A6\u09BF\u09A8",thanks:"\u09A7\u09A8\u09CD\u09AF\u09AC\u09BE\u09A6\u0964"},de:{back:"Zur\xFCck",close:"Schlie\xDFen",closed:"Dieses Formular nimmt gerade keine Antworten an.",failed:"Senden fehlgeschlagen. Bitte erneut versuchen.",invalid:"Diese Antwort wird nicht angenommen.",next:"Weiter",poweredBy:"Bereitgestellt von Prodantix",required:"Dieses Feld ist erforderlich.",sending:"Wird gesendet\u2026",step:"Schritt {step} von {total}",submit:"Absenden",thanks:"Vielen Dank."},en:{back:"Back",close:"Close",closed:"This form is not accepting responses right now.",failed:"This could not be sent. Try again.",invalid:"This answer is not accepted.",next:"Next",poweredBy:"Powered by Prodantix",required:"This is required.",sending:"Sending\u2026",step:"Step {step} of {total}",submit:"Submit",thanks:"Thank you."},es:{back:"Atr\xE1s",close:"Cerrar",closed:"Este formulario no acepta respuestas ahora.",failed:"No se pudo enviar. Int\xE9ntalo de nuevo.",invalid:"Esta respuesta no se acepta.",next:"Siguiente",poweredBy:"Con la tecnolog\xEDa de Prodantix",required:"Este campo es obligatorio.",sending:"Enviando\u2026",step:"Paso {step} de {total}",submit:"Enviar",thanks:"Gracias."},et:{back:"Tagasi",close:"Sulge",closed:"See vorm ei v\xF5ta praegu vastuseid vastu.",failed:"Saatmine eba\xF5nnestus. Proovi uuesti.",invalid:"Seda vastust ei v\xF5eta vastu.",next:"Edasi",poweredBy:"Toetab Prodantix",required:"See on kohustuslik.",sending:"Saatmine\u2026",step:"Samm {step}/{total}",submit:"Saada",thanks:"Ait\xE4h."},fil:{back:"Bumalik",close:"Isara",closed:"Hindi tumatanggap ng sagot ang form na ito ngayon.",failed:"Hindi naipadala. Subukan ulit.",invalid:"Hindi tinatanggap ang sagot na ito.",next:"Susunod",poweredBy:"Pinapagana ng Prodantix",required:"Kailangan ito.",sending:"Ipinapadala\u2026",step:"Hakbang {step} sa {total}",submit:"Ipadala",thanks:"Salamat."},fr:{back:"Retour",close:"Fermer",closed:"Ce formulaire n\u2019accepte plus de r\xE9ponses pour le moment.",failed:"L\u2019envoi a \xE9chou\xE9. R\xE9essayez.",invalid:"Cette r\xE9ponse n\u2019est pas accept\xE9e.",next:"Suivant",poweredBy:"Propuls\xE9 par Prodantix",required:"Ce champ est obligatoire.",sending:"Envoi\u2026",step:"\xC9tape {step} sur {total}",submit:"Envoyer",thanks:"Merci."},hi:{back:"\u092A\u0940\u091B\u0947",close:"\u092C\u0902\u0926 \u0915\u0930\u0947\u0902",closed:"\u092F\u0939 \u092B\u093C\u0949\u0930\u094D\u092E \u0905\u092D\u0940 \u091C\u0935\u093E\u092C \u0928\u0939\u0940\u0902 \u0932\u0947 \u0930\u0939\u093E \u0939\u0948\u0964",failed:"\u092D\u0947\u091C\u093E \u0928\u0939\u0940\u0902 \u091C\u093E \u0938\u0915\u093E\u0964 \u092B\u093F\u0930 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0947\u0902\u0964",invalid:"\u092F\u0939 \u091C\u0935\u093E\u092C \u0938\u094D\u0935\u0940\u0915\u093E\u0930 \u0928\u0939\u0940\u0902 \u0939\u0948\u0964",next:"\u0906\u0917\u0947",poweredBy:"Prodantix \u0926\u094D\u0935\u093E\u0930\u093E \u0938\u0902\u091A\u093E\u0932\u093F\u0924",required:"\u092F\u0939 \u091C\u093C\u0930\u0942\u0930\u0940 \u0939\u0948\u0964",sending:"\u092D\u0947\u091C\u093E \u091C\u093E \u0930\u0939\u093E \u0939\u0948\u2026",step:"\u091A\u0930\u0923 {step} / {total}",submit:"\u092D\u0947\u091C\u0947\u0902",thanks:"\u0927\u0928\u094D\u092F\u0935\u093E\u0926\u0964"},id:{back:"Kembali",close:"Tutup",closed:"Formulir ini sedang tidak menerima tanggapan.",failed:"Gagal mengirim. Coba lagi.",invalid:"Jawaban ini tidak diterima.",next:"Berikutnya",poweredBy:"Didukung oleh Prodantix",required:"Wajib diisi.",sending:"Mengirim\u2026",step:"Langkah {step} dari {total}",submit:"Kirim",thanks:"Terima kasih."},ja:{back:"\u623B\u308B",close:"\u9589\u3058\u308B",closed:"\u3053\u306E\u30D5\u30A9\u30FC\u30E0\u306F\u73FE\u5728\u56DE\u7B54\u3092\u53D7\u3051\u4ED8\u3051\u3066\u3044\u307E\u305B\u3093\u3002",failed:"\u9001\u4FE1\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F\u3002\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",invalid:"\u3053\u306E\u56DE\u7B54\u306F\u53D7\u3051\u4ED8\u3051\u3089\u308C\u307E\u305B\u3093\u3002",next:"\u6B21\u3078",poweredBy:"Powered by Prodantix",required:"\u5FC5\u9808\u9805\u76EE\u3067\u3059\u3002",sending:"\u9001\u4FE1\u4E2D\u2026",step:"\u30B9\u30C6\u30C3\u30D7 {step}/{total}",submit:"\u9001\u4FE1",thanks:"\u3042\u308A\u304C\u3068\u3046\u3054\u3056\u3044\u307E\u3057\u305F\u3002"},ko:{back:"\uC774\uC804",close:"\uB2EB\uAE30",closed:"\uC774 \uC591\uC2DD\uC740 \uC9C0\uAE08 \uC751\uB2F5\uC744 \uBC1B\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.",failed:"\uBCF4\uB0B4\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uB2E4\uC2DC \uC2DC\uB3C4\uD558\uC138\uC694.",invalid:"\uC774 \uB2F5\uBCC0\uC740 \uBC1B\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",next:"\uB2E4\uC74C",poweredBy:"Prodantix \uC81C\uACF5",required:"\uD544\uC218 \uD56D\uBAA9\uC785\uB2C8\uB2E4.",sending:"\uBCF4\uB0B4\uB294 \uC911\u2026",step:"{total}\uB2E8\uACC4 \uC911 {step}\uB2E8\uACC4",submit:"\uC81C\uCD9C",thanks:"\uAC10\uC0AC\uD569\uB2C8\uB2E4."},pt:{back:"Voltar",close:"Fechar",closed:"Este formul\xE1rio n\xE3o est\xE1 a aceitar respostas neste momento.",failed:"N\xE3o foi poss\xEDvel enviar. Tente novamente.",invalid:"Esta resposta n\xE3o \xE9 aceite.",next:"Seguinte",poweredBy:"Com tecnologia Prodantix",required:"Este campo \xE9 obrigat\xF3rio.",sending:"A enviar\u2026",step:"Passo {step} de {total}",submit:"Enviar",thanks:"Obrigado."},ru:{back:"\u041D\u0430\u0437\u0430\u0434",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",closed:"\u042D\u0442\u0430 \u0444\u043E\u0440\u043C\u0430 \u0441\u0435\u0439\u0447\u0430\u0441 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442 \u043E\u0442\u0432\u0435\u0442\u044B.",failed:"\u041D\u0435 \u0443\u0434\u0430\u043B\u043E\u0441\u044C \u043E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C. \u041F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0435\u0449\u0451 \u0440\u0430\u0437.",invalid:"\u042D\u0442\u043E\u0442 \u043E\u0442\u0432\u0435\u0442 \u043D\u0435 \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0441\u044F.",next:"\u0414\u0430\u043B\u0435\u0435",poweredBy:"\u0420\u0430\u0431\u043E\u0442\u0430\u0435\u0442 \u043D\u0430 Prodantix",required:"\u042D\u0442\u043E \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u043F\u043E\u043B\u0435.",sending:"\u041E\u0442\u043F\u0440\u0430\u0432\u043A\u0430\u2026",step:"\u0428\u0430\u0433 {step} \u0438\u0437 {total}",submit:"\u041E\u0442\u043F\u0440\u0430\u0432\u0438\u0442\u044C",thanks:"\u0421\u043F\u0430\u0441\u0438\u0431\u043E."},sw:{back:"Rudi",close:"Funga",closed:"Fomu hii haipokei majibu kwa sasa.",failed:"Imeshindwa kutuma. Jaribu tena.",invalid:"Jibu hili halikubaliki.",next:"Endelea",poweredBy:"Inaendeshwa na Prodantix",required:"Hii inahitajika.",sending:"Inatuma\u2026",step:"Hatua {step} kati ya {total}",submit:"Tuma",thanks:"Asante."},vi:{back:"Quay l\u1EA1i",close:"\u0110\xF3ng",closed:"Bi\u1EC3u m\u1EABu n\xE0y hi\u1EC7n kh\xF4ng nh\u1EADn c\xE2u tr\u1EA3 l\u1EDDi.",failed:"Kh\xF4ng g\u1EEDi \u0111\u01B0\u1EE3c. H\xE3y th\u1EED l\u1EA1i.",invalid:"C\xE2u tr\u1EA3 l\u1EDDi n\xE0y kh\xF4ng \u0111\u01B0\u1EE3c ch\u1EA5p nh\u1EADn.",next:"Ti\u1EBFp",poweredBy:"\u0110\u01B0\u1EE3c h\u1ED7 tr\u1EE3 b\u1EDFi Prodantix",required:"Tr\u01B0\u1EDDng n\xE0y l\xE0 b\u1EAFt bu\u1ED9c.",sending:"\u0110ang g\u1EEDi\u2026",step:"B\u01B0\u1EDBc {step}/{total}",submit:"G\u1EEDi",thanks:"C\u1EA3m \u01A1n b\u1EA1n."},zh:{back:"\u4E0A\u4E00\u6B65",close:"\u5173\u95ED",closed:"\u6B64\u8868\u5355\u76EE\u524D\u4E0D\u63A5\u53D7\u56DE\u590D\u3002",failed:"\u53D1\u9001\u5931\u8D25\uFF0C\u8BF7\u91CD\u8BD5\u3002",invalid:"\u6B64\u56DE\u7B54\u65E0\u6548\u3002",next:"\u4E0B\u4E00\u6B65",poweredBy:"\u7531 Prodantix \u63D0\u4F9B\u652F\u6301",required:"\u6B64\u9879\u4E3A\u5FC5\u586B\u9879\u3002",sending:"\u6B63\u5728\u53D1\u9001\u2026",step:"\u7B2C {step} \u6B65\uFF0C\u5171 {total} \u6B65",submit:"\u63D0\u4EA4",thanks:"\u8C22\u8C22\u3002"}},de=e=>{let t=(e??"").toLowerCase().split("-")[0]??"";return t in $?t:"en"};var y="prodantix-cta",zt="prodantix-cta-style",ir=`.${y}{font-family:system-ui,sans-serif;color:var(--pdx-text);background:var(--pdx-background);border-radius:var(--pdx-radius);box-sizing:border-box;padding:16px;display:flex;gap:12px;align-items:center;flex-wrap:wrap}
|
|
2
|
+
.${y} *{box-sizing:border-box}
|
|
3
|
+
.${y} h2{font-size:18px;line-height:1.3;margin:0;font-weight:700}
|
|
4
|
+
.${y} p{margin:0;font-size:15px;line-height:1.5}
|
|
5
|
+
.${y} img{max-width:100%;height:auto;border-radius:var(--pdx-radius)}
|
|
6
|
+
.${y} .pdx-text{display:flex;flex-direction:column;gap:6px;flex:1 1 240px;min-width:0}
|
|
7
|
+
.${y} .pdx-actions{display:flex;gap:8px;flex-wrap:wrap}
|
|
8
|
+
.${y} button{font:inherit;min-height:44px;padding:0 18px;border:0;border-radius:var(--pdx-radius);background:var(--pdx-button);color:var(--pdx-button-text);cursor:pointer}
|
|
9
|
+
.${y} button[data-secondary]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
10
|
+
.${y} .pdx-close{min-width:44px;padding:0;background:transparent;color:inherit;font-size:22px;line-height:1}
|
|
11
|
+
.${y} .pdx-meta{font-size:12px;opacity:.85;flex-basis:100%}
|
|
12
|
+
.${y} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}
|
|
13
|
+
.${y}[data-kind=banner]{position:fixed;left:0;right:0;z-index:2147483000;border-radius:0}
|
|
14
|
+
.${y}[data-kind=banner][data-placement=top]{top:0}
|
|
15
|
+
.${y}[data-kind=banner][data-placement=bottom]{bottom:0}
|
|
16
|
+
.${y}[data-kind=slide_in]{position:fixed;bottom:16px;z-index:2147483000;width:min(360px,calc(100vw - 32px));box-shadow:0 8px 32px rgba(0,0,0,.18)}
|
|
17
|
+
.${y}[data-kind=slide_in][data-placement=bottom_left]{left:16px}
|
|
18
|
+
.${y}[data-kind=slide_in][data-placement=bottom_right]{right:16px}
|
|
19
|
+
dialog.${y}{border:0;max-width:min(480px,calc(100vw - 32px));box-shadow:0 16px 48px rgba(0,0,0,.24)}
|
|
20
|
+
dialog.${y}::backdrop{background:rgba(0,0,0,.45)}
|
|
21
|
+
@media (prefers-reduced-motion:no-preference){.${y}[data-kind=slide_in],.${y}[data-kind=banner],dialog.${y}{animation:pdx-cta-in .2s ease-out}}
|
|
22
|
+
@keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,sr=()=>{if(document.getElementById(zt))return;let e=document.createElement("style");e.id=zt,e.textContent=ir,document.head.append(e);},ar=(e,t)=>{let n=t.variant.style;for(let[r,o]of [["--pdx-background",n.background],["--pdx-text",n.text],["--pdx-button",n.button],["--pdx-button-text",n.buttonText],["--pdx-radius",`${n.radius}px`]])e.style.setProperty(r,o);},Fe=(e,t,n,r)=>{let o=t.variant.content,a=$[n.language];if(e.className=y,e.dataset.kind=t.kind,e.dataset.placement=t.placement,e.dataset.ctaId=t.id,ar(e,t),o.image){let s=document.createElement("img");s.src=o.image,s.alt=o.imageAlt,s.loading="lazy",e.append(s);}let i=document.createElement("div");if(i.className="pdx-text",o.heading){let s=document.createElement("h2");s.textContent=o.heading,i.append(s);}if(o.body){let s=document.createElement("p");s.textContent=o.body,i.append(s);}if(e.append(i),o.buttons.length>0){let s=document.createElement("div");s.className="pdx-actions",o.buttons.forEach((c,d)=>{let u=document.createElement("button");u.type="button",u.textContent=c.label,u.dataset.action=`button-${d}`,d>0&&(u.dataset.secondary=""),u.addEventListener("click",()=>n.onButton(d)),s.append(u);}),e.append(s);}if(r){let s=document.createElement("button");s.type="button",s.className="pdx-close",s.dataset.action="close",s.textContent="\xD7",s.setAttribute("aria-label",a.close),s.title=a.close,s.addEventListener("click",r),e.append(s);}if(t.poweredBy){let s=document.createElement("p");s.className="pdx-meta",s.textContent=a.poweredBy,e.append(s);}},ue=(e,t)=>{sr();let n=e.variant.content.heading||e.variant.content.body;if(e.kind==="embedded"){let i=[...document.querySelectorAll("[data-prodantix-cta]")].filter(s=>s.dataset.prodantixCta===e.id).map(s=>{let c=document.createElement("section");return c.setAttribute("aria-label",n),Fe(c,e,t,null),s.replaceChildren(c),c});return {destroy:()=>i.forEach(s=>s.remove()),elements:i}}if(e.kind==="popup"){let a=document.activeElement instanceof HTMLElement?document.activeElement:null,i=document.createElement("dialog");i.setAttribute("aria-label",n);let s=false,c=()=>{s||(s=true,i.open&&i.close(),i.remove(),a?.focus());},d=()=>{c(),t.onDismiss();};return Fe(i,e,t,d),i.addEventListener("cancel",u=>{u.preventDefault(),d();}),document.body.append(i),i.showModal(),{destroy:c,elements:[i]}}let r=document.createElement("section");r.setAttribute("aria-label",n),e.kind==="slide_in"&&(r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"));let o=()=>r.remove();return Fe(r,e,t,()=>{o(),t.onDismiss();}),document.body.append(r),{destroy:o,elements:[r]}};var Jt=(e,t)=>{let n=false,r=[],o=()=>{n=true;for(let i of r.splice(0))i();},a=()=>{n||(o(),t());};if(e.kind==="load")queueMicrotask(a);else if(e.kind==="delay"){let i=setTimeout(a,e.value*1e3);r.push(()=>clearTimeout(i));}else if(e.kind==="scroll"){let i=()=>{let s=document.documentElement.scrollHeight-window.innerHeight;(s<=0||window.scrollY/s*100>=e.value)&&a();};window.addEventListener("scroll",i,{passive:true}),r.push(()=>window.removeEventListener("scroll",i)),i();}else if(e.kind==="exit"){let i=s=>{s.relatedTarget===null&&s.clientY<=0&&a();};document.addEventListener("mouseout",i),r.push(()=>document.removeEventListener("mouseout",i));}else {let i=e.value,s=d=>{try{return d.closest(i)!==null}catch{return false}},c=d=>{let u=d.target;u instanceof Element&&s(u)&&a();};document.addEventListener("click",c,true),r.push(()=>document.removeEventListener("click",c,true));}return o};var Yt=e=>`prodantix-form-popup:${e}`,dr=e=>{try{let t=window.localStorage.getItem(Yt(e));return t===null?null:Number(t)}catch{return null}},ur=(e,t)=>{try{window.localStorage.setItem(Yt(e),String(t));}catch{return}},Xt=(e,t,n)=>n===null||t-n>=e.periodDays*864e5,Qt=(e,t,n=Date.now)=>{if(!Xt(e,n(),dr(e.formId)))return ()=>{};let r=false,o=[],a=()=>{if(!r){r=true;for(let s of o)s();ur(e.formId,n()),t();}},i=e.trigger;if(i.kind==="delay"){let s=setTimeout(a,i.seconds*1e3);o.push(()=>clearTimeout(s));}else if(i.kind==="scroll"){let s=()=>{let c=document.documentElement.scrollHeight-window.innerHeight;(c<=0||window.scrollY/c*100>=i.percent)&&a();};window.addEventListener("scroll",s,{passive:true}),o.push(()=>window.removeEventListener("scroll",s));}else {let s=c=>{c.relatedTarget===null&&c.clientY<=0&&a();};document.addEventListener("mouseout",s),o.push(()=>document.removeEventListener("mouseout",s));}return ()=>{r=true;for(let s of o)s();}};var cr=e=>{let t=0;for(let n of e){if(n!==0)return t+Math.clz32(n)-24;t+=8;}return t},lr=async e=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(e))),Zt=async e=>{for(let t=0;;t+=1){let n=t.toString(36);if(cr(await lr(`${e.nonce}:${n}`))>=e.difficulty)return n}};var S="prodantix-form",pr=`.${S}{font-family:var(--pdx-font);color:var(--pdx-text);background:var(--pdx-background);max-width:var(--pdx-width);box-sizing:border-box;padding:16px;border-radius:var(--pdx-radius)}
|
|
23
|
+
.${S} *{box-sizing:border-box}
|
|
24
|
+
.${S} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
|
|
25
|
+
.${S} .pdx-field[hidden]{display:none}
|
|
26
|
+
.${S} label,.${S} legend{font-weight:600;font-size:14px}
|
|
27
|
+
.${S} input:not([type=checkbox]):not([type=radio]),.${S} select,.${S} textarea{font:inherit;color:var(--pdx-field-text);background:var(--pdx-field-background);border:1px solid currentColor;border-radius:var(--pdx-radius);padding:10px;min-height:44px;width:100%}
|
|
28
|
+
.${S} .pdx-choice{display:flex;align-items:center;gap:8px;min-height:44px}
|
|
29
|
+
.${S} .pdx-help,.${S} .pdx-meta{font-size:12px;opacity:.85}
|
|
30
|
+
.${S} .pdx-error{font-size:12px;font-weight:600}
|
|
31
|
+
.${S} button{font:inherit;min-height:44px;padding:0 18px;border:0;border-radius:var(--pdx-radius);background:var(--pdx-button);color:var(--pdx-button-text);cursor:pointer}
|
|
32
|
+
.${S} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
33
|
+
.${S} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
|
|
34
|
+
.${S} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
|
|
35
|
+
.${S} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,en=e=>e==null||e===false||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0,tn=(e,t)=>{let n=e.condition;if(!n)return true;let r=t[n.field];return en(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(a=>typeof a=="string"&&n.values.includes(a))},mr=e=>{let t=`${encodeURIComponent(e)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(t));return n?decodeURIComponent(n.slice(t.length)):""},fr=e=>{let t=e.hidden;return t?t.source==="fixed"?t.value:t.source==="query"?new URLSearchParams(window.location.search).get(t.value)??"":mr(t.value):""},p=(e,t={},n=[])=>{let r=Object.assign(document.createElement(e),t);return r.append(...n),r},gr=(e,t,n)=>{let r=p("p",{className:"pdx-error",id:`${t}-error`}),o=e.help?p("p",{className:"pdx-help",id:`${t}-help`},[e.help]):null,a=[o?`${t}-help`:"",`${t}-error`].filter(Boolean).join(" "),i=p("div",{className:"pdx-field"});if(i.dataset.field=e.key,e.kind==="rich_text")return i.append(p("p",{},[e.label])),{error:r,field:e,focus:()=>{},read:()=>{},root:i};if(e.kind==="hidden")return i.hidden=true,{error:r,field:e,focus:()=>{},read:()=>fr(e),root:i};if(e.kind==="radio"||e.kind==="checkboxes"){let u=p("fieldset",{});u.setAttribute("aria-describedby",a),e.required&&u.setAttribute("aria-required","true"),u.append(p("legend",{},[e.label]));let l=e.options.filter(L=>!L.archived).map((L,T)=>{let I=p("input",{id:`${t}-${T}`,name:t,type:e.kind==="radio"?"radio":"checkbox",value:L.value});return I.addEventListener("change",n),u.append(p("div",{className:"pdx-choice"},[I,p("label",{htmlFor:`${t}-${T}`},[L.label])])),I});return i.append(u,...o?[o]:[],r),{error:r,field:e,focus:()=>l[0]?.focus(),read:()=>{let L=l.filter(T=>T.checked).map(T=>T.value);return e.kind==="radio"?L[0]??"":L},root:i}}let s=p("label",{htmlFor:t},[e.label]),c;if(e.kind==="textarea")c=p("textarea",{id:t,placeholder:e.placeholder,rows:4});else if(e.kind==="dropdown")c=p("select",{id:t},[p("option",{value:""},[""]),...e.options.filter(u=>!u.archived).map(u=>p("option",{value:u.value},[u.label]))]);else if(e.kind==="checkbox")c=p("input",{id:t,type:"checkbox"});else {let u={date:"date",email:"email",file:"file",number:"number",phone:"tel"};c=p("input",{id:t,placeholder:e.placeholder,type:u[e.kind]??"text"}),e.kind==="email"&&(c.autocomplete="email");}return c.setAttribute("aria-describedby",a),e.required&&c.setAttribute("aria-required","true"),c.addEventListener("input",n),c.addEventListener("change",n),e.kind==="checkbox"?i.append(p("div",{className:"pdx-choice"},[c,s]),...o?[o]:[],r):i.append(s,...o?[o]:[],c,r),{error:r,field:e,focus:()=>c.focus(),read:()=>c instanceof HTMLInputElement&&c.type==="checkbox"?c.checked:e.kind==="number"?c.value===""?"":Number(c.value):c.value,root:i}},hr=(e,t)=>{let n=t.style,r={"--pdx-background":n.background,"--pdx-button":n.button,"--pdx-button-text":n.buttonText,"--pdx-field-background":n.fieldBackground,"--pdx-field-text":n.fieldText,"--pdx-font":n.font,"--pdx-radius":`${n.radius}px`,"--pdx-text":n.text,"--pdx-width":`${n.width}px`};for(let[o,a]of Object.entries(r))e.style.setProperty(o,a);},yr=()=>{document.getElementById("prodantix-form-style")||document.head.append(p("style",{id:"prodantix-form-style",textContent:pr}));},ce=(e,t$1)=>{let{formId:n,host:r,language:o}=t$1,a=$[o],i=l=>a[l],s$1=p("form",{className:S,noValidate:true});s$1.dataset.prodantixForm=n;let c=p("p",{className:"pdx-meta"});c.setAttribute("aria-live","polite"),c.setAttribute("role","status");let d=false,u$1=r.form(n).then(l=>{if(d)return;if(!l.accepting){s$1.replaceChildren(p("p",{className:"pdx-meta"},[i("closed")]));return}yr(),hr(s$1,l);let k=l.challenge?Zt(l.challenge):null,L=false,T=[],I=()=>{let m={};for(let x of T.flat())if(!x.root.hidden||x.field.kind==="hidden"){let P=x.read();P!==void 0&&(m[x.field.key]=P);}return m},O=()=>{let m=I();for(let x of T.flat())x.field.kind!=="hidden"&&(x.root.hidden=!tn(x.field,m));},A=()=>{L||(L=true,r.capture(t,{$form_id:l.id,$form_version:l.version})),O();},N=l.steps.map((m,x)=>{let P=p("div",{});P.dataset.step=String(x),m.title&&P.append(p("p",{className:"pdx-meta"},[m.title]));let v=m.fields.map(M=>gr(M,`pdx-${n}-${M.key}`,A));return T.push(v),P.append(...v.map(M=>M.root)),P}),F=p("input",{autocomplete:"off",name:l.honeypot,tabIndex:-1,type:"text"}),R=p("div",{className:"pdx-hp"},[F]);R.setAttribute("aria-hidden","true");let _=[],h=p("div",{});if(l.consent.processing){let m=p("input",{id:`pdx-${n}-consent`,type:"checkbox"});m.setAttribute("aria-required","true"),_.push({input:m,key:"$consent_processing"}),h.append(p("div",{className:"pdx-choice"},[m,p("label",{htmlFor:m.id},[l.consent.processing])]));}for(let m of l.consent.purposes){let x=p("input",{id:`pdx-${n}-consent-${m.key}`,type:"checkbox"});_.push({input:x,key:`$consent_${m.key}`}),h.append(p("div",{className:"pdx-choice"},[x,p("label",{htmlFor:x.id},[m.label])])),m.notice&&h.append(p("p",{className:"pdx-help"},[m.notice]));}let f=p("p",{className:"pdx-meta"}),E=p("button",{type:"button"},[i("back")]);E.dataset.variant="back";let b=p("button",{type:"button"},[i("next")]),C=p("button",{type:"submit"},[i("submit")]);E.dataset.action="back",b.dataset.action="next",C.dataset.action="submit";let Be=p("div",{className:"pdx-actions"},[E,b,C]),g=0,le=()=>{N.forEach((x,P)=>{x.hidden=P!==g;});let m=g===N.length-1;E.hidden=g===0,b.hidden=m,C.hidden=!m,h.hidden=!m,f.hidden=N.length<2,f.textContent=i("step").replace("{step}",String(g+1)).replace("{total}",String(N.length));},dn=()=>{for(let m of T.flat())m.error.textContent="",m.root.querySelector("[aria-invalid]")?.removeAttribute("aria-invalid");},He=(m,x)=>{m.error.textContent=x,m.root.querySelector("input,select,textarea,fieldset")?.setAttribute("aria-invalid","true");},qe=m=>{dn();let x=I(),P=(T[m]??[]).filter(v=>!v.root.hidden&&v.field.required&&en(x[v.field.key]));for(let v of P)He(v,i("required"));return P.length>0?(c.textContent=i("required"),P[0]?.focus(),false):true};E.addEventListener("click",()=>{g=Math.max(0,g-1),le();}),b.addEventListener("click",()=>{qe(g)&&(g+=1,le());}),s$1.addEventListener("submit",m=>{if(m.preventDefault(),!qe(g))return;let x={...I(),[l.honeypot]:F.value};for(let v of _)x[v.key]=v.input.checked;C.disabled=true,C.textContent=i("sending");let P=l.challenge;if(!P||!k){c.textContent=i("closed");return}k.then(v=>r.submit(n,x,P,v)).then(v=>{if(v.kind==="redirect"&&v.value.startsWith("https://")){window.location.assign(v.value);return}let M=p("p",{},[v.kind==="message"&&v.value?v.value:i("thanks")]);M.setAttribute("role","status"),s$1.replaceChildren(M);}).catch(v=>{C.disabled=false,C.textContent=i("submit");let M=v instanceof u?v.fields:[];for(let Ke of M){let Ge=T.flat().find(un=>un.field.key===Ke.field);Ge&&He(Ge,Ke.rule==="required"?i("required"):i("invalid"));}c.textContent=M.length>0?i("invalid"):i("failed");});}),s$1.append(f,...N,R,h,Be,c),l.poweredBy&&t$1.poweredBy!==false&&s$1.append(p("p",{className:"pdx-meta"},[i("poweredBy")])),le(),O(),r.capture(s,{$form_id:l.id,$form_version:l.version});}).catch(()=>{d||s$1.replaceChildren(p("p",{className:"pdx-meta"},[i("closed")]));});return e.append(s$1),{destroy:()=>{d=true,s$1.remove();},ready:u$1}};var De=e=>({capture:(t,n)=>e.capture(t,{properties:n}),form:t=>e.getForm(t),submit:(t,n,r,o)=>e.submitForm(t,n,r,o)});var nn=e=>({capture:(t,n,r)=>e.captureCta(t,n,r),ctas:t=>e.getCtas(t),forms:De(e),isEnabled:t=>e.isFeatureEnabled(t),variant:async t=>(await e.getVariant(t))?.key??null}),rn=e=>e<768?"mobile":e<1024?"tablet":"desktop",on=async(e,t)=>{let n=t.flag;return n?n.variant?await e.variant(n.key)===n.variant:e.isEnabled(n.key):true},xr=(e,t,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let o=document.createElement("button");o.type="button",o.textContent="\xD7",o.setAttribute("aria-label",$[n].close),o.title=$[n].close,o.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(o),document.body.append(r),ce(r,{formId:e,host:t,language:n}),r.showModal();},vr=()=>{let e=window.prodantix;typeof e=="function"&&e("open");},sn=async(e,t)=>{let n=t.now??Date.now,r=t.open??(d=>window.location.assign(d)),o=[],a=[],i$1=false,s=()=>{i$1=true;for(let d of o.splice(0))d();for(let d of a.splice(0))d.destroy();},c=await e.ctas({device:rn(window.innerWidth),language:document.documentElement.lang||t.language,url:window.location.href});for(let d of c)i$1||!Wt(d.frequency,Ut(d.id),Vt(d.id),n())||!await on(e,d)||o.push(Jt(d.trigger,()=>{if(i$1)return;let u=ue(d,{language:t.language,onButton:l=>{e.capture(j,d,l);let k$1=d.variant.content.buttons[l]?.action;k$1&&((k$1.kind!=="url"||d.kind!=="embedded")&&u.destroy(),k$1.kind==="url"?r(k$1.value):k$1.kind==="form"?xr(k$1.value,e.forms,t.language):k$1.kind==="messenger"?vr():e.capture(k,d));},onDismiss:()=>e.capture(k,d)});u.elements.length!==0&&(a.push(u),jt(d.id,n()),e.capture(i,d));}));return s},kr=()=>{},br=(e,t)=>{let n=nn(e),r=de(t??document.documentElement.lang),o=()=>sn(n,{language:r}).catch(u=>(console.error("[prodantix] the CTAs for this page could not be read",u),kr)),a=o(),i=window.location.href,s=()=>{if(window.location.href===i)return;i=window.location.href,a=a.then(l=>(l(),o()));},c=history.pushState.bind(history),d=history.replaceState.bind(history);return history.pushState=(...u)=>{c(...u),s();},history.replaceState=(...u)=>{d(...u),s();},window.addEventListener("popstate",s),()=>{history.pushState=c,history.replaceState=d,window.removeEventListener("popstate",s),a.then(u=>u());}};var B=class{constructor(t){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e$1(t.fetch),this.host=h(t.host),this.projectKey=t.projectKey,this.requestTimeoutMs=t.requestTimeoutMs??1e4;}async request(t,n){let r=this.fetch;if(!r)throw new d$1("no fetch implementation available in this runtime");let o=f(),a=o?setTimeout(()=>o.abort(),this.requestTimeoutMs):void 0;try{let i={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(i["content-type"]="application/json");let s=await r(`${this.host}${t}`,{body:n.body,headers:i,method:n.method,signal:o?.signal});return {status:s.status,text:await s.text()}}finally{a!==void 0&&clearTimeout(a);}}async vapidKey(t){let{status:n,text:r}=await this.request(`/v1/push/vapid?appId=${encodeURIComponent(t)}`,{method:"GET"});if(n<200||n>=300)throw new d$1(`push key request failed with status ${n}`,n);return JSON.parse(r).publicKey}async register(t){let{status:n,text:r}=await this.request("/v1/push/devices",{body:JSON.stringify(t),method:"POST"});if(n<200||n>=300)throw new d$1(`push registration failed with status ${n}`,n);return JSON.parse(r).id}async opened(t){let{status:n}=await this.request("/v1/push/opens",{body:JSON.stringify({sendId:t}),method:"POST"});if(n<200||n>=300)throw new d$1(`push open report failed with status ${n}`,n)}};var an="/prodantix-push-sw.js",wr=()=>{let e=globalThis,t=e.navigator?.serviceWorker,n=e.Notification;return t===void 0||n===void 0||e.PushManager===void 0?null:{register:async r=>(await t.register(r),t.ready),requestPermission:()=>n.requestPermission()}},Er=e=>{let t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(e.length/4)*4,"="),n=atob(t);return Uint8Array.from(n,r=>r.charCodeAt(0))},Sr=(e,t,n)=>`${e}${e.includes("?")?"&":"?"}host=${encodeURIComponent(t)}&key=${encodeURIComponent(n)}`,Tr=async e=>{let t=e.browser??wr();if(t===null)return {status:"unsupported"};if(await t.requestPermission()!=="granted")return {status:"denied"};let r=new B({fetch:e.fetch,host:e.host,projectKey:e.apiKey}),o=await t.register(Sr(e.serviceWorker??an,e.host,e.apiKey)),a=await o.pushManager.getSubscription()??await o.pushManager.subscribe({applicationServerKey:Er(await r.vapidKey(e.appId)),userVisibleOnly:true});return {deviceId:await r.register({appId:e.appId,distinctId:e.distinctId,permission:"granted",platform:"web",token:JSON.stringify(a.toJSON())}),status:"registered"}};function Cr(){return globalThis.navigator}function Lr(){return globalThis.document}function Pr(){return globalThis.history}function Ar(){return globalThis.location}function Ir(e){let t=e?.userAgentData?.platform??e?.platform;return t?t.slice(0,50):void 0}function Nr(e){let t=()=>{e.flush();};globalThis.document?.addEventListener?.("visibilitychange",t),globalThis.addEventListener?.("pagehide",t);}function Or(e,t,n){try{return Ne({domain:t,name:`pdx_${h$1(e)}`})??n}catch{return n}}function hi(e){let{autocaptureOptions:t,cookieDomain:n,guides:r,linkedDomains:o,replayHost:a,sessionReplay:i,sessionReplayOptions:s,surveys:c$1,...d}=e,u=Cr(),l=b(),k=d.storage??l,L=d.sharedStorage??Or(d.apiKey,n,l),T=Ft({history:Pr(),location:Ar(),namespace:h$1(d.apiKey),now:(d.clock??c).now().getTime(),shared:L,storage:k}),I=J(d.onError??(()=>{})),O={...d,describeElement:d.describeElement??(R=>ft(R,I)),locale:d.locale??(u?.language?u.language.slice(0,20):void 0),os:d.os??Ir(u),sessionTracking:d.sessionTracking??true,sharedStorage:L,storage:k,transport:d.transport??new Q({maxRetries:d.maxRetries,requestTimeoutMs:d.requestTimeoutMs})},A=new _(O);T!==void 0&&A.alias(T),Nr(A),O.consentMode==="banner"&&typeof window<"u"&&wt(A,window),(e.autocapture??true)&&vt(A,{onError:O.onError,...t});let N=Lr();N&&o&&Oe(N,A,o);let F=typeof window>"u"?void 0:window;if(F&&(c$1!==false||r!==false)&&At(A,F,{edgeHost:(d.flagsHost??d.host).replace(/\/+$/,""),guides:r!==false,namespace:h$1(d.apiKey),onError:O.onError??(()=>{}),storage:k,surveys:c$1!==false}),i&&a){let R=()=>{Gt({apiKey:O.apiKey,distinctId:()=>A.distinctId,onError:O.onError,replayHost:a,...s,sessionId:s?.sessionId??A.sessionId});};if(A.isCookieless()){let _=A.onStorageAllowed(()=>{_(),R();});}else R();}return A}
|
|
36
|
+
export{pt as ACTION_ATTRIBUTE,lt as ANNOTATION_ATTRIBUTE,D as ANNOTATION_MAX_LENGTH,an as DEFAULT_SERVICE_WORKER,mt as IGNORE_ATTRIBUTE,B as PushClient,Q as WebTransport,Ne as createCookieStorage,hi as createWebClient,nn as ctasHost,Mt as decorateLink,rn as deviceOf,on as flagAllows,de as formLanguage,De as formsHost,vt as installAutocapture,Oe as installLinkCarry,Gt as installSessionReplay,_t as readCarry,Tr as registerPush,ue as renderCta,ce as renderForm,Tt as resolveCookieDomain,sn as runCtas,br as startCtas,$t as stripCarry,Qt as watchPopup};//# sourceMappingURL=web.js.map
|
|
2
37
|
//# sourceMappingURL=web.js.map
|
package/package.json
CHANGED
package/dist/chunk-D6PMLUYA.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import {c as c$1,a as a$2,b as b$2}from'./chunk-V77KYPOF.js';import {e,h,d,f as f$1,g as g$1,a as a$1,b as b$1,c as c$2}from'./chunk-ODN4ZELX.js';import {a}from'./chunk-5XGN7UAV.js';var g=class{constructor(){a(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,t){this.store.set(e,t);}};function Ce(){try{let s=globalThis.localStorage;if(s){let e="__pdx_probe__";return s.setItem(e,"1"),s.removeItem(e),s}}catch{return new g}return new g}var V={now:()=>new Date};function S(s){return s.toISOString()}var de=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var ue=/^(?:\$|[a-z])[a-z0-9_.]*$/;function j(s){let e=0;for(let t of s)e+=1;return e}function H(s){return de.test(s)}function he(s){return ue.test(s)}function U(s){let e=j(s);if(e<1||e>200)throw new c$2("distinct_id","distinct_id must be between 1 and 200 characters")}function B(s){let e=j(s);if(e<1||e>200)throw new c$2("event_name","event_name must be between 1 and 200 characters");if(!he(s))throw new c$2("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var J="prodantix-js",z="0.7.0";function pe(){return globalThis.crypto}function fe(s){s[6]=s[6]&15|64,s[8]=s[8]&63|128;let e=[];for(let t=0;t<16;t+=1)e.push(s[t].toString(16).padStart(2,"0"));return `${e[0]}${e[1]}${e[2]}${e[3]}-${e[4]}${e[5]}-${e[6]}${e[7]}-${e[8]}${e[9]}-${e[10]}${e[11]}${e[12]}${e[13]}${e[14]}${e[15]}`}function me(){let s=pe();if(s?.randomUUID)return s.randomUUID();let e=new Uint8Array(16);if(s?.getRandomValues)s.getRandomValues(e);else for(let t=0;t<16;t+=1)e[t]=Math.floor(Math.random()*256);return fe(e)}var Q={uuid:me};var ge=s=>{};function G(s){if(!s.apiKey||!H(s.apiKey))throw new b$1("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!s.host)throw new b$1("host is required (the ingest base URL)");let e=h(s.host),t=s.defaultProperties,n=s.storage??new g;return {apiKey:s.apiKey,autocapture:s.autocapture??false,clock:s.clock??V,consent:s.consent,defaultProperties:typeof t=="function"?t:()=>t??{},describeElement:s.describeElement,flagsHost:s.flagsHost?h(s.flagsHost):e,flushAt:s.flushAt??20,flushIntervalMs:s.flushIntervalMs??1e4,host:e,ids:s.ids??Q,locale:s.locale,maxQueueSize:s.maxQueueSize??1e3,maxRetries:s.maxRetries??3,namespace:ye(s.apiKey),onError:s.onError??ge,os:s.os,requestTimeoutMs:s.requestTimeoutMs??1e4,sdkName:s.sdkName??J,sdkVersion:s.sdkVersion??z,sessionTracking:s.sessionTracking??false,sharedStorage:s.sharedStorage??n,socketFactory:s.socketFactory,storage:n,streamFlags:s.streamFlags??false,transport:s.transport}}function ye(s){return s.slice(0,16)}var f=Symbol("absent");function ve(s,e){if(s==="distinct_id")return e.distinctId;let t=e.properties??{};if(Object.prototype.hasOwnProperty.call(t,s))return t[s];let n=e.attributes??{};return Object.prototype.hasOwnProperty.call(n,s)?n[s]:f}function p(s){return s===f?"undefined":String(s)}function W(s){return s===f?Number.NaN:Number(s)}function Y(s){return s!==f&&s!==null&&s!==""}function X(s,e){if(!Array.isArray(e))return false;let t=p(s);return e.map(n=>String(n)).includes(t)}function Z(s,e){let t=ve(s.attribute,e),n=s.value;switch(s.op){case "is_set":return Y(t);case "is_not_set":return !Y(t);case "eq":return p(t)===p(n===void 0?f:n);case "neq":return p(t)!==p(n===void 0?f:n);case "contains":return p(t).includes(p(n===void 0?f:n));case "in":return X(t,n);case "not_in":return Array.isArray(n)?!X(t,n):false;case "gt":return x(t,n,(i,r)=>i>r);case "gte":return x(t,n,(i,r)=>i>=r);case "lt":return x(t,n,(i,r)=>i<r);case "lte":return x(t,n,(i,r)=>i<=r);case "in_cohort":return typeof n=="string"&&n!==""&&(e.cohorts??[]).includes(n);case "not_in_cohort":return typeof n=="string"&&n!==""&&!(e.cohorts??[]).includes(n);default:return false}}function x(s,e,t){let n=W(s),i=e===void 0?Number.NaN:W(e);return Number.isNaN(n)||Number.isNaN(i)?false:t(n,i)}function ee(s,e){let t=`${s}:${e}`,n=2166136261;for(let i=0;i<t.length;i++)n^=t.charCodeAt(i),n=Math.imul(n,16777619);return (n>>>0)%100}function P(s,e){return s.targeting.length===0||s.targeting.every(t=>Z(t,e))}function te(s,e){let t=ee(s.key,e.distinctId),n=s.variations??[];if(n.length===0)return s.rolloutPercentage>=100||t<s.rolloutPercentage?"true":"false";let i=0;for(let r=n.length-1;r>=0;r--)if(i+=n[r].weight,t<i)return n[r].key;return n[0].key}function R(s,e,t,n){for(let i of s.prerequisites??[]){if(n.includes(i.flagKey))return false;let r=e.find(d=>d.key===i.flagKey);if(!r||!r.enabled)return false;n.push(r.key);let a=R(r,e,t,n)&&P(r,t)&&te(r,t)===i.variationKey;if(n.pop(),!a)return false}return true}function y(s,e,t){return s.enabled?R(s,e,t,[s.key])?P(s,t)?s.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:ee(s.key,t.distinctId)<s.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function ze(s,e){return y(s,[],e)}function se(s,e){let t={};for(let n of s)t[n.key]=y(n,s,e).enabled;return t}function v(s,e,t){let n=s.variations??[],i=n[0];if(!i)return null;if(!s.enabled||!R(s,e,t,[s.key])||!P(s,t))return i;let r=te(s,t);return n.find(a=>a.key===r)??i}function Qe(s,e){return v(s,[],e)}function Ge(s,e,t){let n=s.find(i=>i.key===e);return n?v(n,s,t)?.value??null:null}function ne(s){return s.some(e=>e.targeting.some(t=>t.op==="in_cohort"||t.op==="not_in_cohort"))}var I=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let t=this.fetch;if(!t)throw new d("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!a.ok)throw new d(`flags request failed with status ${a.status}`,a.status);let d$1=JSON.parse(await a.text());return {flags:d$1.flags??{},variants:d$1.variants??{}}}finally{r!==void 0&&clearTimeout(r);}}async snapshot(){let e=this.fetch;if(!e)throw new d("no fetch implementation available in this runtime");let t=`${this.host}/v1/flags/snapshot`,n=f$1(),i=n?setTimeout(()=>n.abort(),this.requestTimeoutMs):void 0;try{let r=await e(t,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:n?.signal});if(!r.ok)throw new d(`flag snapshot request failed with status ${r.status}`,r.status);let a=JSON.parse(await r.text()),d$1={flags:a.flags??[],generatedAt:a.generatedAt};return typeof a.socketUrl=="string"&&a.socketUrl!==""&&(d$1.socketUrl=a.socketUrl),d$1}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){let t=this.fetch;if(!t)throw new d("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let a=await t(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!a.ok)throw new d(`memberships request failed with status ${a.status}`,a.status);return JSON.parse(await a.text()).cohorts??[]}finally{r!==void 0&&clearTimeout(r);}}};function b(s){if(typeof s!="string")return;let e=Array.from(s).length;return e>=1&&e<=200?s:void 0}function F(s,e){return `pdx.${s}.${e}`}var ie="consent";function be(s){if(typeof s!="string")return null;try{let e=JSON.parse(s);if(e===null||typeof e!="object"||Array.isArray(e))return null;let t=e.identityLink;return typeof t=="boolean"?{identityLink:t}:null}catch{return null}}function ke(s,e){return be(s.getItem(F(e,ie)))}function Se(s,e,t){let n=F(e,ie);if(typeof t.identityLink!="boolean"){s.removeItem(n);return}s.setItem(n,JSON.stringify({identityLink:t.identityLink}));}function tt(s,e,t,n){let i=F(t,"anonymous_id"),r=b(e.getItem(i))??b(s.getItem(i));return e.setItem(i,n),s.setItem(i,n),r!==void 0&&r!==n?r:void 0}var w=class{constructor(e,t,n,i){this.storage=e;this.shared=t;this.ids=n;this.namespace=i;a(this,"anonymousId");a(this,"distinctId");a(this,"identified");this.refresh();}refresh(){let e=b(this.shared.getItem(this.key("anonymous_id"))),t=b(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,t!==e&&this.storage.setItem(this.key("anonymous_id"),e)):t?(this.anonymousId=t,this.shared.setItem(this.key("anonymous_id"),t)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let n=b(this.storage.getItem(this.key("distinct_id")));n?(this.distinctId=n,this.identified=true):(this.distinctId=this.anonymousId,this.identified=false);}getAnonymousId(){return this.anonymousId}getDistinctId(){return this.distinctId}isIdentified(){return this.identified}snapshot(){return {anonymousId:this.anonymousId,distinctId:this.distinctId,identified:this.identified}}consent(){return ke(this.shared,this.namespace)}setConsent(e){Se(this.shared,this.namespace,e);}identify(e){let t=!this.identified||this.distinctId!==e,n=this.storage.getItem(this.key("linked_anonymous_id")),i=t||n!==this.anonymousId;return this.distinctId=e,this.identified=true,t&&this.storage.setItem(this.key("distinct_id"),e),!i||this.consent()?.identityLink===false?{changed:t}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:t})}reset(){this.anonymousId=this.ids.uuid(),this.distinctId=this.anonymousId,this.identified=false,this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.removeItem(this.key("distinct_id")),this.storage.removeItem(this.key("linked_anonymous_id"));}key(e){return F(this.namespace,e)}};var E=class{constructor(e$1){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=e(e$1.fetch),this.host=h(e$1.host),this.projectKey=e$1.projectKey,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4;}async inbox(e){let t=this.requireFetch(),n=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(t,n,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new d(`inbox request failed with status ${i.status}`,i.status);return JSON.parse(await i.text()).messages??[]}async markRead(e,t){let n=this.requireFetch(),i=`${this.host}/v1/messages/read`,r=await this.request(n,i,{body:JSON.stringify({distinct_id:t,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!r.ok)throw new d(`mark-read request failed with status ${r.status}`,r.status)}requireFetch(){if(!this.fetch)throw new d("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,t,n){let i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t,{...n,signal:i?.signal})}finally{r!==void 0&&clearTimeout(r);}}};var c={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageview:"$pageview",screen:"$screen",set:"$set"},xe=[{emittedBy:"web",meaning:"A click anywhere on the page, with the element that was clicked. The web SDK sends it by default; autocapture: false or autocaptureOptions.clicks: false turns it off.",name:c.autocapture,properties:["$event_type","$el_description","$el_description_source","$el_action","$el_tag","$el_text","$el_id","$el_classes","$el_href","$current_url","$pathname","$host","$title","$referrer"]},{emittedBy:"web",meaning:"A page shown, including every client-side navigation the History API makes: one per distinct path and query.",name:c.pageview,properties:["$current_url","$pathname","$host","$title","$referrer"]},{emittedBy:"flutter",meaning:"A named route pushed or replaced in a Flutter app, the mobile counterpart of $pageview.",name:c.screen,properties:["screen"]},{emittedBy:"every",meaning:"A person becomes known by a distinct id. The anonymous trail before it is joined to them, and any traits ride along under $set.",name:c.identify,properties:["$anon_distinct_id","$set"]},{emittedBy:"every",meaning:"A second id for the same person, so events sent under either resolve to one profile.",name:c.createAlias,properties:["alias"]},{emittedBy:"every",meaning:"The person is placed in a group such as a company or a team; group properties ride along under $set.",name:c.group,properties:["$group_type","$group_key","$set"]},{emittedBy:"every",meaning:"Person properties written without an identify: $set overwrites, $set_once fills only what is still empty.",name:c.set,properties:["$set","$set_once"]},{emittedBy:"every",meaning:"A flag was evaluated for this person, sent once per distinct answer. Experiments attribute exposure from it.",name:c.featureFlagCalled,properties:["$feature_flag","$feature_flag_response"]}],lt=s=>s.startsWith("$"),ct=s=>xe.find(e=>e.name===s);function re(s){return s>=400&&s<500&&s!==429}var _=class{constructor(e$1={}){a(this,"fetch");a(this,"maxRetries");a(this,"requestTimeoutMs");a(this,"baseDelayMs");a(this,"maxDelayMs");a(this,"sleep");a(this,"random");this.fetch=e(e$1.fetch),this.maxRetries=e$1.maxRetries??3,this.requestTimeoutMs=e$1.requestTimeoutMs??1e4,this.baseDelayMs=e$1.baseDelayMs??500,this.maxDelayMs=e$1.maxDelayMs??3e4,this.sleep=e$1.sleep??g$1,this.random=e$1.random??Math.random;}async send(e){let t=this.fetch;if(!t)throw new d("no fetch implementation available in this runtime");let n=JSON.stringify(e.body),i;for(let r=0;r<=this.maxRetries;r+=1){try{let a=await this.attempt(t,e,n);if(a.ok)return;if(re(a.status))throw new d(`ingest rejected batch with status ${a.status}`,a.status);i=new d(`ingest transient status ${a.status}`,a.status);}catch(a){if(a instanceof d&&a.status!==void 0&&re(a.status))throw a;i=a;}r<this.maxRetries&&await this.sleep(this.backoff(r));}throw new d("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,t,n){let i=f$1(),r=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(t.url,{body:n,headers:{authorization:`Bearer ${t.projectKey}`,"content-type":"application/json"},method:"POST",signal:i?.signal})}finally{r!==void 0&&clearTimeout(r);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};function oe(s,e,t){B(s.eventName),U(s.distinctId);let n={distinct_id:s.distinctId,event_id:s.eventId??t.uuid(),event_name:s.eventName,properties:s.properties??{},schema_version:1,timestamp:S(s.timestamp??e.now())};return s.context&&(n.context=s.context),s.sessionId&&(n.session_id=s.sessionId),n}var Ie="/socket.io/?EIO=4&transport=websocket",we=250,T=class{constructor(e){this.options=e;a(this,"socket",null);a(this,"heartbeat",null);a(this,"pending",null);a(this,"lastKey","");a(this,"ready",false);a(this,"closed",false);a(this,"heartbeatWindow",45e3);a(this,"factory");a(this,"setTimer");a(this,"clearTimer");this.factory=e.socketFactory??Fe,this.setTimer=e.setTimer??((t,n)=>setTimeout(t,n)),this.clearTimer=e.clearTimer??(t=>clearTimeout(t));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Ie}`,t;try{t=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=t,t.onmessage=n=>this.receive(String(n.data)),t.onerror=()=>t.close(),t.onclose=()=>this.fell();}close(){this.closed=true,this.stopHeartbeat(),this.pending!==null&&this.clearTimer(this.pending),this.pending=null;let e=this.socket;this.socket=null,e?.close();}receive(e){let t=c$1(e);if(t.kind==="open"){this.armHeartbeat(t.pingInterval+t.pingTimeout),this.socket?.send(a$2({projectKey:this.options.projectKey}));return}if(t.kind==="ping"){this.armHeartbeat(),this.socket?.send(b$2());return}if(t.kind==="connectError"||t.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(t.kind==="event"){if(t.name==="ready"){this.ready=true;return}if(t.name==="flagChange"){let n=t.payload?.key;this.lastKey=typeof n=="string"?n:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},we));}}}fell(){this.stopHeartbeat();let e=this.ready;this.socket=null,this.ready=false,this.closed||this.options.onClosed(e);}armHeartbeat(e){e!==void 0&&(this.heartbeatWindow=e),this.stopHeartbeat(),this.heartbeat=this.setTimer(()=>this.socket?.close(),this.heartbeatWindow);}stopHeartbeat(){this.heartbeat!==null&&this.clearTimer(this.heartbeat),this.heartbeat=null;}};function Fe(s){let e=globalThis.WebSocket;if(!e)throw new d("no WebSocket");return new e(s)}var C=class{constructor(e,t){this.maxSize=e;this.onOverflow=t;a(this,"events",[]);}get size(){return this.events.length}enqueue(e){this.events.push(e),this.enforceCap();}restore(e){this.events.push(...e),this.enforceCap();}requeue(e){this.events.unshift(...e),this.enforceCap();}drain(e){let t=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,t)}snapshot(){return [...this.events]}enforceCap(){if(this.events.length<=this.maxSize)return;let e=this.events.splice(0,this.events.length-this.maxSize);this.onOverflow?.({dropped:e});}};var Ee={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function ae(s){return `pdx.${s}.session`}function wt(s,e,t,n){let i={id:t.id,lastActivityAt:n,startedAt:t.startedAt};s.setItem(ae(e),JSON.stringify(i));}var A=class{constructor(e,t,n,i,r=Ee){this.storage=e;this.ids=t;this.clock=n;this.namespace=i;this.options=r;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),t=this.live(this.read(),e);if(t===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-t.lastActivityAt<=this.options.throttleMs)return t;let n=this.live(this.read(),e),i=n!==void 0&&n.id!==t.id?n:t;return this.write({...i,lastActivityAt:e})}live(e,t){if(e!==void 0&&!(t-e.lastActivityAt>this.options.idleMs||t-e.startedAt>this.options.maxMs))return e}write(e){return this.storage.setItem(this.key(),JSON.stringify(e)),e}read(){let e=this.storage.getItem(this.key());if(e)try{let t=JSON.parse(e);return typeof t.id=="string"&&typeof t.startedAt=="number"&&typeof t.lastActivityAt=="number"?{id:t.id,lastActivityAt:t.lastActivityAt,startedAt:t.startedAt}:void 0}catch{return}}key(){return ae(this.namespace)}};var _e="queue",Te=1e3,le=3e4,M=s=>{let e={};return s.avatar!==void 0&&(e.$avatar=s.avatar),s.email!==void 0&&(e.$email=s.email),s.name!==void 0&&(e.$name=s.name),s.phone!==void 0&&(e.$phone=s.phone),e},q=class{constructor(e){a(this,"config");a(this,"identity");a(this,"session");a(this,"queue");a(this,"transport");a(this,"flagsClient");a(this,"messagesClient");a(this,"context");a(this,"flushTimer");a(this,"flushing",false);a(this,"cachedFlags");a(this,"cachedSnapshot");a(this,"membershipCache");a(this,"stream");a(this,"shutDown",false);a(this,"exposures",new Set);this.config=G(e),this.identity=new w(this.config.storage,this.config.sharedStorage,this.config.ids,this.config.namespace),this.config.consent!==void 0&&this.identity.setConsent(this.config.consent),this.session=this.config.sessionTracking?new A(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new C(this.config.maxQueueSize,({dropped:t})=>{this.config.onError(new a$1("queue_overflow",`event queue overflow: dropped ${t.length} oldest event(s)`));}),this.transport=this.config.transport??new _({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new I({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new E({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.context={sdk:this.config.sdkName,sdk_version:this.config.sdkVersion},this.config.os&&(this.context.os=this.config.os),this.config.locale&&(this.context.locale=this.config.locale),this.restoreQueue(),this.startTimer();}get distinctId(){return this.identity.getDistinctId()}get anonymousId(){return this.identity.getAnonymousId()}get isIdentified(){return this.identity.isIdentified()}get sessionId(){return this.session?.current()}get sessionStartedAt(){return this.session?.startedAt()}capture(e,t={}){try{this.identity.refresh();let n={...this.config.defaultProperties(),...t.element===void 0?{}:this.config.describeElement?.(t.element)??{},...t.properties??{}},i=oe({context:this.context,distinctId:t.distinctId??this.identity.getDistinctId(),eventName:e,properties:n,sessionId:t.sessionId??this.session?.current(),timestamp:t.timestamp},this.config.clock,this.config.ids);this.enqueue(i);}catch(n){this.config.onError(n);}}identify(e,t={}){this.identity.refresh();let n=this.identity.identify(e),i={};n.anonymousToLink!==void 0&&(i.$anon_distinct_id=n.anonymousToLink);let r={...M(t.traits??{}),...t.set??{}};Object.keys(r).length>0&&(i.$set=r),this.capture(c.identify,{properties:i});}link(e,t,n){let i={$anon_distinct_id:t},r=M(n??{});Object.keys(r).length>0&&(i.$set=r),this.capture(c.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e);}consent(){return this.identity.consent()}alias(e){this.capture(c.createAlias,{properties:{alias:e}});}group(e,t,n){let i={$group_key:t,$group_type:e};n&&(i.$set=n),this.capture(c.group,{properties:i});}setPersonProperties(e,t){let n={};e&&(n.$set=e),t&&(n.$set_once=t),this.capture(c.set,{properties:n});}setPersonTraits(e){let t=M(e);Object.keys(t).length!==0&&this.capture(c.set,{properties:{$set:t}});}async getAllFlags(){let e=this.identity.getDistinctId(),t=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:t.flags,variants:t.variants??{}},t.flags}async isFeatureEnabled(e){let n=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(n)),n}async getVariant(e){let t=await this.getAllFlags(),n=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,n?.key??String(t[e]??false)),n}async getVariantLocal(e,t={}){let n=await this.flagSnapshot(),i=n.flags.find(ce=>ce.key===e),r=await this.localContext(t,n.flags),a=i?v(i,n.flags,r):null,d=i?y(i,n.flags,r).enabled:false;return this.recordExposure(e,a?.key??String(d)),a?{key:a.key,value:a.value}:null}recordExposure(e,t){let n=`${this.identity.getDistinctId()} ${e} ${t}`;this.exposures.has(n)||(this.exposures.add(n),this.capture(c.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:t}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let t=await this.flagSnapshot();return se(t.flags,await this.localContext(e,t.flags))}async isFeatureEnabledLocal(e,t={}){let n=await this.flagSnapshot(),i=n.flags.find(d=>d.key===e),r=await this.localContext(t,n.flags),a=i?y(i,n.flags,r).enabled:false;return this.recordExposure(e,(i?v(i,n.flags,r)?.key:void 0)??String(a)),a}async localContext(e,t){let n=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&ne(t)){let r=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===n&&r-this.membershipCache.fetchedAt<le?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(n),this.membershipCache={cohorts:i,distinctId:n,fetchedAt:r});}return {attributes:e.attributes,cohorts:i,distinctId:n,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<le)return this.cachedSnapshot.snapshot;let t=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:t},this.maybeStream(t),t}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let t=new T({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(n=>this.config.onError(n));},onClosed:n=>{this.stream=void 0,n&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=t,t.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(Te);try{await this.transport.send({body:{events:e,sent_at:S(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(t){this.queue.requeue(e),this.persistQueue(),this.config.onError(t);}finally{this.flushing=false;}}reset(){this.session?.reset(),this.identity.reset(),this.cachedFlags=void 0,this.cachedSnapshot=void 0,this.membershipCache=void 0;}async shutdown(){this.shutDown=true,this.stopTimer(),this.stream?.close(),this.stream=void 0,await this.flush();}enqueue(e){this.queue.enqueue(e),this.persistQueue(),this.queue.size>=this.config.flushAt&&this.flush();}persistQueue(){try{this.config.storage.setItem(this.persistKey(),JSON.stringify(this.queue.snapshot()));}catch(e){this.config.onError(e);}}restoreQueue(){try{let e=this.config.storage.getItem(this.persistKey());if(!e)return;let t=JSON.parse(e);Array.isArray(t)&&this.queue.restore(t);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),t=e;typeof t.unref=="function"&&t.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${_e}`}};function Lt(s){return new q(s)}export{g as a,Ce as b,V as c,me as d,j as e,J as f,z as g,ye as h,Z as i,ee as j,ze as k,se as l,Qe as m,Ge as n,I as o,be as p,tt as q,E as r,wt as s,c as t,xe as u,lt as v,ct as w,_ as x,q as y,Lt as z};//# sourceMappingURL=chunk-D6PMLUYA.js.map
|
|
2
|
-
//# sourceMappingURL=chunk-D6PMLUYA.js.map
|