getmoxel 0.1.0 → 0.1.1
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/PROTOCOL.md +6 -3
- package/README.md +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/m.js +1 -1
- package/package.json +1 -1
package/PROTOCOL.md
CHANGED
|
@@ -33,9 +33,11 @@ so browsers skip the CORS preflight. Sent with `navigator.sendBeacon` when
|
|
|
33
33
|
the page is hiding, otherwise `fetch` with `keepalive: true`,
|
|
34
34
|
`credentials: "omit"`.
|
|
35
35
|
|
|
36
|
-
Responses: `202` accepted (also for dropped bots), `400` malformed, `
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
Responses: `202` accepted (also for dropped bots), `400` malformed, `402`
|
|
37
|
+
the site's account has used its free actions and has no plan, or the page's
|
|
38
|
+
address used them up under any account and this one has no plan, so nothing
|
|
39
|
+
is stored, `403` wrong origin, `404` unknown site key, `429` slow down or daily
|
|
40
|
+
limit reached, `503` the write could not finish. The tracker never retries a 4xx. It retries
|
|
39
41
|
a network failure or a 5xx once, after 2 seconds.
|
|
40
42
|
|
|
41
43
|
The answer names the caller's origin in `Access-Control-Allow-Origin` and
|
|
@@ -64,6 +66,7 @@ a browser logs an error otherwise. No cookie is ever set.
|
|
|
64
66
|
| `now` | integer ms | Browser clock when the batch was sent. The server uses `now - ts` to place each event, so a wrong clock does not matter. |
|
|
65
67
|
| `w` | integer | Viewport width in CSS pixels. |
|
|
66
68
|
| `tz` | string, optional | IANA time zone from `Intl`. |
|
|
69
|
+
| `wd` | 1, optional | Sent when `navigator.webdriver` is true (a script drives the browser) and `allowAutomation` is off. The server keeps the batch as a bot visit and counts nothing. |
|
|
67
70
|
| `ev` | array, 1 to 50 | Events, oldest first. |
|
|
68
71
|
|
|
69
72
|
A batch is at most 50 events and 32 KB. The tracker flushes every 5 seconds,
|
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Optional attributes:
|
|
|
24
24
|
- `data-endpoint`: where events are sent. Defaults to the origin the script was loaded from.
|
|
25
25
|
- `data-respect-dnt`: do nothing when Do Not Track or Global Privacy Control is on.
|
|
26
26
|
- `data-debug`: log each batch to the browser console.
|
|
27
|
-
- `data-allow-automation`:
|
|
27
|
+
- `data-allow-automation`: count visits from automated browsers as people. Off by default, so those visits are marked as bots and left out of your numbers.
|
|
28
28
|
|
|
29
29
|
Count your own events with `window.moxel.track("signup", 49)`. The second
|
|
30
30
|
argument is optional and must be a number.
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface MoxelOptions {
|
|
|
11
11
|
respectDnt?: boolean;
|
|
12
12
|
/** Log each batch to the console. */
|
|
13
13
|
debug?: boolean;
|
|
14
|
-
/**
|
|
14
|
+
/** Count a browser driven by a test tool as a person. Off by default, so its visits are marked as bots. */
|
|
15
15
|
allowAutomation?: boolean;
|
|
16
16
|
}
|
|
17
17
|
|
package/dist/index.js
CHANGED
|
@@ -37,7 +37,6 @@ function createTracker(opts) {
|
|
|
37
37
|
if (typeof window === "undefined" || typeof document === "undefined") return NOOP;
|
|
38
38
|
const nav = window.navigator || {};
|
|
39
39
|
if (o.respectDnt && (nav.doNotTrack === "1" || nav.doNotTrack === "yes" || nav.globalPrivacyControl === true)) return NOOP;
|
|
40
|
-
if (nav.webdriver && !o.allowAutomation) return NOOP;
|
|
41
40
|
if (!o.siteKey) return NOOP;
|
|
42
41
|
return build(o, nav);
|
|
43
42
|
} catch (e) {
|
|
@@ -85,6 +84,7 @@ function build(o, nav) {
|
|
|
85
84
|
function envelope(evs) {
|
|
86
85
|
const b = { v: 1, k: o.siteKey, d: depth, now: Date.now(), w: Math.round(window.innerWidth) || 0 };
|
|
87
86
|
if (typeof tz === "string" && tz) b.tz = tz;
|
|
87
|
+
if (nav.webdriver === true && !o.allowAutomation) b.wd = 1;
|
|
88
88
|
b.ev = evs;
|
|
89
89
|
return b;
|
|
90
90
|
}
|
package/dist/m.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var At="https://www.getmoxel.com",rt={chill:0,vibey:1,feral:2},Lt={pv:0,lv:0,fs:0,fx:0,ev:0,fm:0,sd:1,cl:1,fa:1,ff:2,fb:2,fe:2,rg:2,sp:2},xt=5e3,kt=20,Ot=50,_t=32768,It=1e3,Pt=500,Ct=20,Ut=8,qt="a[href],button,input[type=submit],input[type=button],input[type=reset],input[type=image],[role=button],[role=link],[data-moxel]",Dt="[data-moxel-ignore]",Ft={hidden:1,password:1,submit:1,button:1,reset:1,image:1},N={track(){},flush(){},stop(){}},M=(r,c)=>String(r==null?"":r).replace(/\s+/g," ").trim().slice(0,c),at=r=>r.replace(/[^\s@/]+@[^\s@/]+\.[^\s@/]+/g,"*").replace(/\d{6,}/g,"*"),ct=r=>r.split("/").map(c=>/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(c)||/^(?=.*\d)(?=.*[a-z])[a-z0-9_]{16,}$/i.test(c)?"*":at(c)).join("/").slice(0,200),H=()=>location.protocol==="file:"?"/"+location.pathname.split("/").pop():location.pathname,st=r=>String(r==null?"":r).slice(0,2e3).replace(/\s+/g," ").trim().slice(0,600),f=(r,c)=>r.getAttribute(c);function Rt(r){let c=r.length;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);u>127&&(c+=u>2047?2:1)}return c}function lt(r){try{let c=r||{};if(typeof window=="undefined"||typeof document=="undefined")return N;let l=window.navigator||{};return c.respectDnt&&(l.doNotTrack==="1"||l.doNotTrack==="yes"||l.globalPrivacyControl===!0)||l.webdriver&&!c.allowAutomation||!c.siteKey?N:Xt(c,l)}catch(c){return N}}function Xt(r,c){let l=r.depth in rt?r.depth:"vibey",u=rt[l],Y=String(r.endpoint||At||"").replace(/\/+$/,"");if(!Y)return N;let z=Y+"/e",K=!!r.debug,$=[],x;try{x=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){}let m=t=>function(){try{return t.apply(this,arguments)}catch(n){K&&console.warn("[moxel]",n)}},p=(t,n,e,o)=>{let i=m(e);t.addEventListener(n,i,o),$.push(()=>t.removeEventListener(n,i,o))},g=()=>performance.now(),k=()=>document.visibilityState!=="hidden",v=t=>!!(t&&t.closest&&t.closest(Dt)),S=[],O=0;function h(t,n,e){if(u<Lt[t]||S.length>=It)return;let o={t,ts:Date.now(),p:ct(String(n))};for(let i in e)e[i]!==void 0&&(o[i]=e[i]);S.push(o),S.length>=kt?E():O||(O=setTimeout(E,xt))}function J(t){let n={v:1,k:r.siteKey,d:l,now:Date.now(),w:Math.round(window.innerWidth)||0};return typeof x=="string"&&x&&(n.tz=x),n.ev=t,n}function j(t,n,e,o){if(K)try{console.log("[moxel]",JSON.parse(n))}catch(a){}if(e&&c.sendBeacon)try{if(c.sendBeacon(z,n))return}catch(a){}if(typeof fetch!="function")return;let i=()=>{o||setTimeout(()=>j(t,JSON.stringify(J(t)),!1,1),2e3)};try{fetch(z,{method:"POST",body:n,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).then(a=>{a.status>=500&&i()},i).catch(()=>{})}catch(a){}}function E(t){for(clearTimeout(O),O=0;S.length;){let n=Math.min(S.length,Ot),e;for(;e=JSON.stringify(J(S.slice(0,n))),!(n<=1||Rt(e)<=_t);)n=Math.ceil(n/2);j(S.splice(0,n),e,t===!0,0)}}let s=null,C=0,U=0,q=0;function V(){let t=document.documentElement.scrollHeight;if(!t)return 0;let n=Math.round(((window.scrollY||0)+window.innerHeight)/t*100);return n<0?0:n>100?100:n}function dt(){U=window.scrollY||0,q=g(),C||(C=requestAnimationFrame(m(W)))}function W(){C=0;let t=s;if(!t)return;let n=V();if(n>t.sc&&(t.sc=n),u>=2){let e=q-t.lt;if(e>8&&e<100){let o=Math.abs(U-t.ly)/e*1e3;o>t.sp&&(t.sp=o)}t.ly=U,t.lt=q}}function ht(t){let n=g();t.since!==null&&(t.vis+=n-t.since,t.since=null),t.secs.forEach(e=>{e.since!==null&&(e.ms+=n-e.since,e.since=null)})}function mt(t){if(!k())return;let n=g();t.since===null&&(t.since=n),t.pending=!0,t.secs.forEach(e=>{e.on&&e.since===null&&(e.since=n)})}function pt(t){if(s!==t||!t.io)return;let n=(e,o)=>{e=M(e,64),!(!e||t.secs.has(e)||t.els.has(o)||v(o))&&(t.els.add(o),t.secs.set(e,{on:!1,since:null,ms:0}),t.byEl.set(o,e),t.io.observe(o))};if(document.querySelectorAll("[data-moxel-section]").forEach(e=>n(f(e,"data-moxel-section"),e)),!t.secs.has("hero")&&!document.querySelector("[data-moxel-section]")){let e=document.querySelector("header")||document.querySelector("[class*=hero]")||document.querySelector("main section");e&&n("hero",e)}}function gt(t){let n=s;if(!n)return;let e=window.innerHeight;t.forEach(o=>{let i=n.secs.get(n.byEl.get(o.target));if(!i)return;let a=o.isIntersecting&&(o.intersectionRatio>=.5||o.intersectionRect.height>=e*.5);a&&!i.on?(i.on=!0,k()&&n.since!==null&&(i.since=g())):!a&&i.on&&(i.on=!1,i.since!==null&&(i.ms+=g()-i.since,i.since=null))})}function D(t){let n=H(),e=s={path:n,vis:0,since:k()?g():null,pending:!0,sc:0,sp:0,ly:window.scrollY||0,lt:g(),forms:new Map,told:new Set,secs:new Map,els:new Set,byEl:new Map,io:null},o={};if(t&&document.referrer)try{let a=new URL(document.referrer);a.hostname!==location.hostname&&(o.r=a.host.slice(0,200))}catch(a){}try{let a=new URLSearchParams(location.search);[["us","utm_source"],["um","utm_medium"],["uc","utm_campaign"]].forEach(d=>{let w=a.get(d[1]);w&&(o[d[0]]=M(w,64))})}catch(a){}h("pv",n,o);let i=()=>bt(e);if(t&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m(i),{once:!0}):i()),setTimeout(m(i),1500),u>=1&&(requestAnimationFrame(m(W)),typeof IntersectionObserver=="function")){let a=[];for(let w=0;w<=10;w++)a.push(w/10);e.io=new IntersectionObserver(m(gt),{threshold:a});let d=()=>pt(e);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m(d),{once:!0}):d(),window.addEventListener("load",m(d),{once:!0}),setTimeout(m(d),400),setTimeout(m(d),1500)}}function _(t,n){if(!t||(Q(),ht(t),t.forms.forEach(o=>{o.started&&o.last!=null&&o.fa!==o.last&&(o.fa=o.last,h("fa",t.path,{f:o.f,fd:o.last,i:o.i}))}),!t.pending))return;if(t.pending=!1,u>=1&&n){let o=V();o>t.sc&&(t.sc=o)}t.secs.forEach((o,i)=>{o.ms>=Pt&&h("sd",t.path,{s:i,ms:Math.round(o.ms)}),o.ms=0}),t.sp>=1&&h("sp",t.path,{v:Math.round(t.sp)}),t.sp=0;let e={ms:Math.round(t.vis)};u>=1&&(e.sc=t.sc),h("lv",t.path,e),t.vis=0}function G(){if(!s||H()===s.path)return;let t=s;_(t,!1),t.io&&t.io.disconnect(),D(!1)}let T=[],y=null,F=0;function R(t){let n=t.tagName,e=n==="INPUT",o=f(t,"data-moxel")||f(t,"aria-label")||st(e?f(t,"value"):t.textContent)||f(t,"title");if(!o){let i=e?t:t.querySelector&&t.querySelector("img[alt]");o=i&&f(i,"alt")}return o||(o=n.toLowerCase()),M(at(st(o)),60)}function Q(){clearTimeout(F),y&&h("rg",y.p,{el:y.el,n:y.n}),y=null,T=[]}function yt(t){let n=t.target;if(!n||!n.closest||v(n))return;let e=n.closest(qt);if(e&&u>=1){let o=e.tagName,i={el:R(e),tg:o==="A"?"a":o==="BUTTON"||o==="INPUT"||f(e,"role")==="button"?"button":"other"};if(o==="A")try{let a=new URL(e.href,location.href);(a.protocol==="http:"||a.protocol==="https:")&&(i.h=a.host===location.host?ct(a.pathname):a.host.slice(0,200))}catch(a){}h("cl",s.path,i)}if(u>=2){let o=Date.now(),i=t.clientX,a=t.clientY;T=T.filter(d=>o-d.t<1e3&&Math.abs(d.x-i)<30&&Math.abs(d.y-a)<30),T.push({t:o,x:i,y:a}),T.length>=3&&(y?y.n++:y={el:e||String(n.textContent||"").length<80?R(e||n):n.tagName.toLowerCase(),n:T.length,p:s.path}),clearTimeout(F),y&&(F=setTimeout(m(Q),1e3))}}function I(t){if(!t||!t.tagName)return null;let n=t.tagName;if(n!=="INPUT"&&n!=="SELECT"&&n!=="TEXTAREA"||n==="INPUT"&&Ft[t.type])return null;let e=f(t,"autocomplete");return e&&/(^|\s)cc-/i.test(e)||!t.form||v(t)||v(t.form)?null:t}function wt(t){return t.type==="checkbox"||t.type==="radio"?t.checked:t.type==="file"?!!(t.files&&t.files.length):t.tagName==="SELECT"&&t.multiple?t.selectedOptions.length>0:t.value!==""}function Z(t){let n=[];for(let e=0;e<t.elements.length;e++)I(t.elements[e])&&n.push(t.elements[e]);return n}function tt(t,n){let e="";return t.labels&&t.labels[0]&&(e=t.labels[0].textContent),M(f(t,"data-moxel-field")||f(t,"name")||f(t,"id")||f(t,"aria-label")||e||f(t,"placeholder")||"",64)||"field "+(n+1)}function X(t){let n=Z(t.form),e=n.indexOf(t);return{name:tt(t,e),i:e,nf:n.length}}function et(t){let n=Array.prototype.indexOf.call(document.forms,t)+1;return M(f(t,"data-moxel-form")||f(t,"name")||f(t,"id")||f(t,"aria-label")||"form "+n,64)}function bt(t){if(s===t)for(let n=0;n<document.forms.length&&t.told.size<Ct;n++){let e=document.forms[n];if(v(e))continue;let o=Z(e),i=t.forms.get(e),a=i?i.f:et(e);if(!o.length||t.told.has(a))continue;t.told.add(a);let d={f:a,nf:o.length,fds:o.slice(0,Ut).map(tt)},w=e.querySelector("button:not([type=button]):not([type=reset]),input[type=submit]");w&&(d.el=R(w)),h("fm",t.path,d)}}function B(t){let n=s.forms.get(t);return n||(n={f:et(t),started:!1,fa:null,last:null,i:0,cur:null,at:0,fxAt:0},s.forms.set(t,n)),n}function St(t){let n=I(t.target);if(!n)return;let e=B(n.form),o=X(n);e.started||(e.started=!0,e.fa=null,h("fs",s.path,{f:e.f,nf:o.nf})),e.last=o.name,e.i=o.i,e.cur=n,e.at=g(),h("ff",s.path,{f:e.f,fd:o.name,i:o.i})}function vt(t){let n=I(t.target);if(!n)return;let e=s.forms.get(n.form);if(!e||e.cur!==n)return;e.cur=null;let o=X(n);h("fb",s.path,{f:e.f,fd:o.name,i:o.i,ms:Math.round(g()-e.at),fl:wt(n)?1:0})}function Et(t){let n=t.target;if(!n||n.tagName!=="FORM"||v(n))return;let e=B(n),o=g();e.fxAt&&o-e.fxAt<1e3||(e.fxAt=o,e.started=!1,e.cur=null,h("fx",s.path,{f:e.f}))}function Tt(t){let n=I(t.target);if(!n)return;let e=n.validity,o=e.valueMissing?"required":e.typeMismatch||e.badInput?"type":e.patternMismatch?"pattern":e.tooShort?"short":e.tooLong?"long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":"custom",i=X(n);h("fe",s.path,{f:B(n.form).f,fd:i.name,i:i.i,k:o})}let A={capture:!0};p(document,"focusin",St,A),p(document,"submit",Et,A),u>=1&&p(document,"click",yt,A),u>=2&&(p(document,"focusout",vt,A),p(document,"invalid",Tt,A)),u>=1&&p(window,"scroll",dt,{passive:!0}),p(window,"popstate",G),p(window,"pagehide",()=>{_(s,!0),E(!0)}),p(window,"pageshow",t=>{t.persisted&&(s&&s.io&&s.io.disconnect(),D(!1))}),p(document,"visibilitychange",()=>{s&&(k()?mt(s):(_(s,!0),E(!0)))});let b=window.history,nt=b.pushState,ot=b.replaceState,it=t=>function(){let n=t.apply(this,arguments);return m(G)(),n},Mt=b.pushState=it(nt),Nt=b.replaceState=it(ot);return D(!0),{track(t,n){try{let e=M(String(t==null?"":t).replace(/[^\w -]+/g," "),64);if(!e)return;let o={n:e};typeof n=="number"&&isFinite(n)&&(o.val=n),h("ev",s?s.path:H(),o)}catch(e){}},flush(){try{E(!1)}catch(t){}},stop(){try{_(s,!0),E(!0),$.forEach(t=>t()),b.pushState===Mt&&(b.pushState=nt),b.replaceState===Nt&&(b.replaceState=ot),s&&s.io&&s.io.disconnect(),s=null}catch(t){}}}}var L=null,P=[];function ut(r){try{if(typeof window=="undefined"||typeof document=="undefined"||L)return;L=lt(r||{});let c=P;P=[],c.forEach(l=>L.track(l[0],l[1]))}catch(c){}}function ft(r,c){try{L?L.track(r,c):typeof window!="undefined"&&P.length<20&&P.push([r,c])}catch(l){}}var Bt=/(^|\.)(unpkg\.com|jsdelivr\.net)$/;function Ht(r){try{let c=new URL(r.src,location.href);if(/^https?:$/.test(c.protocol)&&!Bt.test(c.hostname))return c.origin}catch(c){}}(function(){try{if(typeof document=="undefined"||window.moxel)return;let r=document.currentScript||document.querySelector("script[data-site]");if(!r)return;let c=l=>{let u=r.getAttribute(l);return u!==null&&u!=="false"&&u!=="0"};window.moxel={track:ft},ut({siteKey:r.getAttribute("data-site"),depth:r.getAttribute("data-depth")||"vibey",endpoint:r.getAttribute("data-endpoint")||Ht(r),respectDnt:c("data-respect-dnt"),debug:c("data-debug"),allowAutomation:c("data-allow-automation")})}catch(r){}})();})();
|
|
1
|
+
(()=>{var At="https://www.getmoxel.com",rt={chill:0,vibey:1,feral:2},Lt={pv:0,lv:0,fs:0,fx:0,ev:0,fm:0,sd:1,cl:1,fa:1,ff:2,fb:2,fe:2,rg:2,sp:2},xt=5e3,kt=20,Ot=50,_t=32768,It=1e3,Pt=500,Ct=20,Ut=8,qt="a[href],button,input[type=submit],input[type=button],input[type=reset],input[type=image],[role=button],[role=link],[data-moxel]",Dt="[data-moxel-ignore]",Ft={hidden:1,password:1,submit:1,button:1,reset:1,image:1},A={track(){},flush(){},stop(){}},M=(r,c)=>String(r==null?"":r).replace(/\s+/g," ").trim().slice(0,c),at=r=>r.replace(/[^\s@/]+@[^\s@/]+\.[^\s@/]+/g,"*").replace(/\d{6,}/g,"*"),ct=r=>r.split("/").map(c=>/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(c)||/^(?=.*\d)(?=.*[a-z])[a-z0-9_]{16,}$/i.test(c)?"*":at(c)).join("/").slice(0,200),H=()=>location.protocol==="file:"?"/"+location.pathname.split("/").pop():location.pathname,st=r=>String(r==null?"":r).slice(0,2e3).replace(/\s+/g," ").trim().slice(0,600),f=(r,c)=>r.getAttribute(c);function Rt(r){let c=r.length;for(let l=0;l<r.length;l++){let u=r.charCodeAt(l);u>127&&(c+=u>2047?2:1)}return c}function lt(r){try{let c=r||{};if(typeof window=="undefined"||typeof document=="undefined")return A;let l=window.navigator||{};return c.respectDnt&&(l.doNotTrack==="1"||l.doNotTrack==="yes"||l.globalPrivacyControl===!0)||!c.siteKey?A:Xt(c,l)}catch(c){return A}}function Xt(r,c){let l=r.depth in rt?r.depth:"vibey",u=rt[l],Y=String(r.endpoint||At||"").replace(/\/+$/,"");if(!Y)return A;let z=Y+"/e",K=!!r.debug,$=[],x;try{x=Intl.DateTimeFormat().resolvedOptions().timeZone}catch(t){}let m=t=>function(){try{return t.apply(this,arguments)}catch(n){K&&console.warn("[moxel]",n)}},p=(t,n,e,o)=>{let i=m(e);t.addEventListener(n,i,o),$.push(()=>t.removeEventListener(n,i,o))},g=()=>performance.now(),k=()=>document.visibilityState!=="hidden",v=t=>!!(t&&t.closest&&t.closest(Dt)),S=[],O=0;function h(t,n,e){if(u<Lt[t]||S.length>=It)return;let o={t,ts:Date.now(),p:ct(String(n))};for(let i in e)e[i]!==void 0&&(o[i]=e[i]);S.push(o),S.length>=kt?E():O||(O=setTimeout(E,xt))}function J(t){let n={v:1,k:r.siteKey,d:l,now:Date.now(),w:Math.round(window.innerWidth)||0};return typeof x=="string"&&x&&(n.tz=x),c.webdriver===!0&&!r.allowAutomation&&(n.wd=1),n.ev=t,n}function j(t,n,e,o){if(K)try{console.log("[moxel]",JSON.parse(n))}catch(a){}if(e&&c.sendBeacon)try{if(c.sendBeacon(z,n))return}catch(a){}if(typeof fetch!="function")return;let i=()=>{o||setTimeout(()=>j(t,JSON.stringify(J(t)),!1,1),2e3)};try{fetch(z,{method:"POST",body:n,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).then(a=>{a.status>=500&&i()},i).catch(()=>{})}catch(a){}}function E(t){for(clearTimeout(O),O=0;S.length;){let n=Math.min(S.length,Ot),e;for(;e=JSON.stringify(J(S.slice(0,n))),!(n<=1||Rt(e)<=_t);)n=Math.ceil(n/2);j(S.splice(0,n),e,t===!0,0)}}let s=null,C=0,U=0,q=0;function V(){let t=document.documentElement.scrollHeight;if(!t)return 0;let n=Math.round(((window.scrollY||0)+window.innerHeight)/t*100);return n<0?0:n>100?100:n}function dt(){U=window.scrollY||0,q=g(),C||(C=requestAnimationFrame(m(W)))}function W(){C=0;let t=s;if(!t)return;let n=V();if(n>t.sc&&(t.sc=n),u>=2){let e=q-t.lt;if(e>8&&e<100){let o=Math.abs(U-t.ly)/e*1e3;o>t.sp&&(t.sp=o)}t.ly=U,t.lt=q}}function ht(t){let n=g();t.since!==null&&(t.vis+=n-t.since,t.since=null),t.secs.forEach(e=>{e.since!==null&&(e.ms+=n-e.since,e.since=null)})}function mt(t){if(!k())return;let n=g();t.since===null&&(t.since=n),t.pending=!0,t.secs.forEach(e=>{e.on&&e.since===null&&(e.since=n)})}function pt(t){if(s!==t||!t.io)return;let n=(e,o)=>{e=M(e,64),!(!e||t.secs.has(e)||t.els.has(o)||v(o))&&(t.els.add(o),t.secs.set(e,{on:!1,since:null,ms:0}),t.byEl.set(o,e),t.io.observe(o))};if(document.querySelectorAll("[data-moxel-section]").forEach(e=>n(f(e,"data-moxel-section"),e)),!t.secs.has("hero")&&!document.querySelector("[data-moxel-section]")){let e=document.querySelector("header")||document.querySelector("[class*=hero]")||document.querySelector("main section");e&&n("hero",e)}}function gt(t){let n=s;if(!n)return;let e=window.innerHeight;t.forEach(o=>{let i=n.secs.get(n.byEl.get(o.target));if(!i)return;let a=o.isIntersecting&&(o.intersectionRatio>=.5||o.intersectionRect.height>=e*.5);a&&!i.on?(i.on=!0,k()&&n.since!==null&&(i.since=g())):!a&&i.on&&(i.on=!1,i.since!==null&&(i.ms+=g()-i.since,i.since=null))})}function D(t){let n=H(),e=s={path:n,vis:0,since:k()?g():null,pending:!0,sc:0,sp:0,ly:window.scrollY||0,lt:g(),forms:new Map,told:new Set,secs:new Map,els:new Set,byEl:new Map,io:null},o={};if(t&&document.referrer)try{let a=new URL(document.referrer);a.hostname!==location.hostname&&(o.r=a.host.slice(0,200))}catch(a){}try{let a=new URLSearchParams(location.search);[["us","utm_source"],["um","utm_medium"],["uc","utm_campaign"]].forEach(d=>{let w=a.get(d[1]);w&&(o[d[0]]=M(w,64))})}catch(a){}h("pv",n,o);let i=()=>bt(e);if(t&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m(i),{once:!0}):i()),setTimeout(m(i),1500),u>=1&&(requestAnimationFrame(m(W)),typeof IntersectionObserver=="function")){let a=[];for(let w=0;w<=10;w++)a.push(w/10);e.io=new IntersectionObserver(m(gt),{threshold:a});let d=()=>pt(e);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",m(d),{once:!0}):d(),window.addEventListener("load",m(d),{once:!0}),setTimeout(m(d),400),setTimeout(m(d),1500)}}function _(t,n){if(!t||(Q(),ht(t),t.forms.forEach(o=>{o.started&&o.last!=null&&o.fa!==o.last&&(o.fa=o.last,h("fa",t.path,{f:o.f,fd:o.last,i:o.i}))}),!t.pending))return;if(t.pending=!1,u>=1&&n){let o=V();o>t.sc&&(t.sc=o)}t.secs.forEach((o,i)=>{o.ms>=Pt&&h("sd",t.path,{s:i,ms:Math.round(o.ms)}),o.ms=0}),t.sp>=1&&h("sp",t.path,{v:Math.round(t.sp)}),t.sp=0;let e={ms:Math.round(t.vis)};u>=1&&(e.sc=t.sc),h("lv",t.path,e),t.vis=0}function G(){if(!s||H()===s.path)return;let t=s;_(t,!1),t.io&&t.io.disconnect(),D(!1)}let T=[],y=null,F=0;function R(t){let n=t.tagName,e=n==="INPUT",o=f(t,"data-moxel")||f(t,"aria-label")||st(e?f(t,"value"):t.textContent)||f(t,"title");if(!o){let i=e?t:t.querySelector&&t.querySelector("img[alt]");o=i&&f(i,"alt")}return o||(o=n.toLowerCase()),M(at(st(o)),60)}function Q(){clearTimeout(F),y&&h("rg",y.p,{el:y.el,n:y.n}),y=null,T=[]}function yt(t){let n=t.target;if(!n||!n.closest||v(n))return;let e=n.closest(qt);if(e&&u>=1){let o=e.tagName,i={el:R(e),tg:o==="A"?"a":o==="BUTTON"||o==="INPUT"||f(e,"role")==="button"?"button":"other"};if(o==="A")try{let a=new URL(e.href,location.href);(a.protocol==="http:"||a.protocol==="https:")&&(i.h=a.host===location.host?ct(a.pathname):a.host.slice(0,200))}catch(a){}h("cl",s.path,i)}if(u>=2){let o=Date.now(),i=t.clientX,a=t.clientY;T=T.filter(d=>o-d.t<1e3&&Math.abs(d.x-i)<30&&Math.abs(d.y-a)<30),T.push({t:o,x:i,y:a}),T.length>=3&&(y?y.n++:y={el:e||String(n.textContent||"").length<80?R(e||n):n.tagName.toLowerCase(),n:T.length,p:s.path}),clearTimeout(F),y&&(F=setTimeout(m(Q),1e3))}}function I(t){if(!t||!t.tagName)return null;let n=t.tagName;if(n!=="INPUT"&&n!=="SELECT"&&n!=="TEXTAREA"||n==="INPUT"&&Ft[t.type])return null;let e=f(t,"autocomplete");return e&&/(^|\s)cc-/i.test(e)||!t.form||v(t)||v(t.form)?null:t}function wt(t){return t.type==="checkbox"||t.type==="radio"?t.checked:t.type==="file"?!!(t.files&&t.files.length):t.tagName==="SELECT"&&t.multiple?t.selectedOptions.length>0:t.value!==""}function Z(t){let n=[];for(let e=0;e<t.elements.length;e++)I(t.elements[e])&&n.push(t.elements[e]);return n}function tt(t,n){let e="";return t.labels&&t.labels[0]&&(e=t.labels[0].textContent),M(f(t,"data-moxel-field")||f(t,"name")||f(t,"id")||f(t,"aria-label")||e||f(t,"placeholder")||"",64)||"field "+(n+1)}function X(t){let n=Z(t.form),e=n.indexOf(t);return{name:tt(t,e),i:e,nf:n.length}}function et(t){let n=Array.prototype.indexOf.call(document.forms,t)+1;return M(f(t,"data-moxel-form")||f(t,"name")||f(t,"id")||f(t,"aria-label")||"form "+n,64)}function bt(t){if(s===t)for(let n=0;n<document.forms.length&&t.told.size<Ct;n++){let e=document.forms[n];if(v(e))continue;let o=Z(e),i=t.forms.get(e),a=i?i.f:et(e);if(!o.length||t.told.has(a))continue;t.told.add(a);let d={f:a,nf:o.length,fds:o.slice(0,Ut).map(tt)},w=e.querySelector("button:not([type=button]):not([type=reset]),input[type=submit]");w&&(d.el=R(w)),h("fm",t.path,d)}}function B(t){let n=s.forms.get(t);return n||(n={f:et(t),started:!1,fa:null,last:null,i:0,cur:null,at:0,fxAt:0},s.forms.set(t,n)),n}function St(t){let n=I(t.target);if(!n)return;let e=B(n.form),o=X(n);e.started||(e.started=!0,e.fa=null,h("fs",s.path,{f:e.f,nf:o.nf})),e.last=o.name,e.i=o.i,e.cur=n,e.at=g(),h("ff",s.path,{f:e.f,fd:o.name,i:o.i})}function vt(t){let n=I(t.target);if(!n)return;let e=s.forms.get(n.form);if(!e||e.cur!==n)return;e.cur=null;let o=X(n);h("fb",s.path,{f:e.f,fd:o.name,i:o.i,ms:Math.round(g()-e.at),fl:wt(n)?1:0})}function Et(t){let n=t.target;if(!n||n.tagName!=="FORM"||v(n))return;let e=B(n),o=g();e.fxAt&&o-e.fxAt<1e3||(e.fxAt=o,e.started=!1,e.cur=null,h("fx",s.path,{f:e.f}))}function Tt(t){let n=I(t.target);if(!n)return;let e=n.validity,o=e.valueMissing?"required":e.typeMismatch||e.badInput?"type":e.patternMismatch?"pattern":e.tooShort?"short":e.tooLong?"long":e.rangeUnderflow||e.rangeOverflow||e.stepMismatch?"range":"custom",i=X(n);h("fe",s.path,{f:B(n.form).f,fd:i.name,i:i.i,k:o})}let N={capture:!0};p(document,"focusin",St,N),p(document,"submit",Et,N),u>=1&&p(document,"click",yt,N),u>=2&&(p(document,"focusout",vt,N),p(document,"invalid",Tt,N)),u>=1&&p(window,"scroll",dt,{passive:!0}),p(window,"popstate",G),p(window,"pagehide",()=>{_(s,!0),E(!0)}),p(window,"pageshow",t=>{t.persisted&&(s&&s.io&&s.io.disconnect(),D(!1))}),p(document,"visibilitychange",()=>{s&&(k()?mt(s):(_(s,!0),E(!0)))});let b=window.history,nt=b.pushState,ot=b.replaceState,it=t=>function(){let n=t.apply(this,arguments);return m(G)(),n},Mt=b.pushState=it(nt),Nt=b.replaceState=it(ot);return D(!0),{track(t,n){try{let e=M(String(t==null?"":t).replace(/[^\w -]+/g," "),64);if(!e)return;let o={n:e};typeof n=="number"&&isFinite(n)&&(o.val=n),h("ev",s?s.path:H(),o)}catch(e){}},flush(){try{E(!1)}catch(t){}},stop(){try{_(s,!0),E(!0),$.forEach(t=>t()),b.pushState===Mt&&(b.pushState=nt),b.replaceState===Nt&&(b.replaceState=ot),s&&s.io&&s.io.disconnect(),s=null}catch(t){}}}}var L=null,P=[];function ut(r){try{if(typeof window=="undefined"||typeof document=="undefined"||L)return;L=lt(r||{});let c=P;P=[],c.forEach(l=>L.track(l[0],l[1]))}catch(c){}}function ft(r,c){try{L?L.track(r,c):typeof window!="undefined"&&P.length<20&&P.push([r,c])}catch(l){}}var Bt=/(^|\.)(unpkg\.com|jsdelivr\.net)$/;function Ht(r){try{let c=new URL(r.src,location.href);if(/^https?:$/.test(c.protocol)&&!Bt.test(c.hostname))return c.origin}catch(c){}}(function(){try{if(typeof document=="undefined"||window.moxel)return;let r=document.currentScript||document.querySelector("script[data-site]");if(!r)return;let c=l=>{let u=r.getAttribute(l);return u!==null&&u!=="false"&&u!=="0"};window.moxel={track:ft},ut({siteKey:r.getAttribute("data-site"),depth:r.getAttribute("data-depth")||"vibey",endpoint:r.getAttribute("data-endpoint")||Ht(r),respectDnt:c("data-respect-dnt"),debug:c("data-debug"),allowAutomation:c("data-allow-automation")})}catch(r){}})();})();
|