@sentientui/core 0.38.0 → 0.39.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 (38) hide show
  1. package/README.md +43 -1
  2. package/dist/{chunk-NCLBL5V3.mjs → chunk-EVF5PQ4U.mjs} +1 -1
  3. package/dist/{chunk-NCLBL5V3.mjs.map → chunk-EVF5PQ4U.mjs.map} +1 -1
  4. package/dist/chunk-VE2K45X4.mjs +2 -0
  5. package/dist/chunk-VE2K45X4.mjs.map +1 -0
  6. package/dist/{index-BdpO3Qlm.d.cts → index-BAfi7_FG.d.cts} +60 -5
  7. package/dist/{index-DzGhQhSK.d.ts → index-DyKtujwf.d.ts} +60 -5
  8. package/dist/index-engagement.js +1 -1
  9. package/dist/index-engagement.js.map +1 -1
  10. package/dist/index-engagement.mjs +1 -1
  11. package/dist/index-graph.d.cts +5 -5
  12. package/dist/index-graph.d.ts +5 -5
  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-local.d.cts +3 -3
  17. package/dist/index-local.d.ts +3 -3
  18. package/dist/index-region.d.cts +1 -1
  19. package/dist/index-region.d.ts +1 -1
  20. package/dist/index-region.mjs +1 -1
  21. package/dist/index-server.d.cts +73 -5
  22. package/dist/index-server.d.ts +73 -5
  23. package/dist/index-server.js +1 -1
  24. package/dist/index-server.js.map +1 -1
  25. package/dist/index-server.mjs +1 -1
  26. package/dist/index-server.mjs.map +1 -1
  27. package/dist/index.d.cts +3 -3
  28. package/dist/index.d.ts +3 -3
  29. package/dist/index.js +1 -1
  30. package/dist/index.js.map +1 -1
  31. package/dist/index.mjs +1 -1
  32. package/dist/{region-skeleton-D2ahkcbe.d.cts → region-skeleton-BRIVB-qf.d.cts} +1 -0
  33. package/dist/{region-skeleton-D2ahkcbe.d.ts → region-skeleton-BRIVB-qf.d.ts} +1 -0
  34. package/dist/{session-meta-CvEwPQCX.d.ts → session-meta-BtRtwsHI.d.ts} +1 -1
  35. package/dist/{session-meta-USVMwvsR.d.cts → session-meta-qx4kIL5y.d.cts} +1 -1
  36. package/package.json +1 -1
  37. package/dist/chunk-VLFWHJNJ.mjs +0 -2
  38. package/dist/chunk-VLFWHJNJ.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.cjs';
2
- import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-USVMwvsR.cjs';
3
- import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-D2ahkcbe.cjs';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-qx4kIL5y.cjs';
3
+ import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-BRIVB-qf.cjs';
4
4
  import './index-consent.cjs';
5
5
  import { SlotResult } from '@sentientui/policy';
6
6
 
@@ -185,6 +185,27 @@ declare function forgetGeneration(apiKey: string): number;
185
185
  declare const PAGE_SCOPE_RE: RegExp;
186
186
  declare function pageScopeMatches(page: string | undefined, pathname: string): boolean;
187
187
 
188
+ /**
189
+ * url_reached matching, shared by the snippet (client-side wiring) and the API
190
+ * (server-side matching on pageview ingest) so the two can never disagree about
191
+ * whether a path satisfies a goal.
192
+ *
193
+ * A pattern matches the current path on an exact hit or a path-segment
194
+ * boundary — never a bare substring. Substring matching made the degenerate '/'
195
+ * pattern (what the editor's "Track page visits" button saves on a homepage)
196
+ * contain every path, firing the homepage goal on every route; it also let
197
+ * '/pricing' over-match '/pricing-details'. The root '/' matches only '/', and
198
+ * '/pricing' matches '/pricing' and '/pricing/monthly' but not '/pricing-x'.
199
+ */
200
+ declare function urlMatches(pattern: string, path: string): boolean;
201
+ /**
202
+ * Reduce a pasted full URL to its path. An operator who copies
203
+ * `https://host/pricing` into a url_reached goal saved a pattern that no
204
+ * pathname ever starts with, so the goal silently never fired. A path (or
205
+ * anything unparseable) passes through unchanged.
206
+ */
207
+ declare function normalizeUrlPattern(p: string): string;
208
+
188
209
  /**
189
210
  * The adaptation reveal — the 0.X-second moment a visitor notices the page is
190
211
  * for them (`what-sentient-is-becoming.md` §"Fast generation and the wow",
@@ -292,6 +313,12 @@ type SentientConfig = {
292
313
  * variantIds) still fetch once when the seed carries no content.
293
314
  */
