@junobuild/analytics 0.0.26 → 0.0.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/idb.services-CVJFLYYN.js +2 -0
- package/dist/browser/{idb.services-V6IDWAXJ.js.map → idb.services-CVJFLYYN.js.map} +3 -3
- package/dist/browser/index.js +1 -1
- package/dist/browser/index.js.map +4 -4
- package/dist/browser/web-vitals-BPYNZXGZ.js +2 -0
- package/dist/browser/web-vitals-BPYNZXGZ.js.map +7 -0
- package/dist/declarations/orbiter/orbiter.did.d.ts +67 -4
- package/dist/declarations/orbiter/orbiter.factory.did.js +80 -6
- package/dist/declarations/orbiter/orbiter.factory.did.mjs +80 -6
- package/dist/node/index.mjs +1 -1
- package/dist/node/index.mjs.map +4 -4
- package/dist/types/index.d.ts +1 -1
- package/dist/types/services/analytics.services.d.ts +1 -0
- package/dist/types/services/idb.services.d.ts +7 -1
- package/dist/types/services/performance.services.d.ts +1 -0
- package/dist/types/types/env.d.ts +14 -0
- package/dist/types/types/idb.d.ts +4 -1
- package/dist/workers/analytics.worker.js +18 -18
- package/dist/workers/analytics.worker.js.map +3 -3
- package/package.json +3 -2
- package/dist/browser/idb.services-V6IDWAXJ.js +0 -2
|
@@ -78,6 +78,49 @@ export const idlFactory = ({IDL}) => {
|
|
|
78
78
|
referrers: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32)),
|
|
79
79
|
pages: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
|
|
80
80
|
});
|
|
81
|
+
const NavigationType = IDL.Variant({
|
|
82
|
+
Navigate: IDL.Null,
|
|
83
|
+
Restore: IDL.Null,
|
|
84
|
+
Reload: IDL.Null,
|
|
85
|
+
BackForward: IDL.Null,
|
|
86
|
+
BackForwardCache: IDL.Null,
|
|
87
|
+
Prerender: IDL.Null
|
|
88
|
+
});
|
|
89
|
+
const WebVitalsMetric = IDL.Record({
|
|
90
|
+
id: IDL.Text,
|
|
91
|
+
value: IDL.Float64,
|
|
92
|
+
navigation_type: IDL.Opt(NavigationType),
|
|
93
|
+
delta: IDL.Float64
|
|
94
|
+
});
|
|
95
|
+
const PerformanceData = IDL.Variant({WebVitalsMetric: WebVitalsMetric});
|
|
96
|
+
const PerformanceMetricName = IDL.Variant({
|
|
97
|
+
CLS: IDL.Null,
|
|
98
|
+
FCP: IDL.Null,
|
|
99
|
+
INP: IDL.Null,
|
|
100
|
+
LCP: IDL.Null,
|
|
101
|
+
TTFB: IDL.Null
|
|
102
|
+
});
|
|
103
|
+
const PerformanceMetric = IDL.Record({
|
|
104
|
+
updated_at: IDL.Nat64,
|
|
105
|
+
session_id: IDL.Text,
|
|
106
|
+
data: PerformanceData,
|
|
107
|
+
href: IDL.Text,
|
|
108
|
+
metric_name: PerformanceMetricName,
|
|
109
|
+
created_at: IDL.Nat64,
|
|
110
|
+
satellite_id: IDL.Principal,
|
|
111
|
+
version: IDL.Opt(IDL.Nat64)
|
|
112
|
+
});
|
|
113
|
+
const AnalyticsWebVitalsPageMetrics = IDL.Record({
|
|
114
|
+
cls: IDL.Opt(IDL.Float64),
|
|
115
|
+
fcp: IDL.Opt(IDL.Float64),
|
|
116
|
+
inp: IDL.Opt(IDL.Float64),
|
|
117
|
+
lcp: IDL.Opt(IDL.Float64),
|
|
118
|
+
ttfb: IDL.Opt(IDL.Float64)
|
|
119
|
+
});
|
|
120
|
+
const AnalyticsWebVitalsPerformanceMetrics = IDL.Record({
|
|
121
|
+
overall: AnalyticsWebVitalsPageMetrics,
|
|
122
|
+
pages: IDL.Vec(IDL.Tuple(IDL.Text, AnalyticsWebVitalsPageMetrics))
|
|
123
|
+
});
|
|
81
124
|
const TrackEvent = IDL.Record({
|
|
82
125
|
updated_at: IDL.Nat64,
|
|
83
126
|
session_id: IDL.Text,
|
|
@@ -90,11 +133,16 @@ export const idlFactory = ({IDL}) => {
|
|
|
90
133
|
const AnalyticsTrackEvents = IDL.Record({
|
|
91
134
|
total: IDL.Vec(IDL.Tuple(IDL.Text, IDL.Nat32))
|
|
92
135
|
});
|
|
136
|
+
const OrbiterSatelliteFeatures = IDL.Record({
|
|
137
|
+
performance_metrics: IDL.Bool,
|
|
138
|
+
track_events: IDL.Bool,
|
|
139
|
+
page_views: IDL.Bool
|
|
140
|
+
});
|
|
93
141
|
const OrbiterSatelliteConfig = IDL.Record({
|
|
94
142
|
updated_at: IDL.Nat64,
|
|
143
|
+
features: IDL.Opt(OrbiterSatelliteFeatures),
|
|
95
144
|
created_at: IDL.Nat64,
|
|
96
|
-
version: IDL.Opt(IDL.Nat64)
|
|
97
|
-
enabled: IDL.Bool
|
|
145
|
+
version: IDL.Opt(IDL.Nat64)
|
|
98
146
|
});
|
|
99
147
|
const MemorySize = IDL.Record({stable: IDL.Nat64, heap: IDL.Nat64});
|
|
100
148
|
const SetController = IDL.Record({
|
|
@@ -123,9 +171,19 @@ export const idlFactory = ({IDL}) => {
|
|
|
123
171
|
Ok: IDL.Null,
|
|
124
172
|
Err: IDL.Vec(IDL.Tuple(AnalyticKey, IDL.Text))
|
|
125
173
|
});
|
|
126
|
-
const
|
|
174
|
+
const SetPerformanceMetric = IDL.Record({
|
|
175
|
+
session_id: IDL.Text,
|
|
176
|
+
data: PerformanceData,
|
|
177
|
+
href: IDL.Text,
|
|
178
|
+
metric_name: PerformanceMetricName,
|
|
179
|
+
satellite_id: IDL.Principal,
|
|
127
180
|
version: IDL.Opt(IDL.Nat64),
|
|
128
|
-
|
|
181
|
+
user_agent: IDL.Opt(IDL.Text)
|
|
182
|
+
});
|
|
183
|
+
const Result_2 = IDL.Variant({Ok: PerformanceMetric, Err: IDL.Text});
|
|
184
|
+
const SetSatelliteConfig = IDL.Record({
|
|
185
|
+
features: IDL.Opt(OrbiterSatelliteFeatures),
|
|
186
|
+
version: IDL.Opt(IDL.Nat64)
|
|
129
187
|
});
|
|
130
188
|
const SetTrackEvent = IDL.Record({
|
|
131
189
|
updated_at: IDL.Opt(IDL.Nat64),
|
|
@@ -136,7 +194,7 @@ export const idlFactory = ({IDL}) => {
|
|
|
136
194
|
version: IDL.Opt(IDL.Nat64),
|
|
137
195
|
user_agent: IDL.Opt(IDL.Text)
|
|
138
196
|
});
|
|
139
|
-
const
|
|
197
|
+
const Result_3 = IDL.Variant({Ok: TrackEvent, Err: IDL.Text});
|
|
140
198
|
return IDL.Service({
|
|
141
199
|
del_controllers: IDL.Func(
|
|
142
200
|
[DeleteControllersArgs],
|
|
@@ -161,6 +219,16 @@ export const idlFactory = ({IDL}) => {
|
|
|
161
219
|
['query']
|
|
162
220
|
),
|
|
163
221
|
get_page_views_analytics_top_10: IDL.Func([GetAnalytics], [AnalyticsTop10PageViews], ['query']),
|
|
222
|
+
get_performance_metrics: IDL.Func(
|
|
223
|
+
[GetAnalytics],
|
|
224
|
+
[IDL.Vec(IDL.Tuple(AnalyticKey, PerformanceMetric))],
|
|
225
|
+
['query']
|
|
226
|
+
),
|
|
227
|
+
get_performance_metrics_analytics_web_vitals: IDL.Func(
|
|
228
|
+
[GetAnalytics],
|
|
229
|
+
[AnalyticsWebVitalsPerformanceMetrics],
|
|
230
|
+
['query']
|
|
231
|
+
),
|
|
164
232
|
get_track_events: IDL.Func(
|
|
165
233
|
[GetAnalytics],
|
|
166
234
|
[IDL.Vec(IDL.Tuple(AnalyticKey, TrackEvent))],
|
|
@@ -181,12 +249,18 @@ export const idlFactory = ({IDL}) => {
|
|
|
181
249
|
),
|
|
182
250
|
set_page_view: IDL.Func([AnalyticKey, SetPageView], [Result], []),
|
|
183
251
|
set_page_views: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetPageView))], [Result_1], []),
|
|
252
|
+
set_performance_metric: IDL.Func([AnalyticKey, SetPerformanceMetric], [Result_2], []),
|
|
253
|
+
set_performance_metrics: IDL.Func(
|
|
254
|
+
[IDL.Vec(IDL.Tuple(AnalyticKey, SetPerformanceMetric))],
|
|
255
|
+
[Result_1],
|
|
256
|
+
[]
|
|
257
|
+
),
|
|
184
258
|
set_satellite_configs: IDL.Func(
|
|
185
259
|
[IDL.Vec(IDL.Tuple(IDL.Principal, SetSatelliteConfig))],
|
|
186
260
|
[IDL.Vec(IDL.Tuple(IDL.Principal, OrbiterSatelliteConfig))],
|
|
187
261
|
[]
|
|
188
262
|
),
|
|
189
|
-
set_track_event: IDL.Func([AnalyticKey, SetTrackEvent], [
|
|
263
|
+
set_track_event: IDL.Func([AnalyticKey, SetTrackEvent], [Result_3], []),
|
|
190
264
|
set_track_events: IDL.Func([IDL.Vec(IDL.Tuple(AnalyticKey, SetTrackEvent))], [Result_1], []),
|
|
191
265
|
version: IDL.Func([], [IDL.Text], ['query'])
|
|
192
266
|
});
|
package/dist/node/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createRequire as topLevelCreateRequire } from 'module';
|
|
2
2
|
const require = topLevelCreateRequire(import.meta.url);
|
|
3
|
-
var ze=Object.create;var J=Object.defineProperty;var Ye=Object.getOwnPropertyDescriptor;var Ze=Object.getOwnPropertyNames;var Qe=Object.getPrototypeOf,et=Object.prototype.hasOwnProperty;var tt=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var me=(e,t)=>()=>(e&&(t=e(e=0)),t);var h=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),nt=(e,t)=>{for(var n in t)J(e,n,{get:t[n],enumerable:!0})},rt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Ze(t))!et.call(e,o)&&o!==n&&J(e,o,{get:()=>t[o],enumerable:!(r=Ye(t,o))||r.enumerable});return e};var ot=(e,t,n)=>(n=e!=null?ze(Qe(e)):{},rt(t||!e||!e.__esModule?J(n,"default",{value:e,enumerable:!0}):n,e));var _e=h(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.decode=A.encode=void 0;var L="abcdefghijklmnopqrstuvwxyz234567",E=Object.create(null);for(let e=0;e<L.length;e++)E[L[e]]=e;E[0]=E.o;E[1]=E.i;function it(e){let t=0,n=0,r="";function o(i){return t<0?n|=i>>-t:n=i<<t&248,t>3?(t-=8,1):(t<4&&(r+=L[n>>3],t+=5),0)}for(let i=0;i<e.length;)i+=o(e[i]);return r+(t<0?L[n>>3]:"")}A.encode=it;function st(e){let t=0,n=0,r=new Uint8Array(e.length*4/3|0),o=0;function i(a){let c=E[a.toLowerCase()];if(c===void 0)throw new Error(`Invalid character: ${JSON.stringify(a)}`);c<<=3,n|=c>>>t,t+=5,t>=8&&(r[o++]=n,t-=8,t>0?n=c<<5-t&255:n=0)}for(let a of e)i(a);return r.slice(0,o)}A.decode=st});var ve=h(N=>{"use strict";Object.defineProperty(N,"__esModule",{value:!0});N.getCrc32=void 0;var at=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function ct(e){let t=new Uint8Array(e),n=-1;for(let r=0;r<t.length;r++){let i=(t[r]^n)&255;n=at[i]^n>>>8}return(n^-1)>>>0}N.getCrc32=ct});var X=h(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.output=u.exists=u.hash=u.bytes=u.bool=u.number=u.isBytes=void 0;function C(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}u.number=C;function Ie(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}u.bool=Ie;function Ee(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}u.isBytes=Ee;function $(e,...t){if(!Ee(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}u.bytes=$;function Ae(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");C(e.outputLen),C(e.blockLen)}u.hash=Ae;function ke(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}u.exists=ke;function Te(e,t){$(e);let n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}u.output=Te;var ft={number:C,bool:Ie,bytes:$,hash:Ae,exists:ke,output:Te};u.default=ft});var Pe=h(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.crypto=void 0;var j=tt("node:crypto");M.crypto=j&&typeof j=="object"&&"webcrypto"in j?j.webcrypto:void 0});var Q=h(s=>{"use strict";Object.defineProperty(s,"__esModule",{value:!0});s.randomBytes=s.wrapXOFConstructorWithOpts=s.wrapConstructorWithOpts=s.wrapConstructor=s.checkOpts=s.Hash=s.concatBytes=s.toBytes=s.utf8ToBytes=s.asyncLoop=s.nextTick=s.hexToBytes=s.bytesToHex=s.byteSwap32=s.byteSwapIfBE=s.byteSwap=s.isLE=s.rotl=s.rotr=s.createView=s.u32=s.u8=s.isBytes=void 0;var z=Pe(),Z=X();function dt(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}s.isBytes=dt;var ut=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);s.u8=ut;var xt=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));s.u32=xt;var lt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);s.createView=lt;var bt=(e,t)=>e<<32-t|e>>>t;s.rotr=bt;var pt=(e,t)=>e<<t|e>>>32-t>>>0;s.rotl=pt;s.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;var ht=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;s.byteSwap=ht;s.byteSwapIfBE=s.isLE?e=>e:e=>(0,s.byteSwap)(e);function yt(e){for(let t=0;t<e.length;t++)e[t]=(0,s.byteSwap)(e[t])}s.byteSwap32=yt;var gt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function wt(e){(0,Z.bytes)(e);let t="";for(let n=0;n<e.length;n++)t+=gt[e[n]];return t}s.bytesToHex=wt;var y={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function Se(e){if(e>=y._0&&e<=y._9)return e-y._0;if(e>=y._A&&e<=y._F)return e-(y._A-10);if(e>=y._a&&e<=y._f)return e-(y._a-10)}function mt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let o=0,i=0;o<n;o++,i+=2){let a=Se(e.charCodeAt(i)),c=Se(e.charCodeAt(i+1));if(a===void 0||c===void 0){let d=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+d+'" at index '+i)}r[o]=a*16+c}return r}s.hexToBytes=mt;var _t=async()=>{};s.nextTick=_t;async function vt(e,t,n){let r=Date.now();for(let o=0;o<e;o++){n(o);let i=Date.now()-r;i>=0&&i<t||(await(0,s.nextTick)(),r+=i)}}s.asyncLoop=vt;function Be(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}s.utf8ToBytes=Be;function D(e){return typeof e=="string"&&(e=Be(e)),(0,Z.bytes)(e),e}s.toBytes=D;function It(...e){let t=0;for(let r=0;r<e.length;r++){let o=e[r];(0,Z.bytes)(o),t+=o.length}let n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){let i=e[r];n.set(i,o),o+=i.length}return n}s.concatBytes=It;var Y=class{clone(){return this._cloneInto()}};s.Hash=Y;var Et={}.toString;function At(e,t){if(t!==void 0&&Et.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}s.checkOpts=At;function kt(e){let t=r=>e().update(D(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}s.wrapConstructor=kt;function Tt(e){let t=(r,o)=>e(o).update(D(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}s.wrapConstructorWithOpts=Tt;function Pt(e){let t=(r,o)=>e(o).update(D(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}s.wrapXOFConstructorWithOpts=Pt;function St(e=32){if(z.crypto&&typeof z.crypto.getRandomValues=="function")return z.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}s.randomBytes=St});var Ue=h(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.HashMD=w.Maj=w.Chi=void 0;var ee=X(),O=Q();function Bt(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);let o=BigInt(32),i=BigInt(4294967295),a=Number(n>>o&i),c=Number(n&i),d=r?4:0,b=r?0:4;e.setUint32(t+d,a,r),e.setUint32(t+b,c,r)}var Ut=(e,t,n)=>e&t^~e&n;w.Chi=Ut;var Ot=(e,t,n)=>e&t^e&n^t&n;w.Maj=Ot;var te=class extends O.Hash{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,O.createView)(this.buffer)}update(t){(0,ee.exists)(this);let{view:n,buffer:r,blockLen:o}=this;t=(0,O.toBytes)(t);let i=t.length;for(let a=0;a<i;){let c=Math.min(o-this.pos,i-a);if(c===o){let d=(0,O.createView)(t);for(;o<=i-a;a+=o)this.process(d,a);continue}r.set(t.subarray(a,a+c),this.pos),this.pos+=c,a+=c,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,ee.exists)(this),(0,ee.output)(t,this),this.finished=!0;let{buffer:n,view:r,blockLen:o,isLE:i}=this,{pos:a}=this;n[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(r,0),a=0);for(let f=a;f<o;f++)n[f]=0;Bt(r,o-8,BigInt(this.length*8),i),this.process(r,0);let c=(0,O.createView)(t),d=this.outputLen;if(d%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let b=d/4,g=this.get();if(b>g.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<b;f++)c.setUint32(4*f,g[f],i)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:n,buffer:r,length:o,finished:i,destroyed:a,pos:c}=this;return t.length=o,t.pos=c,t.finished=i,t.destroyed=a,o%n&&t.buffer.set(r),t}};w.HashMD=te});var Oe=h(k=>{"use strict";Object.defineProperty(k,"__esModule",{value:!0});k.sha224=k.sha256=void 0;var ne=Ue(),l=Q(),Lt=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),m=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),_=new Uint32Array(64),V=class extends ne.HashMD{constructor(){super(64,32,8,!1),this.A=m[0]|0,this.B=m[1]|0,this.C=m[2]|0,this.D=m[3]|0,this.E=m[4]|0,this.F=m[5]|0,this.G=m[6]|0,this.H=m[7]|0}get(){let{A:t,B:n,C:r,D:o,E:i,F:a,G:c,H:d}=this;return[t,n,r,o,i,a,c,d]}set(t,n,r,o,i,a,c,d){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=a|0,this.G=c|0,this.H=d|0}process(t,n){for(let f=0;f<16;f++,n+=4)_[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){let U=_[f-15],I=_[f-2],we=(0,l.rotr)(U,7)^(0,l.rotr)(U,18)^U>>>3,G=(0,l.rotr)(I,17)^(0,l.rotr)(I,19)^I>>>10;_[f]=G+_[f-7]+we+_[f-16]|0}let{A:r,B:o,C:i,D:a,E:c,F:d,G:b,H:g}=this;for(let f=0;f<64;f++){let U=(0,l.rotr)(c,6)^(0,l.rotr)(c,11)^(0,l.rotr)(c,25),I=g+U+(0,ne.Chi)(c,d,b)+Lt[f]+_[f]|0,G=((0,l.rotr)(r,2)^(0,l.rotr)(r,13)^(0,l.rotr)(r,22))+(0,ne.Maj)(r,o,i)|0;g=b,b=d,d=c,c=a+I|0,a=i,i=o,o=r,r=I+G|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,a=a+this.D|0,c=c+this.E|0,d=d+this.F|0,b=b+this.G|0,g=g+this.H|0,this.set(r,o,i,a,c,d,b,g)}roundClean(){_.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},re=class extends V{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};k.sha256=(0,l.wrapConstructor)(()=>new V);k.sha224=(0,l.wrapConstructor)(()=>new re)});var Le=h(R=>{"use strict";Object.defineProperty(R,"__esModule",{value:!0});R.sha224=void 0;var Nt=Oe();function Ct(e){return Nt.sha224.create().update(new Uint8Array(e)).digest()}R.sha224=Ct});var je=h(p=>{"use strict";Object.defineProperty(p,"__esModule",{value:!0});p.Principal=p.JSON_KEY_PRINCIPAL=void 0;var Ne=_e(),jt=ve(),Mt=Le();p.JSON_KEY_PRINCIPAL="__principal__";var Dt=2,Ce=4,Vt="aaaaa-aa",Rt=e=>{var t;return new Uint8Array(((t=e.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(n=>parseInt(n,16)))},Ht=e=>e.reduce((t,n)=>t+n.toString(16).padStart(2,"0"),""),oe=class e{constructor(t){this._arr=t,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([Ce]))}static managementCanister(){return this.fromHex(Vt)}static selfAuthenticating(t){let n=(0,Mt.sha224)(t);return new this(new Uint8Array([...n,Dt]))}static from(t){if(typeof t=="string")return e.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new e(t);if(typeof t=="object"&&t!==null&&t._isPrincipal===!0)return new e(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(Rt(t))}static fromText(t){let n=t;if(t.includes(p.JSON_KEY_PRINCIPAL)){let a=JSON.parse(t);p.JSON_KEY_PRINCIPAL in a&&(n=a[p.JSON_KEY_PRINCIPAL])}let r=n.toLowerCase().replace(/-/g,""),o=(0,Ne.decode)(r);o=o.slice(4,o.length);let i=new this(o);if(i.toText()!==n)throw new Error(`Principal "${i.toText()}" does not have a valid checksum (original value "${n}" may not be a valid Principal ID).`);return i}static fromUint8Array(t){return new this(t)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===Ce}toUint8Array(){return this._arr}toHex(){return Ht(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,(0,jt.getCrc32)(this._arr));let r=new Uint8Array(t),o=Uint8Array.from(this._arr),i=new Uint8Array([...r,...o]),c=(0,Ne.encode)(i).match(/.{1,5}/g);if(!c)throw new Error;return c.join("-")}toString(){return this.toText()}toJSON(){return{[p.JSON_KEY_PRINCIPAL]:this.toText()}}compareTo(t){for(let n=0;n<Math.min(this._arr.length,t._arr.length);n++){if(this._arr[n]<t._arr[n])return"lt";if(this._arr[n]>t._arr[n])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let n=this.compareTo(t);return n=="lt"||n=="eq"}gtEq(t){let n=this.compareTo(t);return n=="gt"||n=="eq"}};p.Principal=oe});function B(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function K(e,t){let n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);let r=B(n);return(o,i)=>r.then(a=>i(a.transaction(t,o).objectStore(t)))}function de(){return fe||(fe=K("keyval-store","keyval")),fe}function ue(e,t,n=de()){return n("readwrite",r=>(r.put(t,e),B(r.transaction)))}function xe(e,t=de()){return t("readwrite",n=>(e.forEach(r=>n.delete(r)),B(n.transaction)))}function Jt(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},B(e.transaction)}function le(e=de()){return e("readonly",t=>{if(t.getAll&&t.getAllKeys)return Promise.all([B(t.getAllKeys()),B(t.getAll())]).then(([r,o])=>r.map((i,a)=>[i,o[a]]));let n=[];return e("readonly",r=>Jt(r,o=>n.push([o.key,o.value])).then(()=>n))})}var fe,Re=me(()=>{});var he={};nt(he,{delPageViews:()=>zt,delTrackEvents:()=>Qt,getPageViews:()=>Xt,getTrackEvents:()=>Zt,setPageView:()=>$t,setTrackEvent:()=>Yt});var be,pe,$t,Xt,zt,Yt,Zt,Qt,ye=me(()=>{"use strict";Re();be=K("juno-views","views"),pe=K("juno-events","events"),$t=({key:e,view:t})=>ue(e,t,be),Xt=()=>le(be),zt=e=>xe(e,be),Yt=({key:e,track:t})=>ue(e,t,pe),Zt=()=>le(pe),Qt=e=>xe(e,pe)});var Wt=ot(je(),1);var H=e=>e==null,ie=e=>!H(e),Ft=class extends Error{},T=(e,t)=>{if(H(e))throw new Ft(t)};var W=e=>ie(e)?[e]:[];var se=()=>typeof window<"u";import{webcrypto as De}from"node:crypto";var Me="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Kt=128,v,P;function qt(e){!v||v.length<e?(v=Buffer.allocUnsafe(e*Kt),De.getRandomValues(v),P=0):P+e>v.length&&(De.getRandomValues(v),P=0),P+=e}function F(e=21){qt(e-=0);let t="";for(let n=P-e;n<P;n++)t+=Me[v[n]&63];return t}var Ve=()=>BigInt(Date.now())*BigInt(1e6);var ae=()=>({collected_at:Ve(),updated_at:[],version:[]}),ce=()=>{let{userAgent:e}=navigator;return{user_agent:W(e)}};var Gt="Analytics worker not initialized. Did you call `initOrbiter`?",S=e=>{H(e)&&console.warn(Gt)};var en=()=>{if(!(typeof crypto>"u"))return F()},q=en(),x,He=e=>{let{path:t}=e.worker??{},n=t===void 0?"./workers/analytics.worker.js":t;x=new Worker(n);let r=()=>console.warn("Unable to connect to the analytics web worker. Have you deployed it?");return x?.addEventListener("error",r,!1),nn(e),{cleanup(){x?.removeEventListener("error",r,!1)}}},We=()=>{let e=async()=>await Ke(),t=new Proxy(history.pushState,{apply:async(n,r,o)=>{n.apply(r,o),await e()}});return history.pushState=t,addEventListener("popstate",e,{passive:!0}),{cleanup(){t=null,removeEventListener("popstate",e,!1)}}},Fe="No session ID initialized.",ge=async()=>{if(!se())return;T(q,Fe);let{title:e,location:{href:t},referrer:n}=document,{innerWidth:r,innerHeight:o}=window,{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),a={title:e,href:t,referrer:W(ie(n)&&n!==""?n:void 0),device:{inner_width:r,inner_height:o},time_zone:i,session_id:q,...ce(),...ae()};await(await Promise.resolve().then(()=>(ye(),he))).setPageView({key:F(),view:a})},Ke=async()=>{S(x),await ge(),x?.postMessage({msg:"junoTrackPageView"})},tn=async e=>{if(!se())return;T(q,Fe),S(x),await(await Promise.resolve().then(()=>(ye(),he))).setTrackEvent({key:F(),track:{...e,session_id:q,...ce(),...ae()}}),x?.postMessage({msg:"junoTrackEvent"})},nn=e=>{S(x),x?.postMessage({msg:"junoInitEnvironment",data:e})},qe=()=>{S(x),x?.postMessage({msg:"junoStartTrackTimer"})},Ge=()=>{S(x),x?.postMessage({msg:"junoStopTracker"})};var Je=()=>{let e=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_SATELLITE_ID??import.meta.env?.PUBLIC_SATELLITE_ID:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_SATELLITE_ID??e():e()},$e=()=>{let e=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_ORBITER_ID??import.meta.env?.PUBLIC_ORBITER_ID:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_ORBITER_ID??e():e()},Xe=()=>{let e=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_CONTAINER??import.meta.env?.PUBLIC_CONTAINER:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_CONTAINER??e():e()};var rn=e=>{let t=e?.satelliteId??Je();T(t,"Satellite ID is not configured. Orbiter cannot be initialized without a target Satellite.");let n=e?.orbiterId??$e();T(n,"Orbiter ID is not configured. The analytics cannot be initialized without an Orbiter.");let r=e?.container??Xe();return{orbiterId:n,satelliteId:t,container:r,worker:e?.worker}},Dn=async e=>{await ge();let t=rn(e),{cleanup:n}=He(t),{cleanup:r}=We();return qe(),()=>{Ge(),n(),r()}};export{Dn as initOrbiter,tn as trackEvent,Ke as trackPageView};
|
|
3
|
+
var Wt=Object.create;var ye=Object.defineProperty;var Kt=Object.getOwnPropertyDescriptor;var qt=Object.getOwnPropertyNames;var Gt=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty;var $t=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,n)=>(typeof require<"u"?require:t)[n]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var ge=(e,t)=>()=>(e&&(t=e(e=0)),t);var w=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Ze=(e,t)=>{for(var n in t)ye(e,n,{get:t[n],enumerable:!0})},Xt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qt(t))!Jt.call(e,o)&&o!==n&&ye(e,o,{get:()=>t[o],enumerable:!(r=Kt(t,o))||r.enumerable});return e};var zt=(e,t,n)=>(n=e!=null?Wt(Gt(e)):{},Xt(t||!e||!e.__esModule?ye(n,"default",{value:e,enumerable:!0}):n,e));var Qe=w(M=>{"use strict";Object.defineProperty(M,"__esModule",{value:!0});M.decode=M.encode=void 0;var z="abcdefghijklmnopqrstuvwxyz234567",L=Object.create(null);for(let e=0;e<z.length;e++)L[z[e]]=e;L[0]=L.o;L[1]=L.i;function Yt(e){let t=0,n=0,r="";function o(i){return t<0?n|=i>>-t:n=i<<t&248,t>3?(t-=8,1):(t<4&&(r+=z[n>>3],t+=5),0)}for(let i=0;i<e.length;)i+=o(e[i]);return r+(t<0?z[n>>3]:"")}M.encode=Yt;function Zt(e){let t=0,n=0,r=new Uint8Array(e.length*4/3|0),o=0;function i(a){let s=L[a.toLowerCase()];if(s===void 0)throw new Error(`Invalid character: ${JSON.stringify(a)}`);s<<=3,n|=s>>>t,t+=5,t>=8&&(r[o++]=n,t-=8,t>0?n=s<<5-t&255:n=0)}for(let a of e)i(a);return r.slice(0,o)}M.decode=Zt});var et=w(Y=>{"use strict";Object.defineProperty(Y,"__esModule",{value:!0});Y.getCrc32=void 0;var Qt=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function en(e){let t=new Uint8Array(e),n=-1;for(let r=0;r<t.length;r++){let i=(t[r]^n)&255;n=Qt[i]^n>>>8}return(n^-1)>>>0}Y.getCrc32=en});var ve=w(l=>{"use strict";Object.defineProperty(l,"__esModule",{value:!0});l.output=l.exists=l.hash=l.bytes=l.bool=l.number=l.isBytes=void 0;function Z(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}l.number=Z;function tt(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}l.bool=tt;function nt(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}l.isBytes=nt;function we(e,...t){if(!nt(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}l.bytes=we;function rt(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Z(e.outputLen),Z(e.blockLen)}l.hash=rt;function ot(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}l.exists=ot;function it(e,t){we(e);let n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}l.output=it;var tn={number:Z,bool:tt,bytes:we,hash:rt,exists:ot,output:it};l.default=tn});var at=w(ee=>{"use strict";Object.defineProperty(ee,"__esModule",{value:!0});ee.crypto=void 0;var Q=$t("node:crypto");ee.crypto=Q&&typeof Q=="object"&&"webcrypto"in Q?Q.webcrypto:void 0});var Ee=w(c=>{"use strict";Object.defineProperty(c,"__esModule",{value:!0});c.randomBytes=c.wrapXOFConstructorWithOpts=c.wrapConstructorWithOpts=c.wrapConstructor=c.checkOpts=c.Hash=c.concatBytes=c.toBytes=c.utf8ToBytes=c.asyncLoop=c.nextTick=c.hexToBytes=c.bytesToHex=c.byteSwap32=c.byteSwapIfBE=c.byteSwap=c.isLE=c.rotl=c.rotr=c.createView=c.u32=c.u8=c.isBytes=void 0;var _e=at(),Te=ve();function nn(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}c.isBytes=nn;var rn=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);c.u8=rn;var on=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));c.u32=on;var an=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);c.createView=an;var sn=(e,t)=>e<<32-t|e>>>t;c.rotr=sn;var cn=(e,t)=>e<<t|e>>>32-t>>>0;c.rotl=cn;c.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;var un=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255;c.byteSwap=un;c.byteSwapIfBE=c.isLE?e=>e:e=>(0,c.byteSwap)(e);function fn(e){for(let t=0;t<e.length;t++)e[t]=(0,c.byteSwap)(e[t])}c.byteSwap32=fn;var dn=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ln(e){(0,Te.bytes)(e);let t="";for(let n=0;n<e.length;n++)t+=dn[e[n]];return t}c.bytesToHex=ln;var v={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function st(e){if(e>=v._0&&e<=v._9)return e-v._0;if(e>=v._A&&e<=v._F)return e-(v._A-10);if(e>=v._a&&e<=v._f)return e-(v._a-10)}function pn(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);let t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let r=new Uint8Array(n);for(let o=0,i=0;o<n;o++,i+=2){let a=st(e.charCodeAt(i)),s=st(e.charCodeAt(i+1));if(a===void 0||s===void 0){let u=e[i]+e[i+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+i)}r[o]=a*16+s}return r}c.hexToBytes=pn;var xn=async()=>{};c.nextTick=xn;async function bn(e,t,n){let r=Date.now();for(let o=0;o<e;o++){n(o);let i=Date.now()-r;i>=0&&i<t||(await(0,c.nextTick)(),r+=i)}}c.asyncLoop=bn;function ct(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}c.utf8ToBytes=ct;function te(e){return typeof e=="string"&&(e=ct(e)),(0,Te.bytes)(e),e}c.toBytes=te;function hn(...e){let t=0;for(let r=0;r<e.length;r++){let o=e[r];(0,Te.bytes)(o),t+=o.length}let n=new Uint8Array(t);for(let r=0,o=0;r<e.length;r++){let i=e[r];n.set(i,o),o+=i.length}return n}c.concatBytes=hn;var Ie=class{clone(){return this._cloneInto()}};c.Hash=Ie;var mn={}.toString;function yn(e,t){if(t!==void 0&&mn.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(e,t)}c.checkOpts=yn;function gn(e){let t=r=>e().update(te(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}c.wrapConstructor=gn;function wn(e){let t=(r,o)=>e(o).update(te(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}c.wrapConstructorWithOpts=wn;function vn(e){let t=(r,o)=>e(o).update(te(r)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}c.wrapXOFConstructorWithOpts=vn;function _n(e=32){if(_e.crypto&&typeof _e.crypto.getRandomValues=="function")return _e.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}c.randomBytes=_n});var ut=w(_=>{"use strict";Object.defineProperty(_,"__esModule",{value:!0});_.HashMD=_.Maj=_.Chi=void 0;var Pe=ve(),H=Ee();function In(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);let o=BigInt(32),i=BigInt(4294967295),a=Number(n>>o&i),s=Number(n&i),u=r?4:0,d=r?0:4;e.setUint32(t+u,a,r),e.setUint32(t+d,s,r)}var Tn=(e,t,n)=>e&t^~e&n;_.Chi=Tn;var En=(e,t,n)=>e&t^e&n^t&n;_.Maj=En;var ke=class extends H.Hash{constructor(t,n,r,o){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,H.createView)(this.buffer)}update(t){(0,Pe.exists)(this);let{view:n,buffer:r,blockLen:o}=this;t=(0,H.toBytes)(t);let i=t.length;for(let a=0;a<i;){let s=Math.min(o-this.pos,i-a);if(s===o){let u=(0,H.createView)(t);for(;o<=i-a;a+=o)this.process(u,a);continue}r.set(t.subarray(a,a+s),this.pos),this.pos+=s,a+=s,this.pos===o&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,Pe.exists)(this),(0,Pe.output)(t,this),this.finished=!0;let{buffer:n,view:r,blockLen:o,isLE:i}=this,{pos:a}=this;n[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(r,0),a=0);for(let f=a;f<o;f++)n[f]=0;In(r,o-8,BigInt(this.length*8),i),this.process(r,0);let s=(0,H.createView)(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let d=u/4,x=this.get();if(d>x.length)throw new Error("_sha2: outputLen bigger than state");for(let f=0;f<d;f++)s.setUint32(4*f,x[f],i)}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:n,buffer:r,length:o,finished:i,destroyed:a,pos:s}=this;return t.length=o,t.pos=s,t.finished=i,t.destroyed=a,o%n&&t.buffer.set(r),t}};_.HashMD=ke});var ft=w(B=>{"use strict";Object.defineProperty(B,"__esModule",{value:!0});B.sha224=B.sha256=void 0;var Ae=ut(),b=Ee(),Pn=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),I=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),T=new Uint32Array(64),ne=class extends Ae.HashMD{constructor(){super(64,32,8,!1),this.A=I[0]|0,this.B=I[1]|0,this.C=I[2]|0,this.D=I[3]|0,this.E=I[4]|0,this.F=I[5]|0,this.G=I[6]|0,this.H=I[7]|0}get(){let{A:t,B:n,C:r,D:o,E:i,F:a,G:s,H:u}=this;return[t,n,r,o,i,a,s,u]}set(t,n,r,o,i,a,s,u){this.A=t|0,this.B=n|0,this.C=r|0,this.D=o|0,this.E=i|0,this.F=a|0,this.G=s|0,this.H=u|0}process(t,n){for(let f=0;f<16;f++,n+=4)T[f]=t.getUint32(n,!1);for(let f=16;f<64;f++){let P=T[f-15],k=T[f-2],Ye=(0,b.rotr)(P,7)^(0,b.rotr)(P,18)^P>>>3,me=(0,b.rotr)(k,17)^(0,b.rotr)(k,19)^k>>>10;T[f]=me+T[f-7]+Ye+T[f-16]|0}let{A:r,B:o,C:i,D:a,E:s,F:u,G:d,H:x}=this;for(let f=0;f<64;f++){let P=(0,b.rotr)(s,6)^(0,b.rotr)(s,11)^(0,b.rotr)(s,25),k=x+P+(0,Ae.Chi)(s,u,d)+Pn[f]+T[f]|0,me=((0,b.rotr)(r,2)^(0,b.rotr)(r,13)^(0,b.rotr)(r,22))+(0,Ae.Maj)(r,o,i)|0;x=d,d=u,u=s,s=a+k|0,a=i,i=o,o=r,r=k+me|0}r=r+this.A|0,o=o+this.B|0,i=i+this.C|0,a=a+this.D|0,s=s+this.E|0,u=u+this.F|0,d=d+this.G|0,x=x+this.H|0,this.set(r,o,i,a,s,u,d,x)}roundClean(){T.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Se=class extends ne{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}};B.sha256=(0,b.wrapConstructor)(()=>new ne);B.sha224=(0,b.wrapConstructor)(()=>new Se)});var dt=w(re=>{"use strict";Object.defineProperty(re,"__esModule",{value:!0});re.sha224=void 0;var kn=ft();function An(e){return kn.sha224.create().update(new Uint8Array(e)).digest()}re.sha224=An});var xt=w(y=>{"use strict";Object.defineProperty(y,"__esModule",{value:!0});y.Principal=y.JSON_KEY_PRINCIPAL=void 0;var lt=Qe(),Sn=et(),Cn=dt();y.JSON_KEY_PRINCIPAL="__principal__";var Ln=2,pt=4,Mn="aaaaa-aa",Bn=e=>{var t;return new Uint8Array(((t=e.match(/.{1,2}/g))!==null&&t!==void 0?t:[]).map(n=>parseInt(n,16)))},Nn=e=>e.reduce((t,n)=>t+n.toString(16).padStart(2,"0"),""),Ce=class e{constructor(t){this._arr=t,this._isPrincipal=!0}static anonymous(){return new this(new Uint8Array([pt]))}static managementCanister(){return this.fromHex(Mn)}static selfAuthenticating(t){let n=(0,Cn.sha224)(t);return new this(new Uint8Array([...n,Ln]))}static from(t){if(typeof t=="string")return e.fromText(t);if(Object.getPrototypeOf(t)===Uint8Array.prototype)return new e(t);if(typeof t=="object"&&t!==null&&t._isPrincipal===!0)return new e(t._arr);throw new Error(`Impossible to convert ${JSON.stringify(t)} to Principal.`)}static fromHex(t){return new this(Bn(t))}static fromText(t){let n=t;if(t.includes(y.JSON_KEY_PRINCIPAL)){let a=JSON.parse(t);y.JSON_KEY_PRINCIPAL in a&&(n=a[y.JSON_KEY_PRINCIPAL])}let r=n.toLowerCase().replace(/-/g,""),o=(0,lt.decode)(r);o=o.slice(4,o.length);let i=new this(o);if(i.toText()!==n)throw new Error(`Principal "${i.toText()}" does not have a valid checksum (original value "${n}" may not be a valid Principal ID).`);return i}static fromUint8Array(t){return new this(t)}isAnonymous(){return this._arr.byteLength===1&&this._arr[0]===pt}toUint8Array(){return this._arr}toHex(){return Nn(this._arr).toUpperCase()}toText(){let t=new ArrayBuffer(4);new DataView(t).setUint32(0,(0,Sn.getCrc32)(this._arr));let r=new Uint8Array(t),o=Uint8Array.from(this._arr),i=new Uint8Array([...r,...o]),s=(0,lt.encode)(i).match(/.{1,5}/g);if(!s)throw new Error;return s.join("-")}toString(){return this.toText()}toJSON(){return{[y.JSON_KEY_PRINCIPAL]:this.toText()}}compareTo(t){for(let n=0;n<Math.min(this._arr.length,t._arr.length);n++){if(this._arr[n]<t._arr[n])return"lt";if(this._arr[n]>t._arr[n])return"gt"}return this._arr.length<t._arr.length?"lt":this._arr.length>t._arr.length?"gt":"eq"}ltEq(t){let n=this.compareTo(t);return n=="lt"||n=="eq"}gtEq(t){let n=this.compareTo(t);return n=="gt"||n=="eq"}};y.Principal=Ce});var Ct={};Ze(Ct,{CLSThresholds:()=>Ue,FCPThresholds:()=>Oe,FIDThresholds:()=>Ve,INPThresholds:()=>je,LCPThresholds:()=>De,TTFBThresholds:()=>Fe,onCLS:()=>Rn,onFCP:()=>It,onFID:()=>Qn,onINP:()=>Jn,onLCP:()=>$n,onTTFB:()=>zn});var Ne,E,G,vt,ce,_t,C,Re,fe,h,F,m,He,J,de,D,yt,ue,gt,Vn,We,$,Oe,It,Ue,Rn,Tt,Me,ae,Hn,Et,Wn,g,se,Pt,Kn,qn,Gn,kt,je,Jn,De,Be,$n,Fe,Xn,zn,q,Yn,wt,At,Zn,St,Ve,Qn,Lt=ge(()=>{_t=-1,C=function(e){addEventListener("pageshow",function(t){t.persisted&&(_t=t.timeStamp,e(t))},!0)},Re=function(){var e=self.performance&&performance.getEntriesByType&&performance.getEntriesByType("navigation")[0];if(e&&e.responseStart>0&&e.responseStart<performance.now())return e},fe=function(){var e=Re();return e&&e.activationStart||0},h=function(e,t){var n=Re(),r="navigate";return _t>=0?r="back-forward-cache":n&&(document.prerendering||fe()>0?r="prerender":document.wasDiscarded?r="restore":n.type&&(r=n.type.replace(/_/g,"-"))),{name:e,value:t===void 0?-1:t,rating:"good",delta:0,entries:[],id:"v4-".concat(Date.now(),"-").concat(Math.floor(8999999999999*Math.random())+1e12),navigationType:r}},F=function(e,t,n){try{if(PerformanceObserver.supportedEntryTypes.includes(e)){var r=new PerformanceObserver(function(o){Promise.resolve().then(function(){t(o.getEntries())})});return r.observe(Object.assign({type:e,buffered:!0},n||{})),r}}catch{}},m=function(e,t,n,r){var o,i;return function(a){t.value>=0&&(a||r)&&((i=t.value-(o||0))||o===void 0)&&(o=t.value,t.delta=i,t.rating=function(s,u){return s>u[1]?"poor":s>u[0]?"needs-improvement":"good"}(t.value,n),e(t))}},He=function(e){requestAnimationFrame(function(){return requestAnimationFrame(function(){return e()})})},J=function(e){document.addEventListener("visibilitychange",function(){document.visibilityState==="hidden"&&e()})},de=function(e){var t=!1;return function(){t||(e(),t=!0)}},D=-1,yt=function(){return document.visibilityState!=="hidden"||document.prerendering?1/0:0},ue=function(e){document.visibilityState==="hidden"&&D>-1&&(D=e.type==="visibilitychange"?e.timeStamp:0,Vn())},gt=function(){addEventListener("visibilitychange",ue,!0),addEventListener("prerenderingchange",ue,!0)},Vn=function(){removeEventListener("visibilitychange",ue,!0),removeEventListener("prerenderingchange",ue,!0)},We=function(){return D<0&&(D=yt(),gt(),C(function(){setTimeout(function(){D=yt(),gt()},0)})),{get firstHiddenTime(){return D}}},$=function(e){document.prerendering?addEventListener("prerenderingchange",function(){return e()},!0):e()},Oe=[1800,3e3],It=function(e,t){t=t||{},$(function(){var n,r=We(),o=h("FCP"),i=F("paint",function(a){a.forEach(function(s){s.name==="first-contentful-paint"&&(i.disconnect(),s.startTime<r.firstHiddenTime&&(o.value=Math.max(s.startTime-fe(),0),o.entries.push(s),n(!0)))})});i&&(n=m(e,o,Oe,t.reportAllChanges),C(function(a){o=h("FCP"),n=m(e,o,Oe,t.reportAllChanges),He(function(){o.value=performance.now()-a.timeStamp,n(!0)})}))})},Ue=[.1,.25],Rn=function(e,t){t=t||{},It(de(function(){var n,r=h("CLS",0),o=0,i=[],a=function(u){u.forEach(function(d){if(!d.hadRecentInput){var x=i[0],f=i[i.length-1];o&&d.startTime-f.startTime<1e3&&d.startTime-x.startTime<5e3?(o+=d.value,i.push(d)):(o=d.value,i=[d])}}),o>r.value&&(r.value=o,r.entries=i,n())},s=F("layout-shift",a);s&&(n=m(e,r,Ue,t.reportAllChanges),J(function(){a(s.takeRecords()),n(!0)}),C(function(){o=0,r=h("CLS",0),n=m(e,r,Ue,t.reportAllChanges),He(function(){return n()})}),setTimeout(n,0))}))},Tt=0,Me=1/0,ae=0,Hn=function(e){e.forEach(function(t){t.interactionId&&(Me=Math.min(Me,t.interactionId),ae=Math.max(ae,t.interactionId),Tt=ae?(ae-Me)/7+1:0)})},Et=function(){return Ne?Tt:performance.interactionCount||0},Wn=function(){"interactionCount"in performance||Ne||(Ne=F("event",Hn,{type:"event",buffered:!0,durationThreshold:0}))},g=[],se=new Map,Pt=0,Kn=function(){var e=Math.min(g.length-1,Math.floor((Et()-Pt)/50));return g[e]},qn=[],Gn=function(e){if(qn.forEach(function(o){return o(e)}),e.interactionId||e.entryType==="first-input"){var t=g[g.length-1],n=se.get(e.interactionId);if(n||g.length<10||e.duration>t.latency){if(n)e.duration>n.latency?(n.entries=[e],n.latency=e.duration):e.duration===n.latency&&e.startTime===n.entries[0].startTime&&n.entries.push(e);else{var r={id:e.interactionId,latency:e.duration,entries:[e]};se.set(r.id,r),g.push(r)}g.sort(function(o,i){return i.latency-o.latency}),g.length>10&&g.splice(10).forEach(function(o){return se.delete(o.id)})}}},kt=function(e){var t=self.requestIdleCallback||self.setTimeout,n=-1;return e=de(e),document.visibilityState==="hidden"?e():(n=t(e),J(e)),n},je=[200,500],Jn=function(e,t){"PerformanceEventTiming"in self&&"interactionId"in PerformanceEventTiming.prototype&&(t=t||{},$(function(){var n;Wn();var r,o=h("INP"),i=function(s){kt(function(){s.forEach(Gn);var u=Kn();u&&u.latency!==o.value&&(o.value=u.latency,o.entries=u.entries,r())})},a=F("event",i,{durationThreshold:(n=t.durationThreshold)!==null&&n!==void 0?n:40});r=m(e,o,je,t.reportAllChanges),a&&(a.observe({type:"first-input",buffered:!0}),J(function(){i(a.takeRecords()),r(!0)}),C(function(){Pt=Et(),g.length=0,se.clear(),o=h("INP"),r=m(e,o,je,t.reportAllChanges)}))}))},De=[2500,4e3],Be={},$n=function(e,t){t=t||{},$(function(){var n,r=We(),o=h("LCP"),i=function(u){t.reportAllChanges||(u=u.slice(-1)),u.forEach(function(d){d.startTime<r.firstHiddenTime&&(o.value=Math.max(d.startTime-fe(),0),o.entries=[d],n())})},a=F("largest-contentful-paint",i);if(a){n=m(e,o,De,t.reportAllChanges);var s=de(function(){Be[o.id]||(i(a.takeRecords()),a.disconnect(),Be[o.id]=!0,n(!0))});["keydown","click"].forEach(function(u){addEventListener(u,function(){return kt(s)},!0)}),J(s),C(function(u){o=h("LCP"),n=m(e,o,De,t.reportAllChanges),He(function(){o.value=performance.now()-u.timeStamp,Be[o.id]=!0,n(!0)})})}})},Fe=[800,1800],Xn=function e(t){document.prerendering?$(function(){return e(t)}):document.readyState!=="complete"?addEventListener("load",function(){return e(t)},!0):setTimeout(t,0)},zn=function(e,t){t=t||{};var n=h("TTFB"),r=m(e,n,Fe,t.reportAllChanges);Xn(function(){var o=Re();o&&(n.value=Math.max(o.responseStart-fe(),0),n.entries=[o],r(!0),C(function(){n=h("TTFB",0),(r=m(e,n,Fe,t.reportAllChanges))(!0)}))})},q={passive:!0,capture:!0},Yn=new Date,wt=function(e,t){E||(E=t,G=e,vt=new Date,St(removeEventListener),At())},At=function(){if(G>=0&&G<vt-Yn){var e={entryType:"first-input",name:E.type,target:E.target,cancelable:E.cancelable,startTime:E.timeStamp,processingStart:E.timeStamp+G};ce.forEach(function(t){t(e)}),ce=[]}},Zn=function(e){if(e.cancelable){var t=(e.timeStamp>1e12?new Date:performance.now())-e.timeStamp;e.type=="pointerdown"?function(n,r){var o=function(){wt(n,r),a()},i=function(){a()},a=function(){removeEventListener("pointerup",o,q),removeEventListener("pointercancel",i,q)};addEventListener("pointerup",o,q),addEventListener("pointercancel",i,q)}(t,e):wt(t,e)}},St=function(e){["mousedown","keydown","touchstart","pointerdown"].forEach(function(t){return e(t,Zn,q)})},Ve=[100,300],Qn=function(e,t){t=t||{},$(function(){var n,r=We(),o=h("FID"),i=function(u){u.startTime<r.firstHiddenTime&&(o.value=u.processingStart-u.startTime,o.entries.push(u),n(!0))},a=function(u){u.forEach(i)},s=F("first-input",a);n=m(e,o,Ve,t.reportAllChanges),s&&(J(de(function(){a(s.takeRecords()),s.disconnect()})),C(function(){var u;o=h("FID"),n=m(e,o,Ve,t.reportAllChanges),ce=[],G=-1,E=null,St(addEventListener),u=i,ce.push(u),At()}))})}});function V(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function X(e,t){let n=indexedDB.open(e);n.onupgradeneeded=()=>n.result.createObjectStore(t);let r=V(n);return(o,i)=>r.then(a=>i(a.transaction(t,o).objectStore(t)))}function qe(){return Ke||(Ke=X("keyval-store","keyval")),Ke}function le(e,t,n=qe()){return n("readwrite",r=>(r.put(t,e),V(r.transaction)))}function pe(e,t=qe()){return t("readwrite",n=>(e.forEach(r=>n.delete(r)),V(n.transaction)))}function er(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},V(e.transaction)}function xe(e=qe()){return e("readonly",t=>{if(t.getAll&&t.getAllKeys)return Promise.all([V(t.getAllKeys()),V(t.getAll())]).then(([r,o])=>r.map((i,a)=>[i,o[a]]));let n=[];return e("readonly",r=>er(r,o=>n.push([o.key,o.value])).then(()=>n))})}var Ke,Mt=ge(()=>{});var be={};Ze(be,{delPageViews:()=>rr,delPerformanceMetrics:()=>ur,delTrackEvents:()=>ar,getPageViews:()=>nr,getPerformanceMetrics:()=>cr,getTrackEvents:()=>ir,setPageView:()=>tr,setPerformanceMetric:()=>sr,setTrackEvent:()=>or});var Ge,Je,$e,tr,nr,rr,or,ir,ar,sr,cr,ur,he=ge(()=>{"use strict";Mt();Ge=X("juno-views","views"),Je=X("juno-events","events"),$e=X("juno-metrics","metrics"),tr=({key:e,view:t})=>le(e,t,Ge),nr=()=>xe(Ge),rr=e=>pe(e,Ge),or=({key:e,track:t})=>le(e,t,Je),ir=()=>xe(Je),ar=e=>pe(e,Je),sr=({key:e,view:t})=>le(e,t,$e),cr=()=>xe($e),ur=e=>pe(e,$e)});var On=zt(xt(),1);var oe=e=>e==null,Le=e=>!oe(e),Un=class extends Error{},A=(e,t)=>{if(oe(e))throw new Un(t)};var N=e=>Le(e)?[e]:[];var ie=()=>typeof window<"u";import{webcrypto as ht}from"node:crypto";var bt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var jn=128,S,O;function Dn(e){!S||S.length<e?(S=Buffer.allocUnsafe(e*jn),ht.getRandomValues(S),O=0):O+e>S.length&&(ht.getRandomValues(S),O=0),O+=e}function U(e=21){Dn(e-=0);let t="";for(let n=O-e;n<O;n++)t+=bt[S[n]&63];return t}var mt=()=>BigInt(Date.now())*BigInt(1e6);var W=()=>({collected_at:mt(),updated_at:[],version:[]}),K=()=>{let{userAgent:e}=navigator;return{user_agent:N(e)}};var Fn="Analytics worker not initialized. Did you call `initOrbiter`?",j=e=>{oe(e)&&console.warn(Fn)};var Bt=async e=>{let{onCLS:t,onFCP:n,onINP:r,onLCP:o,onTTFB:i}=await Promise.resolve().then(()=>(Lt(),Ct)),a=s=>{(async()=>await fr({...s,sessionId:e}))()};t(a),n(a),r(a),o(a),i(a)},fr=async e=>{let t=dr(e);if(t==="unknown"){console.warn("Performance metric ignored. Unknown metric name.",e);return}if(t==="deprecated")return;await(await Promise.resolve().then(()=>(he(),be))).setPerformanceMetric({key:U(),view:t})},dr=({sessionId:e,name:t,value:n,delta:r,id:o,navigationType:i})=>{let s=(()=>{switch(t){case"CLS":return{CLS:null};case"FCP":return{FCP:null};case"INP":return{INP:null};case"LCP":return{LCP:null};case"TTFB":return{TTFB:null};case"FID":return"deprecated";default:return"unknown"}})();if(s==="unknown"||s==="deprecated")return s;let d={value:n,delta:r,id:o,navigation_type:N((()=>{switch(i){case"navigate":return{Navigate:null};case"restore":return{Restore:null};case"reload":return{Reload:null};case"back-forward":return{BackForward:null};case"back-forward-cache":return{BackForwardCache:null};case"prerender":return{Prerender:null};default:return}})())},{location:{href:x}}=document,{updated_at:f,...P}=W();return{href:x,metric_name:s,session_id:e,data:{WebVitalsMetric:d},...K(),...P}};var lr=()=>{if(!(typeof crypto>"u"))return U()},R=lr(),p,Nt=e=>{let{path:t}=e.worker??{},n=t===void 0?"./workers/analytics.worker.js":t;p=new Worker(n);let r=()=>console.warn("Unable to connect to the analytics web worker. Have you deployed it?");return p?.addEventListener("error",r,!1),xr(e),{cleanup(){p?.removeEventListener("error",r,!1)}}},Ot=()=>{let e=async()=>await jt(),t=new Proxy(history.pushState,{apply:async(n,r,o)=>{n.apply(r,o),await e()}});return history.pushState=t,addEventListener("popstate",e,{passive:!0}),{cleanup(){t=null,removeEventListener("popstate",e,!1)}}},Xe="No session ID initialized.",ze=async()=>{if(!ie())return;A(R,Xe);let{title:e,location:{href:t},referrer:n}=document,{innerWidth:r,innerHeight:o}=window,{timeZone:i}=Intl.DateTimeFormat().resolvedOptions(),a={title:e,href:t,referrer:N(Le(n)&&n!==""?n:void 0),device:{inner_width:r,inner_height:o},time_zone:i,session_id:R,...K(),...W()};await(await Promise.resolve().then(()=>(he(),be))).setPageView({key:U(),view:a})},Ut=async({options:e})=>{ie()&&e?.performance!==!1&&(A(R,Xe),await Bt(R))},jt=async()=>{j(p),await ze(),p?.postMessage({msg:"junoTrackPageView"})},pr=async e=>{if(!ie())return;A(R,Xe),j(p),await(await Promise.resolve().then(()=>(he(),be))).setTrackEvent({key:U(),track:{...e,session_id:R,...K(),...W()}}),p?.postMessage({msg:"junoTrackEvent"})},xr=e=>{j(p),p?.postMessage({msg:"junoInitEnvironment",data:e})},Dt=()=>{j(p),p?.postMessage({msg:"junoStartTrackTimer"})},Ft=()=>{j(p),p?.postMessage({msg:"junoStopTracker"})};var Vt=()=>{let e=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_SATELLITE_ID??import.meta.env?.PUBLIC_SATELLITE_ID:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_SATELLITE_ID??e():e()},Rt=()=>{let e=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_ORBITER_ID??import.meta.env?.PUBLIC_ORBITER_ID:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_ORBITER_ID??e():e()},Ht=()=>{let e=()=>typeof import.meta<"u"&&typeof import.meta.env<"u"?import.meta.env?.VITE_CONTAINER??import.meta.env?.PUBLIC_CONTAINER:void 0;return typeof process<"u"?process.env?.NEXT_PUBLIC_CONTAINER??e():e()};var br=e=>{let t=e?.satelliteId??Vt();A(t,"Satellite ID is not configured. Orbiter cannot be initialized without a target Satellite.");let n=e?.orbiterId??Rt();A(n,"Orbiter ID is not configured. The analytics cannot be initialized without an Orbiter.");let r=e?.container??Ht();return{orbiterId:n,satelliteId:t,container:r,worker:e?.worker,options:e?.options}},eo=async e=>{await ze();let t=br(e),{cleanup:n}=Nt(t),{cleanup:r}=Ot();return await Ut(t),Dt(),()=>{Ft(),n(),r()}};export{eo as initOrbiter,pr as trackEvent,jt as trackPageView};
|
|
4
4
|
/*! Bundled license information:
|
|
5
5
|
|
|
6
6
|
@noble/hashes/utils.js:
|