@sentientui/core 0.33.0 → 0.34.0

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.
Files changed (52) hide show
  1. package/dist/chunk-3FKD44SF.mjs +2 -0
  2. package/dist/chunk-3FKD44SF.mjs.map +1 -0
  3. package/dist/chunk-DGRAS5VP.mjs +2 -0
  4. package/dist/chunk-DGRAS5VP.mjs.map +1 -0
  5. package/dist/{index-CgkImSaM.d.ts → index-C2EOL-_c.d.cts} +43 -4
  6. package/dist/{index-COl_pfNm.d.cts → index-DrMXbLKP.d.ts} +43 -4
  7. package/dist/index-engagement.js +1 -1
  8. package/dist/index-engagement.js.map +1 -1
  9. package/dist/index-engagement.mjs +1 -1
  10. package/dist/index-engagement.mjs.map +1 -1
  11. package/dist/index-graph.d.cts +6 -4
  12. package/dist/index-graph.d.ts +6 -4
  13. package/dist/index-graph.js +1 -1
  14. package/dist/index-graph.js.map +1 -1
  15. package/dist/index-graph.mjs +1 -1
  16. package/dist/index-graph.mjs.map +1 -1
  17. package/dist/index-local.d.cts +4 -2
  18. package/dist/index-local.d.ts +4 -2
  19. package/dist/index-region.d.cts +40 -0
  20. package/dist/index-region.d.ts +40 -0
  21. package/dist/index-region.js +2 -0
  22. package/dist/index-region.js.map +1 -0
  23. package/dist/index-region.mjs +2 -0
  24. package/dist/index-region.mjs.map +1 -0
  25. package/dist/index-server.d.cts +15 -2
  26. package/dist/index-server.d.ts +15 -2
  27. package/dist/index-server.js +1 -1
  28. package/dist/index-server.js.map +1 -1
  29. package/dist/index-server.mjs +1 -1
  30. package/dist/index-server.mjs.map +1 -1
  31. package/dist/index-style-sample.d.cts +12 -0
  32. package/dist/index-style-sample.d.ts +12 -0
  33. package/dist/index-style-sample.js +2 -0
  34. package/dist/index-style-sample.js.map +1 -0
  35. package/dist/index-style-sample.mjs +2 -0
  36. package/dist/index-style-sample.mjs.map +1 -0
  37. package/dist/index.d.cts +4 -2
  38. package/dist/index.d.ts +4 -2
  39. package/dist/index.js +1 -1
  40. package/dist/index.js.map +1 -1
  41. package/dist/index.mjs +1 -1
  42. package/dist/region-skeleton-CQ4yhVw1.d.cts +56 -0
  43. package/dist/region-skeleton-CQ4yhVw1.d.ts +56 -0
  44. package/dist/session-meta-CWGtzFOQ.d.ts +226 -0
  45. package/dist/session-meta-KwDqU9a8.d.cts +226 -0
  46. package/dist/style-vocabulary-BqviEw9O.d.cts +285 -0
  47. package/dist/style-vocabulary-BqviEw9O.d.ts +285 -0
  48. package/package.json +11 -1
  49. package/dist/chunk-EVYMV2C6.mjs +0 -2
  50. package/dist/chunk-EVYMV2C6.mjs.map +0 -1
  51. package/dist/session-meta-DydKfQiR.d.cts +0 -416
  52. package/dist/session-meta-DydKfQiR.d.ts +0 -416
@@ -1,4 +1,6 @@
1
- import { a1 as SlotConfigEntry, a0 as SitePalette, a2 as SlotDeclInput, I as CompoundLocator } from './session-meta-DydKfQiR.js';
1
+ import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-BqviEw9O.cjs';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-KwDqU9a8.cjs';
3
+ import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-CQ4yhVw1.cjs';
2
4
  import { SlotResult } from '@sentientui/policy';
3
5
 
4
6
  /** Manages anonymous session identity with cookie + localStorage layers. */
@@ -225,6 +227,17 @@ declare function attachMicroSignalDetectors(emit: MicroSignalEmitter, node: Elem
225
227
  tabLoss?: boolean;
226
228
  }): () => void;
227
229
 
230
+ /** A captured skeleton, or why none could be captured. */
231
+ type SkeletonReport = RegionSkeleton | {
232
+ status: 'too_large' | 'empty' | 'unaddressable';
233
+ };
234
+ /** One authored arm of a hybrid <Adaptive>, as it rendered. */
235
+ type AuthoredArmReport = {
236
+ key: string;
237
+ text?: string;
238
+ skeleton?: RegionSkeleton;
239
+ };
240
+
228
241
  /**
229
242
  * @internal Wires an alternate entry point's init as grantConsent()'s upgrade
230
243
  * path for `apiKey`. The /graph entry calls this when its init is gated on
@@ -315,6 +328,8 @@ type SentientConfig = {
315
328
  initialSlotConfig?: Record<string, SlotConfigEntry>;
316
329
  /** Site palette decided outside the browser (SSR). Seeds `getSitePalette()`. */
317
330
  initialPalette?: SitePalette;
331
+ /** Site styles the SSR decision's Redesign arms borrow. Seeds `getStyleVocabulary()`. */
332
+ initialVocabulary?: StyleVocabulary;
318
333
  /**
319
334
  * Persona decided during SSR. Takes priority over the html-attribute
320
335
  * adoption and the local snapshot.
@@ -383,6 +398,7 @@ type DecideOutcome = {
383
398
  goals?: GoalDefinition[];
384
399
  sectionMap?: SectionMapEntry[];
385
400
  palette?: SitePalette;
401
+ vocabulary?: StyleVocabulary;
386
402
  };
387
403
  type DecideInput = {
388
404
  sections?: string[];
@@ -398,6 +414,10 @@ type DecideInput = {
398
414
  /** Registry mode only: `false` omits the snippet bootstrap data (editor goals,
399
415
  * section map) the React SDK never reads — two queries per page saved. */
400
416
  bootstrap?: false;