294
315
  initialAssignments?: Record<string, string>;
316
+ /**
317
+ * Component ids an SSR preload found moved onto the shared track
318
+ * (`preloadAssignmentsDetailed` / `preloadDecisions` with the unified cap).
319
+ * Their cached assignments are ignored and `isUnified` reports them.
320
+ */
321
+ initialUnified?: string[];
295
322
  /**
296
323
  * Segment used for SSR preload (`device:source`). When set with `initialAssignments`,
297
324
  * seeds the assignment cache under this key so hydration matches the server bandit row.
@@ -410,6 +437,15 @@ type AssignResult = {
410
437
  variantId: string;
411
438
  assignmentTtlMs: number;
412
439
  content?: string;
440
+ /** The operator migrated this component onto the shared track (one
441
+ * component model). Only answered to a request that sent `{ unified: true }`;
442
+ * nothing was assigned — `variantId` is only the declared baseline. */
443
+ unified?: true;
444
+ };
445
+ /** What the caller of `assign` can do with the answer. */
446
+ type AssignOptions = {
447
+ /** Can render this component on the shared track (decide it as a slot). */
448
+ unified?: boolean;
413
449
  };
414
450
 
415
451
  /** An editor-defined goal delivered with a registry-mode decision, for the
@@ -528,9 +564,23 @@ type SentientClient = {
528
564
  */
529
565
  componentGoal(componentId: string, goalType: string, opts?: ComponentGoalOptions): void;
530
566
  identify(userId: string): void;
567
+ /**
568
+ * The visitor id (session id) for carrying a conversion to your server
569
+ * later: store it with the order/sign-up, then pass it to `trackServerGoal`.
570
+ * Null until the client is tracking with consent, and after forget-me.
571
+ * Optional only so hand-rolled clients (test doubles) keep type-checking;
572
+ * every client the SDK creates implements it.
573
+ */
574
+ getVisitorId?(): string | null;
531
575
  getAssignment(componentId: string, segment: string): Assignment | null;
532
- /** Server-side variant assignment. Caches the result locally per (component, segment). */
533
- assign(componentId: string, variantIds?: string[], agentData?: unknown, agentDataByVariant?: Record<string, unknown>): Promise<AssignResult | null>;
576
+ /** True once this page knows the component was moved onto the shared track
577
+ * (SSR preload or a `unified` assign answer). */
578
+ isUnified?(componentId: string): boolean;
579
+ /** Server-side variant assignment. Caches the result locally per (component, segment).
580
+ * `opts.unified`: the caller can render a migrated component on the shared
581
+ * track; the server may then answer `{ unified: true }` (nothing assigned,
582
+ * nothing cached) and the caller decides it as a slot instead. */
583
+ assign(componentId: string, variantIds?: string[], agentData?: unknown, agentDataByVariant?: Record<string, unknown>, opts?: AssignOptions): Promise<AssignResult | null>;
534
584
  /**
535
585
  * Single-roundtrip decision for layout sections, component variants, and
536
586
  * adaptive slots. Awaits the session upsert (like `assign`) so the server
@@ -560,6 +610,11 @@ type SentientClient = {
560
610
  * (registered before skeletons existed). Once per id per client; the server
561
611
  * stores it only while the slot has none. Optional for hand-rolled clients. */
562
612
  reportSkeleton?(slotId: string, skeleton: SkeletonReport): void;
613
+ /** Agent-readable data for the arm a slot served (`agentData` /
614
+ * `agentDataByVariant` on a slot-path <Adaptive>). Once per (slot, arm) per
615
+ * client, fire-and-forget; the server stores it against that arm so
616
+ * /sentient.json shows what visitors are shown. Optional for hand-rolled clients. */
617
+ reportAgentData?(slotId: string, armId: string, data: unknown): void;
563
618
  /** A served Rewrite arm could not be applied because the region's markup no
564
619
  * longer matches the skeleton it was written for. Batched, deduped per
565
620
  * (slot, fingerprint), never throws. Enough distinct visitors reporting the
@@ -686,4 +741,4 @@ declare function routeKey(): string;
686
741
  */
687
742
  declare function init(config: SentientConfig): SentientClient;
688
743
 
