@datacub/web 0.4.0 → 0.4.2
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/CHANGELOG.md +7 -0
- package/README.md +1 -1
- package/dist/datacub.js +4 -4
- package/dist/datacub.mjs +2 -2
- package/package.json +1 -1
- package/types/datacub.d.ts +2 -2
- package/types/index.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.4.2](https://github.com/datacub/sdk/compare/web-v0.4.0...web-v0.4.2) (2026-11-22)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* **web:** accept the 8-character project id (data-id), send to the host the script came from ([37df73b](https://github.com/datacub/sdk/commit/37df73bbf498362c55dff04363550ffcf66a7f90))
|
|
9
|
+
|
|
3
10
|
## 0.4.0
|
|
4
11
|
|
|
5
12
|
- `datacub.identify({ id, ...traits })` works: the id can be `id`, `userId` or `user_id`, and `fullName` and `phoneNumber` count as `name` and `phone`.
|
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ npm install @datacub/web
|
|
|
9
9
|
```ts
|
|
10
10
|
import datacub from '@datacub/web'
|
|
11
11
|
|
|
12
|
-
datacub.init('
|
|
12
|
+
datacub.init('YOUR_PROJECT_ID')
|
|
13
13
|
|
|
14
14
|
datacub.track('signup_completed', { plan: 'pro' }) // a custom event
|
|
15
15
|
datacub.identify(user.id, { email, name }) // after login
|
package/dist/datacub.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{var v={n:0},_t=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),ve=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Bt=(t)=>_t(t).replace(ve,""),ke=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function Y(t){let e="",n=0;for(let r of _t(t).matchAll(ke)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;e+=`${t.slice(n,r.index)}[redacted]`,n=r.index+r[0].length,v.n++}return e+t.slice(n)}function M(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return v.n++,"[redacted]";return Y(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var D=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),Ee=/(?:passw(?:or)?d|passcode|pwd|pin|pincode|otp|otpcode|onetimecode|mfacode|2facode|tfacode|smscode|secretkey|privatekey|authcode|verificationcode|securitycode|resetcode|cvv|cvc|cardnumber|ccnumber|creditcard|pan|iban|iqama|hawiya|nationalid|nid|idnumber|ssn|token|authorization|secret|apikey|sessionid|cookie|jwt|bearer|csrf|xsrf|passport|\u0643\u0644\u0645\u0647\u0627\u0644\u0645\u0631\u0648\u0631|\u0643\u0644\u0645\u0647\u0627\u0644\u0633\u0631|\u0627\u0644\u0631\u0645\u0632\u0627\u0644\u0633\u0631\u064a|\u0627\u0644\u0631\u0642\u0645\u0627\u0644\u0633\u0631\u064a|\u0631\u0645\u0632\u0627\u0644\u062a\u062d\u0642\u0642|\u0631\u0642\u0645\u0627\u0644\u0647\u0648\u064a\u0647|\u0627\u0644\u0647\u0648\u064a\u0647\u0627\u0644\u0648\u0637\u0646\u064a\u0647|\u0627\u0644\u0627\u0642\u0627\u0645\u0647|\u0627\u0644\u0628\u0637\u0627\u0642\u0647|\u0627\u0644\u0627\u064a\u0628\u0627\u0646)$/;function Kt(t,e){let n=t.normalize("NFKD").replace(/[\p{M}\u0640]/gu,"").replace(/\u0629/g,"\u0647").replace(/\u0649/g,"\u064a").replace(/(\p{Ll})(?=\p{Lu})|(\p{N}+)/gu,"$1 $2 ").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);while(n.length>1&&/^\p{N}+$/u.test(n[n.length-1]))n.pop();return!t||[...t].length>200||/\./.test(t)||D(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||Ee.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((r)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(r))}function U(t,e=0){if(typeof t==="string")return M(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&Y(`${t}`)!==`${t}`?"[redacted]":t:void 0;if(typeof t==="boolean"||t===null)return t;if(t instanceof Date)return Number.isNaN(+t)?void 0:t.toISOString();if(typeof t!=="object")return;if(e>2)return"[depth]";if(Array.isArray(t))return t.slice(0,100).map((i)=>U(i,e+1)).filter((i)=>i!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let r={};for(let[i,s]of Object.entries(t).slice(0,200)){let o=i.trim();if(Kt(o,!e))v.n++;else{let a=U(s,e+1);if(a!==void 0)r[o]=a}}return r}function Xt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=_t(e);let n=v.n;if(Y(e)!==e)return v.n=n+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e))return":uuid";if(/^[0-9a-f]{16,}$/i.test(e))return e.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(e)&&/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e))return":token";let r=e.replace(/\D/g,"").length;return r&&(r===e.length||r>3&&r*2>=e.length)?":id":t}var xe=/^(?:reset|invite|sid|token|jwt|otp|code|key|state|sig(?:nature)?|auth\w*|nonce|session\w*|hash|q|query|search\w*|s|keywords?|term|text|msg|message|comments?|\w*name|e?-?mail\w*|phone|mobile|tel|address\w*|city|zip|postcode|dob|birth\w*)$/i,Se=(t)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(t)&&!(t.length>=8&&/\d/.test(t)&&/[a-z]/i.test(t)),k=(t,e)=>Y(t.normalize("NFC")).slice(0,e),Vt=(t)=>t.split("/").map((e)=>e&&Xt(e)).join("/");function R(t,e,n){let r;try{r=new URL(t)}catch{return null}let i=r.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(i))return{url:i,path:i};if(!/^https?:$/.test(i))return null;let s=Vt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Vt(r.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(r.origin+s).slice(0,2048),path:s};for(let[a,p]of r.searchParams){let h=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(h)&&p)o.utm={...o.utm,[h.slice(4)]:M(p,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(h))o.click_id_type=h.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let y=Xt(p);o.q??={},o.q[k(a,64)]=Kt(a,!1)||xe.test(a)||p.length>40||!(y[0]===":"||Se(p))?"":y===":redacted"?"":y}}return o}function Yt(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||D(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Bt(e))?null:e}function vt(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),r=Bt(n),i=0;for(let s=0;s<r.length;s++){let o=+r[r.length-1-s];i+=s%2?o>4?o*2-9:o*2:o}return!n||[...n].length>128||/^(?:null|undefined|0|-1|anonymous|guest|\[object object\]|none|nan|false|true|user|test|unknown|not_authenticated|distinct_id|id)$/i.test(n)||D(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(r)||/^[2-6]\d{14,15}$/.test(r)&&i%10===0||e.includes(n)?null:n}var St="0.4.0",Wt=1800000,Re=86400000,Ae=34560000,Rt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,bt=".datacub-no-capture,[data-datacub-no-capture]",re=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,lt=!1,O={},ie=!0,At=0,Q=0,tt=0,et=0,nt={},It=new Set,Ot,C=0,ut=0,w,rt,ft,W,q={},oe=!1,Lt="",N="",Nt=!1,se=null,K="pending",Tt=!1,_=!1,G="",dt="",l="",E=null,j=null,P=null,g="",it=0,A=0,ae,H=0,X="",V=null,Ie=0,ot=0,pt=0,gt=0,ce="",st=!0,Z,Zt=0,u=[],Ct,le=!1,Jt="",z=!1,at=0,mt=!1,b=0,qt=[],x=Date.now;function ht(t){if(oe)console.warn(`[datacub] ${t}`)}var S=(t)=>(...e)=>{try{t(...e)}catch{}},f=(t,e,n)=>t.addEventListener(e,S(n),!0);function L(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let r=5,i=t;t&&r>=0;r--,i=Math.floor(i/256))e[r]=i&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(r)=>(r+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function B(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||G&&r.endsWith(G))t[r==="datacub_optout"?r:r.slice(0,-G.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function m(t,e,n=dt,r=e?Ae:0){try{c.cookie=`${t==="datacub_optout"?t:t+G}=${encodeURIComponent(e||"")};Path=/;Max-Age=${r};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function ue(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function Ut(){if(!_)return;let t=B(),e=t.datacub_id??null;if(e!==l)l=e&&Rt.test(e)?e:L(),m("datacub_id",l),g="";E=t.datacub_u??null,j=t.datacub_a??null;let[n,r,i]=(t.datacub_ss||"").split(".");if(ae=n,H=+i,n&&Rt.test(n)&&H&&(n!==g||H>A))g=n,it=+r,A=H}function fe(t,e){if(!g||t-A>Wt||t-it>Re){if(g=L(x()),it=A=t,_)m("datacub_id",l)}else if(e&&t>A)A=t;if(_&&(ae!==g||A-H>5000))m("datacub_ss",`${g}.${it}.${A}`,dt,Wt/1000)}function I(t){clearTimeout(Ct),le=t===0,Ct=t==null?void 0:setTimeout(S(Ht),t)}function de(t){if((t||u.length>19||c.visibilityState==="hidden")&&!le&&!at)I(0);else if(!Ct)I(5000)}var Oe=new TextEncoder;function d(t,e,n,r){if(!l)return;let i=x();if(Ut(),fe(i,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),v.n)e={...e,$d:v.n};let s=JSON.stringify([L(i),t,i,l,E,j,g,X||null,Ie++,+(K==="granted"),+_,V?.url,ce,e,n]),o=Oe.encode(s).length;if(o>31000){b++;return}v.n=0,u.push([s,o]),ye(),de(r)}function Ne(t,e){if(!l||typeof t!=="string")return;let n=Yt(t);if(!n)return ht("bad name");d(n,e&&typeof e==="object"&&!Array.isArray(e)&&U(e)||{})}function Mt(t=x()){if(ot)pt+=t-ot;ot=c.visibilityState==="visible"?t:0}var ct=()=>{C=innerWidth,ut=innerHeight,ce=C<360?"xs":C<480?"s":C<768?"m":C<1280?"l":"xl",gt=Math.max(gt,scrollY+ut)};function Dt(t,e){return nt[t]=(nt[t]||0)+1,nt[t]<=e}function pe(){if(!X)return;Mt();let t=pt-At;if(st&&t<1)return;let e=c.documentElement.scrollHeight,n={$v:t,$s:e?gt/e:null};if(st)n.$e=!0;if(Q)n.$ec=Q;if(tt)n.$rq=tt;if(et)n.$rf=et;Q=tt=et=0;try{Object.assign(n,q.l?.())}catch{}st=!0,At=pt,d("$pageleave",n)}function Ft(t,e){if(!l)return;let n=location.pathname+(Nt?location.hash.split("?")[0]:"");if(!t&&n===Jt)return;let r=R(location.href,Nt,O.query!==!1);if(!r)return;Jt=n,pe();let i={};if(V)i.$p=V.path;if(t&&!e)i.$b=!0;if(i.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":Ot,r.q)i.$q=r.q;if(O.title!==!1&&c.title)i.$T=k(c.title,200);V=r,X=L(x()),st=!1,pt=gt=ot=At=0,nt={},It.clear(),Mt(),ct(),i.$vw=C,i.$vh=ut;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}d("$pageview",i,[r.utm,r.click_id_type,s],e)}var kt=(t)=>()=>{if(!(Z&&t==="replace"&&Ot==="push"))Ot=t;w?.(),clearTimeout(Z),Z=setTimeout(S(()=>{Z=void 0,Ft()}),100)},ge=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?M(e,100):null},me=!0;function Te(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let r=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)r++;let i=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${i&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(i)?`#${k(i,64)}`:""}${r>1?`:${r}`:""}${s?`[${k(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function Ce(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${bt}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return k(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function qe(t,e){w?.(),rt=void 0;let n=c.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(c.activeElement===n&&!(s&&!e.defaultPrevented)&&!(rt&&!rt.defaultPrevented))d("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Pe(t){let e=t.target,n=t;if(!l||!(e instanceof Element)||e.closest(`${bt},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let r=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),i=!r&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=r||e,o={$t:s.localName,$n:ge(e),$g:Te(s)};if(s.closest("form"))o.$o=!0;if(n.detail)o.$cx=Math.round(n.clientX/C*100),o.$cy=Math.round(n.clientY/ut*100);if((r||i)&&O.text!==!1)o.$l=Ce(s);if(r){let a=r.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(r.localName==="input")o.$y=r.type;if(r.localName==="a"&&r.hasAttribute("href"))o.$h=R(r.href)?.url;d("$click",o)}if(me&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))d("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))qe(o,t)}var yt=(t)=>({$f:ge(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function je(t){let e=t.target;if(rt=t,!l||e.localName!=="form"||e.closest(bt))return;d("$form_submit",yt(e))}var he=(t)=>{let e=t.target.form;return l&&e&&O.forms!==!1&&!e.closest(bt)?e:null},Qt=new WeakSet;function Le(t){w?.();let e=he(t);if(e&&!Qt.has(e))Qt.add(e),d("$form_start",yt(e))}var J=new Map;function Ue(t){w?.();let e=he(t);if(!e)return;let n=J.get(e)||0;if(J.set(e,n+1),!n)setTimeout(S(()=>{if(Dt("i",10))d("$form_invalid",{...yt(e),$iv:J.get(e)});J.delete(e)}))}var te=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(R(e.slice(0,e.length-n.length))?.url??"")+n});function Et(t,e,n,r,i){let s=`${r}`.startsWith(N.slice(0,-5));if(!l||O.errors===!1||t==="resource"&&(!i||s))return;Q++;let o=e&&typeof e==="object"?e:{},a=k(te(`${o.message??n??(e&&e!==o?e:"")}`).replace(/(["'\u201c\u201d\u00ab\u00bb\u2018\u2019])[^"'\u201c\u201d\u00ab\u00bb\u2018\u2019]*["'\u201c\u201d\u00ab\u00bb\u2018\u2019]/g,'"\u2026"'),200),p=typeof o.stack==="string"?k(te(o.stack.split(`
|
|
2
|
-
`).filter((
|
|
3
|
-
`)),1000):void 0,
|
|
4
|
-
`)[0]}${r}`;if(
|
|
1
|
+
(()=>{var v={n:0},vt=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),ve=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Bt=(t)=>vt(t).replace(ve,""),ke=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function Z(t){let e="",n=0;for(let r of vt(t).matchAll(ke)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;e+=`${t.slice(n,r.index)}[redacted]`,n=r.index+r[0].length,v.n++}return e+t.slice(n)}function F(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return v.n++,"[redacted]";return Z(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var H=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),Ee=/(?:passw(?:or)?d|passcode|pwd|pin|pincode|otp|otpcode|onetimecode|mfacode|2facode|tfacode|smscode|secretkey|privatekey|authcode|verificationcode|securitycode|resetcode|cvv|cvc|cardnumber|ccnumber|creditcard|pan|iban|iqama|hawiya|nationalid|nid|idnumber|ssn|token|authorization|secret|apikey|sessionid|cookie|jwt|bearer|csrf|xsrf|passport|\u0643\u0644\u0645\u0647\u0627\u0644\u0645\u0631\u0648\u0631|\u0643\u0644\u0645\u0647\u0627\u0644\u0633\u0631|\u0627\u0644\u0631\u0645\u0632\u0627\u0644\u0633\u0631\u064a|\u0627\u0644\u0631\u0642\u0645\u0627\u0644\u0633\u0631\u064a|\u0631\u0645\u0632\u0627\u0644\u062a\u062d\u0642\u0642|\u0631\u0642\u0645\u0627\u0644\u0647\u0648\u064a\u0647|\u0627\u0644\u0647\u0648\u064a\u0647\u0627\u0644\u0648\u0637\u0646\u064a\u0647|\u0627\u0644\u0627\u0642\u0627\u0645\u0647|\u0627\u0644\u0628\u0637\u0627\u0642\u0647|\u0627\u0644\u0627\u064a\u0628\u0627\u0646)$/;function Kt(t,e){let n=t.normalize("NFKD").replace(/[\p{M}\u0640]/gu,"").replace(/\u0629/g,"\u0647").replace(/\u0649/g,"\u064a").replace(/(\p{Ll})(?=\p{Lu})|(\p{N}+)/gu,"$1 $2 ").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);while(n.length>1&&/^\p{N}+$/u.test(n[n.length-1]))n.pop();return!t||[...t].length>200||/\./.test(t)||H(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||Ee.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((r)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(r))}function D(t,e=0){if(typeof t==="string")return F(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&Z(`${t}`)!==`${t}`?"[redacted]":t:void 0;if(typeof t==="boolean"||t===null)return t;if(t instanceof Date)return Number.isNaN(+t)?void 0:t.toISOString();if(typeof t!=="object")return;if(e>2)return"[depth]";if(Array.isArray(t))return t.slice(0,100).map((i)=>D(i,e+1)).filter((i)=>i!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let r={};for(let[i,s]of Object.entries(t).slice(0,200)){let o=i.trim();if(Kt(o,!e))v.n++;else{let a=D(s,e+1);if(a!==void 0)r[o]=a}}return r}function Xt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=vt(e);let n=v.n;if(Z(e)!==e)return v.n=n+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e))return":uuid";if(/^[0-9a-f]{16,}$/i.test(e))return e.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(e)&&/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e))return":token";let r=e.replace(/\D/g,"").length;return r&&(r===e.length||r>3&&r*2>=e.length)?":id":t}var xe=/^(?:reset|invite|sid|token|jwt|otp|code|key|state|sig(?:nature)?|auth\w*|nonce|session\w*|hash|q|query|search\w*|s|keywords?|term|text|msg|message|comments?|\w*name|e?-?mail\w*|phone|mobile|tel|address\w*|city|zip|postcode|dob|birth\w*)$/i,Se=(t)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(t)&&!(t.length>=8&&/\d/.test(t)&&/[a-z]/i.test(t)),k=(t,e)=>Z(t.normalize("NFC")).slice(0,e),Vt=(t)=>t.split("/").map((e)=>e&&Xt(e)).join("/");function R(t,e,n){let r;try{r=new URL(t)}catch{return null}let i=r.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(i))return{url:i,path:i};if(!/^https?:$/.test(i))return null;let s=Vt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Vt(r.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(r.origin+s).slice(0,2048),path:s};for(let[a,f]of r.searchParams){let g=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(g)&&f)o.utm={...o.utm,[g.slice(4)]:F(f,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(g))o.click_id_type=g.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let m=Xt(f);o.q??={},o.q[k(a,64)]=Kt(a,!1)||xe.test(a)||f.length>40||!(m[0]===":"||Se(f))?"":m===":redacted"?"":m}}return o}function Yt(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||H(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Bt(e))?null:e}function kt(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),r=Bt(n),i=0;for(let s=0;s<r.length;s++){let o=+r[r.length-1-s];i+=s%2?o>4?o*2-9:o*2:o}return!n||[...n].length>128||/^(?:null|undefined|0|-1|anonymous|guest|\[object object\]|none|nan|false|true|user|test|unknown|not_authenticated|distinct_id|id)$/i.test(n)||H(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(r)||/^[2-6]\d{14,15}$/.test(r)&&i%10===0||e.includes(n)?null:n}var Rt="0.4.2",Wt=1800000,Re=86400000,Ae=34560000,At=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,$t=".datacub-no-capture,[data-datacub-no-capture]",re=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,ft=!1,O={},ie=!0,It=0,et=0,nt=0,rt=0,it={},Ot=new Set,Tt,C=0,dt=0,w,ot,pt,J,q={},oe=!1,Ut="",T="",Nt=!1,se=null,Y="pending",Ct=!1,_=!1,B="",gt="",l="",E=null,j=null,P=null,h="",st=0,A=0,ae,G=0,W="",K=null,Ie=0,at=0,mt=0,ht=0,ce="",ct=!0,Q,Zt=0,u=[],qt,le=!1,Jt="",V=!1,lt=0,bt=!1,y=0,Pt=[],x=Date.now;function yt(t){if(oe)console.warn(`[datacub] ${t}`)}var S=(t)=>(...e)=>{try{t(...e)}catch{}},d=(t,e,n)=>t.addEventListener(e,S(n),!0);function L(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let r=5,i=t;t&&r>=0;r--,i=Math.floor(i/256))e[r]=i&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(r)=>(r+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function X(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||B&&r.endsWith(B))t[r==="datacub_optout"?r:r.slice(0,-B.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function b(t,e,n=gt,r=e?Ae:0){try{c.cookie=`${t==="datacub_optout"?t:t+B}=${encodeURIComponent(e||"")};Path=/;Max-Age=${r};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function ue(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function Mt(){if(!_)return;let t=X(),e=t.datacub_id??null;if(e!==l)l=e&&At.test(e)?e:L(),b("datacub_id",l),h="";E=t.datacub_u??null,j=t.datacub_a??null;let[n,r,i]=(t.datacub_ss||"").split(".");if(ae=n,G=+i,n&&At.test(n)&&G&&(n!==h||G>A))h=n,st=+r,A=G}function fe(t,e){if(!h||t-A>Wt||t-st>Re){if(h=L(x()),st=A=t,_)b("datacub_id",l)}else if(e&&t>A)A=t;if(_&&(ae!==h||A-G>5000))b("datacub_ss",`${h}.${st}.${A}`,gt,Wt/1000)}function I(t){clearTimeout(qt),le=t===0,qt=t==null?void 0:setTimeout(S(zt),t)}function de(t){if((t||u.length>19||c.visibilityState==="hidden")&&!le&&!lt)I(0);else if(!qt)I(5000)}var Oe=new TextEncoder;function p(t,e,n,r){if(!l)return;let i=x();if(Mt(),fe(i,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),v.n)e={...e,$d:v.n};let s=JSON.stringify([L(i),t,i,l,E,j,h,W||null,Ie++,+(Y==="granted"),+_,K?.url,ce,e,n]),o=Oe.encode(s).length;if(o>31000){y++;return}v.n=0,u.push([s,o]),ye(),de(r)}function Te(t,e){if(!l||typeof t!=="string")return;let n=Yt(t);if(!n)return yt("bad name");p(n,e&&typeof e==="object"&&!Array.isArray(e)&&D(e)||{})}function Dt(t=x()){if(at)mt+=t-at;at=c.visibilityState==="visible"?t:0}var ut=()=>{C=innerWidth,dt=innerHeight,ce=C<360?"xs":C<480?"s":C<768?"m":C<1280?"l":"xl",ht=Math.max(ht,scrollY+dt)};function Ft(t,e){return it[t]=(it[t]||0)+1,it[t]<=e}function pe(){if(!W)return;Dt();let t=mt-It;if(ct&&t<1)return;let e=c.documentElement.scrollHeight,n={$v:t,$s:e?ht/e:null};if(ct)n.$e=!0;if(et)n.$ec=et;if(nt)n.$rq=nt;if(rt)n.$rf=rt;et=nt=rt=0;try{Object.assign(n,q.l?.())}catch{}ct=!0,It=mt,p("$pageleave",n)}function Ht(t,e){if(!l)return;let n=location.pathname+(Nt?location.hash.split("?")[0]:"");if(!t&&n===Jt)return;let r=R(location.href,Nt,O.query!==!1);if(!r)return;Jt=n,pe();let i={};if(K)i.$p=K.path;if(t&&!e)i.$b=!0;if(i.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":Tt,r.q)i.$q=r.q;if(O.title!==!1&&c.title)i.$T=k(c.title,200);K=r,W=L(x()),ct=!1,mt=ht=at=It=0,it={},Ot.clear(),Dt(),ut(),i.$vw=C,i.$vh=dt;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}p("$pageview",i,[r.utm,r.click_id_type,s],e)}var Et=(t)=>()=>{if(!(Q&&t==="replace"&&Tt==="push"))Tt=t;w?.(),clearTimeout(Q),Q=setTimeout(S(()=>{Q=void 0,Ht()}),100)},ge=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?F(e,100):null},me=!0;function Ne(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let r=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)r++;let i=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${i&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(i)?`#${k(i,64)}`:""}${r>1?`:${r}`:""}${s?`[${k(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function Ce(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${$t}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return k(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function qe(t,e){w?.(),ot=void 0;let n=c.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(c.activeElement===n&&!(s&&!e.defaultPrevented)&&!(ot&&!ot.defaultPrevented))p("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Pe(t){let e=t.target,n=t;if(!l||!(e instanceof Element)||e.closest(`${$t},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let r=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),i=!r&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=r||e,o={$t:s.localName,$n:ge(e),$g:Ne(s)};if(s.closest("form"))o.$o=!0;if(n.detail)o.$cx=Math.round(n.clientX/C*100),o.$cy=Math.round(n.clientY/dt*100);if((r||i)&&O.text!==!1)o.$l=Ce(s);if(r){let a=r.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(r.localName==="input")o.$y=r.type;if(r.localName==="a"&&r.hasAttribute("href"))o.$h=R(r.href)?.url;p("$click",o)}if(me&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))p("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))qe(o,t)}var wt=(t)=>({$f:ge(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function je(t){let e=t.target;if(ot=t,!l||e.localName!=="form"||e.closest($t))return;p("$form_submit",wt(e))}var he=(t)=>{let e=t.target.form;return l&&e&&O.forms!==!1&&!e.closest($t)?e:null},Qt=new WeakSet;function Le(t){w?.();let e=he(t);if(e&&!Qt.has(e))Qt.add(e),p("$form_start",wt(e))}var tt=new Map;function Ue(t){w?.();let e=he(t);if(!e)return;let n=tt.get(e)||0;if(tt.set(e,n+1),!n)setTimeout(S(()=>{if(Ft("i",10))p("$form_invalid",{...wt(e),$iv:tt.get(e)});tt.delete(e)}))}var te=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(R(e.slice(0,e.length-n.length))?.url??"")+n});function xt(t,e,n,r,i){let s=`${r}`.startsWith(T.slice(0,-5));if(!l||O.errors===!1||t==="resource"&&(!i||s))return;et++;let o=e&&typeof e==="object"?e:{},a=k(te(`${o.message??n??(e&&e!==o?e:"")}`).replace(/(["'\u201c\u201d\u00ab\u00bb\u2018\u2019])[^"'\u201c\u201d\u00ab\u00bb\u2018\u2019]*["'\u201c\u201d\u00ab\u00bb\u2018\u2019]/g,'"\u2026"'),200),f=typeof o.stack==="string"?k(te(o.stack.split(`
|
|
2
|
+
`).filter((m)=>/:\d+:\d+/.test(m)).slice(0,5).map((m)=>m.trim().replace(/@(?=https?:)/," ")).join(`
|
|
3
|
+
`)),1000):void 0,g=`${t}${o.name}${a}${f?.split(`
|
|
4
|
+
`)[0]}${r}`;if(Ot.has(g)||!Ft("e",20))return;Ot.add(g),p("$error",{$ek:t,$en:typeof o.name==="string"?k(o.name,64):void 0,$em:a||void 0,$es:f||void 0,$eu:r?R(`${r}`)?.url:void 0,$et:i})}function be(t,e,n,r,i){if(!l||O.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(T.slice(0,-5)))return;nt++;let o=x()-r,a=i==="AbortError"?"abort":i?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")rt++;if(Ft("r",30))p("$request",{$nm:`${t}`.toUpperCase().slice(0,10),$nu:R(s)?.url,$ns:n,$nd:o,$nk:a})}var ee=S(be);function ye(){let t=u.length-1000;if(t>0)y+=u.splice(0,t).length}function Me(){if(!J)try{let r=(s)=>+matchMedia(`(${s})`).matches,i=navigator;J=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,i.hardwareConcurrency,i.deviceMemory,i.maxTouchPoints,r("pointer:coarse")?"c":"f",r("prefers-color-scheme:dark")?"d":"l",r("prefers-reduced-motion:reduce")]}catch{J=Array(10)}let t=navigator.connection||{},e=q.h||[];return[...J,t.effectiveType,t.rtt,t.downlink,+t.saveData,e[0],e[1],-new Date().getTimezoneOffset()]}var jt=(t,e)=>`${JSON.stringify([3,Ut,x(),Rt,e,se,navigator.language,!!navigator.webdriver,Me()]).slice(0,-1)},${t.map((n)=>n[0])}]`;function Lt(t){let e=0,n=200;while(e<u.length&&e<100){if(n+=u[e][1]+1,n>t)break;e++}return u.splice(0,e||1)}var St=!1;async function zt(){if(I(),V)St=!0;if(V||bt||!u.length||!navigator.onLine)return;V=!0;let t=Lt(30720),e=y;y=0;let n=0;try{let r=await pt(T,{method:"POST",body:jt(t,e),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),i=r.status;if(i===401||i===403)bt=!0,u=[];else if(i===429||i>499)n=Math.min(+(r.headers.get("Retry-After")||0),3600)*1000||-1;else if(lt=0,i>299)y+=t.length+e;else if((await r.json().catch(()=>0)).directives?.includes("rotate_anon_id"))Gt()}catch{n=-1}V=!1;try{if(n&&l){if(u=t.concat(u),y+=e,ye(),++lt<11)I(n>0?n:Math.random()*Math.min(1000*2**lt,300000))}else if(u.length)de(St);St=!1}catch{}}function ne(){if(w?.(),pe(),I(),typeof Request==="function"&&"keepalive"in Request.prototype){let t=V?0:61440;while(u.length&&!bt&&t>2048){let e=Lt(t),n=y,r=jt(e,n);t-=r.length,y=0;let i=()=>{u=e.concat(u),y+=n,I(1000)};try{pt(T,{method:"POST",body:r,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(i)}catch{i();break}}}else{let t=61440;while(u.length&&!bt&&navigator.sendBeacon){let e=Lt(t);if(navigator.sendBeacon(T,jt(e,y)))y=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)I(1000)}function $e(t){Y=t?"granted":"not_required";for(let n of ue().reverse())if(b("datacub_tld","1",n,9),X().datacub_tld){b("datacub_tld","",n),gt=n;break}let e=X().datacub_id;if(l=e&&At.test(e)?e:L(),b("datacub_id",l),_=X().datacub_id===l,t){for(let n of["",gt])b("datacub_optout","",n);p("$consent",{$m:/^(?:banner|settings|api|cmp)$/.test(`${t.method}`)?t.method:"api",$P:typeof t.policyVersion==="string"?F(t.policyVersion,64):null})}if(P)_e(...P);if(P=null,Ht(!0,!0),ie&&!q.v){q.v=Rt,q.e=(n,r)=>n==="$form_fields"&&O.forms!==!1&&p(n,r),q.f=wt,window.__datacub=q;try{let n=c.createElement("script");n.src=`${T.slice(0,-5)}sdk/insights-${Rt}.min.js`,n.async=!0,n.referrerPolicy="no-referrer",n.integrity="sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z",n.crossOrigin="anonymous",n.setAttribute("fetchpriority","low"),(c.head||c.documentElement).append(n)}catch{}}}function De(t={}){if(!l&&(!Ct||t.overrideGPC))$e(t)}function we(){Y="denied",I(),u=[];for(let t of re)for(let e of["",...ue()])b(t,"",e);l=h=W="",E=j=P=K=null,_=!1,b("datacub_optout","1")}function _e(t,e,n){if(Mt(),E&&E!==t)Gt();if(e!==j&&_)b("datacub_a",e);if(j=e,E!==t){if(E=t,_)b("datacub_u",t);n.$A=l}for(let r in n)return p(n.$A?"$identify":"$set",n,0,!0)}function Fe(t,e){if(t&&typeof t==="object")e=t,t=e.id??e.userId??e.user_id;let n=[l,h,W],r=kt(t,n),i=e?.account==null?null:kt(e.account,n);if(!r||e?.account!=null&&!i)return yt("bad id");let s=e&&D(e)||{};for(let o in s){let a=/^(?:account|id|user_?id|(email)|(?:full_?)?(name)|(phone)(?:_?number)?)$/i.exec(o);if(a){let f=a[1]||a[2]||a[3];if(f)s[`$${f.toLowerCase()}`]=e[o];delete s[o]}}if(l)_e(r,i,s);else if(Y==="pending")P=[r,i,s]}function Gt(){if(P=null,!l)return;if(zt(),l=L(),E=j=null,h="",_){b("datacub_id",l);for(let t of re.slice(1))b(t,"")}}function He(t,e={}){if(oe=/^(?:localhost|127\.0\.0\.1|\[::1\])$|\.(?:localhost|test)$/.test(location.hostname),ft||typeof t!=="string")return;if(/^sk_/.test(t))return console.error("[datacub] refused a secret key. Use your project ID.");let n;try{n=new URL(e.apiHost||"https://in.datacub.to",location.href)}catch{}if(!/^(?:pk_(?:live|test)_[A-Za-z0-9]{24,48}|[a-z0-9]{8})$/.test(t))return yt("init: bad key");if(!n||n.username||n.password||!(n.protocol==="https:"||n.protocol==="http:"&&/^(?:localhost|127\.0\.0\.1)$/.test(n.hostname)))return yt("init: bad apiHost");if(ft=!0,Ut=t,B=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,T=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,Nt=e.hashRouting===!0,se=typeof e.release==="string"&&!H(e.release)?e.release.slice(0,64):null,O=e.capture&&typeof e.capture==="object"&&e.capture||{},ie=e.insights!==!1,pt=fetch,Ct=navigator.globalPrivacyControl===!0,Ct||X().datacub_optout)we();else if(!e.requireConsent)$e();if(me=e.rageClicks!==!1,e.autocapture!==!1)d(c,"click",Pe),d(c,"submit",je),d(c,"input",Le),d(c,"invalid",Ue);for(let r of["pointerdown","keydown","scroll"])d(c,r,(i)=>{let s=x();if(i.target===c)ut();if(r==="scroll")w?.();if(h&&c.visibilityState==="visible"&&s-Zt>5000)Zt=s,Mt(),fe(s,!0)});d(c,"visibilitychange",()=>{if(Dt(),c.visibilityState==="hidden")ne()}),ut(),d(window,"resize",ut),d(window,"pagehide",ne),d(window,"pageshow",(r)=>r.persisted&&Ht(!0)),d(window,"online",zt),d(window,"popstate",Et("pop")),d(window,"hashchange",Et("hash"));for(let r of["pushState","replaceState"]){let i=history[r];history[r]=function(...s){i.apply(this,s),Et(r==="pushState"?"push":"replace")()}}try{d(window,"error",(o)=>o instanceof ErrorEvent?xt("js",o.error,o.message,o.filename):xt("resource",0,"",o.target.src||o.target.href,o.target.localName)),d(window,"unhandledrejection",(o)=>xt("rejection",o.reason)),window.fetch=function(...o){let a=pt.apply(this,o);try{let f=x(),g=o[0],m=`${g.url||g}`,M=o[1]?.method||g.method||"GET";return a.then((N)=>{try{ee(M,N.url||m,N.type==="opaque"?200:N.status,f)}catch{}return N},(N)=>{throw ee(M,m,0,f,N?.name||"Error"),N})}catch{}return a};let r=XMLHttpRequest.prototype,{open:i,send:s}=r;r.open=function(...o){return this._x=o,i.apply(this,o)},r.send=function(...o){if(this._x&&!this._t)for(let a of["load","error","abort","timeout"])d(this,a,()=>be(this._x?.[0],`${this._x?.[1]}`,this.status,this._t,a==="load"?"":a==="abort"?"AbortError":"TypeError"));return this._t=x(),s.apply(this,o)}}catch{}}var z=(t)=>S((...e)=>{if(typeof window>"u")return;if(ft)t(...e);else if(Pt.length<100)Pt.push([t,e])}),ze={init:S((t,e)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;c=document;let n=S(()=>{He(t,e);for(let[r,i]of Pt.splice(0))if(ft)r(...i)});if(c.prerendering)d(c,"prerenderingchange",n);else n()}),track:z(Te),identify:z(Fe),reset:z(Gt),consent:{grant:z(De),revoke:z(we)},_fb:()=>[Y,_,Ut,T,l,E,h,p]},U=ze;var _t=window;if(!_t.datacub?._fb){let t=Array.isArray(_t.datacub)?_t.datacub:[],e=document.currentScript,n=e?.dataset,r=e?.src?new URL(e.src).origin:void 0,i=U.init;U.init=(o,a)=>{let f=a?.apiHost||r;return i(o,f?{...a,apiHost:f}:a)},_t.datacub=U;let s=n?.id||n?.key;if(s)U.init(s,{apiHost:n.apiHost,requireConsent:n.requireConsent!=null});for(let o of t)try{let[a,...f]=o,g=String(a).split(".").reduce((m,M)=>m&&Object.hasOwn(m,M)?m[M]:void 0,U);if(typeof g==="function")g(...f)}catch{}}})();
|
package/dist/datacub.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var v={n:0},$t=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),we=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Gt=(t)=>$t(t).replace(we,""),_e=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function Y(t){let e="",n=0;for(let r of $t(t).matchAll(_e)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;e+=`${t.slice(n,r.index)}[redacted]`,n=r.index+r[0].length,v.n++}return e+t.slice(n)}function M(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return v.n++,"[redacted]";return Y(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var D=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),ve=/(?:passw(?:or)?d|passcode|pwd|pin|pincode|otp|otpcode|onetimecode|mfacode|2facode|tfacode|smscode|secretkey|privatekey|authcode|verificationcode|securitycode|resetcode|cvv|cvc|cardnumber|ccnumber|creditcard|pan|iban|iqama|hawiya|nationalid|nid|idnumber|ssn|token|authorization|secret|apikey|sessionid|cookie|jwt|bearer|csrf|xsrf|passport|\u0643\u0644\u0645\u0647\u0627\u0644\u0645\u0631\u0648\u0631|\u0643\u0644\u0645\u0647\u0627\u0644\u0633\u0631|\u0627\u0644\u0631\u0645\u0632\u0627\u0644\u0633\u0631\u064a|\u0627\u0644\u0631\u0642\u0645\u0627\u0644\u0633\u0631\u064a|\u0631\u0645\u0632\u0627\u0644\u062a\u062d\u0642\u0642|\u0631\u0642\u0645\u0627\u0644\u0647\u0648\u064a\u0647|\u0627\u0644\u0647\u0648\u064a\u0647\u0627\u0644\u0648\u0637\u0646\u064a\u0647|\u0627\u0644\u0627\u0642\u0627\u0645\u0647|\u0627\u0644\u0628\u0637\u0627\u0642\u0647|\u0627\u0644\u0627\u064a\u0628\u0627\u0646)$/;function Vt(t,e){let n=t.normalize("NFKD").replace(/[\p{M}\u0640]/gu,"").replace(/\u0629/g,"\u0647").replace(/\u0649/g,"\u064a").replace(/(\p{Ll})(?=\p{Lu})|(\p{N}+)/gu,"$1 $2 ").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);while(n.length>1&&/^\p{N}+$/u.test(n[n.length-1]))n.pop();return!t||[...t].length>200||/\./.test(t)||D(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||ve.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((r)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(r))}function U(t,e=0){if(typeof t==="string")return M(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&Y(`${t}`)!==`${t}`?"[redacted]":t:void 0;if(typeof t==="boolean"||t===null)return t;if(t instanceof Date)return Number.isNaN(+t)?void 0:t.toISOString();if(typeof t!=="object")return;if(e>2)return"[depth]";if(Array.isArray(t))return t.slice(0,100).map((i)=>U(i,e+1)).filter((i)=>i!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let r={};for(let[i,s]of Object.entries(t).slice(0,200)){let o=i.trim();if(Vt(o,!e))v.n++;else{let a=U(s,e+1);if(a!==void 0)r[o]=a}}return r}function Bt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=$t(e);let n=v.n;if(Y(e)!==e)return v.n=n+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e))return":uuid";if(/^[0-9a-f]{16,}$/i.test(e))return e.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(e)&&/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e))return":token";let r=e.replace(/\D/g,"").length;return r&&(r===e.length||r>3&&r*2>=e.length)?":id":t}var ke=/^(?:reset|invite|sid|token|jwt|otp|code|key|state|sig(?:nature)?|auth\w*|nonce|session\w*|hash|q|query|search\w*|s|keywords?|term|text|msg|message|comments?|\w*name|e?-?mail\w*|phone|mobile|tel|address\w*|city|zip|postcode|dob|birth\w*)$/i,Ee=(t)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(t)&&!(t.length>=8&&/\d/.test(t)&&/[a-z]/i.test(t)),k=(t,e)=>Y(t.normalize("NFC")).slice(0,e),zt=(t)=>t.split("/").map((e)=>e&&Bt(e)).join("/");function R(t,e,n){let r;try{r=new URL(t)}catch{return null}let i=r.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(i))return{url:i,path:i};if(!/^https?:$/.test(i))return null;let s=zt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${zt(r.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(r.origin+s).slice(0,2048),path:s};for(let[a,p]of r.searchParams){let h=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(h)&&p)o.utm={...o.utm,[h.slice(4)]:M(p,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(h))o.click_id_type=h.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let y=Bt(p);o.q??={},o.q[k(a,64)]=Vt(a,!1)||ke.test(a)||p.length>40||!(y[0]===":"||Ee(p))?"":y===":redacted"?"":y}}return o}function Kt(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||D(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Gt(e))?null:e}function wt(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),r=Gt(n),i=0;for(let s=0;s<r.length;s++){let o=+r[r.length-1-s];i+=s%2?o>4?o*2-9:o*2:o}return!n||[...n].length>128||/^(?:null|undefined|0|-1|anonymous|guest|\[object object\]|none|nan|false|true|user|test|unknown|not_authenticated|distinct_id|id)$/i.test(n)||D(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(r)||/^[2-6]\d{14,15}$/.test(r)&&i%10===0||e.includes(n)?null:n}var Et="0.4.0",Xt=1800000,xe=86400000,Se=34560000,xt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,bt=".datacub-no-capture,[data-datacub-no-capture]",ee=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,lt=!1,N={},ne=!0,St=0,Q=0,tt=0,et=0,nt={},Rt=new Set,At,O=0,ut=0,w,rt,ft,W,P={},re=!1,qt="",T="",It=!1,ie=null,K="pending",Nt=!1,_=!1,G="",dt="",l="",E=null,j=null,q=null,g="",it=0,A=0,oe,H=0,X="",V=null,Re=0,ot=0,pt=0,gt=0,se="",st=!0,Z,Yt=0,u=[],Tt,ae=!1,Wt="",z=!1,at=0,mt=!1,b=0,Ct=[],x=Date.now;function ht(t){if(re)console.warn(`[datacub] ${t}`)}var S=(t)=>(...e)=>{try{t(...e)}catch{}},f=(t,e,n)=>t.addEventListener(e,S(n),!0);function L(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let r=5,i=t;t&&r>=0;r--,i=Math.floor(i/256))e[r]=i&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(r)=>(r+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function B(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||G&&r.endsWith(G))t[r==="datacub_optout"?r:r.slice(0,-G.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function m(t,e,n=dt,r=e?Se:0){try{c.cookie=`${t==="datacub_optout"?t:t+G}=${encodeURIComponent(e||"")};Path=/;Max-Age=${r};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function ce(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function jt(){if(!_)return;let t=B(),e=t.datacub_id??null;if(e!==l)l=e&&xt.test(e)?e:L(),m("datacub_id",l),g="";E=t.datacub_u??null,j=t.datacub_a??null;let[n,r,i]=(t.datacub_ss||"").split(".");if(oe=n,H=+i,n&&xt.test(n)&&H&&(n!==g||H>A))g=n,it=+r,A=H}function le(t,e){if(!g||t-A>Xt||t-it>xe){if(g=L(x()),it=A=t,_)m("datacub_id",l)}else if(e&&t>A)A=t;if(_&&(oe!==g||A-H>5000))m("datacub_ss",`${g}.${it}.${A}`,dt,Xt/1000)}function I(t){clearTimeout(Tt),ae=t===0,Tt=t==null?void 0:setTimeout(S(Dt),t)}function ue(t){if((t||u.length>19||c.visibilityState==="hidden")&&!ae&&!at)I(0);else if(!Tt)I(5000)}var Ae=new TextEncoder;function d(t,e,n,r){if(!l)return;let i=x();if(jt(),le(i,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),v.n)e={...e,$d:v.n};let s=JSON.stringify([L(i),t,i,l,E,j,g,X||null,Re++,+(K==="granted"),+_,V?.url,se,e,n]),o=Ae.encode(s).length;if(o>31000){b++;return}v.n=0,u.push([s,o]),he(),ue(r)}function Ie(t,e){if(!l||typeof t!=="string")return;let n=Kt(t);if(!n)return ht("bad name");d(n,e&&typeof e==="object"&&!Array.isArray(e)&&U(e)||{})}function Lt(t=x()){if(ot)pt+=t-ot;ot=c.visibilityState==="visible"?t:0}var ct=()=>{O=innerWidth,ut=innerHeight,se=O<360?"xs":O<480?"s":O<768?"m":O<1280?"l":"xl",gt=Math.max(gt,scrollY+ut)};function Ut(t,e){return nt[t]=(nt[t]||0)+1,nt[t]<=e}function fe(){if(!X)return;Lt();let t=pt-St;if(st&&t<1)return;let e=c.documentElement.scrollHeight,n={$v:t,$s:e?gt/e:null};if(st)n.$e=!0;if(Q)n.$ec=Q;if(tt)n.$rq=tt;if(et)n.$rf=et;Q=tt=et=0;try{Object.assign(n,P.l?.())}catch{}st=!0,St=pt,d("$pageleave",n)}function Mt(t,e){if(!l)return;let n=location.pathname+(It?location.hash.split("?")[0]:"");if(!t&&n===Wt)return;let r=R(location.href,It,N.query!==!1);if(!r)return;Wt=n,fe();let i={};if(V)i.$p=V.path;if(t&&!e)i.$b=!0;if(i.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":At,r.q)i.$q=r.q;if(N.title!==!1&&c.title)i.$T=k(c.title,200);V=r,X=L(x()),st=!1,pt=gt=ot=St=0,nt={},Rt.clear(),Lt(),ct(),i.$vw=O,i.$vh=ut;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}d("$pageview",i,[r.utm,r.click_id_type,s],e)}var _t=(t)=>()=>{if(!(Z&&t==="replace"&&At==="push"))At=t;w?.(),clearTimeout(Z),Z=setTimeout(S(()=>{Z=void 0,Mt()}),100)},de=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?M(e,100):null},pe=!0;function Ne(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let r=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)r++;let i=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${i&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(i)?`#${k(i,64)}`:""}${r>1?`:${r}`:""}${s?`[${k(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function Te(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${bt}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return k(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function Ce(t,e){w?.(),rt=void 0;let n=c.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(c.activeElement===n&&!(s&&!e.defaultPrevented)&&!(rt&&!rt.defaultPrevented))d("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Oe(t){let e=t.target,n=t;if(!l||!(e instanceof Element)||e.closest(`${bt},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let r=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),i=!r&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=r||e,o={$t:s.localName,$n:de(e),$g:Ne(s)};if(s.closest("form"))o.$o=!0;if(n.detail)o.$cx=Math.round(n.clientX/O*100),o.$cy=Math.round(n.clientY/ut*100);if((r||i)&&N.text!==!1)o.$l=Te(s);if(r){let a=r.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(r.localName==="input")o.$y=r.type;if(r.localName==="a"&&r.hasAttribute("href"))o.$h=R(r.href)?.url;d("$click",o)}if(pe&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))d("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))Ce(o,t)}var yt=(t)=>({$f:de(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function Pe(t){let e=t.target;if(rt=t,!l||e.localName!=="form"||e.closest(bt))return;d("$form_submit",yt(e))}var ge=(t)=>{let e=t.target.form;return l&&e&&N.forms!==!1&&!e.closest(bt)?e:null},Zt=new WeakSet;function qe(t){w?.();let e=ge(t);if(e&&!Zt.has(e))Zt.add(e),d("$form_start",yt(e))}var J=new Map;function je(t){w?.();let e=ge(t);if(!e)return;let n=J.get(e)||0;if(J.set(e,n+1),!n)setTimeout(S(()=>{if(Ut("i",10))d("$form_invalid",{...yt(e),$iv:J.get(e)});J.delete(e)}))}var Jt=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(R(e.slice(0,e.length-n.length))?.url??"")+n});function vt(t,e,n,r,i){let s=`${r}`.startsWith(T.slice(0,-5));if(!l||N.errors===!1||t==="resource"&&(!i||s))return;Q++;let o=e&&typeof e==="object"?e:{},a=k(Jt(`${o.message??n??(e&&e!==o?e:"")}`).replace(/(["'\u201c\u201d\u00ab\u00bb\u2018\u2019])[^"'\u201c\u201d\u00ab\u00bb\u2018\u2019]*["'\u201c\u201d\u00ab\u00bb\u2018\u2019]/g,'"\u2026"'),200),p=typeof o.stack==="string"?k(Jt(o.stack.split(`
|
|
1
|
+
var v={n:0},$t=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),we=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Gt=(t)=>$t(t).replace(we,""),_e=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function Y(t){let e="",n=0;for(let r of $t(t).matchAll(_e)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;e+=`${t.slice(n,r.index)}[redacted]`,n=r.index+r[0].length,v.n++}return e+t.slice(n)}function M(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return v.n++,"[redacted]";return Y(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var D=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),ve=/(?:passw(?:or)?d|passcode|pwd|pin|pincode|otp|otpcode|onetimecode|mfacode|2facode|tfacode|smscode|secretkey|privatekey|authcode|verificationcode|securitycode|resetcode|cvv|cvc|cardnumber|ccnumber|creditcard|pan|iban|iqama|hawiya|nationalid|nid|idnumber|ssn|token|authorization|secret|apikey|sessionid|cookie|jwt|bearer|csrf|xsrf|passport|\u0643\u0644\u0645\u0647\u0627\u0644\u0645\u0631\u0648\u0631|\u0643\u0644\u0645\u0647\u0627\u0644\u0633\u0631|\u0627\u0644\u0631\u0645\u0632\u0627\u0644\u0633\u0631\u064a|\u0627\u0644\u0631\u0642\u0645\u0627\u0644\u0633\u0631\u064a|\u0631\u0645\u0632\u0627\u0644\u062a\u062d\u0642\u0642|\u0631\u0642\u0645\u0627\u0644\u0647\u0648\u064a\u0647|\u0627\u0644\u0647\u0648\u064a\u0647\u0627\u0644\u0648\u0637\u0646\u064a\u0647|\u0627\u0644\u0627\u0642\u0627\u0645\u0647|\u0627\u0644\u0628\u0637\u0627\u0642\u0647|\u0627\u0644\u0627\u064a\u0628\u0627\u0646)$/;function Vt(t,e){let n=t.normalize("NFKD").replace(/[\p{M}\u0640]/gu,"").replace(/\u0629/g,"\u0647").replace(/\u0649/g,"\u064a").replace(/(\p{Ll})(?=\p{Lu})|(\p{N}+)/gu,"$1 $2 ").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);while(n.length>1&&/^\p{N}+$/u.test(n[n.length-1]))n.pop();return!t||[...t].length>200||/\./.test(t)||D(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||ve.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((r)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(r))}function U(t,e=0){if(typeof t==="string")return M(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&Y(`${t}`)!==`${t}`?"[redacted]":t:void 0;if(typeof t==="boolean"||t===null)return t;if(t instanceof Date)return Number.isNaN(+t)?void 0:t.toISOString();if(typeof t!=="object")return;if(e>2)return"[depth]";if(Array.isArray(t))return t.slice(0,100).map((i)=>U(i,e+1)).filter((i)=>i!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let r={};for(let[i,s]of Object.entries(t).slice(0,200)){let o=i.trim();if(Vt(o,!e))v.n++;else{let a=U(s,e+1);if(a!==void 0)r[o]=a}}return r}function Bt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=$t(e);let n=v.n;if(Y(e)!==e)return v.n=n+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e))return":uuid";if(/^[0-9a-f]{16,}$/i.test(e))return e.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(e)&&/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e))return":token";let r=e.replace(/\D/g,"").length;return r&&(r===e.length||r>3&&r*2>=e.length)?":id":t}var ke=/^(?:reset|invite|sid|token|jwt|otp|code|key|state|sig(?:nature)?|auth\w*|nonce|session\w*|hash|q|query|search\w*|s|keywords?|term|text|msg|message|comments?|\w*name|e?-?mail\w*|phone|mobile|tel|address\w*|city|zip|postcode|dob|birth\w*)$/i,Ee=(t)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(t)&&!(t.length>=8&&/\d/.test(t)&&/[a-z]/i.test(t)),k=(t,e)=>Y(t.normalize("NFC")).slice(0,e),Ht=(t)=>t.split("/").map((e)=>e&&Bt(e)).join("/");function R(t,e,n){let r;try{r=new URL(t)}catch{return null}let i=r.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(i))return{url:i,path:i};if(!/^https?:$/.test(i))return null;let s=Ht(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Ht(r.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(r.origin+s).slice(0,2048),path:s};for(let[a,p]of r.searchParams){let h=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(h)&&p)o.utm={...o.utm,[h.slice(4)]:M(p,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(h))o.click_id_type=h.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let y=Bt(p);o.q??={},o.q[k(a,64)]=Vt(a,!1)||ke.test(a)||p.length>40||!(y[0]===":"||Ee(p))?"":y===":redacted"?"":y}}return o}function Kt(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||D(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Gt(e))?null:e}function wt(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),r=Gt(n),i=0;for(let s=0;s<r.length;s++){let o=+r[r.length-1-s];i+=s%2?o>4?o*2-9:o*2:o}return!n||[...n].length>128||/^(?:null|undefined|0|-1|anonymous|guest|\[object object\]|none|nan|false|true|user|test|unknown|not_authenticated|distinct_id|id)$/i.test(n)||D(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(r)||/^[2-6]\d{14,15}$/.test(r)&&i%10===0||e.includes(n)?null:n}var Et="0.4.2",Xt=1800000,xe=86400000,Se=34560000,xt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,bt=".datacub-no-capture,[data-datacub-no-capture]",ee=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,lt=!1,N={},ne=!0,St=0,Q=0,tt=0,et=0,nt={},Rt=new Set,At,O=0,ut=0,w,rt,ft,W,P={},re=!1,jt="",T="",It=!1,ie=null,K="pending",Nt=!1,_=!1,G="",dt="",l="",E=null,q=null,j=null,g="",it=0,A=0,oe,z=0,X="",V=null,Re=0,ot=0,pt=0,gt=0,se="",st=!0,Z,Yt=0,u=[],Tt,ae=!1,Wt="",H=!1,at=0,mt=!1,b=0,Ct=[],x=Date.now;function ht(t){if(re)console.warn(`[datacub] ${t}`)}var S=(t)=>(...e)=>{try{t(...e)}catch{}},f=(t,e,n)=>t.addEventListener(e,S(n),!0);function L(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let r=5,i=t;t&&r>=0;r--,i=Math.floor(i/256))e[r]=i&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(r)=>(r+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function B(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||G&&r.endsWith(G))t[r==="datacub_optout"?r:r.slice(0,-G.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function m(t,e,n=dt,r=e?Se:0){try{c.cookie=`${t==="datacub_optout"?t:t+G}=${encodeURIComponent(e||"")};Path=/;Max-Age=${r};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function ce(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function qt(){if(!_)return;let t=B(),e=t.datacub_id??null;if(e!==l)l=e&&xt.test(e)?e:L(),m("datacub_id",l),g="";E=t.datacub_u??null,q=t.datacub_a??null;let[n,r,i]=(t.datacub_ss||"").split(".");if(oe=n,z=+i,n&&xt.test(n)&&z&&(n!==g||z>A))g=n,it=+r,A=z}function le(t,e){if(!g||t-A>Xt||t-it>xe){if(g=L(x()),it=A=t,_)m("datacub_id",l)}else if(e&&t>A)A=t;if(_&&(oe!==g||A-z>5000))m("datacub_ss",`${g}.${it}.${A}`,dt,Xt/1000)}function I(t){clearTimeout(Tt),ae=t===0,Tt=t==null?void 0:setTimeout(S(Dt),t)}function ue(t){if((t||u.length>19||c.visibilityState==="hidden")&&!ae&&!at)I(0);else if(!Tt)I(5000)}var Ae=new TextEncoder;function d(t,e,n,r){if(!l)return;let i=x();if(qt(),le(i,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),v.n)e={...e,$d:v.n};let s=JSON.stringify([L(i),t,i,l,E,q,g,X||null,Re++,+(K==="granted"),+_,V?.url,se,e,n]),o=Ae.encode(s).length;if(o>31000){b++;return}v.n=0,u.push([s,o]),he(),ue(r)}function Ie(t,e){if(!l||typeof t!=="string")return;let n=Kt(t);if(!n)return ht("bad name");d(n,e&&typeof e==="object"&&!Array.isArray(e)&&U(e)||{})}function Lt(t=x()){if(ot)pt+=t-ot;ot=c.visibilityState==="visible"?t:0}var ct=()=>{O=innerWidth,ut=innerHeight,se=O<360?"xs":O<480?"s":O<768?"m":O<1280?"l":"xl",gt=Math.max(gt,scrollY+ut)};function Ut(t,e){return nt[t]=(nt[t]||0)+1,nt[t]<=e}function fe(){if(!X)return;Lt();let t=pt-St;if(st&&t<1)return;let e=c.documentElement.scrollHeight,n={$v:t,$s:e?gt/e:null};if(st)n.$e=!0;if(Q)n.$ec=Q;if(tt)n.$rq=tt;if(et)n.$rf=et;Q=tt=et=0;try{Object.assign(n,P.l?.())}catch{}st=!0,St=pt,d("$pageleave",n)}function Mt(t,e){if(!l)return;let n=location.pathname+(It?location.hash.split("?")[0]:"");if(!t&&n===Wt)return;let r=R(location.href,It,N.query!==!1);if(!r)return;Wt=n,fe();let i={};if(V)i.$p=V.path;if(t&&!e)i.$b=!0;if(i.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":At,r.q)i.$q=r.q;if(N.title!==!1&&c.title)i.$T=k(c.title,200);V=r,X=L(x()),st=!1,pt=gt=ot=St=0,nt={},Rt.clear(),Lt(),ct(),i.$vw=O,i.$vh=ut;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}d("$pageview",i,[r.utm,r.click_id_type,s],e)}var _t=(t)=>()=>{if(!(Z&&t==="replace"&&At==="push"))At=t;w?.(),clearTimeout(Z),Z=setTimeout(S(()=>{Z=void 0,Mt()}),100)},de=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?M(e,100):null},pe=!0;function Ne(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let r=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)r++;let i=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${i&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(i)?`#${k(i,64)}`:""}${r>1?`:${r}`:""}${s?`[${k(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function Te(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${bt}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return k(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function Ce(t,e){w?.(),rt=void 0;let n=c.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(c.activeElement===n&&!(s&&!e.defaultPrevented)&&!(rt&&!rt.defaultPrevented))d("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Oe(t){let e=t.target,n=t;if(!l||!(e instanceof Element)||e.closest(`${bt},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let r=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),i=!r&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=r||e,o={$t:s.localName,$n:de(e),$g:Ne(s)};if(s.closest("form"))o.$o=!0;if(n.detail)o.$cx=Math.round(n.clientX/O*100),o.$cy=Math.round(n.clientY/ut*100);if((r||i)&&N.text!==!1)o.$l=Te(s);if(r){let a=r.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(r.localName==="input")o.$y=r.type;if(r.localName==="a"&&r.hasAttribute("href"))o.$h=R(r.href)?.url;d("$click",o)}if(pe&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))d("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))Ce(o,t)}var yt=(t)=>({$f:de(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function Pe(t){let e=t.target;if(rt=t,!l||e.localName!=="form"||e.closest(bt))return;d("$form_submit",yt(e))}var ge=(t)=>{let e=t.target.form;return l&&e&&N.forms!==!1&&!e.closest(bt)?e:null},Zt=new WeakSet;function je(t){w?.();let e=ge(t);if(e&&!Zt.has(e))Zt.add(e),d("$form_start",yt(e))}var J=new Map;function qe(t){w?.();let e=ge(t);if(!e)return;let n=J.get(e)||0;if(J.set(e,n+1),!n)setTimeout(S(()=>{if(Ut("i",10))d("$form_invalid",{...yt(e),$iv:J.get(e)});J.delete(e)}))}var Jt=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(R(e.slice(0,e.length-n.length))?.url??"")+n});function vt(t,e,n,r,i){let s=`${r}`.startsWith(T.slice(0,-5));if(!l||N.errors===!1||t==="resource"&&(!i||s))return;Q++;let o=e&&typeof e==="object"?e:{},a=k(Jt(`${o.message??n??(e&&e!==o?e:"")}`).replace(/(["'\u201c\u201d\u00ab\u00bb\u2018\u2019])[^"'\u201c\u201d\u00ab\u00bb\u2018\u2019]*["'\u201c\u201d\u00ab\u00bb\u2018\u2019]/g,'"\u2026"'),200),p=typeof o.stack==="string"?k(Jt(o.stack.split(`
|
|
2
2
|
`).filter((y)=>/:\d+:\d+/.test(y)).slice(0,5).map((y)=>y.trim().replace(/@(?=https?:)/," ")).join(`
|
|
3
3
|
`)),1000):void 0,h=`${t}${o.name}${a}${p?.split(`
|
|
4
|
-
`)[0]}${r}`;if(Rt.has(h)||!Ut("e",20))return;Rt.add(h),d("$error",{$ek:t,$en:typeof o.name==="string"?k(o.name,64):void 0,$em:a||void 0,$es:p||void 0,$eu:r?R(`${r}`)?.url:void 0,$et:i})}function me(t,e,n,r,i){if(!l||N.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(T.slice(0,-5)))return;tt++;let o=x()-r,a=i==="AbortError"?"abort":i?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")et++;if(Ut("r",30))d("$request",{$nm:`${t}`.toUpperCase().slice(0,10),$nu:R(s)?.url,$ns:n,$nd:o,$nk:a})}var Qt=S(me);function he(){let t=u.length-1000;if(t>0)b+=u.splice(0,t).length}function Le(){if(!W)try{let r=(s)=>+matchMedia(`(${s})`).matches,i=navigator;W=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,i.hardwareConcurrency,i.deviceMemory,i.maxTouchPoints,r("pointer:coarse")?"c":"f",r("prefers-color-scheme:dark")?"d":"l",r("prefers-reduced-motion:reduce")]}catch{W=Array(10)}let t=navigator.connection||{},e=P.h||[];return[...W,t.effectiveType,t.rtt,t.downlink,+t.saveData,e[0],e[1],-new Date().getTimezoneOffset()]}var Ot=(t,e)=>`${JSON.stringify([3,
|
|
4
|
+
`)[0]}${r}`;if(Rt.has(h)||!Ut("e",20))return;Rt.add(h),d("$error",{$ek:t,$en:typeof o.name==="string"?k(o.name,64):void 0,$em:a||void 0,$es:p||void 0,$eu:r?R(`${r}`)?.url:void 0,$et:i})}function me(t,e,n,r,i){if(!l||N.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(T.slice(0,-5)))return;tt++;let o=x()-r,a=i==="AbortError"?"abort":i?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")et++;if(Ut("r",30))d("$request",{$nm:`${t}`.toUpperCase().slice(0,10),$nu:R(s)?.url,$ns:n,$nd:o,$nk:a})}var Qt=S(me);function he(){let t=u.length-1000;if(t>0)b+=u.splice(0,t).length}function Le(){if(!W)try{let r=(s)=>+matchMedia(`(${s})`).matches,i=navigator;W=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,i.hardwareConcurrency,i.deviceMemory,i.maxTouchPoints,r("pointer:coarse")?"c":"f",r("prefers-color-scheme:dark")?"d":"l",r("prefers-reduced-motion:reduce")]}catch{W=Array(10)}let t=navigator.connection||{},e=P.h||[];return[...W,t.effectiveType,t.rtt,t.downlink,+t.saveData,e[0],e[1],-new Date().getTimezoneOffset()]}var Ot=(t,e)=>`${JSON.stringify([3,jt,x(),Et,e,ie,navigator.language,!!navigator.webdriver,Le()]).slice(0,-1)},${t.map((n)=>n[0])}]`;function Pt(t){let e=0,n=200;while(e<u.length&&e<100){if(n+=u[e][1]+1,n>t)break;e++}return u.splice(0,e||1)}var kt=!1;async function Dt(){if(I(),H)kt=!0;if(H||mt||!u.length||!navigator.onLine)return;H=!0;let t=Pt(30720),e=b;b=0;let n=0;try{let r=await ft(T,{method:"POST",body:Ot(t,e),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),i=r.status;if(i===401||i===403)mt=!0,u=[];else if(i===429||i>499)n=Math.min(+(r.headers.get("Retry-After")||0),3600)*1000||-1;else if(at=0,i>299)b+=t.length+e;else if((await r.json().catch(()=>0)).directives?.includes("rotate_anon_id"))Ft()}catch{n=-1}H=!1;try{if(n&&l){if(u=t.concat(u),b+=e,he(),++at<11)I(n>0?n:Math.random()*Math.min(1000*2**at,300000))}else if(u.length)ue(kt);kt=!1}catch{}}function te(){if(w?.(),fe(),I(),typeof Request==="function"&&"keepalive"in Request.prototype){let t=H?0:61440;while(u.length&&!mt&&t>2048){let e=Pt(t),n=b,r=Ot(e,n);t-=r.length,b=0;let i=()=>{u=e.concat(u),b+=n,I(1000)};try{ft(T,{method:"POST",body:r,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(i)}catch{i();break}}}else{let t=61440;while(u.length&&!mt&&navigator.sendBeacon){let e=Pt(t);if(navigator.sendBeacon(T,Ot(e,b)))b=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)I(1000)}function be(t){K=t?"granted":"not_required";for(let n of ce().reverse())if(m("datacub_tld","1",n,9),B().datacub_tld){m("datacub_tld","",n),dt=n;break}let e=B().datacub_id;if(l=e&&xt.test(e)?e:L(),m("datacub_id",l),_=B().datacub_id===l,t){for(let n of["",dt])m("datacub_optout","",n);d("$consent",{$m:/^(?:banner|settings|api|cmp)$/.test(`${t.method}`)?t.method:"api",$P:typeof t.policyVersion==="string"?M(t.policyVersion,64):null})}if(j)$e(...j);if(j=null,Mt(!0,!0),ne&&!P.v){P.v=Et,P.e=(n,r)=>n==="$form_fields"&&N.forms!==!1&&d(n,r),P.f=yt,window.__datacub=P;try{let n=c.createElement("script");n.src=`${T.slice(0,-5)}sdk/insights-${Et}.min.js`,n.async=!0,n.referrerPolicy="no-referrer",n.integrity="sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z",n.crossOrigin="anonymous",n.setAttribute("fetchpriority","low"),(c.head||c.documentElement).append(n)}catch{}}}function Ue(t={}){if(!l&&(!Nt||t.overrideGPC))be(t)}function ye(){K="denied",I(),u=[];for(let t of ee)for(let e of["",...ce()])m(t,"",e);l=g=X="",E=q=j=V=null,_=!1,m("datacub_optout","1")}function $e(t,e,n){if(qt(),E&&E!==t)Ft();if(e!==q&&_)m("datacub_a",e);if(q=e,E!==t){if(E=t,_)m("datacub_u",t);n.$A=l}for(let r in n)return d(n.$A?"$identify":"$set",n,0,!0)}function Me(t,e){if(t&&typeof t==="object")e=t,t=e.id??e.userId??e.user_id;let n=[l,g,X],r=wt(t,n),i=e?.account==null?null:wt(e.account,n);if(!r||e?.account!=null&&!i)return ht("bad id");let s=e&&U(e)||{};for(let o in s){let a=/^(?:account|id|user_?id|(email)|(?:full_?)?(name)|(phone)(?:_?number)?)$/i.exec(o);if(a){let p=a[1]||a[2]||a[3];if(p)s[`$${p.toLowerCase()}`]=e[o];delete s[o]}}if(l)$e(r,i,s);else if(K==="pending")j=[r,i,s]}function Ft(){if(j=null,!l)return;if(Dt(),l=L(),E=q=null,g="",_){m("datacub_id",l);for(let t of ee.slice(1))m(t,"")}}function De(t,e={}){if(re=/^(?:localhost|127\.0\.0\.1|\[::1\])$|\.(?:localhost|test)$/.test(location.hostname),lt||typeof t!=="string")return;if(/^sk_/.test(t))return console.error("[datacub] refused a secret key. Use your project ID.");let n;try{n=new URL(e.apiHost||"https://in.datacub.to",location.href)}catch{}if(!/^(?:pk_(?:live|test)_[A-Za-z0-9]{24,48}|[a-z0-9]{8})$/.test(t))return ht("init: bad key");if(!n||n.username||n.password||!(n.protocol==="https:"||n.protocol==="http:"&&/^(?:localhost|127\.0\.0\.1)$/.test(n.hostname)))return ht("init: bad apiHost");if(lt=!0,jt=t,G=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,T=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,It=e.hashRouting===!0,ie=typeof e.release==="string"&&!D(e.release)?e.release.slice(0,64):null,N=e.capture&&typeof e.capture==="object"&&e.capture||{},ne=e.insights!==!1,ft=fetch,Nt=navigator.globalPrivacyControl===!0,Nt||B().datacub_optout)ye();else if(!e.requireConsent)be();if(pe=e.rageClicks!==!1,e.autocapture!==!1)f(c,"click",Oe),f(c,"submit",Pe),f(c,"input",je),f(c,"invalid",qe);for(let r of["pointerdown","keydown","scroll"])f(c,r,(i)=>{let s=x();if(i.target===c)ct();if(r==="scroll")w?.();if(g&&c.visibilityState==="visible"&&s-Yt>5000)Yt=s,qt(),le(s,!0)});f(c,"visibilitychange",()=>{if(Lt(),c.visibilityState==="hidden")te()}),ct(),f(window,"resize",ct),f(window,"pagehide",te),f(window,"pageshow",(r)=>r.persisted&&Mt(!0)),f(window,"online",Dt),f(window,"popstate",_t("pop")),f(window,"hashchange",_t("hash"));for(let r of["pushState","replaceState"]){let i=history[r];history[r]=function(...s){i.apply(this,s),_t(r==="pushState"?"push":"replace")()}}try{f(window,"error",(o)=>o instanceof ErrorEvent?vt("js",o.error,o.message,o.filename):vt("resource",0,"",o.target.src||o.target.href,o.target.localName)),f(window,"unhandledrejection",(o)=>vt("rejection",o.reason)),window.fetch=function(...o){let a=ft.apply(this,o);try{let p=x(),h=o[0],y=`${h.url||h}`,zt=o[1]?.method||h.method||"GET";return a.then((C)=>{try{Qt(zt,C.url||y,C.type==="opaque"?200:C.status,p)}catch{}return C},(C)=>{throw Qt(zt,y,0,p,C?.name||"Error"),C})}catch{}return a};let r=XMLHttpRequest.prototype,{open:i,send:s}=r;r.open=function(...o){return this._x=o,i.apply(this,o)},r.send=function(...o){if(this._x&&!this._t)for(let a of["load","error","abort","timeout"])f(this,a,()=>me(this._x?.[0],`${this._x?.[1]}`,this.status,this._t,a==="load"?"":a==="abort"?"AbortError":"TypeError"));return this._t=x(),s.apply(this,o)}}catch{}}var F=(t)=>S((...e)=>{if(typeof window>"u")return;if(lt)t(...e);else if(Ct.length<100)Ct.push([t,e])}),Fe={init:S((t,e)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;c=document;let n=S(()=>{De(t,e);for(let[r,i]of Ct.splice(0))if(lt)r(...i)});if(c.prerendering)f(c,"prerenderingchange",n);else n()}),track:F(Ie),identify:F(Me),reset:F(Ft),consent:{grant:F(Ue),revoke:F(ye)},_fb:()=>[K,_,jt,T,l,E,g,d]},Ve=Fe;export{Et as VERSION,Ve as default};
|
package/package.json
CHANGED
package/types/datacub.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// datacub web SDK 0.4.
|
|
2
|
-
export declare const VERSION = "0.4.
|
|
1
|
+
// datacub web SDK 0.4.2, for the script tag. Save as datacub.d.ts in your project: `datacub` is then typed.
|
|
2
|
+
export declare const VERSION = "0.4.2";
|
|
3
3
|
export type Property = string | number | boolean | null | Date | Property[] | {
|
|
4
4
|
[key: string]: Property;
|
|
5
5
|
};
|
package/types/index.d.ts
CHANGED