417
+ /** Registry mode only: what the page can render per mounted slot. The
418
+ * server narrows each slot's arm space to it before drawing (CONTRACTS §2
419
+ * — an arm the page would refuse still books a trial). */
420
+ render?: Record<string, RenderCaps>;
401
421
  /**
402
422
  * Caller's build version (e.g. the snippet's `__SNIPPET_VERSION__`), sent
403
423
  * as `v` on the wire. Additive/best-effort: the server persists it for
@@ -482,7 +502,20 @@ type SentientClient = {
482
502
  * generation can ground its versions in what they replace — sent only on
483
503
  * the first report of an id, capped, and the server keeps it only at
484
504
  * first registration. */
485
- reportSlots(slotIds: string[], baselineTexts?: Record<string, string>): void;
505
+ reportSlots(slotIds: string[], baselineTexts?: Record<string, string>, baselineSkeletons?: Record<string, SkeletonReport>,
506
+ /** A hybrid <Adaptive>'s authored arms seen on screen (spec 2026-09-23
507
+ * §7.4): recorded for the dashboard and to ground generation. Sent once
508
+ * per (slot, key) per client. */
509
+ authoredArms?: Record<string, AuthoredArmReport[]>): void;
510
+ /** Report a skeleton for a PUBLISHED slot the server flagged `needsSkeleton`
511
+ * (registered before skeletons existed). Once per id per client; the server
512
+ * stores it only while the slot has none. Optional for hand-rolled clients. */
513
+ reportSkeleton?(slotId: string, skeleton: SkeletonReport): void;
514
+ /** A served Rewrite arm could not be applied because the region's markup no
515
+ * longer matches the skeleton it was written for. Batched, deduped per
516
+ * (slot, fingerprint), never throws. Enough distinct visitors reporting the
517
+ * same drift suspend that skeleton's arms. Optional for hand-rolled clients. */
518
+ reportDrift?(slotId: string, expectedFp: string, observedFp: string | null, reason: 'fp_mismatch' | 'unaddressable' | 'forms'): void;
486
519
  /**
487
520
  * Ask the server for the registry config of these MOUNTED slots. Batches a
488
521
  * tick's mounts into one decide scoped to exactly those ids, once per id per
@@ -491,7 +524,10 @@ type SentientClient = {
491
524
  * Listeners from `onSlotsChanged` fire when the answer lands. Optional so
492
525
  * hand-rolled/test clients keep type-checking.
493
526
  */
494
- requestSlots?(slotIds: string[], baselineTexts?: Record<string, string>): void;
527
+ requestSlots?(slotIds: string[], baselineTexts?: Record<string, string>, extras?: {
528
+ render?: Record<string, RenderCaps>;
529
+ skeletons?: Record<string, SkeletonReport>;
530
+ }): void;
495
531
  /**
496
532
  * Decide these MOUNTED request-declared slots (useAdaptiveTokens,
497
533
  * AdaptiveGroup) that nothing preloaded: a tick's mounts batch into one
@@ -521,6 +557,9 @@ type SentientClient = {
521
557
  isSlotDecided?(slotId: string): boolean;
522
558
  /** Site palette served with registry block decisions. Null when absent. */
523
559
  getSitePalette(): SitePalette | null;
560
+ /** Site styles the served Redesign (compose) arms borrow; null when none.
561
+ * Optional so hand-rolled clients keep type-checking. */
562
+ getStyleVocabulary?(): StyleVocabulary | null;
524
563
  /** Current persona estimate. Band is always `confidenceBand(confidence)`. Null when nothing is known yet. */
525
564
  getPersona(): {
526
565
  persona: string;
@@ -581,4 +620,4 @@ declare function grantConsent(apiKey?: string): void;
581
620
  */
582
621
  declare function init(config: SentientConfig): SentientClient;
583
622
 
584
- export { type AssignResult as A, sanitizePageUrl as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, sessionCookieName as F, type GoalDefinition as G, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, type SectionMapEntry as S, type WeightEntry as W, _registerConsentUpgradeInit as _, type Assignment as a, type AssignmentCache as b, type ComponentWeightEntry as c, type DecideOutcome as d, type EventType as e, type GoalOptions as f, type GraphClient as g, type GraphConfig as h, type GraphSnapshot as i, LOCAL_MODE_BANNER as j, type MicroSignalType as k, PROD_KEYLESS_ERROR as l, type PageNode as m, type RevealOptions as n, type SentientClient as o, type SentientConfig as p, type SentientEvent as q, type SessionConfig as r, type SessionManager as s, attachMicroSignalDetectors as t, grantConsent as u, init as v, isDoNotTrackEnabled as w, pageScopeMatches as x, resetRevealStyles as y, reveal as z };
623
+ export { type AssignResult as A, resetRevealStyles as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, reveal as F, type GoalDefinition as G, sanitizePageUrl as H, sessionCookieName as I, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, type SectionMapEntry as S, type WeightEntry as W, _registerConsentUpgradeInit as _, type Assignment as a, type AssignmentCache as b, type AuthoredArmReport as c, type ComponentWeightEntry as d, type DecideOutcome as e, type EventType as f, type GoalOptions as g, type GraphClient as h, type GraphConfig as i, type GraphSnapshot as j, LOCAL_MODE_BANNER as k, type MicroSignalType as l, PROD_KEYLESS_ERROR as m, type PageNode as n, type RevealOptions as o, type SentientClient as p, type SentientConfig as q, type SentientEvent as r, type SessionConfig as s, type SessionManager as t, type SkeletonReport as u, attachMicroSignalDetectors as v, grantConsent as w, init as x, isDoNotTrackEnabled as y, pageScopeMatches as z };
@@ -1,4 +1,6 @@
1
- import { a1 as SlotConfigEntry, a0 as SitePalette, a2 as SlotDeclInput, I as CompoundLocator } from './session-meta-DydKfQiR.cjs';
1
+ import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-BqviEw9O.js';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-CWGtzFOQ.js';
3
+ import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-CQ4yhVw1.js';
2
4
  import { SlotResult } from '@sentientui/policy';
3
5
 
4
6
  /** Manages anonymous session identity with cookie + localStorage layers. */
@@ -225,6 +227,17 @@ declare function attachMicroSignalDetectors(emit: MicroSignalEmitter, node: Elem
225
227
  tabLoss?: boolean;
226
228
  }): () => void;