689
- export { type AssignResult as A, exposedStage as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, forgetGeneration as F, type GoalDefinition as G, grantConsent as H, init as I, isDoNotTrackEnabled as J, pageScopeMatches as K, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, resetRevealStyles as N, reveal as O, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, STAGE_ATTRIBUTE as S, routeKey as T, sanitizePageUrl as U, sessionCookieName as V, type WeightEntry as W, setCspNonce as X, setStageAttribute as Y, _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 SectionMapEntry as p, type SentientClient as q, type SentientConfig as r, type SentientEvent as s, type SessionConfig as t, type SessionManager as u, type SkeletonReport as v, type StageAttributes as w, applyNonce as x, attachMicroSignalDetectors as y, cspNonce as z };
744
+ export { setStageAttribute as $, type AssignOptions as A, cspNonce as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, exposedStage as F, type GoalDefinition as G, forgetGeneration as H, grantConsent as I, init as J, isDoNotTrackEnabled as K, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, normalizeUrlPattern as N, pageScopeMatches as O, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, STAGE_ATTRIBUTE as S, resetRevealStyles as T, reveal as U, routeKey as V, type WeightEntry as W, sanitizePageUrl as X, sessionCookieName as Y, setCspNonce as Z, _registerConsentUpgradeInit as _, type AssignResult as a, urlMatches as a0, type Assignment as b, type AssignmentCache as c, type AuthoredArmReport as d, type ComponentWeightEntry as e, type DecideOutcome as f, type EventType as g, type GoalOptions as h, type GraphClient as i, type GraphConfig as j, type GraphSnapshot as k, LOCAL_MODE_BANNER as l, type MicroSignalType as m, PROD_KEYLESS_ERROR as n, type PageNode as o, type RevealOptions as p, type SectionMapEntry as q, type SentientClient as r, type SentientConfig as s, type SentientEvent as t, type SessionConfig as u, type SessionManager as v, type SkeletonReport as w, type StageAttributes as x, applyNonce as y, attachMicroSignalDetectors as z };
@@ -1,6 +1,6 @@
1
1
  import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.js';
2
- import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-CvEwPQCX.js';
3
- import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-D2ahkcbe.js';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-BtRtwsHI.js';
3
+ import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-BRIVB-qf.js';
4
4
  import './index-consent.js';
5
5
  import { SlotResult } from '@sentientui/policy';
6
6
 
@@ -185,6 +185,27 @@ declare function forgetGeneration(apiKey: string): number;
185
185
  declare const PAGE_SCOPE_RE: RegExp;
186
186
  declare function pageScopeMatches(page: string | undefined, pathname: string): boolean;
187
187
 
188
+ /**
189
+ * url_reached matching, shared by the snippet (client-side wiring) and the API
190
+ * (server-side matching on pageview ingest) so the two can never disagree about
191
+ * whether a path satisfies a goal.
192
+ *
193
+ * A pattern matches the current path on an exact hit or a path-segment
194
+ * boundary — never a bare substring. Substring matching made the degenerate '/'
195
+ * pattern (what the editor's "Track page visits" button saves on a homepage)
196
+ * contain every path, firing the homepage goal on every route; it also let
197
+ * '/pricing' over-match '/pricing-details'. The root '/' matches only '/', and
198
+ * '/pricing' matches '/pricing' and '/pricing/monthly' but not '/pricing-x'.
199
+ */
200
+ declare function urlMatches(pattern: string, path: string): boolean;
201
+ /**
202
+ * Reduce a pasted full URL to its path. An operator who copies
203
+ * `https://host/pricing` into a url_reached goal saved a pattern that no
204
+ * pathname ever starts with, so the goal silently never fired. A path (or
205
+ * anything unparseable) passes through unchanged.
206
+ */
207
+ declare function normalizeUrlPattern(p: string): string;
208
+
188
209
  /**
189
210
  * The adaptation reveal — the 0.X-second moment a visitor notices the page is
190
211
  * for them (`what-sentient-is-becoming.md` §"Fast generation and the wow",
@@ -292,6 +313,12 @@ type SentientConfig = {
292
313
  * variantIds) still fetch once when the seed carries no content.
293
314
  */
294
315
  initialAssignments?: Record<string, string>;
