@lucida-analytics/browser 0.0.0-stage → 0.1.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 (108) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +228 -2
  3. package/dist/autocapture.d.ts +78 -0
  4. package/dist/autocapture.js +1 -0
  5. package/dist/banner-CGEWCIGP.js +1 -0
  6. package/dist/chunk-3PWTJFHH.js +1 -0
  7. package/dist/chunk-AWIQCFGN.js +1 -0
  8. package/dist/chunk-GVYMMTQM.js +1 -0
  9. package/dist/chunk-MCWQHOEV.js +1 -0
  10. package/dist/chunk-MI35SSIT.js +1 -0
  11. package/dist/client-ts5YMCoB.d.ts +8 -0
  12. package/dist/consent.d.ts +84 -0
  13. package/dist/consent.js +1 -0
  14. package/dist/core.d.ts +9 -0
  15. package/dist/core.js +3 -0
  16. package/dist/correlate.d.ts +15 -0
  17. package/dist/correlate.js +1 -0
  18. package/dist/early-access.d.ts +12 -0
  19. package/dist/early-access.js +1 -0
  20. package/dist/experiments.d.ts +199 -0
  21. package/dist/experiments.js +1 -0
  22. package/dist/flags.d.ts +13 -0
  23. package/dist/flags.js +3 -0
  24. package/dist/forms.d.ts +13 -0
  25. package/dist/forms.js +1 -0
  26. package/dist/guides.d.ts +1158 -0
  27. package/dist/guides.js +1 -0
  28. package/dist/heatmaps.d.ts +17 -0
  29. package/dist/heatmaps.js +1 -0
  30. package/dist/host-headers.d.ts +16 -0
  31. package/dist/host-headers.js +1 -0
  32. package/dist/index.d.ts +89 -0
  33. package/dist/index.js +3 -0
  34. package/dist/inspector.d.ts +13 -0
  35. package/dist/inspector.js +1 -0
  36. package/dist/lucida.js +3 -0
  37. package/dist/modules-FANMZRDJ.js +1 -0
  38. package/dist/persistent-XLGNSZQR.js +1 -0
  39. package/dist/recommendations.d.ts +2 -0
  40. package/dist/recommendations.js +1 -0
  41. package/dist/recorder-LFUTDRP4.js +78 -0
  42. package/dist/replay.d.ts +18 -0
  43. package/dist/replay.js +1 -0
  44. package/dist/static/v0/autocapture.js +1 -0
  45. package/dist/static/v0/banner-CGEWCIGP.js +1 -0
  46. package/dist/static/v0/chunk-3PWTJFHH.js +1 -0
  47. package/dist/static/v0/chunk-AWIQCFGN.js +1 -0
  48. package/dist/static/v0/chunk-GVYMMTQM.js +1 -0
  49. package/dist/static/v0/chunk-MCWQHOEV.js +1 -0
  50. package/dist/static/v0/chunk-MI35SSIT.js +1 -0
  51. package/dist/static/v0/consent.js +1 -0
  52. package/dist/static/v0/core.js +3 -0
  53. package/dist/static/v0/correlate.js +1 -0
  54. package/dist/static/v0/early-access.js +1 -0
  55. package/dist/static/v0/experiments.js +1 -0
  56. package/dist/static/v0/flags.js +3 -0
  57. package/dist/static/v0/forms.js +1 -0
  58. package/dist/static/v0/guides.js +1 -0
  59. package/dist/static/v0/heatmaps.js +1 -0
  60. package/dist/static/v0/host-headers.js +1 -0
  61. package/dist/static/v0/index.js +3 -0
  62. package/dist/static/v0/inspector.js +1 -0
  63. package/dist/static/v0/lucida.js +3 -0
  64. package/dist/static/v0/modules-FANMZRDJ.js +1 -0
  65. package/dist/static/v0/persistent-XLGNSZQR.js +1 -0
  66. package/dist/static/v0/recommendations.js +1 -0
  67. package/dist/static/v0/recorder-LFUTDRP4.js +78 -0
  68. package/dist/static/v0/replay.js +1 -0
  69. package/dist/static/v0/toolbar.js +4 -0
  70. package/dist/static/v0/validation-ENITEP6V.js +1 -0
  71. package/dist/static/v0/webmcp.js +1 -0
  72. package/dist/static/v0.1.0/autocapture.js +1 -0
  73. package/dist/static/v0.1.0/banner-CGEWCIGP.js +1 -0
  74. package/dist/static/v0.1.0/chunk-3PWTJFHH.js +1 -0
  75. package/dist/static/v0.1.0/chunk-AWIQCFGN.js +1 -0
  76. package/dist/static/v0.1.0/chunk-GVYMMTQM.js +1 -0
  77. package/dist/static/v0.1.0/chunk-MCWQHOEV.js +1 -0
  78. package/dist/static/v0.1.0/chunk-MI35SSIT.js +1 -0
  79. package/dist/static/v0.1.0/consent.js +1 -0
  80. package/dist/static/v0.1.0/core.js +3 -0
  81. package/dist/static/v0.1.0/correlate.js +1 -0
  82. package/dist/static/v0.1.0/early-access.js +1 -0
  83. package/dist/static/v0.1.0/experiments.js +1 -0
  84. package/dist/static/v0.1.0/flags.js +3 -0
  85. package/dist/static/v0.1.0/forms.js +1 -0
  86. package/dist/static/v0.1.0/guides.js +1 -0
  87. package/dist/static/v0.1.0/heatmaps.js +1 -0
  88. package/dist/static/v0.1.0/host-headers.js +1 -0
  89. package/dist/static/v0.1.0/index.js +3 -0
  90. package/dist/static/v0.1.0/inspector.js +1 -0
  91. package/dist/static/v0.1.0/integrity.json +30 -0
  92. package/dist/static/v0.1.0/lucida.js +3 -0
  93. package/dist/static/v0.1.0/modules-FANMZRDJ.js +1 -0
  94. package/dist/static/v0.1.0/persistent-XLGNSZQR.js +1 -0
  95. package/dist/static/v0.1.0/recommendations.js +1 -0
  96. package/dist/static/v0.1.0/recorder-LFUTDRP4.js +78 -0
  97. package/dist/static/v0.1.0/replay.js +1 -0
  98. package/dist/static/v0.1.0/toolbar.js +4 -0
  99. package/dist/static/v0.1.0/validation-ENITEP6V.js +1 -0
  100. package/dist/static/v0.1.0/webmcp.js +1 -0
  101. package/dist/toolbar.d.ts +193 -0
  102. package/dist/toolbar.js +4 -0
  103. package/dist/types-BWd9sbCh.d.ts +1071 -0
  104. package/dist/types-Cv4pBbPu.d.ts +898 -0
  105. package/dist/validation-ENITEP6V.js +1 -0
  106. package/dist/webmcp.d.ts +21 -0
  107. package/dist/webmcp.js +1 -0
  108. package/package.json +104 -3
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
package/README.md CHANGED
@@ -1,3 +1,229 @@
1
- # Temporary Holding Version
1
+ # @lucida-analytics/browser
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Browser SDK: core client plus opt-in modules (each its own entry, tree-shakeable).
4
+
5
+ ```ts
6
+ import { createClient, autocapture } from "@lucida-analytics/browser";
7
+ import { replay } from "@lucida-analytics/browser/replay"; // loader only; rrweb loads lazily
8
+ import { heatmaps } from "@lucida-analytics/browser/heatmaps";
9
+ import { forms } from "@lucida-analytics/browser/forms";
10
+ createClient("lc_pk_...", { apiHost: "https://ingest.example.com" }, [autocapture, heatmaps, forms, replay]);
11
+ ```
12
+
13
+ Privacy defaults: inputs masked in replay, no form values ever collected, consent respected
14
+ before any storage write. `[data-lc-ignore]` hides a subtree from every module,
15
+ `[data-lc-mask]` masks text in replay, `[data-lc-block]` replaces an element with a placeholder.
16
+ `replay: { mask_all_text: true, unmask_selectors: [".menu"] }` masks every text node and text attribute in the browser except
17
+ inside `[data-lc-unmask]` or the unmask list (a mask selector inside still wins); the project setting `replay_mask_all_text` forces it on.
18
+
19
+ ## Wire contract
20
+
21
+ - **Replay**: `POST /v1/replay?compression=gzip`, body `{api_key, session_id, window_id, seq, events}`;
22
+ `seq` is monotonic per window and resets when the session rotates. The gateway accepts up to
23
+ 10 MB decompressed (full DOM snapshots); the SDK drops a single event above that. A custom
24
+ rrweb event `page_height` carries the document height for scroll-depth math.
25
+ - **Clicks** (`$autocapture`): `$selector`, `$el_interactive`, `$click_x/$click_y` (page px),
26
+ `$click_el_x/$click_el_y`, `$el_width/$el_height`, `$viewport_bucket`. `$rageclick`,
27
+ `$deadclick` and `$frustration` are derived server-side (`selector`, `x_ratio`, `y_px`,
28
+ `viewport_bucket`, `$pathname`); the browser never emits them.
29
+ - **Scroll depth**: `$pageleave` carries `$scroll_depth` (%) and `$scroll_depth_px`.
30
+ - **Forms**: `$form_start {form}`, `$form_field_interact {form, field, interaction_ms,
31
+ refill_count, error}`, `$form_submit {form}`, `$form_abandon {form, last_field}`. `form` and
32
+ `field` are 12-hex hashes of name/id/label; values are never read.
33
+ - **Toolbar**: opens on `?__lc_toolbar=<token>`; the token is stripped from the URL and exchanged
34
+ once at `POST /v1/toolbar/exchange` with `{token, origin}`, returning
35
+ `{token, project_id, scopes, origin, expires_at}`. The returned token is the bearer for
36
+ project-scoped calls (`/v1/projects/{id}/actions`, `/heatmaps`). Rejected token: nothing mounts.
37
+ Launch it from the app (Settings > Toolbar: authorized origins, Launch, bookmarklet) or from code with
38
+ `client.loadToolbar(token)` when your framework rewrites the URL first; `#__lc_toolbar=<token>` in the hash also works.
39
+ Behind a reverse proxy that only forwards capture, set `uiHost` to the Lucida API host the toolbar should call.
40
+ Panels: multi-element **actions** (each picked element is an OR alternative with editable selector, text, link and
41
+ page conditions; `toolbar.dataAttributes` sets the selector's attribute preference) and an overlay of existing
42
+ actions (numbered boxes, counts, edit, delete); **heatmap** (click, rage, dead, move, scrollmap; numbered element
43
+ boxes with click and rage counts, "Create action" from a box, Load more / Load all, match links by URL); **flag
44
+ overrides** (search, on/off or any variant, reload prompt); **event debugger** (local only: search or `/regex/`,
45
+ category, pause, pin, copy, export JSON, relative time). A toolbar `read` member gets a view-only session.
46
+ **CSP**: allow the API host (or `uiHost`) in `connect-src`; the toolbar needs no extra `script-src` (its panels are
47
+ bundled chunks of this SDK) and renders in a shadow root, so `style-src` must permit inline style attributes
48
+ (`'unsafe-inline'` for attributes, or `style-src-attr 'unsafe-inline'`). The in-app heatmap viewer renders a
49
+ recording, not your live site, so it needs no `frame-ancestors` change on your site.
50
+ The **Guide builder** (lazy chunk, LC-ENG-7) picks elements with the inspector (selector preference: `data-lc-id`,
51
+ `data-testid`/`data-test`/`data-cy`/`data-qa`, `#id`, structural), previews with the SDK renderer (no events), and saves via
52
+ `POST/PUT /v1/projects/{id}/guides`. Toolbar sessions carry `guides:write`. All guide kinds are offered, plus an image URL and alt text.
53
+ - **Experiment editor** (lazy chunk, LC-EXT-37): opens on `?__lc_toolbar=<token>&__lc_edit=<experiment id>` (scope `experiments:write`). It picks a variant, records point-and-click changes (optionally for this page only), saves them to a draft experiment and adds click goals. `?lc_preview=<flag>:<variant>` forces a variant for QA without recording exposure.
54
+ - **Banners and changelog** (LC-ENG-8): `banner` guides render top or bottom (`steps[0].placement: "bottom"`), dismissible,
55
+ one engagement at a time via the arbiter. `client.guides.showChangelog()` lists banner guides (returns the count, 0 = none).
56
+ - **Guides depth** (LC-ENG-10 to 18, `@lucida-analytics/browser/guides`): `hotspot`, `beacon`, `badge` and `launcher` guides stay on the
57
+ page (lazy `persistent` chunk). Step `buttons[].goto` / `branch` rules (person properties) jump forward; a step with `url`
58
+ pauses a tour until that page, and tours / checklists resume on the next page (consent-gated storage). Targeting adds
59
+ `devices`, `person_filters`, `group_filters` (from `group(type, key, props)`), `seen_guides` / `not_seen_guides`, `schedule`
60
+ (window, weekdays, local hours), `frequency` and gateway-resolved `cohort_ids` / `exclude_cohort_ids`. Guides sharing `ab_group`
61
+ are A/B variants (`ab_weight`); `holdout_pct` people get `$guide_holdout` and no guide, the control for goal impact.
62
+ `steps[].i18n` picks text by `config.guides.locale`, person property `locale`, then the browser language. Checklist items
63
+ with `complete_on: {event, props?}` tick themselves from captured events, also when the list is not on screen.
64
+ - **Guide behaviour extras** (W11): `branch[].op` also `element_present` / `element_absent` (CSS selector, checked when Next is
65
+ pressed) and `flag_on` / `flag_off` (evaluated flags). Buttons `action: "snooze"` (`snooze_hours` 1..720, kept with the guide
66
+ state and synced across devices), step `advance: "input"` (moves on when the target field fires `change`; the value is never
67
+ read), `auto_close_s` (dismissed with `reason: "auto_close"`), `confetti` on the last step (skipped under reduced motion) and
68
+ `automation: {action: click|focus|fill, selector, value?}` (never on `input[type=password]`, `[data-lc-mask]`, `.lc-mask`,
69
+ `[autocomplete^=cc-]`; values never read). Kinds `carousel` (dot pager, Back / Next, arrow keys, swipe) and `form_validation`
70
+ (`validation: {selector, rules}` checked on blur and submit; a failing submit is held back and only
71
+ `$guide_validation_failed {rule}` is sent, never a value). `appearance.theme_mode` (auto / light / dark) with
72
+ `appearance.dark.tokens` and the gateway-resolved theme `font_family`. Anchored steps that never find their target send
73
+ `$guide_target_missing {step_id, selector}`.
74
+ - **Guide permalinks**: `?lc_guide=<id>` opens that guide at once (no delay) when the gateway served it and its targeting
75
+ passes; the param is stripped with `history.replaceState`, and nothing runs before consent.
76
+ - **Resource-center AI answers**: a `search` module asks `POST /v1/guides/answer` (publishable key; 503 = no LLM, the box hides
77
+ and plain search stays), shows the answer, https citations, suggested guides and Helpful / Not helpful. Each search sends
78
+ `$guide_search {query_length, results, answered, feedback?}`; the query text only with the project setting
79
+ `guide_search_capture_query`.
80
+ - **Guides in iframes**: in a child frame set `guides.renderInTop: "https://app.example.com"` (the top origin); in the top
81
+ window set `guides.frameOrigins: ["https://embed.example.com"]`. The child keeps targeting, state and events and posts its
82
+ guides to the top window, which draws them over the whole page with target rects mapped through the iframe position.
83
+ Messages go to one exact origin and are accepted only from the expected window and origin.
84
+ - **Toolbar guide tools**: "Record clicks" turns a click path (across page loads in the tab) into tour steps with stable
85
+ selectors and step urls, then `POST /v1/projects/{id}/guides/draft` writes the copy (a plain recorded tour when the route
86
+ fails); "Draft from prompt" asks the same route; "Derive theme from this page" reads computed body / primary-button styles
87
+ and saves `POST /guide-themes`. Automation targets and form-validation fields are checked in the page before saving.
88
+
89
+ ## Experiments and early access
90
+
91
+ - **Split URL** (`splitUrl` from `@lucida-analytics/browser/experiments`): a variant payload `{"lc_split_url": {"url": "/pricing-b"}}`
92
+ sends visitors assigned that variant there with `location.replace`, before paint when `splitUrl.antiFlickerMs` hides the page.
93
+ Query and hash are kept (the variant URL's own params win), the target gets `__lc_split=<flag>` (stripped on arrival; it
94
+ prevents loops), only same-origin or `splitUrl.allowedOrigins` targets are followed, and `$exposure` is flushed first.
95
+ - **Early access** (`earlyAccess` from `@lucida-analytics/browser/early-access`): `client.earlyAccess.list()` reads
96
+ `GET /v1/early-access?api_key=` (`{features: [{flag_key, name, description, stage}]}`, a gateway endpoint that does not
97
+ exist yet) and marks local enrolment; `optIn(key)`/`optOut(key)` capture `$early_access_opt_in {$feature_flag, $enrolled}`
98
+ with the person property `$feature_enrollment/<key>` and reload flags.
99
+
100
+ ## Link, search, privacy and identity options
101
+
102
+ - **Outbound / downloads / site search** (autocapture config, each on by default): `outboundLinks` emits `$outbound_click
103
+ {$url, $outbound_host}`; `fileDownloads` (`false`, or your own extension list; default pdf, zip, office, csv, dmg, exe, mp3,
104
+ mp4 ...) emits `$file_download {$url, $file_name, $file_extension}`; `siteSearch` (`false`, or `{params: [...]}`, default
105
+ `q`, `s`, `search`, `query`) emits `$site_search {$search_term, $search_param}` after each `$pageview` that carries a
106
+ query param. Reported URLs drop query and hash. `[data-lc-ignore]` subtrees are skipped. `tag404(client)` (from
107
+ `@lucida-analytics/browser`) on a 404 page captures `$page_not_found {$status: 404}`.
108
+ - **DNT / GPC**: `respectDnt` (default false) and `respectGpc` (default false). When set and the browser sends the signal,
109
+ an `opt_out` project starts with consent denied, so nothing is stored or sent until `setConsent`. An explicit stored
110
+ decision still wins. (`consent.respectDnt` is kept and enables both.)
111
+ - **Consent state**: `client.getConsent()` returns the current decision per category; `client.getConsentStatus(category?)`
112
+ is `pending` until the visitor chose (stored or `setConsent`), then `granted` or `denied`, so a banner can show only
113
+ while pending. `consent.storageKey` (default `lc_consent`) names the stored decision; `cookie: { domain: ".example.com" }`
114
+ (or `crossSubdomain: true`) shares identity, session and the decision across subdomains.
115
+ - **Cross-domain**: `crossDomains: ["shop.example.com"]` (exact host or subdomains; list the other site on both sides). While
116
+ analytics consent is held, clicks on links to those hosts get `_lcid=<distinct_id>.<base36 ms>_<session id>`. On landing the
117
+ SDK strips `_lcid` from the address bar and, if it is under 2 minutes old and the referrer (when sent) is a configured
118
+ domain, adopts that id and session for a first-time visitor (an existing id or session is kept). Links from older SDKs
119
+ (no session part) still work, and older SDKs read new links. The value is unsigned by design: treat it as identity
120
+ continuity, not authentication.
121
+ - **Internal traffic**: `client.optOutInternal()` stores an exclude-me flag (consent-gated) and adds `$internal: true` to
122
+ every event from that browser; `optOutInternal(false)` undoes it. The toolbar has a toggle. `$lc_*` properties are stripped
123
+ at the gateway, hence `$internal`: lc-worker must drop or flag these events.
124
+
125
+ ## Snapshot properties, page privacy rules and agent actions
126
+
127
+ - **Snapshot properties** (no code, set in project settings or picked in the toolbar): each rule reads an element's visible
128
+ text (whitespace collapsed, at most 255 characters) or one attribute onto `$autocapture` clicks and/or `$pageview` as
129
+ `<name>`. `scope: "target"` reads the match nearest the clicked element, `url` limits the rule to matching pages. Form
130
+ fields, editable or masked elements, `value`/`password`/`on*` attributes and card-like digit runs are never read. SPA
131
+ pageviews wait one tick so the new page renders; the first pageview of a hard load can miss values the page renders later.
132
+ - **Page privacy rules** (`replay.url_privacy_rules`, or `replay_url_privacy_rules` from the remote config): `[{url,
133
+ mask_all_text?, mask_selectors?, block_selectors?}]`. On matching pages the recorder adds those masks on top of the global
134
+ policy and restarts recording with a fresh full snapshot when the rule set changes on navigation. Patterns use the URL
135
+ blocklist syntax (`*` wildcard, `re:` regex).
136
+ - **WebMCP agent actions** (`import { webmcp } from "@lucida-analytics/browser/webmcp"`, add it to `modules`): wraps
137
+ `navigator.modelContext.provideContext` / `registerTool` so each tool call an AI agent makes on the page captures
138
+ `$agent_action {tool, status: ok|error, duration_ms, $agent_protocol: "webmcp"}`. Tool arguments and results are never
139
+ sent. From the first call the session is marked: every later event carries `$agent_session: true`, and the enricher sets
140
+ `$agent_source = webmcp` so replays and insights can filter agent-driven sessions.
141
+
142
+ ## Event hooks, person modes and request controls
143
+
144
+ - **`beforeSend`** (one hook or an array): runs on every event right before it is queued, in order, each on the previous
145
+ output. Return the (amended) event, or `null` to drop it. A hook that throws is logged and skipped. `sampleRate: 0.1` keeps
146
+ 10% and stamps `$sample_rate` (the `sampleHook(rate)` helper is exported to compose with your own filter);
147
+ `propertyDenylist: ["email"]` removes those keys from properties, `$set` and `$set_once`. They run before your hooks.
148
+ - **`personProfiles`**: `"always"` (default), `"identified_only"` (events carry `$process_person_profile: false` until
149
+ `identify`, `alias`, `group` or `setPersonProperties`; the state is stored after consent and cleared by `reset()`), or
150
+ `"never"` (always personless; `identify`/`alias`/`setPersonProperties` do nothing). `$identify`, `$create_alias` and
151
+ `$groupidentify` are always processed. Person writes riding on a personless event are not sent, except `$set_once`
152
+ values (initial referrer, campaign, click ids): those are kept (first value wins, consent-gated) and sent with the first
153
+ person-processed event. `createPersonProfile()` switches an `identified_only` visitor to a person without `identify`.
154
+ `reuseAnonymousId: true` makes `reset()` keep this device's first anonymous id.
155
+ - **Methods**: `setPersonProperties(set, setOnce)` / `unsetPersonProperties(keys)` (send a `$set` event),
156
+ `getSessionId()`, `onSessionId(cb)` (now and on every rotation), `getProperty(key)`, `hasOptedOut()`,
157
+ `reset(resetDeviceId)`, `getReplayUrl({withTimestamp, timestampLookBackSeconds})` (uses `uiHost`, else `apiHost`),
158
+ `debug(on)` (also `?__lucida_debug=1`), `featureView(flag)` / `featureInteraction(flag)` (`$feature_view` /
159
+ `$feature_interaction`, marking the person `$feature_view/<flag>`), `updateFlags(flags, payloads, {merge})`.
160
+ - **`capture(event, props, options)`**: `timestamp` (epoch ms, ISO string or Date), `sendInstantly` (flush now),
161
+ `transport: "beacon"` (flush with sendBeacon).
162
+ - **`bootstrap`**: `{distinctId, isIdentified, sessionId, flags, payloads}`. A stored identity or session always wins
163
+ over bootstrap values, so a returning browser keeps its own; `isIdentified` means the id is a signed-in user.
164
+ - **Tracing headers**: `tracingHeaders: ["api.example.com", ".example.org"]` (exact host, or a leading-dot suffix) adds
165
+ `X-Lucida-Distinct-Id` and `X-Lucida-Session-Id` to fetch/XHR to those hosts. Opt-in, only while analytics consent is
166
+ held, never sent to the ingest host; cross-origin targets must allow both headers in CORS. Server SDKs read them with
167
+ `requestContext`; they are client-controlled, so never use them for auth.
168
+ - **Limits and sessions**: `rateLimit: {eventsPerSecond: 10, burst: 100}` (off by default) is a client token bucket; drops
169
+ are reported as one `$$client_ingestion_warning {$dropped_count}` per minute. `onCapture` listeners (inspector, replay
170
+ triggers) only see events that passed `beforeSend`, sampling and the limit;
171
+ `session: {idleMs, maxMs}` changes the 30 min idle / 24 h rotation; `customCampaignParams: ["ref_code"]` adds
172
+ `$ref_code` (and `$initial_ref_code`) on pageviews.
173
+ - **Transport**: `disableBeacon`, `requestHeaders` (adds a CORS preflight to the ingest host), `onRequestError({url, status})`,
174
+ `rewritePath: (path) => path` (renames every request path on `apiHost` / `flagsApiHost`, for proxies). Every event carries
175
+ `$lib_custom_api_host` when `apiHost` is not the Lucida default, so proxy coverage is measurable.
176
+ - **Storage**: `persistence: "cookie" | "localStorage" | "sessionStorage" | "localStorage+cookie" | "memory" | "none"`.
177
+ `localStorage+cookie` keeps identity, session, device id and consent in a cookie and localStorage (cookie wins on
178
+ conflict, either fills in for the other) and everything else in localStorage. `persistedProperties: ["plan"]` persists only
179
+ those super properties; `storageWriteDelayMs` coalesces writes (flushed on page hide); `flagPersistence` and
180
+ `consentPersistence` give the flag cache and the consent decision their own store; `cookieless: "always" | "on_reject"`.
181
+ All writes stay behind consent.
182
+ - **Runtime config**: `client.setConfig(partial)` merges options one level deep; per-event options (debug, autocapture
183
+ options, hooks, sampling, denylist, rate limit, persisted properties) apply at once.
184
+ - **Delivery**: `assetHost` + `modules: ["replay", ...]` (classic script only) load versioned modules from
185
+ `<assetHost>/static/v<version>/`; `nonce` goes on every injected `<style>`; `extension: true` (auto on extension pages) for
186
+ Manifest V3. See docs/guides/sdk-pinning.md, csp.md and browser-extension.md.
187
+ - **Cookies**: `cookie: {secure, expiryDays, crossSubdomain, domain}`. `crossSubdomain` probes for the broadest parent domain
188
+ the browser accepts (on first write, which is after consent); all cookie writes stay behind consent.
189
+ - **Pageleave**: `capturePageleave: true | false | "if_capture_pageview"` (default).
190
+ - **Autocapture**: `elementAllowlist: ["a", "button"]`, `attributeIgnore: ["data-*", "title", "href"]`,
191
+ `maskAllAttributes` + `attributeAllowlist` (every attribute value in `$elements` reads `***` except the allowlist),
192
+ `urlIgnorelist: ["/admin", /\/checkout\//]` (autocapture off on those pages), `contentEditable` (default on: an edited
193
+ region is reported on blur, chain only), `copyCut` (`$copy_autocapture {$copy_type}`, default off) with
194
+ `captureCopiedText` (`$selected_content`, digits and emails masked, 255 chars), and `data-lc-attr-<name>="v"` on an
195
+ element or ancestor adds `<name>: "v"` to its events.
196
+ `rageClicks: false | {count, radiusPx, windowMs, ignoreSelectors, ignoreTextSelection, suppressSteppers, stepperSelectors}`
197
+ (`.lc-no-rageclick` always opts out; steppers such as number inputs, +/- and carousel arrows never count unless
198
+ `suppressSteppers: false`), `deadClicks: false | {waitMs, ignoreSelectors}` (a scroll or selection change counts as a reaction).
199
+ - **Flags**: `flagsApiHost` (separate origin for `/v1/flags`), `flagOptions: {timeoutMs, refreshMs, keys, evaluationContexts,
200
+ disableRemote}`. `keys` scopes both the request (`flag_keys`) and what the client exposes; `disableRemote` leaves values to
201
+ bootstrap, `localFlags` and `updateFlags`.
202
+
203
+ ## Agent analytics
204
+
205
+ ```ts
206
+ const lucida = init("lc_pk_...", { ai: { captureText: false } });
207
+ const convo = lucida.ai.startConversation({ agentName: "support-bot", agentVersion: "3", traceId, topic: "billing" });
208
+ convo.message("user", question);
209
+ convo.message("assistant", answer);
210
+ convo.feedback({ kind: "thumbs", value: -1 });
211
+ convo.end("resolved");
212
+ ```
213
+
214
+ Events: `$ai_conversation_started`, `$ai_message` (role, auto-incremented index, text length; for user
215
+ messages a simhash `$ai_text_hash` and a lexicon `$ai_sentiment` so rephrases and frustration show without the
216
+ text), `$ai_feedback` (thumbs 1/-1, rating 1..5, comment), `$ai_conversation_ended` and `$ai_outcome`
217
+ (`resolved`, `unresolved`, `escalated`, `abandoned`, `error`). Message text and feedback comments are sent only
218
+ with `ai: { captureText: true }`, after cards, emails and phone numbers are masked. `traceId` (a W3C trace id) links the
219
+ conversation to its trace in Watchtower; tokens, latency, cost and model names are never captured here.
220
+ Events use the normal capture path, so consent and opt-out apply.
221
+
222
+ ## Interventions
223
+
224
+ `client.onIntervention((i) => ...)` receives the in-session interventions fired for the current person (`{id, intervention_id, name, event, payload, fired_at}`, each once). The first listener opens `GET /v1/interventions/stream` (after analytics consent); it resumes after the last fire on reconnect and follows `identify` / `reset`. Returns an unsubscribe function. See `docs/guides/interventions.md`.
225
+
226
+ ## Develop
227
+
228
+ `pnpm test` (jsdom), `pnpm e2e` (builds, then real Chromium via Playwright against a stub
229
+ ingest server), `pnpm size` (bundle budgets).
@@ -0,0 +1,78 @@
1
+ import { C as Client, M as Module } from './types-BWd9sbCh.js';
2
+ import { Props } from '@lucida-analytics/sdk-core';
3
+
4
+ interface ElementInfo {
5
+ tag_name: string;
6
+ nth_child: number;
7
+ nth_of_type: number;
8
+ classes?: string[];
9
+ attr__id?: string;
10
+ href?: string;
11
+ text?: string;
12
+ attrs?: Record<string, string>;
13
+ }
14
+ /** Attribute-value masking: everything but `allow` (same matching as attributeIgnore) reads `***`. */
15
+ interface MaskOptions {
16
+ maskAll?: boolean | undefined;
17
+ allow?: readonly string[] | undefined;
18
+ }
19
+ declare const MASKED = "***";
20
+ /** `data-lc-attr-<name>="v"` on the target or an ancestor becomes event property `<name>: "v"` (nearest wins). */
21
+ declare function attrProps(target: Element): Record<string, string>;
22
+ /** Element chain from the target up to <html> (max depth 10). Text only on the first `textDepth` elements. */
23
+ declare function buildChain(target: Element, captureText: boolean, textUpTo?: Element, ignoreAttrs?: readonly string[], maskOpts?: MaskOptions): ElementInfo[];
24
+ /** Compact single-string form: tag.class:attr__id="x"nth-child="1"..., elements joined by ';'. */
25
+ declare function chainToString(chain: ElementInfo[]): string;
26
+
27
+ /**
28
+ * Descendant-combinator selector (`body div.card button#buy`) in the subset crates/lc-replay's
29
+ * selector engine understands: tag, #id, .class. Stops at the first id; max 5 levels.
30
+ */
31
+ declare function cssSelector(el: Element): string;
32
+
33
+ /** Copied text as sent with `captureCopiedText`: digit runs (cards, phones) and emails masked, whitespace folded, cut to 255. */
34
+ declare function maskCopied(t: string): string;
35
+
36
+ /**
37
+ * Repeated clicks here are the intended use, not frustration: number inputs and spinbuttons, +/- and arrow buttons,
38
+ * and controls whose class, aria-label or title names a stepper, quantity or carousel, plus your `extra` selectors.
39
+ */
40
+ declare function isStepper(target: Element, extra?: readonly string[]): boolean;
41
+
42
+ declare const DOWNLOAD_EXTENSIONS: string[];
43
+ declare const SEARCH_PARAMS: string[];
44
+ /** Call from the 404 page template: `$page_not_found` lets reports list dead URLs and their referrers. */
45
+ declare function tag404(client: Pick<Client, "capture">, props?: Record<string, string | number | boolean>): void;
46
+
47
+ /** Media URL without query or fragment (signed URLs and tokens stay out of analytics). */
48
+ declare function mediaSrc(el: HTMLMediaElement): string;
49
+
50
+ /**
51
+ * No-code snapshot properties (P-M15): remote rules (`snapshot_properties` in GET /v1/config, set in the
52
+ * web app or with the toolbar picker) copy the visible text or one attribute of a matching element onto
53
+ * `$autocapture` clicks and/or `$pageview`s. Form controls, editable and masked elements are never read,
54
+ * nor `value`/event-handler attributes; card-like digit runs are dropped.
55
+ */
56
+ interface SnapshotRule {
57
+ name: string;
58
+ selector: string;
59
+ source: "text" | "attribute";
60
+ attribute?: string;
61
+ events: Array<"click" | "pageview">;
62
+ /** `target`: the closest match around the clicked element (click rules only). Default `page`: first match in the document. */
63
+ scope?: "page" | "target";
64
+ /** URL pattern (substring, `*` wildcard, `re:` regex). */
65
+ url?: string;
66
+ }
67
+ /** Well-formed rules only (remote config is untrusted input). */
68
+ declare function snapshotRules(v: unknown): SnapshotRule[];
69
+ /** Property values of the rules for `event` on this page (`target`: the clicked element). */
70
+ declare function readSnapshot(rules: SnapshotRule[], event: "click" | "pageview", target?: Element, url?: string): Props;
71
+
72
+ /**
73
+ * Autocapture module: click/change/submit, contenteditable edits, copy/cut, outbound/download/site-search, media,
74
+ * SPA pageviews, pageleave + scroll depth. `urlIgnorelist` switches all but pageviews off on matching pages.
75
+ */
76
+ declare const autocapture: Module;
77
+
78
+ export { DOWNLOAD_EXTENSIONS, type ElementInfo, MASKED, type MaskOptions, SEARCH_PARAMS, type SnapshotRule, attrProps, autocapture, buildChain, chainToString, cssSelector, isStepper, maskCopied, mediaSrc, readSnapshot, snapshotRules, tag404 };
@@ -0,0 +1 @@
1
+ var ae=(e,t)=>()=>(e&&(t=e(e=0)),t);function Oe(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function $(e,t){return!!e?.some(n=>{try{return new RegExp(Oe(n),"i").test(t)}catch{return!1}})}var Q=ae(()=>{"use strict"});var le='[data-lc-region="article"]';function O(e,t,n){if(t.articles===!1)return()=>{};let s;e.loadConfig().then(f=>{typeof f?.article_selector=="string"&&(s=f.article_selector)});let a=()=>{for(let f of[t.articleSelector,s,le])if(f)try{let y=document.querySelector(f);if(y)return y}catch{}return null},o=location.href,l=location.pathname,u=null,i=0,c=!1,r=()=>{if(u??=a(),!u)return;let f=u.getBoundingClientRect();if(f.height<=0)return;let y=Math.round(Math.min(100,Math.max(0,(window.innerHeight-f.top)/f.height*100)));i=Math.max(i,y);let _=u.querySelector("h1,h2");_&&_.getBoundingClientRect().bottom<0&&(c=!0)},p=()=>{!u||!n()||(r(),e.client.capture("$article_read",{$article_id:(u.getAttribute("data-lc-article-id")??"").trim().slice(0,200)||l,$article_depth:i,$article_finished:i>=90,$article_headline_exit:!c&&i<25}),u=null)},d=()=>{p(),u=null,i=0,c=!1,o=location.href,l=location.pathname},m=()=>location.href!==o?d():r(),g=new MutationObserver(m);return g.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("scroll",m,{passive:!0}),e.onUnload(p),r(),()=>{g.disconnect(),window.removeEventListener("scroll",m)}}var w="data-lc-content",ce="data-lc-content-piece",ue="data-lc-content-target";var S=(e,t)=>(e.getAttribute(t)??"").trim().slice(0,200);function I(e,t,n){if(t.contentBlocks===!1||typeof IntersectionObserver>"u")return()=>{};let s=new WeakSet,a=r=>{let p={$content_name:S(r,w)},d=S(r,ce),m=S(r,ue);return d&&(p.$content_piece=d),m&&(p.$content_target=m),p},o=location.href,l=new IntersectionObserver(r=>{for(let p of r)!p.isIntersecting||s.has(p.target)||!n()||(s.add(p.target),e.client.capture("$content_impression",a(p.target)))},{threshold:.5}),u=r=>r.querySelectorAll(`[${w}]`).forEach(p=>l.observe(p));u(document);let i=new MutationObserver(()=>{location.href!==o&&(o=location.href,l.disconnect(),document.querySelectorAll(`[${w}]`).forEach(r=>s.delete(r))),u(document)});i.observe(document.documentElement,{childList:!0,subtree:!0});let c=r=>{let p=r.target?.closest?.(`[${w}]`);p&&n()&&e.client.capture("$content_interaction",{...a(p),$content_interaction_type:"click"})};return document.addEventListener("click",c,!0),()=>{l.disconnect(),i.disconnect(),document.removeEventListener("click",c,!0)}}var pe=new Set(["input","textarea","select","option"]),de=["name","type","role","aria-label","title","alt","placeholder"],fe=/(?:\d[ -]?){9,}/;function me(e){if(pe.has(e.tagName.toLowerCase())||e.isContentEditable)return;let t="";for(let n of Array.from(e.childNodes))n.nodeType===3&&(t+=n.textContent??"");if(t=t.replace(/\s+/g," ").trim(),!(!t||fe.test(t)))return t.slice(0,255)}function H(e){if(!e?.length)return()=>!1;let t=e.map(n=>n.toLowerCase());return n=>t.some(s=>s.endsWith("*")?n.startsWith(s.slice(0,-1)):n===s)}var P="***";function v(e){let t={};for(let n=e,s=0;n&&s<10;n=n.parentElement,s++)for(let a of Array.from(n.attributes)){let o=a.name.startsWith("data-lc-attr-")?a.name.slice(13):"";o&&!(o in t)&&!o.startsWith("$")&&(t[o]=a.value.slice(0,255))}return t}function ge(e,t,n,s){let a=e.parentElement,o=a?Array.from(a.children):[e],l={tag_name:e.tagName.toLowerCase(),nth_child:o.indexOf(e)+1,nth_of_type:o.filter(r=>r.tagName===e.tagName).indexOf(e)+1},u=(e.getAttribute("class")??"").split(/\s+/).filter(Boolean);u.length&&!n("class")&&(l.classes=u),e.id&&!n("id")&&(l.attr__id=s("id",e.id));let i=e.getAttribute("href");i&&!n("href")&&(l.href=s("href",i.slice(0,1024)));let c={};for(let r of Array.from(e.attributes))(r.name.startsWith("data-lc-")||de.includes(r.name))&&!n(r.name)&&(c[r.name]=s(r.name,r.value.slice(0,255)));if(Object.keys(c).length&&(l.attrs=c),t){let r=me(e);r&&(l.text=r)}return l}function b(e,t,n,s,a={}){let o=[],l=H(s),u=H(a.allow),i=a.maskAll?(r,p)=>u(r)?p:P:(r,p)=>p,c=t;for(let r=e;r&&o.length<10;r=r.parentElement)o.push(ge(r,c,l,i)),(r===n||!n)&&(c=!1);return o}var C=e=>e.replace(/(["\\])/g,"\\$1");function E(e){return e.map(t=>{let n=t.tag_name+(t.classes?"."+t.classes.join("."):"")+":";t.attr__id&&(n+=`attr__id="${C(t.attr__id)}"`),t.href&&(n+=`href="${C(t.href)}"`),t.text&&(n+=`text="${C(t.text)}"`);for(let[s,a]of Object.entries(t.attrs??{}))n+=`attr__${s}="${C(a)}"`;return n+`nth-child="${t.nth_child}"nth-of-type="${t.nth_of_type}"`}).join(";")}var h=[],ye=/^[+\-−–‹›<>«»←→↑↓▲▼▶◀^ˇ˄˅]$/,he=/\b(increase|decrease|increment|decrement|plus|minus|add one|remove one|next|prev|previous|scroll (left|right))\b/i,_e=/(^|[-_\s])(stepper|spinner|quantity|qty|increment|decrement|inc|dec|plus|minus|carousel|slider|swiper|slick|glide|splide|arrow|next|prev)([-_\s]|$)/i,ve="button,[role=button],a,input[type=button],input[type=submit],[role=spinbutton]";function j(e,t=[]){if(t.length&&e.closest(t.join(","))||e.closest("input[type=number],[role=spinbutton],[role=slider]"))return!0;let n=e.closest(ve)??e,s=`${n.getAttribute("aria-label")??""} ${n.getAttribute("title")??""}`;if(ye.test((n.textContent??"").trim())||he.test(s))return!0;for(let a=n,o=0;a&&o<3;a=a.parentElement,o++)if(_e.test(a.getAttribute("class")??""))return!0;return!1}var be=()=>typeof getSelection=="function"?(getSelection()?.toString()??"")!=="":!1;function N(e,t=Date.now(),n={},s){if(s&&n.ignoreSelectors?.length&&s.closest(n.ignoreSelectors.join(",")))return{};if(s&&n.suppressSteppers!==!1&&j(s,n.stepperSelectors))return{};if(n.ignoreTextSelection!==!1&&be())return{};let a=n.windowMs??1e3,o=n.radiusPx??30;for(h.length&&t<h[h.length-1].t&&(h.length=0),h.push({t,x:e.clientX,y:e.clientY});h.length&&t-h[0].t>a;)h.shift();let l=h.filter(u=>Math.hypot(u.x-e.clientX,u.y-e.clientY)<=o).length;return l>=(n.count??3)?{$rageclick:!0,$rageclick_count:l}:{}}function D(e,t,n=700){if(typeof MutationObserver>"u")return;let s=!1,a=new MutationObserver(()=>s=!0);a.observe(document.documentElement,{subtree:!0,childList:!0,attributes:!0,characterData:!0});let o=()=>{s=!0};window.addEventListener("scroll",o,{capture:!0,passive:!0}),document.addEventListener("selectionchange",o);let l=()=>{a.disconnect(),window.removeEventListener("scroll",o,{capture:!0}),document.removeEventListener("selectionchange",o)},u=setTimeout(()=>{l(),!s&&document.visibilityState!=="hidden"&&e.client.capture("$deadclick_hint",{$selector:t,$no_mutation_ms:n})},n);e.onUnload(()=>{clearTimeout(u),l()})}var W=/^[A-Za-z_][\w-]*$/,Ee=5;function U(e){let t=[];for(let n=e;n&&t.length<Ee;n=n.parentElement){let s=n.tagName.toLowerCase();if(n.id&&W.test(n.id)){t.unshift(`${s}#${n.id}`);break}let a=(n.getAttribute("class")??"").split(/\s+/).filter(o=>W.test(o)).slice(0,2);t.unshift(s+a.map(o=>`.${o}`).join(""))}return t.join(" ")}function X(e,t,n,s,a={}){let o={$selector:U(n),$el_interactive:s};(t.clientX||t.clientY||t.detail)&&(o.$click_x=Math.round(t.clientX+(window.scrollX||0)),o.$click_y=Math.round(t.clientY+(window.scrollY||0))),a.rageClicks!==!1&&!n.closest(".lc-no-rageclick,[data-lc-no-rageclick]")&&Object.assign(o,N(t,Date.now(),a.rageClicks||{},n));let l=a.deadClicks;!s&&t.isTrusted&&l!==!1&&!(l?.ignoreSelectors?.length&&n.closest(l.ignoreSelectors.join(",")))&&D(e,o.$selector,l?.waitMs);for(let u of e.clickExtras)Object.assign(o,u(t,n));return o}var ke="a,button,input,select,textarea,label,summary,[role=button],[role=link],[data-lc-capture]",xe="[data-lc-ignore]",A=e=>e.some(t=>typeof t=="string"?location.href.includes(t):t.test(location.href)),we=e=>!e?.length||A(e),M=e=>({maskAll:e.maskAllAttributes,allow:e.attributeAllowlist}),k=(e,t)=>!!e.closest(xe)||!!(t.denySelectors?.length&&e.closest(t.denySelectors.join(",")));function F(e,t,n){let s=t.events??["click","change","submit"],a=0,o=i=>{let c=i.target;!n()||i.isComposing||!(c instanceof Element)||k(c,t)||c instanceof HTMLInputElement&&c.type==="password"||(a+=1)},l=i=>c=>{if(!n())return;let r=c.target;if(!(r instanceof Element)||k(r,t)||t.allowSelectors?.length&&!r.closest(t.allowSelectors.join(","))||t.elementAllowlist?.length&&!r.closest(t.elementAllowlist.join(","))||!we(t.urlAllowlist)||i==="change"&&!/^(input|select|textarea)$/i.test(r.tagName)||r instanceof HTMLInputElement&&r.type==="password")return;let p=r.closest(ke);if(i==="click"&&!p&&!t.allowSelectors?.length)return;let d=b(r,t.captureText??!0,p??void 0,t.attributeIgnore,M(t)),m=d.find(f=>f.text)?.text,g=a;a=0,e.client.capture("$autocapture",{...v(r),$event_type:i,...g>0?{$keystroke_count:g}:{},$elements:d,$elements_chain:E(d),...m?{$el_text:m}:{},...i==="click"?X(e,c,r,!!p,t):{}})};e.autocaptureClicks=s.includes("click");let u=s.map(i=>[i,l(i)]);for(let[i,c]of u)document.addEventListener(i,c,!0);return document.addEventListener("keydown",o,!0),()=>{for(let[i,c]of u)document.removeEventListener(i,c,!0);document.removeEventListener("keydown",o,!0)}}var Ce='[contenteditable]:not([contenteditable="false"])',q="input,textarea,select",Re=255;function K(e){return e.replace(/\d(?:[ -]?\d){5,}/g,"***").replace(/[^\s@]+@[^\s@]+\.[^\s@]+/g,"***").replace(/\s+/g," ").trim().slice(0,Re)}var Se=e=>e?e instanceof Element?e:e.parentElement:null;function G(e,t,n){let s=t.events??["click","change","submit"],a=t.contentEditable!==!1&&s.includes("change"),o=new WeakSet,l=p=>{let d=b(p,!1,p,t.attributeIgnore,M(t));return{...v(p),$elements:d,$elements_chain:E(d)}},u=p=>{let d=p instanceof Element?p.closest(Ce):null;return d&&!k(d,t)?d:null},i=p=>{let d=n()?u(p.target):null;d&&o.add(d)},c=p=>{let d=u(p.target);!d||!o.has(d)||p.relatedTarget instanceof Node&&d.contains(p.relatedTarget)||(o.delete(d),n()&&e.client.capture("$autocapture",{$event_type:"change",$el_contenteditable:!0,...l(d)}))},r=p=>{if(!n()||!t.copyCut)return;let d=typeof getSelection=="function"?getSelection():null,m=p.target instanceof Element?p.target:null,g=Se(d?.anchorNode)??m;if(!g||k(g,t)||g.closest(q)||m?.closest(q))return;let f=t.captureCopiedText?K(d?.toString()??""):"";e.client.capture("$copy_autocapture",{$copy_type:p.type,...l(g),...f?{$selected_content:f}:{}})};return a&&(document.addEventListener("input",i,!0),document.addEventListener("focusout",c,!0)),document.addEventListener("copy",r,!0),document.addEventListener("cut",r,!0),()=>{document.removeEventListener("input",i,!0),document.removeEventListener("focusout",c,!0),document.removeEventListener("copy",r,!0),document.removeEventListener("cut",r,!0)}}var Ae="[data-lc-ignore]",B=["pdf","zip","gz","tar","rar","7z","doc","docx","xls","xlsx","ppt","pptx","csv","epub","dmg","exe","msi","pkg","apk","iso","mp3","mp4","mov"],V=["q","s","search","query"],Y=e=>e.origin+e.pathname;function z(e,t,n){let s=Array.isArray(t.fileDownloads)?t.fileDownloads.map(o=>o.toLowerCase()):B,a=[];if(t.outboundLinks!==!1||t.fileDownloads!==!1){let o=l=>{let u=l.target instanceof Element?l.target.closest("a[href]"):null;if(!u||!n()||u.closest(Ae))return;let i;try{i=new URL(u.href,location.href)}catch{return}if(i.protocol!=="http:"&&i.protocol!=="https:")return;let c=decodeURIComponent(i.pathname.split("/").pop()??""),r=c.includes(".")?c.split(".").pop().toLowerCase():"";t.fileDownloads!==!1&&(u.hasAttribute("download")||s.includes(r))?e.client.capture("$file_download",{$url:Y(i),$file_name:c,$file_extension:r}):t.outboundLinks!==!1&&i.host!==location.host&&e.client.capture("$outbound_click",{$url:Y(i),$outbound_host:i.host})};document.addEventListener("click",o,!0),a.push(()=>document.removeEventListener("click",o,!0))}if(t.siteSearch!==!1){let o=typeof t.siteSearch=="object"&&t.siteSearch.params?t.siteSearch.params:V,l=!0;a.push(()=>{l=!1}),e.onCapture(u=>{if(!l||u.event!=="$pageview"||!n())return;let i=new URLSearchParams(location.search);for(let c of o){let r=i.get(c)?.trim();if(r)return void e.client.capture("$site_search",{$search_term:r.slice(0,200),$search_param:c})}})}return()=>a.forEach(o=>o())}function Me(e,t={}){e.capture("$page_not_found",{$status:404,...t})}var Te=[25,50,75],$e="data-lc-media-title";function T(e){let t=e.currentSrc||e.src;if(!t||t.startsWith("blob:")||t.startsWith("data:"))return"";try{let n=new URL(t,location.href);return`${n.origin}${n.pathname}`}catch{return""}}var Le=e=>(e.getAttribute($e)??e.getAttribute("title")??e.getAttribute("aria-label")??"").trim().slice(0,200);function Z(e,t,n){if(t.media===!1)return()=>{};let s=new WeakMap,a=i=>{let c={$media_type:i instanceof HTMLVideoElement?"video":"audio",$media_src:T(i)},r=Le(i);return r&&(c.$media_title=r),Number.isFinite(i.duration)&&(c.$media_duration=Math.round(i.duration)),c},o=i=>{let c=T(i);if(!c)return null;let r=s.get(i);return(!r||r.src!==c)&&s.set(i,r={src:c,played:!1,reached:new Set,done:!1}),r},l=i=>{let c=i.target;if(!(c instanceof HTMLMediaElement)||!n())return;let r=o(c);if(r)if(i.type==="play"){if(r.done&&Object.assign(r,{played:!1,reached:new Set,done:!1}),r.played)return;r.played=!0,e.client.capture("$media_play",a(c))}else if(i.type==="timeupdate"){if(!r.played||r.done||!Number.isFinite(c.duration)||c.duration<=0)return;let p=c.currentTime/c.duration*100;for(let d of Te)p>=d&&!r.reached.has(d)&&(r.reached.add(d),e.client.capture("$media_progress",{...a(c),$media_progress:d}))}else i.type==="ended"&&r.played&&!r.done&&(r.done=!0,e.client.capture("$media_complete",a(c)))},u=["play","timeupdate","ended"];return u.forEach(i=>document.addEventListener(i,l,!0)),()=>u.forEach(i=>document.removeEventListener(i,l,!0))}function J(e=()=>performance.now()){let t=()=>document.visibilityState!=="hidden",n=0,s=t()?e():null,a=()=>{t()?s===null&&(s=e()):(s!==null&&(n+=e()-s),s=null)};return document.addEventListener("visibilitychange",a),{read:()=>Math.round(n+(s===null?0:e()-s)),reset:()=>{n=0,s=t()?e():null},stop:()=>document.removeEventListener("visibilitychange",a)}}Q();var ee=255,Ie=new Set(["input","textarea","select","option"]),He="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",Pe=new Set(["value","password","autocomplete"]),je=/(?:\d[ -]?){9,}/,x=new WeakMap;function te(e){return Array.isArray(e)?e.filter(t=>{if(!t||typeof t!="object")return!1;let n=t;return typeof n.name=="string"&&n.name!==""&&!n.name.startsWith("$")&&typeof n.selector=="string"&&(n.source==="text"||n.source==="attribute"&&typeof n.attribute=="string")&&Array.isArray(n.events)}):[]}function Ne(e){if(!e||Ie.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(He)}catch{return!1}}function De(e,t){if(e.source==="attribute"){let s=(e.attribute??"").toLowerCase();if(!s||Pe.has(s)||s.startsWith("on"))return;let a=t.getAttribute(s);return a===null?void 0:a.slice(0,ee)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||je.test(n)))return n.slice(0,ee)}function L(e,t,n,s=location.href){let a={};for(let o of e){if(!o.events.includes(t)||o.url&&!$([o.url],s))continue;let l=null;try{l=o.scope==="target"?t==="click"&&n?n.closest(o.selector):null:document.querySelector(o.selector)}catch{continue}if(!Ne(l))continue;let u=De(o,l);u!==void 0&&(a[o.name]=u)}return a}function ne(e){let t=!0;return e.loadConfig().then(n=>{t&&x.set(e,te(n?.snapshot_properties))}),e.clickExtras.push((n,s)=>t?L(x.get(e)??[],"click",s):{}),()=>{t=!1,x.delete(e)}}function re(e){let t=x.get(e);return t?.length?L(t,"pageview"):{}}function oe(e){return!!x.get(e)?.some(t=>t.events.includes("pageview"))}function se(){let e=0,t=0,n=()=>{let s=document.documentElement,a=Math.max(s.scrollHeight,document.body?.scrollHeight??0),o=Math.min(a,(window.scrollY||window.pageYOffset||0)+window.innerHeight);o>e&&(e=o,t=a>0?Math.min(100,Math.round(o/a*100)):0)};return n(),window.addEventListener("scroll",n,{passive:!0}),{read:()=>({pct:t,px:e}),stop:()=>window.removeEventListener("scroll",n)}}function R(e,t,n={}){let s=n.views??!0,a=n.leave??!0,o=location.href,l=se(),u=J(),i,c=()=>{if(!a||i===o)return;i=o;let{pct:f,px:y}=l.read();e.client.capture("$pageleave",{$current_url:o,$scroll_depth:f,$scroll_depth_px:y,$engagement_time_ms:u.read()})},r=!1,p=f=>{if(!s)return;let{core:y}=e;if(!y.hasConsent("analytics")&&!y.anonymousOnReject&&!(y.consent.pending&&y.consent.queueBeforeConsent)){if(!r){r=!0;let _=()=>{r&&(r=!1,p())};e.whenConsented(_),y.onChange(ie=>{ie==="consent"&&y.anonymousOnReject&&_()})}return}e.client.capture("$pageview",{...re(e),...f===void 0?{}:{$referrer:f}})},d=()=>{if(location.href===o)return;let f=o;c(),l.stop(),o=location.href,l=se(),u.reset(),oe(e)?setTimeout(()=>p(f),0):p(f)};if(e.onUnload(c),p(),t!=="history"&&t!=="hash")return()=>(l.stop(),u.stop());let{pushState:m,replaceState:g}=history;return history.pushState=function(...f){m.apply(this,f),d()},history.replaceState=function(...f){g.apply(this,f),d()},window.addEventListener("popstate",d),t==="hash"&&window.addEventListener("hashchange",d),()=>{window.removeEventListener("hashchange",d),history.pushState=m,history.replaceState=g,window.removeEventListener("popstate",d),l.stop(),u.stop()}}var Et=e=>{let t=[],n=e.config.autocapture,s=!1;if(n!==!1){let l=typeof n=="object"?n:{},u=()=>!s&&!(l.urlIgnorelist?.length&&A(l.urlIgnorelist));t.push(F(e,l,u),G(e,l,u),z(e,l,u),I(e,l,u),O(e,l,u),Z(e,l,u),ne(e)),n===void 0&&e.loadConfig().then(i=>s=i?.autocapture===!1)}let a=e.config.capturePageview??"history",o=e.config.capturePageleave??"if_capture_pageview";return a!==!1&&o!==!1?t.push(R(e,a)):a!==!1?t.push(R(e,a,{leave:!1})):o===!0&&t.push(R(e,"history",{views:!1})),()=>t.forEach(l=>l())};export{B as DOWNLOAD_EXTENSIONS,P as MASKED,V as SEARCH_PARAMS,v as attrProps,Et as autocapture,b as buildChain,E as chainToString,U as cssSelector,j as isStepper,K as maskCopied,T as mediaSrc,L as readSnapshot,te as snapshotRules,Me as tag404};
@@ -0,0 +1 @@
1
+ import{b as A}from"./chunk-GVYMMTQM.js";import"./chunk-MI35SSIT.js";var C={title:"Your privacy",body:"We use cookies and similar technologies to measure and improve this site. Choose what you allow.",acceptAll:"Accept all",rejectAll:"Reject all",save:"Save choices",categories:{analytics:"Analytics",replay:"Session replay",marketing:"Marketing"}},j=["analytics","replay","marketing"],O="button, input, [href], [tabindex]:not([tabindex='-1'])",w={bottom:{left:"0",right:"0",bottom:"0"},top:{left:"0",right:"0",top:"0"},center:{top:"50%",left:"50%",transform:"translate(-50%,-50%)","max-width":"28rem"},"bottom-left":{left:"1rem",bottom:"1rem","max-width":"24rem"},"bottom-right":{right:"1rem",bottom:"1rem","max-width":"24rem"}},l=(e,t={},...s)=>{let c=Object.assign(document.createElement(e),t);return c.append(...s),c},h;function P(){h?.close()}function S(e){if(!e)return{};let t=(e.categories??[]).filter(a=>!a.required&&j.includes(a.id)),s=Object.fromEntries(t.map(a=>[a.id,a.label])),c={title:e.title,body:e.body,acceptAll:e.accept_label,rejectAll:e.decline_label,save:e.customize_label,categories:s},d=e.position?.replace("_","-");return{texts:Object.fromEntries(Object.entries(c).filter(([,a])=>a!==void 0)),...t.length?{categories:t.map(a=>a.id)}:{},...d&&d in w?{position:d}:{}}}async function H(e){try{let t=await e.fetch(`${e.config.apiHost}/v1/config?api_key=${encodeURIComponent(e.apiKey)}`,{credentials:"omit"});return t.ok?S((await t.json()).consent_banner):{}}catch{return{}}}async function _(e,t={}){if(!t.remote)return B(e,t);let s=await H(e);return B(e,{...s,...t,texts:{...s.texts,...t.texts,categories:{...s.texts?.categories,...t.texts?.categories}}})}function B(e,t){P();let s={...C,...t.texts,categories:{...C.categories,...t.texts?.categories}},c=t.categories??j,d=e.core.getConsent(),a=t.position??"bottom",m=`lc-consent-${Math.random().toString(36).slice(2,8)}`,L=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,M=document.activeElement,v=c.map(o=>{let i=l("input",{type:"checkbox",id:`${m}-${o}`,checked:d[o]});return{c:o,input:i,row:l("label",{htmlFor:i.id},i,document.createTextNode(` ${s.categories[o]}`))}}),p=(o,i)=>{let u=l("button",{type:"button",textContent:o});return u.style.cssText=`padding:.5rem 1rem;margin:.25rem .5rem .25rem 0;border:1px solid #1f2937;border-radius:.375rem;cursor:pointer;font:inherit;background:${i?"#1f2937":"#fff"};color:${i?"#fff":"#1f2937"}`,u},g=p(s.acceptAll,!0),k=p(s.rejectAll,!0),T=p(s.save,!1),n=l("div",{role:"dialog",id:m},l("h2",{id:`${m}-t`,textContent:s.title}),l("p",{id:`${m}-d`,textContent:s.body}),...c.length>1?v.map(o=>o.row):[],l("div",{},g,k,...c.length>1?[T]:[]));n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",`${m}-t`),n.setAttribute("aria-describedby",`${m}-d`),n.setAttribute("data-lc-ignore",""),n.style.cssText="position:fixed;z-index:2147483000;box-sizing:border-box;padding:1rem 1.25rem;background:#fff;color:#111827;font:14px/1.4 system-ui,sans-serif;box-shadow:0 0 .75rem rgba(0,0,0,.3);display:block";for(let[o,i]of Object.entries(w[a]))n.style.setProperty(o,i);for(let o of n.querySelectorAll("h2"))o.style.cssText="margin:0 0 .5rem;font-size:1.1rem";for(let o of n.querySelectorAll("label"))o.style.cssText="display:block;margin:.25rem 0";return L||(n.style.opacity="0",n.style.transition="opacity .2s",requestAnimationFrame(()=>n.style.opacity="1")),new Promise(o=>{let i=r=>{document.removeEventListener("keydown",E,!0),n.remove(),h=void 0,M?.focus?.(),r&&A(e,r,"banner",t.version?{version:t.version}:{}),o(r?e.core.getConsent():null)},u=r=>Object.fromEntries(c.map(f=>[f,r])),E=r=>{if(r.key==="Escape")return void i(null);if(r.key!=="Tab")return;let f=[...n.querySelectorAll(O)],y=f[0],b=f[f.length-1],x=document.activeElement;if(!n.contains(x))(r.shiftKey?b:y).focus();else if(r.shiftKey&&x===y)b.focus();else if(!r.shiftKey&&x===b)y.focus();else return;r.preventDefault()};g.onclick=()=>i(u(!0)),k.onclick=()=>i(u(!1)),T.onclick=()=>i(Object.fromEntries(v.map(r=>[r.c,r.input.checked]))),document.addEventListener("keydown",E,!0),document.body.append(n),h={root:n,close:()=>i(null)},g.focus()})}export{S as fromRemote,P as hideBanner,_ as showBanner};
@@ -0,0 +1 @@
1
+ function _(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function d(e,t){return!!e?.some(r=>{try{return new RegExp(_(r),"i").test(t)}catch{return!1}})}function R(e,t){return e===!1||!e&&!t?null:{fps:c(e?e.fps??2:2,1,15),quality:c(e?e.quality??.4:.4,.05,1)}}var c=(e,t,r)=>Math.min(r,Math.max(t,e)),x=1e7;function O(e,t){if(t?.session_recording===!1)return null;let r=t?.replay??{},o=(n,l)=>e[n]??r[n]??l,i=[...r.mask_selectors??[],...t?.replay_mask_selectors??[],...e.mask_selectors??[]];return{sample_rate:e.sample_rate??r.sample_rate??t?.replay_sample_rate??1,min_duration_ms:e.min_duration_ms??r.min_duration_ms??t?.replay_min_duration_ms??0,min_duration_mode:e.min_duration_mode??r.min_duration_mode??t?.replay_min_duration_mode??"buffer",trigger:o("trigger",{mode:"always"}),trigger_groups:e.trigger_groups??r.trigger_groups??t?.replay_trigger_groups??[],include_urls:o("include_urls",[]),exclude_urls:[...o("exclude_urls",[]),...(t?.replay_url_blocklist??[]).map(_)],block_selectors:[...r.block_selectors??[],...t?.replay_block_selectors??[],...e.block_selectors??[]],mask_selectors:i,mask_all_inputs:e.mask_all_inputs??(t?.mask_all_inputs===!0||r.mask_all_inputs!==!1),mask_all_text:e.mask_all_text===!0||t?.replay_mask_all_text===!0||r.mask_all_text===!0||i.includes("*"),unmask_selectors:[...e.unmask_selectors??[]],url_privacy_rules:[...Array.isArray(t?.replay_url_privacy_rules)?t?.replay_url_privacy_rules:[],...e.url_privacy_rules??[]],buffer_ms:o("buffer_ms",6e4),flush_interval_ms:o("flush_interval_ms",5e3),chunk_bytes:Math.min(o("chunk_bytes",256*1024),x-16384),canvas:R(e.captureCanvas,t?.replay_capture_canvas===!0),maskInputOptions:e.maskInputOptions,maskInputFn:e.maskInputFn,maskTextFn:e.maskTextFn,maskUrlFn:e.maskUrlFn,crossOriginIframes:e.crossOriginIframes?.allowedOrigins.length?[...e.crossOriginIframes.allowedOrigins]:null,canvasMaskRegions:e.canvasMaskRegions,canvasMask:(Array.isArray(t?.replay_canvas_mask)?t.replay_canvas_mask:[]).filter(n=>typeof n?.selector=="string"),mutationThrottle:e.mutationThrottle===!1?null:{...e.mutationThrottle},assets:e.assets}}var f=(e,t)=>e.some(r=>{try{return new RegExp(r).test(t)}catch{return!1}});function A(e,t,r){return!f(r,e)&&(!t.length||f(t,e))}function I(e){return e==="watchtower"?!1:e?!0:globalThis.__WATCHTOWER__?.replayActive!==!0}function T(e){let t=2166136261;for(let r of new TextEncoder().encode(e))t^=r,t=Math.imul(t,16777619)>>>0;return t>>>0}function C(e,t,r){return T(`${e}:${t}`)/4294967296<r}var w=(e,t)=>{let r=t[e.key];return e.variant===void 0?r!==void 0&&r!==!1&&r!=="false":r===e.variant},M=(e,t)=>e.flatMap(r=>{try{return[new RegExp(r)]}catch{return t("bad url pattern",r),[]}});function y(e){let t=[];return e.urls.length&&t.push(e.url),e.g.events?.length&&t.push(e.event),e.g.flag&&t.push(e.flag),t.length?e.g.match==="all"?t.every(Boolean):t.some(Boolean):!0}function F(e,t,r,o,i={}){let n=t.map(s=>({g:s,urls:M(s.url_patterns??[],e.log),url:!!i.url,event:!!i.event,flag:!!i.flag})),l=!1,m=!1,p=()=>{if(!(l||m)){for(let s of n)if(y(s)&&(i.sampling||C(r(),s.g.id,s.g.sample_rate??1))){l=!0,o(s.g);return}}};e.onCapture(s=>{let u=!1;for(let a of n)!a.event&&a.g.events?.includes(s.event)&&(u=a.event=!0);u&&p()});let v=s=>{let u=!1;for(let a of n)a.g.flag&&!a.flag&&w(a.g.flag,s)&&(u=a.flag=!0);u&&p()},b=e.flags?.onChange(v),g=(s,u)=>n.some(s)?n.some(a=>s(a)&&u(a))?"activated":"pending":"disabled";return{checkUrl(s){let u=!1;for(let a of n)!a.url&&a.urls.some(h=>h.test(s))&&(u=a.url=!0);u&&p()},check:p,stop(){m=!0,b?.()},matched:()=>n.filter(y).map(s=>s.g.id),states:()=>({url:g(s=>s.urls.length>0,s=>s.url),event:g(s=>!!s.g.events?.length,s=>s.event),flag:g(s=>!!s.g.flag,s=>s.flag)})}}var k=e=>Array.isArray(e)?e.filter(t=>typeof t=="string"&&t.trim()!==""):[];function U(e){return Array.isArray(e)?e.filter(t=>!!t&&typeof t=="object"&&typeof t.url=="string").map(t=>({url:t.url,mask_all_text:t.mask_all_text===!0,mask_selectors:k(t.mask_selectors),block_selectors:k(t.block_selectors)})):[]}function W(e,t){let r=e.filter(l=>d([l.url],t)),o=r.some(l=>l.mask_all_text===!0),i=[...new Set(r.flatMap(l=>l.mask_selectors??[]))],n=[...new Set(r.flatMap(l=>l.block_selectors??[]))];return{maskAllText:o,mask:i,block:n,key:JSON.stringify([o,i,n])}}export{d as a,x as b,O as c,A as d,I as e,T as f,C as g,F as h,U as i,W as j};
@@ -0,0 +1 @@
1
+ var e=!1;function t(){if(e)return null;e=!0;let r=!1;return()=>{r||(r=!0,e=!1)}}export{t as a};
@@ -0,0 +1 @@
1
+ import{a as i}from"./chunk-MI35SSIT.js";var r="$consent_updated";function l(e,s,a,n={}){let c=JSON.stringify(e.core.getConsent());e.client.setConsent(s);let t=e.core.getConsent();if(n.onlyIfChanged&&JSON.stringify(t)===c)return;let o={categories:t,source:a,version:n.version??e.config.consent?.policyVersion??"1"};if(e.core.hasConsent("analytics"))e.client.capture(r,o);else if(e.config.consent?.logBeacon&&!e.config.disabled){let p=JSON.stringify({api_key:e.apiKey,batch:[{uuid:i(Date.now()),event:r,timestamp:new Date().toISOString(),properties:{...o,$lib:"lucida-browser"}}],sent_at:new Date().toISOString()});e.fetch(`${e.config.apiHost}/v1/batch`,{method:"POST",body:p,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{})}}export{r as a,l as b};