227
229
 
230
+ /** A captured skeleton, or why none could be captured. */
231
+ type SkeletonReport = RegionSkeleton | {
232
+ status: 'too_large' | 'empty' | 'unaddressable';
233
+ };
234
+ /** One authored arm of a hybrid <Adaptive>, as it rendered. */
235
+ type AuthoredArmReport = {
236
+ key: string;
237
+ text?: string;
238
+ skeleton?: RegionSkeleton;
239
+ };
240
+
228
241
  /**
229
242
  * @internal Wires an alternate entry point's init as grantConsent()'s upgrade
230
243
  * path for `apiKey`. The /graph entry calls this when its init is gated on
@@ -315,6 +328,8 @@ type SentientConfig = {
315
328
  initialSlotConfig?: Record<string, SlotConfigEntry>;
316
329
  /** Site palette decided outside the browser (SSR). Seeds `getSitePalette()`. */
317
330
  initialPalette?: SitePalette;
331
+ /** Site styles the SSR decision's Redesign arms borrow. Seeds `getStyleVocabulary()`. */
332
+ initialVocabulary?: StyleVocabulary;
318
333
  /**
319
334
  * Persona decided during SSR. Takes priority over the html-attribute
320
335
  * adoption and the local snapshot.
@@ -383,6 +398,7 @@ type DecideOutcome = {
383
398
  goals?: GoalDefinition[];
384
399
  sectionMap?: SectionMapEntry[];
385
400
  palette?: SitePalette;
401
+ vocabulary?: StyleVocabulary;
386
402
  };
387
403
  type DecideInput = {
388
404
  sections?: string[];
@@ -398,6 +414,10 @@ type DecideInput = {
398
414
  /** Registry mode only: `false` omits the snippet bootstrap data (editor goals,
399
415
  * section map) the React SDK never reads — two queries per page saved. */
400
416
  bootstrap?: false;
417
+ /** Registry mode only: what the page can render per mounted slot. The
418
+ * server narrows each slot's arm space to it before drawing (CONTRACTS §2
419
+ * — an arm the page would refuse still books a trial). */
420
+ render?: Record<string, RenderCaps>;
401
421
  /**
402
422
  * Caller's build version (e.g. the snippet's `__SNIPPET_VERSION__`), sent
403
423
  * as `v` on the wire. Additive/best-effort: the server persists it for
@@ -482,7 +502,20 @@ type SentientClient = {
482
502
  * generation can ground its versions in what they replace — sent only on
483
503
  * the first report of an id, capped, and the server keeps it only at
484
504
  * first registration. */
485
- reportSlots(slotIds: string[], baselineTexts?: Record<string, string>): void;
505
+ reportSlots(slotIds: string[], baselineTexts?: Record<string, string>, baselineSkeletons?: Record<string, SkeletonReport>,
506
+ /** A hybrid <Adaptive>'s authored arms seen on screen (spec 2026-09-23
507
+ * §7.4): recorded for the dashboard and to ground generation. Sent once
508
+ * per (slot, key) per client. */
509
+ authoredArms?: Record<string, AuthoredArmReport[]>): void;
510
+ /** Report a skeleton for a PUBLISHED slot the server flagged `needsSkeleton`
511
+ * (registered before skeletons existed). Once per id per client; the server
512
+ * stores it only while the slot has none. Optional for hand-rolled clients. */
513
+ reportSkeleton?(slotId: string, skeleton: SkeletonReport): void;
514
+ /** A served Rewrite arm could not be applied because the region's markup no
515
+ * longer matches the skeleton it was written for. Batched, deduped per
516
+ * (slot, fingerprint), never throws. Enough distinct visitors reporting the
517
+ * same drift suspend that skeleton's arms. Optional for hand-rolled clients. */
518
+ reportDrift?(slotId: string, expectedFp: string, observedFp: string | null, reason: 'fp_mismatch' | 'unaddressable' | 'forms'): void;
486
519
  /**
487
520
  * Ask the server for the registry config of these MOUNTED slots. Batches a
488
521
  * tick's mounts into one decide scoped to exactly those ids, once per id per
@@ -491,7 +524,10 @@ type SentientClient = {
491
524
  * Listeners from `onSlotsChanged` fire when the answer lands. Optional so
492
525
  * hand-rolled/test clients keep type-checking.
493
526
  */
494
- requestSlots?(slotIds: string[], baselineTexts?: Record<string, string>): void;
527
+ requestSlots?(slotIds: string[], baselineTexts?: Record<string, string>, extras?: {
528
+ render?: Record<string, RenderCaps>;
529
+ skeletons?: Record<string, SkeletonReport>;
530
+ }): void;
495
531
  /**
496
532
  * Decide these MOUNTED request-declared slots (useAdaptiveTokens,
497
533
  * AdaptiveGroup) that nothing preloaded: a tick's mounts batch into one
@@ -521,6 +557,9 @@ type SentientClient = {
521
557
  isSlotDecided?(slotId: string): boolean;
522
558
  /** Site palette served with registry block decisions. Null when absent. */
523
559
  getSitePalette(): SitePalette | null;
560
+ /** Site styles the served Redesign (compose) arms borrow; null when none.
561
+ * Optional so hand-rolled clients keep type-checking. */
562
+ getStyleVocabulary?(): StyleVocabulary | null;
524
563
  /** Current persona estimate. Band is always `confidenceBand(confidence)`. Null when nothing is known yet. */