316
+ /**
317
+ * Component ids an SSR preload found moved onto the shared track
318
+ * (`preloadAssignmentsDetailed` / `preloadDecisions` with the unified cap).
319
+ * Their cached assignments are ignored and `isUnified` reports them.
320
+ */
321
+ initialUnified?: string[];
295
322
  /**
296
323
  * Segment used for SSR preload (`device:source`). When set with `initialAssignments`,
297
324
  * seeds the assignment cache under this key so hydration matches the server bandit row.
@@ -410,6 +437,15 @@ type AssignResult = {
410
437
  variantId: string;
411
438
  assignmentTtlMs: number;
412
439
  content?: string;
440
+ /** The operator migrated this component onto the shared track (one
441
+ * component model). Only answered to a request that sent `{ unified: true }`;
442
+ * nothing was assigned — `variantId` is only the declared baseline. */
443
+ unified?: true;
444
+ };
445
+ /** What the caller of `assign` can do with the answer. */
446
+ type AssignOptions = {
447
+ /** Can render this component on the shared track (decide it as a slot). */
448
+ unified?: boolean;
413
449
  };
414
450
 
415
451
  /** An editor-defined goal delivered with a registry-mode decision, for the
@@ -528,9 +564,23 @@ type SentientClient = {
528
564
  */
529
565
  componentGoal(componentId: string, goalType: string, opts?: ComponentGoalOptions): void;
530
566
  identify(userId: string): void;
567
+ /**
568
+ * The visitor id (session id) for carrying a conversion to your server
569
+ * later: store it with the order/sign-up, then pass it to `trackServerGoal`.
570
+ * Null until the client is tracking with consent, and after forget-me.
571
+ * Optional only so hand-rolled clients (test doubles) keep type-checking;
572
+ * every client the SDK creates implements it.
573
+ */
574
+ getVisitorId?(): string | null;
531
575
  getAssignment(componentId: string, segment: string): Assignment | null;
532
- /** Server-side variant assignment. Caches the result locally per (component, segment). */
533
- assign(componentId: string, variantIds?: string[], agentData?: unknown, agentDataByVariant?: Record<string, unknown>): Promise<AssignResult | null>;
576
+ /** True once this page knows the component was moved onto the shared track
577
+ * (SSR preload or a `unified` assign answer). */
578
+ isUnified?(componentId: string): boolean;
579
+ /** Server-side variant assignment. Caches the result locally per (component, segment).
580
+ * `opts.unified`: the caller can render a migrated component on the shared
581
+ * track; the server may then answer `{ unified: true }` (nothing assigned,
582
+ * nothing cached) and the caller decides it as a slot instead. */
583
+ assign(componentId: string, variantIds?: string[], agentData?: unknown, agentDataByVariant?: Record<string, unknown>, opts?: AssignOptions): Promise<AssignResult | null>;
534
584
  /**
535
585
  * Single-roundtrip decision for layout sections, component variants, and
536
586
  * adaptive slots. Awaits the session upsert (like `assign`) so the server
@@ -560,6 +610,11 @@ type SentientClient = {
560
610
  * (registered before skeletons existed). Once per id per client; the server
561
611
  * stores it only while the slot has none. Optional for hand-rolled clients. */
562
612
  reportSkeleton?(slotId: string, skeleton: SkeletonReport): void;
613
+ /** Agent-readable data for the arm a slot served (`agentData` /
614
+ * `agentDataByVariant` on a slot-path <Adaptive>). Once per (slot, arm) per
615
+ * client, fire-and-forget; the server stores it against that arm so
616
+ * /sentient.json shows what visitors are shown. Optional for hand-rolled clients. */
617
+ reportAgentData?(slotId: string, armId: string, data: unknown): void;
563
618
  /** A served Rewrite arm could not be applied because the region's markup no
564
619
  * longer matches the skeleton it was written for. Batched, deduped per
565
620
  * (slot, fingerprint), never throws. Enough distinct visitors reporting the
@@ -686,4 +741,4 @@ declare function routeKey(): string;
686
741
  */
687
742
  declare function init(config: SentientConfig): SentientClient;
688
743
 
