@coframe/sdk 1.1.47 → 1.1.48

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.
@@ -300,9 +300,11 @@ const generateUUID = () => {
300
300
  const cryptoObject = (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.crypto;
301
301
  if (cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.randomUUID)
302
302
  return cryptoObject.randomUUID();
303
+ const randomByte = (cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.getRandomValues)
304
+ ? () => cryptoObject.getRandomValues(new Uint8Array(1))[0]
305
+ : () => Math.floor(Math.random() * 256);
303
306
  return `${1e7}${ -1e3}${ -4e3}${ -8e3}${ -1e11}`.replace(/[018]/g, (c) => {
304
- var _a, _b;
305
- const randomValue = (_b = (_a = cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.getRandomValues) === null || _a === void 0 ? void 0 : _a.call(cryptoObject, new Uint8Array(1))[0]) !== null && _b !== void 0 ? _b : 0;
307
+ const randomValue = randomByte();
306
308
  return (c ^
307
309
  (randomValue & (15 >> (c / 4)))).toString(16);
308
310
  });
@@ -369,16 +371,30 @@ const getOrGenerateUserToken = () => {
369
371
  const setUserTokenCookie = (uuid, logger) => {
370
372
  setCookie(USER_TOKEN_COOKIE_KEY, uuid, logger);
371
373
  };
374
+ const VISIT_BOUNDARY_MS = 2 * 60 * 60 * 1000;
375
+ function startsNewVisit(lastVisitTime, now) {
376
+ return !lastVisitTime || now - lastVisitTime > VISIT_BOUNDARY_MS;
377
+ }
378
+ function nextVisitCount(existing, lastVisitTime, now) {
379
+ return startsNewVisit(lastVisitTime, now) ? existing + 1 : existing;
380
+ }
381
+ function parseNonNegativeInt(raw) {
382
+ if (!raw || !/^\d+$/.test(raw))
383
+ return undefined;
384
+ const parsed = Number(raw);
385
+ return parsed <= 9007199254740991 ? parsed : undefined;
386
+ }
387
+ function parseVisitCount(raw) {
388
+ var _a;
389
+ return (_a = parseNonNegativeInt(raw)) !== null && _a !== void 0 ? _a : 0;
390
+ }
372
391
  const trackVisitCookie = (logger) => {
373
- const visitCountString = getCookie(VISIT_COUNT_COOKIE_KEY);
374
- const lastVisitTime = Number.parseInt(getCookie(LAST_VISIT_TIME_KEY), 10);
392
+ const existing = parseVisitCount(getCookie(VISIT_COUNT_COOKIE_KEY));
393
+ const lastVisitTime = parseVisitCount(getCookie(LAST_VISIT_TIME_KEY));
375
394
  const currentTime = Date.now();
376
- const twoHours = 2 * 60 * 60 * 1000;
377
- if (!lastVisitTime || currentTime - lastVisitTime > twoHours) {
378
- const visitCount = visitCountString
379
- ? Number.parseInt(visitCountString, 10) + 1
380
- : 1;
381
- setCookie(VISIT_COUNT_COOKIE_KEY, visitCount.toString(), logger);
395
+ const next = nextVisitCount(existing, lastVisitTime, currentTime);
396
+ if (next !== existing) {
397
+ setCookie(VISIT_COUNT_COOKIE_KEY, next.toString(), logger);
382
398
  setCookie(LAST_VISIT_TIME_KEY, currentTime.toString(), logger);
383
399
  }
384
400
  };
@@ -2291,6 +2307,16 @@ function murmurHash3_x86_32(key, seed) {
2291
2307
  return h1 >>> 0;
2292
2308
  }
2293
2309
 
2310
+ function parseLaneCookie(raw) {
2311
+ if (!raw)
2312
+ return {};
2313
+ try {
2314
+ return parseClaims(decodeURIComponent(raw));
2315
+ }
2316
+ catch (_a) {
2317
+ return parseClaims(raw);
2318
+ }
2319
+ }
2294
2320
  function parseClaims(raw) {
2295
2321
  if (!raw)
2296
2322
  return {};
@@ -2724,7 +2750,7 @@ function checkAllAudiences(metadata, ctx) {
2724
2750
  const audience = ctx.project.audiences[audienceId];
2725
2751
  if (!audience)
2726
2752
  continue;
2727
- const activated = checkActivationCondition(audience.selector, ctx.personalizationHeaders, ctx.currentPageUrl, ctx.languages, ctx.browserPlatform, ctx.userToken, ctx.userVisitCount, (js, args) => executeJs(js, args, { isExpression: true, nonce: ctx.nonce }), ctx.logger);
2753
+ const activated = checkActivationCondition(audience.selector, ctx.personalizationHeaders, ctx.currentPageUrl, ctx.languages, ctx.browserPlatform, ctx.userToken, ctx.userVisitCount, ctx.runJsFunction, ctx.logger);
2728
2754
  if (activated === false)
2729
2755
  return false;
2730
2756
  if (activated !== true)
@@ -2732,8 +2758,12 @@ function checkAllAudiences(metadata, ctx) {
2732
2758
  }
2733
2759
  return result;
2734
2760
  }
2735
- async function getVariantsAndElements(personalizationHeaders, project, previewVariantId, userToken, currentPageUrl, languages, browserPlatform, logger, nonce, laneClaims = {}, silentFallback = false, chooseCmabVariants) {
2736
- var _a;
2761
+ function audiencesPass(metadata, ctx) {
2762
+ const result = checkAllAudiences(metadata, ctx);
2763
+ return ctx.unknownIsInactive ? result === true : result !== false;
2764
+ }
2765
+ async function getVariantsAndElements(personalizationHeaders, project, previewVariantId, userToken, currentPageUrl, languages, browserPlatform, logger, nonce, laneClaims = {}, silentFallback = false, chooseCmabVariants, userVisitCountOverride, runtime = {}) {
2766
+ var _a, _b;
2737
2767
  const experimentsInfo = [];
2738
2768
  const cloakBot = !!((_a = project.settings) === null || _a === void 0 ? void 0 : _a.bot_cloaking_enabled) &&
2739
2769
  personalizationHeaders['x-is-bot'] === 'true';
@@ -2745,7 +2775,11 @@ async function getVariantsAndElements(personalizationHeaders, project, previewVa
2745
2775
  laneClaims: meClaims,
2746
2776
  };
2747
2777
  };
2748
- const userVisitCount = Number.parseInt(getCookie(VISIT_COUNT_COOKIE_KEY) || '0', 10);
2778
+ const userVisitCount = userVisitCountOverride !== null && userVisitCountOverride !== void 0 ? userVisitCountOverride : parseVisitCount(getCookie(VISIT_COUNT_COOKIE_KEY));
2779
+ const evaluateJsFunctions = (_b = runtime.evaluateJsFunctions) !== null && _b !== void 0 ? _b : true;
2780
+ const runJsFunction = evaluateJsFunctions
2781
+ ? (js, args) => executeJs(js, args, { isExpression: true, nonce })
2782
+ : undefined;
2749
2783
  const ctx = {
2750
2784
  project,
2751
2785
  personalizationHeaders,
@@ -2754,8 +2788,9 @@ async function getVariantsAndElements(personalizationHeaders, project, previewVa
2754
2788
  languages,
2755
2789
  browserPlatform,
2756
2790
  userVisitCount,
2757
- nonce,
2758
2791
  logger,
2792
+ runJsFunction,
2793
+ unknownIsInactive: !evaluateJsFunctions,
2759
2794
  };
2760
2795
  const validatedClaims = validateClaims(laneClaims, project.lanes);
2761
2796
  const previewVariantIds = splitPreviewVariantIds(previewVariantId);
@@ -2810,27 +2845,24 @@ function activateFrames(ctx) {
2810
2845
  return ctx.project.frames.filter((frame) => {
2811
2846
  if (!frame.experiments)
2812
2847
  return false;
2813
- const frameActivated = checkActivationCondition(frame.activation_condition, ctx.personalizationHeaders, ctx.currentPageUrl, ctx.languages, ctx.browserPlatform, ctx.userToken, ctx.userVisitCount, (js, args) => executeJs(js, args, { isExpression: true, nonce: ctx.nonce }), ctx.logger);
2814
- if (!frameActivated)
2815
- return false;
2816
- return true;
2848
+ const frameActivated = checkActivationCondition(frame.activation_condition, ctx.personalizationHeaders, ctx.currentPageUrl, ctx.languages, ctx.browserPlatform, ctx.userToken, ctx.userVisitCount, ctx.runJsFunction, ctx.logger);
2849
+ return ctx.unknownIsInactive ? frameActivated === true : !!frameActivated;
2817
2850
  });
2818
2851
  }
2819
2852
  async function assignFrames(activeFrames, validatedClaims, ctx, chooseCmabVariants) {
2820
- var _a;
2853
+ var _a, _b, _c;
2821
2854
  const { project, userToken, logger } = ctx;
2822
2855
  const experimentsInfo = [];
2823
2856
  const variantsAndElements = [];
2824
- const evalAudiences = (metadata) => checkAllAudiences(metadata, ctx) !== false;
2825
2857
  const audiencePass = new Map();
2826
2858
  const reachableByLane = {};
2827
2859
  for (const frame of activeFrames) {
2828
- for (const experiment of frame.experiments) {
2860
+ for (const experiment of (_a = frame.experiments) !== null && _a !== void 0 ? _a : []) {
2829
2861
  const metadata = experiment.metadata;
2830
2862
  const laneIds = experimentLaneIds(metadata);
2831
2863
  if (laneIds.length === 0)
2832
2864
  continue;
2833
- const passes = evalAudiences(metadata);
2865
+ const passes = audiencesPass(metadata, ctx);
2834
2866
  audiencePass.set(metadata.experiment_id, passes);
2835
2867
  if (passes) {
2836
2868
  for (const laneId of laneIds) {
@@ -2847,7 +2879,7 @@ async function assignFrames(activeFrames, validatedClaims, ctx, chooseCmabVarian
2847
2879
  let hasActivatedFrames = false;
2848
2880
  for (const frame of activeFrames) {
2849
2881
  let atLeastOneExperimentWasActivated = false;
2850
- for (const experiment of frame.experiments) {
2882
+ for (const experiment of (_b = frame.experiments) !== null && _b !== void 0 ? _b : []) {
2851
2883
  if (atLeastOneExperimentWasActivated)
2852
2884
  break;
2853
2885
  const metadata = experiment.metadata;
@@ -2857,7 +2889,7 @@ async function assignFrames(activeFrames, validatedClaims, ctx, chooseCmabVarian
2857
2889
  continue;
2858
2890
  let activated = audiencePass.get(metadata.experiment_id);
2859
2891
  if (activated === undefined) {
2860
- activated = evalAudiences(metadata);
2892
+ activated = audiencesPass(metadata, ctx);
2861
2893
  }
2862
2894
  if (!activated)
2863
2895
  continue;
@@ -2913,7 +2945,7 @@ async function assignFrames(activeFrames, validatedClaims, ctx, chooseCmabVarian
2913
2945
  try {
2914
2946
  mlVariantIds = await chooseCmabVariants(Array.from(cmabMetadataById.values()), userToken);
2915
2947
  }
2916
- catch (_b) {
2948
+ catch (_d) {
2917
2949
  mlVariantIds = new Map();
2918
2950
  }
2919
2951
  }
@@ -2924,7 +2956,7 @@ async function assignFrames(activeFrames, validatedClaims, ctx, chooseCmabVarian
2924
2956
  }
2925
2957
  const { metadata, variants, elements } = entry;
2926
2958
  let mlVariantId = metadata.type === 'CMAB'
2927
- ? ((_a = mlVariantIds.get(metadata.experiment_id)) !== null && _a !== void 0 ? _a : null)
2959
+ ? ((_c = mlVariantIds.get(metadata.experiment_id)) !== null && _c !== void 0 ? _c : null)
2928
2960
  : null;
2929
2961
  if (mlVariantId && !variants.some((v) => v.id === mlVariantId)) {
2930
2962
  logger.warn(`CMAB variant ${mlVariantId} not in experiment ${metadata.experiment_id}`, 'cmab_variant_not_found', { experiment_id: metadata.experiment_id });
@@ -2977,9 +3009,12 @@ async function previewVariants(previewVariantIds, validatedClaims, ctx, silentFa
2977
3009
  return uniqueByVariantId([...rolledOutVariants, ...requestedVariants]);
2978
3010
  }
2979
3011
  function findVariants(frames, variantIds) {
2980
- return frames.flatMap((frame) => frame.experiments.flatMap((experiment) => experiment.variants
2981
- .filter((variant) => variantIds.includes(variant.id))
2982
- .map((variant) => ({ variant, elements: frame.elements }))));
3012
+ return frames.flatMap((frame) => {
3013
+ var _a;
3014
+ return ((_a = frame.experiments) !== null && _a !== void 0 ? _a : []).flatMap((experiment) => experiment.variants
3015
+ .filter((variant) => variantIds.includes(variant.id))
3016
+ .map((variant) => ({ variant, elements: frame.elements })));
3017
+ });
2983
3018
  }
2984
3019
  function uniqueByVariantId(items) {
2985
3020
  const seen = {};
@@ -2991,10 +3026,13 @@ function uniqueByVariantId(items) {
2991
3026
  });
2992
3027
  }
2993
3028
  function keepRolledOutExperiments(frames) {
2994
- return frames.map((frame) => ({
2995
- ...frame,
2996
- experiments: frame.experiments.filter((experiment) => experiment.metadata.serving_mode === 'winner'),
2997
- }));
3029
+ return frames.map((frame) => {
3030
+ var _a;
3031
+ return ({
3032
+ ...frame,
3033
+ experiments: ((_a = frame.experiments) !== null && _a !== void 0 ? _a : []).filter((experiment) => experiment.metadata.serving_mode === 'winner'),
3034
+ });
3035
+ });
2998
3036
  }
2999
3037
 
3000
3038
  function buildSessionContext(isInitialApply) {
@@ -3665,6 +3703,7 @@ async function resolveProject(Coframe, previewVariantId, isSessionVariant, confi
3665
3703
  const queuedHeaders = getQueuedPersonalizationHeaders();
3666
3704
  let personalizationHeaders = queuedHeaders;
3667
3705
  let project = isSessionVariant ? undefined : projectData === null || projectData === void 0 ? void 0 : projectData.project;
3706
+ const assignmentContext = project ? projectData === null || projectData === void 0 ? void 0 : projectData.assignmentContext : undefined;
3668
3707
  if (!project) {
3669
3708
  const edgeResult = await fetchProject(config.projectUrl, Coframe.projectId, config.currentUrl || getCurrentPageUrl(), undefined, config.userContext, previewVariantId || undefined, undefined, (_b = config.referrer) !== null && _b !== void 0 ? _b : getBrowserReferrer());
3670
3709
  personalizationHeaders = mergeClientHeaders(queuedHeaders, edgeResult === null || edgeResult === void 0 ? void 0 : edgeResult.personalizationHeaders);
@@ -3681,6 +3720,7 @@ async function resolveProject(Coframe, previewVariantId, isSessionVariant, confi
3681
3720
  return {
3682
3721
  project,
3683
3722
  personalizationHeaders: personalizationHeaders,
3723
+ ...(assignmentContext ? { assignmentContext } : {}),
3684
3724
  };
3685
3725
  }
3686
3726
 
@@ -4452,18 +4492,12 @@ function setupSPANavigation(Coframe, project, config, previewVariantId, isSessio
4452
4492
  }
4453
4493
  function readLaneClaims() {
4454
4494
  const cookie = getCookie(LANE_COOKIE_KEY);
4455
- if (cookie) {
4456
- try {
4457
- return parseClaims(decodeURIComponent(cookie));
4458
- }
4459
- catch (_a) {
4460
- return parseClaims(cookie);
4461
- }
4462
- }
4495
+ if (cookie)
4496
+ return parseLaneCookie(cookie);
4463
4497
  try {
4464
4498
  return parseClaims(localStorage.getItem(LANE_COOKIE_KEY));
4465
4499
  }
4466
- catch (_b) {
4500
+ catch (_a) {
4467
4501
  return {};
4468
4502
  }
4469
4503
  }
@@ -4478,14 +4512,17 @@ function persistLaneClaims(claims, logger) {
4478
4512
  setCookie(LANE_COOKIE_KEY, encodeURIComponent(serialized), logger);
4479
4513
  }
4480
4514
  }
4481
- function createApplyVariants(Coframe, config, previewVariantId, isSessionVariant, executionStartTime, analytics, laneStore, runtime) {
4515
+ function createApplyVariants(Coframe, config, previewVariantId, isSessionVariant, executionStartTime, analytics, laneStore, runtime, initialAssignmentContext) {
4482
4516
  let isFirstApply = true;
4517
+ let snapshotContext = initialAssignmentContext;
4483
4518
  let applicationId = 0;
4484
4519
  const apply = async (pageUrl, pageProject, personalizationHeaders, signal, deadline) => {
4485
- var _a, _b;
4520
+ var _a, _b, _c, _d;
4486
4521
  const currentApplication = ++applicationId;
4487
4522
  if (signal === null || signal === void 0 ? void 0 : signal.aborted)
4488
4523
  return 'skipped';
4524
+ const assignmentContext = snapshotContext;
4525
+ snapshotContext = undefined;
4489
4526
  const preview = resolvePreview(pageUrl, previewVariantId, isSessionVariant);
4490
4527
  const chooseCmabVariants = createCmabVariantBatchChooser({
4491
4528
  projectId: Coframe.projectId,
@@ -4496,7 +4533,7 @@ function createApplyVariants(Coframe, config, previewVariantId, isSessionVariant
4496
4533
  disableRemoteAssignment: Boolean(config.projectUrl || config.ingestUrl),
4497
4534
  userContext: config.userContext,
4498
4535
  });
4499
- const { variantsAndElements, experimentsInfo, hasActivatedFrames, laneClaims, } = await getVariantsAndElements(personalizationHeaders, pageProject, preview.previewVariantId, Coframe.userToken, pageUrl, getBrowserLanguages(), getBrowserPlatform(), Coframe.logger, config.nonce, laneStore.claims, preview.isSessionVariant, chooseCmabVariants);
4536
+ const { variantsAndElements, experimentsInfo, hasActivatedFrames, laneClaims, } = await getVariantsAndElements(personalizationHeaders, pageProject, preview.previewVariantId, Coframe.userToken, pageUrl, (_b = assignmentContext === null || assignmentContext === void 0 ? void 0 : assignmentContext.languages) !== null && _b !== void 0 ? _b : getBrowserLanguages(), (_c = assignmentContext === null || assignmentContext === void 0 ? void 0 : assignmentContext.browserPlatform) !== null && _c !== void 0 ? _c : getBrowserPlatform(), Coframe.logger, config.nonce, laneStore.claims, preview.isSessionVariant, chooseCmabVariants, assignmentContext === null || assignmentContext === void 0 ? void 0 : assignmentContext.userVisitCount);
4500
4537
  if ((signal === null || signal === void 0 ? void 0 : signal.aborted) ||
4501
4538
  currentApplication !== applicationId ||
4502
4539
  (runtime === null || runtime === void 0 ? void 0 : runtime.isDestroyed()) ||
@@ -4504,7 +4541,7 @@ function createApplyVariants(Coframe, config, previewVariantId, isSessionVariant
4504
4541
  return 'skipped';
4505
4542
  if (!signal &&
4506
4543
  runtime &&
4507
- ((_b = pageProject === null || pageProject === void 0 ? void 0 : pageProject.settings) === null || _b === void 0 ? void 0 : _b.mutation_observer_active) &&
4544
+ ((_d = pageProject === null || pageProject === void 0 ? void 0 : pageProject.settings) === null || _d === void 0 ? void 0 : _d.mutation_observer_active) &&
4508
4545
  !urlsMatch(pageUrl, getCurrentPageUrl(), true))
4509
4546
  return 'stale-route';
4510
4547
  if (!signal && runtime) {
@@ -4550,7 +4587,7 @@ function createApplyVariants(Coframe, config, previewVariantId, isSessionVariant
4550
4587
  async function modifyPage(Coframe, configResult, projectResult, analytics, lifecycle) {
4551
4588
  var _a;
4552
4589
  const { config, timeoutMs, previewVariantId, isSessionVariant, integrationStartTime, executionStartTime, } = configResult;
4553
- const { project: cdnProject, personalizationHeaders } = projectResult;
4590
+ const { project: cdnProject, personalizationHeaders, assignmentContext, } = projectResult;
4554
4591
  const revealCoordinator = (_a = lifecycle === null || lifecycle === void 0 ? void 0 : lifecycle.revealCoordinator) !== null && _a !== void 0 ? _a : createRevealCoordinator(revealPage, logRevealListenerError(() => Coframe.logger));
4555
4592
  const runtime = lifecycle === null || lifecycle === void 0 ? void 0 : lifecycle.runtime;
4556
4593
  if (runtime && config.waitForHydration) {
@@ -4576,7 +4613,7 @@ async function modifyPage(Coframe, configResult, projectResult, analytics, lifec
4576
4613
  if (!(await ensureBody(Coframe, cdnProject, timeoutMs, config.nonce, revealCoordinator, () => !(runtime === null || runtime === void 0 ? void 0 : runtime.isDestroyed()))))
4577
4614
  return;
4578
4615
  const laneStore = { claims: readLaneClaims() };
4579
- const applier = createApplyVariants(Coframe, config, previewVariantId, isSessionVariant, executionStartTime, analytics, laneStore, runtime);
4616
+ const applier = createApplyVariants(Coframe, config, previewVariantId, isSessionVariant, executionStartTime, analytics, laneStore, runtime, assignmentContext);
4580
4617
  const initialUrl = getCurrentPageUrl();
4581
4618
  if (runtime) {
4582
4619
  const runtimeUrl = runtime.getState().currentUrl;
@@ -5179,6 +5216,9 @@ function injectOptions(options) {
5179
5216
  projectData: {
5180
5217
  project: options.projectData.project,
5181
5218
  personalizationHeaders: (_a = options.projectData.personalizationHeaders) !== null && _a !== void 0 ? _a : {},
5219
+ ...(options.projectData.assignmentContext
5220
+ ? { assignmentContext: options.projectData.assignmentContext }
5221
+ : {}),
5182
5222
  },
5183
5223
  });
5184
5224
  }
@@ -34,9 +34,11 @@ const generateUUID = () => {
34
34
  const cryptoObject = (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.crypto;
35
35
  if (cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.randomUUID)
36
36
  return cryptoObject.randomUUID();
37
+ const randomByte = (cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.getRandomValues)
38
+ ? () => cryptoObject.getRandomValues(new Uint8Array(1))[0]
39
+ : () => Math.floor(Math.random() * 256);
37
40
  return `${1e7}${ -1e3}${ -4e3}${ -8e3}${ -1e11}`.replace(/[018]/g, (c) => {
38
- var _a, _b;
39
- const randomValue = (_b = (_a = cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.getRandomValues) === null || _a === void 0 ? void 0 : _a.call(cryptoObject, new Uint8Array(1))[0]) !== null && _b !== void 0 ? _b : 0;
41
+ const randomValue = randomByte();
40
42
  return (c ^
41
43
  (randomValue & (15 >> (c / 4)))).toString(16);
42
44
  });
@@ -32,9 +32,11 @@ const generateUUID = () => {
32
32
  const cryptoObject = (_a = getGlobalScope()) === null || _a === void 0 ? void 0 : _a.crypto;
33
33
  if (cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.randomUUID)
34
34
  return cryptoObject.randomUUID();
35
+ const randomByte = (cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.getRandomValues)
36
+ ? () => cryptoObject.getRandomValues(new Uint8Array(1))[0]
37
+ : () => Math.floor(Math.random() * 256);
35
38
  return `${1e7}${ -1e3}${ -4e3}${ -8e3}${ -1e11}`.replace(/[018]/g, (c) => {
36
- var _a, _b;
37
- const randomValue = (_b = (_a = cryptoObject === null || cryptoObject === void 0 ? void 0 : cryptoObject.getRandomValues) === null || _a === void 0 ? void 0 : _a.call(cryptoObject, new Uint8Array(1))[0]) !== null && _b !== void 0 ? _b : 0;
39
+ const randomValue = randomByte();
38
40
  return (c ^
39
41
  (randomValue & (15 >> (c / 4)))).toString(16);
40
42
  });