525
564
  getPersona(): {
526
565
  persona: string;
@@ -581,4 +620,4 @@ declare function grantConsent(apiKey?: string): void;
581
620
  */
582
621
  declare function init(config: SentientConfig): SentientClient;
583
622
 
584
- export { type AssignResult as A, sanitizePageUrl as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, sessionCookieName as F, type GoalDefinition as G, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, type SectionMapEntry as S, type WeightEntry as W, _registerConsentUpgradeInit as _, type Assignment as a, type AssignmentCache as b, type ComponentWeightEntry as c, type DecideOutcome as d, type EventType as e, type GoalOptions as f, type GraphClient as g, type GraphConfig as h, type GraphSnapshot as i, LOCAL_MODE_BANNER as j, type MicroSignalType as k, PROD_KEYLESS_ERROR as l, type PageNode as m, type RevealOptions as n, type SentientClient as o, type SentientConfig as p, type SentientEvent as q, type SessionConfig as r, type SessionManager as s, attachMicroSignalDetectors as t, grantConsent as u, init as v, isDoNotTrackEnabled as w, pageScopeMatches as x, resetRevealStyles as y, reveal as z };
623
+ export { type AssignResult as A, resetRevealStyles as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, reveal as F, type GoalDefinition as G, sanitizePageUrl as H, sessionCookieName as I, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, type SectionMapEntry as S, type WeightEntry as W, _registerConsentUpgradeInit as _, type Assignment as a, type AssignmentCache as b, type AuthoredArmReport as c, type ComponentWeightEntry as d, type DecideOutcome as e, type EventType as f, type GoalOptions as g, type GraphClient as h, type GraphConfig as i, type GraphSnapshot as j, LOCAL_MODE_BANNER as k, type MicroSignalType as l, PROD_KEYLESS_ERROR as m, type PageNode as n, type RevealOptions as o, type SentientClient as p, type SentientConfig as q, type SentientEvent as r, type SessionConfig as s, type SessionManager as t, type SkeletonReport as u, attachMicroSignalDetectors as v, grantConsent as w, init as x, isDoNotTrackEnabled as y, pageScopeMatches as z };
@@ -1,2 +1,2 @@
1
- "use strict";var V=Object.defineProperty,he=Object.defineProperties,Se=Object.getOwnPropertyDescriptor,ve=Object.getOwnPropertyDescriptors,be=Object.getOwnPropertyNames,te=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var ne=(e,t,n)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&ne(e,n,t[n]);if(te)for(var n of te(t))we.call(t,n)&&ne(e,n,t[n]);return e},J=(e,t)=>he(e,ve(t));var Ee=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})},Te=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of be(t))!oe.call(e,o)&&o!==n&&V(e,o,{get:()=>t[o],enumerable:!(i=Se(t,o))||i.enumerable});return e};var ke=e=>Te(V({},"__esModule",{value:!0}),e);var je={};Ee(je,{INTERACTION_STATS_COMPONENT:()=>ee,SEMANTIC_TYPES:()=>Y,classifyFeatures:()=>U,classifySection:()=>re,featuresFromElement:()=>H,startEngagementCapture:()=>ye});module.exports=ke(je);var Y=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Ce={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Ie(e){let t=e.ariaRole?Ce[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function _e(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Re=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],X=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],se={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function xe(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function U(e){var o,a;let t=Ie(e);if(t)return{type:(o=se[t])!=null?o:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[d,l]of Re)if(l.test(n))return{type:d,strength:"strong"};for(let[d,l]of X)if(l.test(e.bodyText))return{type:d,strength:"strong"};let i=_e(e);return{type:(a=se[i])!=null?a:"generic",strength:"weak"}}function H(e){var i,o;let t=((i=e.textContent)!=null?i:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return C({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((o=e.className)!=null?o:"")}`,headingText:xe(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function re(e){return U(H(e)).type}var me=require("@sentientui/policy");var Ae=require("@sentientui/policy");function ie(e,t,n,i){let o=[];{let l=!1,u=[],v=()=>{if(l)return;let y=Date.now();for(u.push(y);u.length>0&&y-u[0]>500;)u.shift();u.length>=3&&(l=!0,e("rage_click"))};t.addEventListener("click",v),o.push(()=>t.removeEventListener("click",v))}{let a=!1,d=l=>{if(a||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.target)return;a=!0;let u=typeof window!="undefined"?window.getSelection():null,v=u?u.toString().length:0;e("text_copy",{selectionLength:v})};document.addEventListener("copy",d),o.push(()=>document.removeEventListener("copy",d))}{let a=!1,d=!1,l=null,u=()=>{l!==null&&(clearTimeout(l),l=null)},v=()=>{a||!d||(u(),l=setTimeout(()=>{!a&&d&&(a=!0,e("scroll_hesitation"))},3e3))},y=()=>{u(),v()},S=T=>{for(let I of T)d=I.intersectionRatio>.3,d?v():u()},b=new IntersectionObserver(S,{threshold:[.3]});b.observe(t),window.addEventListener("scroll",y,{passive:!0}),o.push(()=>{b.disconnect(),window.removeEventListener("scroll",y),u()})}if((i==null?void 0:i.tabLoss)!==!1){let a=!1,d=n!=null?n:Date.now(),l=()=>{if(a||document.visibilityState!=="hidden")return;let u=Date.now()-d;u<15e3&&(a=!0,e("tab_loss",{timeOnPage:u}))};document.addEventListener("visibilitychange",l),o.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let a of o)a()}}function ae(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(t=>t==="1"||t==="yes")}var Oe=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Z(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function De(e){return{tag:e.tagName.toLowerCase(),text:Z(e).slice(0,40)}}function le(e){return e.replace(/["\\\]]/g,"\\$&")}function z(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function ce(e,t){var d;let n=e.tagName.toLowerCase();if(!n)return null;let i=((d=e.getAttribute("class"))!=null?d:"").split(/\s+/).filter(l=>/^[a-zA-Z][\w-]*$/.test(l)),o=[n,...i.map(l=>`${n}.${l}`)];for(let l of o)if(z(t,l))return l;let a=e.parentElement;if(a&&a!==t){let l=ce(a,t);if(l){for(let S of o){let b=`${l} > ${S}`;if(z(t,b))return b}let u=Array.from(a.children).filter(S=>S.tagName.toLowerCase()===n),v=u.indexOf(e),y=u.some(S=>S!==e&&Z(S)!==Z(e));if(v>=0&&y){let S=`${l} > ${n}:nth-of-type(${v+1})`;if(z(t,S))return S}}}return null}function de(e,t){let n=De(e),i=e.getAttribute("id");if(i&&z(t,`#${le(i)}`))return{v:1,id:i,fingerprint:n};for(let a of Oe){let d=e.getAttribute(a);if(d&&z(t,`[${a}="${le(d)}"]`))return{v:1,dataAttr:{name:a,value:d},fingerprint:n}}let o=ce(e,t);return o?{v:1,selector:o,fingerprint:n}:null}var ue=[100,300,1e3,3e3,1e4],Pe=250,Le=1e3,Me=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function pe(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var ge=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function Ne(e){var t;try{let n=e.createElement("canvas"),i=n.getContext("webgl")||n.getContext("experimental-webgl");if(!i)return"unknown";let o=i.getExtension("WEBGL_debug_renderer_info"),a=o?String((t=i.getParameter(o.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return a?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(a)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function fe(e,t=Date.now){var g,f;let n=(g=e.defaultView)!=null?g:typeof window!="undefined"?window:void 0,i={n:0,mean:0,m2:0},o={n:0,mean:0,m2:0},a=[0,0,0,0,0,0],d=0,l=0,u=0,v=0,y=0,S=0,b=0,T=0,I=0,_=0,O=-1/0,D=-1/0,h=null,P=null,A=null,L=(f=n==null?void 0:n.scrollY)!=null?f:0,M=0,w=e.hidden?null:t(),R=()=>{let s=t();if(A!=null){let m=s-A,E=0;for(;E<ue.length&&m>=ue[E];)E++;a[E]++}A=s},N=()=>{d++,O=t()},K=()=>{l++,D=t()},$=()=>{h=t()},G=()=>{h!=null&&(pe(i,t()-h),h=null)},W=()=>{let s=t();u++,s-O>Pe&&s-D>Le&&v++,R()},x=()=>{y++},j=()=>{var m;let s=(m=n==null?void 0:n.scrollY)!=null?m:0;S+=Math.abs(s-L),L=s,R()},F=s=>{let m=t();b++,(s.key==="Backspace"||s.key==="Delete")&&I++,Me.has(s.key)&&_++,P!=null&&pe(o,m-P),P=m,R()},B=s=>{let m=s.data;typeof m=="string"&&(T+=m.length),R()},q=()=>{let s=t();e.hidden?w!=null&&(M+=s-w,w=null):w==null&&(w=s)},p={passive:!0,capture:!0};e.addEventListener("mousemove",N,p),e.addEventListener("touchstart",K,p),e.addEventListener("touchmove",x,p),e.addEventListener("mousedown",$,p),e.addEventListener("mouseup",G,p),e.addEventListener("click",W,p),e.addEventListener("wheel",x,p),e.addEventListener("keydown",F,p),e.addEventListener("input",B,p),e.addEventListener("visibilitychange",q),n==null||n.addEventListener("scroll",j,p);let r=Ne(e),c=(()=>{var s;try{return((s=n==null?void 0:n.matchMedia)==null?void 0:s.call(n,"(prefers-reduced-motion: reduce)").matches)===!0}catch(m){return!1}})();return{snapshot(){var E,k;let s=t(),m=M+(w!=null?s-w:0);return{v:1,active_ms:Math.round(m),mm:d,mm_rate:m>0?Number((d*1e3/m).toFixed(2)):0,touches:l,clicks:u,hold_n:i.n,hold_mean:Math.round(i.mean),hold_std:Math.round(ge(i)),teleport:v,wheel:y,scroll_px:Math.round(S),keydowns:b,input_chars:T,ik_cv:o.mean>0?Number((ge(o)/o.mean).toFixed(2)):0,backspaces:I,gaps:[...a],reduced_motion:c,kb_nav:_,renderer:r,vp:[(E=n==null?void 0:n.innerWidth)!=null?E:0,(k=n==null?void 0:n.innerHeight)!=null?k:0],dpr:(n==null?void 0:n.devicePixelRatio)||1}},stop(){e.removeEventListener("mousemove",N,p),e.removeEventListener("touchstart",K,p),e.removeEventListener("touchmove",x,p),e.removeEventListener("mousedown",$,p),e.removeEventListener("mouseup",G,p),e.removeEventListener("click",W,p),e.removeEventListener("wheel",x,p),e.removeEventListener("keydown",F,p),e.removeEventListener("input",B,p),e.removeEventListener("visibilitychange",q),n==null||n.removeEventListener("scroll",j,p)}}}var Ke="section, header, footer, nav, main > div, [data-sentient-section]",$e=2e4,ee="__session__";function Ge(e){let t=Array.from(e.querySelectorAll(Ke)),n=t.filter(i=>t.filter(o=>o!==i&&i.contains(o)).length<2);return n.filter(i=>!n.some(o=>o!==i&&o.contains(i)))}function We(e,t,n,i){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:i})}).catch(()=>{})}catch(o){}}var Q=()=>{};function ye(e,t){var L,M,w,R,N,K,$,G,W,x,j,F,B,q,p;let n=(L=t.doc)!=null?L:typeof document!="undefined"?document:void 0;if(!n||typeof IntersectionObserver=="undefined"||ae()||!t.apiKey||!t.apiKey.startsWith("pk_"))return Q;let i=((M=t.apiBase)!=null?M:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),o=Ge(n);if(o.length===0)return Q;let a=new Map,d=[];for(let r of o){let c=(N=[(R=t.sectionTypes)==null?void 0:R[(w=r.getAttribute("data-sentient-id"))!=null?w:""],r.getAttribute("data-sentient-type")].find(k=>Y.includes(k)))!=null?N:null,g=H(r),f=($=c!=null?c:(K=t.typeOf)==null?void 0:K.call(t,r))!=null?$:U(g).type,s=de(r,n),m=s?`nc-${f}-${(0,me.fnv1a)(JSON.stringify({id:(G=s.id)!=null?G:null,dataAttr:(W=s.dataAttr)!=null?W:null,selector:(x=s.selector)!=null?x:null})).toString(36)}`:`nc-${f}`;a.set(r,m);let E=X.filter(([,k])=>k.test(g.bodyText)).map(([k])=>k);d.push(J(C({componentId:m,semanticType:f,source:c?"markup":"auto"},s?{locator:s}:{}),{observation:C(C({tag:g.tag,idClass:g.idClass.slice(0,200),headingText:g.headingText,textLength:g.textLength,actionCount:g.actionCount},g.ariaRole?{ariaRole:g.ariaRole}:{}),E.length>0?{patternFlags:E}:{})}))}let l=(q=(B=(F=(j=n.defaultView)!=null?j:typeof window!="undefined"?window:void 0)==null?void 0:F.location)==null?void 0:B.pathname)!=null?q:"/";We(t.apiKey,i,l,d);let u=fe(n),v=()=>{let r;try{r=u.snapshot()}catch(c){return}try{e.track({projectId:t.apiKey,componentId:ee,eventType:"interaction_stats",payload:r})}catch(c){}},y=new Map,S=r=>{let c=y.get(r);return c||(c={ms:0,scroll:0,enterAt:null,intersecting:!1},y.set(r,c)),c},b=new IntersectionObserver(r=>{for(let c of r){let g=a.get(c.target);if(!g)continue;let f=S(g);c.isIntersecting?(f.intersecting=!0,f.enterAt=Date.now(),c.intersectionRatio>f.scroll&&(f.scroll=c.intersectionRatio)):(f.intersecting=!1,f.enterAt!=null&&(f.ms+=Date.now()-f.enterAt,f.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let r of a.keys())b.observe(r);let T=(r=!1)=>{var g;let c=Date.now();for(let[f,s]of y)if(s.enterAt!=null&&(s.ms+=c-s.enterAt,s.enterAt=null),!(s.ms<=0)){try{e.track({projectId:t.apiKey,componentId:f,eventType:"dwell",payload:{dwell_time:Math.round(s.ms),scroll_depth:Number(s.scroll.toFixed(2))}})}catch(m){}s.ms=0}if(v(),r)try{(g=e.flush)==null||g.call(e)}catch(f){}},I=()=>{if(n.hidden)T(!0);else{let r=Date.now();for(let c of y.values())c.intersecting&&(c.enterAt=r)}},_=!1,O=r=>{if(T(!0),r!=null&&r.persisted){_=!0;return}try{b.disconnect()}catch(c){}},D=r=>{if(!(r!=null&&r.persisted)||!_)return;_=!1;let c=Date.now();for(let g of y.values())g.enterAt=g.intersecting&&!n.hidden?c:null};n.addEventListener("visibilitychange",I);let h=(p=n.defaultView)!=null?p:typeof window!="undefined"?window:void 0;h==null||h.addEventListener("pagehide",O),h==null||h.addEventListener("pageshow",D);let P=setInterval(()=>{if(n.hidden||_)return;T();let r=Date.now();for(let c of y.values())c.intersecting&&(c.enterAt=r)},$e),A=[];return t.microSignals&&[...a.entries()].forEach(([r,c],g)=>{A.push(ie((f,s={})=>{try{e.track({projectId:t.apiKey,componentId:c,eventType:"micro_signal",payload:C({signalType:f},s)})}catch(m){}},r,void 0,{tabLoss:g===0}))}),()=>{T(!0),clearInterval(P),u.stop(),n.removeEventListener("visibilitychange",I),h==null||h.removeEventListener("pagehide",O),h==null||h.removeEventListener("pageshow",D);for(let r of A)r();try{b.disconnect()}catch(r){}}}0&&(module.exports={INTERACTION_STATS_COMPONENT,SEMANTIC_TYPES,classifyFeatures,classifySection,featuresFromElement,startEngagementCapture});
1
+ "use strict";var z=Object.defineProperty,he=Object.defineProperties,Se=Object.getOwnPropertyDescriptor,ve=Object.getOwnPropertyDescriptors,be=Object.getOwnPropertyNames,te=Object.getOwnPropertySymbols;var oe=Object.prototype.hasOwnProperty,we=Object.prototype.propertyIsEnumerable;var ne=(e,t,n)=>t in e?z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,R=(e,t)=>{for(var n in t||(t={}))oe.call(t,n)&&ne(e,n,t[n]);if(te)for(var n of te(t))we.call(t,n)&&ne(e,n,t[n]);return e},Q=(e,t)=>he(e,ve(t));var Ee=(e,t)=>{for(var n in t)z(e,n,{get:t[n],enumerable:!0})},ke=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of be(t))!oe.call(e,o)&&o!==n&&z(e,o,{get:()=>t[o],enumerable:!(i=Se(t,o))||i.enumerable});return e};var Te=e=>ke(z({},"__esModule",{value:!0}),e);var We={};Ee(We,{INTERACTION_STATS_COMPONENT:()=>ee,SEMANTIC_TYPES:()=>Y,classifyFeatures:()=>q,classifySection:()=>re,featuresFromElement:()=>U,startEngagementCapture:()=>ye});module.exports=Te(We);var Y=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Re={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Ce(e){let t=e.ariaRole?Re[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function Ie(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var _e=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],X=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],se={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Ae(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function q(e){var o,a;let t=Ce(e);if(t)return{type:(o=se[t])!=null?o:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[d,l]of _e)if(l.test(n))return{type:d,strength:"strong"};for(let[d,l]of X)if(l.test(e.bodyText))return{type:d,strength:"strong"};let i=Ie(e);return{type:(a=se[i])!=null?a:"generic",strength:"weak"}}function U(e){var i,o;let t=((i=e.textContent)!=null?i:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return R({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((o=e.className)!=null?o:"")}`,headingText:Ae(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function re(e){return q(U(e)).type}var me=require("@sentientui/policy");var xe=require("@sentientui/policy");function ie(e,t,n,i){let o=[];{let l=!1,u=[],v=()=>{if(l)return;let y=Date.now();for(u.push(y);u.length>0&&y-u[0]>500;)u.shift();u.length>=3&&(l=!0,e("rage_click"))};t.addEventListener("click",v),o.push(()=>t.removeEventListener("click",v))}{let a=!1,d=l=>{if(a||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.target)return;a=!0;let u=typeof window!="undefined"?window.getSelection():null,v=u?u.toString().length:0;e("text_copy",{selectionLength:v})};document.addEventListener("copy",d),o.push(()=>document.removeEventListener("copy",d))}{let a=!1,d=!1,l=null,u=()=>{l!==null&&(clearTimeout(l),l=null)},v=()=>{a||!d||(u(),l=setTimeout(()=>{!a&&d&&(a=!0,e("scroll_hesitation"))},3e3))},y=()=>{u(),v()},S=k=>{for(let C of k)d=C.intersectionRatio>.3,d?v():u()},b=new IntersectionObserver(S,{threshold:[.3]});b.observe(t),window.addEventListener("scroll",y,{passive:!0}),o.push(()=>{b.disconnect(),window.removeEventListener("scroll",y),u()})}if((i==null?void 0:i.tabLoss)!==!1){let a=!1,d=n!=null?n:Date.now(),l=()=>{if(a||document.visibilityState!=="hidden")return;let u=Date.now()-d;u<15e3&&(a=!0,e("tab_loss",{timeOnPage:u}))};document.addEventListener("visibilitychange",l),o.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let a of o)a()}}function ae(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(t=>t==="1"||t==="yes")}var Oe=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Z(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function De(e){return{tag:e.tagName.toLowerCase(),text:Z(e).slice(0,40)}}function le(e){return e.replace(/["\\\]]/g,"\\$&")}function H(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function ce(e,t){var d;let n=e.tagName.toLowerCase();if(!n)return null;let i=((d=e.getAttribute("class"))!=null?d:"").split(/\s+/).filter(l=>/^[a-zA-Z][\w-]*$/.test(l)),o=[n,...i.map(l=>`${n}.${l}`)];for(let l of o)if(H(t,l))return l;let a=e.parentElement;if(a&&a!==t){let l=ce(a,t);if(l){for(let S of o){let b=`${l} > ${S}`;if(H(t,b))return b}let u=Array.from(a.children).filter(S=>S.tagName.toLowerCase()===n),v=u.indexOf(e),y=u.some(S=>S!==e&&Z(S)!==Z(e));if(v>=0&&y){let S=`${l} > ${n}:nth-of-type(${v+1})`;if(H(t,S))return S}}}return null}function de(e,t){let n=De(e),i=e.getAttribute("id");if(i&&H(t,`#${le(i)}`))return{v:1,id:i,fingerprint:n};for(let a of Oe){let d=e.getAttribute(a);if(d&&H(t,`[${a}="${le(d)}"]`))return{v:1,dataAttr:{name:a,value:d},fingerprint:n}}let o=ce(e,t);return o?{v:1,selector:o,fingerprint:n}:null}var ue=[100,300,1e3,3e3,1e4],Pe=250,Ne=1e3,Me=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function pe(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var ge=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function Le(e){var t;try{let n=e.createElement("canvas"),i=n.getContext("webgl")||n.getContext("experimental-webgl");if(!i)return"unknown";let o=i.getExtension("WEBGL_debug_renderer_info"),a=o?String((t=i.getParameter(o.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return a?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(a)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function fe(e,t=Date.now){var g,f;let n=(g=e.defaultView)!=null?g:typeof window!="undefined"?window:void 0,i={n:0,mean:0,m2:0},o={n:0,mean:0,m2:0},a=[0,0,0,0,0,0],d=0,l=0,u=0,v=0,y=0,S=0,b=0,k=0,C=0,I=0,O=-1/0,D=-1/0,h=null,P=null,x=null,N=(f=n==null?void 0:n.scrollY)!=null?f:0,M=0,w=e.hidden?null:t(),_=()=>{let s=t();if(x!=null){let m=s-x,E=0;for(;E<ue.length&&m>=ue[E];)E++;a[E]++}x=s},L=()=>{d++,O=t()},$=()=>{l++,D=t()},K=()=>{h=t()},j=()=>{h!=null&&(pe(i,t()-h),h=null)},G=()=>{let s=t();u++,s-O>Pe&&s-D>Ne&&v++,_()},A=()=>{y++},W=()=>{var m;let s=(m=n==null?void 0:n.scrollY)!=null?m:0;S+=Math.abs(s-N),N=s,_()},F=s=>{let m=t();b++,(s.key==="Backspace"||s.key==="Delete")&&C++,Me.has(s.key)&&I++,P!=null&&pe(o,m-P),P=m,_()},B=s=>{let m=s.data;typeof m=="string"&&(k+=m.length),_()},V=()=>{let s=t();e.hidden?w!=null&&(M+=s-w,w=null):w==null&&(w=s)},p={passive:!0,capture:!0};e.addEventListener("mousemove",L,p),e.addEventListener("touchstart",$,p),e.addEventListener("touchmove",A,p),e.addEventListener("mousedown",K,p),e.addEventListener("mouseup",j,p),e.addEventListener("click",G,p),e.addEventListener("wheel",A,p),e.addEventListener("keydown",F,p),e.addEventListener("input",B,p),e.addEventListener("visibilitychange",V),n==null||n.addEventListener("scroll",W,p);let r=Le(e),c=(()=>{var s;try{return((s=n==null?void 0:n.matchMedia)==null?void 0:s.call(n,"(prefers-reduced-motion: reduce)").matches)===!0}catch(m){return!1}})();return{snapshot(){var E,T;let s=t(),m=M+(w!=null?s-w:0);return{v:1,active_ms:Math.round(m),mm:d,mm_rate:m>0?Number((d*1e3/m).toFixed(2)):0,touches:l,clicks:u,hold_n:i.n,hold_mean:Math.round(i.mean),hold_std:Math.round(ge(i)),teleport:v,wheel:y,scroll_px:Math.round(S),keydowns:b,input_chars:k,ik_cv:o.mean>0?Number((ge(o)/o.mean).toFixed(2)):0,backspaces:C,gaps:[...a],reduced_motion:c,kb_nav:I,renderer:r,vp:[(E=n==null?void 0:n.innerWidth)!=null?E:0,(T=n==null?void 0:n.innerHeight)!=null?T:0],dpr:(n==null?void 0:n.devicePixelRatio)||1}},stop(){e.removeEventListener("mousemove",L,p),e.removeEventListener("touchstart",$,p),e.removeEventListener("touchmove",A,p),e.removeEventListener("mousedown",K,p),e.removeEventListener("mouseup",j,p),e.removeEventListener("click",G,p),e.removeEventListener("wheel",A,p),e.removeEventListener("keydown",F,p),e.removeEventListener("input",B,p),e.removeEventListener("visibilitychange",V),n==null||n.removeEventListener("scroll",W,p)}}}var $e="section, header, footer, nav, main > div, [data-sentient-section]",Ke=2e4,ee="__session__";function je(e){let t=Array.from(e.querySelectorAll($e)),n=t.filter(i=>t.filter(o=>o!==i&&i.contains(o)).length<2);return n.filter(i=>!n.some(o=>o!==i&&o.contains(i)))}function Ge(e,t,n,i){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:i})}).catch(()=>{})}catch(o){}}var J=()=>{};function ye(e,t){var N,M,w,_,L,$,K,j,G,A,W,F,B,V,p;let n=(N=t.doc)!=null?N:typeof document!="undefined"?document:void 0;if(!n||typeof IntersectionObserver=="undefined"||ae()||!t.apiKey||!t.apiKey.startsWith("pk_"))return J;let i=((M=t.apiBase)!=null?M:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),o=je(n);if(o.length===0)return J;let a=new Map,d=[];for(let r of o){let c=(L=[(_=t.sectionTypes)==null?void 0:_[(w=r.getAttribute("data-sentient-id"))!=null?w:""],r.getAttribute("data-sentient-type")].find(T=>Y.includes(T)))!=null?L:null,g=U(r),f=(K=c!=null?c:($=t.typeOf)==null?void 0:$.call(t,r))!=null?K:q(g).type,s=de(r,n),m=s?`nc-${f}-${(0,me.fnv1a)(JSON.stringify({id:(j=s.id)!=null?j:null,dataAttr:(G=s.dataAttr)!=null?G:null,selector:(A=s.selector)!=null?A:null})).toString(36)}`:`nc-${f}`;a.set(r,m);let E=X.filter(([,T])=>T.test(g.bodyText)).map(([T])=>T);d.push(Q(R({componentId:m,semanticType:f,source:c?"markup":"auto"},s?{locator:s}:{}),{observation:R(R({tag:g.tag,idClass:g.idClass.slice(0,200),headingText:g.headingText,textLength:g.textLength,actionCount:g.actionCount},g.ariaRole?{ariaRole:g.ariaRole}:{}),E.length>0?{patternFlags:E}:{})}))}let l=(V=(B=(F=(W=n.defaultView)!=null?W:typeof window!="undefined"?window:void 0)==null?void 0:F.location)==null?void 0:B.pathname)!=null?V:"/";Ge(t.apiKey,i,l,d);let u=fe(n),v=()=>{let r;try{r=u.snapshot()}catch(c){return}try{e.track({projectId:t.apiKey,componentId:ee,eventType:"interaction_stats",payload:r})}catch(c){}},y=new Map,S=r=>{let c=y.get(r);return c||(c={ms:0,scroll:0,enterAt:null,intersecting:!1},y.set(r,c)),c},b=new IntersectionObserver(r=>{for(let c of r){let g=a.get(c.target);if(!g)continue;let f=S(g);c.isIntersecting?(f.intersecting=!0,f.enterAt=Date.now(),c.intersectionRatio>f.scroll&&(f.scroll=c.intersectionRatio)):(f.intersecting=!1,f.enterAt!=null&&(f.ms+=Date.now()-f.enterAt,f.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let r of a.keys())b.observe(r);let k=(r=!1)=>{var g;let c=Date.now();for(let[f,s]of y)if(s.enterAt!=null&&(s.ms+=c-s.enterAt,s.enterAt=null),!(s.ms<=0)){try{e.track({projectId:t.apiKey,componentId:f,eventType:"dwell",payload:{dwell_time:Math.round(s.ms),scroll_depth:Number(s.scroll.toFixed(2))}})}catch(m){}s.ms=0}if(v(),r)try{(g=e.flush)==null||g.call(e)}catch(f){}},C=()=>{if(n.hidden)k(!0);else{let r=Date.now();for(let c of y.values())c.intersecting&&(c.enterAt=r)}},I=!1,O=r=>{if(k(!0),r!=null&&r.persisted){I=!0;return}try{b.disconnect()}catch(c){}},D=r=>{if(!(r!=null&&r.persisted)||!I)return;I=!1;let c=Date.now();for(let g of y.values())g.enterAt=g.intersecting&&!n.hidden?c:null};n.addEventListener("visibilitychange",C);let h=(p=n.defaultView)!=null?p:typeof window!="undefined"?window:void 0;h==null||h.addEventListener("pagehide",O),h==null||h.addEventListener("pageshow",D);let P=setInterval(()=>{if(n.hidden||I)return;k();let r=Date.now();for(let c of y.values())c.intersecting&&(c.enterAt=r)},Ke),x=[];return t.microSignals&&[...a.entries()].forEach(([r,c],g)=>{x.push(ie((f,s={})=>{try{e.track({projectId:t.apiKey,componentId:c,eventType:"micro_signal",payload:R({signalType:f},s)})}catch(m){}},r,void 0,{tabLoss:g===0}))}),()=>{k(!0),clearInterval(P),u.stop(),n.removeEventListener("visibilitychange",C),h==null||h.removeEventListener("pagehide",O),h==null||h.removeEventListener("pageshow",D);for(let r of x)r();try{b.disconnect()}catch(r){}}}0&&(module.exports={INTERACTION_STATS_COMPONENT,SEMANTIC_TYPES,classifyFeatures,classifySection,featuresFromElement,startEngagementCapture});
2
2
  //# sourceMappingURL=index-engagement.js.map