689
- export { type AssignResult as A, exposedStage as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, forgetGeneration as F, type GoalDefinition as G, grantConsent as H, init as I, isDoNotTrackEnabled as J, pageScopeMatches as K, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, resetRevealStyles as N, reveal as O, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, STAGE_ATTRIBUTE as S, routeKey as T, sanitizePageUrl as U, sessionCookieName as V, type WeightEntry as W, setCspNonce as X, setStageAttribute as Y, _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 SectionMapEntry as p, type SentientClient as q, type SentientConfig as r, type SentientEvent as s, type SessionConfig as t, type SessionManager as u, type SkeletonReport as v, type StageAttributes as w, applyNonce as x, attachMicroSignalDetectors as y, cspNonce as z };
744
+ export { setStageAttribute as $, type AssignOptions as A, cspNonce as B, type ComponentGoalOptions as C, type DecideInput as D, type EventQueue as E, exposedStage as F, type GoalDefinition as G, forgetGeneration as H, grantConsent as I, init as J, isDoNotTrackEnabled as K, LEGACY_SESSION_COOKIE_NAME as L, type MicroSignalEmitter as M, normalizeUrlPattern as N, pageScopeMatches as O, PAGE_SCOPE_RE as P, type QueueConfig as Q, REVEAL_MS as R, STAGE_ATTRIBUTE as S, resetRevealStyles as T, reveal as U, routeKey as V, type WeightEntry as W, sanitizePageUrl as X, sessionCookieName as Y, setCspNonce as Z, _registerConsentUpgradeInit as _, type AssignResult as a, urlMatches as a0, type Assignment as b, type AssignmentCache as c, type AuthoredArmReport as d, type ComponentWeightEntry as e, type DecideOutcome as f, type EventType as g, type GoalOptions as h, type GraphClient as i, type GraphConfig as j, type GraphSnapshot as k, LOCAL_MODE_BANNER as l, type MicroSignalType as m, PROD_KEYLESS_ERROR as n, type PageNode as o, type RevealOptions as p, type SectionMapEntry as q, type SentientClient as r, type SentientConfig as s, type SentientEvent as t, type SessionConfig as u, type SessionManager as v, type SkeletonReport as w, type StageAttributes as x, applyNonce as y, attachMicroSignalDetectors as z };
@@ -1,2 +1,2 @@
1
- "use strict";var z=Object.defineProperty,he=Object.defineProperties,Se=Object.getOwnPropertyDescriptor,be=Object.getOwnPropertyDescriptors,ve=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,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},Q=(e,t)=>he(e,be(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 ve(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"],Ce={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Re(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 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=Re(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 C({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=[],b=()=>{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",b),o.push(()=>t.removeEventListener("click",b))}{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,b=u?u.toString().length:0;e("text_copy",{selectionLength:b})};document.addEventListener("copy",d),o.push(()=>document.removeEventListener("copy",d))}{let a=!1,d=!1,l=null,u=()=>{l!==null&&(clearTimeout(l),l=null)},b=()=>{a||!d||(u(),l=setTimeout(()=>{!a&&d&&(a=!0,e("scroll_hesitation"))},3e3))},y=()=>{u(),b()},S=k=>{for(let R of k)d=R.intersectionRatio>.3,d?b():u()},v=new IntersectionObserver(S,{threshold:[.3]});v.observe(t),window.addEventListener("scroll",y,{passive:!0}),o.push(()=>{v.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 v=`${l} > ${S}`;if(H(t,v))return v}let u=Array.from(a.children).filter(S=>S.tagName.toLowerCase()===n),b=u.indexOf(e),y=u.some(S=>S!==e&&Z(S)!==Z(e));if(b>=0&&y){let S=`${l} > ${n}:nth-of-type(${b+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,b=0,y=0,S=0,v=0,k=0,R=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()},K=()=>{l++,D=t()},$=()=>{h=t()},j=()=>{h!=null&&(pe(i,t()-h),h=null)},G=()=>{let s=t();u++,s-O>Pe&&s-D>Ne&&b++,_()},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();v++,(s.key==="Backspace"||s.key==="Delete")&&R++,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",K,p),e.addEventListener("touchmove",A,p),e.addEventListener("mousedown",$,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:b,wheel:y,scroll_px:Math.round(S),keydowns:v,input_chars:k,ik_cv:o.mean>0?Number((ge(o)/o.mean).toFixed(2)):0,backspaces:R,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",K,p),e.removeEventListener("touchmove",A,p),e.removeEventListener("mousedown",$,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 Ke="section, header, footer, nav, main > div, [data-sentient-section]",$e=2e4,ee="__session__";function je(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 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=($=c!=null?c:(K=t.typeOf)==null?void 0:K.call(t,r))!=null?$: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(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=(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),b=()=>{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},v=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())v.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(b(),r)try{(g=e.flush)==null||g.call(e)}catch(f){}},R=()=>{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{v.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",R);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)},$e),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:C({signalType:f},s)})}catch(m){}},r,void 0,{tabLoss:g===0}))}),()=>{k(!0),clearInterval(P),u.stop(),n.removeEventListener("visibilitychange",R),h==null||h.removeEventListener("pagehide",O),h==null||h.removeEventListener("pageshow",D);for(let r of x)r();try{v.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,be=Object.getOwnPropertyDescriptors,ve=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,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},Q=(e,t)=>he(e,be(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 ve(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:()=>J,classifyFeatures:()=>B,classifySection:()=>re,featuresFromElement:()=>q,startEngagementCapture:()=>ye});module.exports=Te(We);var J=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Ce={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Re(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 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 B(e){var o,a;let t=Re(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 q(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: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 B(q(e)).type}var me=require("@sentientui/policy");var xe=require("@sentientui/policy");function ie(e,t,n,i){let o=[];{let l=!1,u=[],b=()=>{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",b),o.push(()=>t.removeEventListener("click",b))}{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,b=u?u.toString().length:0;e("text_copy",{selectionLength:b})};document.addEventListener("copy",d),o.push(()=>document.removeEventListener("copy",d))}{let a=!1,d=!1,l=null,u=()=>{l!==null&&(clearTimeout(l),l=null)},b=()=>{a||!d||(u(),l=setTimeout(()=>{!a&&d&&(a=!0,e("scroll_hesitation"))},3e3))},y=()=>{u(),b()},S=k=>{for(let R of k)d=R.intersectionRatio>.3,d?b():u()},v=new IntersectionObserver(S,{threshold:[.3]});v.observe(t),window.addEventListener("scroll",y,{passive:!0}),o.push(()=>{v.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 v=`${l} > ${S}`;if(H(t,v))return v}let u=Array.from(a.children).filter(S=>S.tagName.toLowerCase()===n),b=u.indexOf(e),y=u.some(S=>S!==e&&Z(S)!==Z(e));if(b>=0&&y){let S=`${l} > ${n}:nth-of-type(${b+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,Me=1e3,Ne=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,b=0,y=0,S=0,v=0,k=0,R=0,I=0,O=-1/0,D=-1/0,h=null,P=null,x=null,M=(f=n==null?void 0:n.scrollY)!=null?f:0,N=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>Me&&b++,_()},A=()=>{y++},W=()=>{var m;let s=(m=n==null?void 0:n.scrollY)!=null?m:0;S+=Math.abs(s-M),M=s,_()},F=s=>{let m=t();v++,(s.key==="Backspace"||s.key==="Delete")&&R++,Ne.has(s.key)&&I++,P!=null&&pe(o,m-P),P=m,_()},V=s=>{let m=s.data;typeof m=="string"&&(k+=m.length),_()},U=()=>{let s=t();e.hidden?w!=null&&(N+=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",V,p),e.addEventListener("visibilitychange",U),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=N+(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:b,wheel:y,scroll_px:Math.round(S),keydowns:v,input_chars:k,ik_cv:o.mean>0?Number((ge(o)/o.mean).toFixed(2)):0,backspaces:R,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",V,p),e.removeEventListener("visibilitychange",U),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 Y=()=>{};function ye(e,t){var M,N,w,_,L,$,K,j,G,A,W,F,V,U,p;let n=(M=t.doc)!=null?M:typeof document!="undefined"?document:void 0;if(!n||typeof IntersectionObserver=="undefined"||ae()||!t.apiKey||!t.apiKey.startsWith("pk_"))return Y;let i=((N=t.apiBase)!=null?N:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),o=je(n);if(o.length===0)return Y;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=>J.includes(T)))!=null?L:null,g=q(r),f=(K=c!=null?c:($=t.typeOf)==null?void 0:$.call(t,r))!=null?K:B(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(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=(U=(V=(F=(W=n.defaultView)!=null?W:typeof window!="undefined"?window:void 0)==null?void 0:F.location)==null?void 0:V.pathname)!=null?U:"/";Ge(t.apiKey,i,l,d);let u=fe(n),b=()=>{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},v=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())v.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(b(),r)try{(g=e.flush)==null||g.call(e)}catch(f){}},R=()=>{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{v.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",R);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:C({signalType:f},s)})}catch(m){}},r,void 0,{tabLoss:g===0}))}),()=>{k(!0),clearInterval(P),u.stop(),n.removeEventListener("visibilitychange",R),h==null||h.removeEventListener("pagehide",O),h==null||h.removeEventListener("pageshow",D);for(let r of x)r();try{v.disconnect()}catch(r){}}}0&&(module.exports={INTERACTION_STATS_COMPONENT,SEMANTIC_TYPES,classifyFeatures,classifySection,featuresFromElement,startEngagementCapture});
2
2
  //# sourceMappingURL=index-engagement.js.map