@prodantix/sdk 0.7.0-beta.438 → 0.7.0-beta.441
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-C6Yz_Tdf.d.ts} +41 -3
- package/dist/{config-CpfUyEw8.d.cts → config-Cs3L7V_P.d.cts} +41 -3
- 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.cjs
CHANGED
|
@@ -1,2 +1,37 @@
|
|
|
1
|
-
'use strict';var Ct=Object.defineProperty;var At=(t,e,n)=>e in t?Ct(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var a=(t,e,n)=>At(t,typeof e!="symbol"?e+"":e,n);var m=class extends Error{constructor(n,r,i){super(r,i);a(this,"code");this.code=n,this.name="ProdantixError";}},C=class extends m{constructor(e){super("config",e),this.name="ConfigError";}},S=class extends m{constructor(n,r){super("validation",r);a(this,"field");this.field=n,this.name="ValidationError";}},d=class extends m{constructor(n,r,i){super("transport",n,i);a(this,"status");this.status=r,this.name="TransportError";}};function y(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function v(){let t=globalThis.AbortController;return t?new t:void 0}var Ae=t=>new Promise(e=>{setTimeout(e,t);});function g(t){return t.replace(/\/+$/,"")}var T=class{constructor(){a(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}};function _e(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch{return new T}return new T}var F={now:()=>new Date};function P(t){return t.toISOString()}function _t(){return globalThis.crypto}function Nt(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].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 oe(){let t=_t();if(t?.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t?.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return Nt(e)}var Ne={uuid:oe};var Lt=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Ot=/^(?:\$|[a-z])[a-z0-9_.]*$/;function R(t){let e=0;for(let n of t)e+=1;return e}function Le(t){return Lt.test(t)}function Ft(t){return Ot.test(t)}function Oe(t){let e=R(t);if(e<1||e>200)throw new S("distinct_id","distinct_id must be between 1 and 200 characters")}function Fe(t){let e=R(t);if(e<1||e>200)throw new S("event_name","event_name must be between 1 and 200 characters");if(!Ft(t))throw new S("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Pe="prodantix-js",Re="0.7.0";var Pt=t=>{};function $e(t){if(!t.apiKey||!Le(t.apiKey))throw new C("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new C("host is required (the ingest base URL)");let e=g(t.host),n=t.defaultProperties,r=t.storage??new T;return {apiKey:t.apiKey,autocapture:t.autocapture??false,clock:t.clock??F,consent:t.consent,defaultProperties:typeof n=="function"?n:()=>n??{},describeElement:t.describeElement,flagsHost:t.flagsHost?g(t.flagsHost):e,flushAt:t.flushAt??20,flushIntervalMs:t.flushIntervalMs??1e4,host:e,ids:t.ids??Ne,locale:t.locale,maxQueueSize:t.maxQueueSize??1e3,maxRetries:t.maxRetries??3,namespace:$(t.apiKey),onError:t.onError??Pt,os:t.os,requestTimeoutMs:t.requestTimeoutMs??1e4,sdkName:t.sdkName??Pe,sdkVersion:t.sdkVersion??Re,sessionTracking:t.sessionTracking??false,sharedStorage:t.sharedStorage??r,socketFactory:t.socketFactory,storage:r,streamFlags:t.streamFlags??false,transport:t.transport}}function $(t){return t.slice(0,16)}function Me(t,e,n){Fe(t.eventName),Oe(t.distinctId);let r={distinct_id:t.distinctId,event_id:t.eventId??n.uuid(),event_name:t.eventName,properties:t.properties??{},schema_version:1,timestamp:P(t.timestamp??e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var x=Symbol("absent");function Rt(t,e){if(t==="distinct_id")return e.distinctId;let n=e.properties??{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=e.attributes??{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:x}function E(t){return t===x?"undefined":String(t)}function De(t){return t===x?Number.NaN:Number(t)}function qe(t){return t!==x&&t!==null&&t!==""}function Ke(t,e){if(!Array.isArray(e))return false;let n=E(t);return e.map(r=>String(r)).includes(n)}function Ve(t,e){let n=Rt(t.attribute,e),r=t.value;switch(t.op){case "is_set":return qe(n);case "is_not_set":return !qe(n);case "eq":return E(n)===E(r===void 0?x:r);case "neq":return E(n)!==E(r===void 0?x:r);case "contains":return E(n).includes(E(r===void 0?x:r));case "in":return Ke(n,r);case "not_in":return Array.isArray(r)?!Ke(n,r):false;case "gt":return M(n,r,(i,s)=>i>s);case "gte":return M(n,r,(i,s)=>i>=s);case "lt":return M(n,r,(i,s)=>i<s);case "lte":return M(n,r,(i,s)=>i<=s);case "in_cohort":return typeof r=="string"&&r!==""&&(e.cohorts??[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!(e.cohorts??[]).includes(r);default:return false}}function M(t,e,n){let r=De(t),i=e===void 0?Number.NaN:De(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function je(t,e){let n=`${t}:${e}`,r=2166136261;for(let i=0;i<n.length;i++)r^=n.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function ae(t,e){return t.targeting.length===0||t.targeting.every(n=>Ve(n,e))}function He(t,e){let n=je(t.key,e.distinctId),r=t.variations??[];if(r.length===0)return t.rolloutPercentage>=100||n<t.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,n<i)return r[s].key;return r[0].key}function ce(t,e,n,r){for(let i of t.prerequisites??[]){if(r.includes(i.flagKey))return false;let s=e.find(c=>c.key===i.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let o=ce(s,e,n,r)&&ae(s,n)&&He(s,n)===i.variationKey;if(r.pop(),!o)return false}return true}function D(t,e,n){return t.enabled?ce(t,e,n,[t.key])?ae(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:je(t.key,n.distinctId)<t.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function Ue(t,e){let n={};for(let r of t)n[r.key]=D(r,t,e).enabled;return n}function le(t,e,n){let r=t.variations??[],i=r[0];if(!i)return null;if(!t.enabled||!ce(t,e,n,[t.key])||!ae(t,n))return i;let s=He(t,n);return r.find(o=>o.key===s)??i}function Be(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function Ge(t){return `40${JSON.stringify(t)}`}function Je(){return "3"}function ze(t){let e=t.charAt(0),n=t.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let o=ue(n);return {kind:"open",pingInterval:typeof o?.pingInterval=="number"?o.pingInterval:25e3,pingTimeout:typeof o?.pingTimeout=="number"?o.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=n.charAt(0),i=n.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let o=ue(i);return {kind:"connectError",message:typeof o?.message=="string"?o.message:"refused"}}if(r!=="2")return {kind:"other"};let s=ue(i);return !Array.isArray(s)||typeof s[0]!="string"?{kind:"other"}:{kind:"event",name:s[0],payload:s[1]}}function ue(t){try{return JSON.parse(t)}catch{return null}}var $t="/socket.io/?EIO=4&transport=websocket",Mt=250,q=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??Dt,this.setTimer=e.setTimer??((n,r)=>setTimeout(n,r)),this.clearTimer=e.clearTimer??(n=>clearTimeout(n));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${$t}`,n;try{n=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=n,n.onmessage=r=>this.receive(String(r.data)),n.onerror=()=>n.close(),n.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 n=ze(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),this.socket?.send(Ge({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),this.socket?.send(Je());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let r=n.payload?.key;this.lastKey=typeof r=="string"?r:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Mt));}}}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 Dt(t){let e=globalThis.WebSocket;if(!e)throw new d("no WebSocket");return new e(t)}var K=class{constructor(e){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let n=this.fetch;if(!n)throw new d("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=v(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new d(`flags request failed with status ${o.status}`,o.status);let c=JSON.parse(await o.text());return {flags:c.flags??{},variants:c.variants??{}}}finally{s!==void 0&&clearTimeout(s);}}async snapshot(){let e=this.fetch;if(!e)throw new d("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=v(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!s.ok)throw new d(`flag snapshot request failed with status ${s.status}`,s.status);let o=JSON.parse(await s.text()),c={flags:o.flags??[],generatedAt:o.generatedAt};return typeof o.socketUrl=="string"&&o.socketUrl!==""&&(c.socketUrl=o.socketUrl),c}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){let n=this.fetch;if(!n)throw new d("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=v(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new d(`memberships request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).cohorts??[]}finally{s!==void 0&&clearTimeout(s);}}};function A(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function j(t,e){return `pdx.${t}.${e}`}var We="consent";function qt(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e.identityLink;return typeof n=="boolean"?{identityLink:n}:null}catch{return null}}function Kt(t,e){return qt(t.getItem(j(e,We)))}function Vt(t,e,n){let r=j(e,We);if(typeof n.identityLink!="boolean"){t.removeItem(r);return}t.setItem(r,JSON.stringify({identityLink:n.identityLink}));}function Qe(t,e,n,r){let i=j(n,"anonymous_id"),s=A(e.getItem(i))??A(t.getItem(i));return e.setItem(i,r),t.setItem(i,r),s!==void 0&&s!==r?s:void 0}var V=class{constructor(e,n,r,i){this.storage=e;this.shared=n;this.ids=r;this.namespace=i;a(this,"anonymousId");a(this,"distinctId");a(this,"identified");this.refresh();}refresh(){let e=A(this.shared.getItem(this.key("anonymous_id"))),n=A(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,n!==e&&this.storage.setItem(this.key("anonymous_id"),e)):n?(this.anonymousId=n,this.shared.setItem(this.key("anonymous_id"),n)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=A(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,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 Kt(this.shared,this.namespace)}setConsent(e){Vt(this.shared,this.namespace,e);}identify(e){let n=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=n||r!==this.anonymousId;return this.distinctId=e,this.identified=true,n&&this.storage.setItem(this.key("distinct_id"),e),!i||this.consent()?.identityLink===false?{changed:n}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:n})}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 j(this.namespace,e)}};var H=class{constructor(e){a(this,"fetch");a(this,"host");a(this,"projectKey");a(this,"requestTimeoutMs");this.fetch=y(e.fetch),this.host=g(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async inbox(e){let n=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(n,r,{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,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,s=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!s.ok)throw new d(`mark-read request failed with status ${s.status}`,s.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,n,r){let i=v(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i?.signal})}finally{s!==void 0&&clearTimeout(s);}}};var U=class{constructor(e,n){this.maxSize=e;this.onOverflow=n;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 n=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,n)}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 jt={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function Xe(t){return `pdx.${t}.session`}function Ye(t,e,n,r){let i={id:n.id,lastActivityAt:r,startedAt:n.startedAt};t.setItem(Xe(e),JSON.stringify(i));}var B=class{constructor(e,n,r,i,s=jt){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=s;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),n=this.live(this.read(),e);if(n===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-n.lastActivityAt<=this.options.throttleMs)return n;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==n.id?r:n;return this.write({...i,lastActivityAt:e})}live(e,n){if(e!==void 0&&!(n-e.lastActivityAt>this.options.idleMs||n-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 n=JSON.parse(e);return typeof n.id=="string"&&typeof n.startedAt=="number"&&typeof n.lastActivityAt=="number"?{id:n.id,lastActivityAt:n.lastActivityAt,startedAt:n.startedAt}:void 0}catch{return}}key(){return Xe(this.namespace)}};var p={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageview:"$pageview",set:"$set"};function Ze(t){return t>=400&&t<500&&t!==429}var I=class{constructor(e={}){a(this,"fetch");a(this,"maxRetries");a(this,"requestTimeoutMs");a(this,"baseDelayMs");a(this,"maxDelayMs");a(this,"sleep");a(this,"random");this.fetch=y(e.fetch),this.maxRetries=e.maxRetries??3,this.requestTimeoutMs=e.requestTimeoutMs??1e4,this.baseDelayMs=e.baseDelayMs??500,this.maxDelayMs=e.maxDelayMs??3e4,this.sleep=e.sleep??Ae,this.random=e.random??Math.random;}async send(e){let n=this.fetch;if(!n)throw new d("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let s=0;s<=this.maxRetries;s+=1){try{let o=await this.attempt(n,e,r);if(o.ok)return;if(Ze(o.status))throw new d(`ingest rejected batch with status ${o.status}`,o.status);i=new d(`ingest transient status ${o.status}`,o.status);}catch(o){if(o instanceof d&&o.status!==void 0&&Ze(o.status))throw o;i=o;}s<this.maxRetries&&await this.sleep(this.backoff(s));}throw new d("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,n,r){let i=v(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n.url,{body:r,headers:{authorization:`Bearer ${n.projectKey}`,"content-type":"application/json"},method:"POST",signal:i?.signal})}finally{s!==void 0&&clearTimeout(s);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var Ht="queue",Ut=1e3,et=3e4,de=t=>{let e={};return t.avatar!==void 0&&(e.$avatar=t.avatar),t.email!==void 0&&(e.$email=t.email),t.name!==void 0&&(e.$name=t.name),t.phone!==void 0&&(e.$phone=t.phone),e},G=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=$e(e),this.identity=new V(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 B(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new U(this.config.maxQueueSize,({dropped:n})=>{this.config.onError(new m("queue_overflow",`event queue overflow: dropped ${n.length} oldest event(s)`));}),this.transport=this.config.transport??new I({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new K({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new H({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,n={}){try{this.identity.refresh();let r={...this.config.defaultProperties(),...n.element===void 0?{}:this.config.describeElement?.(n.element)??{},...n.properties??{}},i=Me({context:this.context,distinctId:n.distinctId??this.identity.getDistinctId(),eventName:e,properties:r,sessionId:n.sessionId??this.session?.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(i);}catch(r){this.config.onError(r);}}identify(e,n={}){this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let s={...de(n.traits??{}),...n.set??{}};Object.keys(s).length>0&&(i.$set=s),this.capture(p.identify,{properties:i});}link(e,n,r){let i={$anon_distinct_id:n},s=de(r??{});Object.keys(s).length>0&&(i.$set=s),this.capture(p.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e);}consent(){return this.identity.consent()}alias(e){this.capture(p.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(p.group,{properties:i});}setPersonProperties(e,n){let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(p.set,{properties:r});}setPersonTraits(e){let n=de(e);Object.keys(n).length!==0&&this.capture(p.set,{properties:{$set:n}});}async getAllFlags(){let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:n.variants??{}},n.flags}async isFeatureEnabled(e){let r=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(r)),r}async getVariant(e){let n=await this.getAllFlags(),r=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,r?.key??String(n[e]??false)),r}async getVariantLocal(e,n={}){let r=await this.flagSnapshot(),i=r.flags.find(f=>f.key===e),s=await this.localContext(n,r.flags),o=i?le(i,r.flags,s):null,c=i?D(i,r.flags,s).enabled:false;return this.recordExposure(e,o?.key??String(c)),o?{key:o.key,value:o.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(p.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:n}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let n=await this.flagSnapshot();return Ue(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){let r=await this.flagSnapshot(),i=r.flags.find(c=>c.key===e),s=await this.localContext(n,r.flags),o=i?D(i,r.flags,s).enabled:false;return this.recordExposure(e,(i?le(i,r.flags,s)?.key:void 0)??String(o)),o}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&Be(n)){let s=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&s-this.membershipCache.fetchedAt<et?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:s});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<et)return this.cachedSnapshot.snapshot;let n=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:n},this.maybeStream(n),n}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let n=new q({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=n,n.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(Ut);try{await this.transport.send({body:{events:e,sent_at:P(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(n){this.queue.requeue(e),this.persistQueue(),this.config.onError(n);}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 n=JSON.parse(e);Array.isArray(n)&&this.queue.restore(n);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),n=e;typeof n.unref=="function"&&n.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${Ht}`}};var nt="data-prodantix",rt="data-prodantix-action",it="data-prodantix-ignore",w=300,pe="data-pdx-no-capture",fe="pdx-no-capture",Bt=new Set(["a","button","input","label","option","select","summary","textarea"]),Gt=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function Jt(t){return Bt.has(t.tagName.toLowerCase())||Gt.has((t.getAttribute("role")??"").trim().toLowerCase())}function he(t){for(let e=t;e!==null;e=e.parentElement)if(Jt(e))return e;return t}function me(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(it)!==null)return true;return false}function ge(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(pe)!==null||typeof e.className=="string"&&e.className.split(/\s+/).includes(fe))return true;return false}function J(t){let e=new Set;return n=>{e.has(n.message)||(e.add(n.message),t(n));}}function tt(t,e,n){let r=t.getAttribute(e);if(r===null)return;let i=r.trim();if(i!==""){if(i.length>w){n(new m("validation",`${e} on a <${t.tagName.toLowerCase()}> is ${i.length} characters, over the ${w}-character limit, so it was ignored: "${i.slice(0,40)}\u2026"`));return}return i}}function ye(t,e){let n={},r=tt(t,nt,e);r!==void 0&&(n.$el_description=r,n.$el_description_source="annotation");let i=tt(t,rt,e);return i!==void 0&&(n.$el_action=i),n}function st(t,e){return !zt(t)||me(t)||ge(t)?{}:ye(he(t),e)}function zt(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"&&typeof t.getAttribute=="function"}var Wt=new Set(["input","select","textarea"]),Qt=new Set(["email","password","tel"]);function W(){return globalThis.location}function ot(){return globalThis.document}function Xt(){return globalThis.window??globalThis}function Yt(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"}function z(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 at(){let t=W(),e=ot(),n={};if(t){let r=z(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?z(e.referrer):void 0;r&&(n.$referrer=r);}return n}function Zt(t){return typeof t.className=="string"?t.className:""}function en(t){return Wt.has(t.tagName.toLowerCase())||Qt.has((t.getAttribute("type")??"").toLowerCase())}function tn(t,e,n){let r={$el_tag:t.tagName.toLowerCase(),$event_type:"click"};if(e)return r;let i=n?t.textContent?.trim():void 0;i&&(r.$el_text=i.slice(0,255)),t.id&&(r.$el_id=t.id);let s=Zt(t);s&&(r.$el_classes=s);let o=t.getAttribute("href"),c=o?z(o,W()?.href):void 0;return c&&(r.$el_href=c),r}function ve(t){return (t??"").replace(/\s+/g," ").trim()}function _(t,e){return {$el_description:t,$el_description_source:e}}function nn(t,e,n){if(!e&&n){let o=ve(t.getAttribute("aria-label"));if(o!==""&&o.length<=w)return _(o,"aria_label");let c=ve(t.textContent);if(c!==""&&c.length<=w)return _(c,"text")}let r=e?null:t.getAttribute("href"),i=r?z(r,W()?.href):void 0;if(i)return _(i,"href");let s=ve(t.getAttribute("role")).toLowerCase();return s===""?_(t.tagName.toLowerCase(),"tag"):_(s,"role")}function rn(t,e){let n=new Set,r=(l,u)=>{if(n.has(l))return false;try{return u()}catch(h){return n.add(l),e(new m("config",`autocapture maskSelectors entry "${l}" is not a valid selector`,{cause:h})),false}},i=(l,u)=>l.matches?r(u,()=>l.matches?.(u)===!0):false,s=l=>{let u=l.querySelector?.bind(l);return u?u(`[${pe}], .${fe}`)!==null||t.some(h=>r(h,()=>u(h)!==null)):false},o=l=>{for(let u=l;u;u=u.parentElement){let h=u;if(t.some(k=>i(h,k)))return true}return false},c=l=>{for(let u=l;u;u=u.parentElement)if(en(u))return true;return false},f=l=>ge(l)||o(l);return {holdsMasked:s,isMasked:l=>f(l)||c(l),isOptedOut:f}}function sn(t){let e=globalThis.history,n=Xt(),r="",i=()=>{let c=W(),f=c?`${c.pathname}${c.search}`:"";f!==r&&(r=f,t.capture(p.pageview,{properties:at()}));};if(i(),!e||!n)return ()=>{};let s=e.pushState.bind(e),o=e.replaceState.bind(e);return e.pushState=(...c)=>{s(...c),i();},e.replaceState=(...c)=>{o(...c),i();},n.addEventListener("popstate",i),()=>{e.pushState=s,e.replaceState=o,n.removeEventListener("popstate",i);}}function on(t,e){let n=ot();if(!n)return ()=>{};let r=e.onError??(()=>{}),i=rn(e.maskSelectors??[],r),s=J(r),o=e.captureElementText??false,c=f=>{let l=f.target;if(!Yt(l)||me(l))return;let u=he(l),h=i.isMasked(l)||i.holdsMasked(u),k=i.isOptedOut(l)?{}:ye(u,s),se=k.$el_description===void 0?nn(u,h,o):{};t.capture(p.autocapture,{properties:{...at(),...tn(u,h,o),...se,...k}});};return n.addEventListener("click",c,true),()=>n.removeEventListener("click",c,true)}function ct(t,e={}){let n=[];return (e.pageviews??true)&&n.push(sn(t)),(e.clicks??true)&&n.push(on(t,e)),()=>{for(let r of n)r();}}function an(){return globalThis.document?.visibilityState==="hidden"}function cn(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 i=new n([r],{type:"application/json"});return e.sendBeacon(t.url,i)}catch{return false}}var Q=class{constructor(e={}){a(this,"fetchTransport");this.fetchTransport=new I(e);}async send(e){an()&&cn(e)||await this.fetchTransport.send(e);}};var ln=/^\d{1,3}(\.\d{1,3}){3}$/,un=/^[a-z0-9.-]+$/i;function lt(){return Math.random().toString(36).slice(2,12)}function X(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let s=i.trim();s.startsWith(n)&&r.push(s.slice(n.length));}return r}function N(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function ut(t,e,n,r){try{let i=`pdx_probe_${r()}`,s=r();t.cookie=`${i}=${s}; ${N(e,60,n)}`;let o=X(t,i).includes(s);t.cookie=`${i}=; ${N(e,0,n)}`;let c=X(t,i).includes(s);return o&&!c}catch{return false}}function be(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||ln.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let i=n.length-2;i>=0;i-=1)r.push(n.slice(i).join("."));return r}function dt(t,e,n,r=lt){for(let i of be(t))if(ut(e,i,n,r))return i}function dn(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,i]of Object.entries(n))typeof i=="string"&&e.set(r,i);return e}var ke=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}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=X(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${N(void 0,0,this.secure)}`,e=X(this.jar,this.name));let n=e[0];return n?dn(n):new Map}catch{return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${N(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${N(this.domain,31536e3,this.secure)}`;}catch{return}}};function pn(){return globalThis.document}function fn(){return globalThis.location?.hostname??""}function hn(){return globalThis.location?.protocol==="https:"}function mn(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return un.test(e)?e.toLowerCase():void 0}function Ee(t){let e="jar"in t?t.jar:pn();if(!e||globalThis.navigator?.cookieEnabled===false)return null;let r=t.random??lt,i=t.secure??hn(),s=t.hostname??fn();try{let o=mn(t.domain)??dt(s,e,i,r);return ut(e,o,i,r)?new ke(e,t.name,o,i):null}catch{return null}}var ht="_pdx",mt="~",gn=200,yn=/^\d+$/;function gt(t,e,n,r){let i=kn(t.href);if(i===void 0||Se(i.search).some(Te))return;let s=pt(i.hostname,n);s===void 0||s===pt(r,n)||(i.search=`${i.search}${i.search?"&":"?"}${ht}=${vn(e)}`,t.href=i.href);}function vn(t){return [t.anonymousId,t.sessionId,String(t.sessionStartedAt)].map(En).join(mt)}function yt(t){let e=Se(t).find(Te);if(e===void 0)return;let n=bn(e).split(mt);if(n.length!==3)return;let r=Y(n[0]),i=Y(n[1]),s=Y(n[2]);if(!(!ft(r)||!ft(i)||!xn(s)))return {anonymousId:r,sessionId:i,sessionStartedAt:Number(s)}}function vt(t,e){let n=Se(e.search),r=n.filter(s=>!Te(s));if(r.length===n.length)return;let i=r.length>0?`?${r.join("&")}`:"";t.replaceState(t.state,"",`${e.pathname}${i}${e.hash}`);}function kt(t){if(t.location===void 0||typeof t.location.search!="string")return;let e=yt(t.location.search);if(e===void 0)return;let n=Qe(t.storage,t.shared,t.namespace,e.anonymousId);return Ye(t.shared,t.namespace,{id:e.sessionId,startedAt:e.sessionStartedAt},t.now),t.history!==void 0&&vt(t.history,t.location),n}function xe(t,e,n){if(n.length===0)return ()=>{};let r=i=>{let s=In(i.target);if(s===void 0)return;let o=Sn(e);o!==void 0&>(s,o,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 kn(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"?e:void 0}catch{return}}function pt(t,e){let n=e.map(r=>r.replace(/^\./,"").toLowerCase());return be(t).find(r=>n.includes(r))}function Se(t){return t.replace(/^\?/,"").split("&").filter(e=>e!=="")}function Te(t){let e=t.indexOf("=");return Y(e===-1?t:t.slice(0,e))===ht}function bn(t){let e=t.indexOf("=");return e===-1?"":t.slice(e+1)}function En(t){return encodeURIComponent(t).replace(/~/g,"%7E")}function Y(t){try{return decodeURIComponent(t)}catch{return}}function ft(t){if(t===void 0)return false;let e=R(t);return e>=1&&e<=gn}function xn(t){return t!==void 0&&yn.test(t)&&Number.isSafeInteger(Number(t))}function Sn(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 Tn(t){return typeof t.tagName=="string"&&t.tagName.toUpperCase()==="A"&&typeof t.href=="string"}function In(t){let e=typeof t=="object"?t:null;for(;e;){if(Tn(e))return e;e=e.parentElement??null;}}var bt={maskAllInputs:true,maskAllText:false},wn=new Set(["email","password","tel"]);function Et(t){return t.replace(/\S/g,"*")}function Z(t,e,n){return Cn(e)||n.maskAllInputs?Et(t):t}function ee(t,e){return e.maskAllText?Et(t):t}function Cn(t){return wn.has((t??"").toLowerCase())}var An=5e3,te=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),An);}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 Ie=1,we=3,_n=9,ne=class{constructor(){a(this,"next",1);}allocate(){let e=this.next;return this.next+=1,e}},Nn=new Set(["NOSCRIPT","SCRIPT"]);function re(t,e,n,r){if(t.nodeType===we){let i=e.allocate();return r?.(t,i),{id:i,textContent:ee(t.textValue??"",n),type:"text"}}if(t.nodeType===_n){let i=e.allocate();return r?.(t,i),{childNodes:xt(t,e,n,r),id:i,type:"document"}}if(t.nodeType===Ie){let i=t.tagName??"";if(Nn.has(i))return null;let s=e.allocate();return r?.(t,s),{attributes:Ln(t,n),childNodes:xt(t,e,n,r),id:s,tagName:i,type:"element"}}return null}function xt(t,e,n,r){let i=[];for(let s of t.childNodes??[]){let o=re(s,e,n,r);o&&i.push(o);}return i}function Ln(t,e){let n={};for(let r of t.attributes??[])n[r.name]=r.value;return t.inputValue!==void 0&&(n.value=Z(t.inputValue,t.inputType,e)),n}async function St(t,e){let n=`${g(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 Tt=new Set(["INPUT","SELECT","TEXTAREA"]),ie=class{constructor(e){this.options=e;a(this,"allocator",new ne);a(this,"mirror",new Map);a(this,"chunker");a(this,"fetchImpl");a(this,"observer");a(this,"timer");a(this,"started",false);this.chunker=new te({distinctId:e.distinctId,masked:e.mask.maskAllInputs,maxEvents:e.maxEvents,now:e.now,sessionId:e.sessionId}),this.fetchImpl=y(e.fetch);}start(){if(this.started)return;let e=On(),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=re(this.adapt(e),this.allocator,this.options.mask,(r,i)=>{let s=r.ref;s&&this.mirror.set(s,i);});n&&this.push(2,{node:n});}observeMutations(e){let n=globalThis.MutationObserver;n&&(this.observer=new n(r=>{for(let i of r)this.handleMutation(i);}),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:ee(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 i=re(this.adapt(r),this.allocator,this.options.mask,(s,o)=>{let c=s.ref;c&&this.mirror.set(c,o);});i&&this.push(3,{adds:[{node:i,parentId:n}]});}for(let r of Array.from(e.removedNodes)){let i=this.mirror.get(r);i!==void 0&&(this.push(3,{removes:[{id:i,parentId:n}]}),this.mirror.delete(r));}}}observeInteractions(e){e.addEventListener("input",n=>{let r=n.target;if(!r||!Tt.has(r.tagName))return;let i=this.mirror.get(r);i!==void 0&&this.push(3,{input:{id:i,value:Z(r.value??"",r.type,this.options.mask)}});},true),e.addEventListener("scroll",n=>{let r=n.target,i=r?this.mirror.get(r):void 0;this.push(3,{scroll:{id:i??0,x:r?.scrollLeft??0,y:r?.scrollTop??0}});},true);}adapt(e){let n={childNodes:[],nodeType:e.nodeType,ref:e};if(e.nodeType===we)return n.textValue=e.textContent??"",n;if(e.nodeType===Ie){let r=e;if(n.tagName=r.tagName,n.attributes=Array.from(r.attributes).map(i=>({name:i.name,value:i.value})),Tt.has(r.tagName)){let i=r;n.inputType=i.type,n.inputValue=i.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||St(e,{apiKey:this.options.apiKey,fetch:this.fetchImpl,replayHost:this.options.replayHost}).catch(n=>this.options.onError?.(n));}};function On(){return globalThis.document}function It(t){let e=new ie({apiKey:t.apiKey,distinctId:t.distinctId,flushIntervalMs:t.flushIntervalMs??5e3,mask:{...bt,...t.mask},maxEvents:t.maxEvents??200,now:t.now??(()=>Date.now()),onError:t.onError,replayHost:t.replayHost,sessionId:t.sessionId??oe()});return e.start(),e}function Fn(){return globalThis.navigator}function Pn(){return globalThis.document}function Rn(){return globalThis.history}function $n(){return globalThis.location}function Mn(t){let e=t?.userAgentData?.platform??t?.platform;return e?e.slice(0,50):void 0}function Dn(t){let e=()=>{t.flush();};globalThis.document?.addEventListener?.("visibilitychange",e),globalThis.addEventListener?.("pagehide",e);}function qn(t,e,n){try{return Ee({domain:e,name:`pdx_${$(t)}`})??n}catch{return n}}function ji(t){let{autocaptureOptions:e,cookieDomain:n,linkedDomains:r,replayHost:i,sessionReplay:s,sessionReplayOptions:o,...c}=t,f=Fn(),l=_e(),u=c.storage??l,h=c.sharedStorage??qn(c.apiKey,n,l),k=kt({history:Rn(),location:$n(),namespace:$(c.apiKey),now:(c.clock??F).now().getTime(),shared:h,storage:u}),se=J(c.onError??(()=>{})),O={...c,describeElement:c.describeElement??(wt=>st(wt,se)),locale:c.locale??(f?.language?f.language.slice(0,20):void 0),os:c.os??Mn(f),sessionTracking:c.sessionTracking??true,sharedStorage:h,storage:u,transport:c.transport??new Q({maxRetries:c.maxRetries,requestTimeoutMs:c.requestTimeoutMs})},b=new G(O);k!==void 0&&b.alias(k),Dn(b),(t.autocapture??true)&&ct(b,{onError:O.onError,...e});let Ce=Pn();return Ce&&r&&xe(Ce,b,r),s&&i&&It({apiKey:O.apiKey,distinctId:()=>b.distinctId,onError:O.onError,replayHost:i,...o,sessionId:o?.sessionId??b.sessionId}),b}exports.ACTION_ATTRIBUTE=rt;exports.ANNOTATION_ATTRIBUTE=nt;exports.ANNOTATION_MAX_LENGTH=w;exports.IGNORE_ATTRIBUTE=it;exports.WebTransport=Q;exports.createCookieStorage=Ee;exports.createWebClient=ji;exports.decorateLink=gt;exports.installAutocapture=ct;exports.installLinkCarry=xe;exports.installSessionReplay=It;exports.readCarry=yt;exports.resolveCookieDomain=dt;exports.stripCarry=vt;//# sourceMappingURL=web.cjs.map
|
|
1
|
+
'use strict';var yr=Object.defineProperty;var vr=(t,e,n)=>e in t?yr(t,e,{enumerable:true,configurable:true,writable:true,value:n}):t[e]=n;var d=(t,e,n)=>vr(t,typeof e!="symbol"?e+"":e,n);var D=class extends Error{constructor(n,r,i){super(r,i);d(this,"code");this.code=n,this.name="ProdantixError";}},X=class extends D{constructor(e){super("config",e),this.name="ConfigError";}},z=class extends D{constructor(n,r){super("validation",r);d(this,"field");this.field=n,this.name="ValidationError";}},g=class extends D{constructor(n,r,i){super("transport",n,i);d(this,"status");this.status=r,this.name="TransportError";}};function _(t){if(t)return t;let e=globalThis.fetch;if(typeof e=="function")return e.bind(globalThis)}function F(){let t=globalThis.AbortController;return t?new t:void 0}var At=t=>new Promise(e=>{setTimeout(e,t);});function T(t){return t.replace(/\/+$/,"")}var j=class{constructor(){d(this,"store",new Map);}getItem(e){return this.store.get(e)??null}removeItem(e){this.store.delete(e);}setItem(e,n){this.store.set(e,n);}},Z=class{constructor(e,n=()=>false){this.real=e;this.passes=n;d(this,"held",new j);d(this,"opened",false);}get isOpen(){return this.opened}open(){this.opened=true;}close(){this.opened=false;}target(e){return this.opened||this.passes(e)?this.real:this.held}getItem(e){return this.target(e).getItem(e)}removeItem(e){this.target(e).removeItem(e);}setItem(e,n){this.target(e).setItem(e,n);}};function Pt(){try{let t=globalThis.localStorage;if(t){let e="__pdx_probe__";return t.setItem(e,"1"),t.removeItem(e),t}}catch{return new j}return new j}var oe={now:()=>new Date};function ae(t){return t.toISOString()}function _t(){if(typeof window>"u"||typeof Intl>"u")return null;let t=Intl.DateTimeFormat().resolvedOptions().timeZone;return typeof t=="string"&&t!==""?t:null}function br(){return globalThis.crypto}function kr(t){t[6]=t[6]&15|64,t[8]=t[8]&63|128;let e=[];for(let n=0;n<16;n+=1)e.push(t[n].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 je(){let t=br();if(t?.randomUUID)return t.randomUUID();let e=new Uint8Array(16);if(t?.getRandomValues)t.getRandomValues(e);else for(let n=0;n<16;n+=1)e[n]=Math.floor(Math.random()*256);return kr(e)}var Ft={uuid:je};var xr=/^pdx_pub_(?:(?:live|test)_)?[a-z0-9]{32}$/;var Sr=/^(?:\$|[a-z])[a-z0-9_.]*$/;function de(t){let e=0;for(let n of t)e+=1;return e}function Lt(t){return xr.test(t)}function Er(t){return Sr.test(t)}function $t(t){let e=de(t);if(e<1||e>200)throw new z("distinct_id","distinct_id must be between 1 and 200 characters")}function Nt(t){let e=de(t);if(e<1||e>200)throw new z("event_name","event_name must be between 1 and 200 characters");if(!Er(t))throw new z("event_name","event_name must match /^(\\$|[a-z])[a-z0-9_.]*$/")}var Rt="prodantix-js",Ot="0.7.0";var wr=t=>{};function Mt(t){if(!t.apiKey||!Lt(t.apiKey))throw new X("apiKey must be a public project key of the form pdx_pub_<32 lowercase alphanumerics>");if(!t.host)throw new X("host is required (the ingest base URL)");let e=T(t.host),n=t.defaultProperties,r=t.storage??new j;return {apiKey:t.apiKey,autocapture:t.autocapture??false,clock:t.clock??oe,consent:t.consent,consentMode:t.consentMode,defaultProperties:typeof n=="function"?n:()=>n??{},describeElement:t.describeElement,flagsHost:t.flagsHost?T(t.flagsHost):e,flushAt:t.flushAt??20,flushIntervalMs:t.flushIntervalMs??1e4,host:e,ids:t.ids??Ft,locale:t.locale,maxQueueSize:t.maxQueueSize??1e3,maxRetries:t.maxRetries??3,namespace:ee(t.apiKey),onError:t.onError??wr,os:t.os,requestTimeoutMs:t.requestTimeoutMs??1e4,sdkName:t.sdkName??Rt,sdkVersion:t.sdkVersion??Ot,sessionTracking:t.sessionTracking??false,sharedStorage:t.sharedStorage??r,socketFactory:t.socketFactory,storage:r,streamFlags:t.streamFlags??false,transport:t.transport}}function ee(t){return t.slice(0,16)}var Dt="$cta_viewed",qt="$cta_clicked",Ve="$cta_dismissed",Kt=(t,e)=>{let n={$cta_id:t.id,$cta_kind:t.kind,$cta_variant:t.variant.key,$cta_version:t.version},r=e===void 0?void 0:t.variant.content.buttons[e];return r&&e!==void 0&&(n.$cta_button=e,n.$cta_button_label=r.label,r.action.kind==="form"&&(n.$cta_form_id=r.action.value)),n},le=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async ctas(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=new URLSearchParams({anonymous:String(e.anonymous),device:e.device,distinct_id:e.distinctId,language:e.language,url:e.url}),i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(`${this.host}/v1/ctas?${r.toString()}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(o.status<200||o.status>=300)throw new g(`ctas request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).ctas}finally{s!==void 0&&clearTimeout(s);}}};function Bt(t,e,n){Nt(t.eventName),$t(t.distinctId);let r={distinct_id:t.distinctId,event_id:t.eventId??n.uuid(),event_name:t.eventName,properties:t.properties??{},schema_version:1,timestamp:ae(t.timestamp??e.now())};return t.context&&(r.context=t.context),t.sessionId&&(r.session_id=t.sessionId),r}var U=Symbol("absent");function Cr(t,e){if(t==="distinct_id")return e.distinctId;let n=e.properties??{};if(Object.prototype.hasOwnProperty.call(n,t))return n[t];let r=e.attributes??{};return Object.prototype.hasOwnProperty.call(r,t)?r[t]:U}function V(t){return t===U?"undefined":String(t)}function Ht(t){return t===U?Number.NaN:Number(t)}function Gt(t){return t!==U&&t!==null&&t!==""}function jt(t,e){if(!Array.isArray(e))return false;let n=V(t);return e.map(r=>String(r)).includes(n)}function Vt(t,e){let n=Cr(t.attribute,e),r=t.value;switch(t.op){case "is_set":return Gt(n);case "is_not_set":return !Gt(n);case "eq":return V(n)===V(r===void 0?U:r);case "neq":return V(n)!==V(r===void 0?U:r);case "contains":return V(n).includes(V(r===void 0?U:r));case "in":return jt(n,r);case "not_in":return Array.isArray(r)?!jt(n,r):false;case "gt":return ce(n,r,(i,s)=>i>s);case "gte":return ce(n,r,(i,s)=>i>=s);case "lt":return ce(n,r,(i,s)=>i<s);case "lte":return ce(n,r,(i,s)=>i<=s);case "in_cohort":return typeof r=="string"&&r!==""&&(e.cohorts??[]).includes(r);case "not_in_cohort":return typeof r=="string"&&r!==""&&!(e.cohorts??[]).includes(r);default:return false}}function ce(t,e,n){let r=Ht(t),i=e===void 0?Number.NaN:Ht(e);return Number.isNaN(r)||Number.isNaN(i)?false:n(r,i)}function Ut(t,e){let n=`${t}:${e}`,r=2166136261;for(let i=0;i<n.length;i++)r^=n.charCodeAt(i),r=Math.imul(r,16777619);return (r>>>0)%100}function Ue(t,e){return t.targeting.length===0||t.targeting.every(n=>Vt(n,e))}function zt(t,e){let n=Ut(t.key,e.distinctId),r=t.variations??[];if(r.length===0)return t.rolloutPercentage>=100||n<t.rolloutPercentage?"true":"false";let i=0;for(let s=r.length-1;s>=0;s--)if(i+=r[s].weight,n<i)return r[s].key;return r[0].key}function ze(t,e,n,r){for(let i of t.prerequisites??[]){if(r.includes(i.flagKey))return false;let s=e.find(a=>a.key===i.flagKey);if(!s||!s.enabled)return false;r.push(s.key);let o=ze(s,e,n,r)&&Ue(s,n)&&zt(s,n)===i.variationKey;if(r.pop(),!o)return false}return true}function ue(t,e,n){return t.enabled?ze(t,e,n,[t.key])?Ue(t,n)?t.rolloutPercentage>=100?{enabled:true,reason:"rollout_full"}:Ut(t.key,n.distinctId)<t.rolloutPercentage?{enabled:true,reason:"rollout"}:{enabled:false,reason:"rollout_excluded"}:{enabled:false,reason:"targeting"}:{enabled:false,reason:"prerequisite"}:{enabled:false,reason:"disabled"}}function Wt(t,e){let n={};for(let r of t)n[r.key]=ue(r,t,e).enabled;return n}function We(t,e,n){let r=t.variations??[],i=r[0];if(!i)return null;if(!t.enabled||!ze(t,e,n,[t.key])||!Ue(t,n))return i;let s=zt(t,n);return r.find(o=>o.key===s)??i}function Jt(t){return t.some(e=>e.targeting.some(n=>n.op==="in_cohort"||n.op==="not_in_cohort"))}function Yt(t){return `40${JSON.stringify(t)}`}function Qt(){return "3"}function Xt(t){let e=t.charAt(0),n=t.slice(1);if(e==="2")return {kind:"ping"};if(e==="1")return {kind:"disconnect"};if(e==="0"){let o=Je(n);return {kind:"open",pingInterval:typeof o?.pingInterval=="number"?o.pingInterval:25e3,pingTimeout:typeof o?.pingTimeout=="number"?o.pingTimeout:2e4}}if(e!=="4")return {kind:"other"};let r=n.charAt(0),i=n.slice(1);if(r==="0")return {kind:"connected"};if(r==="1")return {kind:"disconnect"};if(r==="4"){let o=Je(i);return {kind:"connectError",message:typeof o?.message=="string"?o.message:"refused"}}if(r!=="2")return {kind:"other"};let s=Je(i);return !Array.isArray(s)||typeof s[0]!="string"?{kind:"other"}:{kind:"event",name:s[0],payload:s[1]}}function Je(t){try{return JSON.parse(t)}catch{return null}}var Tr="/socket.io/?EIO=4&transport=websocket",Ir=250,pe=class{constructor(e){this.options=e;d(this,"socket",null);d(this,"heartbeat",null);d(this,"pending",null);d(this,"lastKey","");d(this,"ready",false);d(this,"closed",false);d(this,"heartbeatWindow",45e3);d(this,"factory");d(this,"setTimer");d(this,"clearTimer");this.factory=e.socketFactory??Ar,this.setTimer=e.setTimer??((n,r)=>setTimeout(n,r)),this.clearTimer=e.clearTimer??(n=>clearTimeout(n));}open(){if(this.socket||this.closed)return;let e=`${this.options.host.replace(/^http/,"ws").replace(/\/+$/,"")}${Tr}`,n;try{n=this.factory(e);}catch{this.options.onClosed(false);return}this.socket=n,n.onmessage=r=>this.receive(String(r.data)),n.onerror=()=>n.close(),n.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 n=Xt(e);if(n.kind==="open"){this.armHeartbeat(n.pingInterval+n.pingTimeout),this.socket?.send(Yt({projectKey:this.options.projectKey}));return}if(n.kind==="ping"){this.armHeartbeat(),this.socket?.send(Qt());return}if(n.kind==="connectError"||n.kind==="disconnect"){this.stopHeartbeat(),this.socket?.close();return}if(n.kind==="event"){if(n.name==="ready"){this.ready=true;return}if(n.name==="flagChange"){let r=n.payload?.key;this.lastKey=typeof r=="string"?r:"",this.pending===null&&(this.pending=this.setTimer(()=>{this.pending=null,this.options.onChange(this.lastKey);},Ir));}}}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 Ar(t){let e=globalThis.WebSocket;if(!e)throw new g("no WebSocket");return new e(t)}var me=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async fetchAll(e){return (await this.fetchDecisions(e)).flags}async fetchDecisions(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags?distinct_id=${encodeURIComponent(e)}`,i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new g(`flags request failed with status ${o.status}`,o.status);let a=JSON.parse(await o.text());return {flags:a.flags??{},variants:a.variants??{}}}finally{s!==void 0&&clearTimeout(s);}}async snapshot(){let e=this.fetch;if(!e)throw new g("no fetch implementation available in this runtime");let n=`${this.host}/v1/flags/snapshot`,r=F(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await e(n,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!s.ok)throw new g(`flag snapshot request failed with status ${s.status}`,s.status);let o=JSON.parse(await s.text()),a={flags:o.flags??[],generatedAt:o.generatedAt};return typeof o.socketUrl=="string"&&o.socketUrl!==""&&(a.socketUrl=o.socketUrl),a}finally{i!==void 0&&clearTimeout(i);}}async memberships(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=`${this.host}/v1/flags/memberships?distinct_id=${encodeURIComponent(e)}`,i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await n(r,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new g(`memberships request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).cohorts??[]}finally{s!==void 0&&clearTimeout(s);}}};var Zt="$form_viewed",en="$form_started",te=class extends Error{constructor(n,r,i){super(i);d(this,"fields");d(this,"status");this.name="FormRefusedError",this.status=n,this.fields=r;}},ge=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async request(e,n){let r=this.fetch;if(!r)throw new g("no fetch implementation available in this runtime");let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(o["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:o,method:n.method,signal:i?.signal});return {status:a.status,text:await a.text()}}finally{s!==void 0&&clearTimeout(s);}}async form(e,n){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}?distinct_id=${encodeURIComponent(n)}`,{method:"GET"});if(r<200||r>=300)throw new g(`form request failed with status ${r}`,r);return JSON.parse(i)}async submit(e,n){let{status:r,text:i}=await this.request(`/v1/forms/${encodeURIComponent(e)}/submissions`,{body:JSON.stringify(n),method:"POST"});if(r>=200&&r<300)return JSON.parse(i).afterSubmit;let s=[],o=`form submission failed with status ${r}`;try{let a=JSON.parse(i);s=a.error?.fields??[],o=a.error?.message??o;}catch{s=[];}throw new te(r,s,o)}};var tn="$survey_shown",nn="$survey_dismissed",rn="$survey_sent",fe=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async surveys(e,n){let r=this.fetch;if(!r)throw new g("no fetch implementation available in this runtime");let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o=await r(`${this.host}/v1/surveys?distinct_id=${encodeURIComponent(e)}${n?`&lang=${encodeURIComponent(n)}`:""}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:i?.signal});if(!o.ok)throw new g(`surveys request failed with status ${o.status}`,o.status);return JSON.parse(await o.text()).surveys??[]}finally{s!==void 0&&clearTimeout(s);}}},Pr=864e5,he=t=>`${t.id}:${t.iteration}`;function Ye(t,e){return t.length===0?true:t.some(n=>{switch(n.matches){case "exact":return e===n.value;case "starts_with":return e.startsWith(n.value);default:return e.includes(n.value)}})}function sn(t,e,n,r,i){return t.kind!=="popover"||e.settled.includes(he(t))||t.showOnce&&e.settled.some(s=>s.startsWith(`${t.id}:`))||t.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<t.waitDays*Pr||t.event&&t.event!==i?false:Ye(t.urls,n)}function ye(t,e){let n={$survey_id:t.id,$survey_iteration:t.iteration,$survey_name:t.name};for(let[r,i]of Object.entries(e))n[`$survey_response_${r}`]=i;return n}var Qe="$guide_shown",on="$guide_step_viewed",an="$guide_step_missed",Xe="$guide_completed",Ze="$guide_dismissed",dn="$checklist_task_done",ve=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async guides(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=F(),i=r?setTimeout(()=>r.abort(),this.requestTimeoutMs):void 0;try{let s=await n(`${this.host}/v1/guides?distinct_id=${encodeURIComponent(e)}`,{headers:{authorization:`Bearer ${this.projectKey}`},method:"GET",signal:r?.signal});if(!s.ok)throw new g(`guides request failed with status ${s.status}`,s.status);return JSON.parse(await s.text()).guides??[]}finally{i!==void 0&&clearTimeout(i);}}},_r=864e5,W=t=>`${t.id}:${t.iteration}`,be=(t,e)=>`${W(t)}:${e}`;function ln(t,e,n,r,i){return e.settled.includes(W(t))||t.showOnce&&e.settled.some(s=>s.startsWith(`${t.id}:`))||t.kind!=="checklist"&&t.waitDays>0&&e.lastShownAt!==void 0&&r-e.lastShownAt<t.waitDays*_r||t.event&&t.event!==i?false:Ye(t.urls,n)}var et=(t,e)=>t.steps.filter(n=>e.done.includes(be(t,n.id))).map(n=>n.id),cn=(t,e)=>t.kind==="checklist"?t.steps.find(n=>n.event===e):void 0;function un(t,e){let n={$guide_id:t.id,$guide_iteration:t.iteration,$guide_name:t.name};return e!==void 0&&(n.$guide_step_id=e),n}function ne(t){if(typeof t!="string")return;let e=Array.from(t).length;return e>=1&&e<=200?t:void 0}function xe(t,e){return `pdx.${t}.${e}`}var nt="consent",Fr=["identityLink","analytics","marketing","functional"];function tt(t){if(typeof t!="string")return null;try{let e=JSON.parse(t);if(e===null||typeof e!="object"||Array.isArray(e))return null;let n=e,r={};for(let i of Fr){let s=n[i];typeof s=="boolean"&&(r[i]=s);}return typeof n.version=="number"&&Number.isInteger(n.version)&&(r.version=n.version),Array.isArray(n.categories)&&n.categories.every(i=>typeof i=="string")&&(r.categories=n.categories),Object.keys(r).length===0?null:r}catch{return null}}var pn=t=>t.endsWith(`.${nt}`);function Se(t,e){return tt(t.getItem(xe(e,nt)))}function Lr(t,e,n){let r=xe(e,nt),i=tt(JSON.stringify(n)),s=i===null?null:tt(JSON.stringify({...Se(t,e)??{},...i}));if(s===null){t.removeItem(r);return}t.setItem(r,JSON.stringify(s));}function mn(t,e,n,r){let i=xe(n,"anonymous_id"),s=ne(e.getItem(i))??ne(t.getItem(i));return e.setItem(i,r),t.setItem(i,r),s!==void 0&&s!==r?s:void 0}var ke=class{constructor(e,n,r,i){this.storage=e;this.shared=n;this.ids=r;this.namespace=i;d(this,"anonymousId");d(this,"distinctId");d(this,"identified");this.refresh();}refresh(){let e=ne(this.shared.getItem(this.key("anonymous_id"))),n=ne(this.storage.getItem(this.key("anonymous_id")));e?(this.anonymousId=e,n!==e&&this.storage.setItem(this.key("anonymous_id"),e)):n?(this.anonymousId=n,this.shared.setItem(this.key("anonymous_id"),n)):(this.anonymousId=this.ids.uuid(),this.shared.setItem(this.key("anonymous_id"),this.anonymousId),this.storage.setItem(this.key("anonymous_id"),this.anonymousId));let r=ne(this.storage.getItem(this.key("distinct_id")));r?(this.distinctId=r,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 Se(this.shared,this.namespace)}setConsent(e){Lr(this.shared,this.namespace,e);}assumeAnonymousId(e){this.anonymousId=e,this.shared.setItem(this.key("anonymous_id"),e),this.storage.setItem(this.key("anonymous_id"),e),this.identified||(this.distinctId=e);}identify(e){let n=!this.identified||this.distinctId!==e,r=this.storage.getItem(this.key("linked_anonymous_id")),i=n||r!==this.anonymousId;return this.distinctId=e,this.identified=true,n&&this.storage.setItem(this.key("distinct_id"),e),!i||this.consent()?.identityLink===false?{changed:n}:(this.storage.setItem(this.key("linked_anonymous_id"),this.anonymousId),{anonymousToLink:this.anonymousId,changed:n})}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 xe(this.namespace,e)}};var Ee=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async inbox(e){let n=this.requireFetch(),r=`${this.host}/v1/messages?distinct_id=${encodeURIComponent(e)}`,i=await this.request(n,r,{headers:this.authHeaders(),method:"GET"});if(!i.ok)throw new g(`inbox request failed with status ${i.status}`,i.status);return JSON.parse(await i.text()).messages??[]}async markRead(e,n){let r=this.requireFetch(),i=`${this.host}/v1/messages/read`,s=await this.request(r,i,{body:JSON.stringify({distinct_id:n,message_id:e}),headers:{...this.authHeaders(),"content-type":"application/json"},method:"POST"});if(!s.ok)throw new g(`mark-read request failed with status ${s.status}`,s.status)}requireFetch(){if(!this.fetch)throw new g("no fetch implementation available in this runtime");return this.fetch}authHeaders(){return {authorization:`Bearer ${this.projectKey}`}}async request(e,n,r){let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n,{...r,signal:i?.signal})}finally{s!==void 0&&clearTimeout(s);}}};var we=class{constructor(e,n){this.maxSize=e;this.onOverflow=n;d(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 n=e===void 0?this.events.length:Math.min(e,this.events.length);return this.events.splice(0,n)}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 $r={idleMs:18e5,maxMs:864e5,throttleMs:1e4};function gn(t){return `pdx.${t}.session`}function fn(t,e,n,r){let i={id:n.id,lastActivityAt:r,startedAt:n.startedAt};t.setItem(gn(e),JSON.stringify(i));}var Ce=class{constructor(e,n,r,i,s=$r){this.storage=e;this.ids=n;this.clock=r;this.namespace=i;this.options=s;}current(){return this.touch().id}startedAt(){return this.touch().startedAt}reset(){this.storage.removeItem(this.key());}touch(){let e=this.clock.now().getTime(),n=this.live(this.read(),e);if(n===void 0)return this.write({id:this.ids.uuid(),lastActivityAt:e,startedAt:e});if(e-n.lastActivityAt<=this.options.throttleMs)return n;let r=this.live(this.read(),e),i=r!==void 0&&r.id!==n.id?r:n;return this.write({...i,lastActivityAt:e})}live(e,n){if(e!==void 0&&!(n-e.lastActivityAt>this.options.idleMs||n-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 n=JSON.parse(e);return typeof n.id=="string"&&typeof n.startedAt=="number"&&typeof n.lastActivityAt=="number"?{id:n.id,lastActivityAt:n.lastActivityAt,startedAt:n.startedAt}:void 0}catch{return}}key(){return gn(this.namespace)}};var w={autocapture:"$autocapture",createAlias:"$create_alias",featureFlagCalled:"$feature_flag_called",group:"$group",identify:"$identify",pageview:"$pageview",set:"$set"};function hn(t){return t>=400&&t<500&&t!==429}var J=class{constructor(e={}){d(this,"fetch");d(this,"maxRetries");d(this,"requestTimeoutMs");d(this,"baseDelayMs");d(this,"maxDelayMs");d(this,"sleep");d(this,"random");this.fetch=_(e.fetch),this.maxRetries=e.maxRetries??3,this.requestTimeoutMs=e.requestTimeoutMs??1e4,this.baseDelayMs=e.baseDelayMs??500,this.maxDelayMs=e.maxDelayMs??3e4,this.sleep=e.sleep??At,this.random=e.random??Math.random;}async send(e){let n=this.fetch;if(!n)throw new g("no fetch implementation available in this runtime");let r=JSON.stringify(e.body),i;for(let s=0;s<=this.maxRetries;s+=1){try{let o=await this.attempt(n,e,r);if(o.ok)return;if(hn(o.status))throw new g(`ingest rejected batch with status ${o.status}`,o.status);i=new g(`ingest transient status ${o.status}`,o.status);}catch(o){if(o instanceof g&&o.status!==void 0&&hn(o.status))throw o;i=o;}s<this.maxRetries&&await this.sleep(this.backoff(s));}throw new g("ingest delivery failed after retries",void 0,{cause:i})}async attempt(e,n,r){let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{return await e(n.url,{body:r,headers:{authorization:`Bearer ${n.projectKey}`,"content-type":"application/json"},method:"POST",signal:i?.signal})}finally{s!==void 0&&clearTimeout(s);}}backoff(e){return Math.min(this.maxDelayMs,this.baseDelayMs*2**e)+this.random()*this.baseDelayMs}};var Nr="queue",Rr=1e3,yn=3e4,rt=t=>{let e={};return t.avatar!==void 0&&(e.$avatar=t.avatar),t.email!==void 0&&(e.$email=t.email),t.name!==void 0&&(e.$name=t.name),t.phone!==void 0&&(e.$phone=t.phone),e},Te=class{constructor(e){d(this,"config");d(this,"identity");d(this,"session");d(this,"queue");d(this,"transport");d(this,"flagsClient");d(this,"messagesClient");d(this,"surveysClient");d(this,"guidesClient");d(this,"captureListeners",new Set);d(this,"formsClient");d(this,"ctasClient");d(this,"context");d(this,"flushTimer");d(this,"flushing",false);d(this,"cachedFlags");d(this,"cachedSnapshot");d(this,"membershipCache");d(this,"stream");d(this,"shutDown",false);d(this,"exposures",new Set);d(this,"gates");d(this,"cookielessId");d(this,"storageListeners",new Set);let n=Mt(e),r=Se(n.sharedStorage,n.namespace)??n.consent??null;if(this.gates=[new Z(n.storage),new Z(n.sharedStorage,pn)],n.consentMode!=="banner"||r?.analytics===true)for(let o of this.gates)o.open();let[i,s]=this.gates;this.config={...n,sharedStorage:s,storage:i},this.identity=new ke(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 Ce(this.config.sharedStorage,this.config.ids,this.config.clock,this.config.namespace):void 0,this.queue=new we(this.config.maxQueueSize,({dropped:o})=>{this.config.onError(new D("queue_overflow",`event queue overflow: dropped ${o.length} oldest event(s)`));}),this.transport=this.config.transport??new J({maxRetries:this.config.maxRetries,requestTimeoutMs:this.config.requestTimeoutMs}),this.flagsClient=new me({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.messagesClient=new Ee({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.surveysClient=new fe({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.guidesClient=new ve({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.formsClient=new ge({host:this.config.flagsHost,projectKey:this.config.apiKey,requestTimeoutMs:this.config.requestTimeoutMs}),this.ctasClient=new le({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,n={}){try{this.identity.refresh();let r={...this.config.defaultProperties(),...n.element===void 0?{}:this.config.describeElement?.(n.element)??{},...n.properties??{}},i=Bt({context:this.context,distinctId:n.distinctId??this.identity.getDistinctId(),eventName:e,properties:r,sessionId:n.sessionId??this.session?.current(),timestamp:n.timestamp},this.config.clock,this.config.ids);this.enqueue(i);}catch(r){this.config.onError(r);}for(let r of this.captureListeners)try{r(e);}catch(i){this.config.onError(i);}}onCapture(e){return this.captureListeners.add(e),()=>{this.captureListeners.delete(e);}}identify(e,n={}){if(this.isCookieless())return;this.identity.refresh();let r=this.identity.identify(e),i={};r.anonymousToLink!==void 0&&(i.$anon_distinct_id=r.anonymousToLink);let s=_t(),o={...s===null?{}:{$timezone:s},...rt(n.traits??{}),...n.set??{}};Object.keys(o).length>0&&(i.$set=o),this.capture(w.identify,{properties:i});}link(e,n,r){if(this.isCookieless())return;let i={$anon_distinct_id:n},s=rt(r??{});Object.keys(s).length>0&&(i.$set=s),this.capture(w.identify,{distinctId:e,properties:i});}setConsent(e){this.identity.setConsent(e),e.analytics===true&&this.allowStorage(),e.analytics===false&&this.config.consentMode==="banner"&&this.forbidStorage();}isCookieless(){return !this.gates[0].isOpen}takeCookielessId(e){this.cookielessId=e,this.isCookieless()&&this.identity.assumeAnonymousId(e);}allowStorage(){if(this.isCookieless()){for(let e of this.gates)e.open();this.identity.refresh();for(let e of [...this.storageListeners])e();}}onStorageAllowed(e){return this.storageListeners.add(e),()=>{this.storageListeners.delete(e);}}forbidStorage(){if(!this.isCookieless()){for(let e of ["anonymous_id","distinct_id","linked_anonymous_id","session"])this.config.storage.removeItem(`pdx.${this.config.namespace}.${e}`),this.config.sharedStorage.removeItem(`pdx.${this.config.namespace}.${e}`);for(let e of this.gates)e.close();this.identity.refresh(),this.cookielessId!==void 0&&this.identity.assumeAnonymousId(this.cookielessId);}}consent(){return this.identity.consent()}alias(e){this.capture(w.createAlias,{properties:{alias:e}});}group(e,n,r){let i={$group_key:n,$group_type:e};r&&(i.$set=r),this.capture(w.group,{properties:i});}setPersonProperties(e,n){if(this.isCookieless())return;let r={};e&&(r.$set=e),n&&(r.$set_once=n),this.capture(w.set,{properties:r});}setPersonTraits(e){if(this.isCookieless())return;let n=rt(e);Object.keys(n).length!==0&&this.capture(w.set,{properties:{$set:n}});}async getAllFlags(){let e=this.identity.getDistinctId(),n=await this.flagsClient.fetchDecisions(e);return this.cachedFlags={distinctId:e,flags:n.flags,variants:n.variants??{}},n.flags}async isFeatureEnabled(e){let r=(await this.getAllFlags())[e]??false;return this.recordExposure(e,this.cachedFlags?.variants[e]?.key??String(r)),r}async getVariant(e){let n=await this.getAllFlags(),r=this.cachedFlags?.variants[e]??null;return this.recordExposure(e,r?.key??String(n[e]??false)),r}async getVariantLocal(e,n={}){let r=await this.flagSnapshot(),i=r.flags.find(u=>u.key===e),s=await this.localContext(n,r.flags),o=i?We(i,r.flags,s):null,a=i?ue(i,r.flags,s).enabled:false;return this.recordExposure(e,o?.key??String(a)),o?{key:o.key,value:o.value}:null}recordExposure(e,n){let r=`${this.identity.getDistinctId()} ${e} ${n}`;this.exposures.has(r)||(this.exposures.add(r),this.capture(w.featureFlagCalled,{properties:{$feature_flag:e,$feature_flag_response:n}}));}getCachedFlag(e){if(!(!this.cachedFlags||this.cachedFlags.distinctId!==this.distinctId))return this.cachedFlags.flags[e]}async getLocalFlags(e={}){let n=await this.flagSnapshot();return Wt(n.flags,await this.localContext(e,n.flags))}async isFeatureEnabledLocal(e,n={}){let r=await this.flagSnapshot(),i=r.flags.find(a=>a.key===e),s=await this.localContext(n,r.flags),o=i?ue(i,r.flags,s).enabled:false;return this.recordExposure(e,(i?We(i,r.flags,s)?.key:void 0)??String(o)),o}async localContext(e,n){let r=this.identity.getDistinctId(),i=e.cohorts;if(i===void 0&&Jt(n)){let s=this.config.clock.now().getTime();this.membershipCache&&this.membershipCache.distinctId===r&&s-this.membershipCache.fetchedAt<yn?i=this.membershipCache.cohorts:(i=await this.flagsClient.memberships(r),this.membershipCache={cohorts:i,distinctId:r,fetchedAt:s});}return {attributes:e.attributes,cohorts:i,distinctId:r,properties:e.properties}}async flagSnapshot(){let e=this.config.clock.now().getTime();if(this.cachedSnapshot&&e-this.cachedSnapshot.fetchedAt<yn)return this.cachedSnapshot.snapshot;let n=await this.flagsClient.snapshot();return this.cachedSnapshot={fetchedAt:e,snapshot:n},this.maybeStream(n),n}maybeStream(e){if(!this.config.streamFlags||this.shutDown||this.stream||!e.socketUrl)return;let n=new pe({host:e.socketUrl,onChange:()=>{this.cachedSnapshot=void 0,this.flagSnapshot().catch(r=>this.config.onError(r));},onClosed:r=>{this.stream=void 0,r&&this.maybeStream(e);},projectKey:this.config.apiKey,socketFactory:this.config.socketFactory});this.stream=n,n.open();}async getInbox(){return this.messagesClient.inbox(this.identity.getDistinctId())}async markMessageRead(e){await this.messagesClient.markRead(e,this.identity.getDistinctId());}async getSurveys(e){return this.surveysClient.surveys(this.identity.getDistinctId(),e??this.config.locale)}captureSurveyShown(e){this.capture(tn,{properties:ye(e,{})});}captureSurveyDismissed(e){this.capture(nn,{properties:ye(e,{})});}captureSurveySent(e,n){this.capture(rn,{properties:ye(e,n)});}async getGuides(){return this.guidesClient.guides(this.identity.getDistinctId())}captureGuide(e,n,r){this.capture(e,{properties:un(n,r)});}async getForm(e){return this.formsClient.form(e,this.identity.getDistinctId())}async submitForm(e,n,r,i){let{$page_id:s,$page_variant:o}=this.config.defaultProperties();return this.formsClient.submit(e,{answers:n,challenge:r,distinctId:this.identity.getDistinctId(),isAnonymous:!this.identity.isIdentified(),pageUrl:typeof window>"u"?"":window.location.href,solution:i,...typeof s=="string"&&typeof o=="string"?{pageId:s,pageVariant:o}:{}})}async getCtas(e){return this.ctasClient.ctas({...e,anonymous:!this.identity.isIdentified(),distinctId:this.identity.getDistinctId()})}captureCta(e,n,r){this.capture(e,{properties:Kt(n,r)});}async flush(){if(this.flushing||this.queue.size===0)return;this.flushing=true;let e=this.queue.drain(Rr);try{await this.transport.send({body:{events:e,sent_at:ae(this.config.clock.now())},projectKey:this.config.apiKey,url:`${this.config.host}/v1/events`}),this.persistQueue();}catch(n){this.queue.requeue(e),this.persistQueue(),this.config.onError(n);}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 n=JSON.parse(e);Array.isArray(n)&&this.queue.restore(n);}catch(e){this.config.onError(e);}}startTimer(){if(this.config.flushIntervalMs<=0)return;let e=setInterval(()=>{this.flush();},this.config.flushIntervalMs),n=e;typeof n.unref=="function"&&n.unref(),this.flushTimer=e;}stopTimer(){this.flushTimer!==void 0&&(clearInterval(this.flushTimer),this.flushTimer=void 0);}persistKey(){return `pdx.${this.config.namespace}.${Nr}`}};var bn="data-prodantix",kn="data-prodantix-action",xn="data-prodantix-ignore",Y=300,it="data-pdx-no-capture",st="pdx-no-capture",Or=new Set(["a","button","input","label","option","select","summary","textarea"]),Mr=new Set(["button","checkbox","link","menuitem","menuitemcheckbox","menuitemradio","option","radio","switch","tab","treeitem"]);function Dr(t){return Or.has(t.tagName.toLowerCase())||Mr.has((t.getAttribute("role")??"").trim().toLowerCase())}function ot(t){for(let e=t;e!==null;e=e.parentElement)if(Dr(e))return e;return t}function at(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(xn)!==null)return true;return false}function dt(t){for(let e=t;e!==null;e=e.parentElement)if(e.getAttribute(it)!==null||typeof e.className=="string"&&e.className.split(/\s+/).includes(st))return true;return false}function Ie(t){let e=new Set;return n=>{e.has(n.message)||(e.add(n.message),t(n));}}function vn(t,e,n){let r=t.getAttribute(e);if(r===null)return;let i=r.trim();if(i!==""){if(i.length>Y){n(new D("validation",`${e} on a <${t.tagName.toLowerCase()}> is ${i.length} characters, over the ${Y}-character limit, so it was ignored: "${i.slice(0,40)}\u2026"`));return}return i}}function lt(t,e){let n={},r=vn(t,bn,e);r!==void 0&&(n.$el_description=r,n.$el_description_source="annotation");let i=vn(t,kn,e);return i!==void 0&&(n.$el_action=i),n}function Sn(t,e){return !qr(t)||at(t)||dt(t)?{}:lt(ot(t),e)}function qr(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"&&typeof t.getAttribute=="function"}var Kr="$form_submitted",Br=new Set(["button","file","hidden","image","password","reset","submit"]),En=/(card|cc-?num|cvc|cvv|iban|security.?code)/i,Hr=t=>(t.getAttribute("autocomplete")??"").startsWith("cc-")||En.test(t.name)||En.test(t.id),Gr=t=>{let e=t.name.toLowerCase();return t instanceof HTMLInputElement&&t.type==="email"||e==="email"||t.getAttribute("autocomplete")==="email"?"$email":e==="name"||e==="full_name"||e==="fullname"||t.getAttribute("autocomplete")==="name"?"$name":null},jr=(t,e)=>{if(t.closest("[data-prodantix-ignore]")||t.hasAttribute("data-prodantix-form"))return null;let n={},r={};for(let i of Array.from(t.elements)){if(!(i instanceof HTMLInputElement||i instanceof HTMLSelectElement||i instanceof HTMLTextAreaElement)||!i.name||i.closest("[data-prodantix-ignore]")||Hr(i)||i instanceof HTMLInputElement&&(Br.has(i.type)||(i.type==="checkbox"||i.type==="radio")&&!i.checked))continue;let s=i.value.trim();if(s==="")continue;n[i.name]=s;let o=Gr(i);o&&(r[o]=s);}return {$answers:n,$form_id:t.id||`${e}#${Array.from(t.ownerDocument.forms).indexOf(t)}`,$page_url:t.ownerDocument.location?.href??"",$set:r,collected:true}},wn=(t,e=document)=>{let n=r=>{if(r.target instanceof HTMLFormElement){let i=jr(r.target,e.location?.pathname??"");i&&t.capture(Kr,{properties:i});}};return e.addEventListener("submit",n,true),()=>e.removeEventListener("submit",n,true)};var Vr=new Set(["input","select","textarea"]),Ur=new Set(["email","password","tel"]);function Pe(){return globalThis.location}function Cn(){return globalThis.document}function zr(){return globalThis.window??globalThis}function Wr(t){return typeof t=="object"&&t!==null&&typeof t.tagName=="string"}function Ae(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 Tn(){let t=Pe(),e=Cn(),n={};if(t){let r=Ae(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?Ae(e.referrer):void 0;r&&(n.$referrer=r);}return n}function Jr(t){return typeof t.className=="string"?t.className:""}function Yr(t){return Vr.has(t.tagName.toLowerCase())||Ur.has((t.getAttribute("type")??"").toLowerCase())}function Qr(t,e,n){let r={$el_tag:t.tagName.toLowerCase(),$event_type:"click"};if(e)return r;let i=n?t.textContent?.trim():void 0;i&&(r.$el_text=i.slice(0,255)),t.id&&(r.$el_id=t.id);let s=Jr(t);s&&(r.$el_classes=s);let o=t.getAttribute("href"),a=o?Ae(o,Pe()?.href):void 0;return a&&(r.$el_href=a),r}function ct(t){return (t??"").replace(/\s+/g," ").trim()}function re(t,e){return {$el_description:t,$el_description_source:e}}function Xr(t,e,n){if(!e&&n){let o=ct(t.getAttribute("aria-label"));if(o!==""&&o.length<=Y)return re(o,"aria_label");let a=ct(t.textContent);if(a!==""&&a.length<=Y)return re(a,"text")}let r=e?null:t.getAttribute("href"),i=r?Ae(r,Pe()?.href):void 0;if(i)return re(i,"href");let s=ct(t.getAttribute("role")).toLowerCase();return s===""?re(t.tagName.toLowerCase(),"tag"):re(s,"role")}function Zr(t,e){let n=new Set,r=(l,c)=>{if(n.has(l))return false;try{return c()}catch(p){return n.add(l),e(new D("config",`autocapture maskSelectors entry "${l}" is not a valid selector`,{cause:p})),false}},i=(l,c)=>l.matches?r(c,()=>l.matches?.(c)===!0):false,s=l=>{let c=l.querySelector?.bind(l);return c?c(`[${it}], .${st}`)!==null||t.some(p=>r(p,()=>c(p)!==null)):false},o=l=>{for(let c=l;c;c=c.parentElement){let p=c;if(t.some(S=>i(p,S)))return true}return false},a=l=>{for(let c=l;c;c=c.parentElement)if(Yr(c))return true;return false},u=l=>dt(l)||o(l);return {holdsMasked:s,isMasked:l=>u(l)||a(l),isOptedOut:u}}function ei(t){let e=globalThis.history,n=zr(),r="",i=()=>{let a=Pe(),u=a?`${a.pathname}${a.search}`:"";u!==r&&(r=u,t.capture(w.pageview,{properties:Tn()}));};if(i(),!e||!n)return ()=>{};let s=e.pushState.bind(e),o=e.replaceState.bind(e);return e.pushState=(...a)=>{s(...a),i();},e.replaceState=(...a)=>{o(...a),i();},n.addEventListener("popstate",i),()=>{e.pushState=s,e.replaceState=o,n.removeEventListener("popstate",i);}}function ti(t,e){let n=Cn();if(!n)return ()=>{};let r=e.onError??(()=>{}),i=Zr(e.maskSelectors??[],r),s=Ie(r),o=e.captureElementText??false,a=u=>{let l=u.target;if(!Wr(l)||at(l))return;let c=ot(l),p=i.isMasked(l)||i.holdsMasked(c),S=i.isOptedOut(l)?{}:lt(c,s),L=S.$el_description===void 0?Xr(c,p,o):{};t.capture(w.autocapture,{properties:{...Tn(),...Qr(c,p,o),...L,...S}});};return n.addEventListener("click",a,true),()=>n.removeEventListener("click",a,true)}function In(t,e={}){let n=[];return (e.pageviews??true)&&n.push(ei(t)),(e.clicks??true)&&n.push(ti(t,e)),e.collectForms===true&&typeof document<"u"&&n.push(wn(t)),()=>{for(let r of n)r();}}function ni(){return globalThis.document?.visibilityState==="hidden"}function ri(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 i=new n([r],{type:"application/json"});return e.sendBeacon(t.url,i)}catch{return false}}var _e=class{constructor(e={}){d(this,"fetchTransport");this.fetchTransport=new J(e);}async send(e){ni()&&ri(e)||await this.fetchTransport.send(e);}};var ut="prodantix:consent-ready",pt="prodantix:consent",An="__prodantixConsent";var Pn=(t,e)=>{t.takeCookielessId(e.anonymousId),e.consent!==null?t.setConsent(e.consent):e.rule==="notice"&&t.allowStorage();},_n=(t,e)=>{let n=e[An];n&&Pn(t,n);let r=s=>{let o=s.detail;o&&Pn(t,o);},i=s=>{let o=s.detail;o&&t.setConsent(o);};return e.addEventListener(ut,r),e.addEventListener(pt,i),()=>{e.removeEventListener(ut,r),e.removeEventListener(pt,i);}};var ii=/^\d{1,3}(\.\d{1,3}){3}$/,si=/^[a-z0-9.-]+$/i;function Fn(){return Math.random().toString(36).slice(2,12)}function Fe(t,e){let n=`${e}=`,r=[];for(let i of t.cookie.split(";")){let s=i.trim();s.startsWith(n)&&r.push(s.slice(n.length));}return r}function ie(t,e,n){let r=["Path=/",`Max-Age=${e}`,"SameSite=Lax"];return t&&r.push(`Domain=${t}`),n&&r.push("Secure"),r.join("; ")}function Ln(t,e,n,r){try{let i=`pdx_probe_${r()}`,s=r();t.cookie=`${i}=${s}; ${ie(e,60,n)}`;let o=Fe(t,i).includes(s);t.cookie=`${i}=; ${ie(e,0,n)}`;let a=Fe(t,i).includes(s);return o&&!a}catch{return false}}function gt(t){let e=t.replace(/^\[|\]$/g,"").toLowerCase();if(e.includes(":")||ii.test(e)||!e.includes("."))return [];let n=e.split("."),r=[];for(let i=n.length-2;i>=0;i-=1)r.push(n.slice(i).join("."));return r}function $n(t,e,n,r=Fn){for(let i of gt(t))if(Ln(e,i,n,r))return i}function oi(t){let e=new Map,n=JSON.parse(decodeURIComponent(t));if(n===null||typeof n!="object"||Array.isArray(n))return e;for(let[r,i]of Object.entries(n))typeof i=="string"&&e.set(r,i);return e}var mt=class{constructor(e,n,r,i){this.jar=e;this.name=n;this.domain=r;this.secure=i;}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=Fe(this.jar,this.name);e.length>1&&this.domain&&(this.jar.cookie=`${this.name}=; ${ie(void 0,0,this.secure)}`,e=Fe(this.jar,this.name));let n=e[0];return n?oi(n):new Map}catch{return new Map}}write(e){try{if(e.size===0){this.jar.cookie=`${this.name}=; ${ie(this.domain,0,this.secure)}`;return}let n=encodeURIComponent(JSON.stringify(Object.fromEntries(e)));this.jar.cookie=`${this.name}=${n}; ${ie(this.domain,31536e3,this.secure)}`;}catch{return}}};function ai(){return globalThis.document}function di(){return globalThis.location?.hostname??""}function li(){return globalThis.location?.protocol==="https:"}function ci(t){if(t===void 0)return;let e=t.startsWith(".")?t.slice(1):t;return si.test(e)?e.toLowerCase():void 0}function ft(t){let e="jar"in t?t.jar:ai();if(!e||globalThis.navigator?.cookieEnabled===false)return null;let r=t.random??Fn,i=t.secure??li(),s=t.hostname??di();try{let o=ci(t.domain)??$n(s,e,i,r);return Ln(e,o,i,r)?new mt(e,t.name,o,i):null}catch{return null}}var ui=["am","ar","bn","de","en","es","et","fil","fr","hi","id","ja","ko","pt","ru","sw","vi","zh"],Nn=t=>{let e=(t??"").toLowerCase().split("-")[0]??"";return ui.find(n=>n===e)??"en"};var pi=/^\$(survey|guide|checklist)_/,Rn=()=>({guides:{done:[],settled:[]},surveys:{settled:[]}});function mi(t,e){try{let n=t.getItem(e);if(n===null)return Rn();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 Rn()}}function On(t,e,n){let r=n();return r?Promise.resolve(r):new Promise(i=>{let s=t.document.createElement("script");s.src=e,s.async=true,s.onload=()=>i(n()??null),s.onerror=()=>i(null),t.document.head.append(s);})}function Mn(t,e,n){let r=`pdx_engage_${n.namespace}`,i=mi(n.storage,r),s=()=>{try{n.storage.setItem(r,JSON.stringify(i));}catch(v){n.onError(v);}},o=Nn(e.document.documentElement.lang||e.navigator.language),a=[],u=[],l=false,c=false,p=new Map,S=()=>On(e,`${n.edgeHost}/surveys.js`,()=>e.prodantixSurveys),L=()=>On(e,`${n.edgeHost}/guides.js`,()=>e.prodantixGuides),A=async v=>{if(l)return;let h=a.find(P=>sn(P,i.surveys,e.location.href,Date.now(),v));if(!h)return;l=true;let C=await S();if(!C){l=false;return}let E=()=>{i.surveys.settled=[...i.surveys.settled.filter(P=>P!==he(h)),he(h)],s(),l=false;};C.showSurvey(e.document,h,o,{onDismissed:()=>{t.captureSurveyDismissed(h),E();},onSent:P=>{t.captureSurveySent(h,P),E();},onShown:()=>{i.surveys.lastShownAt=Date.now(),s(),t.captureSurveyShown(h);}});},R=v=>{i.guides.settled=[...i.guides.settled.filter(h=>h!==W(v)),W(v)],s();},M=async v=>{let h=u.filter(y=>!p.has(y.id)&&ln(y,i.guides,e.location.href,Date.now(),v)),C=h.filter(y=>y.kind==="checklist"),E=c?void 0:h.find(y=>y.kind!=="checklist");if(C.length===0&&!E)return;E&&(c=true);let P=await L();if(!P){c=false;return}for(let y of C)p.has(y.id)||p.set(y.id,P.showChecklist(e.document,y,o,et(y,i.guides),{onDismissed:()=>{t.captureGuide(Ze,y),R(y),p.delete(y.id);},onShown:()=>t.captureGuide(Qe,y)}));if(!E)return;(E.kind==="tooltip"?P.showTooltip:P.showTour)(e.document,E,o,{onCompleted:()=>{t.captureGuide(Xe,E),R(E),c=false;},onDismissed:()=>{t.captureGuide(Ze,E),R(E),c=false;},onMissed:y=>t.captureGuide(an,E,y),onShown:()=>{i.guides.lastShownAt=Date.now(),s(),t.captureGuide(Qe,E);},onStep:y=>t.captureGuide(on,E,y)});},N=v=>{for(let h of u){let C=cn(h,v);!C||i.guides.done.includes(be(h,C.id))||i.guides.settled.includes(W(h))||(i.guides.done=[...i.guides.done,be(h,C.id)],t.captureGuide(dn,h,C.id),p.get(h.id)?.markDone(C.id),et(h,i.guides).length===h.steps.length&&(t.captureGuide(Xe,h),R(h),p.get(h.id)?.close(),p.delete(h.id)),s());}},O=v=>{n.surveys&&A(v).catch(n.onError),n.guides&&M(v).catch(n.onError);},G=t.onCapture(v=>{pi.test(v)||(N(v),O(v));}),q=()=>O();e.addEventListener("popstate",q);let B=async()=>{let v=E=>(n.onError(E),[]),[h,C]=await Promise.all([n.surveys?t.getSurveys(e.document.documentElement.lang||e.navigator.language).catch(v):[],n.guides?t.getGuides().catch(v):[]]);a=h,u=C,O();};return e.document.readyState==="loading"?e.document.addEventListener("DOMContentLoaded",()=>void B(),{once:true}):B(),()=>{G(),e.removeEventListener("popstate",q);for(let v of p.values())v.close();p.clear();}}var Kn="_pdx",Bn="~",gi=200,fi=/^\d+$/;function Hn(t,e,n,r){let i=yi(t.href);if(i===void 0||yt(i.search).some(vt))return;let s=Dn(i.hostname,n);s===void 0||s===Dn(r,n)||(i.search=`${i.search}${i.search?"&":"?"}${Kn}=${hi(e)}`,t.href=i.href);}function hi(t){return [t.anonymousId,t.sessionId,String(t.sessionStartedAt)].map(bi).join(Bn)}function Gn(t){let e=yt(t).find(vt);if(e===void 0)return;let n=vi(e).split(Bn);if(n.length!==3)return;let r=Le(n[0]),i=Le(n[1]),s=Le(n[2]);if(!(!qn(r)||!qn(i)||!ki(s)))return {anonymousId:r,sessionId:i,sessionStartedAt:Number(s)}}function jn(t,e){let n=yt(e.search),r=n.filter(s=>!vt(s));if(r.length===n.length)return;let i=r.length>0?`?${r.join("&")}`:"";t.replaceState(t.state,"",`${e.pathname}${i}${e.hash}`);}function Vn(t){if(t.location===void 0||typeof t.location.search!="string")return;let e=Gn(t.location.search);if(e===void 0)return;let n=mn(t.storage,t.shared,t.namespace,e.anonymousId);return fn(t.shared,t.namespace,{id:e.sessionId,startedAt:e.sessionStartedAt},t.now),t.history!==void 0&&jn(t.history,t.location),n}function ht(t,e,n){if(n.length===0)return ()=>{};let r=i=>{let s=Ei(i.target);if(s===void 0)return;let o=xi(e);o!==void 0&&Hn(s,o,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 yi(t){try{let e=new URL(t);return e.protocol==="http:"||e.protocol==="https:"?e:void 0}catch{return}}function Dn(t,e){let n=e.map(r=>r.replace(/^\./,"").toLowerCase());return gt(t).find(r=>n.includes(r))}function yt(t){return t.replace(/^\?/,"").split("&").filter(e=>e!=="")}function vt(t){let e=t.indexOf("=");return Le(e===-1?t:t.slice(0,e))===Kn}function vi(t){let e=t.indexOf("=");return e===-1?"":t.slice(e+1)}function bi(t){return encodeURIComponent(t).replace(/~/g,"%7E")}function Le(t){try{return decodeURIComponent(t)}catch{return}}function qn(t){if(t===void 0)return false;let e=de(t);return e>=1&&e<=gi}function ki(t){return t!==void 0&&fi.test(t)&&Number.isSafeInteger(Number(t))}function xi(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 Si(t){return typeof t.tagName=="string"&&t.tagName.toUpperCase()==="A"&&typeof t.href=="string"}function Ei(t){let e=typeof t=="object"?t:null;for(;e;){if(Si(e))return e;e=e.parentElement??null;}}var Un={maskAllInputs:true,maskAllText:false},wi=new Set(["email","password","tel"]);function zn(t){return t.replace(/\S/g,"*")}function $e(t,e,n){return Ci(e)||n.maskAllInputs?zn(t):t}function Ne(t,e){return e.maskAllText?zn(t):t}function Ci(t){return wi.has((t??"").toLowerCase())}var Ti=5e3,Re=class{constructor(e){this.options=e;d(this,"buffer",[]);d(this,"seq",0);d(this,"maxEvents");this.maxEvents=Math.min(Math.max(1,e.maxEvents),Ti);}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 bt=1,kt=3,Ii=9,Oe=class{constructor(){d(this,"next",1);}allocate(){let e=this.next;return this.next+=1,e}},Ai=new Set(["NOSCRIPT","SCRIPT"]);function Me(t,e,n,r){if(t.nodeType===kt){let i=e.allocate();return r?.(t,i),{id:i,textContent:Ne(t.textValue??"",n),type:"text"}}if(t.nodeType===Ii){let i=e.allocate();return r?.(t,i),{childNodes:Wn(t,e,n,r),id:i,type:"document"}}if(t.nodeType===bt){let i=t.tagName??"";if(Ai.has(i))return null;let s=e.allocate();return r?.(t,s),{attributes:Pi(t,n),childNodes:Wn(t,e,n,r),id:s,tagName:i,type:"element"}}return null}function Wn(t,e,n,r){let i=[];for(let s of t.childNodes??[]){let o=Me(s,e,n,r);o&&i.push(o);}return i}function Pi(t,e){let n={};for(let r of t.attributes??[])n[r.name]=r.value;return t.inputValue!==void 0&&(n.value=$e(t.inputValue,t.inputType,e)),n}async function Jn(t,e){let n=`${T(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 Yn=new Set(["INPUT","SELECT","TEXTAREA"]),De=class{constructor(e){this.options=e;d(this,"allocator",new Oe);d(this,"mirror",new Map);d(this,"chunker");d(this,"fetchImpl");d(this,"observer");d(this,"timer");d(this,"started",false);this.chunker=new Re({distinctId:e.distinctId,masked:e.mask.maskAllInputs,maxEvents:e.maxEvents,now:e.now,sessionId:e.sessionId}),this.fetchImpl=_(e.fetch);}start(){if(this.started)return;let e=_i(),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=Me(this.adapt(e),this.allocator,this.options.mask,(r,i)=>{let s=r.ref;s&&this.mirror.set(s,i);});n&&this.push(2,{node:n});}observeMutations(e){let n=globalThis.MutationObserver;n&&(this.observer=new n(r=>{for(let i of r)this.handleMutation(i);}),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:Ne(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 i=Me(this.adapt(r),this.allocator,this.options.mask,(s,o)=>{let a=s.ref;a&&this.mirror.set(a,o);});i&&this.push(3,{adds:[{node:i,parentId:n}]});}for(let r of Array.from(e.removedNodes)){let i=this.mirror.get(r);i!==void 0&&(this.push(3,{removes:[{id:i,parentId:n}]}),this.mirror.delete(r));}}}observeInteractions(e){e.addEventListener("input",n=>{let r=n.target;if(!r||!Yn.has(r.tagName))return;let i=this.mirror.get(r);i!==void 0&&this.push(3,{input:{id:i,value:$e(r.value??"",r.type,this.options.mask)}});},true),e.addEventListener("scroll",n=>{let r=n.target,i=r?this.mirror.get(r):void 0;this.push(3,{scroll:{id:i??0,x:r?.scrollLeft??0,y:r?.scrollTop??0}});},true);}adapt(e){let n={childNodes:[],nodeType:e.nodeType,ref:e};if(e.nodeType===kt)return n.textValue=e.textContent??"",n;if(e.nodeType===bt){let r=e;if(n.tagName=r.tagName,n.attributes=Array.from(r.attributes).map(i=>({name:i.name,value:i.value})),Yn.has(r.tagName)){let i=r;n.inputType=i.type,n.inputValue=i.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||Jn(e,{apiKey:this.options.apiKey,fetch:this.fetchImpl,replayHost:this.options.replayHost}).catch(n=>this.options.onError?.(n));}};function _i(){return globalThis.document}function Qn(t){let e=new De({apiKey:t.apiKey,distinctId:t.distinctId,flushIntervalMs:t.flushIntervalMs??5e3,mask:{...Un,...t.mask},maxEvents:t.maxEvents??200,now:t.now??(()=>Date.now()),onError:t.onError,replayHost:t.replayHost,sessionId:t.sessionId??je()});return e.start(),e}var qe=t=>`prodantix-cta:${t}`,Xn=t=>{try{let e=window.localStorage.getItem(qe(t));return e===null?null:Number(e)}catch{return null}},Zn=t=>{try{return window.sessionStorage.getItem(qe(t))!==null}catch{return false}},er=(t,e)=>{try{window.localStorage.setItem(qe(t),String(e)),window.sessionStorage.setItem(qe(t),String(e));}catch{return}},tr=(t,e,n,r)=>e===null?true:t.kind==="once"?false:t.kind==="session"?!n:r-e>=t.value*864e5;var H={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"}},Ke=t=>{let e=(t??"").toLowerCase().split("-")[0]??"";return e in H?e:"en"};var b="prodantix-cta",nr="prodantix-cta-style",Fi=`.${b}{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
|
+
.${b} *{box-sizing:border-box}
|
|
3
|
+
.${b} h2{font-size:18px;line-height:1.3;margin:0;font-weight:700}
|
|
4
|
+
.${b} p{margin:0;font-size:15px;line-height:1.5}
|
|
5
|
+
.${b} img{max-width:100%;height:auto;border-radius:var(--pdx-radius)}
|
|
6
|
+
.${b} .pdx-text{display:flex;flex-direction:column;gap:6px;flex:1 1 240px;min-width:0}
|
|
7
|
+
.${b} .pdx-actions{display:flex;gap:8px;flex-wrap:wrap}
|
|
8
|
+
.${b} 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
|
+
.${b} button[data-secondary]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
10
|
+
.${b} .pdx-close{min-width:44px;padding:0;background:transparent;color:inherit;font-size:22px;line-height:1}
|
|
11
|
+
.${b} .pdx-meta{font-size:12px;opacity:.85;flex-basis:100%}
|
|
12
|
+
.${b} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}
|
|
13
|
+
.${b}[data-kind=banner]{position:fixed;left:0;right:0;z-index:2147483000;border-radius:0}
|
|
14
|
+
.${b}[data-kind=banner][data-placement=top]{top:0}
|
|
15
|
+
.${b}[data-kind=banner][data-placement=bottom]{bottom:0}
|
|
16
|
+
.${b}[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
|
+
.${b}[data-kind=slide_in][data-placement=bottom_left]{left:16px}
|
|
18
|
+
.${b}[data-kind=slide_in][data-placement=bottom_right]{right:16px}
|
|
19
|
+
dialog.${b}{border:0;max-width:min(480px,calc(100vw - 32px));box-shadow:0 16px 48px rgba(0,0,0,.24)}
|
|
20
|
+
dialog.${b}::backdrop{background:rgba(0,0,0,.45)}
|
|
21
|
+
@media (prefers-reduced-motion:no-preference){.${b}[data-kind=slide_in],.${b}[data-kind=banner],dialog.${b}{animation:pdx-cta-in .2s ease-out}}
|
|
22
|
+
@keyframes pdx-cta-in{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}`,Li=()=>{if(document.getElementById(nr))return;let t=document.createElement("style");t.id=nr,t.textContent=Fi,document.head.append(t);},$i=(t,e)=>{let n=e.variant.style;for(let[r,i]of [["--pdx-background",n.background],["--pdx-text",n.text],["--pdx-button",n.button],["--pdx-button-text",n.buttonText],["--pdx-radius",`${n.radius}px`]])t.style.setProperty(r,i);},xt=(t,e,n,r)=>{let i=e.variant.content,s=H[n.language];if(t.className=b,t.dataset.kind=e.kind,t.dataset.placement=e.placement,t.dataset.ctaId=e.id,$i(t,e),i.image){let a=document.createElement("img");a.src=i.image,a.alt=i.imageAlt,a.loading="lazy",t.append(a);}let o=document.createElement("div");if(o.className="pdx-text",i.heading){let a=document.createElement("h2");a.textContent=i.heading,o.append(a);}if(i.body){let a=document.createElement("p");a.textContent=i.body,o.append(a);}if(t.append(o),i.buttons.length>0){let a=document.createElement("div");a.className="pdx-actions",i.buttons.forEach((u,l)=>{let c=document.createElement("button");c.type="button",c.textContent=u.label,c.dataset.action=`button-${l}`,l>0&&(c.dataset.secondary=""),c.addEventListener("click",()=>n.onButton(l)),a.append(c);}),t.append(a);}if(r){let a=document.createElement("button");a.type="button",a.className="pdx-close",a.dataset.action="close",a.textContent="\xD7",a.setAttribute("aria-label",s.close),a.title=s.close,a.addEventListener("click",r),t.append(a);}if(e.poweredBy){let a=document.createElement("p");a.className="pdx-meta",a.textContent=s.poweredBy,t.append(a);}},Be=(t,e)=>{Li();let n=t.variant.content.heading||t.variant.content.body;if(t.kind==="embedded"){let o=[...document.querySelectorAll("[data-prodantix-cta]")].filter(a=>a.dataset.prodantixCta===t.id).map(a=>{let u=document.createElement("section");return u.setAttribute("aria-label",n),xt(u,t,e,null),a.replaceChildren(u),u});return {destroy:()=>o.forEach(a=>a.remove()),elements:o}}if(t.kind==="popup"){let s=document.activeElement instanceof HTMLElement?document.activeElement:null,o=document.createElement("dialog");o.setAttribute("aria-label",n);let a=false,u=()=>{a||(a=true,o.open&&o.close(),o.remove(),s?.focus());},l=()=>{u(),e.onDismiss();};return xt(o,t,e,l),o.addEventListener("cancel",c=>{c.preventDefault(),l();}),document.body.append(o),o.showModal(),{destroy:u,elements:[o]}}let r=document.createElement("section");r.setAttribute("aria-label",n),t.kind==="slide_in"&&(r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"));let i=()=>r.remove();return xt(r,t,e,()=>{i(),e.onDismiss();}),document.body.append(r),{destroy:i,elements:[r]}};var rr=(t,e)=>{let n=false,r=[],i=()=>{n=true;for(let o of r.splice(0))o();},s=()=>{n||(i(),e());};if(t.kind==="load")queueMicrotask(s);else if(t.kind==="delay"){let o=setTimeout(s,t.value*1e3);r.push(()=>clearTimeout(o));}else if(t.kind==="scroll"){let o=()=>{let a=document.documentElement.scrollHeight-window.innerHeight;(a<=0||window.scrollY/a*100>=t.value)&&s();};window.addEventListener("scroll",o,{passive:true}),r.push(()=>window.removeEventListener("scroll",o)),o();}else if(t.kind==="exit"){let o=a=>{a.relatedTarget===null&&a.clientY<=0&&s();};document.addEventListener("mouseout",o),r.push(()=>document.removeEventListener("mouseout",o));}else {let o=t.value,a=l=>{try{return l.closest(o)!==null}catch{return false}},u=l=>{let c=l.target;c instanceof Element&&a(c)&&s();};document.addEventListener("click",u,true),r.push(()=>document.removeEventListener("click",u,true));}return i};var ir=t=>`prodantix-form-popup:${t}`,Ni=t=>{try{let e=window.localStorage.getItem(ir(t));return e===null?null:Number(e)}catch{return null}},Ri=(t,e)=>{try{window.localStorage.setItem(ir(t),String(e));}catch{return}},sr=(t,e,n)=>n===null||e-n>=t.periodDays*864e5,or=(t,e,n=Date.now)=>{if(!sr(t,n(),Ni(t.formId)))return ()=>{};let r=false,i=[],s=()=>{if(!r){r=true;for(let a of i)a();Ri(t.formId,n()),e();}},o=t.trigger;if(o.kind==="delay"){let a=setTimeout(s,o.seconds*1e3);i.push(()=>clearTimeout(a));}else if(o.kind==="scroll"){let a=()=>{let u=document.documentElement.scrollHeight-window.innerHeight;(u<=0||window.scrollY/u*100>=o.percent)&&s();};window.addEventListener("scroll",a,{passive:true}),i.push(()=>window.removeEventListener("scroll",a));}else {let a=u=>{u.relatedTarget===null&&u.clientY<=0&&s();};document.addEventListener("mouseout",a),i.push(()=>document.removeEventListener("mouseout",a));}return ()=>{r=true;for(let a of i)a();}};var Oi=t=>{let e=0;for(let n of t){if(n!==0)return e+Math.clz32(n)-24;e+=8;}return e},Mi=async t=>new Uint8Array(await crypto.subtle.digest("SHA-256",new TextEncoder().encode(t))),ar=async t=>{for(let e=0;;e+=1){let n=e.toString(36);if(Oi(await Mi(`${t.nonce}:${n}`))>=t.difficulty)return n}};var I="prodantix-form",Di=`.${I}{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
|
+
.${I} *{box-sizing:border-box}
|
|
24
|
+
.${I} .pdx-field{display:flex;flex-direction:column;gap:4px;margin:0 0 12px}
|
|
25
|
+
.${I} .pdx-field[hidden]{display:none}
|
|
26
|
+
.${I} label,.${I} legend{font-weight:600;font-size:14px}
|
|
27
|
+
.${I} input:not([type=checkbox]):not([type=radio]),.${I} select,.${I} 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
|
+
.${I} .pdx-choice{display:flex;align-items:center;gap:8px;min-height:44px}
|
|
29
|
+
.${I} .pdx-help,.${I} .pdx-meta{font-size:12px;opacity:.85}
|
|
30
|
+
.${I} .pdx-error{font-size:12px;font-weight:600}
|
|
31
|
+
.${I} 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
|
+
.${I} button[data-variant=back]{background:transparent;color:inherit;border:1px solid currentColor}
|
|
33
|
+
.${I} .pdx-actions{display:flex;gap:8px;justify-content:flex-end}
|
|
34
|
+
.${I} .pdx-hp{position:absolute;left:-10000px;width:1px;height:1px;overflow:hidden}
|
|
35
|
+
.${I} :focus-visible{outline:2px solid var(--pdx-button);outline-offset:2px}`,dr=t=>t==null||t===false||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0,lr=(t,e)=>{let n=t.condition;if(!n)return true;let r=e[n.field];return dr(r)?false:n.op==="is_set"?true:n.op==="equals"?typeof r=="string"&&r===n.values[0]:(Array.isArray(r)?r:[r]).some(s=>typeof s=="string"&&n.values.includes(s))},qi=t=>{let e=`${encodeURIComponent(t)}=`,n=document.cookie.split("; ").find(r=>r.startsWith(e));return n?decodeURIComponent(n.slice(e.length)):""},Ki=t=>{let e=t.hidden;return e?e.source==="fixed"?e.value:e.source==="query"?new URLSearchParams(window.location.search).get(e.value)??"":qi(e.value):""},m=(t,e={},n=[])=>{let r=Object.assign(document.createElement(t),e);return r.append(...n),r},Bi=(t,e,n)=>{let r=m("p",{className:"pdx-error",id:`${e}-error`}),i=t.help?m("p",{className:"pdx-help",id:`${e}-help`},[t.help]):null,s=[i?`${e}-help`:"",`${e}-error`].filter(Boolean).join(" "),o=m("div",{className:"pdx-field"});if(o.dataset.field=t.key,t.kind==="rich_text")return o.append(m("p",{},[t.label])),{error:r,field:t,focus:()=>{},read:()=>{},root:o};if(t.kind==="hidden")return o.hidden=true,{error:r,field:t,focus:()=>{},read:()=>Ki(t),root:o};if(t.kind==="radio"||t.kind==="checkboxes"){let c=m("fieldset",{});c.setAttribute("aria-describedby",s),t.required&&c.setAttribute("aria-required","true"),c.append(m("legend",{},[t.label]));let p=t.options.filter(L=>!L.archived).map((L,A)=>{let R=m("input",{id:`${e}-${A}`,name:e,type:t.kind==="radio"?"radio":"checkbox",value:L.value});return R.addEventListener("change",n),c.append(m("div",{className:"pdx-choice"},[R,m("label",{htmlFor:`${e}-${A}`},[L.label])])),R});return o.append(c,...i?[i]:[],r),{error:r,field:t,focus:()=>p[0]?.focus(),read:()=>{let L=p.filter(A=>A.checked).map(A=>A.value);return t.kind==="radio"?L[0]??"":L},root:o}}let a=m("label",{htmlFor:e},[t.label]),u;if(t.kind==="textarea")u=m("textarea",{id:e,placeholder:t.placeholder,rows:4});else if(t.kind==="dropdown")u=m("select",{id:e},[m("option",{value:""},[""]),...t.options.filter(c=>!c.archived).map(c=>m("option",{value:c.value},[c.label]))]);else if(t.kind==="checkbox")u=m("input",{id:e,type:"checkbox"});else {let c={date:"date",email:"email",file:"file",number:"number",phone:"tel"};u=m("input",{id:e,placeholder:t.placeholder,type:c[t.kind]??"text"}),t.kind==="email"&&(u.autocomplete="email");}return u.setAttribute("aria-describedby",s),t.required&&u.setAttribute("aria-required","true"),u.addEventListener("input",n),u.addEventListener("change",n),t.kind==="checkbox"?o.append(m("div",{className:"pdx-choice"},[u,a]),...i?[i]:[],r):o.append(a,...i?[i]:[],u,r),{error:r,field:t,focus:()=>u.focus(),read:()=>u instanceof HTMLInputElement&&u.type==="checkbox"?u.checked:t.kind==="number"?u.value===""?"":Number(u.value):u.value,root:o}},Hi=(t,e)=>{let n=e.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[i,s]of Object.entries(r))t.style.setProperty(i,s);},Gi=()=>{document.getElementById("prodantix-form-style")||document.head.append(m("style",{id:"prodantix-form-style",textContent:Di}));},He=(t,e)=>{let{formId:n,host:r,language:i}=e,s=H[i],o=p=>s[p],a=m("form",{className:I,noValidate:true});a.dataset.prodantixForm=n;let u=m("p",{className:"pdx-meta"});u.setAttribute("aria-live","polite"),u.setAttribute("role","status");let l=false,c=r.form(n).then(p=>{if(l)return;if(!p.accepting){a.replaceChildren(m("p",{className:"pdx-meta"},[o("closed")]));return}Gi(),Hi(a,p);let S=p.challenge?ar(p.challenge):null,L=false,A=[],R=()=>{let f={};for(let k of A.flat())if(!k.root.hidden||k.field.kind==="hidden"){let $=k.read();$!==void 0&&(f[k.field.key]=$);}return f},M=()=>{let f=R();for(let k of A.flat())k.field.kind!=="hidden"&&(k.root.hidden=!lr(k.field,f));},N=()=>{L||(L=true,r.capture(en,{$form_id:p.id,$form_version:p.version})),M();},O=p.steps.map((f,k)=>{let $=m("div",{});$.dataset.step=String(k),f.title&&$.append(m("p",{className:"pdx-meta"},[f.title]));let x=f.fields.map(K=>Bi(K,`pdx-${n}-${K.key}`,N));return A.push(x),$.append(...x.map(K=>K.root)),$}),G=m("input",{autocomplete:"off",name:p.honeypot,tabIndex:-1,type:"text"}),q=m("div",{className:"pdx-hp"},[G]);q.setAttribute("aria-hidden","true");let B=[],v=m("div",{});if(p.consent.processing){let f=m("input",{id:`pdx-${n}-consent`,type:"checkbox"});f.setAttribute("aria-required","true"),B.push({input:f,key:"$consent_processing"}),v.append(m("div",{className:"pdx-choice"},[f,m("label",{htmlFor:f.id},[p.consent.processing])]));}for(let f of p.consent.purposes){let k=m("input",{id:`pdx-${n}-consent-${f.key}`,type:"checkbox"});B.push({input:k,key:`$consent_${f.key}`}),v.append(m("div",{className:"pdx-choice"},[k,m("label",{htmlFor:k.id},[f.label])])),f.notice&&v.append(m("p",{className:"pdx-help"},[f.notice]));}let h=m("p",{className:"pdx-meta"}),C=m("button",{type:"button"},[o("back")]);C.dataset.variant="back";let E=m("button",{type:"button"},[o("next")]),P=m("button",{type:"submit"},[o("submit")]);C.dataset.action="back",E.dataset.action="next",P.dataset.action="submit";let Et=m("div",{className:"pdx-actions"},[C,E,P]),y=0,Ge=()=>{O.forEach((k,$)=>{k.hidden=$!==y;});let f=y===O.length-1;C.hidden=y===0,E.hidden=f,P.hidden=!f,v.hidden=!f,h.hidden=O.length<2,h.textContent=o("step").replace("{step}",String(y+1)).replace("{total}",String(O.length));},fr=()=>{for(let f of A.flat())f.error.textContent="",f.root.querySelector("[aria-invalid]")?.removeAttribute("aria-invalid");},wt=(f,k)=>{f.error.textContent=k,f.root.querySelector("input,select,textarea,fieldset")?.setAttribute("aria-invalid","true");},Ct=f=>{fr();let k=R(),$=(A[f]??[]).filter(x=>!x.root.hidden&&x.field.required&&dr(k[x.field.key]));for(let x of $)wt(x,o("required"));return $.length>0?(u.textContent=o("required"),$[0]?.focus(),false):true};C.addEventListener("click",()=>{y=Math.max(0,y-1),Ge();}),E.addEventListener("click",()=>{Ct(y)&&(y+=1,Ge());}),a.addEventListener("submit",f=>{if(f.preventDefault(),!Ct(y))return;let k={...R(),[p.honeypot]:G.value};for(let x of B)k[x.key]=x.input.checked;P.disabled=true,P.textContent=o("sending");let $=p.challenge;if(!$||!S){u.textContent=o("closed");return}S.then(x=>r.submit(n,k,$,x)).then(x=>{if(x.kind==="redirect"&&x.value.startsWith("https://")){window.location.assign(x.value);return}let K=m("p",{},[x.kind==="message"&&x.value?x.value:o("thanks")]);K.setAttribute("role","status"),a.replaceChildren(K);}).catch(x=>{P.disabled=false,P.textContent=o("submit");let K=x instanceof te?x.fields:[];for(let Tt of K){let It=A.flat().find(hr=>hr.field.key===Tt.field);It&&wt(It,Tt.rule==="required"?o("required"):o("invalid"));}u.textContent=K.length>0?o("invalid"):o("failed");});}),a.append(h,...O,q,v,Et,u),p.poweredBy&&e.poweredBy!==false&&a.append(m("p",{className:"pdx-meta"},[o("poweredBy")])),Ge(),M(),r.capture(Zt,{$form_id:p.id,$form_version:p.version});}).catch(()=>{l||a.replaceChildren(m("p",{className:"pdx-meta"},[o("closed")]));});return t.append(a),{destroy:()=>{l=true,a.remove();},ready:c}};var St=t=>({capture:(e,n)=>t.capture(e,{properties:n}),form:e=>t.getForm(e),submit:(e,n,r,i)=>t.submitForm(e,n,r,i)});var cr=t=>({capture:(e,n,r)=>t.captureCta(e,n,r),ctas:e=>t.getCtas(e),forms:St(t),isEnabled:e=>t.isFeatureEnabled(e),variant:async e=>(await t.getVariant(e))?.key??null}),ur=t=>t<768?"mobile":t<1024?"tablet":"desktop",pr=async(t,e)=>{let n=e.flag;return n?n.variant?await t.variant(n.key)===n.variant:t.isEnabled(n.key):true},ji=(t,e,n)=>{let r=document.createElement("dialog");r.className="prodantix-form-popup";let i=document.createElement("button");i.type="button",i.textContent="\xD7",i.setAttribute("aria-label",H[n].close),i.title=H[n].close,i.addEventListener("click",()=>r.close()),r.addEventListener("close",()=>r.remove()),r.append(i),document.body.append(r),He(r,{formId:t,host:e,language:n}),r.showModal();},Vi=()=>{let t=window.prodantix;typeof t=="function"&&t("open");},mr=async(t,e)=>{let n=e.now??Date.now,r=e.open??(l=>window.location.assign(l)),i=[],s=[],o=false,a=()=>{o=true;for(let l of i.splice(0))l();for(let l of s.splice(0))l.destroy();},u=await t.ctas({device:ur(window.innerWidth),language:document.documentElement.lang||e.language,url:window.location.href});for(let l of u)o||!tr(l.frequency,Xn(l.id),Zn(l.id),n())||!await pr(t,l)||i.push(rr(l.trigger,()=>{if(o)return;let c=Be(l,{language:e.language,onButton:p=>{t.capture(qt,l,p);let S=l.variant.content.buttons[p]?.action;S&&((S.kind!=="url"||l.kind!=="embedded")&&c.destroy(),S.kind==="url"?r(S.value):S.kind==="form"?ji(S.value,t.forms,e.language):S.kind==="messenger"?Vi():t.capture(Ve,l));},onDismiss:()=>t.capture(Ve,l)});c.elements.length!==0&&(s.push(c),er(l.id,n()),t.capture(Dt,l));}));return a},Ui=()=>{},zi=(t,e)=>{let n=cr(t),r=Ke(e??document.documentElement.lang),i=()=>mr(n,{language:r}).catch(c=>(console.error("[prodantix] the CTAs for this page could not be read",c),Ui)),s=i(),o=window.location.href,a=()=>{if(window.location.href===o)return;o=window.location.href,s=s.then(p=>(p(),i()));},u=history.pushState.bind(history),l=history.replaceState.bind(history);return history.pushState=(...c)=>{u(...c),a();},history.replaceState=(...c)=>{l(...c),a();},window.addEventListener("popstate",a),()=>{history.pushState=u,history.replaceState=l,window.removeEventListener("popstate",a),s.then(c=>c());}};var Q=class{constructor(e){d(this,"fetch");d(this,"host");d(this,"projectKey");d(this,"requestTimeoutMs");this.fetch=_(e.fetch),this.host=T(e.host),this.projectKey=e.projectKey,this.requestTimeoutMs=e.requestTimeoutMs??1e4;}async request(e,n){let r=this.fetch;if(!r)throw new g("no fetch implementation available in this runtime");let i=F(),s=i?setTimeout(()=>i.abort(),this.requestTimeoutMs):void 0;try{let o={authorization:`Bearer ${this.projectKey}`};n.body!==void 0&&(o["content-type"]="application/json");let a=await r(`${this.host}${e}`,{body:n.body,headers:o,method:n.method,signal:i?.signal});return {status:a.status,text:await a.text()}}finally{s!==void 0&&clearTimeout(s);}}async vapidKey(e){let{status:n,text:r}=await this.request(`/v1/push/vapid?appId=${encodeURIComponent(e)}`,{method:"GET"});if(n<200||n>=300)throw new g(`push key request failed with status ${n}`,n);return JSON.parse(r).publicKey}async register(e){let{status:n,text:r}=await this.request("/v1/push/devices",{body:JSON.stringify(e),method:"POST"});if(n<200||n>=300)throw new g(`push registration failed with status ${n}`,n);return JSON.parse(r).id}async opened(e){let{status:n}=await this.request("/v1/push/opens",{body:JSON.stringify({sendId:e}),method:"POST"});if(n<200||n>=300)throw new g(`push open report failed with status ${n}`,n)}};var gr="/prodantix-push-sw.js",Wi=()=>{let t=globalThis,e=t.navigator?.serviceWorker,n=t.Notification;return e===void 0||n===void 0||t.PushManager===void 0?null:{register:async r=>(await e.register(r),e.ready),requestPermission:()=>n.requestPermission()}},Ji=t=>{let e=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(Math.ceil(t.length/4)*4,"="),n=atob(e);return Uint8Array.from(n,r=>r.charCodeAt(0))},Yi=(t,e,n)=>`${t}${t.includes("?")?"&":"?"}host=${encodeURIComponent(e)}&key=${encodeURIComponent(n)}`,Qi=async t=>{let e=t.browser??Wi();if(e===null)return {status:"unsupported"};if(await e.requestPermission()!=="granted")return {status:"denied"};let r=new Q({fetch:t.fetch,host:t.host,projectKey:t.apiKey}),i=await e.register(Yi(t.serviceWorker??gr,t.host,t.apiKey)),s=await i.pushManager.getSubscription()??await i.pushManager.subscribe({applicationServerKey:Ji(await r.vapidKey(t.appId)),userVisibleOnly:true});return {deviceId:await r.register({appId:t.appId,distinctId:t.distinctId,permission:"granted",platform:"web",token:JSON.stringify(s.toJSON())}),status:"registered"}};function Xi(){return globalThis.navigator}function Zi(){return globalThis.document}function es(){return globalThis.history}function ts(){return globalThis.location}function ns(t){let e=t?.userAgentData?.platform??t?.platform;return e?e.slice(0,50):void 0}function rs(t){let e=()=>{t.flush();};globalThis.document?.addEventListener?.("visibilitychange",e),globalThis.addEventListener?.("pagehide",e);}function is(t,e,n){try{return ft({domain:e,name:`pdx_${ee(t)}`})??n}catch{return n}}function kd(t){let{autocaptureOptions:e,cookieDomain:n,guides:r,linkedDomains:i,replayHost:s,sessionReplay:o,sessionReplayOptions:a,surveys:u,...l}=t,c=Xi(),p=Pt(),S=l.storage??p,L=l.sharedStorage??is(l.apiKey,n,p),A=Vn({history:es(),location:ts(),namespace:ee(l.apiKey),now:(l.clock??oe).now().getTime(),shared:L,storage:S}),R=Ie(l.onError??(()=>{})),M={...l,describeElement:l.describeElement??(q=>Sn(q,R)),locale:l.locale??(c?.language?c.language.slice(0,20):void 0),os:l.os??ns(c),sessionTracking:l.sessionTracking??true,sharedStorage:L,storage:S,transport:l.transport??new _e({maxRetries:l.maxRetries,requestTimeoutMs:l.requestTimeoutMs})},N=new Te(M);A!==void 0&&N.alias(A),rs(N),M.consentMode==="banner"&&typeof window<"u"&&_n(N,window),(t.autocapture??true)&&In(N,{onError:M.onError,...e});let O=Zi();O&&i&&ht(O,N,i);let G=typeof window>"u"?void 0:window;if(G&&(u!==false||r!==false)&&Mn(N,G,{edgeHost:(l.flagsHost??l.host).replace(/\/+$/,""),guides:r!==false,namespace:ee(l.apiKey),onError:M.onError??(()=>{}),storage:S,surveys:u!==false}),o&&s){let q=()=>{Qn({apiKey:M.apiKey,distinctId:()=>N.distinctId,onError:M.onError,replayHost:s,...a,sessionId:a?.sessionId??N.sessionId});};if(N.isCookieless()){let B=N.onStorageAllowed(()=>{B(),q();});}else q();}return N}
|
|
36
|
+
exports.ACTION_ATTRIBUTE=kn;exports.ANNOTATION_ATTRIBUTE=bn;exports.ANNOTATION_MAX_LENGTH=Y;exports.DEFAULT_SERVICE_WORKER=gr;exports.IGNORE_ATTRIBUTE=xn;exports.PushClient=Q;exports.WebTransport=_e;exports.createCookieStorage=ft;exports.createWebClient=kd;exports.ctasHost=cr;exports.decorateLink=Hn;exports.deviceOf=ur;exports.flagAllows=pr;exports.formLanguage=Ke;exports.formsHost=St;exports.installAutocapture=In;exports.installLinkCarry=ht;exports.installSessionReplay=Qn;exports.readCarry=Gn;exports.registerPush=Qi;exports.renderCta=Be;exports.renderForm=He;exports.resolveCookieDomain=$n;exports.runCtas=mr;exports.startCtas=zi;exports.stripCarry=jn;exports.watchPopup=or;//# sourceMappingURL=web.cjs.map
|
|
2
37
|
//# sourceMappingURL=web.cjs.map
|
package/dist/web.d.cts
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-vogZuHfD.cjs';
|
|
2
|
+
import { T as Transport, i as TransportRequest, a as StorageAdapter, b as Consent, P as ProdantixConfig } from './types-BUXFV_aE.cjs';
|
|
3
|
+
import { a as FetchTransportOptions } from './transport-C9C4hqlF.cjs';
|
|
4
4
|
import { F as FetchLike } from './http-BCh716Vs.cjs';
|
|
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 };
|