From 1d163a7de2a5c3292ba1f51af152c68987e8bf5c Mon Sep 17 00:00:00 2001
From: Murraylr
Date: Fri, 5 Jun 2026 18:42:10 -0400
Subject: [PATCH 01/33] Init
---
sessionist-prd-v1_5.md | 783 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 783 insertions(+)
create mode 100644 sessionist-prd-v1_5.md
diff --git a/sessionist-prd-v1_5.md b/sessionist-prd-v1_5.md
new file mode 100644
index 0000000..3229b6a
--- /dev/null
+++ b/sessionist-prd-v1_5.md
@@ -0,0 +1,783 @@
+# Sessionist — Product Requirements Document
+### Session & Cookie Profile Manager for QA Engineers and Web Developers
+
+| | |
+|---|---|
+| **Status** | v1.5 — Playwright/IndexedDB nuance, Pro packaging, one-time launch seeding, source-available wording, and Team emphasis refined over v1.4 |
+| **Owner** | Murray le Roux (solo founder / builder) |
+| **Last updated** | 2026-06-05 |
+| **Name** | **Sessionist** (pending final trademark + Chrome Web Store search-collision check before public listing) |
+| **Distribution** | Chrome Web Store first (Chromium: Chrome, Edge, Brave, Arc), Firefox Add-ons fast-follow; organic search first — **no paid ads, outbound, or ongoing founder-led marketing** |
+| **One-line pitch** | Save, switch, and export browser session identities — the missing power-tool for testing as different users. |
+
+---
+
+## 1. Executive summary
+
+Sessionist is a Manifest V3 browser extension for developers and QA engineers who need to test web apps as different users without repeatedly logging in, deleting cookies, or rebuilding authentication state in test automation.
+
+The product lets users capture a browser session identity for the active site as a named **profile**, including cookies, `localStorage`, and `sessionStorage` where technically supported. Users can switch between profiles, restore profiles, snapshot the current state before changes, and export a saved profile into automation-ready formats — with **Playwright `storageState` export included in MVP** because it is the clearest professional value hook. MVP Playwright export is positioned honestly: it works for apps whose reusable auth state is represented by cookies and/or `localStorage`; IndexedDB-backed auth is gated by the pre-build spike.
+
+The market opening is not simply that one incumbent disappeared. The better read is: the Manifest V2 transition and the disruption around legacy cookie editors created search demand, user confusion, and trust gaps. Older cookie tools, clones, MV3 migrations, and tab-session managers exist, but there is still room for a trustworthy, developer/QA-native product that goes beyond raw cookie editing into **session identity management** and **test automation export**.
+
+**The strategic bet:** the cookie-editing job is a commodity users expect for free; it is the acquisition channel. Monetizable value lives one layer up, in session-profile scale, Playwright-centric workflows, local power tools, security conveniences, and eventually team sharing if demand is proven. Sessionist gives the commodity away to win ranking and reviews, then charges for workflows that save paid professionals real time.
+
+---
+
+## 2. Strategic context & the core bet
+
+### 2.1 Why this, why now
+
+- **The MV2 transition created disruption and search intent.** Manifest V2 was disabled for normal Chrome users by Chrome 138, with the enterprise policy removed in Chrome 139. This disrupted legacy extension categories and sent users looking for replacements.
+- **The EditThisCookie story is now a trust-and-continuity story, not a blank-space story.** The original legacy extension was disrupted by the MV2 transition, but newer V3 listings and lookalikes exist. Sessionist should not claim the field is empty. It should win by being the credible, transparent, developer-focused alternative.
+- **The successor field is still shallow on workflow quality.** Many tools solve raw cookie editing only. Few are designed around testing as named identities, exporting browser auth into Playwright, and sharing test-account state safely.
+- **The window is real but closing.** This is a 2026 opportunity, not an evergreen monopoly. Speed to a credible, trustworthy v1 matters more than feature completeness.
+
+### 2.2 The income logic
+
+Revenue = `installs × activation × paid conversion × price × retention`.
+
+Under the no-paid-ads / no-outbound / no-ongoing-marketing constraint, each term is constrained. The product deliberately optimizes the few levers still available.
+
+| Lever | Constraint | Design response |
+|---|---|---|
+| **Installs** | Organic search first; one-time launch seeding allowed | Free tier must fully win the cookie-editing job → strong reviews → Web Store ranking → compounding organic installs. Store listing targets orphan/replacement and dev workflow queries; a one-time GitHub/Show HN/dev.to launch artifact seeds initial awareness without becoming an ongoing marketing job. |
+| **Activation** | Users must reach value quickly | First-run guides the user to capture the current site as a profile and export to Playwright if relevant. |
+| **Conversion** | Extension free→paid is realistically low | Target professional developers and QA engineers with high time-value and expensable budgets. Free wall sits just past a casual user’s natural session count. |
+| **Price** | Little pricing power in commodity cookie editing | Charge for session-profile scale, project/environment organization, bulk tools, advanced exports, passphrase lock, larger local vault handling, and team workflows — never for core cookie editing. |
+| **Retention / LTV** | Solo founder cannot run heavy churn ops | Individual Pro is one-time to reduce churn ops. Recurring revenue is concentrated in Team seats, but only after product demand is proven. |
+
+**The near-term business is Pro for local developer/QA power users.** Team is the long-term upside, not the first business thesis. A small number of QA teams can outweigh thousands of one-time consumer purchases, but shared vaults only matter if Sessionist first earns organic installs, repeat professional usage, and Pro conversion.
+
+**Goal honesty (decide this, do not hedge it).** The revenue model in §11.3 caps the realistic outcome at roughly $30–60k/year even in the bull case, and the binding constraint producing that ceiling is distribution, not the product. Two coherent goals exist, and they imply different designs:
+
+- **(A) "Most income."** Then the strict no-marketing constraint must be relaxed to allow **one-time community seeding**: a public GitHub repo, a high-quality Show HN / dev.to launch post about "stop hand-coding login in your E2E tests," and perhaps one Product Hunt-style launch. This is not an ongoing content engine; it is a launch artifact that developers can circulate themselves.
+- **(B) "A trustworthy tool I'd use, small passive income, and a credibility/portfolio asset."** A perfectly good goal — but then optimize for build enjoyment, a clean source-available artifact, and low ongoing ops, and stop treating Team MRR as the point.
+
+Pick one explicitly before the build. The rest of this document assumes (A) with one-time launch seeding allowed, unless decided otherwise.
+
+---
+
+## 3. Problem statement
+
+Developers and QA engineers constantly need to act as **multiple identities** against the same application: admin vs. standard user, read-only vs. editor, customer A vs. customer B, or the same role across dev/staging/prod.
+
+Today they do this by:
+
+- Manually editing or deleting cookies and re-logging in.
+- Juggling incognito windows and separate Chrome profiles.
+- Rebuilding login flows in Playwright or other test tools when the browser already has a valid authenticated state.
+- Sharing test-account credentials over Slack, docs, or password managers and each re-logging in independently.
+- Losing a useful session while trying to switch accounts or clear state.
+
+Existing extensions usually address only one slice: raw cookie editing, tab/window restoration, or multi-account browsing. No strong, privacy-respecting, MV3-native product is clearly positioned around the developer/QA workflow of **capture → switch → snapshot → export → eventually share**.
+
+---
+
+## 4. Target users & personas
+
+**Primary — “QA Quinn” (QA / test automation engineer).** Maintains a stable of test accounts across roles and environments. Needs reliable profile switching, automation export, and eventually team sharing. Strong willingness to pay if the product saves repetitive login/setup time.
+
+**Primary — “Dev Dana” (full-stack / frontend developer).** Debugs auth, multi-tenant, and permission bugs. Needs to reproduce “what the user sees” quickly and turn the current browser auth state into a local repro or Playwright fixture. Most likely to buy Individual Pro.
+
+**Secondary — “Orphan Oscar” (former EditThisCookie / Cookie-Editor user).** Arrives via search looking for a cookie editor or replacement. May only ever use the free tier, but can drive reviews, ranking, and trust if the free experience is genuinely good.
+
+**Explicit non-target:** growth hackers, multi-accounting operators, ban-evasion users, scraping farms, ad-fraud users, and anti-detect browser buyers. Sessionist will not market or build fingerprint spoofing, proxy-per-profile, bot evasion, anti-detect, or marketplace-account abuse features.
+
+---
+
+## 5. Goals & non-goals
+
+### 5.1 Goals
+
+1. Win a meaningful slice of “cookie editor,” “EditThisCookie alternative,” and “export cookies to Playwright” search intent with a free tier good enough to earn a 4.6★+ rating.
+2. Convert professional users to paid via session-profile scale, automation export, bulk tools, passphrase lock, and eventually team sharing.
+3. Make Playwright auth reuse a first-class MVP workflow, not a later add-on.
+4. Be the most trustworthy tool in the category: local-first, ad-free, minimal permissions, clear privacy policy, no remote code, and optional zero-knowledge sync later.
+5. Treat Team as a later upside path, only after install, repeat usage, and Pro-conversion demand are validated.
+
+### 5.2 Non-goals
+
+- No anti-detect browser, fingerprint spoofing, proxy-per-profile, or ban-evasion positioning.
+- No mobile. Chrome on Android does not support normal extensions, so mobile is out of scope.
+- No general-purpose tab/session-window manager. Sessionist manages identities, not browsing workspaces.
+- No ongoing founder-run content marketing, paid ads, or outbound. One-time launch seeding is allowed: public repo, Show HN/dev.to-style launch post, Product Hunt-style launch, and narrowly relevant community announcement.
+- No claim that session switching can restore every possible browser/app state. MVP supports explicit stores only and must communicate limitations honestly.
+
+---
+
+## 6. Success metrics
+
+**North Star:** weekly session-profile switches per active user.
+
+This measures the core value moment: users trust Sessionist enough to swap identities repeatedly.
+
+### Supporting metrics & targets
+
+| Metric | 90-day target | 12-month target |
+|---|---:|---:|
+| Organic installs, cumulative | 5,000 | 50,000+ |
+| Activation: saved ≥1 profile in first session | ≥35% | ≥45% |
+| Playwright export usage among activated dev/QA users | ≥10% | ≥20% |
+| Web Store rating | ≥4.6★ | ≥4.6★ |
+| Free → Individual Pro conversion among activated users | ≥1% | 1.5–2% |
+| Team accounts with ≥2 seats | First 1–3 | 25–75 |
+| Median Team seats per account | — | 4–6 |
+| Monthly recurring revenue from Team | — | $1.5k–$6k |
+
+### Kill / pivot signals
+
+- If cumulative installs stall below ~1,000 at 90 days **with** a 4.5★+ rating and a correctly optimized listing, the search-demand assumption is likely wrong.
+- If activation is below 25%, onboarding or product clarity is failing.
+- If Playwright export usage is low among developer/QA users, the automation-export positioning may be weaker than assumed.
+- If Pro conversion is below 0.5% after activation and pricing/packaging tests, Team should not be built yet.
+
+### Pre-build validation gate
+
+Before committing to the full MVP, complete a lightweight validation pass:
+
+1. Chrome Web Store search audit for `cookie editor`, `EditThisCookie`, `session manager`, `profile switcher`, `export cookies`, and `Playwright cookies`.
+2. Trademark and Chrome Web Store search-collision check for “Sessionist.”
+3. Keyword-volume and intent check for replacement and automation-export queries.
+4. Current competitor feature matrix based on live listings, not historical assumptions.
+5. Optional landing page or GitHub repo page to test whether “cookie editor + Playwright storageState export” gets developer interest.
+
+---
+
+## 7. Competitive landscape & differentiation
+
+| Competitor | What it is | Weakness / opening |
+|---|---|---|
+| **EditThisCookie legacy + V3 successors/lookalikes** | Known cookie-editor brand disrupted by MV2 transition, with newer listings and lookalikes now present | Search and trust confusion remain. Sessionist should not claim no successor exists; it should win on transparency, MV3-native UX, and developer workflow. |
+| **Cookie-Editor (Moustachauve)** | Open-source, clean cookie editor | Strong free competitor for raw cookie editing. Sessionist must be a superset through profiles, snapshots, and Playwright export. |
+| **Ad-laden / clone cookie editors** | Various cookie tools with unclear trust posture | Ads, dark patterns, alarming permissions, and weak privacy posture create room for a trust-first alternative. |
+| **Session Buddy / Tab Session Manager** | Tab/window session savers | Save tabs/windows, not authenticated identities. Different job. |
+| **Session-profile switchers (e.g., SwitchSession, SessionHub)** | Extensions that save named session profiles (cookies + localStorage) and switch between them, often free-N-then-Pro, explicitly pitched at dev/QA | **This is the Pro tier, already shipping.** Profile switching is *not* a differentiator on its own; it is contested. The wedge must be Playwright export + trust + (later) team, not switching as such. |
+| **SessionBox / GoLogin / Sendwin / AdsPower** | Multi-account / container tools; most also ship one-click team session sharing without password sharing | **This is the Team feature, already shipping** — in an anti-detect/multi-accounting frame. The capability is not novel; the defensible angle is the developer/QA framing and trust posture, not the existence of shared sessions. Avoid anti-detect positioning. |
+| **Chrome profiles / incognito** | Native browser options | Useful but heavyweight; no named test identity profiles, automation export, bulk cookie edit, or team workflow. |
+| **Playwright built-in auth tooling** | Developer can manually save auth state from tests | Powerful but requires writing setup flows. Sessionist bridges the browser session a developer already has into Playwright faster. |
+
+**What the competitive read means.** The two layers Sessionist plans to *monetize* — profile switching (Pro) and team session sharing (Team) — already ship in the market. Switching as a capability is commoditized by tools like SwitchSession; team session sharing is commoditized (in an anti-detect frame) by GoLogin/SessionBox. The one job none of these tools serve is bridging a developer's live browser auth into their test suite. That is the uncontested ground, and it should be the sharp point of the spear.
+
+### Defensible wedge, in priority order
+
+1. **Playwright auth bridge.** One-click `storageState` export from the session you already have in the browser. Dev-native, high willingness-to-pay, owns search intent (`export cookies playwright`, `playwright storageState extension`) that the anti-detect/multi-account incumbents structurally ignore. **This is the differentiator; lead with it.**
+2. **Trust.** Local-first, ad-free, minimal permissions, no remote code, clear privacy posture, source-available core (see §12.4 — not OSI-permissive).
+3. **Transaction-like switching with safety snapshots.** Table stakes against SwitchSession et al.; win on reliability + recoverable snapshots + honest limitations, not on the existence of switching.
+4. **Developer/QA session identities, not just cookies.** Capture, label, restore explicit browser stores as named test identities, organized by project/environment.
+5. **Team-shared encrypted vaults.** Long-term paid moat *in the dev/QA framing specifically* — the capability exists elsewhere, so the moat is workflow fit + trust, not novelty. Only after demand is proven.
+
+---
+
+## 8. Product principles
+
+1. **The free editor is sacred.** Never degrade or paywall core cookie editing; it is the acquisition and review engine.
+2. **Local-first, prove it.** Default to zero network egress. Sync is opt-in and zero-knowledge when built.
+3. **Minimum viable permissions with explicit UX.** Every permission costs install conversion and review scrutiny. Request host access only when a user acts on a site, and explain why.
+4. **A value moment in under 30 seconds.** Install → grant access for current site → capture profile or import cookies → switch or export.
+5. **Safety before cleverness.** Snapshot before destructive changes. Make recovery obvious.
+6. **Do not overpromise session completeness.** Clearly distinguish supported stores from unsupported app/browser state.
+7. **Do not build the multi-accounting product.** Resist features that pull toward anti-detect, evasion, or abuse markets.
+
+---
+
+## 9. Functional requirements
+
+Priority definitions:
+
+- **P0** = MVP / launch-blocking.
+- **P1** = fast-follow, likely to drive paid conversion.
+- **P2** = team revenue engine.
+
+### 9.1 Cookie editor — free forever (P0)
+
+- View, search, filter, add, edit, and delete cookies for the active tab’s domain and related domains.
+- Edit supported fields: name, value, domain, path, expiry, `Secure`, `HttpOnly`, `SameSite`, and partition key where available through browser APIs.
+- Bulk select/delete and “delete all for this site.”
+- Protect/lock specific cookies from deletion inside Sessionist operations.
+- Import/export cookies as JSON compatible with common cookie-editor formats.
+- Netscape `cookies.txt` import/export is P1 unless needed for first-launch parity.
+- Side Panel UI for the main editor.
+- Compact popup is P1 unless it becomes necessary for review/usefulness.
+
+**Acceptance:** a user can replace a daily cookie-editing workflow with no paid prompt blocking core cookie editing; exported JSON round-trips without data loss for supported fields.
+
+### 9.2 Session profiles (P0 free-limited, P1 unlocked)
+
+- Capture current session state for the active site as a named **profile**.
+- MVP capture scope:
+ - Cookies for the active site / granted origin.
+ - `localStorage` for the active origin via injected script.
+ - `sessionStorage` for the active tab/origin via injected script, with clear limitations.
+- **IndexedDB capture — decision gated on the validation spike, not deferred by default.** Many modern SPAs store auth tokens in IndexedDB. If switching ignores it, the switch silently half-works and reviews suffer — the exact quality failure the SEO thesis cannot afford. The pre-build spike (§17) must check *where auth actually lives* in 3–5 representative target apps. If they rely on cookies/localStorage, IndexedDB stays P1. If any rely on IndexedDB, either pull IndexedDB capture into MVP for those cases, or narrow the launch positioning explicitly to cookie/localStorage-auth apps. Do not promise general switching and quietly omit the store that breaks it.
+- One-click **switch** should behave as a transaction-like operation, not a true atomic browser transaction:
+ 1. Confirm the target profile.
+ 2. Create a pre-switch snapshot of the currently supported state.
+ 3. Clear supported current state for the active site/origin.
+ 4. Apply the selected profile.
+ 5. Reload the active tab.
+ 6. Surface success/failure per store.
+- Restore a profile without clearing current state: additive apply.
+- Organize profiles by project, environment, tags, and domain/origin.
+- Free limit: up to **3 saved profiles** total — but note this directly tensions the North Star (weekly switches = habit). A QA engineer's natural set (admin/user/readonly × dev/staging/prod) exceeds 3 immediately, so the wall can land *before* the switching habit forms, reading as "crippled" rather than "worth paying for." Calibrate deliberately: prefer gating the upsell on a **usage milestone** (e.g., Nth successful switch, or attempting profile 4 *after* the habit is established) over a hard block at save #4, and treat the exact number as an A/B tunable once install volume allows. Switching itself among saved profiles is never throttled.
+- Pro: unlimited profiles subject to local storage/quota constraints.
+
+**Known limitations to communicate in product:**
+
+- Session switching cannot guarantee full application identity reset for state held in IndexedDB, Cache Storage, service workers, memory-only auth, browser profile data, third-party iframes, or multiple open tabs.
+- **Captured sessions are point-in-time.** For apps using short-lived access tokens with single-use refresh-token rotation, or device/IP-bound sessions, a captured profile may expire within minutes or fail to validate from another machine. Frame this honestly as "re-capture when expired" — which is the normal Playwright `storageState` workflow anyway (see §9.3), not a defect.
+- `sessionStorage` is tab-specific and may not behave like persistent auth state.
+- Multi-tab sessions can race against switch operations; MVP operates on the active tab and granted origin first.
+- Some auth flows may require page reload, hard refresh, or manual logout depending on the app.
+
+**Acceptance:** switching between two logged-in identities on a representative test app takes ≤2 clicks after setup, applies supported stores correctly, reloads the active tab, and always leaves a recoverable pre-switch snapshot.
+
+### 9.3 Playwright export — MVP (P0)
+
+- Export any saved profile as a Playwright `storageState` JSON file where supported profile data maps cleanly to Playwright’s model.
+- MVP export scope:
+ - Cookies.
+ - `localStorage` origins.
+ - IndexedDB only if the pre-build auth-storage survey pulls target-site IndexedDB capture into MVP.
+- Positioning must be precise: MVP export works for apps whose reusable auth state is represented by cookies and/or `localStorage`. It is not universal Playwright auth export unless IndexedDB capture is included.
+- Playwright’s own auth reuse model can cover cookies, local storage, and IndexedDB-based authentication when captured through Playwright APIs. Sessionist must not imply parity with Playwright’s full browser-context capture unless it captures the same stores.
+- Playwright does not normally persist browser `sessionStorage` as part of the standard `storageState` convenience flow. Sessionist may provide a separate helper snippet for `sessionStorage` as P1 if users need it.
+- Provide copy-to-clipboard and download-as-file.
+- Include basic redaction/preview warnings so users do not accidentally share secrets.
+
+**Acceptance:** a generated Playwright `storageState` file can be used by a Playwright test fixture to authenticate against the same app without manually re-running the login flow, assuming that app’s auth state is represented by supported exported stores.
+
+### 9.4 Additional automation export — Pro / fast-follow (P1)
+
+- Puppeteer: `page.setCookie(...)` or equivalent browser-context setup.
+- Selenium: `driver.add_cookie(...)` for Python and JS.
+- cURL: `-b "k=v; ..."` cookie header output.
+- Playwright code snippet in addition to raw `storageState` JSON.
+- Obfuscate/redact option for sharing snippets safely.
+
+**Acceptance:** exported snippets run with minimal editing for common test setups.
+
+### 9.5 Search-intent onboarding (P0)
+
+- Empty-state copy addresses replacement users without overclaiming: “Coming from EditThisCookie or another cookie editor? Import your cookies here.”
+- First-run offers import from common cookie-editor JSON formats.
+- First-run also offers “Export current login to Playwright” for developer/QA users.
+- No signup required.
+
+**Acceptance:** an exported JSON file from common predecessor tools imports cleanly, and a developer can reach either “edit cookies” or “export to Playwright” in under 30 seconds after granting site access.
+
+### 9.6 Permission UX (P0)
+
+- Do not request `` at install.
+- Install-time permissions should be limited to the minimum required extension APIs, such as `cookies`, `storage`, `sidePanel`, `scripting`, `activeTab`, and optional host permissions where appropriate.
+- When a user acts on a site, show an explicit permission step:
+ - “Allow Sessionist to manage cookies and supported session storage for `example.com`?”
+ - Explain that access is used only for that site unless they grant more.
+- Store granted origins and show them in a “Site access” settings screen.
+- Provide revoke/remove access affordances.
+- If a user declines permission, show a graceful explanation and keep the extension usable for already-granted sites/imported files.
+
+**Acceptance:** a first-time user understands why site access is needed before granting it, and can inspect/revoke granted origins later.
+
+### 9.7 Team sync & shared vaults (P2 — Team, revenue engine)
+
+- Account creation via Google OAuth and email magic link.
+- Zero-knowledge encrypted cloud sync of profiles across a user’s own devices.
+- Shared vaults where members publish/consume shared session profiles, encrypted under a team key.
+- Roles: owner, admin, member/read-use.
+- Per-vault access controls.
+- In-product invite flow: “Share this profile with your team → invite teammates by email.”
+- Seat-based billing.
+- Audit log for shared profile create/update/use events, without storing plaintext session contents.
+
+**Important security limitation:** zero-knowledge sync prevents Sessionist’s server/founder from reading session data. It does **not** prevent an authorized teammate from using, copying, or exporting a decrypted profile on their own device. Revocation prevents future access to newly rotated/shared material; it cannot claw back session data already decrypted, exported, or copied.
+
+**Acceptance:** server stores only ciphertext; a teammate can use a shared session profile after local decryption; revocation and key rotation prevent future decryption of newly shared or rotated material.
+
+### 9.8 Cross-cutting (P0 unless noted)
+
+- Light/dark theme is P1 unless launch UX requires it.
+- Local encryption at rest for profile blobs via WebCrypto AES-GCM.
+- Optional passphrase lock is P1.
+- Telemetry is opt-in, event-level only, and must never transmit cookie values, storage values, session contents, or profile blobs.
+- Error states must be explicit: show which store failed to capture/apply/export.
+
+---
+
+## 10. Key UX flows
+
+1. **Replacement import:** install → open side panel → “Import from cookie editor” → select JSON → cookies appear → edit as before. Value in under 30 seconds, no signup.
+2. **Site permission:** user clicks “Capture session” or “Edit this site” → Sessionist requests access for the current origin → user grants → operation continues.
+3. **Capture & switch:** on a logged-in app, save session as “admin” → log in as another user → save as “customer” → switch back to “admin” → Sessionist snapshots current state, applies supported stores, and reloads.
+4. **Export to Playwright:** select profile → “Export → Playwright storageState” → download `storageState.json` → use in test fixture.
+5. **Hit the wall:** attempt to save a 4th profile → inline upsell for unlimited profiles, advanced exports, passphrase lock, and bulk tools → one-time purchase → instant unlock.
+6. **Share to team:** after validation only → “Share profile” → invite teammates → teammates install → join vault → use shared identity.
+
+---
+
+## 11. Monetization & pricing
+
+### 11.1 Tiers
+
+| Tier | Price | Includes | Rationale |
+|---|---|---|---|
+| **Free** | $0 | Full cookie editor, JSON import/export, up to 3 session profiles, pre-switch snapshots, Playwright `storageState` export for saved profiles | Acquisition + trust + dev/QA activation. Playwright export in free/MVP helps prove the wedge and win reviews. |
+| **Pro** | **$29 one-time** (lifetime for this major version) | Unlimited profiles, project/environment profile sets, saved export presets, bulk export, Puppeteer/Selenium/cURL exports, redacted sharing snippets, passphrase lock, larger local vault handling, stronger project organization | One-time utility pricing improves conversion and avoids churn ops. Monetizes Dev Dana after the free Playwright wedge proves value. |
+| **Team** | **$7 / seat / month billed annually**; monthly $9/seat | Everything in Pro + encrypted cloud sync, shared vaults, roles, audit log, invite flow | Recurring revenue engine after demand is proven. Monetizes QA Quinn’s team. |
+
+### 11.2 Pricing notes
+
+- Core cookie editing remains free forever.
+- Playwright `storageState` export is included in MVP/free because it is the clearest differentiator and validation signal. Free export is limited by the free profile cap; Pro monetizes scale, organization, bulk export, saved presets, advanced framework exports, and security/power-user workflows.
+- Pro monetizes scale, convenience, advanced exports, local security, and power-user workflows.
+- Team monetizes collaboration and sync, not basic local utility.
+- Payment uses Stripe-hosted Checkout for Pro and Stripe Billing for Team.
+
+### 11.3 Directional revenue model
+
+Assumptions are ranges, not forecasts.
+
+| Scenario | 12-mo installs | Activation | Pro conversion | Pro one-time revenue, cumulative | Team accounts × seats | Team MRR |
+|---|---:|---:|---:|---:|---:|---:|
+| **Bear** | 8,000 | 30% | 0.7% | ~$490 | 1 × 3 | ~$60 |
+| **Base** | 50,000 | 40% | 1.5% | ~$8,700 | 20 × 4 | ~$560 |
+| **Bull** | 120,000 | 45% | 2% | ~$31,000 | 75 × 5 | ~$2,600 |
+
+The realistic path to meaningful income is maximizing activated organic installs first, converting a small percentage of professionals to Pro second, and building Team only if the product proves repeated professional use and collaboration demand. Team is upside, not the near-term dependency.
+
+---
+
+## 12. Go-to-market = the product
+
+Because there is no paid, outbound, or ongoing founder marketing, GTM is **store-listing SEO + product loops + one-time launch seeding**.
+
+### 12.1 Store positioning
+
+- **Store title:** “Sessionist — Cookie Editor, Session Manager & Playwright Export for Devs/QA.”
+- **Target queries:** `editthiscookie alternative`, `editthiscookie replacement manifest v3`, `cookie editor`, `cookie editor chrome`, `export cookies playwright`, `playwright storageState extension`, `save browser session extension`, `switch login session chrome`.
+- **Description:** front-load the trust story, cookie editor parity, and Playwright export.
+- **Screenshots:** show cookie editor, saved profiles, switch flow with pre-switch snapshot, and Playwright export.
+
+### 12.2 Review flywheel
+
+- Prompt for a review only after a success moment, such as:
+ - 5th successful profile switch.
+ - Successful Playwright export.
+ - Successful import and edit session.
+- Never prompt on install.
+- Never block functionality with review prompts.
+
+### 12.3 Product loops
+
+- **Import loop:** replacement users import from old cookie tools.
+- **Activation loop:** profile switching creates repeated usage.
+- **Developer loop:** Playwright export creates word-of-mouth among devs and QA engineers.
+- **Team loop:** shared vault invitations create seat expansion after P2, if collaboration demand is proven.
+
+### 12.4 Source-available core (not OSI-permissive)
+
+Publish the cookie editor and local session capture/switch client as **source-available** under a license that grants inspection but **denies competing redistribution** — e.g., Business Source License (BSL), Functional Source License (FSL), or PolyForm Noncommercial/Shield. Keep Pro entitlement, advanced paid logic, and the Team sync server closed-source.
+
+**Why not MIT/Apache:** the category has a demonstrated cloning-with-malware problem, and §16 lists clones as a real risk. A permissive license on your *acquisition engine* hands a clone farm the right to rebrand your code, bolt on ads, and compete for your exact search terms. Source-available preserves every benefit you actually want from openness while removing the one thing that helps a competitor.
+
+Rationale (all preserved under source-available):
+
+- Builds trust in a sensitive category — anyone can read the code and verify local-first claims.
+- Helps rank on Google for replacement queries (public repo, indexable).
+- Invites issues/scrutiny from technical users.
+- Differentiates from clone/adware competitors — *without arming them*.
+
+The earlier "MIT vs Apache-2.0" question is the wrong question; the real choice is **source-available vs OSI-permissive**, and the recommendation is source-available.
+
+---
+
+## 13. Technical architecture
+
+### 13.1 Extension client
+
+- Manifest V3.
+- TypeScript strict.
+- Framework: WXT, using Vite under the hood.
+- UI: React + Tailwind in Side Panel first.
+- Popup is P1 unless needed for Web Store UX.
+- State: Zustand or lightweight equivalent, hydrated from durable extension storage.
+- Messaging: type-safe service worker ↔ content script ↔ UI messaging via WXT messaging or `@webext-core/messaging`.
+
+### 13.2 Browser APIs
+
+Use:
+
+- `chrome.cookies`
+- `chrome.storage`
+- `chrome.tabs`
+- `chrome.scripting`
+- `chrome.sidePanel`
+- `chrome.runtime`
+- `chrome.permissions` / optional host permissions
+
+Avoid for MVP:
+
+- `chrome.declarativeNetRequest`, unless header manipulation becomes necessary.
+- Broad `` install-time host permissions.
+- Remote code.
+- Obfuscated code.
+
+### 13.3 MV3 service worker constraints
+
+- Treat the MV3 service worker as ephemeral.
+- Persist all durable state outside worker memory.
+- Make operations resumable or safely retryable where possible.
+- Never rely on long-lived in-memory state for profile switching or license state.
+
+### 13.4 Storage architecture
+
+MVP must not assume `chrome.storage.local` is enough for unlimited profiles.
+
+- Store small metadata in `chrome.storage.local`.
+- Store larger encrypted profile blobs in extension IndexedDB if profile size grows beyond safe `chrome.storage.local` usage.
+- Track serialized profile size.
+- Warn users before saving very large profiles.
+- Show quota/storage errors clearly.
+- Consider `unlimitedStorage` only when justified by real usage; if requested, explain the permission clearly.
+- IndexedDB capture from target websites is separate from using extension IndexedDB as Sessionist’s own local database. Target-site IndexedDB capture remains post-MVP.
+
+### 13.5 Local encryption
+
+- Profile blobs encrypted at rest with WebCrypto AES-GCM.
+- MVP can use a locally generated key protected by extension storage for basic at-rest protection.
+- P1 passphrase lock derives a key using PBKDF2 via native WebCrypto.
+- Argon2-wasm is optional later if stronger KDF requirements justify the dependency and review complexity.
+
+### 13.6 Session capture/switch implementation
+
+- Cookies captured through the cookies API for granted origins.
+- `localStorage` and `sessionStorage` captured via injected content script on the active tab/origin.
+- Switching uses a transaction-like sequence with pre-switch snapshot and per-store apply results.
+- Multi-tab/session-wide coordination is not MVP; warn if other same-origin tabs are open, or offer to reload them as P1.
+- **Multi-domain auth scope.** Real auth often spans several domains (`auth.example.com` + `app.example.com` + `api.example.com`) and partitioned cookies (CHIPS). Define and surface the exact origin/domain scope a profile covers; capturing only the active origin will leave SSO sessions half-applied. The `domainScope` field on `Profile` (§13.11) exists for this — make it real, not decorative.
+- **Correctness test matrix (build early, it is the quality bet).** E2E-validate capture→switch→restore against at least: (a) a single-origin cookie-session app, (b) a multi-domain SSO app, (c) a localStorage-token SPA, (d) a CHIPS/partitioned-cookie case, and (e) an IndexedDB-token app (to confirm the §9.2 limitation behaves as disclosed). Each must either switch cleanly or fail loudly with a recoverable snapshot — never half-switch silently.
+- Unsupported stores must be visible in UI as “not captured.”
+
+### 13.7 Playwright export implementation
+
+- Client-side JSON/code generation only.
+- MVP output: `storageState.json` with cookies and origins/localStorage.
+- Validate cookie fields against Playwright’s expected shape.
+- P1: helper snippets for sessionStorage if users need it, clearly separate from native Playwright `storageState`.
+- E2E tests should verify that generated state authenticates against a controlled demo app.
+
+### 13.8 Payments & licensing
+
+- Stripe-hosted Checkout for Pro.
+- A Cloudflare Worker creates Checkout sessions and receives `checkout.session.completed` webhooks.
+- Worker mints an Ed25519-signed license key.
+- Extension verifies the license locally using a public key baked into the build.
+- No license database required for MVP.
+- **Honest framing:** because the core client is source-available, the local license check is removable by a determined user, and one key can be shared. For a $29 one-time utility aimed at honest professionals, fighting this is negative ROI — Pro is effectively an honesty model, and that is an accepted trade, not a bug. The Ed25519 signature makes keys unforgeable; it does not make the client-side gate untamperable. Do not design anti-piracy machinery around it.
+- Team billing uses Stripe Billing via backend at P2.
+
+### 13.9 Backend — Team only
+
+Build only after validation gates are met.
+
+- ASP.NET Core on .NET 10 LTS.
+- Minimal APIs.
+- PostgreSQL via EF Core/Npgsql.
+- Redis optional.
+- Google OAuth + email magic link.
+- Short-lived JWT access + refresh.
+- Stripe Billing via `Stripe.net`.
+- Hosting: Fly.io for solo phase unless Azure becomes strategically necessary.
+
+### 13.10 Zero-knowledge sync design — P2
+
+- Client encrypts each profile/vault blob before upload.
+- Server stores ciphertext only.
+- Server never receives plaintext session data, master keys, or team keys.
+- Team key wrapped per member using public-key encryption.
+- Revocation requires key rotation for future shared material.
+- Audit logs track events and object IDs, not plaintext session contents.
+
+### 13.11 Data model
+
+```ts
+type Profile = {
+ id: string;
+ name: string;
+ projectId?: string;
+ environment?: 'dev' | 'staging' | 'prod' | 'other';
+ tags: string[];
+ origin: string;
+ domainScope: string[];
+ cookies: CookieRecord[];
+ localStorage: Record;
+ sessionStorage: Record;
+ unsupportedStores?: UnsupportedStoreNotice[];
+ sizeBytes: number;
+ createdAt: string;
+ updatedAt: string;
+};
+
+type Project = {
+ id: string;
+ name: string;
+};
+
+type Vault = {
+ id: string;
+ name: string;
+ ownerId: string;
+ members: Membership[];
+ encryptedKeyPerMember: Record;
+};
+
+type Membership = {
+ userId: string;
+ vaultId: string;
+ role: 'owner' | 'admin' | 'member';
+};
+
+type Entitlement = {
+ subjectId: string;
+ tier: 'free' | 'pro' | 'team';
+ seats?: number;
+ validUntil?: string;
+};
+```
+
+---
+
+## 14. Privacy, security & permissions
+
+This section is a competitive weapon, not boilerplate.
+
+### 14.1 Permission minimization
+
+- Do not request broad host access at install.
+- Use runtime host permission requests when the user acts on a site.
+- Explain permissions in plain English.
+- Show granted site access in settings.
+- Allow users to revoke site access.
+
+### 14.2 Web Store review posture
+
+- Accurate privacy policy before submission.
+- Disclose exactly what data is processed locally.
+- State that cookie/session data is never sold, brokered, or used for advertising.
+- State that cloud sync, when built, is opt-in and end-to-end encrypted.
+- No remote code.
+- No obfuscation.
+- No misleading permission claims.
+
+### 14.3 Sensitive data handling
+
+- No cookie values, localStorage values, sessionStorage values, or profile blobs in telemetry.
+- No automatic sync.
+- No account required for Free or Pro local usage.
+- Clipboard/export actions must warn users that exported files contain secrets.
+
+### 14.4 Abuse posture
+
+Sessionist will not add:
+
+- Fingerprint spoofing.
+- Proxy-per-profile.
+- Anti-detect profiles.
+- Marketplace/account ban evasion features.
+- Automation designed to bypass platform rules.
+
+---
+
+## 15. Telemetry & analytics
+
+Telemetry is opt-in only.
+
+Allowed events:
+
+- Install.
+- First profile saved.
+- Profile switch success/failure, without session contents.
+- Playwright export used, without exported values.
+- Paywall view.
+- Upgrade.
+- Review prompt shown.
+- Team invite sent/accepted after P2.
+
+Not allowed:
+
+- Cookie names or values.
+- Storage keys or values.
+- Domains unless explicitly normalized/anonymized and necessary.
+- Profile contents.
+- Test-account identifiers.
+- Raw URLs containing paths/query strings.
+
+Analytics options:
+
+- Self-hosted PostHog.
+- Plausible.
+- Minimal first-party event collector.
+
+Default for MVP: telemetry off until the user opts in.
+
+---
+
+## 16. Risks & mitigations
+
+| Risk | Severity | Mitigation |
+|---|---|---|
+| **Competitive field is not empty** | High | Reframe from “dead incumbent” to “trust disruption + workflow gap.” Validate live listings before build. |
+| **Organic demand is weaker than assumed** | High | Add pre-build keyword/store audit and 90-day kill signal. Do not build Team until demand is proven. |
+| **Session switching overpromises completeness** | High | Use “transaction-like,” not “atomic.” Communicate supported/unsupported stores clearly. Always snapshot before switch. |
+| **Storage quota breaks unlimited profiles** | High | Add profile-size tracking, extension IndexedDB storage, quota warnings, and an `unlimitedStorage` decision gate. |
+| **Web Store review delays over cookies/storage permissions** | High | Minimal permissions, runtime host requests, accurate privacy policy, no remote code, no anti-detect positioning. |
+| **Runtime permission prompts hurt activation** | Medium | Design permission UX as part of onboarding. Explain site-specific access clearly. |
+| **Playwright export fails for apps using unsupported state** | Medium | Clearly say MVP export covers cookies/localStorage. Add unsupported-state notices and P1 sessionStorage helper snippets. |
+| **Low free→paid conversion** | High | Keep Pro value tied to scale and power workflows. Use Playwright export as activation and proof, not the only paid feature. |
+| **Team E2EE over-scopes solo founder** | Medium | Build no backend until validation gates are passed. Document revocation limitations honestly. |
+| **Checkout trust gap suppresses payment** | Medium | Use Stripe-hosted Checkout and signed offline-verifiable license keys. |
+| **Copycat clones listing/name** | Medium | Verified publisher, **source-available (not permissive) core** so clones can't legally redistribute, privacy positioning, trademark/name clearance. |
+| **Priced layers already exist in market** | High | Profile switching (SwitchSession) and team session sharing (GoLogin/SessionBox) already ship. Lead with the uncontested Playwright auth-bridge wedge (§7); compete on reliability + trust + dev/QA workflow fit, not on the existence of switching or sharing. |
+| **Goal tension: “most income” vs. “no marketing”** | Structural | Accept a bounded ceiling. Concentrate upside in organic ranking, Pro conversion, and later product-led Team invites. |
+
+---
+
+## 17. Roadmap & MVP cut line
+
+### Pre-build validation — 2–5 days
+
+Complete before full implementation:
+
+- Chrome Web Store competitor/search audit.
+- Keyword intent check.
+- Trademark and search-collision check for “Sessionist.”
+- Confirm import formats from common cookie-editor tools.
+- **Auth-storage survey (feeds the §9.2 IndexedDB gate):** for 3–5 representative target apps, determine where auth actually lives — cookies, localStorage, IndexedDB, or memory/short-lived tokens. This decides whether IndexedDB capture must enter MVP or whether the launch positioning narrows to cookie/localStorage-auth apps.
+- Build a tiny demo/export proof if needed: browser cookies/localStorage → Playwright `storageState` → authenticated test.
+
+### MVP (P0) — target 6–10 focused weeks
+
+Ship to Chrome Web Store.
+
+Included:
+
+- Free cookie editor for active site/granted origins.
+- Side Panel UI.
+- JSON cookie import/export.
+- 3 saved session profiles.
+- Capture cookies + `localStorage` + active-tab `sessionStorage` with limitations shown.
+- Transaction-like profile switching.
+- Pre-switch snapshots and restore.
+- **Playwright `storageState` export.**
+- Permission UX and site-access settings.
+- Local storage/quota handling baseline.
+- Privacy policy.
+- Stripe-hosted checkout + signed license key if Pro unlock is included at launch.
+- Basic E2E validation against a controlled test app.
+
+Cut from MVP unless needed:
+
+- Popup.
+- Netscape `cookies.txt`.
+- Puppeteer/Selenium/cURL export.
+- IndexedDB capture.
+- Passphrase lock.
+- Command palette.
+- Team sync.
+- Multi-tab coordination.
+
+### Fast-follow (P1)
+
+- Unlimited profiles via Pro.
+- Puppeteer/Selenium/cURL export.
+- Playwright helper snippets.
+- Netscape `cookies.txt`.
+- Passphrase lock.
+- Project/environment grouping polish.
+- Bulk tools.
+- Popup.
+- Command palette.
+- Same-origin multi-tab warning/reload.
+- Review prompt after success.
+- Target-site IndexedDB capture, if the pre-build auth-storage survey does not pull it into MVP.
+
+### Revenue engine (P2)
+
+Build only after demand is proven.
+
+- Accounts.
+- Zero-knowledge sync.
+- Shared vaults.
+- Roles.
+- Audit log.
+- In-product invite loop.
+- Stripe seat billing.
+- .NET 10/Postgres backend.
+
+### Validation gate before P2
+
+Proceed to Team backend only if:
+
+- 90-day installs and activation are near target, or clearly trending there.
+- Profile switching is used repeatedly by activated users.
+- Pro conversion is at least directionally promising.
+- Multiple users request sync/team sharing unprompted, or support requests clearly show cross-device/team collaboration pain.
+
+If not, iterate listing, onboarding, export workflow, and Pro packaging before building backend ops.
+
+---
+
+## 18. Decisions log
+
+Locked as of 2026-06-05:
+
+1. **Name — Sessionist, pending clearance.** Brandable and on-theme, but final trademark and Web Store collision checks are required before public listing.
+2. **Core licensing — source-available core (revised in v1.4).** Cookie editor and local session capture/switch client published source-available (BSL/FSL/PolyForm) — inspectable but not redistributable for competition. Pro/Team entitlement logic and sync server stay closed-source. (Was "permissive"; changed because permissive arms the clone risk in §16.)
+3. **Checkout — Stripe.** Stripe-hosted Checkout + license-key unlock for Pro. Stripe Billing for Team seats at P2.
+4. **Pro pricing — $29 one-time.** Optional post-launch price tests only if install volume is high enough to learn anything.
+5. **Backend timing — no backend until P2.** MVP and P1 remain local/serverless except for the small Cloudflare Worker used for checkout/license minting.
+6. **Playwright export — moved into MVP.** Playwright `storageState` export is now a P0 differentiator and validation signal.
+7. **Session switching language — changed from atomic to transaction-like.** The product must communicate supported stores, limitations, and recovery path.
+8. **Permission UX — launch-blocking.** Runtime host permission flow and site-access management are part of MVP.
+9. **Storage quota strategy — launch-blocking.** Profile size tracking and storage architecture must be decided before promising unlimited local profiles.
+
+10. **Positioning lead — Playwright auth bridge.** The contested layers (switching, team sharing) ship elsewhere; lead public framing with the test-auth bridge.
+11. **IndexedDB capture — gated on the auth-storage survey.** Not auto-deferred; the spike decides MVP inclusion vs. narrowed positioning.
+12. **Free profile cap — calibrate for habit.** Prefer a usage-milestone upsell over a hard block at save #4; exact number is an A/B tunable.
+13. **One-time launch seeding — allowed in v1.5.** No ongoing founder-led marketing, paid ads, or outbound; a public repo and one launch artifact are allowed because the “most income” goal otherwise conflicts with distribution.
+14. **Pro packaging — clarified in v1.5.** Free gets the Playwright wedge for up to the free profile limit; Pro monetizes scale, organization, bulk/advanced exports, saved presets, passphrase lock, and larger vault handling.
+
+Still open:
+
+- Final trademark/search-collision clearance for “Sessionist.”
+- **Which source-available license** (BSL vs. FSL vs. PolyForm) for the core. (The earlier "MIT vs. Apache-2.0" question is retired — see decision #2.)
+- Whether Pro unlock ships on day one or shortly after MVP if the first submission should be kept simpler.
+- Whether `unlimitedStorage` is requested initially, later, or avoided through extension IndexedDB and quota management.
+- Whether target-site IndexedDB capture belongs in P1, P2, or never.
+
+---
+
+## 19. Appendix: wording rules for public claims
+
+Use:
+
+- “MV3-native.”
+- “Local-first.”
+- “For developers and QA engineers.”
+- “Export browser auth to Playwright.”
+- “Transaction-like switching with recoverable snapshots.”
+- “Supports cookies, localStorage, and active-tab sessionStorage in MVP.”
+- “Source-available core you can inspect.”
+- “Point-in-time capture — re-capture when the session expires” (for short-lived/SSO auth).
+
+Avoid:
+
+- “Atomic switching.”
+- “Full browser session” without qualification.
+- “Replaces every auth/session mechanism.”
+- “EditThisCookie is dead and there are no replacements.”
+- “Zero-knowledge means teammates cannot copy sessions.”
+- “Unlimited profiles” without storage/quota qualification.
+- “Free/open-source” phrasing that implies others may redistribute it (the core is source-available, not permissive).
+- “Share durable team sessions” for apps using short-lived/SSO auth — say “share and re-capture” instead.
+
From a7e9465335a9724e48e395c40f4ebae93c659a6f Mon Sep 17 00:00:00 2001
From: Murraylr
Date: Fri, 5 Jun 2026 20:49:28 -0400
Subject: [PATCH 02/33] Scaffold full Sessionist app skeleton
MV3 browser-extension skeleton from the PRD: every feature has a wired,
callable entry point. Service bodies are NotImplementedError stubs; types,
wiring, and the build are real.
- Extension (WXT + TS strict + React + Tailwind + Zustand): side panel UI,
ephemeral service worker with a typed handler-map router, services for
cookies, profiles, capture/switch/snapshot, Playwright + Puppeteer/Selenium/
cURL export, permissions, encryption, licensing, telemetry, team; 8 views.
- Cloudflare Worker: Stripe Checkout + Ed25519 license minting.
- .NET 10 backend: Team (P2) zero-knowledge sync API.
Reflects two specialised-review rounds:
- Minimal install permissions; no host_permissions (web storage injected via
chrome.scripting.executeScript, no content script); side-panel-first.
- Source-available LICENSE (FSL-1.1-Apache-2.0) per PRD decision #2.
- Redacting logger + sanitized errors; settings/onboarding/theme wired;
per-store switch results, snapshots, usage-milestone upsell; telemetry +
Pro gating call sites; reproducible npm ci (esbuild override).
- Tooling: ESLint + Prettier + .editorconfig + global.json + CI.
Co-Authored-By: Claude Opus 4.8 (1M context)
---
.editorconfig | 15 +
.env.example | 13 +
.github/workflows/ci.yml | 45 +
.gitignore | 26 +
.prettierignore | 7 +
.prettierrc.json | 6 +
LICENSE | 316 +-
README.md | 90 +-
backend/Sessionist.Api/Program.cs | 36 +
backend/Sessionist.Api/Sessionist.Api.csproj | 23 +
backend/Sessionist.Api/appsettings.json | 10 +
eslint.config.js | 53 +
global.json | 6 +
package-lock.json | 8674 +++++++++++++++++
package.json | 44 +
postcss.config.js | 6 +
src/background/router.ts | 100 +
src/entrypoints/background.ts | 62 +
src/entrypoints/popup/index.html | 12 +
src/entrypoints/popup/main.tsx | 14 +
src/entrypoints/sidepanel/index.html | 12 +
src/entrypoints/sidepanel/main.tsx | 13 +
src/lib/logger.ts | 52 +
src/lib/messaging.ts | 21 +
src/lib/result.ts | 34 +
src/services/capture/pageScript.ts | 37 +
src/services/capture/webStorageCapture.ts | 33 +
src/services/cookies/cookieImportExport.ts | 25 +
src/services/cookies/cookieService.ts | 31 +
src/services/cookies/netscapeFormat.ts | 15 +
src/services/crypto/encryption.ts | 43 +
src/services/crypto/keyManager.ts | 23 +
src/services/crypto/passphrase.ts | 24 +
src/services/export/curlExport.ts | 11 +
src/services/export/playwrightExport.ts | 44 +
src/services/export/puppeteerExport.ts | 11 +
src/services/export/redaction.ts | 22 +
src/services/export/seleniumExport.ts | 11 +
src/services/licensing/entitlementService.ts | 32 +
src/services/licensing/licenseVerifier.ts | 20 +
src/services/permissions/permissionService.ts | 28 +
src/services/profiles/captureService.ts | 37 +
src/services/profiles/profileService.ts | 33 +
src/services/profiles/snapshotService.ts | 27 +
src/services/profiles/switchEngine.ts | 41 +
src/services/storage/db.ts | 42 +
src/services/storage/profileRepository.ts | 43 +
src/services/storage/settingsRepository.ts | 41 +
src/services/team/authService.ts | 28 +
src/services/team/syncService.ts | 19 +
src/services/team/vaultService.ts | 29 +
src/services/telemetry/telemetry.ts | 48 +
src/state/store.ts | 70 +
src/types/messages.ts | 97 +
src/types/models.ts | 129 +
src/ui/App.tsx | 109 +
src/ui/components/ErrorBoundary.tsx | 33 +
src/ui/components/primitives.tsx | 57 +
src/ui/hooks/useActiveTab.ts | 63 +
src/ui/hooks/useBackground.ts | 43 +
src/ui/hooks/useTheme.ts | 28 +
src/ui/styles/globals.css | 24 +
src/ui/views/CookieEditorView.tsx | 251 +
src/ui/views/ExportView.tsx | 132 +
src/ui/views/OnboardingView.tsx | 47 +
src/ui/views/ProfilesView.tsx | 195 +
src/ui/views/SettingsView.tsx | 116 +
src/ui/views/SiteAccessView.tsx | 68 +
src/ui/views/TeamView.tsx | 27 +
src/ui/views/UpgradeView.tsx | 54 +
tailwind.config.js | 17 +
tsconfig.json | 15 +
worker/package-lock.json | 1606 +++
worker/package.json | 17 +
worker/src/index.ts | 70 +
worker/tsconfig.json | 14 +
worker/wrangler.toml | 16 +
wxt.config.ts | 46 +
78 files changed, 13630 insertions(+), 202 deletions(-)
create mode 100644 .editorconfig
create mode 100644 .env.example
create mode 100644 .github/workflows/ci.yml
create mode 100644 .gitignore
create mode 100644 .prettierignore
create mode 100644 .prettierrc.json
create mode 100644 backend/Sessionist.Api/Program.cs
create mode 100644 backend/Sessionist.Api/Sessionist.Api.csproj
create mode 100644 backend/Sessionist.Api/appsettings.json
create mode 100644 eslint.config.js
create mode 100644 global.json
create mode 100644 package-lock.json
create mode 100644 package.json
create mode 100644 postcss.config.js
create mode 100644 src/background/router.ts
create mode 100644 src/entrypoints/background.ts
create mode 100644 src/entrypoints/popup/index.html
create mode 100644 src/entrypoints/popup/main.tsx
create mode 100644 src/entrypoints/sidepanel/index.html
create mode 100644 src/entrypoints/sidepanel/main.tsx
create mode 100644 src/lib/logger.ts
create mode 100644 src/lib/messaging.ts
create mode 100644 src/lib/result.ts
create mode 100644 src/services/capture/pageScript.ts
create mode 100644 src/services/capture/webStorageCapture.ts
create mode 100644 src/services/cookies/cookieImportExport.ts
create mode 100644 src/services/cookies/cookieService.ts
create mode 100644 src/services/cookies/netscapeFormat.ts
create mode 100644 src/services/crypto/encryption.ts
create mode 100644 src/services/crypto/keyManager.ts
create mode 100644 src/services/crypto/passphrase.ts
create mode 100644 src/services/export/curlExport.ts
create mode 100644 src/services/export/playwrightExport.ts
create mode 100644 src/services/export/puppeteerExport.ts
create mode 100644 src/services/export/redaction.ts
create mode 100644 src/services/export/seleniumExport.ts
create mode 100644 src/services/licensing/entitlementService.ts
create mode 100644 src/services/licensing/licenseVerifier.ts
create mode 100644 src/services/permissions/permissionService.ts
create mode 100644 src/services/profiles/captureService.ts
create mode 100644 src/services/profiles/profileService.ts
create mode 100644 src/services/profiles/snapshotService.ts
create mode 100644 src/services/profiles/switchEngine.ts
create mode 100644 src/services/storage/db.ts
create mode 100644 src/services/storage/profileRepository.ts
create mode 100644 src/services/storage/settingsRepository.ts
create mode 100644 src/services/team/authService.ts
create mode 100644 src/services/team/syncService.ts
create mode 100644 src/services/team/vaultService.ts
create mode 100644 src/services/telemetry/telemetry.ts
create mode 100644 src/state/store.ts
create mode 100644 src/types/messages.ts
create mode 100644 src/types/models.ts
create mode 100644 src/ui/App.tsx
create mode 100644 src/ui/components/ErrorBoundary.tsx
create mode 100644 src/ui/components/primitives.tsx
create mode 100644 src/ui/hooks/useActiveTab.ts
create mode 100644 src/ui/hooks/useBackground.ts
create mode 100644 src/ui/hooks/useTheme.ts
create mode 100644 src/ui/styles/globals.css
create mode 100644 src/ui/views/CookieEditorView.tsx
create mode 100644 src/ui/views/ExportView.tsx
create mode 100644 src/ui/views/OnboardingView.tsx
create mode 100644 src/ui/views/ProfilesView.tsx
create mode 100644 src/ui/views/SettingsView.tsx
create mode 100644 src/ui/views/SiteAccessView.tsx
create mode 100644 src/ui/views/TeamView.tsx
create mode 100644 src/ui/views/UpgradeView.tsx
create mode 100644 tailwind.config.js
create mode 100644 tsconfig.json
create mode 100644 worker/package-lock.json
create mode 100644 worker/package.json
create mode 100644 worker/src/index.ts
create mode 100644 worker/tsconfig.json
create mode 100644 worker/wrangler.toml
create mode 100644 wxt.config.ts
diff --git a/.editorconfig b/.editorconfig
new file mode 100644
index 0000000..3b80d9a
--- /dev/null
+++ b/.editorconfig
@@ -0,0 +1,15 @@
+root = true
+
+[*]
+charset = utf-8
+end_of_line = lf
+insert_final_newline = true
+trim_trailing_whitespace = true
+indent_style = space
+indent_size = 2
+
+[*.{cs,csproj}]
+indent_size = 4
+
+[*.md]
+trim_trailing_whitespace = false
diff --git a/.env.example b/.env.example
new file mode 100644
index 0000000..8571c8b
--- /dev/null
+++ b/.env.example
@@ -0,0 +1,13 @@
+# Sessionist environment template. Copy to `.env` and fill in.
+# Never commit real values. See PRD §13.8 (Payments & licensing).
+
+# Public Ed25519 key (base64) baked into the extension build to verify license
+# keys offline. The matching private key lives only in the Cloudflare Worker.
+WXT_LICENSE_PUBLIC_KEY=
+
+# Base URL of the Cloudflare Worker that creates Stripe Checkout sessions and
+# mints signed license keys.
+WXT_CHECKOUT_WORKER_URL=https://checkout.sessionist.example
+
+# Optional telemetry collector endpoint (telemetry is opt-in, PRD §15).
+WXT_TELEMETRY_ENDPOINT=
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..6564401
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,45 @@
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+
+jobs:
+ extension:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ cache: npm
+ - run: npm ci
+ - run: npm run compile
+ - run: npm run lint
+ - run: npm run format
+ - run: npm run build
+
+ worker:
+ runs-on: ubuntu-latest
+ defaults:
+ run:
+ working-directory: worker
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ cache: npm
+ cache-dependency-path: worker/package-lock.json
+ - run: npm ci
+ - run: npm run compile
+
+ backend:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-dotnet@v4
+ with:
+ dotnet-version: '10.0.x'
+ - run: dotnet build backend/Sessionist.Api/Sessionist.Api.csproj
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f4a851d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,26 @@
+# Dependencies
+node_modules/
+
+# WXT build output
+.wxt/
+.output/
+stats.html
+
+# Env / secrets
+.env
+.env.*
+!.env.example
+
+# Editor / OS
+.vscode/
+.idea/
+.DS_Store
+Thumbs.db
+
+# .NET backend
+backend/**/bin/
+backend/**/obj/
+
+# Cloudflare worker
+worker/node_modules/
+worker/.wrangler/
diff --git a/.prettierignore b/.prettierignore
new file mode 100644
index 0000000..1636e8e
--- /dev/null
+++ b/.prettierignore
@@ -0,0 +1,7 @@
+node_modules/
+.wxt/
+.output/
+worker/node_modules/
+backend/**/bin/
+backend/**/obj/
+*.md
diff --git a/.prettierrc.json b/.prettierrc.json
new file mode 100644
index 0000000..e5ce635
--- /dev/null
+++ b/.prettierrc.json
@@ -0,0 +1,6 @@
+{
+ "singleQuote": true,
+ "trailingComma": "all",
+ "printWidth": 100,
+ "semi": true
+}
diff --git a/LICENSE b/LICENSE
index 261eeb9..ce78f1c 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,201 +1,115 @@
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+# Functional Source License, Version 1.1, Apache 2.0 Future License
+
+## Abbreviation
+
+FSL-1.1-Apache-2.0
+
+## Notice
+
+Copyright 2026 Murray le Roux (Sessionist)
+
+## Terms and Conditions
+
+### Licensor ("We")
+
+The party offering the Software under these Terms and Conditions.
+
+### The Software
+
+The "Software" is each version of the software that we make available under
+these Terms and Conditions, as indicated by our inclusion of these Terms and
+Conditions with the Software.
+
+### License Grant
+
+Subject to your compliance with this License Grant and the Patents,
+Redistribution and Trademark clauses below, we hereby grant you the right to use,
+copy, modify, create derivative works, publicly perform, publicly display and
+redistribute the Software for any Permitted Purpose identified below.
+
+### Permitted Purpose
+
+A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
+means making the Software available to others in a commercial product or service
+that:
+
+1. substitutes for the Software;
+
+2. substitutes for any other product or service we offer using the Software that
+ exists as of the date we make the Software available; or
+
+3. offers the same or substantially similar functionality as the Software.
+
+Permitted Purposes specifically include using the Software:
+
+1. for your internal use and access;
+
+2. for non-commercial education;
+
+3. for non-commercial research; and
+
+4. in connection with professional services that you provide to a licensee using
+ the Software in accordance with these Terms and Conditions.
+
+### Patents
+
+To the extent your use for a Permitted Purpose would necessarily infringe our
+patents, the license grant above includes a license under our patents. If you
+make a claim against any party that the Software infringes or contributes to the
+infringement of any patent, then your patent license to the Software ends
+immediately.
+
+### Redistribution
+
+The Terms and Conditions apply to all copies, modifications and derivatives of
+the Software.
+
+If you redistribute any copies, modifications or derivatives of the Software, you
+must include a copy of or a link to these Terms and Conditions and not remove any
+copyright notices provided in or with the Software.
+
+### Disclaimer
+
+THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, INCLUDING
+BUT NOT LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE, TITLE OR NON-INFRINGEMENT.
+
+IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
+SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN
+IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
+
+### Trademarks
+
+Except for displaying the License Details and identifying us as the origin of the
+Software, you have no right under these Terms and Conditions to use our
+trademarks, trade names, service marks or product names.
+
+## Grant of Future License
+
+We hereby irrevocably grant you an additional license to use the Software under
+the Apache License, Version 2.0 that is effective on the second anniversary of
+the date we make the Software available. On or after that date, you may use the
+Software under the Apache License, Version 2.0, in which case the following will
+apply:
+
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License.
+
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software distributed
+under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
+CONDITIONS OF ANY KIND, either express or implied.
+
+See the License for the specific language governing permissions and limitations
+under the License.
+
+---
+
+NOTE (Sessionist): The specific source-available license is still an open
+decision (PRD §18 — BSL vs FSL vs PolyForm). FSL-1.1-Apache-2.0 is used here as a
+sensible default that satisfies the locked decision #2 (source-available, NOT
+OSI-permissive). Only the cookie editor and local session capture/switch client
+are covered; Pro entitlement logic and the Team sync server remain closed-source.
diff --git a/README.md b/README.md
index c964cc1..b6689db 100644
--- a/README.md
+++ b/README.md
@@ -1 +1,89 @@
-# Sessionist
\ No newline at end of file
+# Sessionist
+
+> Save, switch, and export browser session identities — the missing power-tool for testing as different users.
+
+A Manifest V3 browser extension for developers and QA engineers. Cookie editor,
+session profiles, and Playwright `storageState` export. See
+[`sessionist-prd-v1_5.md`](sessionist-prd-v1_5.md) for the full product spec.
+
+> **Status: skeleton.** Every feature has a wired entry point and the project
+> builds, but service logic is stubbed (`NotImplementedError`). No behaviour yet.
+
+## Stack
+
+- **Extension:** [WXT](https://wxt.dev) (Vite), TypeScript strict, React + Tailwind, Zustand. MV3, Side Panel first.
+- **Checkout/licensing:** Cloudflare Worker (`worker/`) — Stripe Checkout + Ed25519 license minting, verified offline.
+- **Team backend (P2):** ASP.NET Core / .NET 10 Minimal API (`backend/`) — zero-knowledge sync, stubbed until validated.
+
+## Getting started
+
+```bash
+npm install # installs deps + runs `wxt prepare`
+npm run dev # Chrome dev build with HMR
+npm run dev:firefox
+npm run build # production build -> .output/
+npm run compile # typecheck only (tsc --noEmit)
+npm run lint # eslint
+npm run format # prettier --check (use format:write to fix)
+```
+
+CI (`.github/workflows/ci.yml`) runs compile + lint + format + build for the
+extension, typecheck for the worker, and `dotnet build` for the backend. Use
+`npm ci` (not `npm install`) for reproducible installs.
+
+Load the unpacked extension from `.output/chrome-mv3/` (or use `npm run dev`,
+which launches a browser with it installed).
+
+Copy `.env.example` to `.env` and fill in the license public key / worker URL.
+
+## Layout
+
+```
+src/
+ entrypoints/ WXT entry points
+ background.ts MV3 service worker — message router
+ sidepanel/ primary UI (React); opens on toolbar click
+ popup/ compact UI (P1)
+ types/ models (PRD §13.11) + message protocol + envelope
+ lib/ messaging, error markers, redacting logger
+ background/router.ts single dispatch point for all UI requests
+ services/ one folder per capability (see map below)
+ capture/pageScript.ts page-context web-storage fns injected via
+ chrome.scripting.executeScript (no content script)
+ state/store.ts Zustand UI store
+ ui/ App shell, hooks, views, components
+worker/ Cloudflare Worker (checkout + license minting)
+backend/ .NET 10 Team backend (P2)
+```
+
+Web storage (localStorage/sessionStorage) is read/written by injecting a
+function into the active, granted tab — there is **no persistent content script**
+and **no install-time host permission** (host access is requested per-origin at
+runtime). Verify: the built `manifest.json` has no `host_permissions`.
+
+## PRD feature → entry point map
+
+| PRD section | Feature | Entry point |
+|---|---|---|
+| §9.1 | Cookie editor (free) | [`services/cookies/`](src/services/cookies), [`CookieEditorView`](src/ui/views/CookieEditorView.tsx) |
+| §9.2 | Session profiles / switch | [`services/profiles/`](src/services/profiles), [`ProfilesView`](src/ui/views/ProfilesView.tsx) |
+| §9.3 | Playwright export (P0) | [`playwrightExport`](src/services/export/playwrightExport.ts), [`ExportView`](src/ui/views/ExportView.tsx) |
+| §9.4 | Puppeteer/Selenium/cURL (P1) | [`services/export/`](src/services/export) |
+| §9.5 | Search-intent onboarding | [`OnboardingView`](src/ui/views/OnboardingView.tsx) |
+| §9.6 | Permission UX | [`permissionService`](src/services/permissions/permissionService.ts), [`SiteAccessView`](src/ui/views/SiteAccessView.tsx) |
+| §9.7 | Team sync & vaults (P2) | [`services/team/`](src/services/team), [`TeamView`](src/ui/views/TeamView.tsx), [`backend/`](backend) |
+| §9.8 | Encryption / telemetry / theme | [`services/crypto/`](src/services/crypto), [`services/telemetry/`](src/services/telemetry), [`SettingsView`](src/ui/views/SettingsView.tsx) |
+| §11 | Tiers / paywall / Pro unlock | [`UpgradeView`](src/ui/views/UpgradeView.tsx), [`entitlementService`](src/services/licensing/entitlementService.ts) |
+| §13.4 | Storage architecture | [`services/storage/`](src/services/storage) |
+| §13.8 | Payments & licensing | [`services/licensing/`](src/services/licensing), [`worker/`](worker) |
+| §13.11 | Data model | [`types/models.ts`](src/types/models.ts) |
+
+## Conventions
+
+- Service functions are stubs that throw `NotImplementedError` — replace as features land. Types are real.
+- Never log or transmit cookie/storage/profile values (PRD §14.3 / §15).
+- Minimum install-time permissions; host access requested at runtime (PRD §9.6).
+- Core is **source-available, not OSI-permissive** (PRD §12.4): `LICENSE` is
+ FSL-1.1-Apache-2.0. The exact choice (BSL/FSL/PolyForm) is still open (§18).
+- `settingsRepository` is implemented (not a stub) because onboarding routing,
+ theming, and the telemetry opt-in depend on it to make the skeleton runnable.
diff --git a/backend/Sessionist.Api/Program.cs b/backend/Sessionist.Api/Program.cs
new file mode 100644
index 0000000..eefe687
--- /dev/null
+++ b/backend/Sessionist.Api/Program.cs
@@ -0,0 +1,36 @@
+// Sessionist Team backend (P2 — PRD §9.7 / §13.9 / §13.10).
+// Minimal API surface. Zero-knowledge: the server stores ciphertext only and
+// never receives plaintext session data, master keys, or team keys.
+// Every endpoint is a stub (501) until the Team phase begins.
+
+var builder = WebApplication.CreateBuilder(args);
+var app = builder.Build();
+
+app.MapGet("/health", () => Results.Ok(new { ok = true }));
+
+// --- Auth (Google OAuth + email magic link; short-lived JWT) ---------------
+app.MapPost("/auth/google", () => NotImplemented("auth/google"));
+app.MapPost("/auth/magic-link", () => NotImplemented("auth/magic-link"));
+app.MapPost("/auth/refresh", () => NotImplemented("auth/refresh"));
+
+// --- Zero-knowledge sync (ciphertext blobs only) ---------------------------
+app.MapGet("/sync/profiles", () => NotImplemented("sync/profiles:list"));
+app.MapPut("/sync/profiles", () => NotImplemented("sync/profiles:push"));
+
+// --- Shared vaults + roles -------------------------------------------------
+app.MapGet("/vaults", () => NotImplemented("vaults:list"));
+app.MapPost("/vaults", () => NotImplemented("vaults:create"));
+app.MapPost("/vaults/{id}/invite", (string id) => NotImplemented($"vaults/{id}/invite"));
+app.MapPost("/vaults/{id}/rotate-key", (string id) => NotImplemented($"vaults/{id}/rotate-key"));
+
+// --- Audit log (events + object IDs, never plaintext session contents) ------
+app.MapGet("/vaults/{id}/audit", (string id) => NotImplemented($"vaults/{id}/audit"));
+
+// --- Stripe Billing (seat-based) -------------------------------------------
+app.MapPost("/billing/checkout", () => NotImplemented("billing/checkout"));
+app.MapPost("/billing/webhook", () => NotImplemented("billing/webhook"));
+
+app.Run();
+
+static IResult NotImplemented(string endpoint) =>
+ Results.Json(new { error = "not_implemented", endpoint }, statusCode: 501);
diff --git a/backend/Sessionist.Api/Sessionist.Api.csproj b/backend/Sessionist.Api/Sessionist.Api.csproj
new file mode 100644
index 0000000..85b2783
--- /dev/null
+++ b/backend/Sessionist.Api/Sessionist.Api.csproj
@@ -0,0 +1,23 @@
+
+
+
+
+
+ net10.0
+ enable
+ enable
+
+
+
+
+
diff --git a/backend/Sessionist.Api/appsettings.json b/backend/Sessionist.Api/appsettings.json
new file mode 100644
index 0000000..8c042ac
--- /dev/null
+++ b/backend/Sessionist.Api/appsettings.json
@@ -0,0 +1,10 @@
+{
+ "Logging": {
+ "LogLevel": {
+ "Default": "Information",
+ "Microsoft.AspNetCore": "Warning"
+ }
+ },
+ "AllowedHosts": "*",
+ "_comment": "P2 only. ConnectionStrings, Stripe keys, and OAuth secrets are injected via environment/user-secrets, never committed (PRD §13.9)."
+}
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 0000000..0cf5769
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,53 @@
+import js from '@eslint/js';
+import tseslint from 'typescript-eslint';
+import reactHooks from 'eslint-plugin-react-hooks';
+import globals from 'globals';
+
+// Flat config. Pragmatic for a stub-heavy skeleton: type-aware linting is off
+// (kept fast), unused vars are allowed when prefixed with `_` (stub params),
+// and the valuable react-hooks rules are on.
+export default tseslint.config(
+ {
+ // backend is C# (linted via .editorconfig / dotnet). The worker IS linted —
+ // it's security-sensitive (Stripe + license minting) — but its deps/output
+ // are not.
+ ignores: [
+ '.wxt/**',
+ '.output/**',
+ 'node_modules/**',
+ 'worker/node_modules/**',
+ 'worker/.wrangler/**',
+ 'backend/**',
+ ],
+ },
+ js.configs.recommended,
+ ...tseslint.configs.recommended,
+ {
+ files: ['src/**/*.{ts,tsx}'],
+ plugins: { 'react-hooks': reactHooks },
+ languageOptions: {
+ globals: { ...globals.browser, chrome: 'readonly' },
+ },
+ rules: {
+ ...reactHooks.configs.recommended.rules,
+ '@typescript-eslint/no-unused-vars': [
+ 'warn',
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
+ ],
+ '@typescript-eslint/no-explicit-any': 'warn',
+ },
+ },
+ {
+ // Cloudflare Worker — service-worker globals, no React.
+ files: ['worker/**/*.ts'],
+ languageOptions: {
+ globals: { ...globals.serviceworker },
+ },
+ rules: {
+ '@typescript-eslint/no-unused-vars': [
+ 'warn',
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
+ ],
+ },
+ },
+);
diff --git a/global.json b/global.json
new file mode 100644
index 0000000..6b65fcd
--- /dev/null
+++ b/global.json
@@ -0,0 +1,6 @@
+{
+ "sdk": {
+ "version": "10.0.200",
+ "rollForward": "latestFeature"
+ }
+}
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..aa3b3ff
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,8674 @@
+{
+ "name": "sessionist",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "sessionist",
+ "version": "0.1.0",
+ "hasInstallScript": true,
+ "license": "SEE LICENSE IN LICENSE",
+ "dependencies": {
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "zustand": "^4.5.5"
+ },
+ "devDependencies": {
+ "@types/chrome": "^0.0.270",
+ "@types/react": "^18.3.12",
+ "@types/react-dom": "^18.3.1",
+ "@wxt-dev/module-react": "1.1.3",
+ "autoprefixer": "^10.4.20",
+ "eslint": "^9.15.0",
+ "eslint-plugin-react-hooks": "^5.0.0",
+ "globals": "^15.12.0",
+ "postcss": "^8.4.49",
+ "prettier": "^3.3.3",
+ "tailwindcss": "^3.4.15",
+ "typescript": "^5.6.3",
+ "typescript-eslint": "^8.15.0",
+ "wxt": "^0.19.13"
+ }
+ },
+ "node_modules/@1natsu/wait-element": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/@1natsu/wait-element/-/wait-element-4.2.0.tgz",
+ "integrity": "sha512-Om0Q+WE9mNrpY4AwMTvkFiYHv8VM7TML3PvOqXy+w6kAjLjKhGYHYX+305+a6J8RVpds9s7IF2Z5aOPYwULFNw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "defu": "^6.1.4",
+ "many-keys-map": "^3.0.0"
+ }
+ },
+ "node_modules/@aklinker1/rollup-plugin-visualizer": {
+ "version": "5.12.0",
+ "resolved": "https://registry.npmjs.org/@aklinker1/rollup-plugin-visualizer/-/rollup-plugin-visualizer-5.12.0.tgz",
+ "integrity": "sha512-X24LvEGw6UFmy0lpGJDmXsMyBD58XmX1bbwsaMLhNoM+UMQfQ3b2RtC+nz4b/NoRK5r6QJSKJHBNVeUdwqybaQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "open": "^8.4.0",
+ "picomatch": "^2.3.1",
+ "source-map": "^0.7.4",
+ "yargs": "^17.5.1"
+ },
+ "bin": {
+ "rollup-plugin-visualizer": "dist/bin/cli.js"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "peerDependencies": {
+ "rollup": "2.x || 3.x || 4.x"
+ },
+ "peerDependenciesMeta": {
+ "rollup": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@aklinker1/rollup-plugin-visualizer/node_modules/define-lazy-prop": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-2.0.0.tgz",
+ "integrity": "sha512-Ds09qNh8yw3khSjiJjiUInaGX9xlqZDY7JVryGxdxV7NPeuqQfplOpQ66yJFZut3jLa5zOwkXw1g9EI2uKh4Og==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@aklinker1/rollup-plugin-visualizer/node_modules/is-docker": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "is-docker": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@aklinker1/rollup-plugin-visualizer/node_modules/is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-docker": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@aklinker1/rollup-plugin-visualizer/node_modules/open": {
+ "version": "8.4.2",
+ "resolved": "https://registry.npmjs.org/open/-/open-8.4.2.tgz",
+ "integrity": "sha512-7x81NCL719oNbsq/3mh+hVrAWmFuEYUqrq/Iw3kUzH8ReypT9QQ0BLoJS7/G9k6N81XjW4qHWtjWwe/9eLy1EQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "define-lazy-prop": "^2.0.0",
+ "is-docker": "^2.1.1",
+ "is-wsl": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@alloc/quick-lru": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz",
+ "integrity": "sha512-UrcABB+4bUrFABwbluTIBErXwvbsU/V7TZWfmbgJfbkwiBuziS9gxdODUyuiecfdGQ85jglMW6juS3+z5TsKLw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@babel/code-frame": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
+ "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-validator-identifier": "^7.29.7",
+ "js-tokens": "^4.0.0",
+ "picocolors": "^1.1.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/compat-data": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz",
+ "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/core": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz",
+ "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/generator": "^7.29.7",
+ "@babel/helper-compilation-targets": "^7.29.7",
+ "@babel/helper-module-transforms": "^7.29.7",
+ "@babel/helpers": "^7.29.7",
+ "@babel/parser": "^7.29.7",
+ "@babel/template": "^7.29.7",
+ "@babel/traverse": "^7.29.7",
+ "@babel/types": "^7.29.7",
+ "@jridgewell/remapping": "^2.3.5",
+ "convert-source-map": "^2.0.0",
+ "debug": "^4.1.0",
+ "gensync": "^1.0.0-beta.2",
+ "json5": "^2.2.3",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/babel"
+ }
+ },
+ "node_modules/@babel/generator": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.7.tgz",
+ "integrity": "sha512-DkXD5OJQaAQIdZ1bt3UZdEnHAn9Imd3IVBdX03UFe+ony9Ojw5pzr9YVKGDY1jt+Gcn/FnGkNf8r+Vj5NOJWtQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.29.7",
+ "@babel/types": "^7.29.7",
+ "@jridgewell/gen-mapping": "^0.3.12",
+ "@jridgewell/trace-mapping": "^0.3.28",
+ "jsesc": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-compilation-targets": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz",
+ "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/compat-data": "^7.29.7",
+ "@babel/helper-validator-option": "^7.29.7",
+ "browserslist": "^4.24.0",
+ "lru-cache": "^5.1.1",
+ "semver": "^6.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-globals": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz",
+ "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-imports": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz",
+ "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/traverse": "^7.29.7",
+ "@babel/types": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-module-transforms": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz",
+ "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-module-imports": "^7.29.7",
+ "@babel/helper-validator-identifier": "^7.29.7",
+ "@babel/traverse": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0"
+ }
+ },
+ "node_modules/@babel/helper-plugin-utils": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz",
+ "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-string-parser": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.7.tgz",
+ "integrity": "sha512-Pb5ijPrZ89GDH8223L4UP8i6QApWxs04RbPQJTeWDV0/keR2E36MeKnyr6LYmUUvqRRI+Iv87SuF1W6ErINzYw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-identifier": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz",
+ "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helper-validator-option": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz",
+ "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/helpers": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.7.tgz",
+ "integrity": "sha512-1k2lAGRMfHTcwuNYcCNUmaUffmQv8KWMfh2iJUUeRlwlwH4FdNG7mfPI10NPfLHJFThE4Tyr4mv7kTNZOiPuBg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/template": "^7.29.7",
+ "@babel/types": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/parser": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.7.tgz",
+ "integrity": "sha512-hnORnjP/1P/zFEndoeX+n+t1RwWRJiJpM/jO7FW32Kn9r5+sJB2JWOdYo4L6k78j15eCwY3Gm/7364B1EMwtNg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.29.7"
+ },
+ "bin": {
+ "parser": "bin/babel-parser.js"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-react-jsx-self": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz",
+ "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/plugin-transform-react-jsx-source": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz",
+ "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-plugin-utils": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ },
+ "peerDependencies": {
+ "@babel/core": "^7.0.0-0"
+ }
+ },
+ "node_modules/@babel/runtime": {
+ "version": "7.28.2",
+ "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.28.2.tgz",
+ "integrity": "sha512-KHp2IflsnGywDjBWDkR9iEqiWSpc8GIi0lgTT3mOElT0PP1tG26P4tmFI2YvAdzgq9RGyoHZQEIEdZy6Ec5xCA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/template": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz",
+ "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/parser": "^7.29.7",
+ "@babel/types": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/traverse": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.7.tgz",
+ "integrity": "sha512-EhlfNQtZ+NK22w5BM61ciuiq1m58ed33Wr1Xan//ZRTy6hgjnwyCffRYwzsGXdASJSUJ1guZILsErh1eQcl+zw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.29.7",
+ "@babel/generator": "^7.29.7",
+ "@babel/helper-globals": "^7.29.7",
+ "@babel/parser": "^7.29.7",
+ "@babel/template": "^7.29.7",
+ "@babel/types": "^7.29.7",
+ "debug": "^4.3.1"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@babel/types": {
+ "version": "7.29.7",
+ "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.7.tgz",
+ "integrity": "sha512-4zBIxpPzowiZpusoFkyGVwakdRJUyuH5PxQ/PrqghfdFWWasvnCdPfQXHrenDai+gyLARulZjZowCOj6fjT4pA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/helper-string-parser": "^7.29.7",
+ "@babel/helper-validator-identifier": "^7.29.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/@devicefarmer/adbkit": {
+ "version": "3.3.8",
+ "resolved": "https://registry.npmjs.org/@devicefarmer/adbkit/-/adbkit-3.3.8.tgz",
+ "integrity": "sha512-7rBLLzWQnBwutH2WZ0EWUkQdihqrnLYCUMaB44hSol9e0/cdIhuNFcqZO0xNheAU6qqHVA8sMiLofkYTgb+lmw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@devicefarmer/adbkit-logcat": "^2.1.2",
+ "@devicefarmer/adbkit-monkey": "~1.2.1",
+ "bluebird": "~3.7",
+ "commander": "^9.1.0",
+ "debug": "~4.3.1",
+ "node-forge": "^1.3.1",
+ "split": "~1.0.1"
+ },
+ "bin": {
+ "adbkit": "bin/adbkit"
+ },
+ "engines": {
+ "node": ">= 0.10.4"
+ }
+ },
+ "node_modules/@devicefarmer/adbkit-logcat": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/@devicefarmer/adbkit-logcat/-/adbkit-logcat-2.1.3.tgz",
+ "integrity": "sha512-yeaGFjNBc/6+svbDeul1tNHtNChw6h8pSHAt5D+JsedUrMTN7tla7B15WLDyekxsuS2XlZHRxpuC6m92wiwCNw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/@devicefarmer/adbkit-monkey": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@devicefarmer/adbkit-monkey/-/adbkit-monkey-1.2.1.tgz",
+ "integrity": "sha512-ZzZY/b66W2Jd6NHbAhLyDWOEIBWC11VizGFk7Wx7M61JZRz7HR9Cq5P+65RKWUU7u6wgsE8Lmh9nE4Mz+U2eTg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">= 0.10.4"
+ }
+ },
+ "node_modules/@devicefarmer/adbkit/node_modules/commander": {
+ "version": "9.5.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-9.5.0.tgz",
+ "integrity": "sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || >=14"
+ }
+ },
+ "node_modules/@devicefarmer/adbkit/node_modules/debug": {
+ "version": "4.3.7",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.7.tgz",
+ "integrity": "sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@esbuild/aix-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz",
+ "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "aix"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz",
+ "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz",
+ "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz",
+ "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz",
+ "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz",
+ "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz",
+ "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz",
+ "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz",
+ "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz",
+ "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz",
+ "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz",
+ "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz",
+ "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz",
+ "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz",
+ "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz",
+ "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz",
+ "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz",
+ "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/openharmony-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz",
+ "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz",
+ "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz",
+ "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz",
+ "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz",
+ "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@eslint-community/eslint-utils": {
+ "version": "4.9.1",
+ "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.1.tgz",
+ "integrity": "sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eslint-visitor-keys": "^3.4.3"
+ },
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0"
+ }
+ },
+ "node_modules/@eslint-community/eslint-utils/node_modules/eslint-visitor-keys": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.4.3.tgz",
+ "integrity": "sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^12.22.0 || ^14.17.0 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@eslint-community/regexpp": {
+ "version": "4.12.2",
+ "resolved": "https://registry.npmjs.org/@eslint-community/regexpp/-/regexpp-4.12.2.tgz",
+ "integrity": "sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.0.0 || ^14.0.0 || >=16.0.0"
+ }
+ },
+ "node_modules/@eslint/config-array": {
+ "version": "0.21.2",
+ "resolved": "https://registry.npmjs.org/@eslint/config-array/-/config-array-0.21.2.tgz",
+ "integrity": "sha512-nJl2KGTlrf9GjLimgIru+V/mzgSK0ABCDQRvxw5BjURL7WfH5uoWmizbH7QB6MmnMBd8cIC9uceWnezL1VZWWw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/object-schema": "^2.1.7",
+ "debug": "^4.3.1",
+ "minimatch": "^3.1.5"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/config-helpers": {
+ "version": "0.4.2",
+ "resolved": "https://registry.npmjs.org/@eslint/config-helpers/-/config-helpers-0.4.2.tgz",
+ "integrity": "sha512-gBrxN88gOIf3R7ja5K9slwNayVcZgK6SOUORm2uBzTeIEfeVaIhOpCtTox3P6R7o2jLFwLFTLnC7kU/RGcYEgw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/core": "^0.17.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/core": {
+ "version": "0.17.0",
+ "resolved": "https://registry.npmjs.org/@eslint/core/-/core-0.17.0.tgz",
+ "integrity": "sha512-yL/sLrpmtDaFEiUj1osRP4TI2MDz1AddJL+jZ7KSqvBuliN4xqYY54IfdN8qD8Toa6g1iloph1fxQNkjOxrrpQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@types/json-schema": "^7.0.15"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/eslintrc": {
+ "version": "3.3.5",
+ "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-3.3.5.tgz",
+ "integrity": "sha512-4IlJx0X0qftVsN5E+/vGujTRIFtwuLbNsVUe7TO6zYPDR1O6nFwvwhIKEKSrl6dZchmYBITazxKoUYOjdtjlRg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ajv": "^6.14.0",
+ "debug": "^4.3.2",
+ "espree": "^10.0.1",
+ "globals": "^14.0.0",
+ "ignore": "^5.2.0",
+ "import-fresh": "^3.2.1",
+ "js-yaml": "^4.1.1",
+ "minimatch": "^3.1.5",
+ "strip-json-comments": "^3.1.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@eslint/eslintrc/node_modules/globals": {
+ "version": "14.0.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-14.0.0.tgz",
+ "integrity": "sha512-oahGvuMGQlPw/ivIYBjVSrWAfWLBeku5tpPE2fOPLi+WHffIWbuh2tCjhyQhTBPMf5E9jDEH4FOmTYgYwbKwtQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@eslint/js": {
+ "version": "9.39.4",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.4.tgz",
+ "integrity": "sha512-nE7DEIchvtiFTwBw4Lfbu59PG+kCofhjsKaCWzxTpt4lfRjRMqG6uMBzKXuEcyXhOHoUp9riAm7/aWYGhXZ9cw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ }
+ },
+ "node_modules/@eslint/object-schema": {
+ "version": "2.1.7",
+ "resolved": "https://registry.npmjs.org/@eslint/object-schema/-/object-schema-2.1.7.tgz",
+ "integrity": "sha512-VtAOaymWVfZcmZbp6E2mympDIHvyjXs/12LqWYjVw6qjrfF+VK+fyG33kChz3nnK+SU5/NeHOqrTEHS8sXO3OA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@eslint/plugin-kit": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/@eslint/plugin-kit/-/plugin-kit-0.4.1.tgz",
+ "integrity": "sha512-43/qtrDUokr7LJqoF2c3+RInu/t4zfrpYdoSDfYyhg52rwLV6TnOvdG4fXm7IkSB3wErkcmJS9iEhjVtOSEjjA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@eslint/core": "^0.17.0",
+ "levn": "^0.4.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ }
+ },
+ "node_modules/@humanfs/core": {
+ "version": "0.19.2",
+ "resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
+ "integrity": "sha512-UhXNm+CFMWcbChXywFwkmhqjs3PRCmcSa/hfBgLIb7oQ5HNb1wS0icWsGtSAUNgefHeI+eBrA8I1fxmbHsGdvA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@humanfs/types": "^0.15.0"
+ },
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanfs/node": {
+ "version": "0.16.8",
+ "resolved": "https://registry.npmjs.org/@humanfs/node/-/node-0.16.8.tgz",
+ "integrity": "sha512-gE1eQNZ3R++kTzFUpdGlpmy8kDZD/MLyHqDwqjkVQI0JMdI1D51sy1H958PNXYkM2rAac7e5/CnIKZrHtPh3BQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@humanfs/core": "^0.19.2",
+ "@humanfs/types": "^0.15.0",
+ "@humanwhocodes/retry": "^0.4.0"
+ },
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanfs/types": {
+ "version": "0.15.0",
+ "resolved": "https://registry.npmjs.org/@humanfs/types/-/types-0.15.0.tgz",
+ "integrity": "sha512-ZZ1w0aoQkwuUuC7Yf+7sdeaNfqQiiLcSRbfI08oAxqLtpXQr9AIVX7Ay7HLDuiLYAaFPu8oBYNq/QIi9URHJ3Q==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18.0"
+ }
+ },
+ "node_modules/@humanwhocodes/module-importer": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/module-importer/-/module-importer-1.0.1.tgz",
+ "integrity": "sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.22"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
+ "node_modules/@humanwhocodes/retry": {
+ "version": "0.4.3",
+ "resolved": "https://registry.npmjs.org/@humanwhocodes/retry/-/retry-0.4.3.tgz",
+ "integrity": "sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18.18"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/nzakas"
+ }
+ },
+ "node_modules/@jridgewell/gen-mapping": {
+ "version": "0.3.13",
+ "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
+ "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.0",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/remapping": {
+ "version": "2.3.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz",
+ "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.31",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz",
+ "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.1.0",
+ "@jridgewell/sourcemap-codec": "^1.4.14"
+ }
+ },
+ "node_modules/@nodelib/fs.scandir": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
+ "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@nodelib/fs.stat": "2.0.5",
+ "run-parallel": "^1.1.9"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.stat": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz",
+ "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@nodelib/fs.walk": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz",
+ "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@nodelib/fs.scandir": "2.1.5",
+ "fastq": "^1.6.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/@pnpm/config.env-replace": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz",
+ "integrity": "sha512-htyl8TWnKL7K/ESFa1oW2UB5lVDxuF5DpM7tBi6Hu2LNL3mWkIzNLG6N4zoCUP1lCKNxWy/3iu8mS8MvToGd6w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.22.0"
+ }
+ },
+ "node_modules/@pnpm/network.ca-file": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@pnpm/network.ca-file/-/network.ca-file-1.0.2.tgz",
+ "integrity": "sha512-YcPQ8a0jwYU9bTdJDpXjMi7Brhkr1mXsXrUJvjqM2mQDgkRiz8jFaQGOdaLxgjtUfQgZhKy/O3cG/YwmgKaxLA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "graceful-fs": "4.2.10"
+ },
+ "engines": {
+ "node": ">=12.22.0"
+ }
+ },
+ "node_modules/@pnpm/network.ca-file/node_modules/graceful-fs": {
+ "version": "4.2.10",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz",
+ "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/@pnpm/npm-conf": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/@pnpm/npm-conf/-/npm-conf-3.0.2.tgz",
+ "integrity": "sha512-h104Kh26rR8tm+a3Qkc5S4VLYint3FE48as7+/5oCEcKR2idC/pF1G6AhIXKI+eHPJa/3J9i5z0Al47IeGHPkA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@pnpm/config.env-replace": "^1.1.0",
+ "@pnpm/network.ca-file": "^1.0.1",
+ "config-chain": "^1.1.11"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@rolldown/pluginutils": {
+ "version": "1.0.0-beta.27",
+ "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz",
+ "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rollup/pluginutils": {
+ "version": "5.4.0",
+ "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.4.0.tgz",
+ "integrity": "sha512-MfPp06CjRLfXQ3wY0R8vJDYBy/MvVcc9OulEfR0B8Iv9ko+GCNaRZ+EpJYFl27LhKsZK0o420sYCRHCjfCgeUg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "^1.0.0",
+ "estree-walker": "^2.0.2",
+ "picomatch": "^4.0.2"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ },
+ "peerDependencies": {
+ "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0"
+ },
+ "peerDependenciesMeta": {
+ "rollup": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@rollup/pluginutils/node_modules/estree-walker": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
+ "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@rollup/pluginutils/node_modules/picomatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
+ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/@rollup/rollup-android-arm-eabi": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.61.1.tgz",
+ "integrity": "sha512-JnBB8MdXj45cajvTuO5FmPlvFVJRQgvrz1uSEl3NwqFnReAPGwb8EanbGi4z2nRaqLzjJSv5/JmycoTKlRZxHA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-android-arm64": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.61.1.tgz",
+ "integrity": "sha512-Jx2g7iSjw4AOT0HDPHM9RV3GNjRXwybWtSFZiZAYUTjUwjVrYIwq3kBf+LnhqJlzXFAqTAh2F7IGI+O568exPw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-arm64": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.61.1.tgz",
+ "integrity": "sha512-0F1L/Z3Eqv8mT2n3dCpeO8GcTvHvVqkP5/t6DMsn0KzhYVcg+s7Ncl5DS8qjKYEeio6Az0Gt6nyBORay5qIlCA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-darwin-x64": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.61.1.tgz",
+ "integrity": "sha512-qLttcH871ujY4YcVfUSShhOw+CsoTatYz8gRbHO7Bb92QH059/P0y5do1KMs41fY0BpD2x4AJH/gID0zFiqVKQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-arm64": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.61.1.tgz",
+ "integrity": "sha512-fUI4RapGE0Oh3mb8mgfvC1O2nU1RpDZUKnDQm3xB1Ipg7C2wTs5Kstz7G2uWK99a8S2yTMq8/P4uycwNa0nJyw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-freebsd-x64": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.61.1.tgz",
+ "integrity": "sha512-H5YrdvJaDtI/U9/emrD4b++xkvp3y/JvOe4rizHbxvkyMfRS/CiRYdji+Pl8D0brEaNFWUh1drQxgAGIl6Xudw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-gnueabihf": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.61.1.tgz",
+ "integrity": "sha512-Q8CBCCQtDFrYtXoeUXSrnFXKOnyUhx6bz+SkL6A0E7V8kAiCJ5pamq1WtbfpVGhR5TSpXY6ak3avmDc5fHTyJA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm-musleabihf": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.61.1.tgz",
+ "integrity": "sha512-nwnhk1581l0FBVellGcVCAT0Oi06onEA3WB53sf01VO3I0UPBkMH9sXONYME2K0ovXcNayJfNtHfm6mpJElatQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-gnu": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.61.1.tgz",
+ "integrity": "sha512-x5Xr49hwt3hdW75UOZm3395YwwzPyauktslv29KpWL/T+vVAzoT3azLcTWv0eMciBNrx+DYjH4paehHoLpPvpg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-arm64-musl": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.61.1.tgz",
+ "integrity": "sha512-unMS3H73DpaoPyyEVPjGKleM/s0mkmsauTENpw4INQY8y4+IuLNjkueQ5QCtC0D3N38Y38yhAU8OoZ20S2Tm6w==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-gnu": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.61.1.tgz",
+ "integrity": "sha512-zNZzGRnAhwjFEYmvphJRV5XaQGjs62cCmeYYHUT//NbvEnHauw+I85nGG+SiVg5ld4GX8D1IbKIX+ozITQnhMQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-loong64-musl": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.61.1.tgz",
+ "integrity": "sha512-LdpWGL8X209B2SIvWjqlc8VZgM6PKfontSerGepuldQmHYrAOtnMCXeJkxXGbC+PPZVOuu5czJo7fNV6aeW8rQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-gnu": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.61.1.tgz",
+ "integrity": "sha512-EC5kTtNaNGOmbMGqar8dvJy6y/hg99GAwjfBz++pxZhQATXGcRjd6c5en5wcbru0vkRmiMGsQKdMJOOf6sza4g==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-ppc64-musl": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.61.1.tgz",
+ "integrity": "sha512-8hiwp6D4acEcNK78I4rP0/XtS1sknWIAMJBPdR4l6zUtyTm5KiTDr5bXmWt4foY7nAN7AThDHgkLIEZOWKbzWw==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-gnu": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.61.1.tgz",
+ "integrity": "sha512-10dh/h/BqA7DuMPWSxkR8uks18FRwnwOEqr5zOTEl+NOwP/OMzKX8OFR/Of9xxDA7D5qef1Nzar5WDD2kCCr1g==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-riscv64-musl": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.61.1.tgz",
+ "integrity": "sha512-YKJ5lg35DP17gcAOggnihe+APw9HLyj1Xn7gsmGumBJAUDa6NGXNixJzmkWLhcK9TOuuyQjdamzvJefkO7qHZQ==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-s390x-gnu": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.61.1.tgz",
+ "integrity": "sha512-Mlil5G2Jj6a7B3LWGctg+XPL9vdXYuzCtNXfxOQ0nPjc2m6ueUktocPGH9bnAM0bNRKb/bAWTujUU7IJQdQA+g==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-gnu": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.61.1.tgz",
+ "integrity": "sha512-bVWIOIk6pV01p4CdUbPP7CJ/434z+OooYjDuFcR+44N35YvKUC66G8MGnvcWx5mWKW3g61J+t74l3Kj15Kwn2Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-linux-x64-musl": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.61.1.tgz",
+ "integrity": "sha512-qy5pBvZbqNFheBz61R1rzsezjm0J7O2oNGoWtGoY89SZYLUfxAJTBAqDChqAIdB4rCiIbi9nF7yZ83GnNiLwSw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ]
+ },
+ "node_modules/@rollup/rollup-openbsd-x64": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.61.1.tgz",
+ "integrity": "sha512-E83TXjI4zm0+5f2qO+UOudaCYIhYwpJ5jq6YCZNIZ+6CbfhKrkAGezeiASBL9ElxAxFsRS9ZhESv8mfnj6TKeg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ]
+ },
+ "node_modules/@rollup/rollup-openharmony-arm64": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.61.1.tgz",
+ "integrity": "sha512-fbWnKqVkjrJN38vNe3ahkbk6iejS/3b0Nt7EEtPpE6RBacZcGXNKbzfHN3GUUlXOPghUg0j6XUGrtjX9z1sIvA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openharmony"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-arm64-msvc": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.61.1.tgz",
+ "integrity": "sha512-ArMl38iVAbk0New1ogihQNY6iphLi4ZaRsa037gUzv5yeKPY8TD3Dmy4x2RNC1VztU/uqm+G+/RwFrSka3Oy2g==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-ia32-msvc": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.61.1.tgz",
+ "integrity": "sha512-0mYtjHS9ucAbcATycCNK9IGBk/cCe/ma7EmSLGZdsxnOA8cjRIyU04wDpVAD9NiOfLUR9KTxdiO53uOkherqjQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-gnu": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.61.1.tgz",
+ "integrity": "sha512-gK1iCEPfpoSG9wfBihXxvBMi8ZfcWffYkEsC/Eih+iFENTaewvNcrEQ69lIOWYO5pePHKLHHO7nq5AILGO/HQQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@rollup/rollup-win32-x64-msvc": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.61.1.tgz",
+ "integrity": "sha512-X+zaP2x+j4RXGfbp/seSoRHWnPxzApilDszisZxbYH5C/jTxFhCtDNdPGZb9lJyYPs24wGxruPF7Y+sIXt9Gzw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ]
+ },
+ "node_modules/@types/babel__core": {
+ "version": "7.20.5",
+ "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
+ "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.20.7",
+ "@babel/types": "^7.20.7",
+ "@types/babel__generator": "*",
+ "@types/babel__template": "*",
+ "@types/babel__traverse": "*"
+ }
+ },
+ "node_modules/@types/babel__generator": {
+ "version": "7.27.0",
+ "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz",
+ "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__template": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz",
+ "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.1.0",
+ "@babel/types": "^7.0.0"
+ }
+ },
+ "node_modules/@types/babel__traverse": {
+ "version": "7.28.0",
+ "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz",
+ "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/types": "^7.28.2"
+ }
+ },
+ "node_modules/@types/chrome": {
+ "version": "0.0.270",
+ "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.270.tgz",
+ "integrity": "sha512-ADvkowV7YnJfycZZxL2brluZ6STGW+9oKG37B422UePf2PCXuFA/XdERI0T18wtuWPx0tmFeZqq6MOXVk1IC+Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/filesystem": "*",
+ "@types/har-format": "*"
+ }
+ },
+ "node_modules/@types/estree": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz",
+ "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/filesystem": {
+ "version": "0.0.36",
+ "resolved": "https://registry.npmjs.org/@types/filesystem/-/filesystem-0.0.36.tgz",
+ "integrity": "sha512-vPDXOZuannb9FZdxgHnqSwAG/jvdGM8Wq+6N4D/d80z+D4HWH+bItqsZaVRQykAn6WEVeEkLm2oQigyHtgb0RA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/filewriter": "*"
+ }
+ },
+ "node_modules/@types/filewriter": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/@types/filewriter/-/filewriter-0.0.33.tgz",
+ "integrity": "sha512-xFU8ZXTw4gd358lb2jw25nxY9QAgqn2+bKKjKOYfNCzN4DKCFetK7sPtrlpg66Ywe3vWY9FNxprZawAh9wfJ3g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/har-format": {
+ "version": "1.2.16",
+ "resolved": "https://registry.npmjs.org/@types/har-format/-/har-format-1.2.16.tgz",
+ "integrity": "sha512-fluxdy7ryD3MV6h8pTfTYpy/xQzCFC7m89nOH9y94cNqJ1mDIDPut7MnRHI3F6qRmh/cT2fUjG1MLdCNb4hE9A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/json-schema": {
+ "version": "7.0.15",
+ "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
+ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/minimatch": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/@types/minimatch/-/minimatch-3.0.5.tgz",
+ "integrity": "sha512-Klz949h02Gz2uZCMGwDUSDS1YBlTdDDgbWHi+81l29tQALUtvz4rAYi5uoVhE5Lagoq6DeqAUlbrHvW/mXDgdQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/node": {
+ "version": "25.9.2",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-25.9.2.tgz",
+ "integrity": "sha512-G05zqtJhcDLb8uslf5EjCxXg9G1KQxiV8OS0R26IC//Eoyitzqe8z37I7cqvnZlrlSfgocQRfSn/AHBZJJFyGw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": ">=7.24.0 <7.24.7"
+ }
+ },
+ "node_modules/@types/prop-types": {
+ "version": "15.7.15",
+ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
+ "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/@types/react": {
+ "version": "18.3.31",
+ "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz",
+ "integrity": "sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==",
+ "devOptional": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/prop-types": "*",
+ "csstype": "^3.2.2"
+ }
+ },
+ "node_modules/@types/react-dom": {
+ "version": "18.3.7",
+ "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz",
+ "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "@types/react": "^18.0.0"
+ }
+ },
+ "node_modules/@types/webextension-polyfill": {
+ "version": "0.12.5",
+ "resolved": "https://registry.npmjs.org/@types/webextension-polyfill/-/webextension-polyfill-0.12.5.tgz",
+ "integrity": "sha512-uKSAv6LgcVdINmxXMKBuVIcg/2m5JZugoZO8x20g7j2bXJkPIl/lVGQcDlbV+aXAiTyXT2RA5U5mI4IGCDMQeg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@typescript-eslint/eslint-plugin": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.60.1.tgz",
+ "integrity": "sha512-JQ4S5GB0tfjO8BuJ4fcX+HodkzJjYBV+7OJ+wLygaX7OGQ7FudyHL4NSCA6ob+w3Yn+5MkKIozOwQhXeM7opVg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/regexpp": "^4.12.2",
+ "@typescript-eslint/scope-manager": "8.60.1",
+ "@typescript-eslint/type-utils": "8.60.1",
+ "@typescript-eslint/utils": "8.60.1",
+ "@typescript-eslint/visitor-keys": "8.60.1",
+ "ignore": "^7.0.5",
+ "natural-compare": "^1.4.0",
+ "ts-api-utils": "^2.5.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "@typescript-eslint/parser": "^8.60.1",
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
+ "typescript": ">=4.8.4 <6.1.0"
+ }
+ },
+ "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": {
+ "version": "7.0.5",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz",
+ "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/@typescript-eslint/parser": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.60.1.tgz",
+ "integrity": "sha512-A0M6ua6H252bVjPvvtSgl2QA4+ET9S5Mtkb2GDyTxIhH/C4qDItT7RQNO5PhMC6NXGYXOR9dIalcDDgBKT7oFA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/scope-manager": "8.60.1",
+ "@typescript-eslint/types": "8.60.1",
+ "@typescript-eslint/typescript-estree": "8.60.1",
+ "@typescript-eslint/visitor-keys": "8.60.1",
+ "debug": "^4.4.3"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
+ "typescript": ">=4.8.4 <6.1.0"
+ }
+ },
+ "node_modules/@typescript-eslint/project-service": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.60.1.tgz",
+ "integrity": "sha512-eXkTH2bxmXlqD1RnOPmLZ9ZM9D3VwSx04JOwBnP9RQ+yUA5a2Mu7SfW8uaV2Aon53NJzZlZYuX7tn91Izf+xaw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/tsconfig-utils": "^8.60.1",
+ "@typescript-eslint/types": "^8.60.1",
+ "debug": "^4.4.3"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4 <6.1.0"
+ }
+ },
+ "node_modules/@typescript-eslint/scope-manager": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.60.1.tgz",
+ "integrity": "sha512-gvI5OQoptnxQnchOirukCuQ55svJSTuD/4k5+pC267xyBtYry748R9/c3tYUzb/iE6RZfllRz2lVulLCHkTm4w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "8.60.1",
+ "@typescript-eslint/visitor-keys": "8.60.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/tsconfig-utils": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.60.1.tgz",
+ "integrity": "sha512-nh8w4qAteiKuZu3pSSzG/yGKpw0OlkrKnzFmbVRenKaD4qc+7i1GrmZaLVkr8rk4uipiPGMOW4YsM6WmKZ5CvA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4 <6.1.0"
+ }
+ },
+ "node_modules/@typescript-eslint/type-utils": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.60.1.tgz",
+ "integrity": "sha512-sdwTrpjosW7ANQYJ39ZBF1ZyEMEGVB2UsikrserVM/30a/F1dTLnu9bGxEdosugyu5caigjLrR2qiD11asjI1A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "8.60.1",
+ "@typescript-eslint/typescript-estree": "8.60.1",
+ "@typescript-eslint/utils": "8.60.1",
+ "debug": "^4.4.3",
+ "ts-api-utils": "^2.5.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
+ "typescript": ">=4.8.4 <6.1.0"
+ }
+ },
+ "node_modules/@typescript-eslint/types": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.60.1.tgz",
+ "integrity": "sha512-4h0tY8ppCkdCzcrl2YM5M3my0xsE1Tf8om3owEu5oPWmXwkKRmk0j0LGDzYBGUcAlesEbxBhazqu/K4cu3Ug7w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/typescript-estree": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.60.1.tgz",
+ "integrity": "sha512-alpRkfG8hlVE5kdJW2GkfgDgXxold3e8e4l6EnmhRmRLbekgAPCCGDVD++sABy9FcgPFroq+uFcCSM1vR57Cew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/project-service": "8.60.1",
+ "@typescript-eslint/tsconfig-utils": "8.60.1",
+ "@typescript-eslint/types": "8.60.1",
+ "@typescript-eslint/visitor-keys": "8.60.1",
+ "debug": "^4.4.3",
+ "minimatch": "^10.2.2",
+ "semver": "^7.7.3",
+ "tinyglobby": "^0.2.15",
+ "ts-api-utils": "^2.5.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4 <6.1.0"
+ }
+ },
+ "node_modules/@typescript-eslint/typescript-estree/node_modules/balanced-match": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
+ "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": {
+ "version": "5.0.6",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
+ "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^4.0.2"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": {
+ "version": "10.2.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
+ "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "brace-expansion": "^5.0.5"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": {
+ "version": "7.8.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz",
+ "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/@typescript-eslint/utils": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.60.1.tgz",
+ "integrity": "sha512-h2MPBLoNtjc3qZWfY3Tl51yPorQ2McHn8pJfcMNTcIvrrZrr90Ykffit0yjrPFWQcRcUxzH20+6OcVdW4yHtUg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.9.1",
+ "@typescript-eslint/scope-manager": "8.60.1",
+ "@typescript-eslint/types": "8.60.1",
+ "@typescript-eslint/typescript-estree": "8.60.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
+ "typescript": ">=4.8.4 <6.1.0"
+ }
+ },
+ "node_modules/@typescript-eslint/visitor-keys": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.60.1.tgz",
+ "integrity": "sha512-EbGRQg4FhrmwLodl+t3JNAnXHWVr9Vp+Zl1QBZVPY4ByfkzIT8cX3K6QWODHtkIZqqJVEWvhHSx3v5PDHsaQag==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/types": "8.60.1",
+ "eslint-visitor-keys": "^5.0.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ }
+ },
+ "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-5.0.1.tgz",
+ "integrity": "sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^20.19.0 || ^22.13.0 || >=24"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/@vitejs/plugin-react": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz",
+ "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/core": "^7.28.0",
+ "@babel/plugin-transform-react-jsx-self": "^7.27.1",
+ "@babel/plugin-transform-react-jsx-source": "^7.27.1",
+ "@rolldown/pluginutils": "1.0.0-beta.27",
+ "@types/babel__core": "^7.20.5",
+ "react-refresh": "^0.17.0"
+ },
+ "engines": {
+ "node": "^14.18.0 || >=16.0.0"
+ },
+ "peerDependencies": {
+ "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
+ }
+ },
+ "node_modules/@webext-core/fake-browser": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/@webext-core/fake-browser/-/fake-browser-1.5.2.tgz",
+ "integrity": "sha512-nkDQwOJ23X5Q7cEtN6LRuBtVFf1KVOFi5GoQAro0lzqdh59F5E+K350j1isbnqYbzsXRh1NJtboudIcHfZtvOQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/webextension-polyfill": ">=0.10.5",
+ "lodash.merge": "^4.6.2"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/@webext-core/isolated-element": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@webext-core/isolated-element/-/isolated-element-1.1.5.tgz",
+ "integrity": "sha512-4m6oP8Vzm/68YO1QmkUOZqqUcmyBtA53tji2g00/nYXE3E3IceYgeub7eIqvXDV2Z7xU6cm6qO1IMt4XFVwtvQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-potential-custom-element-name": "^1.0.1"
+ }
+ },
+ "node_modules/@webext-core/match-patterns": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@webext-core/match-patterns/-/match-patterns-1.0.3.tgz",
+ "integrity": "sha512-NY39ACqCxdKBmHgw361M9pfJma8e4AZo20w9AY+5ZjIj1W2dvXC8J31G5fjfOGbulW9w4WKpT8fPooi0mLkn9A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@wxt-dev/browser": {
+ "version": "0.1.42",
+ "resolved": "https://registry.npmjs.org/@wxt-dev/browser/-/browser-0.1.42.tgz",
+ "integrity": "sha512-BSb0H09i4+0WlqFnN7LnZW0M6uCPH9KndciGx7mwOFKRVjNCorqwPk3hiVB58yQ+cyJNpDvYWL6IoPBxvP8qEA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/filesystem": "*",
+ "@types/har-format": "*"
+ }
+ },
+ "node_modules/@wxt-dev/module-react": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/@wxt-dev/module-react/-/module-react-1.1.3.tgz",
+ "integrity": "sha512-ede2FLS3sdJwtyI61jvY1UiF194ouv3wxm+fCYjfP4FfvoXQbif8UuusYBC0KSa/L2AL9Cfa/lEvsdNYrKFUaA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitejs/plugin-react": "^4.3.4"
+ },
+ "peerDependencies": {
+ "wxt": ">=0.19.16"
+ }
+ },
+ "node_modules/@wxt-dev/storage": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/@wxt-dev/storage/-/storage-1.2.8.tgz",
+ "integrity": "sha512-GWCFKgF5+d7eslOxUDFC70ypA9njupmJb1nQM8uZoX0J3sWT2BO5xJLzb1sYahWAfID9p2BMtnUBN1lkWxPsbQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@wxt-dev/browser": "^0.1.37",
+ "async-mutex": "^0.5.0",
+ "dequal": "^2.0.3"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/wxt-dev"
+ }
+ },
+ "node_modules/acorn": {
+ "version": "8.16.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.16.0.tgz",
+ "integrity": "sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-jsx": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz",
+ "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==",
+ "dev": true,
+ "license": "MIT",
+ "peerDependencies": {
+ "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0"
+ }
+ },
+ "node_modules/adm-zip": {
+ "version": "0.5.17",
+ "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.17.tgz",
+ "integrity": "sha512-+Ut8d9LLqwEvHHJl1+PIHqoyDxFgVN847JTVM3Izi3xHDWPE4UtzzXysMZQs64DMcrJfBeS/uoEP4AD3HQHnQQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0"
+ }
+ },
+ "node_modules/ajv": {
+ "version": "6.15.0",
+ "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
+ "integrity": "sha512-fgFx7Hfoq60ytK2c7DhnF8jIvzYgOMxfugjLOSMHjLIPgenqa7S7oaagATUq99mV6IYvN2tRmC0wnTYX6iPbMw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fast-deep-equal": "^3.1.1",
+ "fast-json-stable-stringify": "^2.0.0",
+ "json-schema-traverse": "^0.4.1",
+ "uri-js": "^4.2.2"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/epoberezkin"
+ }
+ },
+ "node_modules/ansi-align": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-align/-/ansi-align-3.0.1.tgz",
+ "integrity": "sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.1.0"
+ }
+ },
+ "node_modules/ansi-align/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-align/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/ansi-align/node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-align/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-align/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ansi-escapes": {
+ "version": "7.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.3.0.tgz",
+ "integrity": "sha512-BvU8nYgGQBxcmMuEeUEmNTvrMVjJNSH7RgW24vXexN4Ven6qCvy4TntnvlnwnMLTVlcRQQdbRY8NKnaIoeWDNg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "environment": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/ansi-regex": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
+ }
+ },
+ "node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/any-promise": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz",
+ "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/anymatch": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz",
+ "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "normalize-path": "^3.0.0",
+ "picomatch": "^2.0.4"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/arg": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz",
+ "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/argparse": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz",
+ "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
+ "dev": true,
+ "license": "Python-2.0"
+ },
+ "node_modules/array-differ": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-4.0.0.tgz",
+ "integrity": "sha512-Q6VPTLMsmXZ47ENG3V+wQyZS1ZxXMxFyYzA+Z/GMrJ6yIutAIEf9wTyroTzmGjNfox9/h3GdGBCVh43GVFx4Uw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/array-union": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/array-union/-/array-union-3.0.1.tgz",
+ "integrity": "sha512-1OvF9IbWwaeiM9VhzYXVQacMibxpXOMYVNIvMtKRyX9SImBXpKcFr8XvFDeEslCyuH/t6KRt7HEO94AlP8Iatw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/async": {
+ "version": "3.2.6",
+ "resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
+ "integrity": "sha512-htCUDlxyyCLMgaM3xXg0C0LW2xqfuQ6p05pCEIsXuyQ+a1koYKTuBMzRNwmybfLgvJDMd0r1LTn4+E0Ti6C2AA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/async-mutex": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz",
+ "integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/atomic-sleep": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
+ "integrity": "sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.0.0"
+ }
+ },
+ "node_modules/atomically": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/atomically/-/atomically-2.1.1.tgz",
+ "integrity": "sha512-P4w9o2dqARji6P7MHprklbfiArZAWvo07yW7qs3pdljb3BWr12FIB7W+p0zJiuiVsUpRO0iZn1kFFcpPegg0tQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "stubborn-fs": "^2.0.0",
+ "when-exit": "^2.1.4"
+ }
+ },
+ "node_modules/autoprefixer": {
+ "version": "10.5.0",
+ "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.5.0.tgz",
+ "integrity": "sha512-FMhOoZV4+qR6aTUALKX2rEqGG+oyATvwBt9IIzVR5rMa2HRWPkxf+P+PAJLD1I/H5/II+HuZcBJYEFBpq39ong==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/autoprefixer"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "browserslist": "^4.28.2",
+ "caniuse-lite": "^1.0.30001787",
+ "fraction.js": "^5.3.4",
+ "picocolors": "^1.1.1",
+ "postcss-value-parser": "^4.2.0"
+ },
+ "bin": {
+ "autoprefixer": "bin/autoprefixer"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ },
+ "peerDependencies": {
+ "postcss": "^8.1.0"
+ }
+ },
+ "node_modules/balanced-match": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
+ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/baseline-browser-mapping": {
+ "version": "2.10.34",
+ "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.10.34.tgz",
+ "integrity": "sha512-IMDedajPifLnHNY0X9n8hKxRTQ6/eTHwr5bDo04WnuqxyKw6LYtQywCuuqPZwhl3aBXMvQpJov42GLCwRRdQzw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "baseline-browser-mapping": "dist/cli.cjs"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/binary-extensions": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz",
+ "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/bluebird": {
+ "version": "3.7.2",
+ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
+ "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/boolbase": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/boolbase/-/boolbase-1.0.0.tgz",
+ "integrity": "sha512-JZOSA7Mo9sNGB8+UjSgzdLtokWAky1zbztM3WRLCbZ70/3cTANmQmOdR7y2g+J0e2WXywy1yS468tY+IruqEww==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/boxen": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/boxen/-/boxen-8.0.1.tgz",
+ "integrity": "sha512-F3PH5k5juxom4xktynS7MoFY+NUWH5LC4CnH11YB8NPew+HLpmBLCybSAEyb2F+4pRXhuhWqFesoQd6DAyc2hw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-align": "^3.0.1",
+ "camelcase": "^8.0.0",
+ "chalk": "^5.3.0",
+ "cli-boxes": "^3.0.0",
+ "string-width": "^7.2.0",
+ "type-fest": "^4.21.0",
+ "widest-line": "^5.0.0",
+ "wrap-ansi": "^9.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/boxen/node_modules/chalk": {
+ "version": "5.6.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
+ "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/boxen/node_modules/type-fest": {
+ "version": "4.41.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz",
+ "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/brace-expansion": {
+ "version": "1.1.15",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.15.tgz",
+ "integrity": "sha512-EwOCDEex4quD37XhqM3omwtMoJjr//isUZz1JopUNWms+4Z2ViyM/k1YIRePpoVNnQhENnxtFjLaxNHrT7xIUg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0",
+ "concat-map": "0.0.1"
+ }
+ },
+ "node_modules/braces": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz",
+ "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fill-range": "^7.1.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/browserslist": {
+ "version": "4.28.2",
+ "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.28.2.tgz",
+ "integrity": "sha512-48xSriZYYg+8qXna9kwqjIVzuQxi+KYWp2+5nCYnYKPTr0LvD89Jqk2Or5ogxz0NUMfIjhh2lIUX/LyX9B4oIg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "baseline-browser-mapping": "^2.10.12",
+ "caniuse-lite": "^1.0.30001782",
+ "electron-to-chromium": "^1.5.328",
+ "node-releases": "^2.0.36",
+ "update-browserslist-db": "^1.2.3"
+ },
+ "bin": {
+ "browserslist": "cli.js"
+ },
+ "engines": {
+ "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
+ }
+ },
+ "node_modules/buffer-from": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
+ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/bundle-name": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/bundle-name/-/bundle-name-4.1.0.tgz",
+ "integrity": "sha512-tjwM5exMg6BGRI+kNmTntNsvdZS1X8BFYS6tnJ2hdH0kVxM6/eVZ2xy+FqStSWvYmtfFMDLIxurorHwDKfDz5Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "run-applescript": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/c12": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/c12/-/c12-3.3.4.tgz",
+ "integrity": "sha512-cM0ApFQSBXuourJejzwv/AuPRvAxordTyParRVcHjjtXirtkzM0uK2L9TTn9s0cXZbG7E55jCivRQzoxYmRAlA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "chokidar": "^5.0.0",
+ "confbox": "^0.2.4",
+ "defu": "^6.1.6",
+ "dotenv": "^17.3.1",
+ "exsolve": "^1.0.8",
+ "giget": "^3.2.0",
+ "jiti": "^2.6.1",
+ "ohash": "^2.0.11",
+ "pathe": "^2.0.3",
+ "perfect-debounce": "^2.1.0",
+ "pkg-types": "^2.3.0",
+ "rc9": "^3.0.1"
+ },
+ "peerDependencies": {
+ "magicast": "*"
+ },
+ "peerDependenciesMeta": {
+ "magicast": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/c12/node_modules/chokidar": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-5.0.0.tgz",
+ "integrity": "sha512-TQMmc3w+5AxjpL8iIiwebF73dRDF4fBIieAqGn9RGCWaEVwQ6Fb2cGe31Yns0RRIzii5goJ1Y7xbMwo1TxMplw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "readdirp": "^5.0.0"
+ },
+ "engines": {
+ "node": ">= 20.19.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/c12/node_modules/dotenv": {
+ "version": "17.4.2",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
+ "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/c12/node_modules/giget": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/giget/-/giget-3.2.0.tgz",
+ "integrity": "sha512-GvHTWcykIR/fP8cj8dMpuMMkvaeJfPvYnhq0oW+chSeIr+ldX21ifU2Ms6KBoyKZQZmVaUAAhQ2EZ68KJF8a7A==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "giget": "dist/cli.mjs"
+ }
+ },
+ "node_modules/c12/node_modules/jiti": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
+ "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "jiti": "lib/jiti-cli.mjs"
+ }
+ },
+ "node_modules/c12/node_modules/ohash": {
+ "version": "2.0.11",
+ "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz",
+ "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/c12/node_modules/perfect-debounce": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-2.1.0.tgz",
+ "integrity": "sha512-LjgdTytVFXeUgtHZr9WYViYSM/g8MkcTPYDlPa3cDqMirHjKiSZPYd6DoL7pK8AJQr+uWkQvCjHNdiMqsrJs+g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/c12/node_modules/readdirp": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-5.0.0.tgz",
+ "integrity": "sha512-9u/XQ1pvrQtYyMpZe7DXKv2p5CNvyVwzUB6uhLAnQwHMSgKMBR62lc7AHljaeteeHXn11XTAaLLUVZYVZyuRBQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 20.19.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/cac": {
+ "version": "6.7.14",
+ "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz",
+ "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/callsites": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
+ "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/camelcase": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-8.0.0.tgz",
+ "integrity": "sha512-8WB3Jcas3swSvjIeA2yvCJ+Miyz5l1ZmB6HFb9R1317dt9LCQoswg/BGrmAmkWVEszSrrg4RwmO46qIm2OEnSA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/camelcase-css": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz",
+ "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/caniuse-lite": {
+ "version": "1.0.30001793",
+ "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001793.tgz",
+ "integrity": "sha512-iwSsYWaCOoh26cV8NwNRViHlrfUvYsHDfRVcbtmw0Kg6PJIZZXwMkj1442FYLBGkeUf1juAsU3DTfxW579mrPA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/caniuse-lite"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "CC-BY-4.0"
+ },
+ "node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/chokidar": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
+ "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "anymatch": "~3.1.2",
+ "braces": "~3.0.2",
+ "glob-parent": "~5.1.2",
+ "is-binary-path": "~2.1.0",
+ "is-glob": "~4.0.1",
+ "normalize-path": "~3.0.0",
+ "readdirp": "~3.6.0"
+ },
+ "engines": {
+ "node": ">= 8.10.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/chokidar/node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/chownr": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz",
+ "integrity": "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/chrome-launcher": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/chrome-launcher/-/chrome-launcher-1.2.0.tgz",
+ "integrity": "sha512-JbuGuBNss258bvGil7FT4HKdC3SC2K7UAEUqiPy3ACS3Yxo3hAW6bvFpCu2HsIJLgTqxgEX6BkujvzZfLpUD0Q==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@types/node": "*",
+ "escape-string-regexp": "^4.0.0",
+ "is-wsl": "^2.2.0",
+ "lighthouse-logger": "^2.0.1"
+ },
+ "bin": {
+ "print-chrome-path": "bin/print-chrome-path.cjs"
+ },
+ "engines": {
+ "node": ">=12.13.0"
+ }
+ },
+ "node_modules/chrome-launcher/node_modules/is-docker": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "is-docker": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/chrome-launcher/node_modules/is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-docker": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/ci-info": {
+ "version": "4.4.0",
+ "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-4.4.0.tgz",
+ "integrity": "sha512-77PSwercCZU2Fc4sX94eF8k8Pxte6JAwL4/ICZLFjJLqegs7kCuAsqqj/70NQF6TvDpgFjkubQB2FW2ZZddvQg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/sibiraj-s"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/citty": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/citty/-/citty-0.1.6.tgz",
+ "integrity": "sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "consola": "^3.2.3"
+ }
+ },
+ "node_modules/cli-boxes": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cli-boxes/-/cli-boxes-3.0.0.tgz",
+ "integrity": "sha512-/lzGpEWL/8PfI0BmBOPRwp0c/wFNX1RdUML3jK/RcSBA9T8mZDdQpqYBKtCFTOfQbwPqWEOpjqW+Fnayc0969g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/cli-cursor": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-5.0.0.tgz",
+ "integrity": "sha512-aCj4O5wKyszjMmDT4tZj93kxyydN/K5zPWSCe6/0AV/AA1pqe5ZBIw0a2ZfPQV7lL5/yb5HsUreJ6UFAF1tEQw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "restore-cursor": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/cli-spinners": {
+ "version": "2.9.2",
+ "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz",
+ "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/cli-truncate": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-4.0.0.tgz",
+ "integrity": "sha512-nPdaFdQ0h/GEigbPClz11D0v/ZJEwxmeVZGeMo3Z5StPtUTkA9o1lD6QwoirYiSDzbcwn2XcjwmCp68W1IS4TA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "slice-ansi": "^5.0.0",
+ "string-width": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/cliui": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz",
+ "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/cliui/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/cliui/node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/cliui/node_modules/wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/colorette": {
+ "version": "2.0.20",
+ "resolved": "https://registry.npmjs.org/colorette/-/colorette-2.0.20.tgz",
+ "integrity": "sha512-IfEDxwoWIjkeXL1eXcDiow4UbKjhLdq6/EuSVR9GMN7KVH3r9gQ83e73hsz1Nd1T3ijd5xv1wcWRYO+D6kCI2w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/commander": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
+ "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/concat-map": {
+ "version": "0.0.1",
+ "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
+ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/concat-stream": {
+ "version": "1.6.2",
+ "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
+ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
+ "dev": true,
+ "engines": [
+ "node >= 0.8"
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "inherits": "^2.0.3",
+ "readable-stream": "^2.2.2",
+ "typedarray": "^0.0.6"
+ }
+ },
+ "node_modules/confbox": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.4.tgz",
+ "integrity": "sha512-ysOGlgTFbN2/Y6Cg3Iye8YKulHw+R2fNXHrgSmXISQdMnomY6eNDprVdW9R5xBguEqI954+S6709UyiO7B+6OQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/config-chain": {
+ "version": "1.1.13",
+ "resolved": "https://registry.npmjs.org/config-chain/-/config-chain-1.1.13.tgz",
+ "integrity": "sha512-qj+f8APARXHrM0hraqXYb2/bOVSV4PvJQlNZ/DVj0QrmNM2q2euizkeuVckQ57J+W0mRH6Hvi+k50M4Jul2VRQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ini": "^1.3.4",
+ "proto-list": "~1.2.1"
+ }
+ },
+ "node_modules/config-chain/node_modules/ini": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
+ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/configstore": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/configstore/-/configstore-7.1.0.tgz",
+ "integrity": "sha512-N4oog6YJWbR9kGyXvS7jEykLDXIE2C0ILYqNBZBp9iwiJpoCBWYsuAdW6PPFn6w06jjnC+3JstVvWHO4cZqvRg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "atomically": "^2.0.3",
+ "dot-prop": "^9.0.0",
+ "graceful-fs": "^4.2.11",
+ "xdg-basedir": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/consola": {
+ "version": "3.4.2",
+ "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz",
+ "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.18.0 || >=16.10.0"
+ }
+ },
+ "node_modules/convert-source-map": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz",
+ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/core-util-is": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz",
+ "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/cross-spawn": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz",
+ "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^3.1.0",
+ "shebang-command": "^2.0.0",
+ "which": "^2.0.1"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/css-select": {
+ "version": "5.2.2",
+ "resolved": "https://registry.npmjs.org/css-select/-/css-select-5.2.2.tgz",
+ "integrity": "sha512-TizTzUddG/xYLA3NXodFM0fSbNizXjOKhqiQQwvhlspadZokn1KDy0NZFS0wuEubIYAV5/c1/lAr0TaaFXEXzw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "boolbase": "^1.0.0",
+ "css-what": "^6.1.0",
+ "domhandler": "^5.0.2",
+ "domutils": "^3.0.1",
+ "nth-check": "^2.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/fb55"
+ }
+ },
+ "node_modules/css-what": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/css-what/-/css-what-6.2.2.tgz",
+ "integrity": "sha512-u/O3vwbptzhMs3L1fQE82ZSLHQQfto5gyZzwteVIEyeaY5Fc7R4dapF/BvRoSYFeqfBk4m0V1Vafq5Pjv25wvA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">= 6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/fb55"
+ }
+ },
+ "node_modules/cssesc": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
+ "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "cssesc": "bin/cssesc"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/cssom": {
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.5.0.tgz",
+ "integrity": "sha512-iKuQcq+NdHqlAcwUY0o/HL69XQrUaQdMjmStJ8JFmUaiiQErlhrmuigkg/CU4E2J0IyUKUrMAgl36TvN67MqTw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/csstype": {
+ "version": "3.2.3",
+ "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
+ "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==",
+ "devOptional": true,
+ "license": "MIT"
+ },
+ "node_modules/debounce": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz",
+ "integrity": "sha512-XRRe6Glud4rd/ZGQfiV1ruXSfbvfJedlV9Y6zOlP+2K04vBYiJEte6stfFkCP03aMnY5tsipamumUjL14fofug==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/debug": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz",
+ "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ms": "^2.1.3"
+ },
+ "engines": {
+ "node": ">=6.0"
+ },
+ "peerDependenciesMeta": {
+ "supports-color": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/deep-extend": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
+ "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/deep-is": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
+ "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/default-browser": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/default-browser/-/default-browser-5.5.0.tgz",
+ "integrity": "sha512-H9LMLr5zwIbSxrmvikGuI/5KGhZ8E2zH3stkMgM5LpOWDutGM2JZaj460Udnf1a+946zc7YBgrqEWwbk7zHvGw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "bundle-name": "^4.1.0",
+ "default-browser-id": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/default-browser-id": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/default-browser-id/-/default-browser-id-5.0.1.tgz",
+ "integrity": "sha512-x1VCxdX4t+8wVfd1so/9w+vQ4vx7lKd2Qp5tDRutErwmR85OgmfX7RlLRMWafRMY7hbEiXIbudNrjOAPa/hL8Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/define-lazy-prop": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/define-lazy-prop/-/define-lazy-prop-3.0.0.tgz",
+ "integrity": "sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/defu": {
+ "version": "6.1.7",
+ "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz",
+ "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/dequal": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
+ "integrity": "sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/destr": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz",
+ "integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/didyoumean": {
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz",
+ "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
+ "node_modules/dlv": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz",
+ "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/dom-serializer": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
+ "integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.2",
+ "entities": "^4.2.0"
+ },
+ "funding": {
+ "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1"
+ }
+ },
+ "node_modules/domelementtype": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
+ "integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fb55"
+ }
+ ],
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/domhandler": {
+ "version": "5.0.3",
+ "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
+ "integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "domelementtype": "^2.3.0"
+ },
+ "engines": {
+ "node": ">= 4"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/domhandler?sponsor=1"
+ }
+ },
+ "node_modules/domutils": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/domutils/-/domutils-3.2.2.tgz",
+ "integrity": "sha512-6kZKyUajlDuqlHKVX1w7gyslj9MPIXzIFiz/rGu35uC1wMi+kMhQwGhl4lt9unC9Vb9INnY9Z3/ZA3+FhASLaw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "dom-serializer": "^2.0.0",
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.3"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/domutils?sponsor=1"
+ }
+ },
+ "node_modules/dot-prop": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-9.0.0.tgz",
+ "integrity": "sha512-1gxPBJpI/pcjQhKgIU91II6Wkay+dLcN3M6rf2uwP8hRur3HtQXjVrdAK3sjC0piaEuxzMwjXChcETiJl47lAQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "type-fest": "^4.18.2"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/dot-prop/node_modules/type-fest": {
+ "version": "4.41.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz",
+ "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/dotenv": {
+ "version": "16.6.1",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz",
+ "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/dotenv-expand": {
+ "version": "12.0.3",
+ "resolved": "https://registry.npmjs.org/dotenv-expand/-/dotenv-expand-12.0.3.tgz",
+ "integrity": "sha512-uc47g4b+4k/M/SeaW1y4OApx+mtLWl92l5LMPP0GNXctZqELk+YGgOPIIC5elYmUH4OuoK3JLhuRUYegeySiFA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "dotenv": "^16.4.5"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/electron-to-chromium": {
+ "version": "1.5.368",
+ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.368.tgz",
+ "integrity": "sha512-7RckJJK4uESJF9PxvfMWd3TGqIiieUTG4HxnKaKuIpGbcr+r2ZEB3g2gAhCP3Fqm42vJSzLfgab9eva/C4/XVw==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/emoji-regex": {
+ "version": "10.6.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz",
+ "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/entities": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
+ "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
+ "node_modules/environment": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",
+ "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/error-ex": {
+ "version": "1.3.4",
+ "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz",
+ "integrity": "sha512-sqQamAnR14VgCr1A618A3sGrygcpK+HEbenA/HiEAkkUwcZIIB/tgWqHFxWgOyDh4nB4JCRimh79dR5Ywc9MDQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-arrayish": "^0.2.1"
+ }
+ },
+ "node_modules/es-errors": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
+ "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-module-lexer": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz",
+ "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/es6-error": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
+ "integrity": "sha512-Um/+FxMr9CISWh0bi5Zv0iOD+4cFh5qLeks1qhAopKVAJw3drgKbKySikp7wGhDL0HPeaja0P5ULZrxLkniUVg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/esbuild": {
+ "version": "0.25.12",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz",
+ "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.25.12",
+ "@esbuild/android-arm": "0.25.12",
+ "@esbuild/android-arm64": "0.25.12",
+ "@esbuild/android-x64": "0.25.12",
+ "@esbuild/darwin-arm64": "0.25.12",
+ "@esbuild/darwin-x64": "0.25.12",
+ "@esbuild/freebsd-arm64": "0.25.12",
+ "@esbuild/freebsd-x64": "0.25.12",
+ "@esbuild/linux-arm": "0.25.12",
+ "@esbuild/linux-arm64": "0.25.12",
+ "@esbuild/linux-ia32": "0.25.12",
+ "@esbuild/linux-loong64": "0.25.12",
+ "@esbuild/linux-mips64el": "0.25.12",
+ "@esbuild/linux-ppc64": "0.25.12",
+ "@esbuild/linux-riscv64": "0.25.12",
+ "@esbuild/linux-s390x": "0.25.12",
+ "@esbuild/linux-x64": "0.25.12",
+ "@esbuild/netbsd-arm64": "0.25.12",
+ "@esbuild/netbsd-x64": "0.25.12",
+ "@esbuild/openbsd-arm64": "0.25.12",
+ "@esbuild/openbsd-x64": "0.25.12",
+ "@esbuild/openharmony-arm64": "0.25.12",
+ "@esbuild/sunos-x64": "0.25.12",
+ "@esbuild/win32-arm64": "0.25.12",
+ "@esbuild/win32-ia32": "0.25.12",
+ "@esbuild/win32-x64": "0.25.12"
+ }
+ },
+ "node_modules/escalade": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz",
+ "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/escape-goat": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-goat/-/escape-goat-4.0.0.tgz",
+ "integrity": "sha512-2Sd4ShcWxbx6OY1IHyla/CVNwvg7XwZVoXZHcSu9w9SReNP1EzzD5T8NWKIR38fIqEns9kDWKUQTXXAmlDrdPg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/eslint": {
+ "version": "9.39.4",
+ "resolved": "https://registry.npmjs.org/eslint/-/eslint-9.39.4.tgz",
+ "integrity": "sha512-XoMjdBOwe/esVgEvLmNsD3IRHkm7fbKIUGvrleloJXUZgDHig2IPWNniv+GwjyJXzuNqVjlr5+4yVUZjycJwfQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@eslint-community/eslint-utils": "^4.8.0",
+ "@eslint-community/regexpp": "^4.12.1",
+ "@eslint/config-array": "^0.21.2",
+ "@eslint/config-helpers": "^0.4.2",
+ "@eslint/core": "^0.17.0",
+ "@eslint/eslintrc": "^3.3.5",
+ "@eslint/js": "9.39.4",
+ "@eslint/plugin-kit": "^0.4.1",
+ "@humanfs/node": "^0.16.6",
+ "@humanwhocodes/module-importer": "^1.0.1",
+ "@humanwhocodes/retry": "^0.4.2",
+ "@types/estree": "^1.0.6",
+ "ajv": "^6.14.0",
+ "chalk": "^4.0.0",
+ "cross-spawn": "^7.0.6",
+ "debug": "^4.3.2",
+ "escape-string-regexp": "^4.0.0",
+ "eslint-scope": "^8.4.0",
+ "eslint-visitor-keys": "^4.2.1",
+ "espree": "^10.4.0",
+ "esquery": "^1.5.0",
+ "esutils": "^2.0.2",
+ "fast-deep-equal": "^3.1.3",
+ "file-entry-cache": "^8.0.0",
+ "find-up": "^5.0.0",
+ "glob-parent": "^6.0.2",
+ "ignore": "^5.2.0",
+ "imurmurhash": "^0.1.4",
+ "is-glob": "^4.0.0",
+ "json-stable-stringify-without-jsonify": "^1.0.1",
+ "lodash.merge": "^4.6.2",
+ "minimatch": "^3.1.5",
+ "natural-compare": "^1.4.0",
+ "optionator": "^0.9.3"
+ },
+ "bin": {
+ "eslint": "bin/eslint.js"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ },
+ "peerDependencies": {
+ "jiti": "*"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/eslint-plugin-react-hooks": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-5.2.0.tgz",
+ "integrity": "sha512-+f15FfK64YQwZdJNELETdn5ibXEUQmW1DZL6KXhNnc2heoy/sg9VJJeT7n8TlMWouzWqSWavFkIhHyIbIAEapg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "peerDependencies": {
+ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^9.0.0"
+ }
+ },
+ "node_modules/eslint-scope": {
+ "version": "8.4.0",
+ "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-8.4.0.tgz",
+ "integrity": "sha512-sNXOfKCn74rt8RICKMvJS7XKV/Xk9kA7DyJr8mJik3S7Cwgy3qlkkmyS2uQB3jiJg6VNdZd/pDBJu0nvG2NlTg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "esrecurse": "^4.3.0",
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/eslint-visitor-keys": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz",
+ "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/espree": {
+ "version": "10.4.0",
+ "resolved": "https://registry.npmjs.org/espree/-/espree-10.4.0.tgz",
+ "integrity": "sha512-j6PAQ2uUr79PZhBjP5C5fhl8e39FmRnOjsD5lGnWrFU8i2G776tBK7+nP8KuQUTTyAZUwfQqXAgrVH5MbH9CYQ==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "acorn": "^8.15.0",
+ "acorn-jsx": "^5.3.2",
+ "eslint-visitor-keys": "^4.2.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/eslint"
+ }
+ },
+ "node_modules/esquery": {
+ "version": "1.7.0",
+ "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.7.0.tgz",
+ "integrity": "sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "estraverse": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=0.10"
+ }
+ },
+ "node_modules/esrecurse": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz",
+ "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "estraverse": "^5.2.0"
+ },
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/estraverse": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz",
+ "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/estree-walker": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz",
+ "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "^1.0.0"
+ }
+ },
+ "node_modules/esutils": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz",
+ "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/eventemitter3": {
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",
+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/execa": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/execa/-/execa-8.0.1.tgz",
+ "integrity": "sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cross-spawn": "^7.0.3",
+ "get-stream": "^8.0.1",
+ "human-signals": "^5.0.0",
+ "is-stream": "^3.0.0",
+ "merge-stream": "^2.0.0",
+ "npm-run-path": "^5.1.0",
+ "onetime": "^6.0.0",
+ "signal-exit": "^4.1.0",
+ "strip-final-newline": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=16.17"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/execa?sponsor=1"
+ }
+ },
+ "node_modules/exsolve": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.8.tgz",
+ "integrity": "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fast-deep-equal": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
+ "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fast-glob": {
+ "version": "3.3.3",
+ "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz",
+ "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@nodelib/fs.stat": "^2.0.2",
+ "@nodelib/fs.walk": "^1.2.3",
+ "glob-parent": "^5.1.2",
+ "merge2": "^1.3.0",
+ "micromatch": "^4.0.8"
+ },
+ "engines": {
+ "node": ">=8.6.0"
+ }
+ },
+ "node_modules/fast-glob/node_modules/glob-parent": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz",
+ "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/fast-json-stable-stringify": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz",
+ "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fast-levenshtein": {
+ "version": "2.0.6",
+ "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz",
+ "integrity": "sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fast-redact": {
+ "version": "3.5.0",
+ "resolved": "https://registry.npmjs.org/fast-redact/-/fast-redact-3.5.0.tgz",
+ "integrity": "sha512-dwsoQlS7h9hMeYUq1W++23NDcBLV4KqONnITDV9DjfS3q1SgDGVrBdvvTLUotWtPSD7asWDV9/CmsZPy8Hf70A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/fastq": {
+ "version": "1.20.1",
+ "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.1.tgz",
+ "integrity": "sha512-GGToxJ/w1x32s/D2EKND7kTil4n8OVk/9mycTc4VDza13lOvpUZTGX3mFSCtV9ksdGBVzvsyAVLM6mHFThxXxw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "reusify": "^1.0.4"
+ }
+ },
+ "node_modules/file-entry-cache": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-8.0.0.tgz",
+ "integrity": "sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flat-cache": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=16.0.0"
+ }
+ },
+ "node_modules/filesize": {
+ "version": "10.1.6",
+ "resolved": "https://registry.npmjs.org/filesize/-/filesize-10.1.6.tgz",
+ "integrity": "sha512-sJslQKU2uM33qH5nqewAwVB2QgR6w1aMNsYUp3aN5rMRyXEwJGmZvaWzeJFNTOXWlHQyBFCWrdj3fV/fsTOX8w==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">= 10.4.0"
+ }
+ },
+ "node_modules/fill-range": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz",
+ "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "to-regex-range": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/find-up": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
+ "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "locate-path": "^6.0.0",
+ "path-exists": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/firefox-profile": {
+ "version": "4.7.0",
+ "resolved": "https://registry.npmjs.org/firefox-profile/-/firefox-profile-4.7.0.tgz",
+ "integrity": "sha512-aGApEu5bfCNbA4PGUZiRJAIU6jKmghV2UVdklXAofnNtiDjqYw0czLS46W7IfFqVKgKhFB8Ao2YoNGHY4BoIMQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "adm-zip": "~0.5.x",
+ "fs-extra": "^11.2.0",
+ "ini": "^4.1.3",
+ "minimist": "^1.2.8",
+ "xml2js": "^0.6.2"
+ },
+ "bin": {
+ "firefox-profile": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/flat-cache": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-4.0.1.tgz",
+ "integrity": "sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "flatted": "^3.2.9",
+ "keyv": "^4.5.4"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/flatted": {
+ "version": "3.4.2",
+ "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.4.2.tgz",
+ "integrity": "sha512-PjDse7RzhcPkIJwy5t7KPWQSZ9cAbzQXcafsetQoD7sOJRQlGikNbx7yZp2OotDnJyrDcbyRq3Ttb18iYOqkxA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/form-data-encoder": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.1.0.tgz",
+ "integrity": "sha512-G6NsmEW15s0Uw9XnCg+33H3ViYRyiM0hMrMhhqQOR8NFc5GhYrI+6I3u7OTw7b91J2g8rtvMBZJDbcGb2YUniw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/formdata-node": {
+ "version": "6.0.3",
+ "resolved": "https://registry.npmjs.org/formdata-node/-/formdata-node-6.0.3.tgz",
+ "integrity": "sha512-8e1++BCiTzUno9v5IZ2J6bv4RU+3UKDmqWUQD0MIMVCd9AdhWkO1gw57oo1mNEX1dMq2EGI+FbWz4B92pscSQg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 18"
+ }
+ },
+ "node_modules/fraction.js": {
+ "version": "5.3.4",
+ "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz",
+ "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "*"
+ },
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/rawify"
+ }
+ },
+ "node_modules/fs-extra": {
+ "version": "11.3.5",
+ "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.3.5.tgz",
+ "integrity": "sha512-eKpRKAovdpZtR1WopLHxlBWvAgPny3c4gX1G5Jhwmmw4XJj0ifSD5qB5TOo8hmA0wlRKDAOAhEE1yVPgs6Fgcg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "graceful-fs": "^4.2.0",
+ "jsonfile": "^6.0.1",
+ "universalify": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=14.14"
+ }
+ },
+ "node_modules/fs-minipass": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz",
+ "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "minipass": "^3.0.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/fs-minipass/node_modules/minipass": {
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/fs-minipass/node_modules/yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/function-bind": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
+ "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/fx-runner": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/fx-runner/-/fx-runner-1.4.0.tgz",
+ "integrity": "sha512-rci1g6U0rdTg6bAaBboP7XdRu01dzTAaKXxFf+PUqGuCv6Xu7o8NZdY1D5MvKGIjb6EdS1g3VlXOgksir1uGkg==",
+ "dev": true,
+ "license": "MPL-2.0",
+ "dependencies": {
+ "commander": "2.9.0",
+ "shell-quote": "1.7.3",
+ "spawn-sync": "1.0.15",
+ "when": "3.7.7",
+ "which": "1.2.4",
+ "winreg": "0.0.12"
+ },
+ "bin": {
+ "fx-runner": "bin/fx-runner"
+ }
+ },
+ "node_modules/fx-runner/node_modules/commander": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz",
+ "integrity": "sha512-bmkUukX8wAOjHdN26xj5c4ctEV22TQ7dQYhSmuckKhToXrkUn0iIaolHdIxYYqD55nhpSPA9zPQ1yP57GdXP2A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "graceful-readlink": ">= 1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.6.x"
+ }
+ },
+ "node_modules/fx-runner/node_modules/isexe": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-1.1.2.tgz",
+ "integrity": "sha512-d2eJzK691yZwPHcv1LbeAOa91yMJ9QmfTgSO1oXB65ezVhXQsxBac2vEB4bMVms9cGzaA99n6V2viHMq82VLDw==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/fx-runner/node_modules/which": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/which/-/which-1.2.4.tgz",
+ "integrity": "sha512-zDRAqDSBudazdfM9zpiI30Fu9ve47htYXcGi3ln0wfKu2a7SmrT6F3VDoYONu//48V8Vz4TdCRNPjtvyRO3yBA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-absolute": "^0.1.7",
+ "isexe": "^1.1.1"
+ },
+ "bin": {
+ "which": "bin/which"
+ }
+ },
+ "node_modules/gensync": {
+ "version": "1.0.0-beta.2",
+ "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz",
+ "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.9.0"
+ }
+ },
+ "node_modules/get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": "6.* || 8.* || >= 10.*"
+ }
+ },
+ "node_modules/get-east-asian-width": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
+ "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/get-port-please": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.2.0.tgz",
+ "integrity": "sha512-I9QVvBw5U/hw3RmWpYKRumUeaDgxTPd401x364rLmWBJcOQ753eov1eTgzDqRG9bqFIfDc7gfzcQEWrUri3o1A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/get-stream": {
+ "version": "8.0.1",
+ "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz",
+ "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/giget": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/giget/-/giget-1.2.5.tgz",
+ "integrity": "sha512-r1ekGw/Bgpi3HLV3h1MRBIlSAdHoIMklpaQ3OQLFcRw9PwAj2rqigvIbg+dBUI51OxVI2jsEtDywDBjSiuf7Ug==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "citty": "^0.1.6",
+ "consola": "^3.4.0",
+ "defu": "^6.1.4",
+ "node-fetch-native": "^1.6.6",
+ "nypm": "^0.5.4",
+ "pathe": "^2.0.3",
+ "tar": "^6.2.1"
+ },
+ "bin": {
+ "giget": "dist/cli.mjs"
+ }
+ },
+ "node_modules/giget/node_modules/confbox": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
+ "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/giget/node_modules/nypm": {
+ "version": "0.5.4",
+ "resolved": "https://registry.npmjs.org/nypm/-/nypm-0.5.4.tgz",
+ "integrity": "sha512-X0SNNrZiGU8/e/zAB7sCTtdxWTMSIO73q+xuKgglm2Yvzwlo8UoC5FNySQFCvl84uPaeADkqHUZUkWy4aH4xOA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "citty": "^0.1.6",
+ "consola": "^3.4.0",
+ "pathe": "^2.0.3",
+ "pkg-types": "^1.3.1",
+ "tinyexec": "^0.3.2",
+ "ufo": "^1.5.4"
+ },
+ "bin": {
+ "nypm": "dist/cli.mjs"
+ },
+ "engines": {
+ "node": "^14.16.0 || >=16.10.0"
+ }
+ },
+ "node_modules/giget/node_modules/pkg-types": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz",
+ "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "confbox": "^0.1.8",
+ "mlly": "^1.7.4",
+ "pathe": "^2.0.1"
+ }
+ },
+ "node_modules/glob-parent": {
+ "version": "6.0.2",
+ "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
+ "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "is-glob": "^4.0.3"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
+ "node_modules/glob-to-regexp": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
+ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
+ "dev": true,
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/global-directory": {
+ "version": "4.0.1",
+ "resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz",
+ "integrity": "sha512-wHTUcDUoZ1H5/0iVqEudYW4/kAlN5cZ3j/bXn0Dpbizl9iaUVeWSHqiOjsgk6OW2bkLclbBjzewBz6weQ1zA2Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ini": "4.1.1"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/global-directory/node_modules/ini": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.1.tgz",
+ "integrity": "sha512-QQnnxNyfvmHFIsj7gkPcYymR8Jdw/o7mp5ZFihxn6h8Ci6fh3Dx4E1gPjpQEpIuPo9XVNY/ZUwh4BPMjGyL01g==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
+ "node_modules/globals": {
+ "version": "15.15.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-15.15.0.tgz",
+ "integrity": "sha512-7ACyT3wmyp3I61S4fG682L0VA2RGD9otkqGJIwNUMF1SWUombIIk+af1unuDYgMm082aHYwD+mzJvv9Iu8dsgg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/graceful-fs": {
+ "version": "4.2.11",
+ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
+ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/graceful-readlink": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz",
+ "integrity": "sha512-8tLu60LgxF6XpdbK8OW3FA+IfTNBn1ZHGHKF4KQbEeSkajYw5PlYJcKluntgegDPTg8UkHjpet1T82vk6TQ68w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/growly": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/growly/-/growly-1.3.0.tgz",
+ "integrity": "sha512-+xGQY0YyAWCnqy7Cd++hc2JqMYzlm0dG30Jd0beaA64sROr8C4nt8Yc9V5Ro3avlSUDTN0ulqP/VBKi1/lLygw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/hasown": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
+ "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/hookable": {
+ "version": "5.5.3",
+ "resolved": "https://registry.npmjs.org/hookable/-/hookable-5.5.3.tgz",
+ "integrity": "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/html-escaper": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
+ "integrity": "sha512-RuMffC89BOWQoY0WKGpIhn5gX3iI54O6nRA0yC124NYVtzjmFWBIiFd8M0x+ZdX0P9R4lADg1mgP8C7PxGOWuQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/htmlparser2": {
+ "version": "10.1.0",
+ "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-10.1.0.tgz",
+ "integrity": "sha512-VTZkM9GWRAtEpveh7MSF6SjjrpNVNNVJfFup7xTY3UpFtm67foy9HDVXneLtFVt4pMz5kZtgNcvCniNFb1hlEQ==",
+ "dev": true,
+ "funding": [
+ "https://github.com/fb55/htmlparser2?sponsor=1",
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fb55"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "domelementtype": "^2.3.0",
+ "domhandler": "^5.0.3",
+ "domutils": "^3.2.2",
+ "entities": "^7.0.1"
+ }
+ },
+ "node_modules/htmlparser2/node_modules/entities": {
+ "version": "7.0.1",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-7.0.1.tgz",
+ "integrity": "sha512-TWrgLOFUQTH994YUyl1yT4uyavY5nNB5muff+RtWaqNVCAK408b5ZnnbNAUEWLTCpum9w6arT70i1XdQ4UeOPA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
+ "node_modules/human-signals": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz",
+ "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=16.17.0"
+ }
+ },
+ "node_modules/ignore": {
+ "version": "5.3.2",
+ "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
+ "integrity": "sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 4"
+ }
+ },
+ "node_modules/immediate": {
+ "version": "3.0.6",
+ "resolved": "https://registry.npmjs.org/immediate/-/immediate-3.0.6.tgz",
+ "integrity": "sha512-XXOFtyqDjNDAQxVfYxuF7g9Il/IbWmmlQg2MYKOH8ExIT1qg6xc4zyS3HaEEATgs1btfzxq15ciUiY7gjSXRGQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/import-fresh": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.1.tgz",
+ "integrity": "sha512-TR3KfrTZTYLPB6jUjfx6MF9WcWrHL9su5TObK4ZkYgBdWKPOFoSoQIdEuTuR82pmtxH2spWG9h6etwfr1pLBqQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "parent-module": "^1.0.0",
+ "resolve-from": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/import-meta-resolve": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.2.0.tgz",
+ "integrity": "sha512-Iqv2fzaTQN28s/FwZAoFq0ZSs/7hMAHJVX+w8PZl3cY19Pxk6jFFalxQoIfW2826i/fDLXv8IiEZRIT0lDuWcg==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "type": "github",
+ "url": "https://github.com/sponsors/wooorm"
+ }
+ },
+ "node_modules/imurmurhash": {
+ "version": "0.1.4",
+ "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz",
+ "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.8.19"
+ }
+ },
+ "node_modules/inherits": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
+ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/ini": {
+ "version": "4.1.3",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-4.1.3.tgz",
+ "integrity": "sha512-X7rqawQBvfdjS10YU1y1YVreA3SsLrW9dX2CewP2EbBJM4ypVNLDkO5y04gejPwKIY9lR+7r9gn3rFPt/kmWFg==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
+ "node_modules/is-absolute": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/is-absolute/-/is-absolute-0.1.7.tgz",
+ "integrity": "sha512-Xi9/ZSn4NFapG8RP98iNPMOeaV3mXPisxKxzKtHVqr3g56j/fBn+yZmnxSVAA8lmZbl2J9b/a4kJvfU3hqQYgA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-relative": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-arrayish": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz",
+ "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/is-binary-path": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz",
+ "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "binary-extensions": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/is-core-module": {
+ "version": "2.16.2",
+ "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.16.2.tgz",
+ "integrity": "sha512-evOr8xfXKxE6qSR0hSXL2r3sd7ALj8+7jQEUvPYcm5sgZFdJ+AYzT6yNmJenvIYQBgIGwfwz08sL8zoL7yq2BA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "hasown": "^2.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/is-docker": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-3.0.0.tgz",
+ "integrity": "sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "is-docker": "cli.js"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-extglob": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz",
+ "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-fullwidth-code-point": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-4.0.0.tgz",
+ "integrity": "sha512-O4L094N2/dZ7xqVdrXhh9r1KODPJpFms8B5sGdJLPy664AgvXsreZUyCQQNItZRDlYug4xStLjNp/sz3HvBowQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-glob": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz",
+ "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-extglob": "^2.1.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-in-ci": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-in-ci/-/is-in-ci-1.0.0.tgz",
+ "integrity": "sha512-eUuAjybVTHMYWm/U+vBO1sY/JOCgoPCXRxzdju0K+K0BiGW0SChEL1MLC0PoCIR1OlPo5YAp8HuQoUlsWEICwg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "is-in-ci": "cli.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-inside-container": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-inside-container/-/is-inside-container-1.0.0.tgz",
+ "integrity": "sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-docker": "^3.0.0"
+ },
+ "bin": {
+ "is-inside-container": "cli.js"
+ },
+ "engines": {
+ "node": ">=14.16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-installed-globally": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/is-installed-globally/-/is-installed-globally-1.0.0.tgz",
+ "integrity": "sha512-K55T22lfpQ63N4KEN57jZUAaAYqYHEe8veb/TycJRk9DdSCLLcovXz/mL6mOnhQaZsQGwPhuFopdQIlqGSEjiQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "global-directory": "^4.0.1",
+ "is-path-inside": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-interactive": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz",
+ "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-npm": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/is-npm/-/is-npm-6.1.0.tgz",
+ "integrity": "sha512-O2z4/kNgyjhQwVR1Wpkbfc19JIhggF97NZNCpWTnjH7kVcZMUrnut9XSN7txI7VdyIYk5ZatOq3zvSuWpU8hoA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-number": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz",
+ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.12.0"
+ }
+ },
+ "node_modules/is-path-inside": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-4.0.0.tgz",
+ "integrity": "sha512-lJJV/5dYS+RcL8uQdBDW9c9uWFLLBNRyFhnAKXw5tVqLlKZ4RMGZKv+YQ/IA3OhD+RpbJa1LLFM1FQPGyIXvOA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-plain-object": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
+ "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "isobject": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-potential-custom-element-name": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz",
+ "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/is-primitive": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-3.0.1.tgz",
+ "integrity": "sha512-GljRxhWvlCNRfZyORiH77FwdFwGcMO620o37EOYC0ORWdq+WYNVqW0w2Juzew4M+L81l6/QS3t5gkkihyRqv9w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-relative": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/is-relative/-/is-relative-0.1.3.tgz",
+ "integrity": "sha512-wBOr+rNM4gkAZqoLRJI4myw5WzzIdQosFAAbnvfXP5z1LyzgAI3ivOKehC5KfqlQJZoihVhirgtCBj378Eg8GA==",
+ "dev": true,
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/is-stream": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-3.0.0.tgz",
+ "integrity": "sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-unicode-supported": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-2.1.0.tgz",
+ "integrity": "sha512-mE00Gnza5EEB3Ds0HfMyllZzbBrmLOX3vfWoj9A9PEnTfratQ/BcaJOuMhnkhjXvb2+FkY3VuHqtAGpTPmglFQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/is-wsl": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-3.1.1.tgz",
+ "integrity": "sha512-e6rvdUCiQCAuumZslxRJWR/Doq4VpPR82kqclvcS0efgt430SlGIk05vdCN58+VrzgtIcfNODjozVielycD4Sw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-inside-container": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/isarray": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
+ "integrity": "sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/isexe": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
+ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/isobject": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
+ "integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/jiti": {
+ "version": "1.21.7",
+ "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz",
+ "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "jiti": "bin/jiti.js"
+ }
+ },
+ "node_modules/js-tokens": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
+ "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==",
+ "license": "MIT"
+ },
+ "node_modules/js-yaml": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.2.0.tgz",
+ "integrity": "sha512-ePWsvanv0DWuDRsW8dnt+R4jQ31SCRCQ7hhNcPXZPsoBZiemuZNYGf7adZdqX2D86j6rvKp3RpCxVTSb8WQlOw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/puzrin"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/nodeca"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "argparse": "^2.0.1"
+ },
+ "bin": {
+ "js-yaml": "bin/js-yaml.js"
+ }
+ },
+ "node_modules/jsesc": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
+ "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "jsesc": "bin/jsesc"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/json-buffer": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/json-buffer/-/json-buffer-3.0.1.tgz",
+ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/json-parse-even-better-errors": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-3.0.2.tgz",
+ "integrity": "sha512-fi0NG4bPjCHunUJffmLd0gxssIgkNmArMvis4iNah6Owg1MCJjWhEcDLmsK6iGkJq3tHwbDkTlce70/tmXN4cQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
+ },
+ "node_modules/json-schema-traverse": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
+ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/json-stable-stringify-without-jsonify": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
+ "integrity": "sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/json5": {
+ "version": "2.2.3",
+ "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz",
+ "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "json5": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/jsonfile": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.2.1.tgz",
+ "integrity": "sha512-zwOTdL3rFQ/lRdBnntKVOX6k5cKJwEc1HdilT71BWEu7J41gXIB2MRp+vxduPSwZJPWBxEzv4yH1wYLJGUHX4Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "universalify": "^2.0.0"
+ },
+ "optionalDependencies": {
+ "graceful-fs": "^4.1.6"
+ }
+ },
+ "node_modules/jszip": {
+ "version": "3.10.1",
+ "resolved": "https://registry.npmjs.org/jszip/-/jszip-3.10.1.tgz",
+ "integrity": "sha512-xXDvecyTpGLrqFrvkrUSoxxfJI5AH7U8zxxtVclpsUtMCq4JQ290LY8AW5c7Ggnr/Y/oK+bQMbqK2qmtk3pN4g==",
+ "dev": true,
+ "license": "(MIT OR GPL-3.0-or-later)",
+ "dependencies": {
+ "lie": "~3.3.0",
+ "pako": "~1.0.2",
+ "readable-stream": "~2.3.6",
+ "setimmediate": "^1.0.5"
+ }
+ },
+ "node_modules/keyv": {
+ "version": "4.5.4",
+ "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz",
+ "integrity": "sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "json-buffer": "3.0.1"
+ }
+ },
+ "node_modules/kleur": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz",
+ "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/ky": {
+ "version": "1.14.3",
+ "resolved": "https://registry.npmjs.org/ky/-/ky-1.14.3.tgz",
+ "integrity": "sha512-9zy9lkjac+TR1c2tG+mkNSVlyOpInnWdSMiue4F+kq8TwJSgv6o8jhLRg8Ho6SnZ9wOYUq/yozts9qQCfk7bIw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/ky?sponsor=1"
+ }
+ },
+ "node_modules/latest-version": {
+ "version": "9.0.0",
+ "resolved": "https://registry.npmjs.org/latest-version/-/latest-version-9.0.0.tgz",
+ "integrity": "sha512-7W0vV3rqv5tokqkBAFV1LbR7HPOWzXQDpDgEuib/aJ1jsZZx6x3c2mBI+TJhJzOhkGeaLbCKEHXEXLfirtG2JA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "package-json": "^10.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/levn": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz",
+ "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1",
+ "type-check": "~0.4.0"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/lie": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
+ "integrity": "sha512-UaiMJzeWRlEujzAuw5LokY1L5ecNQYZKfmyZ9L7wDHb/p5etKaxXhohBcrw0EYby+G/NA52vRSN4N39dxHAIwQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "immediate": "~3.0.5"
+ }
+ },
+ "node_modules/lighthouse-logger": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/lighthouse-logger/-/lighthouse-logger-2.0.2.tgz",
+ "integrity": "sha512-vWl2+u5jgOQuZR55Z1WM0XDdrJT6mzMP8zHUct7xTlWhuQs+eV0g+QL0RQdFjT54zVmbhLCP8vIVpy1wGn/gCg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "debug": "^4.4.1",
+ "marky": "^1.2.2"
+ }
+ },
+ "node_modules/lilconfig": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.3.tgz",
+ "integrity": "sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/antonk52"
+ }
+ },
+ "node_modules/lines-and-columns": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz",
+ "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/linkedom": {
+ "version": "0.18.12",
+ "resolved": "https://registry.npmjs.org/linkedom/-/linkedom-0.18.12.tgz",
+ "integrity": "sha512-jalJsOwIKuQJSeTvsgzPe9iJzyfVaEJiEXl+25EkKevsULHvMJzpNqwvj1jOESWdmgKDiXObyjOYwlUqG7wo1Q==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "css-select": "^5.1.0",
+ "cssom": "^0.5.0",
+ "html-escaper": "^3.0.3",
+ "htmlparser2": "^10.0.0",
+ "uhyphen": "^0.2.0"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "peerDependencies": {
+ "canvas": ">= 2"
+ },
+ "peerDependenciesMeta": {
+ "canvas": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/listr2": {
+ "version": "8.3.3",
+ "resolved": "https://registry.npmjs.org/listr2/-/listr2-8.3.3.tgz",
+ "integrity": "sha512-LWzX2KsqcB1wqQ4AHgYb4RsDXauQiqhjLk+6hjbaeHG4zpjjVAB6wC/gz6X0l+Du1cN3pUB5ZlrvTbhGSNnUQQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cli-truncate": "^4.0.0",
+ "colorette": "^2.0.20",
+ "eventemitter3": "^5.0.1",
+ "log-update": "^6.1.0",
+ "rfdc": "^1.4.1",
+ "wrap-ansi": "^9.0.0"
+ },
+ "engines": {
+ "node": ">=18.0.0"
+ }
+ },
+ "node_modules/local-pkg": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-1.2.1.tgz",
+ "integrity": "sha512-++gUqRDEvcnN6Zhqrr+y/CkVEHhlrR96vZn3nZZPYzMcBUyBtTKzB9NadClFIsIVSsu+3i9tfk/erqy9kAmt7Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "mlly": "^1.7.4",
+ "pkg-types": "^2.3.0",
+ "quansync": "^0.2.11"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/antfu"
+ }
+ },
+ "node_modules/locate-path": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
+ "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-locate": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/lodash.merge": {
+ "version": "4.6.2",
+ "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz",
+ "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/log-symbols": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-6.0.0.tgz",
+ "integrity": "sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "chalk": "^5.3.0",
+ "is-unicode-supported": "^1.3.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/log-symbols/node_modules/chalk": {
+ "version": "5.6.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
+ "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/log-symbols/node_modules/is-unicode-supported": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz",
+ "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/log-update": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz",
+ "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-escapes": "^7.0.0",
+ "cli-cursor": "^5.0.0",
+ "slice-ansi": "^7.1.0",
+ "strip-ansi": "^7.1.0",
+ "wrap-ansi": "^9.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/log-update/node_modules/ansi-styles": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/log-update/node_modules/is-fullwidth-code-point": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz",
+ "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "get-east-asian-width": "^1.3.1"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/log-update/node_modules/slice-ansi": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz",
+ "integrity": "sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.2.1",
+ "is-fullwidth-code-point": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/slice-ansi?sponsor=1"
+ }
+ },
+ "node_modules/loose-envify": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
+ "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==",
+ "license": "MIT",
+ "dependencies": {
+ "js-tokens": "^3.0.0 || ^4.0.0"
+ },
+ "bin": {
+ "loose-envify": "cli.js"
+ }
+ },
+ "node_modules/lru-cache": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
+ "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^3.0.2"
+ }
+ },
+ "node_modules/magic-string": {
+ "version": "0.30.21",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
+ "integrity": "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/sourcemap-codec": "^1.5.5"
+ }
+ },
+ "node_modules/magicast": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/magicast/-/magicast-0.3.5.tgz",
+ "integrity": "sha512-L0WhttDl+2BOsybvEOLK7fW3UA0OQ0IQ2d6Zl2x/a6vVRs3bAY0ECOSHHeL5jD+SbOpOCUEi0y1DgHEn9Qn1AQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/parser": "^7.25.4",
+ "@babel/types": "^7.25.4",
+ "source-map-js": "^1.2.0"
+ }
+ },
+ "node_modules/make-error": {
+ "version": "1.3.6",
+ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
+ "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/many-keys-map": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/many-keys-map/-/many-keys-map-3.0.3.tgz",
+ "integrity": "sha512-1DiZmDHPXMBgMRjeUtHy1q1VYmeJscHxhIAexX9z/zjRMP80+0ETuPfssi8z+kMY4DwUgsKuHqpjxgmeA9gBNA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/fregante"
+ }
+ },
+ "node_modules/marky": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/marky/-/marky-1.3.0.tgz",
+ "integrity": "sha512-ocnPZQLNpvbedwTy9kNrQEsknEfgvcLMvOtz3sFeWApDq1MXH1TqkCIx58xlpESsfwQOnuBO9beyQuNGzVvuhQ==",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
+ "node_modules/merge-stream": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
+ "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/merge2": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz",
+ "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/micromatch": {
+ "version": "4.0.8",
+ "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz",
+ "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "braces": "^3.0.3",
+ "picomatch": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=8.6"
+ }
+ },
+ "node_modules/mimic-fn": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
+ "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/mimic-function": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/mimic-function/-/mimic-function-5.0.1.tgz",
+ "integrity": "sha512-VP79XUPxV2CigYP3jWwAUFSku2aKqBH7uTAapFWCBqutsbmDo96KY5o8uh6U+/YSIn5OxJnXp73beVkpqMIGhA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/minimatch": {
+ "version": "3.1.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
+ "integrity": "sha512-VgjWUsnnT6n+NUk6eZq77zeFdpW2LWDzP6zFGrCbHXiYNul5Dzqk2HHQ5uFH2DNW5Xbp8+jVzaeNt94ssEEl4w==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^1.1.7"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/minimist": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.8.tgz",
+ "integrity": "sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/minipass": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz",
+ "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/minizlib": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz",
+ "integrity": "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "minipass": "^3.0.0",
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/minizlib/node_modules/minipass": {
+ "version": "3.3.6",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz",
+ "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/minizlib/node_modules/yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/mkdirp": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz",
+ "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "mkdirp": "bin/cmd.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/mlly": {
+ "version": "1.8.2",
+ "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.8.2.tgz",
+ "integrity": "sha512-d+ObxMQFmbt10sretNDytwt85VrbkhhUA/JBGm1MPaWJ65Cl4wOgLaB1NYvJSZ0Ef03MMEU/0xpPMXUIQ29UfA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "acorn": "^8.16.0",
+ "pathe": "^2.0.3",
+ "pkg-types": "^1.3.1",
+ "ufo": "^1.6.3"
+ }
+ },
+ "node_modules/mlly/node_modules/confbox": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
+ "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/mlly/node_modules/pkg-types": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz",
+ "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "confbox": "^0.1.8",
+ "mlly": "^1.7.4",
+ "pathe": "^2.0.1"
+ }
+ },
+ "node_modules/ms": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
+ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/multimatch": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-6.0.0.tgz",
+ "integrity": "sha512-I7tSVxHGPlmPN/enE3mS1aOSo6bWBfls+3HmuEeCUBCE7gWnm3cBXCBkpurzFjVRwC6Kld8lLaZ1Iv5vOcjvcQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/minimatch": "^3.0.5",
+ "array-differ": "^4.0.0",
+ "array-union": "^3.0.1",
+ "minimatch": "^3.0.4"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/mz": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz",
+ "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0",
+ "object-assign": "^4.0.1",
+ "thenify-all": "^1.0.0"
+ }
+ },
+ "node_modules/nano-spawn": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/nano-spawn/-/nano-spawn-0.2.1.tgz",
+ "integrity": "sha512-/pULofvsF8mOVcl/nUeVXL/GYOEvc7eJWSIxa+K4OYUolvXa5zwSgevsn4eoHs1xvh/BO3vx/PZiD9+Ow2ZVuw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.19"
+ },
+ "funding": {
+ "url": "https://github.com/sindresorhus/nano-spawn?sponsor=1"
+ }
+ },
+ "node_modules/nanoid": {
+ "version": "3.3.12",
+ "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.12.tgz",
+ "integrity": "sha512-ZB9RH/39qpq5Vu6Y+NmUaFhQR6pp+M2Xt76XBnEwDaGcVAqhlvxrl3B2bKS5D3NH3QR76v3aSrKaF/Kiy7lEtQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "bin": {
+ "nanoid": "bin/nanoid.cjs"
+ },
+ "engines": {
+ "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
+ }
+ },
+ "node_modules/natural-compare": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz",
+ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/node-fetch-native": {
+ "version": "1.6.7",
+ "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.7.tgz",
+ "integrity": "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/node-forge": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-1.4.0.tgz",
+ "integrity": "sha512-LarFH0+6VfriEhqMMcLX2F7SwSXeWwnEAJEsYm5QKWchiVYVvJyV9v7UDvUv+w5HO23ZpQTXDv/GxdDdMyOuoQ==",
+ "dev": true,
+ "license": "(BSD-3-Clause OR GPL-2.0)",
+ "engines": {
+ "node": ">= 6.13.0"
+ }
+ },
+ "node_modules/node-notifier": {
+ "version": "10.0.1",
+ "resolved": "https://registry.npmjs.org/node-notifier/-/node-notifier-10.0.1.tgz",
+ "integrity": "sha512-YX7TSyDukOZ0g+gmzjB6abKu+hTGvO8+8+gIFDsRCU2t8fLV/P2unmt+LGFaIa4y64aX98Qksa97rgz4vMNeLQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "growly": "^1.3.0",
+ "is-wsl": "^2.2.0",
+ "semver": "^7.3.5",
+ "shellwords": "^0.1.1",
+ "uuid": "^8.3.2",
+ "which": "^2.0.2"
+ }
+ },
+ "node_modules/node-notifier/node_modules/is-docker": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/is-docker/-/is-docker-2.2.1.tgz",
+ "integrity": "sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "is-docker": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/node-notifier/node_modules/is-wsl": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/is-wsl/-/is-wsl-2.2.0.tgz",
+ "integrity": "sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-docker": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/node-notifier/node_modules/semver": {
+ "version": "7.8.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz",
+ "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/node-releases": {
+ "version": "2.0.47",
+ "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.47.tgz",
+ "integrity": "sha512-Uzmd6LXpouKo8EUK68IjH4+E01w/hXyV3R3g/geCJo+rXLNfh1xucB+LOzYEOQPSiUK3h/xZf0cQGcSsmyL2Og==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/normalize-path": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz",
+ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/npm-run-path": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-5.3.0.tgz",
+ "integrity": "sha512-ppwTtiJZq0O/ai0z7yfudtBpWIoxM8yE6nHi1X47eFR2EWORqfbu6CnPlNsjeN683eT0qG6H/Pyf9fCcvjnnnQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "path-key": "^4.0.0"
+ },
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/npm-run-path/node_modules/path-key": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-4.0.0.tgz",
+ "integrity": "sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/nth-check": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.1.1.tgz",
+ "integrity": "sha512-lqjrjmaOoAnWfMmBPL+XNnynZh2+swxiX3WUE0s4yEHI6m+AwrK2UZOimIRl3X/4QctVqS8AiZjFqyOGrMXb/w==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "boolbase": "^1.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/nth-check?sponsor=1"
+ }
+ },
+ "node_modules/nypm": {
+ "version": "0.3.12",
+ "resolved": "https://registry.npmjs.org/nypm/-/nypm-0.3.12.tgz",
+ "integrity": "sha512-D3pzNDWIvgA+7IORhD/IuWzEk4uXv6GsgOxiid4UU3h9oq5IqV1KtPDi63n4sZJ/xcWlr88c0QM2RgN5VbOhFA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "citty": "^0.1.6",
+ "consola": "^3.2.3",
+ "execa": "^8.0.1",
+ "pathe": "^1.1.2",
+ "pkg-types": "^1.2.0",
+ "ufo": "^1.5.4"
+ },
+ "bin": {
+ "nypm": "dist/cli.mjs"
+ },
+ "engines": {
+ "node": "^14.16.0 || >=16.10.0"
+ }
+ },
+ "node_modules/nypm/node_modules/confbox": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
+ "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/nypm/node_modules/pathe": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
+ "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/nypm/node_modules/pkg-types": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz",
+ "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "confbox": "^0.1.8",
+ "mlly": "^1.7.4",
+ "pathe": "^2.0.1"
+ }
+ },
+ "node_modules/nypm/node_modules/pkg-types/node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/object-hash": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz",
+ "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/ofetch": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/ofetch/-/ofetch-1.5.1.tgz",
+ "integrity": "sha512-2W4oUZlVaqAPAil6FUg/difl6YhqhUR7x2eZY4bQCko22UXg3hptq9KLQdqFClV+Wu85UX7hNtdGTngi/1BxcA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "destr": "^2.0.5",
+ "node-fetch-native": "^1.6.7",
+ "ufo": "^1.6.1"
+ }
+ },
+ "node_modules/ohash": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/ohash/-/ohash-1.1.6.tgz",
+ "integrity": "sha512-TBu7PtV8YkAZn0tSxobKY2n2aAQva936lhRrj6957aDaCf9IEtqsKbgMzXE/F/sjqYOwmrukeORHNLe5glk7Cg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/on-exit-leak-free": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz",
+ "integrity": "sha512-0eJJY6hXLGf1udHwfNftBqH+g73EU4B504nZeKpz1sYRKafAghwxEJunB2O7rDZkL4PGfsMVnTXZ2EjibbqcsA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/onetime": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz",
+ "integrity": "sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "mimic-fn": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/open": {
+ "version": "10.2.0",
+ "resolved": "https://registry.npmjs.org/open/-/open-10.2.0.tgz",
+ "integrity": "sha512-YgBpdJHPyQ2UE5x+hlSXcnejzAvD0b22U2OuAP+8OnlJT+PjWPxtgmGqKKc+RgTM63U9gN0YzrYc71R2WT/hTA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "default-browser": "^5.2.1",
+ "define-lazy-prop": "^3.0.0",
+ "is-inside-container": "^1.0.0",
+ "wsl-utils": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/optionator": {
+ "version": "0.9.4",
+ "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.4.tgz",
+ "integrity": "sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "deep-is": "^0.1.3",
+ "fast-levenshtein": "^2.0.6",
+ "levn": "^0.4.1",
+ "prelude-ls": "^1.2.1",
+ "type-check": "^0.4.0",
+ "word-wrap": "^1.2.5"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/ora": {
+ "version": "8.2.0",
+ "resolved": "https://registry.npmjs.org/ora/-/ora-8.2.0.tgz",
+ "integrity": "sha512-weP+BZ8MVNnlCm8c0Qdc1WSWq4Qn7I+9CJGm7Qali6g44e/PUzbjNqJX5NJ9ljlNMosfJvg1fKEGILklK9cwnw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "chalk": "^5.3.0",
+ "cli-cursor": "^5.0.0",
+ "cli-spinners": "^2.9.2",
+ "is-interactive": "^2.0.0",
+ "is-unicode-supported": "^2.0.0",
+ "log-symbols": "^6.0.0",
+ "stdin-discarder": "^0.2.2",
+ "string-width": "^7.2.0",
+ "strip-ansi": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/ora/node_modules/chalk": {
+ "version": "5.6.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
+ "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/os-shim": {
+ "version": "0.1.3",
+ "resolved": "https://registry.npmjs.org/os-shim/-/os-shim-0.1.3.tgz",
+ "integrity": "sha512-jd0cvB8qQ5uVt0lvCIexBaROw1KyKm5sbulg2fWOHjETisuCzWyt+eTZKEMs8v6HwzoGs8xik26jg7eCM6pS+A==",
+ "dev": true,
+ "engines": {
+ "node": ">= 0.4.0"
+ }
+ },
+ "node_modules/p-limit": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz",
+ "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "yocto-queue": "^0.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/p-locate": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz",
+ "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "p-limit": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/package-json": {
+ "version": "10.0.1",
+ "resolved": "https://registry.npmjs.org/package-json/-/package-json-10.0.1.tgz",
+ "integrity": "sha512-ua1L4OgXSBdsu1FPb7F3tYH0F48a6kxvod4pLUlGY9COeJAJQNX/sNH2IiEmsxw7lqYiAwrdHMjz1FctOsyDQg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ky": "^1.2.0",
+ "registry-auth-token": "^5.0.2",
+ "registry-url": "^6.0.1",
+ "semver": "^7.6.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/package-json/node_modules/semver": {
+ "version": "7.8.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz",
+ "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/pako": {
+ "version": "1.0.11",
+ "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.11.tgz",
+ "integrity": "sha512-4hLB8Py4zZce5s4yd9XzopqwVv/yGNhV1Bl8NTmCq1763HeK2+EwVTv+leGeL13Dnh2wfbqowVPXCIO0z4taYw==",
+ "dev": true,
+ "license": "(MIT AND Zlib)"
+ },
+ "node_modules/parent-module": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz",
+ "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "callsites": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/parse-json": {
+ "version": "7.1.1",
+ "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-7.1.1.tgz",
+ "integrity": "sha512-SgOTCX/EZXtZxBE5eJ97P4yGM5n37BwRU+YMsH4vNzFqJV/oWFXXCmwFlgWUM4PrakybVOueJJ6pwHqSVhTFDw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.21.4",
+ "error-ex": "^1.3.2",
+ "json-parse-even-better-errors": "^3.0.0",
+ "lines-and-columns": "^2.0.3",
+ "type-fest": "^3.8.0"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/parse-json/node_modules/lines-and-columns": {
+ "version": "2.0.4",
+ "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-2.0.4.tgz",
+ "integrity": "sha512-wM1+Z03eypVAVUCE7QdSqpVIvelbOakn1M0bPDoA4SGWPx3sNDVUiMo3L6To6WWGClB7VyXnhQ4Sn7gxiJbE6A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0"
+ }
+ },
+ "node_modules/path-exists": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
+ "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-key": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz",
+ "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/path-parse": {
+ "version": "1.0.7",
+ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
+ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/perfect-debounce": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
+ "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/picocolors": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
+ "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/picomatch": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz",
+ "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/pify": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz",
+ "integrity": "sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/pino": {
+ "version": "9.7.0",
+ "resolved": "https://registry.npmjs.org/pino/-/pino-9.7.0.tgz",
+ "integrity": "sha512-vnMCM6xZTb1WDmLvtG2lE/2p+t9hDEIvTWJsu6FejkE62vB7gDhvzrpFR4Cw2to+9JNQxVnkAKVPA1KPB98vWg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "atomic-sleep": "^1.0.0",
+ "fast-redact": "^3.1.1",
+ "on-exit-leak-free": "^2.1.0",
+ "pino-abstract-transport": "^2.0.0",
+ "pino-std-serializers": "^7.0.0",
+ "process-warning": "^5.0.0",
+ "quick-format-unescaped": "^4.0.3",
+ "real-require": "^0.2.0",
+ "safe-stable-stringify": "^2.3.1",
+ "sonic-boom": "^4.0.1",
+ "thread-stream": "^3.0.0"
+ },
+ "bin": {
+ "pino": "bin.js"
+ }
+ },
+ "node_modules/pino-abstract-transport": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/pino-abstract-transport/-/pino-abstract-transport-2.0.0.tgz",
+ "integrity": "sha512-F63x5tizV6WCh4R6RHyi2Ml+M70DNRXt/+HANowMflpgGFMAym/VKm6G7ZOQRjqN7XbGxK1Lg9t6ZrtzOaivMw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "split2": "^4.0.0"
+ }
+ },
+ "node_modules/pino-std-serializers": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/pino-std-serializers/-/pino-std-serializers-7.1.0.tgz",
+ "integrity": "sha512-BndPH67/JxGExRgiX1dX0w1FvZck5Wa4aal9198SrRhZjH3GxKQUKIBnYJTdj2HDN3UQAS06HlfcSbQj2OHmaw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/pirates": {
+ "version": "4.0.7",
+ "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz",
+ "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/pkg-types": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.3.1.tgz",
+ "integrity": "sha512-y+ichcgc2LrADuhLNAx8DFjVfgz91pRxfZdI3UDhxHvcVEZsenLO+7XaU5vOp0u/7V/wZ+plyuQxtrDlZJ+yeg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "confbox": "^0.2.4",
+ "exsolve": "^1.0.8",
+ "pathe": "^2.0.3"
+ }
+ },
+ "node_modules/postcss": {
+ "version": "8.5.15",
+ "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz",
+ "integrity": "sha512-FfR8sjd4em2T6fb3I2MwAJU7HWVMr9zba+enmQeeWFfCbm+UOC/0X4DS8XtpUTMwWMGbjKYP7xjfNekzyGmB3A==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/postcss"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "nanoid": "^3.3.12",
+ "picocolors": "^1.1.1",
+ "source-map-js": "^1.2.1"
+ },
+ "engines": {
+ "node": "^10 || ^12 || >=14"
+ }
+ },
+ "node_modules/postcss-import": {
+ "version": "15.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz",
+ "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "postcss-value-parser": "^4.0.0",
+ "read-cache": "^1.0.0",
+ "resolve": "^1.1.7"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ },
+ "peerDependencies": {
+ "postcss": "^8.0.0"
+ }
+ },
+ "node_modules/postcss-js": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz",
+ "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "camelcase-css": "^2.0.1"
+ },
+ "engines": {
+ "node": "^12 || ^14 || >= 16"
+ },
+ "peerDependencies": {
+ "postcss": "^8.4.21"
+ }
+ },
+ "node_modules/postcss-load-config": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz",
+ "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "lilconfig": "^3.1.1"
+ },
+ "engines": {
+ "node": ">= 18"
+ },
+ "peerDependencies": {
+ "jiti": ">=1.21.0",
+ "postcss": ">=8.0.9",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "jiti": {
+ "optional": true
+ },
+ "postcss": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/postcss-nested": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz",
+ "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/postcss/"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "postcss-selector-parser": "^6.1.1"
+ },
+ "engines": {
+ "node": ">=12.0"
+ },
+ "peerDependencies": {
+ "postcss": "^8.2.14"
+ }
+ },
+ "node_modules/postcss-selector-parser": {
+ "version": "6.1.2",
+ "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.2.tgz",
+ "integrity": "sha512-Q8qQfPiZ+THO/3ZrOrO0cJJKfpYCagtMUkXbnEfmgUjwXg6z/WBeOyS9APBBPCTSiDV+s4SwQGu8yFsiMRIudg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cssesc": "^3.0.0",
+ "util-deprecate": "^1.0.2"
+ },
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/postcss-value-parser": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz",
+ "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/prelude-ls": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz",
+ "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/prettier": {
+ "version": "3.8.3",
+ "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.8.3.tgz",
+ "integrity": "sha512-7igPTM53cGHMW8xWuVTydi2KO233VFiTNyF5hLJqpilHfmn8C8gPf+PS7dUT64YcXFbiMGZxS9pCSxL/Dxm/Jw==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "prettier": "bin/prettier.cjs"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/prettier/prettier?sponsor=1"
+ }
+ },
+ "node_modules/process-nextick-args": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
+ "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/process-warning": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/process-warning/-/process-warning-5.0.0.tgz",
+ "integrity": "sha512-a39t9ApHNx2L4+HBnQKqxxHNs1r7KF+Intd8Q/g1bUh6q0WIp9voPXJ/x0j+ZL45KF1pJd9+q2jLIRMfvEshkA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/fastify"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/fastify"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/promise-toolbox": {
+ "version": "0.21.0",
+ "resolved": "https://registry.npmjs.org/promise-toolbox/-/promise-toolbox-0.21.0.tgz",
+ "integrity": "sha512-NV8aTmpwrZv+Iys54sSFOBx3tuVaOBvvrft5PNppnxy9xpU/akHbaWIril22AB22zaPgrgwKdD0KsrM0ptUtpg==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "make-error": "^1.3.2"
+ },
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/prompts": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz",
+ "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "kleur": "^3.0.3",
+ "sisteransi": "^1.0.5"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/proto-list": {
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz",
+ "integrity": "sha512-vtK/94akxsTMhe0/cbfpR+syPuszcuwhqVjJq26CuNDgFGj682oRBXOP5MJpv2r7JtE8MsiepGIqvvOTBwn2vA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/publish-browser-extension": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/publish-browser-extension/-/publish-browser-extension-3.0.3.tgz",
+ "integrity": "sha512-cBINZCkLo7YQaGoUvEHthZ0sDzgJQht28IS+SFMT2omSNhGsPiVNRkWir3qLiTrhGhW9Ci2KVHpA1QAMoBdL2g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cac": "^6.7.14",
+ "consola": "^3.4.2",
+ "dotenv": "^17.2.3",
+ "form-data-encoder": "^4.1.0",
+ "formdata-node": "^6.0.3",
+ "listr2": "^8.3.3",
+ "ofetch": "^1.4.1",
+ "zod": "^3.25.76 || ^4.0.0"
+ },
+ "bin": {
+ "publish-extension": "bin/publish-extension.cjs"
+ }
+ },
+ "node_modules/publish-browser-extension/node_modules/dotenv": {
+ "version": "17.4.2",
+ "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.4.2.tgz",
+ "integrity": "sha512-nI4U3TottKAcAD9LLud4Cb7b2QztQMUEfHbvhTH09bqXTxnSie8WnjPALV/WMCrJZ6UV/qHJ6L03OqO3LcdYZw==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://dotenvx.com"
+ }
+ },
+ "node_modules/punycode": {
+ "version": "2.3.1",
+ "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz",
+ "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
+ "node_modules/pupa": {
+ "version": "3.3.0",
+ "resolved": "https://registry.npmjs.org/pupa/-/pupa-3.3.0.tgz",
+ "integrity": "sha512-LjgDO2zPtoXP2wJpDjZrGdojii1uqO0cnwKoIoUzkfS98HDmbeiGmYiXo3lXeFlq2xvne1QFQhwYXSUCLKtEuA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "escape-goat": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=12.20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/quansync": {
+ "version": "0.2.11",
+ "resolved": "https://registry.npmjs.org/quansync/-/quansync-0.2.11.tgz",
+ "integrity": "sha512-AifT7QEbW9Nri4tAwR5M/uzpBuqfZf+zwaEM/QkzEjj7NBuFD2rBuy0K3dE+8wltbezDV7JMA0WfnCPYRSYbXA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/antfu"
+ },
+ {
+ "type": "individual",
+ "url": "https://github.com/sponsors/sxzz"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/queue-microtask": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
+ "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT"
+ },
+ "node_modules/quick-format-unescaped": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/quick-format-unescaped/-/quick-format-unescaped-4.0.4.tgz",
+ "integrity": "sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/rc": {
+ "version": "1.2.8",
+ "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz",
+ "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==",
+ "dev": true,
+ "license": "(BSD-2-Clause OR MIT OR Apache-2.0)",
+ "dependencies": {
+ "deep-extend": "^0.6.0",
+ "ini": "~1.3.0",
+ "minimist": "^1.2.0",
+ "strip-json-comments": "~2.0.1"
+ },
+ "bin": {
+ "rc": "cli.js"
+ }
+ },
+ "node_modules/rc/node_modules/ini": {
+ "version": "1.3.8",
+ "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz",
+ "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/rc/node_modules/strip-json-comments": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz",
+ "integrity": "sha512-4gB8na07fecVVkOI6Rs4e7T6NOTki5EmL7TUduTs6bu3EdnSycntVJ4re8kgZA+wx9IueI2Y11bfbgwtzuE0KQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/rc9": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/rc9/-/rc9-3.0.1.tgz",
+ "integrity": "sha512-gMDyleLWVE+i6Sgtc0QbbY6pEKqYs97NGi6isHQPqYlLemPoO8dxQ3uGi0f4NiP98c+jMW6cG1Kx9dDwfvqARQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "defu": "^6.1.6",
+ "destr": "^2.0.5"
+ }
+ },
+ "node_modules/react": {
+ "version": "18.3.1",
+ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz",
+ "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==",
+ "license": "MIT",
+ "dependencies": {
+ "loose-envify": "^1.1.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/react-dom": {
+ "version": "18.3.1",
+ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz",
+ "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==",
+ "license": "MIT",
+ "dependencies": {
+ "loose-envify": "^1.1.0",
+ "scheduler": "^0.23.2"
+ },
+ "peerDependencies": {
+ "react": "^18.3.1"
+ }
+ },
+ "node_modules/react-refresh": {
+ "version": "0.17.0",
+ "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
+ "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/read-cache": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
+ "integrity": "sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "pify": "^2.3.0"
+ }
+ },
+ "node_modules/readable-stream": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.8.tgz",
+ "integrity": "sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "core-util-is": "~1.0.0",
+ "inherits": "~2.0.3",
+ "isarray": "~1.0.0",
+ "process-nextick-args": "~2.0.0",
+ "safe-buffer": "~5.1.1",
+ "string_decoder": "~1.1.1",
+ "util-deprecate": "~1.0.1"
+ }
+ },
+ "node_modules/readdirp": {
+ "version": "3.6.0",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz",
+ "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "picomatch": "^2.2.1"
+ },
+ "engines": {
+ "node": ">=8.10.0"
+ }
+ },
+ "node_modules/real-require": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/real-require/-/real-require-0.2.0.tgz",
+ "integrity": "sha512-57frrGM/OCTLqLOAh0mhVA9VBMHd+9U7Zb2THMGdBUoZVOtGbJzjxsYGDJ3A9AYYCP4hn6y1TVbaOfzWtm5GFg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 12.13.0"
+ }
+ },
+ "node_modules/registry-auth-token": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.1.1.tgz",
+ "integrity": "sha512-P7B4+jq8DeD2nMsAcdfaqHbssgHtZ7Z5+++a5ask90fvmJ8p5je4mOa+wzu+DB4vQ5tdJV/xywY+UnVFeQLV5Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@pnpm/npm-conf": "^3.0.2"
+ },
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/registry-url": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/registry-url/-/registry-url-6.0.1.tgz",
+ "integrity": "sha512-+crtS5QjFRqFCoQmvGduwYWEBng99ZvmFvF+cUJkGYF1L1BfU8C6Zp9T7f5vPAwyLkUExpvK+ANVZmGU49qi4Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "rc": "1.2.8"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/resolve": {
+ "version": "1.22.12",
+ "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.12.tgz",
+ "integrity": "sha512-TyeJ1zif53BPfHootBGwPRYT1RUt6oGWsaQr8UyZW/eAm9bKoijtvruSDEmZHm92CwS9nj7/fWttqPCgzep8CA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "is-core-module": "^2.16.1",
+ "path-parse": "^1.0.7",
+ "supports-preserve-symlinks-flag": "^1.0.0"
+ },
+ "bin": {
+ "resolve": "bin/resolve"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/resolve-from": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz",
+ "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
+ "node_modules/restore-cursor": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-5.1.0.tgz",
+ "integrity": "sha512-oMA2dcrw6u0YfxJQXm342bFKX/E4sG9rbTzO9ptUcR/e8A33cHuvStiYOwH7fszkZlZ1z/ta9AAoPk2F4qIOHA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "onetime": "^7.0.0",
+ "signal-exit": "^4.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/restore-cursor/node_modules/onetime": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-7.0.0.tgz",
+ "integrity": "sha512-VXJjc87FScF88uafS3JllDgvAm+c/Slfz06lorj2uAY34rlUu0Nt+v8wreiImcrgAjjIHp1rXpTDlLOGw29WwQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "mimic-function": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/reusify": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz",
+ "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "iojs": ">=1.0.0",
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/rfdc": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
+ "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/rollup": {
+ "version": "4.61.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz",
+ "integrity": "sha512-I4KW6iuRpuu2uHBLraZ1wNZe0DP7lnRha+VJ9tNaYVaVgKhW0aI3h4RYnoRPeql0flHm/Co55b7snEDcOfOJrA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/estree": "1.0.9"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.61.1",
+ "@rollup/rollup-android-arm64": "4.61.1",
+ "@rollup/rollup-darwin-arm64": "4.61.1",
+ "@rollup/rollup-darwin-x64": "4.61.1",
+ "@rollup/rollup-freebsd-arm64": "4.61.1",
+ "@rollup/rollup-freebsd-x64": "4.61.1",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.61.1",
+ "@rollup/rollup-linux-arm-musleabihf": "4.61.1",
+ "@rollup/rollup-linux-arm64-gnu": "4.61.1",
+ "@rollup/rollup-linux-arm64-musl": "4.61.1",
+ "@rollup/rollup-linux-loong64-gnu": "4.61.1",
+ "@rollup/rollup-linux-loong64-musl": "4.61.1",
+ "@rollup/rollup-linux-ppc64-gnu": "4.61.1",
+ "@rollup/rollup-linux-ppc64-musl": "4.61.1",
+ "@rollup/rollup-linux-riscv64-gnu": "4.61.1",
+ "@rollup/rollup-linux-riscv64-musl": "4.61.1",
+ "@rollup/rollup-linux-s390x-gnu": "4.61.1",
+ "@rollup/rollup-linux-x64-gnu": "4.61.1",
+ "@rollup/rollup-linux-x64-musl": "4.61.1",
+ "@rollup/rollup-openbsd-x64": "4.61.1",
+ "@rollup/rollup-openharmony-arm64": "4.61.1",
+ "@rollup/rollup-win32-arm64-msvc": "4.61.1",
+ "@rollup/rollup-win32-ia32-msvc": "4.61.1",
+ "@rollup/rollup-win32-x64-gnu": "4.61.1",
+ "@rollup/rollup-win32-x64-msvc": "4.61.1",
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/run-applescript": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz",
+ "integrity": "sha512-DPe5pVFaAsinSaV6QjQ6gdiedWDcRCbUuiQfQa2wmWV7+xC9bGulGI8+TdRmoFkAPaBXk8CrAbnlY2ISniJ47Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/run-parallel": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
+ "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/feross"
+ },
+ {
+ "type": "patreon",
+ "url": "https://www.patreon.com/feross"
+ },
+ {
+ "type": "consulting",
+ "url": "https://feross.org/support"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "queue-microtask": "^1.2.2"
+ }
+ },
+ "node_modules/safe-buffer": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
+ "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/safe-stable-stringify": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.5.0.tgz",
+ "integrity": "sha512-b3rppTKm9T+PsVCBEOUR46GWI7fdOs00VKZ1+9c1EWDaDMvjQc6tUwuFyIprgGgTcWoVHSKrU8H31ZHA2e0RHA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/sax": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz",
+ "integrity": "sha512-6R3J5M4AcbtLUdZmRv2SygeVaM7IhrLXu9BmnOGmmACak8fiUtOsYNWUS4uK7upbmHIBbLBeFeI//477BKLBzA==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=11.0.0"
+ }
+ },
+ "node_modules/scheduler": {
+ "version": "0.23.2",
+ "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
+ "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==",
+ "license": "MIT",
+ "dependencies": {
+ "loose-envify": "^1.1.0"
+ }
+ },
+ "node_modules/scule": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/scule/-/scule-1.3.0.tgz",
+ "integrity": "sha512-6FtHJEvt+pVMIB9IBY+IcCJ6Z5f1iQnytgyfKMhDKgmzYG+TeH/wx1y3l27rshSbLiSanrR9ffZDrEsmjlQF2g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/semver": {
+ "version": "6.3.1",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz",
+ "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ }
+ },
+ "node_modules/set-value": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/set-value/-/set-value-4.1.0.tgz",
+ "integrity": "sha512-zTEg4HL0RwVrqcWs3ztF+x1vkxfm0lP+MQQFPiMJTKVceBwEV0A569Ou8l9IYQG8jOZdMVI1hGsc0tmeD2o/Lw==",
+ "dev": true,
+ "funding": [
+ "https://github.com/sponsors/jonschlinkert",
+ "https://paypal.me/jonathanschlinkert",
+ "https://jonschlinkert.dev/sponsor"
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "is-plain-object": "^2.0.4",
+ "is-primitive": "^3.0.1"
+ },
+ "engines": {
+ "node": ">=11.0"
+ }
+ },
+ "node_modules/setimmediate": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
+ "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/shebang-command": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz",
+ "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "shebang-regex": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shebang-regex": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz",
+ "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/shell-quote": {
+ "version": "1.7.3",
+ "resolved": "https://registry.npmjs.org/shell-quote/-/shell-quote-1.7.3.tgz",
+ "integrity": "sha512-Vpfqwm4EnqGdlsBFNmHhxhElJYrdfcxPThu+ryKS5J8L/fhAwLazFZtq+S+TWZ9ANj2piSQLGj6NQg+lKPmxrw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/shellwords": {
+ "version": "0.1.1",
+ "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz",
+ "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/signal-exit": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
+ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/sisteransi": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz",
+ "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/slice-ansi": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-5.0.0.tgz",
+ "integrity": "sha512-FC+lgizVPfie0kkhqUScwRu1O/lF6NOgJmlCgK+/LYxDCTk8sGelYaHDhFcDN+Sn3Cv+3VSa4Byeo+IMCzpMgQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.0.0",
+ "is-fullwidth-code-point": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/slice-ansi?sponsor=1"
+ }
+ },
+ "node_modules/slice-ansi/node_modules/ansi-styles": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/sonic-boom": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/sonic-boom/-/sonic-boom-4.2.1.tgz",
+ "integrity": "sha512-w6AxtubXa2wTXAUsZMMWERrsIRAdrK0Sc+FUytWvYAhBJLyuI4llrMIC1DtlNSdI99EI86KZum2MMq3EAZlF9Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "atomic-sleep": "^1.0.0"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.7.6",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.6.tgz",
+ "integrity": "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">= 12"
+ }
+ },
+ "node_modules/source-map-js": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
+ "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/source-map-support": {
+ "version": "0.5.21",
+ "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
+ "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "buffer-from": "^1.0.0",
+ "source-map": "^0.6.0"
+ }
+ },
+ "node_modules/source-map-support/node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/spawn-sync": {
+ "version": "1.0.15",
+ "resolved": "https://registry.npmjs.org/spawn-sync/-/spawn-sync-1.0.15.tgz",
+ "integrity": "sha512-9DWBgrgYZzNghseho0JOuh+5fg9u6QWhAWa51QC7+U5rCheZ/j1DrEZnyE0RBBRqZ9uEXGPgSSM0nky6burpVw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "dependencies": {
+ "concat-stream": "^1.4.7",
+ "os-shim": "^0.1.2"
+ }
+ },
+ "node_modules/split": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/split/-/split-1.0.1.tgz",
+ "integrity": "sha512-mTyOoPbrivtXnwnIxZRFYRrPNtEFKlpB2fvjSnCQUiAA6qAZzqwna5envK4uk6OIeP17CsdF3rSBGYVBsU0Tkg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "through": "2"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/split2": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/split2/-/split2-4.2.0.tgz",
+ "integrity": "sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">= 10.x"
+ }
+ },
+ "node_modules/stdin-discarder": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz",
+ "integrity": "sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/string_decoder": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
+ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "safe-buffer": "~5.1.0"
+ }
+ },
+ "node_modules/string-width": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
+ "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^10.3.0",
+ "get-east-asian-width": "^1.0.0",
+ "strip-ansi": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/strip-ansi": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
+ "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.2.2"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
+ "node_modules/strip-bom": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-5.0.0.tgz",
+ "integrity": "sha512-p+byADHF7SzEcVnLvc/r3uognM1hUhObuHXxJcgLCfD194XAkaLbjq3Wzb0N5G2tgIjH0dgT708Z51QxMeu60A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/strip-final-newline": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-3.0.0.tgz",
+ "integrity": "sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/strip-json-comments": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
+ "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/strip-literal": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-2.1.1.tgz",
+ "integrity": "sha512-631UJ6O00eNGfMiWG78ck80dfBab8X6IVFB51jZK5Icd7XAs60Z5y7QdSd/wGIklnWvRbUNloVzhOKKmutxQ6Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "js-tokens": "^9.0.1"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/antfu"
+ }
+ },
+ "node_modules/strip-literal/node_modules/js-tokens": {
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz",
+ "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/stubborn-fs": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/stubborn-fs/-/stubborn-fs-2.0.0.tgz",
+ "integrity": "sha512-Y0AvSwDw8y+nlSNFXMm2g6L51rBGdAQT20J3YSOqxC53Lo3bjWRtr2BKcfYoAf352WYpsZSTURrA0tqhfgudPA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "stubborn-utils": "^1.0.1"
+ }
+ },
+ "node_modules/stubborn-utils": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/stubborn-utils/-/stubborn-utils-1.0.2.tgz",
+ "integrity": "sha512-zOh9jPYI+xrNOyisSelgym4tolKTJCQd5GBhK0+0xJvcYDcwlOoxF/rnFKQ2KRZknXSG9jWAp66fwP6AxN9STg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/sucrase": {
+ "version": "3.35.1",
+ "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz",
+ "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.2",
+ "commander": "^4.0.0",
+ "lines-and-columns": "^1.1.6",
+ "mz": "^2.7.0",
+ "pirates": "^4.0.1",
+ "tinyglobby": "^0.2.11",
+ "ts-interface-checker": "^0.1.9"
+ },
+ "bin": {
+ "sucrase": "bin/sucrase",
+ "sucrase-node": "bin/sucrase-node"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
+ "node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/supports-preserve-symlinks-flag": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz",
+ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/tailwindcss": {
+ "version": "3.4.19",
+ "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
+ "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@alloc/quick-lru": "^5.2.0",
+ "arg": "^5.0.2",
+ "chokidar": "^3.6.0",
+ "didyoumean": "^1.2.2",
+ "dlv": "^1.1.3",
+ "fast-glob": "^3.3.2",
+ "glob-parent": "^6.0.2",
+ "is-glob": "^4.0.3",
+ "jiti": "^1.21.7",
+ "lilconfig": "^3.1.3",
+ "micromatch": "^4.0.8",
+ "normalize-path": "^3.0.0",
+ "object-hash": "^3.0.0",
+ "picocolors": "^1.1.1",
+ "postcss": "^8.4.47",
+ "postcss-import": "^15.1.0",
+ "postcss-js": "^4.0.1",
+ "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0",
+ "postcss-nested": "^6.2.0",
+ "postcss-selector-parser": "^6.1.2",
+ "resolve": "^1.22.8",
+ "sucrase": "^3.35.0"
+ },
+ "bin": {
+ "tailwind": "lib/cli.js",
+ "tailwindcss": "lib/cli.js"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/tar": {
+ "version": "6.2.1",
+ "resolved": "https://registry.npmjs.org/tar/-/tar-6.2.1.tgz",
+ "integrity": "sha512-DZ4yORTwrbTj/7MZYq2w+/ZFdI6OZ/f9SFHR+71gIVUZhOQPHzVCLpvRnPgyaMpfWxxk/4ONva3GQSyNIKRv6A==",
+ "deprecated": "Old versions of tar are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "chownr": "^2.0.0",
+ "fs-minipass": "^2.0.0",
+ "minipass": "^5.0.0",
+ "minizlib": "^2.1.1",
+ "mkdirp": "^1.0.3",
+ "yallist": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/tar/node_modules/yallist": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz",
+ "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/thenify": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
+ "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0"
+ }
+ },
+ "node_modules/thenify-all": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz",
+ "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "thenify": ">= 3.1.0 < 4"
+ },
+ "engines": {
+ "node": ">=0.8"
+ }
+ },
+ "node_modules/thread-stream": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/thread-stream/-/thread-stream-3.2.0.tgz",
+ "integrity": "sha512-zLBvqpwr4Esa0kRjcrzGU6zL25lePWaCLMx0RQFrmteozIfeNdaMLpG5U7PeHzvlFkAWaRKA9/KVW4F60iB+qw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "real-require": "^0.2.0"
+ }
+ },
+ "node_modules/through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinyexec": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz",
+ "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/tinyglobby": {
+ "version": "0.2.17",
+ "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
+ "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.4"
+ },
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/SuperchupuDev"
+ }
+ },
+ "node_modules/tinyglobby/node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/tinyglobby/node_modules/picomatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
+ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/tmp": {
+ "version": "0.2.5",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz",
+ "integrity": "sha512-voyz6MApa1rQGUxT3E+BK7/ROe8itEx7vD8/HEvt4xwXucvQ5G5oeEiHkmHZJuBO21RpOf+YYm9MOivj709jow==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.14"
+ }
+ },
+ "node_modules/to-regex-range": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
+ "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-number": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=8.0"
+ }
+ },
+ "node_modules/ts-api-utils": {
+ "version": "2.5.0",
+ "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
+ "integrity": "sha512-OJ/ibxhPlqrMM0UiNHJ/0CKQkoKF243/AEmplt3qpRgkW8VG7IfOS41h7V8TjITqdByHzrjcS/2si+y4lIh8NA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18.12"
+ },
+ "peerDependencies": {
+ "typescript": ">=4.8.4"
+ }
+ },
+ "node_modules/ts-interface-checker": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz",
+ "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==",
+ "dev": true,
+ "license": "Apache-2.0"
+ },
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "dev": true,
+ "license": "0BSD"
+ },
+ "node_modules/type-check": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz",
+ "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "prelude-ls": "^1.2.1"
+ },
+ "engines": {
+ "node": ">= 0.8.0"
+ }
+ },
+ "node_modules/type-fest": {
+ "version": "3.13.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-3.13.1.tgz",
+ "integrity": "sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==",
+ "dev": true,
+ "license": "(MIT OR CC0-1.0)",
+ "engines": {
+ "node": ">=14.16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/typedarray": {
+ "version": "0.0.6",
+ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
+ "integrity": "sha512-/aCDEGatGvZ2BIk+HmLf4ifCJFwvKFNb9/JeZPMulfgFracn9QFcAf5GO8B/mweUjSoblS5In0cWhqpfs/5PQA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/typescript": {
+ "version": "5.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/typescript-eslint": {
+ "version": "8.60.1",
+ "resolved": "https://registry.npmjs.org/typescript-eslint/-/typescript-eslint-8.60.1.tgz",
+ "integrity": "sha512-6m5hkkRAp8lKvhVpcprAIn5KkehQEh+47oHH2VGnExEh7dhNxXlg6GPAOIu6TxbVQxhebrJDvjl3020ooiWCMA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@typescript-eslint/eslint-plugin": "8.60.1",
+ "@typescript-eslint/parser": "8.60.1",
+ "@typescript-eslint/typescript-estree": "8.60.1",
+ "@typescript-eslint/utils": "8.60.1"
+ },
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "type": "opencollective",
+ "url": "https://opencollective.com/typescript-eslint"
+ },
+ "peerDependencies": {
+ "eslint": "^8.57.0 || ^9.0.0 || ^10.0.0",
+ "typescript": ">=4.8.4 <6.1.0"
+ }
+ },
+ "node_modules/ufo": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz",
+ "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/uhyphen": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/uhyphen/-/uhyphen-0.2.0.tgz",
+ "integrity": "sha512-qz3o9CHXmJJPGBdqzab7qAYuW8kQGKNEuoHFYrBwV6hWIMcpAmxDLXojcHfFr9US1Pe6zUswEIJIbLI610fuqA==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/undici-types": {
+ "version": "7.24.6",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.24.6.tgz",
+ "integrity": "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/unimport": {
+ "version": "3.14.6",
+ "resolved": "https://registry.npmjs.org/unimport/-/unimport-3.14.6.tgz",
+ "integrity": "sha512-CYvbDaTT04Rh8bmD8jz3WPmHYZRG/NnvYVzwD6V1YAlvvKROlAeNDUBhkBGzNav2RKaeuXvlWYaa1V4Lfi/O0g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@rollup/pluginutils": "^5.1.4",
+ "acorn": "^8.14.0",
+ "escape-string-regexp": "^5.0.0",
+ "estree-walker": "^3.0.3",
+ "fast-glob": "^3.3.3",
+ "local-pkg": "^1.0.0",
+ "magic-string": "^0.30.17",
+ "mlly": "^1.7.4",
+ "pathe": "^2.0.1",
+ "picomatch": "^4.0.2",
+ "pkg-types": "^1.3.0",
+ "scule": "^1.3.0",
+ "strip-literal": "^2.1.1",
+ "unplugin": "^1.16.1"
+ }
+ },
+ "node_modules/unimport/node_modules/confbox": {
+ "version": "0.1.8",
+ "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.1.8.tgz",
+ "integrity": "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/unimport/node_modules/escape-string-regexp": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
+ "integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/unimport/node_modules/picomatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
+ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/unimport/node_modules/pkg-types": {
+ "version": "1.3.1",
+ "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-1.3.1.tgz",
+ "integrity": "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "confbox": "^0.1.8",
+ "mlly": "^1.7.4",
+ "pathe": "^2.0.1"
+ }
+ },
+ "node_modules/universalify": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.1.tgz",
+ "integrity": "sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 10.0.0"
+ }
+ },
+ "node_modules/unplugin": {
+ "version": "1.16.1",
+ "resolved": "https://registry.npmjs.org/unplugin/-/unplugin-1.16.1.tgz",
+ "integrity": "sha512-4/u/j4FrCKdi17jaxuJA0jClGxB1AvU2hw/IuayPc4ay1XGaJs/rbb4v5WKwAjNifjmXK9PIFyuPiaK8azyR9w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "acorn": "^8.14.0",
+ "webpack-virtual-modules": "^0.6.2"
+ },
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/update-browserslist-db": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
+ "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/browserslist"
+ },
+ {
+ "type": "tidelift",
+ "url": "https://tidelift.com/funding/github/npm/browserslist"
+ },
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/ai"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "escalade": "^3.2.0",
+ "picocolors": "^1.1.1"
+ },
+ "bin": {
+ "update-browserslist-db": "cli.js"
+ },
+ "peerDependencies": {
+ "browserslist": ">= 4.21.0"
+ }
+ },
+ "node_modules/update-notifier": {
+ "version": "7.3.1",
+ "resolved": "https://registry.npmjs.org/update-notifier/-/update-notifier-7.3.1.tgz",
+ "integrity": "sha512-+dwUY4L35XFYEzE+OAL3sarJdUioVovq+8f7lcIJ7wnmnYQV5UD1Y/lcwaMSyaQ6Bj3JMj1XSTjZbNLHn/19yA==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "boxen": "^8.0.1",
+ "chalk": "^5.3.0",
+ "configstore": "^7.0.0",
+ "is-in-ci": "^1.0.0",
+ "is-installed-globally": "^1.0.0",
+ "is-npm": "^6.0.0",
+ "latest-version": "^9.0.0",
+ "pupa": "^3.1.0",
+ "semver": "^7.6.3",
+ "xdg-basedir": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/yeoman/update-notifier?sponsor=1"
+ }
+ },
+ "node_modules/update-notifier/node_modules/chalk": {
+ "version": "5.6.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.6.2.tgz",
+ "integrity": "sha512-7NzBL0rN6fMUW+f7A6Io4h40qQlG+xGmtMxfbnH/K7TAtt8JQWVQK+6g0UXKMeVJoyV5EkkNsErQ8pVD3bLHbA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^12.17.0 || ^14.13 || >=16.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/update-notifier/node_modules/semver": {
+ "version": "7.8.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz",
+ "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/uri-js": {
+ "version": "4.4.1",
+ "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz",
+ "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "dependencies": {
+ "punycode": "^2.1.0"
+ }
+ },
+ "node_modules/use-sync-external-store": {
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/use-sync-external-store/-/use-sync-external-store-1.6.0.tgz",
+ "integrity": "sha512-Pp6GSwGP/NrPIrxVFAIkOQeyw8lFenOHijQWkUTrDvrF4ALqylP2C/KCkeS9dpUM3KvYRQhna5vt7IL95+ZQ9w==",
+ "license": "MIT",
+ "peerDependencies": {
+ "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
+ "node_modules/util-deprecate": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
+ "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/uuid": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
+ "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
+ "deprecated": "uuid@10 and below is no longer supported. For ESM codebases, update to uuid@latest. For CommonJS codebases, use uuid@11 (but be aware this version will likely be deprecated in 2028).",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "uuid": "dist/bin/uuid"
+ }
+ },
+ "node_modules/vite": {
+ "version": "7.3.5",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz",
+ "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "^0.27.0",
+ "fdir": "^6.5.0",
+ "picomatch": "^4.0.3",
+ "postcss": "^8.5.6",
+ "rollup": "^4.43.0",
+ "tinyglobby": "^0.2.15"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^20.19.0 || >=22.12.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^20.19.0 || >=22.12.0",
+ "jiti": ">=1.21.0",
+ "less": "^4.0.0",
+ "lightningcss": "^1.21.0",
+ "sass": "^1.70.0",
+ "sass-embedded": "^1.70.0",
+ "stylus": ">=0.54.8",
+ "sugarss": "^5.0.0",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "lightningcss": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vite-node": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz",
+ "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cac": "^6.7.14",
+ "debug": "^4.4.1",
+ "es-module-lexer": "^1.7.0",
+ "pathe": "^2.0.3",
+ "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0"
+ },
+ "bin": {
+ "vite-node": "vite-node.mjs"
+ },
+ "engines": {
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/vite/node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vite/node_modules/picomatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
+ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/watchpack": {
+ "version": "2.4.4",
+ "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-2.4.4.tgz",
+ "integrity": "sha512-c5EGNOiyxxV5qmTtAB7rbiXxi1ooX1pQKMLX/MIabJjRA0SJBQOjKF+KSVfHkr9U1cADPon0mRiVe/riyaiDUA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "glob-to-regexp": "^0.4.1",
+ "graceful-fs": "^4.1.2"
+ },
+ "engines": {
+ "node": ">=10.13.0"
+ }
+ },
+ "node_modules/web-ext-run": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/web-ext-run/-/web-ext-run-0.2.4.tgz",
+ "integrity": "sha512-rQicL7OwuqWdQWI33JkSXKcp7cuv1mJG8u3jRQwx/8aDsmhbTHs9ZRmNYOL+LX0wX8edIEQX8jj4bB60GoXtKA==",
+ "dev": true,
+ "license": "MPL-2.0",
+ "dependencies": {
+ "@babel/runtime": "7.28.2",
+ "@devicefarmer/adbkit": "3.3.8",
+ "chrome-launcher": "1.2.0",
+ "debounce": "1.2.1",
+ "es6-error": "4.1.1",
+ "firefox-profile": "4.7.0",
+ "fx-runner": "1.4.0",
+ "multimatch": "6.0.0",
+ "node-notifier": "10.0.1",
+ "parse-json": "7.1.1",
+ "pino": "9.7.0",
+ "promise-toolbox": "0.21.0",
+ "set-value": "4.1.0",
+ "source-map-support": "0.5.21",
+ "strip-bom": "5.0.0",
+ "strip-json-comments": "5.0.2",
+ "tmp": "0.2.5",
+ "update-notifier": "7.3.1",
+ "watchpack": "2.4.4",
+ "zip-dir": "2.0.0"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ }
+ },
+ "node_modules/web-ext-run/node_modules/strip-json-comments": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-5.0.2.tgz",
+ "integrity": "sha512-4X2FR3UwhNUE9G49aIsJW5hRRR3GXGTBTZRMfv568O60ojM8HcWjV/VxAxCDW3SUND33O6ZY66ZuRcdkj73q2g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.16"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/webextension-polyfill": {
+ "version": "0.12.0",
+ "resolved": "https://registry.npmjs.org/webextension-polyfill/-/webextension-polyfill-0.12.0.tgz",
+ "integrity": "sha512-97TBmpoWJEE+3nFBQ4VocyCdLKfw54rFaJ6EVQYLBCXqCIpLSZkwGgASpv4oPt9gdKCJ80RJlcmNzNn008Ag6Q==",
+ "dev": true,
+ "license": "MPL-2.0"
+ },
+ "node_modules/webpack-virtual-modules": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz",
+ "integrity": "sha512-66/V2i5hQanC51vBQKPH4aI8NMAcBW59FVBs+rC7eGHupMyfn34q7rZIE+ETlJ+XTevqfUhVVBgSUNSW2flEUQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/when": {
+ "version": "3.7.7",
+ "resolved": "https://registry.npmjs.org/when/-/when-3.7.7.tgz",
+ "integrity": "sha512-9lFZp/KHoqH6bPKjbWqa+3Dg/K/r2v0X/3/G2x4DBGchVS2QX2VXL3cZV994WQVnTM1/PD71Az25nAzryEUugw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/when-exit": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/when-exit/-/when-exit-2.1.5.tgz",
+ "integrity": "sha512-VGkKJ564kzt6Ms1dbgPP/yuIoQCrsFAnRbptpC5wOEsDaNsbCB2bnfnaA8i/vRs5tjUSEOtIuvl9/MyVsvQZCg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/which": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "isexe": "^2.0.0"
+ },
+ "bin": {
+ "node-which": "bin/node-which"
+ },
+ "engines": {
+ "node": ">= 8"
+ }
+ },
+ "node_modules/widest-line": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz",
+ "integrity": "sha512-c9bZp7b5YtRj2wOe6dlj32MK+Bx/M/d+9VB2SHM1OtsUHR0aV0tdP6DWh/iMt0kWi1t5g1Iudu6hQRNd1A4PVA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "string-width": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/winreg": {
+ "version": "0.0.12",
+ "resolved": "https://registry.npmjs.org/winreg/-/winreg-0.0.12.tgz",
+ "integrity": "sha512-typ/+JRmi7RqP1NanzFULK36vczznSNN8kWVA9vIqXyv8GhghUlwhGp1Xj3Nms1FsPcNnsQrJOR10N58/nQ9hQ==",
+ "dev": true,
+ "license": "BSD"
+ },
+ "node_modules/word-wrap": {
+ "version": "1.2.5",
+ "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
+ "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/wrap-ansi": {
+ "version": "9.0.2",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
+ "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.2.1",
+ "string-width": "^7.0.0",
+ "strip-ansi": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/wrap-ansi/node_modules/ansi-styles": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/wsl-utils": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.1.0.tgz",
+ "integrity": "sha512-h3Fbisa2nKGPxCpm89Hk33lBLsnaGBvctQopaBSOW/uIs6FTe1ATyAnKFJrzVs9vpGdsTe73WF3V4lIsk4Gacw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-wsl": "^3.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/wxt": {
+ "version": "0.19.29",
+ "resolved": "https://registry.npmjs.org/wxt/-/wxt-0.19.29.tgz",
+ "integrity": "sha512-n6DRR34OAFczJfZOwJeY5dn+j+w2BTquW2nAX32vk3FMLWUhzpv5svMvSUTyNiFq3P0o3U7YxfxHdmKJnXZHBA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@1natsu/wait-element": "^4.1.2",
+ "@aklinker1/rollup-plugin-visualizer": "5.12.0",
+ "@types/chrome": "^0.0.280",
+ "@types/webextension-polyfill": "^0.12.1",
+ "@webext-core/fake-browser": "^1.3.1",
+ "@webext-core/isolated-element": "^1.1.2",
+ "@webext-core/match-patterns": "^1.0.3",
+ "@wxt-dev/storage": "^1.0.0",
+ "async-mutex": "^0.5.0",
+ "c12": "^3.0.2",
+ "cac": "^6.7.14",
+ "chokidar": "^4.0.3",
+ "ci-info": "^4.1.0",
+ "consola": "^3.2.3",
+ "defu": "^6.1.4",
+ "dotenv": "^16.4.5",
+ "dotenv-expand": "^12.0.1",
+ "esbuild": "^0.25.0",
+ "fast-glob": "^3.3.2",
+ "filesize": "^10.1.6",
+ "fs-extra": "^11.2.0",
+ "get-port-please": "^3.1.2",
+ "giget": "^1.2.3",
+ "hookable": "^5.5.3",
+ "import-meta-resolve": "^4.1.0",
+ "is-wsl": "^3.1.0",
+ "jiti": "^2.4.2",
+ "json5": "^2.2.3",
+ "jszip": "^3.10.1",
+ "linkedom": "^0.18.5",
+ "magicast": "^0.3.5",
+ "minimatch": "^10.0.1",
+ "nano-spawn": "^0.2.0",
+ "normalize-path": "^3.0.0",
+ "nypm": "^0.3.12",
+ "ohash": "^1.1.4",
+ "open": "^10.1.0",
+ "ora": "^8.1.1",
+ "perfect-debounce": "^1.0.0",
+ "picocolors": "^1.1.1",
+ "prompts": "^2.4.2",
+ "publish-browser-extension": "^2.3.0 || ^3.0.0",
+ "scule": "^1.3.0",
+ "unimport": "^3.13.1",
+ "vite": "^5.0.0 || ^6.0.0",
+ "vite-node": "^2.1.4 || ^3.0.0",
+ "web-ext-run": "^0.2.1",
+ "webextension-polyfill": "^0.12.0"
+ },
+ "bin": {
+ "wxt": "bin/wxt.mjs",
+ "wxt-publish-extension": "bin/wxt-publish-extension.cjs"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/wxt-dev"
+ },
+ "peerDependenciesMeta": {
+ "@types/chrome": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/wxt/node_modules/@types/chrome": {
+ "version": "0.0.280",
+ "resolved": "https://registry.npmjs.org/@types/chrome/-/chrome-0.0.280.tgz",
+ "integrity": "sha512-AotSmZrL9bcZDDmSI1D9dE7PGbhOur5L0cKxXd7IqbVizQWCY4gcvupPUVsQ4FfDj3V2tt/iOpomT9EY0s+w1g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/filesystem": "*",
+ "@types/har-format": "*"
+ }
+ },
+ "node_modules/wxt/node_modules/balanced-match": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
+ "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/wxt/node_modules/brace-expansion": {
+ "version": "5.0.6",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
+ "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^4.0.2"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/wxt/node_modules/chokidar": {
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz",
+ "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "readdirp": "^4.0.1"
+ },
+ "engines": {
+ "node": ">= 14.16.0"
+ },
+ "funding": {
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/wxt/node_modules/fdir": {
+ "version": "6.5.0",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
+ "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12.0.0"
+ },
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/wxt/node_modules/jiti": {
+ "version": "2.7.0",
+ "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
+ "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "jiti": "lib/jiti-cli.mjs"
+ }
+ },
+ "node_modules/wxt/node_modules/minimatch": {
+ "version": "10.2.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
+ "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "brace-expansion": "^5.0.5"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/wxt/node_modules/picomatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
+ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/wxt/node_modules/readdirp": {
+ "version": "4.1.2",
+ "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz",
+ "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14.18.0"
+ },
+ "funding": {
+ "type": "individual",
+ "url": "https://paulmillr.com/funding/"
+ }
+ },
+ "node_modules/wxt/node_modules/vite": {
+ "version": "6.4.3",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.3.tgz",
+ "integrity": "sha512-NTKlcQjlAK7MlQoyb6LgaqHc8sso/pVyUJYWMws3jg21uTJw/LddqIFPcPqP6PzpgbIcZyKI85sFE4HBrQDA8A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "esbuild": "^0.25.0",
+ "fdir": "^6.4.4",
+ "picomatch": "^4.0.2",
+ "postcss": "^8.5.3",
+ "rollup": "^4.34.9",
+ "tinyglobby": "^0.2.13"
+ },
+ "bin": {
+ "vite": "bin/vite.js"
+ },
+ "engines": {
+ "node": "^18.0.0 || ^20.0.0 || >=22.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/vitejs/vite?sponsor=1"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.3"
+ },
+ "peerDependencies": {
+ "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0",
+ "jiti": ">=1.21.0",
+ "less": "*",
+ "lightningcss": "^1.21.0",
+ "sass": "*",
+ "sass-embedded": "*",
+ "stylus": "*",
+ "sugarss": "*",
+ "terser": "^5.16.0",
+ "tsx": "^4.8.1",
+ "yaml": "^2.4.2"
+ },
+ "peerDependenciesMeta": {
+ "@types/node": {
+ "optional": true
+ },
+ "jiti": {
+ "optional": true
+ },
+ "less": {
+ "optional": true
+ },
+ "lightningcss": {
+ "optional": true
+ },
+ "sass": {
+ "optional": true
+ },
+ "sass-embedded": {
+ "optional": true
+ },
+ "stylus": {
+ "optional": true
+ },
+ "sugarss": {
+ "optional": true
+ },
+ "terser": {
+ "optional": true
+ },
+ "tsx": {
+ "optional": true
+ },
+ "yaml": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/xdg-basedir": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-5.1.0.tgz",
+ "integrity": "sha512-GCPAHLvrIH13+c0SuacwvRYj2SxJXQ4kaVTT5xgL3kPrz56XxkF21IGhjSE1+W0aw7gpBWRGXLCPnPby6lSpmQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/xml2js": {
+ "version": "0.6.2",
+ "resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz",
+ "integrity": "sha512-T4rieHaC1EXcES0Kxxj4JWgaUQHDk+qwHcYOCFHfiwKz7tOVPLq7Hjq9dM1WCMhylqMEfP7hMcOIChvotiZegA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "sax": ">=0.6.0",
+ "xmlbuilder": "~11.0.0"
+ },
+ "engines": {
+ "node": ">=4.0.0"
+ }
+ },
+ "node_modules/xmlbuilder": {
+ "version": "11.0.1",
+ "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-11.0.1.tgz",
+ "integrity": "sha512-fDlsI/kFEx7gLvbecc0/ohLG50fugQp8ryHzMTuW9vSa1GJ0XYWKnhsUx7oie3G98+r56aTQIUB4kht42R3JvA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4.0"
+ }
+ },
+ "node_modules/y18n": {
+ "version": "5.0.8",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
+ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/yallist": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
+ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
+ "dev": true,
+ "license": "ISC"
+ },
+ "node_modules/yargs": {
+ "version": "17.7.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
+ "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cliui": "^8.0.1",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.3",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^21.1.1"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/yargs-parser": {
+ "version": "21.1.1",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz",
+ "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==",
+ "dev": true,
+ "license": "ISC",
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/yargs/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/yargs/node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yargs/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/yocto-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz",
+ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/zip-dir": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/zip-dir/-/zip-dir-2.0.0.tgz",
+ "integrity": "sha512-uhlsJZWz26FLYXOD6WVuq+fIcZ3aBPGo/cFdiLlv3KNwpa52IF3ISV8fLhQLiqVu5No3VhlqlgthN6gehil1Dg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "async": "^3.2.0",
+ "jszip": "^3.2.2"
+ }
+ },
+ "node_modules/zod": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-4.4.3.tgz",
+ "integrity": "sha512-ytENFjIJFl2UwYglde2jchW2Hwm4GJFLDiSXWdTrJQBIN9Fcyp7n4DhxJEiWNAJMV1/BqWfW/kkg71UDcHJyTQ==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ },
+ "node_modules/zustand": {
+ "version": "4.5.7",
+ "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz",
+ "integrity": "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==",
+ "license": "MIT",
+ "dependencies": {
+ "use-sync-external-store": "^1.2.2"
+ },
+ "engines": {
+ "node": ">=12.7.0"
+ },
+ "peerDependencies": {
+ "@types/react": ">=16.8",
+ "immer": ">=9.0.6",
+ "react": ">=16.8"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "immer": {
+ "optional": true
+ },
+ "react": {
+ "optional": true
+ }
+ }
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..0f37fe1
--- /dev/null
+++ b/package.json
@@ -0,0 +1,44 @@
+{
+ "name": "sessionist",
+ "version": "0.1.0",
+ "description": "Save, switch, and export browser session identities — the missing power-tool for testing as different users.",
+ "private": true,
+ "type": "module",
+ "license": "SEE LICENSE IN LICENSE",
+ "scripts": {
+ "dev": "wxt",
+ "dev:firefox": "wxt -b firefox",
+ "build": "wxt build",
+ "build:firefox": "wxt build -b firefox",
+ "zip": "wxt zip",
+ "compile": "tsc --noEmit",
+ "lint": "eslint .",
+ "format": "prettier --check .",
+ "format:write": "prettier --write .",
+ "postinstall": "wxt prepare"
+ },
+ "dependencies": {
+ "react": "^18.3.1",
+ "react-dom": "^18.3.1",
+ "zustand": "^4.5.5"
+ },
+ "devDependencies": {
+ "@types/chrome": "^0.0.270",
+ "@types/react": "^18.3.12",
+ "@types/react-dom": "^18.3.1",
+ "@wxt-dev/module-react": "1.1.3",
+ "autoprefixer": "^10.4.20",
+ "eslint": "^9.15.0",
+ "eslint-plugin-react-hooks": "^5.0.0",
+ "globals": "^15.12.0",
+ "postcss": "^8.4.49",
+ "prettier": "^3.3.3",
+ "tailwindcss": "^3.4.15",
+ "typescript": "^5.6.3",
+ "typescript-eslint": "^8.15.0",
+ "wxt": "^0.19.13"
+ },
+ "overrides": {
+ "esbuild": "0.25.12"
+ }
+}
diff --git a/postcss.config.js b/postcss.config.js
new file mode 100644
index 0000000..2aa7205
--- /dev/null
+++ b/postcss.config.js
@@ -0,0 +1,6 @@
+export default {
+ plugins: {
+ tailwindcss: {},
+ autoprefixer: {},
+ },
+};
diff --git a/src/background/router.ts b/src/background/router.ts
new file mode 100644
index 0000000..fec7ef2
--- /dev/null
+++ b/src/background/router.ts
@@ -0,0 +1,100 @@
+/**
+ * Central background message router (PRD §13.1 / §13.3).
+ *
+ * Every UI feature reaches its service through here. The router is the single
+ * entry point in the (ephemeral) service worker — it holds no durable in-memory
+ * state (PRD §13.3); each handler reads/writes persistent storage as needed.
+ *
+ * Dispatch is a handler map keyed by request type. Each handler's return type is
+ * checked against BgResponseMap[K] with no per-case cast, and the map type forces
+ * exhaustiveness — a new request type that lacks a handler is a compile error.
+ *
+ * Handlers are wired to real services but those services are still stubs, so
+ * calls resolve the type contract and throw NotImplementedError until filled in.
+ */
+
+import type { BgRequest, BgResponse, BgResponseMap } from '@/types/messages';
+import { logger } from '@/lib/logger';
+import { UserFacingError } from '@/lib/result';
+
+import * as cookies from '@/services/cookies/cookieService';
+import * as cookieIO from '@/services/cookies/cookieImportExport';
+import * as profiles from '@/services/profiles/profileService';
+import * as capture from '@/services/profiles/captureService';
+import * as switchEngine from '@/services/profiles/switchEngine';
+import * as snapshots from '@/services/profiles/snapshotService';
+import * as profileRepo from '@/services/storage/profileRepository';
+import * as settings from '@/services/storage/settingsRepository';
+import * as playwright from '@/services/export/playwrightExport';
+import * as puppeteer from '@/services/export/puppeteerExport';
+import * as selenium from '@/services/export/seleniumExport';
+import * as curl from '@/services/export/curlExport';
+import * as permissions from '@/services/permissions/permissionService';
+import * as entitlements from '@/services/licensing/entitlementService';
+
+/** One handler per request type; return type is checked against BgResponseMap. */
+type Handlers = {
+ [K in BgRequest['type']]: (
+ req: Extract,
+ ) => Promise | BgResponseMap[K];
+};
+
+const handlers: Handlers = {
+ // --- Cookies ---
+ 'cookies/list': (req) => cookies.listCookies(req.origin),
+ 'cookies/set': (req) => cookies.setCookie(req.cookie),
+ 'cookies/delete': (req) => cookies.deleteCookie(req.cookie),
+ 'cookies/deleteAll': (req) => cookies.deleteAllForSite(req.origin),
+ 'cookies/import': (req) => cookieIO.importCookies(req.json),
+ 'cookies/export': async (req) => cookieIO.exportCookies(await cookies.listCookies(req.origin)),
+
+ // --- Profiles ---
+ 'profiles/list': () => profiles.listProfiles(),
+ 'profiles/capture': (req) => capture.captureProfile({ name: req.name, tabId: req.tabId }),
+ 'profiles/switch': (req) => switchEngine.switchToProfile(req.profileId, req.tabId),
+ 'profiles/restore': (req) => switchEngine.restoreAdditive(req.profileId, req.tabId),
+ 'profiles/delete': (req) => profiles.deleteProfile(req.profileId),
+ 'profiles/shouldPromptUpsell': () => profiles.shouldPromptUpsell(),
+
+ // --- Snapshots ---
+ 'snapshots/list': () => profileRepo.listSnapshots(),
+ 'snapshots/restore': (req) => snapshots.restoreSnapshotAsSwitch(req.snapshotId, req.tabId),
+
+ // --- Export ---
+ 'export/playwright': async (req) =>
+ playwright.exportStorageStateJson(await requireProfile(req.profileId)),
+ 'export/puppeteer': async (req) =>
+ puppeteer.exportPuppeteerSnippet(await requireProfile(req.profileId)),
+ 'export/selenium': async (req) =>
+ selenium.exportSeleniumSnippet(await requireProfile(req.profileId), req.lang),
+ 'export/curl': async (req) => curl.exportCurlSnippet(await requireProfile(req.profileId)),
+
+ // --- Permissions ---
+ 'permissions/list': () => permissions.listGrantedOrigins(),
+ 'permissions/request': (req) => permissions.requestOrigin(req.origin),
+ 'permissions/revoke': (req) => permissions.revokeOrigin(req.origin),
+
+ // --- Settings ---
+ 'settings/get': () => settings.getSettings(),
+ 'settings/patch': (req) => settings.patchSettings(req.patch),
+
+ // --- Entitlements ---
+ 'entitlement/get': () => entitlements.getEntitlement(),
+ 'entitlement/activate': (req) => entitlements.activateLicense(req.licenseKey),
+ 'entitlement/startCheckout': () => entitlements.startCheckout(),
+};
+
+/** Route a single request to its handler. Returns the typed response. */
+export async function handleRequest(req: T): Promise> {
+ logger.debug('router', `handling ${req.type}`);
+ // The map guarantees a handler exists for every type; the single boundary cast
+ // bridges the per-key handler signature to the generic caller's response type.
+ const handler = handlers[req.type] as (r: BgRequest) => Promise;
+ return (await handler(req)) as BgResponse;
+}
+
+async function requireProfile(id: string) {
+ const profile = await profileRepo.getProfile(id);
+ if (!profile) throw new UserFacingError('Profile not found');
+ return profile;
+}
diff --git a/src/entrypoints/background.ts b/src/entrypoints/background.ts
new file mode 100644
index 0000000..74bd407
--- /dev/null
+++ b/src/entrypoints/background.ts
@@ -0,0 +1,62 @@
+/**
+ * MV3 service worker entry point (PRD §13.3).
+ *
+ * - Opens the side panel on toolbar click.
+ * - Routes typed UI messages through the central router, wrapping each reply in
+ * a BgEnvelope.
+ * Treated as ephemeral: no durable state lives here (PRD §13.3).
+ */
+
+import { defineBackground } from 'wxt/sandbox';
+import type { BgRequest, BgEnvelope } from '@/types/messages';
+import { handleRequest } from '@/background/router';
+import { logger } from '@/lib/logger';
+import { isSafeMessageError } from '@/lib/result';
+import { trackAsync } from '@/services/telemetry/telemetry';
+
+export default defineBackground(() => {
+ logger.info('background', 'service worker started');
+
+ // Toolbar click opens the side panel (PRD §9.1 Side Panel UI). Persistent
+ // config, re-set on install to be safe.
+ chrome.runtime.onInstalled.addListener((details) => {
+ chrome.sidePanel
+ ?.setPanelBehavior?.({ openPanelOnActionClick: true })
+ .catch((e) => logger.warn('background', 'setPanelBehavior failed', { reason: String(e) }));
+ if (details.reason === 'install') trackAsync('install'); // opt-in checked inside
+ });
+
+ // Type-safe request router. Only handles messages that look like a BgRequest
+ // (a `type` string) from this extension, leaving other senders/listeners
+ // untouched. Returning true keeps the channel open for the async response.
+ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
+ if (sender.id !== chrome.runtime.id) return false;
+ if (typeof (message as { type?: unknown })?.type !== 'string') return false;
+
+ const req = message as BgRequest;
+ handleRequest(req)
+ .then((value) => sendResponse({ ok: true, value } satisfies BgEnvelope))
+ .catch((error: unknown) => {
+ // Log only structural metadata — never the free-form message, which
+ // could embed cookie/storage values (PRD §14.3 / §15).
+ logger.error('background', `handler failed for ${req.type}`, {
+ name: error instanceof Error ? error.name : 'Error',
+ });
+ sendResponse({ ok: false, error: sanitizeError(error) } satisfies BgEnvelope);
+ });
+ return true;
+ });
+});
+
+/**
+ * Reduce an error to a string for the UI. Only known-safe error types have their
+ * message forwarded; everything else is generic so a secret value that a service
+ * accidentally put in an Error message cannot reach the UI (PRD §14.3 / §15).
+ */
+function sanitizeError(error: unknown): string {
+ if (isSafeMessageError(error)) {
+ return `${error.name}: ${(error.message.split('\n')[0] ?? '').slice(0, 200)}`;
+ }
+ if (error instanceof Error) return `${error.name}: an unexpected error occurred`;
+ return 'An unexpected error occurred';
+}
diff --git a/src/entrypoints/popup/index.html b/src/entrypoints/popup/index.html
new file mode 100644
index 0000000..9f29933
--- /dev/null
+++ b/src/entrypoints/popup/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Sessionist
+
+
+
+
+
+
diff --git a/src/entrypoints/popup/main.tsx b/src/entrypoints/popup/main.tsx
new file mode 100644
index 0000000..e233e16
--- /dev/null
+++ b/src/entrypoints/popup/main.tsx
@@ -0,0 +1,14 @@
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import { App } from '@/ui/App';
+import '@/ui/styles/globals.css';
+
+// Compact popup is P1 (PRD §9.1) — reuses the same App shell in a smaller frame.
+const root = document.getElementById('root');
+if (!root) throw new Error('Missing #root');
+
+ReactDOM.createRoot(root).render(
+
+
+ ,
+);
diff --git a/src/entrypoints/sidepanel/index.html b/src/entrypoints/sidepanel/index.html
new file mode 100644
index 0000000..e82ebdd
--- /dev/null
+++ b/src/entrypoints/sidepanel/index.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+ Sessionist
+
+
+
+
+
+
diff --git a/src/entrypoints/sidepanel/main.tsx b/src/entrypoints/sidepanel/main.tsx
new file mode 100644
index 0000000..81c9fa4
--- /dev/null
+++ b/src/entrypoints/sidepanel/main.tsx
@@ -0,0 +1,13 @@
+import React from 'react';
+import ReactDOM from 'react-dom/client';
+import { App } from '@/ui/App';
+import '@/ui/styles/globals.css';
+
+const root = document.getElementById('root');
+if (!root) throw new Error('Missing #root');
+
+ReactDOM.createRoot(root).render(
+
+
+ ,
+);
diff --git a/src/lib/logger.ts b/src/lib/logger.ts
new file mode 100644
index 0000000..cbf69fc
--- /dev/null
+++ b/src/lib/logger.ts
@@ -0,0 +1,52 @@
+/**
+ * Minimal namespaced logger. Never logs cookie/storage/profile values
+ * (PRD §14.3 / §15).
+ *
+ * Defense in depth: `meta` is scrubbed against an allowlist of known-safe,
+ * structural keys before it ever reaches the console, and string values are
+ * truncated. Callers should still pass only structural metadata, but a stray
+ * secret won't leak even if they don't.
+ */
+
+const PREFIX = '[sessionist]';
+
+/** Keys safe to log — counts, kinds, statuses, ids. Never values/keys/urls. */
+const SAFE_KEYS = new Set([
+ 'type',
+ 'name',
+ 'scope',
+ 'store',
+ 'status',
+ 'count',
+ 'sizeBytes',
+ 'reason',
+ 'durationMs',
+ 'tabId',
+ 'ok',
+]);
+
+const MAX_STR = 120;
+
+function scrub(meta?: Record): Record {
+ if (!meta) return {};
+ const out: Record = {};
+ for (const [k, v] of Object.entries(meta)) {
+ if (!SAFE_KEYS.has(k)) {
+ out[k] = '[redacted]';
+ continue;
+ }
+ out[k] = typeof v === 'string' && v.length > MAX_STR ? `${v.slice(0, MAX_STR)}…` : v;
+ }
+ return out;
+}
+
+export const logger = {
+ debug: (scope: string, msg: string, meta?: Record) =>
+ console.debug(`${PREFIX} ${scope}:`, msg, scrub(meta)),
+ info: (scope: string, msg: string, meta?: Record) =>
+ console.info(`${PREFIX} ${scope}:`, msg, scrub(meta)),
+ warn: (scope: string, msg: string, meta?: Record) =>
+ console.warn(`${PREFIX} ${scope}:`, msg, scrub(meta)),
+ error: (scope: string, msg: string, meta?: Record) =>
+ console.error(`${PREFIX} ${scope}:`, msg, scrub(meta)),
+};
diff --git a/src/lib/messaging.ts b/src/lib/messaging.ts
new file mode 100644
index 0000000..ab0a5b3
--- /dev/null
+++ b/src/lib/messaging.ts
@@ -0,0 +1,21 @@
+/**
+ * Type-safe wrapper over chrome.runtime messaging for the UI.
+ *
+ * The background always replies with a `BgEnvelope`; this unwraps it and throws
+ * on failure so callers get the bare typed value. (The React layer uses
+ * useBackground instead, which keeps the error in state rather than throwing.)
+ *
+ * Background -> page-context storage does NOT go through here: it is done by
+ * injecting a function via chrome.scripting.executeScript (see
+ * services/capture/webStorageCapture.ts), avoiding a persistent content script.
+ */
+
+import type { BgRequest, BgResponse, BgEnvelope } from '@/types/messages';
+
+export async function sendToBackground(
+ req: T,
+): Promise> {
+ const env = (await chrome.runtime.sendMessage(req)) as BgEnvelope>;
+ if (!env.ok) throw new Error(env.error);
+ return env.value;
+}
diff --git a/src/lib/result.ts b/src/lib/result.ts
new file mode 100644
index 0000000..9f0cd9d
--- /dev/null
+++ b/src/lib/result.ts
@@ -0,0 +1,34 @@
+/**
+ * Shared error markers.
+ *
+ * The cross-boundary success/failure contract is the `BgEnvelope` type in
+ * types/messages.ts (services return bare values and throw on failure; the
+ * background router wraps them). We deliberately keep a single failure model
+ * rather than also threading a Result monad through every service.
+ */
+
+/** Marker used by every stub in the skeleton. Replace as features land. */
+export class NotImplementedError extends Error {
+ constructor(feature: string) {
+ super(`Not implemented: ${feature}`);
+ this.name = 'NotImplementedError';
+ }
+}
+
+/**
+ * An error whose message is safe to show the user verbatim (no secret values).
+ * Only these (and NotImplementedError) have their message forwarded to the UI;
+ * any other error is reduced to a generic string so a value accidentally
+ * interpolated into an Error message can't leak (PRD §14.3 / §15).
+ */
+export class UserFacingError extends Error {
+ constructor(message: string) {
+ super(message);
+ this.name = 'UserFacingError';
+ }
+}
+
+/** True for errors whose message is known not to contain secret values. */
+export function isSafeMessageError(error: unknown): error is Error {
+ return error instanceof NotImplementedError || error instanceof UserFacingError;
+}
diff --git a/src/services/capture/pageScript.ts b/src/services/capture/pageScript.ts
new file mode 100644
index 0000000..9f0e134
--- /dev/null
+++ b/src/services/capture/pageScript.ts
@@ -0,0 +1,37 @@
+/**
+ * Page-context functions injected via chrome.scripting.executeScript (PRD §13.6).
+ *
+ * These run in the target page's main world, not in a persistent content script,
+ * so Sessionist needs host access only for the specific tab/origin the user is
+ * acting on (granted at runtime) — never broad install-time host permissions.
+ *
+ * Keep these self-contained: executeScript serializes the function body, so they
+ * must not reference module-scope imports or closures.
+ */
+
+import type { WebStorageSnapshot } from '@/types/messages';
+
+/** Read localStorage + sessionStorage from the page. Injected target. */
+export function readPageStorage(): WebStorageSnapshot {
+ const dump = (s: Storage): Record => {
+ const out: Record = {};
+ for (let i = 0; i < s.length; i++) {
+ const k = s.key(i);
+ if (k !== null) out[k] = s.getItem(k) ?? '';
+ }
+ return out;
+ };
+ return { localStorage: dump(window.localStorage), sessionStorage: dump(window.sessionStorage) };
+}
+
+/** Overwrite page web storage with the provided snapshot. Injected target. */
+export function writePageStorage(snapshot: WebStorageSnapshot): void {
+ for (const [k, v] of Object.entries(snapshot.localStorage)) window.localStorage.setItem(k, v);
+ for (const [k, v] of Object.entries(snapshot.sessionStorage)) window.sessionStorage.setItem(k, v);
+}
+
+/** Clear page web storage. Injected target. */
+export function clearPageStorage(): void {
+ window.localStorage.clear();
+ window.sessionStorage.clear();
+}
diff --git a/src/services/capture/webStorageCapture.ts b/src/services/capture/webStorageCapture.ts
new file mode 100644
index 0000000..5dc01a1
--- /dev/null
+++ b/src/services/capture/webStorageCapture.ts
@@ -0,0 +1,33 @@
+/**
+ * Background-side web-storage capture/apply/clear.
+ *
+ * Uses chrome.scripting.executeScript to run pageScript functions in the target
+ * tab's page context for one operation, then return. No persistent content
+ * script, so host access is scoped per-tab/origin at runtime (PRD §9.6 / §13.6).
+ */
+
+import type { WebStorageSnapshot } from '@/types/messages';
+import { readPageStorage, writePageStorage, clearPageStorage } from './pageScript';
+import { NotImplementedError } from '@/lib/result';
+
+export async function captureWebStorage(_tabId: number): Promise {
+ // TODO: const [{ result }] = await chrome.scripting.executeScript({
+ // target: { tabId: _tabId }, func: readPageStorage }); return result;
+ void readPageStorage;
+ throw new NotImplementedError('capture/webStorage.captureWebStorage');
+}
+
+export async function applyWebStorage(
+ _tabId: number,
+ _snapshot: WebStorageSnapshot,
+): Promise {
+ // TODO: executeScript({ target: { tabId }, func: writePageStorage, args: [snapshot] }).
+ void writePageStorage;
+ throw new NotImplementedError('capture/webStorage.applyWebStorage');
+}
+
+export async function clearWebStorage(_tabId: number): Promise {
+ // TODO: executeScript({ target: { tabId }, func: clearPageStorage }).
+ void clearPageStorage;
+ throw new NotImplementedError('capture/webStorage.clearWebStorage');
+}
diff --git a/src/services/cookies/cookieImportExport.ts b/src/services/cookies/cookieImportExport.ts
new file mode 100644
index 0000000..91e834d
--- /dev/null
+++ b/src/services/cookies/cookieImportExport.ts
@@ -0,0 +1,25 @@
+/**
+ * Cookie JSON import/export (PRD §9.1 / §9.5).
+ * Must round-trip without data loss for supported fields, and import cleanly
+ * from common cookie-editor formats (EditThisCookie, Cookie-Editor).
+ */
+
+import type { CookieRecord } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export type CookieJsonFormat = 'sessionist' | 'editthiscookie' | 'cookie-editor';
+
+/** Detect which known cookie-editor format a JSON string is in. */
+export function detectFormat(_json: string): CookieJsonFormat | 'unknown' {
+ throw new NotImplementedError('cookies/importExport.detectFormat');
+}
+
+/** Parse external cookie JSON into CookieRecords. */
+export function importCookies(_json: string): CookieRecord[] {
+ throw new NotImplementedError('cookies/importExport.importCookies');
+}
+
+/** Serialize cookies to Sessionist JSON (round-trips supported fields). */
+export function exportCookies(_cookies: CookieRecord[]): string {
+ throw new NotImplementedError('cookies/importExport.exportCookies');
+}
diff --git a/src/services/cookies/cookieService.ts b/src/services/cookies/cookieService.ts
new file mode 100644
index 0000000..4e8ca59
--- /dev/null
+++ b/src/services/cookies/cookieService.ts
@@ -0,0 +1,31 @@
+/**
+ * Cookie editor — free forever (PRD §9.1). The acquisition engine; never
+ * paywalled (PRD §8 principle 1).
+ *
+ * Thin layer over chrome.cookies for a granted origin and its related domains.
+ */
+
+import type { CookieRecord } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+/** List cookies for the active origin and related domains. */
+export async function listCookies(_origin: string): Promise {
+ throw new NotImplementedError('cookies/cookieService.listCookies');
+}
+
+/** Create or update a cookie (name, value, domain, path, expiry, flags). */
+export async function setCookie(_cookie: CookieRecord): Promise {
+ throw new NotImplementedError('cookies/cookieService.setCookie');
+}
+
+/** Delete a single cookie unless it is locked (PRD §9.1 protect/lock). */
+export async function deleteCookie(
+ _cookie: Pick,
+): Promise {
+ throw new NotImplementedError('cookies/cookieService.deleteCookie');
+}
+
+/** Delete all cookies for a site, skipping locked cookies. Returns count. */
+export async function deleteAllForSite(_origin: string): Promise {
+ throw new NotImplementedError('cookies/cookieService.deleteAllForSite');
+}
diff --git a/src/services/cookies/netscapeFormat.ts b/src/services/cookies/netscapeFormat.ts
new file mode 100644
index 0000000..884126a
--- /dev/null
+++ b/src/services/cookies/netscapeFormat.ts
@@ -0,0 +1,15 @@
+/**
+ * Netscape cookies.txt import/export (P1, PRD §9.1 / §17 fast-follow).
+ * Pull into MVP only if needed for first-launch import parity.
+ */
+
+import type { CookieRecord } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export function importNetscape(_text: string): CookieRecord[] {
+ throw new NotImplementedError('cookies/netscape.importNetscape');
+}
+
+export function exportNetscape(_cookies: CookieRecord[]): string {
+ throw new NotImplementedError('cookies/netscape.exportNetscape');
+}
diff --git a/src/services/crypto/encryption.ts b/src/services/crypto/encryption.ts
new file mode 100644
index 0000000..ee7571b
--- /dev/null
+++ b/src/services/crypto/encryption.ts
@@ -0,0 +1,43 @@
+/**
+ * At-rest encryption for profile blobs (PRD §9.8 / §13.5).
+ * WebCrypto AES-GCM only — no third-party crypto, no remote code (PRD §14.2).
+ */
+
+import { NotImplementedError } from '@/lib/result';
+
+export interface EncryptedBlob {
+ /** Format version, so the on-disk shape can evolve. */
+ v: 1;
+ /** Algorithm tag (only AES-GCM today). */
+ alg: 'AES-GCM';
+ /** Which key encrypted this — needed for the MVP-key -> passphrase-key
+ * migration and future rotation (PRD §13.5). */
+ keyId: string;
+ /** AES-GCM ciphertext. */
+ ciphertext: ArrayBuffer;
+ /** 96-bit IV, unique per encryption. */
+ iv: Uint8Array;
+}
+
+/**
+ * Encrypt a JSON-serializable value. `aad` (Additional Authenticated Data, e.g.
+ * the record id) binds the blob to its record so it cannot be swapped between
+ * records undetected.
+ */
+export async function encryptJson(
+ _key: CryptoKey,
+ _keyId: string,
+ _value: unknown,
+ _aad?: string,
+): Promise {
+ // TODO: JSON.stringify -> TextEncoder -> crypto.subtle.encrypt (AES-GCM, additionalData=aad).
+ throw new NotImplementedError('crypto/encryption.encryptJson');
+}
+
+export async function decryptJson(
+ _key: CryptoKey,
+ _blob: EncryptedBlob,
+ _aad?: string,
+): Promise {
+ throw new NotImplementedError('crypto/encryption.decryptJson');
+}
diff --git a/src/services/crypto/keyManager.ts b/src/services/crypto/keyManager.ts
new file mode 100644
index 0000000..e52b3f0
--- /dev/null
+++ b/src/services/crypto/keyManager.ts
@@ -0,0 +1,23 @@
+/**
+ * Encryption key lifecycle.
+ *
+ * MVP: a locally generated AES-GCM key protected by extension storage
+ * (PRD §13.5). P1: passphrase-derived key via PBKDF2 (see passphrase.ts).
+ */
+
+import { NotImplementedError } from '@/lib/result';
+
+/** Return the active data key, generating + persisting one on first use. */
+export async function getOrCreateDataKey(): Promise {
+ throw new NotImplementedError('crypto/keyManager.getOrCreateDataKey');
+}
+
+/** True once a passphrase lock is configured (P1). */
+export async function isPassphraseSet(): Promise {
+ throw new NotImplementedError('crypto/keyManager.isPassphraseSet');
+}
+
+/** Whether the vault is currently unlocked in this worker session. */
+export function isUnlocked(): boolean {
+ throw new NotImplementedError('crypto/keyManager.isUnlocked');
+}
diff --git a/src/services/crypto/passphrase.ts b/src/services/crypto/passphrase.ts
new file mode 100644
index 0000000..b9c5a4e
--- /dev/null
+++ b/src/services/crypto/passphrase.ts
@@ -0,0 +1,24 @@
+/**
+ * Optional passphrase lock (P1, PRD §9.8 / §13.5).
+ * Derives a key from a passphrase using PBKDF2 (native WebCrypto).
+ * Argon2-wasm is an optional later upgrade (PRD §13.5).
+ */
+
+import { NotImplementedError } from '@/lib/result';
+
+export const PBKDF2_ITERATIONS = 600_000;
+
+export async function deriveKeyFromPassphrase(
+ _passphrase: string,
+ _salt: Uint8Array,
+): Promise {
+ throw new NotImplementedError('crypto/passphrase.deriveKeyFromPassphrase');
+}
+
+export async function setPassphrase(_passphrase: string): Promise {
+ throw new NotImplementedError('crypto/passphrase.setPassphrase');
+}
+
+export async function unlockWithPassphrase(_passphrase: string): Promise {
+ throw new NotImplementedError('crypto/passphrase.unlockWithPassphrase');
+}
diff --git a/src/services/export/curlExport.ts b/src/services/export/curlExport.ts
new file mode 100644
index 0000000..5947241
--- /dev/null
+++ b/src/services/export/curlExport.ts
@@ -0,0 +1,11 @@
+/**
+ * cURL export (P1 / Pro — PRD §9.4).
+ * Emits a -b "k=v; ..." cookie header string.
+ */
+
+import type { Profile } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export function exportCurlSnippet(_profile: Profile): string {
+ throw new NotImplementedError('export/curl.exportCurlSnippet');
+}
diff --git a/src/services/export/playwrightExport.ts b/src/services/export/playwrightExport.ts
new file mode 100644
index 0000000..d91f789
--- /dev/null
+++ b/src/services/export/playwrightExport.ts
@@ -0,0 +1,44 @@
+/**
+ * Playwright storageState export — MVP differentiator (PRD §9.3 / §13.7).
+ *
+ * Client-side JSON generation only. Output maps cookies + localStorage origins
+ * to Playwright's storageState shape. sessionStorage is NOT part of standard
+ * storageState — offered as a separate P1 helper snippet (PRD §9.3).
+ */
+
+import type { Profile, CookieRecord } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+/** Playwright storageState shape (subset we emit). */
+export interface PlaywrightStorageState {
+ cookies: Array<{
+ name: string;
+ value: string;
+ domain: string;
+ path: string;
+ expires: number;
+ httpOnly: boolean;
+ secure: boolean;
+ sameSite: 'Strict' | 'Lax' | 'None';
+ }>;
+ origins: Array<{
+ origin: string;
+ localStorage: Array<{ name: string; value: string }>;
+ }>;
+}
+
+/** Build a storageState object from a saved profile. */
+export function toStorageState(_profile: Profile): PlaywrightStorageState {
+ throw new NotImplementedError('export/playwright.toStorageState');
+}
+
+/** Serialize storageState to a downloadable JSON string. */
+export function exportStorageStateJson(_profile: Profile): string {
+ throw new NotImplementedError('export/playwright.exportStorageStateJson');
+}
+
+/** Validate cookie fields against Playwright's expected shape (PRD §13.7). */
+export function validateForPlaywright(_cookies: CookieRecord[]): string[] {
+ // Returns a list of human-readable warnings (empty => clean).
+ throw new NotImplementedError('export/playwright.validateForPlaywright');
+}
diff --git a/src/services/export/puppeteerExport.ts b/src/services/export/puppeteerExport.ts
new file mode 100644
index 0000000..360dc14
--- /dev/null
+++ b/src/services/export/puppeteerExport.ts
@@ -0,0 +1,11 @@
+/**
+ * Puppeteer export (P1 / Pro — PRD §9.4).
+ * Emits a page.setCookie(...) / browser-context setup snippet.
+ */
+
+import type { Profile } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export function exportPuppeteerSnippet(_profile: Profile): string {
+ throw new NotImplementedError('export/puppeteer.exportPuppeteerSnippet');
+}
diff --git a/src/services/export/redaction.ts b/src/services/export/redaction.ts
new file mode 100644
index 0000000..a310a77
--- /dev/null
+++ b/src/services/export/redaction.ts
@@ -0,0 +1,22 @@
+/**
+ * Redaction / preview warnings for exports (PRD §9.3 / §9.4 / §14.3).
+ * Exports contain secrets — warn before clipboard/file, offer obfuscation.
+ */
+
+import type { Profile } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export interface RedactionWarning {
+ field: string;
+ reason: string;
+}
+
+/** Flag values that look like secrets so the UI can warn before sharing. */
+export function scanForSecrets(_profile: Profile): RedactionWarning[] {
+ throw new NotImplementedError('export/redaction.scanForSecrets');
+}
+
+/** Mask sensitive values in a snippet for safe sharing (Pro, PRD §9.4). */
+export function redactSnippet(_snippet: string): string {
+ throw new NotImplementedError('export/redaction.redactSnippet');
+}
diff --git a/src/services/export/seleniumExport.ts b/src/services/export/seleniumExport.ts
new file mode 100644
index 0000000..18c9b5d
--- /dev/null
+++ b/src/services/export/seleniumExport.ts
@@ -0,0 +1,11 @@
+/**
+ * Selenium export (P1 / Pro — PRD §9.4).
+ * Emits driver.add_cookie(...) for Python or JS.
+ */
+
+import type { Profile } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export function exportSeleniumSnippet(_profile: Profile, _lang: 'python' | 'js'): string {
+ throw new NotImplementedError('export/selenium.exportSeleniumSnippet');
+}
diff --git a/src/services/licensing/entitlementService.ts b/src/services/licensing/entitlementService.ts
new file mode 100644
index 0000000..e46f2d4
--- /dev/null
+++ b/src/services/licensing/entitlementService.ts
@@ -0,0 +1,32 @@
+/**
+ * Entitlement state — gates Pro/Team features (PRD §11).
+ * The cached entitlement lives in chrome.storage.local; the source of truth is
+ * the locally verified license key.
+ */
+
+import type { Entitlement } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+const FREE: Entitlement = { subjectId: 'local', tier: 'free' };
+
+/** Current entitlement, defaulting to free. */
+export async function getEntitlement(): Promise {
+ // TODO: read cached entitlement; fall back to FREE.
+ throw new NotImplementedError('licensing/entitlement.getEntitlement');
+}
+
+/** Verify + persist a license key, returning the resulting entitlement. */
+export async function activateLicense(_licenseKey: string): Promise {
+ throw new NotImplementedError('licensing/entitlement.activateLicense');
+}
+
+/** Begin Stripe-hosted checkout via the Cloudflare Worker. */
+export async function startCheckout(): Promise<{ checkoutUrl: string }> {
+ throw new NotImplementedError('licensing/entitlement.startCheckout');
+}
+
+/** Convenience gate used by UI/services. */
+export async function hasPro(): Promise {
+ const e = await getEntitlement().catch(() => FREE);
+ return e.tier === 'pro' || e.tier === 'team';
+}
diff --git a/src/services/licensing/licenseVerifier.ts b/src/services/licensing/licenseVerifier.ts
new file mode 100644
index 0000000..4a74f9a
--- /dev/null
+++ b/src/services/licensing/licenseVerifier.ts
@@ -0,0 +1,20 @@
+/**
+ * Offline license verification (PRD §13.8 / decision #3).
+ *
+ * The Cloudflare Worker mints an Ed25519-signed license key after Stripe
+ * checkout. The extension verifies it locally with a public key baked into the
+ * build (WXT_LICENSE_PUBLIC_KEY). No license DB for MVP.
+ *
+ * Honest framing (PRD §13.8): the gate is removable since the core is
+ * source-available. Ed25519 makes keys unforgeable, not the client untamperable.
+ * Do not build anti-piracy machinery around this.
+ */
+
+import type { Entitlement } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+/** Verify an Ed25519-signed license key and decode its entitlement payload. */
+export async function verifyLicenseKey(_licenseKey: string): Promise {
+ // TODO: crypto.subtle.verify with the baked-in public key.
+ throw new NotImplementedError('licensing/verifier.verifyLicenseKey');
+}
diff --git a/src/services/permissions/permissionService.ts b/src/services/permissions/permissionService.ts
new file mode 100644
index 0000000..283ebf6
--- /dev/null
+++ b/src/services/permissions/permissionService.ts
@@ -0,0 +1,28 @@
+/**
+ * Runtime host-permission management (PRD §9.6 / §14.1).
+ *
+ * No at install. When the user acts on a site, request access for
+ * that origin only, store granted origins, and allow inspect/revoke later.
+ */
+
+import { NotImplementedError } from '@/lib/result';
+
+/** Origins the user has granted host access to. */
+export async function listGrantedOrigins(): Promise {
+ throw new NotImplementedError('permissions/permissionService.listGrantedOrigins');
+}
+
+/** Prompt for host access to a single origin. Returns whether granted. */
+export async function requestOrigin(_origin: string): Promise {
+ throw new NotImplementedError('permissions/permissionService.requestOrigin');
+}
+
+/** Revoke previously granted host access for an origin. */
+export async function revokeOrigin(_origin: string): Promise {
+ throw new NotImplementedError('permissions/permissionService.revokeOrigin');
+}
+
+/** Whether we already hold host access for an origin. */
+export async function hasOrigin(_origin: string): Promise {
+ throw new NotImplementedError('permissions/permissionService.hasOrigin');
+}
diff --git a/src/services/profiles/captureService.ts b/src/services/profiles/captureService.ts
new file mode 100644
index 0000000..160f62f
--- /dev/null
+++ b/src/services/profiles/captureService.ts
@@ -0,0 +1,37 @@
+/**
+ * Capture the current session for the active site as a Profile (PRD §9.2).
+ *
+ * Scope: cookies (cookies API) + localStorage + active-tab sessionStorage
+ * (read by injecting a function via chrome.scripting.executeScript — see
+ * services/capture/webStorageCapture.ts). IndexedDB capture is gated on the
+ * auth-storage spike (PRD §9.2 / §17) and surfaced as an UnsupportedStoreNotice
+ * until then.
+ *
+ * Web-storage limitation (PRD §13.6): localStorage/sessionStorage are
+ * origin-partitioned and only reachable in the active tab's origin. For
+ * multi-domain SSO (domainScope spanning several origins), cookies cover the
+ * full scope but web storage is captured for the active origin only — surface
+ * the other origins as not-captured rather than half-applying silently.
+ */
+
+import type { Profile } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export interface CaptureOptions {
+ name: string;
+ tabId: number;
+ /** Origins beyond the active one to include (multi-domain SSO, PRD §13.6). */
+ extraOrigins?: string[];
+}
+
+/** Capture supported stores into a new Profile (not yet persisted). */
+export async function captureProfile(_opts: CaptureOptions): Promise {
+ // TODO: gather cookies for domainScope + web storage via executeScript,
+ // attach UnsupportedStoreNotice for IndexedDB and non-active-origin web storage.
+ throw new NotImplementedError('profiles/capture.captureProfile');
+}
+
+/** Resolve the full domain scope (auth often spans several domains). */
+export async function resolveDomainScope(_origin: string): Promise {
+ throw new NotImplementedError('profiles/capture.resolveDomainScope');
+}
diff --git a/src/services/profiles/profileService.ts b/src/services/profiles/profileService.ts
new file mode 100644
index 0000000..cd7fdfe
--- /dev/null
+++ b/src/services/profiles/profileService.ts
@@ -0,0 +1,33 @@
+/**
+ * Profile CRUD + organization + free-tier gating (PRD §9.2).
+ *
+ * Free cap is a *usage-milestone* upsell, not a hard block at save #4
+ * (PRD §9.2 / decision #12). Switching among saved profiles is never throttled.
+ */
+
+import type { Profile } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export async function listProfiles(): Promise {
+ throw new NotImplementedError('profiles/profileService.listProfiles');
+}
+
+export async function saveCapturedProfile(_profile: Profile): Promise {
+ throw new NotImplementedError('profiles/profileService.saveCapturedProfile');
+}
+
+export async function deleteProfile(_id: string): Promise {
+ throw new NotImplementedError('profiles/profileService.deleteProfile');
+}
+
+export async function updateProfileMeta(
+ _id: string,
+ _meta: Partial>,
+): Promise {
+ throw new NotImplementedError('profiles/profileService.updateProfileMeta');
+}
+
+/** Whether saving another profile should trigger the upsell (not block it). */
+export async function shouldPromptUpsell(): Promise {
+ throw new NotImplementedError('profiles/profileService.shouldPromptUpsell');
+}
diff --git a/src/services/profiles/snapshotService.ts b/src/services/profiles/snapshotService.ts
new file mode 100644
index 0000000..b062d56
--- /dev/null
+++ b/src/services/profiles/snapshotService.ts
@@ -0,0 +1,27 @@
+/**
+ * Pre-switch safety snapshots (PRD §8 principle 5 / §9.2).
+ * A switch must always leave a recoverable snapshot, even on partial failure.
+ */
+
+import type { Snapshot, SwitchResult } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+/** Snapshot current supported state for an origin/domain scope. */
+export async function takeSnapshot(
+ _origin: string,
+ _tabId: number,
+ _reason: string,
+): Promise {
+ throw new NotImplementedError('profiles/snapshot.takeSnapshot');
+}
+
+/**
+ * Re-apply a snapshot (the recovery path, PRD §8 principle 5). Reports per-store
+ * results just like a switch so the UI can show exactly what was restored.
+ */
+export async function restoreSnapshotAsSwitch(
+ _snapshotId: string,
+ _tabId: number,
+): Promise {
+ throw new NotImplementedError('profiles/snapshot.restoreSnapshotAsSwitch');
+}
diff --git a/src/services/profiles/switchEngine.ts b/src/services/profiles/switchEngine.ts
new file mode 100644
index 0000000..ab742ab
--- /dev/null
+++ b/src/services/profiles/switchEngine.ts
@@ -0,0 +1,41 @@
+/**
+ * Transaction-like profile switching (PRD §9.2 / §13.6 / decision #7).
+ *
+ * NOT a true atomic browser transaction. The sequence is:
+ * 1. Confirm target profile (caller/UI).
+ * 2. Snapshot current supported state.
+ * 3. Clear supported current state for the active site / domain scope.
+ * 4. Apply selected profile.
+ * 5. Reload the active tab.
+ * 6. Report success/failure per store — never half-switch silently.
+ *
+ * Implementation contract for whoever fills these in:
+ * - Host permission for the active origin must be confirmed (permissionService)
+ * before any executeScript injection, or injection throws opaquely.
+ * - Steps 4 and 5 must be strictly awaited and ordered: apply web storage, then
+ * reload. A reload firing before the injected apply resolves drops the applied
+ * state; reloading before clear/apply lets the live page re-persist stale state.
+ * - Web storage is active-origin only (see captureService); cookies cover the
+ * domainScope. Report non-active origins as not-captured/applied.
+ */
+
+import type { SwitchResult } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+/** Full clear-then-apply switch. Always produces a recoverable snapshot. */
+export async function switchToProfile(_profileId: string, _tabId: number): Promise {
+ throw new NotImplementedError('profiles/switchEngine.switchToProfile');
+}
+
+/** Additive apply: restore a profile without clearing current state (§9.2). */
+export async function restoreAdditive(_profileId: string, _tabId: number): Promise {
+ throw new NotImplementedError('profiles/switchEngine.restoreAdditive');
+}
+
+/** Warn if other same-origin tabs are open and could race the switch (§13.6). */
+export async function findConflictingTabs(
+ _origin: string,
+ _activeTabId: number,
+): Promise {
+ throw new NotImplementedError('profiles/switchEngine.findConflictingTabs');
+}
diff --git a/src/services/storage/db.ts b/src/services/storage/db.ts
new file mode 100644
index 0000000..d32192d
--- /dev/null
+++ b/src/services/storage/db.ts
@@ -0,0 +1,42 @@
+/**
+ * Extension-local IndexedDB wrapper (PRD §13.4).
+ *
+ * Larger encrypted profile/snapshot blobs live here; small metadata lives in
+ * chrome.storage.local (see settingsRepository). This is Sessionist's own DB —
+ * distinct from capturing a *target site's* IndexedDB (post-MVP, PRD §13.4).
+ */
+
+import { NotImplementedError } from '@/lib/result';
+
+export const DB_NAME = 'sessionist';
+export const DB_VERSION = 1;
+
+export const STORE_PROFILES = 'profiles';
+export const STORE_SNAPSHOTS = 'snapshots';
+export const STORE_PROJECTS = 'projects';
+
+/** Open (and lazily migrate) the IndexedDB database. */
+export async function openDb(): Promise {
+ // TODO: implement open + onupgradeneeded creating the object stores above.
+ throw new NotImplementedError('storage/db.openDb');
+}
+
+/** Read a single encrypted blob by key. */
+export async function getBlob(_store: string, _key: string): Promise {
+ throw new NotImplementedError('storage/db.getBlob');
+}
+
+/** Write a single encrypted blob. */
+export async function putBlob(_store: string, _key: string, _blob: ArrayBuffer): Promise {
+ throw new NotImplementedError('storage/db.putBlob');
+}
+
+/** Delete a blob by key. */
+export async function deleteBlob(_store: string, _key: string): Promise {
+ throw new NotImplementedError('storage/db.deleteBlob');
+}
+
+/** List all keys in a store. */
+export async function listKeys(_store: string): Promise {
+ throw new NotImplementedError('storage/db.listKeys');
+}
diff --git a/src/services/storage/profileRepository.ts b/src/services/storage/profileRepository.ts
new file mode 100644
index 0000000..22766f6
--- /dev/null
+++ b/src/services/storage/profileRepository.ts
@@ -0,0 +1,43 @@
+/**
+ * Persistence for profiles & snapshots.
+ *
+ * Profiles are encrypted at rest (PRD §9.8 / §13.5) before hitting IndexedDB.
+ * Size is tracked so we can warn before saving very large profiles (§13.4).
+ */
+
+import type { Profile, Snapshot } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export async function listProfiles(): Promise {
+ throw new NotImplementedError('storage/profileRepo.listProfiles');
+}
+
+export async function getProfile(_id: string): Promise {
+ throw new NotImplementedError('storage/profileRepo.getProfile');
+}
+
+export async function saveProfile(_profile: Profile): Promise {
+ // TODO: encrypt blob, track sizeBytes, warn on quota (PRD §13.4).
+ throw new NotImplementedError('storage/profileRepo.saveProfile');
+}
+
+export async function deleteProfile(_id: string): Promise {
+ throw new NotImplementedError('storage/profileRepo.deleteProfile');
+}
+
+export async function listSnapshots(): Promise {
+ throw new NotImplementedError('storage/profileRepo.listSnapshots');
+}
+
+export async function saveSnapshot(_snapshot: Snapshot): Promise {
+ throw new NotImplementedError('storage/profileRepo.saveSnapshot');
+}
+
+export async function getSnapshot(_id: string): Promise {
+ throw new NotImplementedError('storage/profileRepo.getSnapshot');
+}
+
+/** Best-effort serialized-size estimate for quota warnings. */
+export function estimateSizeBytes(_profile: Profile): number {
+ throw new NotImplementedError('storage/profileRepo.estimateSizeBytes');
+}
diff --git a/src/services/storage/settingsRepository.ts b/src/services/storage/settingsRepository.ts
new file mode 100644
index 0000000..34f677e
--- /dev/null
+++ b/src/services/storage/settingsRepository.ts
@@ -0,0 +1,41 @@
+/**
+ * Small key/value metadata in chrome.storage.local (PRD §13.4).
+ *
+ * Profile *index* metadata, granted origins, theme, telemetry opt-in, and the
+ * cached entitlement live here. Bulk encrypted blobs live in IndexedDB.
+ *
+ * This module is implemented (not stubbed): it's foundational plumbing that
+ * onboarding routing, theming, and the telemetry opt-in all depend on to make
+ * the skeleton actually runnable.
+ */
+
+export interface AppSettings {
+ theme: 'light' | 'dark' | 'system';
+ telemetryOptIn: boolean;
+ onboardingComplete: boolean;
+ /** Origins the user has granted host access to (PRD §9.6). */
+ grantedOrigins: string[];
+ /** Soft cap for free tier; usage-milestone gating (PRD §9.2). */
+ freeProfileLimit: number;
+}
+
+export const DEFAULT_SETTINGS: AppSettings = {
+ theme: 'system',
+ telemetryOptIn: false, // telemetry off by default (PRD §15).
+ onboardingComplete: false,
+ grantedOrigins: [],
+ freeProfileLimit: 3,
+};
+
+const KEY = 'settings';
+
+export async function getSettings(): Promise {
+ const raw = await chrome.storage.local.get(KEY);
+ return { ...DEFAULT_SETTINGS, ...(raw[KEY] as Partial | undefined) };
+}
+
+export async function patchSettings(patch: Partial): Promise {
+ const next = { ...(await getSettings()), ...patch };
+ await chrome.storage.local.set({ [KEY]: next });
+ return next;
+}
diff --git a/src/services/team/authService.ts b/src/services/team/authService.ts
new file mode 100644
index 0000000..2ea8137
--- /dev/null
+++ b/src/services/team/authService.ts
@@ -0,0 +1,28 @@
+/**
+ * Team account auth (P2 — PRD §9.7 / §13.9). Build only after validation gates.
+ * Google OAuth + email magic link; short-lived JWT access + refresh.
+ */
+
+import { NotImplementedError } from '@/lib/result';
+
+export interface Session {
+ userId: string;
+ accessToken: string;
+ expiresAt: string;
+}
+
+export async function signInWithGoogle(): Promise {
+ throw new NotImplementedError('team/auth.signInWithGoogle');
+}
+
+export async function signInWithMagicLink(_email: string): Promise {
+ throw new NotImplementedError('team/auth.signInWithMagicLink');
+}
+
+export async function signOut(): Promise {
+ throw new NotImplementedError('team/auth.signOut');
+}
+
+export async function getSession(): Promise {
+ throw new NotImplementedError('team/auth.getSession');
+}
diff --git a/src/services/team/syncService.ts b/src/services/team/syncService.ts
new file mode 100644
index 0000000..b41b344
--- /dev/null
+++ b/src/services/team/syncService.ts
@@ -0,0 +1,19 @@
+/**
+ * Zero-knowledge cloud sync (P2 — PRD §9.7 / §13.10).
+ * The server stores ciphertext only. To make "server never sees plaintext" a
+ * type guarantee, the network boundary accepts/returns EncryptedBlobs — plaintext
+ * Profiles are encrypted strictly before this layer and decrypted strictly after.
+ */
+
+import type { EncryptedBlob } from '@/services/crypto/encryption';
+import { NotImplementedError } from '@/lib/result';
+
+/** Upload already-encrypted profile blobs. Cannot receive plaintext by design. */
+export async function pushEncryptedProfiles(_blobs: EncryptedBlob[]): Promise {
+ throw new NotImplementedError('team/sync.pushEncryptedProfiles');
+}
+
+/** Download ciphertext blobs; decryption happens in the caller, locally. */
+export async function pullEncryptedProfiles(): Promise {
+ throw new NotImplementedError('team/sync.pullEncryptedProfiles');
+}
diff --git a/src/services/team/vaultService.ts b/src/services/team/vaultService.ts
new file mode 100644
index 0000000..d906a54
--- /dev/null
+++ b/src/services/team/vaultService.ts
@@ -0,0 +1,29 @@
+/**
+ * Shared encrypted vaults (P2 — PRD §9.7 / §13.10).
+ * Team key wrapped per member; revocation requires key rotation for *future*
+ * material only (it cannot claw back already-decrypted sessions — PRD §9.7).
+ */
+
+import type { Profile, Role, Vault } from '@/types/models';
+import { NotImplementedError } from '@/lib/result';
+
+export async function listVaults(): Promise {
+ throw new NotImplementedError('team/vault.listVaults');
+}
+
+export async function createVault(_name: string): Promise {
+ throw new NotImplementedError('team/vault.createVault');
+}
+
+export async function inviteMember(_vaultId: string, _email: string, _role: Role): Promise {
+ throw new NotImplementedError('team/vault.inviteMember');
+}
+
+export async function publishProfile(_vaultId: string, _profile: Profile): Promise {
+ throw new NotImplementedError('team/vault.publishProfile');
+}
+
+/** Rotate the team key (e.g. after revoking a member). */
+export async function rotateKey(_vaultId: string): Promise {
+ throw new NotImplementedError('team/vault.rotateKey');
+}
diff --git a/src/services/telemetry/telemetry.ts b/src/services/telemetry/telemetry.ts
new file mode 100644
index 0000000..b3e0280
--- /dev/null
+++ b/src/services/telemetry/telemetry.ts
@@ -0,0 +1,48 @@
+/**
+ * Opt-in, event-level telemetry (PRD §15).
+ *
+ * Off by default. MUST NEVER transmit cookie/storage/profile values, keys,
+ * test-account identifiers, or raw URLs. `track` only ever receives an event
+ * name from the allowed union below — there is deliberately no payload param.
+ *
+ * `track` is implemented as safe plumbing (not a throwing stub) so success-moment
+ * call sites can exist without breaking flows: it no-ops unless the user opted
+ * in, and never throws. The actual network send remains a TODO.
+ */
+
+import { getSettings, patchSettings } from '@/services/storage/settingsRepository';
+import { logger } from '@/lib/logger';
+
+/** The only events allowed (PRD §15). */
+export type TelemetryEvent =
+ | 'install'
+ | 'profile_saved'
+ | 'profile_switch_success'
+ | 'profile_switch_failure'
+ | 'playwright_export_used'
+ | 'paywall_view'
+ | 'upgrade'
+ | 'review_prompt_shown'
+ | 'team_invite_sent' // P2
+ | 'team_invite_accepted'; // P2
+
+/** Record an event if (and only if) the user has opted in. Never throws. */
+export async function track(event: TelemetryEvent): Promise {
+ try {
+ const settings = await getSettings();
+ if (!settings.telemetryOptIn) return;
+ // TODO: POST { event } only (no values) to WXT_TELEMETRY_ENDPOINT.
+ logger.debug('telemetry', 'event', { type: event });
+ } catch {
+ // Telemetry must never disrupt a user flow.
+ }
+}
+
+/** Fire-and-forget helper for call sites that should not await. */
+export function trackAsync(event: TelemetryEvent): void {
+ void track(event);
+}
+
+export async function setOptIn(optIn: boolean): Promise {
+ await patchSettings({ telemetryOptIn: optIn });
+}
diff --git a/src/state/store.ts b/src/state/store.ts
new file mode 100644
index 0000000..d301fbb
--- /dev/null
+++ b/src/state/store.ts
@@ -0,0 +1,70 @@
+/**
+ * UI state (PRD §13.1). Zustand, hydrated from the background via messaging.
+ * Holds no secrets longer than needed; durable truth lives in the worker/storage.
+ */
+
+import { create } from 'zustand';
+import type { CookieRecord, Entitlement, Profile, Snapshot } from '@/types/models';
+import type { AppSettings } from '@/services/storage/settingsRepository';
+
+export type View =
+ | 'onboarding'
+ | 'cookies'
+ | 'profiles'
+ | 'export'
+ | 'siteAccess'
+ | 'settings'
+ | 'team'
+ | 'upgrade';
+
+interface UiState {
+ view: View;
+ activeOrigin: string | null;
+ activeTabId: number | null;
+
+ cookies: CookieRecord[];
+ profiles: Profile[];
+ snapshots: Snapshot[];
+ entitlement: Entitlement | null;
+ grantedOrigins: string[];
+ settings: AppSettings | null;
+
+ loading: boolean;
+ error: string | null;
+
+ setView: (view: View) => void;
+ setActive: (origin: string | null, tabId: number | null) => void;
+ setCookies: (cookies: CookieRecord[]) => void;
+ setProfiles: (profiles: Profile[]) => void;
+ setSnapshots: (snapshots: Snapshot[]) => void;
+ setEntitlement: (entitlement: Entitlement | null) => void;
+ setGrantedOrigins: (origins: string[]) => void;
+ setSettings: (settings: AppSettings | null) => void;
+ setLoading: (loading: boolean) => void;
+ setError: (error: string | null) => void;
+}
+
+export const useStore = create((set) => ({
+ view: 'cookies',
+ activeOrigin: null,
+ activeTabId: null,
+ cookies: [],
+ profiles: [],
+ snapshots: [],
+ entitlement: null,
+ grantedOrigins: [],
+ settings: null,
+ loading: false,
+ error: null,
+
+ setView: (view) => set({ view }),
+ setActive: (activeOrigin, activeTabId) => set({ activeOrigin, activeTabId }),
+ setCookies: (cookies) => set({ cookies }),
+ setProfiles: (profiles) => set({ profiles }),
+ setSnapshots: (snapshots) => set({ snapshots }),
+ setEntitlement: (entitlement) => set({ entitlement }),
+ setGrantedOrigins: (grantedOrigins) => set({ grantedOrigins }),
+ setSettings: (settings) => set({ settings }),
+ setLoading: (loading) => set({ loading }),
+ setError: (error) => set({ error }),
+}));
diff --git a/src/types/messages.ts b/src/types/messages.ts
new file mode 100644
index 0000000..574c56f
--- /dev/null
+++ b/src/types/messages.ts
@@ -0,0 +1,97 @@
+/**
+ * Type-safe message protocol (PRD §13.1).
+ *
+ * UI -> background (service worker): the `BgRequest` union, answered with a
+ * `BgEnvelope` wrapping the typed `BgResponse`.
+ *
+ * Page-context web storage (localStorage/sessionStorage) is reached by injecting
+ * a function via chrome.scripting.executeScript on a granted, active tab — not a
+ * persistent content script — so no broad host permission is needed (PRD §9.6).
+ */
+
+import type { CookieRecord, Entitlement, Profile, Snapshot, SwitchResult } from './models';
+import type { AppSettings } from '@/services/storage/settingsRepository';
+
+// --- UI -> background -------------------------------------------------------
+
+export type BgRequest =
+ // Cookie editor
+ | { type: 'cookies/list'; origin: string }
+ | { type: 'cookies/set'; cookie: CookieRecord }
+ | {
+ type: 'cookies/delete';
+ cookie: Pick;
+ }
+ | { type: 'cookies/deleteAll'; origin: string }
+ | { type: 'cookies/import'; json: string }
+ | { type: 'cookies/export'; origin: string }
+ // Profiles
+ | { type: 'profiles/list' }
+ | { type: 'profiles/capture'; name: string; tabId: number }
+ | { type: 'profiles/switch'; profileId: string; tabId: number }
+ | { type: 'profiles/restore'; profileId: string; tabId: number }
+ | { type: 'profiles/delete'; profileId: string }
+ | { type: 'profiles/shouldPromptUpsell' }
+ // Snapshots
+ | { type: 'snapshots/list' }
+ | { type: 'snapshots/restore'; snapshotId: string; tabId: number }
+ // Export
+ | { type: 'export/playwright'; profileId: string }
+ | { type: 'export/puppeteer'; profileId: string }
+ | { type: 'export/selenium'; profileId: string; lang: 'python' | 'js' }
+ | { type: 'export/curl'; profileId: string }
+ // Permissions
+ | { type: 'permissions/list' }
+ | { type: 'permissions/request'; origin: string }
+ | { type: 'permissions/revoke'; origin: string }
+ // Settings
+ | { type: 'settings/get' }
+ | { type: 'settings/patch'; patch: Partial }
+ // Licensing / entitlements
+ | { type: 'entitlement/get' }
+ | { type: 'entitlement/activate'; licenseKey: string }
+ | { type: 'entitlement/startCheckout' };
+
+// Map each request to its response payload.
+export interface BgResponseMap {
+ 'cookies/list': CookieRecord[];
+ 'cookies/set': void;
+ 'cookies/delete': void;
+ 'cookies/deleteAll': number;
+ 'cookies/import': CookieRecord[];
+ 'cookies/export': string;
+ 'profiles/list': Profile[];
+ 'profiles/capture': Profile;
+ 'profiles/switch': SwitchResult;
+ 'profiles/restore': SwitchResult;
+ 'profiles/delete': void;
+ 'profiles/shouldPromptUpsell': boolean;
+ 'snapshots/list': Snapshot[];
+ 'snapshots/restore': SwitchResult;
+ 'export/playwright': string;
+ 'export/puppeteer': string;
+ 'export/selenium': string;
+ 'export/curl': string;
+ 'permissions/list': string[];
+ 'permissions/request': boolean;
+ 'permissions/revoke': boolean;
+ 'settings/get': AppSettings;
+ 'settings/patch': AppSettings;
+ 'entitlement/get': Entitlement;
+ 'entitlement/activate': Entitlement;
+ 'entitlement/startCheckout': { checkoutUrl: string };
+}
+
+export type BgResponse = T extends keyof BgResponseMap
+ ? BgResponseMap[T]
+ : never;
+
+/** Wire envelope every background reply is wrapped in (success or failure). */
+export type BgEnvelope = { ok: true; value: V } | { ok: false; error: string };
+
+// --- Page-context web storage (injected via executeScript) ------------------
+
+export interface WebStorageSnapshot {
+ localStorage: Record;
+ sessionStorage: Record;
+}
diff --git a/src/types/models.ts b/src/types/models.ts
new file mode 100644
index 0000000..e9d88b1
--- /dev/null
+++ b/src/types/models.ts
@@ -0,0 +1,129 @@
+/**
+ * Core domain model for Sessionist.
+ *
+ * Mirrors PRD §13.11 with the supporting types the skeleton needs. Nothing here
+ * has behaviour — these are the shapes every feature is wired against.
+ */
+
+export type Environment = 'dev' | 'staging' | 'prod' | 'other';
+
+export type Tier = 'free' | 'pro' | 'team';
+
+export type SameSite = 'no_restriction' | 'lax' | 'strict' | 'unspecified';
+
+/** A single cookie, modelled on chrome.cookies.Cookie + Playwright's shape. */
+export interface CookieRecord {
+ name: string;
+ value: string;
+ domain: string;
+ path: string;
+ /** Unix seconds. Undefined => session cookie. */
+ expirationDate?: number;
+ secure: boolean;
+ httpOnly: boolean;
+ sameSite: SameSite;
+ hostOnly?: boolean;
+ session?: boolean;
+ storeId?: string;
+ /** CHIPS partition key, where the browser exposes it (PRD §9.1). */
+ partitionKey?: string;
+ /** User-locked cookies are protected from Sessionist delete operations. */
+ locked?: boolean;
+}
+
+/** Stores Sessionist knows about but cannot capture, surfaced honestly in UI. */
+export interface UnsupportedStoreNotice {
+ store: 'indexedDB' | 'cacheStorage' | 'serviceWorker' | 'memory' | 'other';
+ reason: string;
+}
+
+export interface Profile {
+ id: string;
+ name: string;
+ projectId?: string;
+ environment?: Environment;
+ tags: string[];
+ /** The origin the profile was captured from. */
+ origin: string;
+ /** All origins/domains this profile's auth spans (PRD §13.6 multi-domain). */
+ domainScope: string[];
+ cookies: CookieRecord[];
+ localStorage: Record;
+ sessionStorage: Record;
+ unsupportedStores?: UnsupportedStoreNotice[];
+ sizeBytes: number;
+ createdAt: string;
+ updatedAt: string;
+}
+
+/** Pre-switch safety snapshot (PRD §9.2 / §8 principle 5). */
+export interface Snapshot {
+ id: string;
+ /** The origin/active site this snapshot was taken for. */
+ origin: string;
+ /** The profile being switched away from, if the snapshot is tied to one. */
+ fromProfileId?: string;
+ domainScope: string[];
+ cookies: CookieRecord[];
+ localStorage: Record;
+ sessionStorage: Record;
+ /** Which stores the accompanying switch cleared — makes restore precise. */
+ clearedStores?: StoreKind[];
+ createdAt: string;
+ /** Why the snapshot was taken — e.g. 'pre-switch', 'pre-clear'. */
+ reason: string;
+}
+
+export interface Project {
+ id: string;
+ name: string;
+}
+
+// ---------------------------------------------------------------------------
+// Team (P2) — shapes only; no backend wired in MVP.
+// ---------------------------------------------------------------------------
+
+export type Role = 'owner' | 'admin' | 'member';
+
+export interface Membership {
+ userId: string;
+ vaultId: string;
+ role: Role;
+}
+
+export interface Vault {
+ id: string;
+ name: string;
+ ownerId: string;
+ members: Membership[];
+ /** Team key wrapped per member (zero-knowledge sync, PRD §13.10). */
+ encryptedKeyPerMember: Record;
+}
+
+export interface Entitlement {
+ subjectId: string;
+ tier: Tier;
+ seats?: number;
+ validUntil?: string;
+}
+
+// ---------------------------------------------------------------------------
+// Per-store operation results — switching must report success/failure per store
+// rather than silently half-switching (PRD §9.2 / §13.6).
+// ---------------------------------------------------------------------------
+
+export type StoreKind = 'cookies' | 'localStorage' | 'sessionStorage' | 'indexedDB';
+
+export interface StoreResult {
+ store: StoreKind;
+ status: 'applied' | 'cleared' | 'skipped' | 'failed' | 'not-captured';
+ message?: string;
+}
+
+export interface SwitchResult {
+ profileId: string;
+ snapshotId: string;
+ results: StoreResult[];
+ reloadedTabId?: number;
+ succeeded: boolean;
+}
diff --git a/src/ui/App.tsx b/src/ui/App.tsx
new file mode 100644
index 0000000..81445fa
--- /dev/null
+++ b/src/ui/App.tsx
@@ -0,0 +1,109 @@
+/**
+ * App shell shared by the side panel (primary) and popup (P1).
+ * Loads settings on mount, routes first-run users to onboarding, applies the
+ * theme, and renders the active view. Each PRD feature has a view entry point.
+ */
+
+import React, { useEffect } from 'react';
+import { useStore, type View } from '@/state/store';
+import { useActiveTab } from '@/ui/hooks/useActiveTab';
+import { useTheme } from '@/ui/hooks/useTheme';
+import { useBackground } from '@/ui/hooks/useBackground';
+import { ErrorBoundary } from '@/ui/components/ErrorBoundary';
+import { CookieEditorView } from '@/ui/views/CookieEditorView';
+import { ProfilesView } from '@/ui/views/ProfilesView';
+import { ExportView } from '@/ui/views/ExportView';
+import { OnboardingView } from '@/ui/views/OnboardingView';
+import { SiteAccessView } from '@/ui/views/SiteAccessView';
+import { SettingsView } from '@/ui/views/SettingsView';
+import { TeamView } from '@/ui/views/TeamView';
+import { UpgradeView } from '@/ui/views/UpgradeView';
+
+const NAV: Array<{ id: View; label: string }> = [
+ { id: 'cookies', label: 'Cookies' },
+ { id: 'profiles', label: 'Profiles' },
+ { id: 'export', label: 'Export' },
+ { id: 'siteAccess', label: 'Sites' },
+ { id: 'team', label: 'Team' },
+ { id: 'settings', label: 'Settings' },
+];
+
+export function App({ surface }: { surface: 'sidepanel' | 'popup' }) {
+ const view = useStore((s) => s.view);
+ const setView = useStore((s) => s.setView);
+ const settings = useStore((s) => s.settings);
+ const setSettings = useStore((s) => s.setSettings);
+ const { activeOrigin } = useActiveTab();
+ const { call } = useBackground();
+
+ useTheme(settings?.theme);
+
+ // First-run: load settings, route to onboarding if not completed yet.
+ useEffect(() => {
+ call({ type: 'settings/get' }).then((s) => {
+ if (!s) return;
+ setSettings(s);
+ if (!s.onboardingComplete) setView('onboarding');
+ });
+ }, [call, setSettings, setView]);
+
+ return (
+
+
+ Sessionist
+
+ {activeOrigin ?? 'no active site'}
+
+
+
+
+ {NAV.map((item) => (
+ setView(item.id)}
+ aria-current={view === item.id ? 'page' : undefined}
+ className={`px-2 py-1 text-sm rounded whitespace-nowrap ${
+ view === item.id
+ ? 'bg-brand text-brand-fg'
+ : 'text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800'
+ }`}
+ >
+ {item.label}
+
+ ))}
+
+
+
+
+
+
+
+
+ );
+}
+
+function CurrentView({ view }: { view: View }) {
+ switch (view) {
+ case 'onboarding':
+ return ;
+ case 'cookies':
+ return ;
+ case 'profiles':
+ return ;
+ case 'export':
+ return ;
+ case 'siteAccess':
+ return ;
+ case 'settings':
+ return ;
+ case 'team':
+ return ;
+ case 'upgrade':
+ return ;
+ default:
+ return null;
+ }
+}
diff --git a/src/ui/components/ErrorBoundary.tsx b/src/ui/components/ErrorBoundary.tsx
new file mode 100644
index 0000000..3493664
--- /dev/null
+++ b/src/ui/components/ErrorBoundary.tsx
@@ -0,0 +1,33 @@
+/** Top-level error boundary so one view's throw doesn't blank the whole panel. */
+
+import React from 'react';
+
+interface State {
+ error: Error | null;
+}
+
+export class ErrorBoundary extends React.Component<{ children: React.ReactNode }, State> {
+ override state: State = { error: null };
+
+ static getDerivedStateFromError(error: Error): State {
+ return { error };
+ }
+
+ override render() {
+ if (this.state.error) {
+ return (
+
+
Something went wrong.
+
{this.state.error.message}
+
this.setState({ error: null })}
+ >
+ Try again
+
+
+ );
+ }
+ return this.props.children;
+ }
+}
diff --git a/src/ui/components/primitives.tsx b/src/ui/components/primitives.tsx
new file mode 100644
index 0000000..a64c805
--- /dev/null
+++ b/src/ui/components/primitives.tsx
@@ -0,0 +1,57 @@
+/** Tiny shared UI primitives so views stay consistent and short. */
+
+import React from 'react';
+
+export function Button({
+ children,
+ variant = 'default',
+ ...props
+}: React.ButtonHTMLAttributes & {
+ variant?: 'default' | 'primary' | 'danger';
+}) {
+ const base =
+ 'px-3 py-1.5 rounded text-sm font-medium disabled:opacity-50 disabled:cursor-not-allowed transition-colors';
+ const variants: Record = {
+ default:
+ 'bg-gray-200 hover:bg-gray-300 text-gray-900 dark:bg-gray-700 dark:hover:bg-gray-600 dark:text-gray-100',
+ primary: 'bg-brand hover:opacity-90 text-brand-fg',
+ danger: 'bg-red-600 hover:bg-red-700 text-white',
+ };
+ return (
+
+ {children}
+
+ );
+}
+
+export function Panel({
+ title,
+ children,
+ actions,
+}: {
+ title: string;
+ children: React.ReactNode;
+ actions?: React.ReactNode;
+}) {
+ return (
+
+ );
+}
+
+export function Empty({ children }: { children: React.ReactNode }) {
+ return {children}
;
+}
+
+export function ProBadge() {
+ return (
+
+ Pro
+
+ );
+}
diff --git a/src/ui/hooks/useActiveTab.ts b/src/ui/hooks/useActiveTab.ts
new file mode 100644
index 0000000..42ae5d5
--- /dev/null
+++ b/src/ui/hooks/useActiveTab.ts
@@ -0,0 +1,63 @@
+/**
+ * Resolves the active tab + its origin so views can scope operations
+ * (cookie listing, capture, switch) to the current site, and keeps it fresh as
+ * the user switches/navigates tabs (the side panel persists across tab changes).
+ *
+ * Permission note: with `tabs` deliberately not requested (PRD §9.6 minimal
+ * permissions), `chrome.tabs.query` only exposes `url` for the tab the user has
+ * invoked the extension on (activeTab, e.g. by opening the panel) or for granted
+ * origins. For other tabs `origin` resolves to null and the UI shows
+ * "no active site" until the user grants access — an accepted trade-off for the
+ * trust/permission posture, not a bug.
+ */
+
+import { useEffect } from 'react';
+import { useStore } from '@/state/store';
+
+export function useActiveTab() {
+ const setActive = useStore((s) => s.setActive);
+ const activeOrigin = useStore((s) => s.activeOrigin);
+ const activeTabId = useStore((s) => s.activeTabId);
+
+ useEffect(() => {
+ let cancelled = false;
+
+ const resolve = () => {
+ chrome.tabs
+ ?.query({ active: true, currentWindow: true })
+ .then((tabs) => {
+ if (cancelled) return;
+ const tab = tabs[0];
+ const origin = tab?.url ? safeOrigin(tab.url) : null;
+ setActive(origin, tab?.id ?? null);
+ })
+ .catch(() => setActive(null, null));
+ };
+
+ resolve();
+
+ // Keep the panel in sync with the visible tab.
+ const onActivated = () => resolve();
+ const onUpdated = (_id: number, info: chrome.tabs.TabChangeInfo) => {
+ if (info.status === 'complete' || info.url) resolve();
+ };
+ chrome.tabs?.onActivated.addListener(onActivated);
+ chrome.tabs?.onUpdated.addListener(onUpdated);
+
+ return () => {
+ cancelled = true;
+ chrome.tabs?.onActivated.removeListener(onActivated);
+ chrome.tabs?.onUpdated.removeListener(onUpdated);
+ };
+ }, [setActive]);
+
+ return { activeOrigin, activeTabId };
+}
+
+function safeOrigin(url: string): string | null {
+ try {
+ return new URL(url).origin;
+ } catch {
+ return null;
+ }
+}
diff --git a/src/ui/hooks/useBackground.ts b/src/ui/hooks/useBackground.ts
new file mode 100644
index 0000000..9cdd9b2
--- /dev/null
+++ b/src/ui/hooks/useBackground.ts
@@ -0,0 +1,43 @@
+/**
+ * Hook for calling the background router with loading/error handling.
+ * The background replies with a BgEnvelope (see background.ts).
+ *
+ * `loading` is tracked with an in-flight counter so concurrent calls (e.g. a
+ * view that refreshes two lists at once) don't flip it off prematurely. `call`
+ * is referentially stable (useCallback with no deps) so it is safe in effect
+ * dependency arrays.
+ */
+
+import { useCallback, useRef, useState } from 'react';
+import type { BgRequest, BgResponse, BgEnvelope } from '@/types/messages';
+
+export function useBackground() {
+ const [loading, setLoading] = useState(false);
+ const [error, setError] = useState(null);
+ const inFlight = useRef(0);
+
+ const call = useCallback(
+ async (req: T): Promise | null> => {
+ inFlight.current += 1;
+ setLoading(true);
+ try {
+ const res = (await chrome.runtime.sendMessage(req)) as BgEnvelope>;
+ if (!res?.ok) {
+ setError(res?.error ?? 'Unknown error');
+ return null;
+ }
+ setError(null);
+ return res.value;
+ } catch (e) {
+ setError(String(e));
+ return null;
+ } finally {
+ inFlight.current -= 1;
+ if (inFlight.current === 0) setLoading(false);
+ }
+ },
+ [],
+ );
+
+ return { call, loading, error };
+}
diff --git a/src/ui/hooks/useTheme.ts b/src/ui/hooks/useTheme.ts
new file mode 100644
index 0000000..a79ece8
--- /dev/null
+++ b/src/ui/hooks/useTheme.ts
@@ -0,0 +1,28 @@
+/**
+ * Applies the resolved theme to (PRD §9.8). Tailwind is in `class` dark
+ * mode, so 'system' must be resolved manually against the OS preference and
+ * kept in sync via matchMedia.
+ */
+
+import { useEffect } from 'react';
+import type { AppSettings } from '@/services/storage/settingsRepository';
+
+export function useTheme(theme: AppSettings['theme'] | undefined) {
+ useEffect(() => {
+ if (!theme) return;
+ const root = document.documentElement;
+ const mql = window.matchMedia('(prefers-color-scheme: dark)');
+
+ const apply = () => {
+ const dark = theme === 'dark' || (theme === 'system' && mql.matches);
+ root.classList.toggle('dark', dark);
+ };
+
+ apply();
+ if (theme === 'system') {
+ mql.addEventListener('change', apply);
+ return () => mql.removeEventListener('change', apply);
+ }
+ return undefined;
+ }, [theme]);
+}
diff --git a/src/ui/styles/globals.css b/src/ui/styles/globals.css
new file mode 100644
index 0000000..acc432b
--- /dev/null
+++ b/src/ui/styles/globals.css
@@ -0,0 +1,24 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
+
+:root {
+ color-scheme: light dark;
+}
+
+html,
+body,
+#root {
+ height: 100%;
+ margin: 0;
+}
+
+body {
+ font-family:
+ ui-sans-serif,
+ system-ui,
+ -apple-system,
+ 'Segoe UI',
+ Roboto,
+ sans-serif;
+}
diff --git a/src/ui/views/CookieEditorView.tsx b/src/ui/views/CookieEditorView.tsx
new file mode 100644
index 0000000..52ec5e6
--- /dev/null
+++ b/src/ui/views/CookieEditorView.tsx
@@ -0,0 +1,251 @@
+/**
+ * Cookie editor — free forever (PRD §9.1). View, search, add, edit, delete,
+ * bulk delete (with confirm), lock, JSON import/export. Never paywalled.
+ */
+
+import React, { useEffect, useState } from 'react';
+import { Panel, Button, Empty } from '@/ui/components/primitives';
+import { useBackground } from '@/ui/hooks/useBackground';
+import { useStore } from '@/state/store';
+import type { CookieRecord } from '@/types/models';
+
+const blankCookie = (domain: string): CookieRecord => ({
+ name: '',
+ value: '',
+ domain,
+ path: '/',
+ secure: true,
+ httpOnly: false,
+ sameSite: 'lax',
+});
+
+export function CookieEditorView() {
+ const { call, loading, error } = useBackground();
+ const cookies = useStore((s) => s.cookies);
+ const setCookies = useStore((s) => s.setCookies);
+ const activeOrigin = useStore((s) => s.activeOrigin);
+ const [query, setQuery] = useState('');
+ const [editing, setEditing] = useState(null);
+ const [importing, setImporting] = useState(false);
+ const [importText, setImportText] = useState('');
+ const [confirmingDeleteAll, setConfirmingDeleteAll] = useState(false);
+
+ const refresh = () => {
+ if (!activeOrigin) return;
+ call({ type: 'cookies/list', origin: activeOrigin }).then((c) => c && setCookies(c));
+ };
+
+ useEffect(refresh, [activeOrigin, call, setCookies]);
+
+ const filtered = cookies.filter((c) => c.name.toLowerCase().includes(query.toLowerCase()));
+
+ return (
+
+ setEditing(blankCookie(domainFromOrigin(activeOrigin)))}>
+ Add
+
+ setImporting((v) => !v)}>Import
+ activeOrigin && call({ type: 'cookies/export', origin: activeOrigin })}
+ >
+ Export
+
+
+ }
+ >
+
+ Search cookies
+
+ setQuery(e.target.value)}
+ placeholder="Search cookies…"
+ className="w-full mb-3 px-2 py-1 text-sm rounded border border-gray-300 dark:border-gray-600 bg-transparent"
+ />
+
+ {importing && (
+
+
Paste cookie-editor JSON
+
+ )}
+
+ {editing && (
+ setEditing(null)}
+ onSave={async (c) => {
+ await call({ type: 'cookies/set', cookie: c });
+ setEditing(null);
+ refresh();
+ }}
+ />
+ )}
+
+ {error && {error}
}
+ {loading && Loading…
}
+
+ {!loading && filtered.length === 0 ? (
+ No cookies for this site yet.
+ ) : (
+
+ {filtered.map((c) => (
+
+ setEditing(c)}
+ aria-label={`Edit cookie ${c.name}`}
+ >
+ {c.name}
+
+ {c.domain}
+ {c.path}
+
+
+ {
+ await call({ type: 'cookies/delete', cookie: c });
+ refresh();
+ }}
+ disabled={c.locked}
+ >
+ {c.locked ? 'Locked' : 'Delete'}
+
+
+ ))}
+
+ )}
+
+
+ {confirmingDeleteAll ? (
+
+ Delete all cookies for this site?
+ {
+ if (activeOrigin) await call({ type: 'cookies/deleteAll', origin: activeOrigin });
+ setConfirmingDeleteAll(false);
+ refresh();
+ }}
+ >
+ Yes, delete all
+
+ setConfirmingDeleteAll(false)}>Cancel
+
+ ) : (
+
setConfirmingDeleteAll(true)}
+ disabled={!activeOrigin}
+ >
+ Delete all for this site
+
+ )}
+
+
+ );
+}
+
+function CookieForm({
+ cookie,
+ onSave,
+ onCancel,
+}: {
+ cookie: CookieRecord;
+ onSave: (c: CookieRecord) => void;
+ onCancel: () => void;
+}) {
+ const [draft, setDraft] = useState(cookie);
+ const set = (patch: Partial) => setDraft({ ...draft, ...patch });
+
+ return (
+
+ );
+}
+
+function Field({
+ label,
+ value,
+ onChange,
+}: {
+ label: string;
+ value: string;
+ onChange: (v: string) => void;
+}) {
+ return (
+
+ {label}
+ onChange(e.target.value)}
+ className="block w-full mt-0.5 px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-transparent"
+ />
+
+ );
+}
+
+function domainFromOrigin(origin: string | null): string {
+ if (!origin) return '';
+ try {
+ return new URL(origin).hostname;
+ } catch {
+ return '';
+ }
+}
diff --git a/src/ui/views/ExportView.tsx b/src/ui/views/ExportView.tsx
new file mode 100644
index 0000000..f7d260b
--- /dev/null
+++ b/src/ui/views/ExportView.tsx
@@ -0,0 +1,132 @@
+/**
+ * Automation export (PRD §9.3 P0 Playwright; §9.4 P1 Puppeteer/Selenium/cURL).
+ * Playwright storageState is free/MVP; the rest are Pro fast-follow.
+ * Copy-to-clipboard + download, with redaction warnings before sharing secrets.
+ */
+
+import React, { useEffect, useState } from 'react';
+import { Panel, Button, Empty, ProBadge } from '@/ui/components/primitives';
+import { useBackground } from '@/ui/hooks/useBackground';
+import { useStore } from '@/state/store';
+import { trackAsync } from '@/services/telemetry/telemetry';
+
+type Target = 'playwright' | 'puppeteer' | 'selenium' | 'curl';
+
+// Playwright export is free/MVP; the rest are Pro (PRD §9.4 / §11).
+const PRO_TARGETS: ReadonlySet = new Set(['puppeteer', 'selenium', 'curl']);
+
+export function ExportView() {
+ const { call, error } = useBackground();
+ const profiles = useStore((s) => s.profiles);
+ const setProfiles = useStore((s) => s.setProfiles);
+ const entitlement = useStore((s) => s.entitlement);
+ const setEntitlement = useStore((s) => s.setEntitlement);
+ const setView = useStore((s) => s.setView);
+ const [selected, setSelected] = useState('');
+ const [output, setOutput] = useState('');
+
+ const isPro = entitlement?.tier === 'pro' || entitlement?.tier === 'team';
+
+ useEffect(() => {
+ call({ type: 'profiles/list' }).then((p) => {
+ if (p) {
+ setProfiles(p);
+ if (p[0]) setSelected(p[0].id);
+ }
+ });
+ call({ type: 'entitlement/get' }).then((e) => e && setEntitlement(e));
+ }, [call, setProfiles, setEntitlement]);
+
+ const doExport = async (target: Target) => {
+ if (!selected) return;
+ // Enforce Pro gating, not just the cosmetic badge (PRD §11).
+ if (PRO_TARGETS.has(target) && !isPro) {
+ setView('upgrade');
+ return;
+ }
+ let res: string | null = null;
+ if (target === 'playwright') {
+ res = await call({ type: 'export/playwright', profileId: selected });
+ if (res) trackAsync('playwright_export_used');
+ }
+ if (target === 'puppeteer') res = await call({ type: 'export/puppeteer', profileId: selected });
+ if (target === 'selenium')
+ res = await call({ type: 'export/selenium', profileId: selected, lang: 'python' });
+ if (target === 'curl') res = await call({ type: 'export/curl', profileId: selected });
+ setOutput(res ?? '');
+ };
+
+ const downloadText = (filename: string, text: string) => {
+ const url = URL.createObjectURL(new Blob([text], { type: 'text/plain' }));
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = filename;
+ a.click();
+ URL.revokeObjectURL(url);
+ };
+
+ if (profiles.length === 0) {
+ return (
+
+ Capture a profile first, then export it for your test framework.
+
+ );
+ }
+
+ return (
+
+
+ Profile
+ setSelected(e.target.value)}
+ className="block w-full mt-1 px-2 py-1 text-sm rounded border border-gray-300 dark:border-gray-600 bg-transparent"
+ >
+ {profiles.map((p) => (
+
+ {p.name}
+
+ ))}
+
+
+
+
+
doExport('playwright')}>
+ Playwright storageState
+
+
doExport('puppeteer')}>
+ Puppeteer
+
+
doExport('selenium')}>
+ Selenium
+
+
doExport('curl')}>
+ cURL
+
+
+
+ {error && {error}
}
+
+
+ ⚠ Exports contain real session secrets. Don't paste them where others can read them.
+
+
+
+ output && navigator.clipboard.writeText(output)} disabled={!output}>
+ Copy
+
+ downloadText('sessionist-export.txt', output)} disabled={!output}>
+ Download
+
+
+
+
+
+ );
+}
diff --git a/src/ui/views/OnboardingView.tsx b/src/ui/views/OnboardingView.tsx
new file mode 100644
index 0000000..77c2bb1
--- /dev/null
+++ b/src/ui/views/OnboardingView.tsx
@@ -0,0 +1,47 @@
+/**
+ * Search-intent onboarding (PRD §9.5 / §10 flow 1).
+ * Addresses replacement users (import) and dev/QA users (Playwright export)
+ * without overclaiming. No signup. Value in under 30 seconds.
+ */
+
+import React from 'react';
+import { Panel, Button } from '@/ui/components/primitives';
+import { useStore } from '@/state/store';
+import { useBackground } from '@/ui/hooks/useBackground';
+
+export function OnboardingView() {
+ const setView = useStore((s) => s.setView);
+ const setSettings = useStore((s) => s.setSettings);
+ const { call } = useBackground();
+
+ // Mark onboarding done so first-run routing doesn't return here, then go.
+ const proceed = async (view: 'cookies' | 'profiles') => {
+ const next = await call({ type: 'settings/patch', patch: { onboardingComplete: true } });
+ if (next) setSettings(next);
+ setView(view);
+ };
+
+ return (
+
+
+
+
Coming from EditThisCookie or another cookie editor?
+
Import your cookies and pick up where you left off.
+
proceed('cookies')}>
+ Import cookies
+
+
+
+
+
Testing as different users?
+
+ Capture your current login and export it to Playwright storageState.
+
+
proceed('profiles')}>
+ Capture this session
+
+
+
+
+ );
+}
diff --git a/src/ui/views/ProfilesView.tsx b/src/ui/views/ProfilesView.tsx
new file mode 100644
index 0000000..b036c29
--- /dev/null
+++ b/src/ui/views/ProfilesView.tsx
@@ -0,0 +1,195 @@
+/**
+ * Session profiles (PRD §9.2 / §10 flow 3).
+ * Capture (inline form — native prompt() is unreliable in panels), switch
+ * (transaction-like, surfaces per-store results), restore, delete, snapshots
+ * recovery. Free cap surfaces as a usage-milestone upsell, not a hard block.
+ */
+
+import React, { useEffect, useState } from 'react';
+import { Panel, Button, Empty } from '@/ui/components/primitives';
+import { useBackground } from '@/ui/hooks/useBackground';
+import { useStore } from '@/state/store';
+import { trackAsync } from '@/services/telemetry/telemetry';
+import type { SwitchResult, Snapshot } from '@/types/models';
+
+export function ProfilesView() {
+ const { call, loading, error } = useBackground();
+ const profiles = useStore((s) => s.profiles);
+ const setProfiles = useStore((s) => s.setProfiles);
+ const snapshots = useStore((s) => s.snapshots);
+ const setSnapshots = useStore((s) => s.setSnapshots);
+ const setView = useStore((s) => s.setView);
+ const activeTabId = useStore((s) => s.activeTabId);
+
+ const [capturing, setCapturing] = useState(false);
+ const [name, setName] = useState('');
+ const [lastResult, setLastResult] = useState(null);
+
+ const refresh = () => {
+ call({ type: 'profiles/list' }).then((p) => p && setProfiles(p));
+ call({ type: 'snapshots/list' }).then((s) => s && setSnapshots(s));
+ };
+
+ useEffect(refresh, [call, setProfiles, setSnapshots]);
+
+ const submitCapture = async () => {
+ if (activeTabId == null || !name.trim()) return;
+ const saved = await call({ type: 'profiles/capture', name: name.trim(), tabId: activeTabId });
+ if (saved) trackAsync('profile_saved');
+ setName('');
+ setCapturing(false);
+ refresh();
+ // Usage-milestone upsell (not a hard block) — PRD §9.2 / decision #12.
+ const prompt = await call({ type: 'profiles/shouldPromptUpsell' });
+ if (prompt) setView('upgrade');
+ };
+
+ const doSwitch = async (profileId: string, additive: boolean) => {
+ if (activeTabId == null) return;
+ const res = await call(
+ additive
+ ? { type: 'profiles/restore', profileId, tabId: activeTabId }
+ : { type: 'profiles/switch', profileId, tabId: activeTabId },
+ );
+ if (res) {
+ setLastResult(res);
+ trackAsync(res.succeeded ? 'profile_switch_success' : 'profile_switch_failure');
+ }
+ };
+
+ return (
+ setCapturing((v) => !v)}>
+ Capture current
+
+ }
+ >
+ {capturing && (
+
+
+ Profile name
+ setName(e.target.value)}
+ onKeyDown={(e) => e.key === 'Enter' && submitCapture()}
+ placeholder='e.g. "admin / staging"'
+ className="block w-full mt-1 px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-transparent"
+ />
+
+
+
+ Save
+
+ setCapturing(false)}>Cancel
+
+
+ )}
+
+ {error && {error}
}
+ {loading && Working…
}
+
+ {lastResult && }
+
+ {!loading && profiles.length === 0 ? (
+ No saved profiles. Capture your current login to get started.
+ ) : (
+
+ {profiles.map((p) => (
+
+
+
{p.name}
+
+ {p.origin} · {p.environment ?? 'other'} · {p.tags.join(', ') || 'no tags'}
+
+
+
+ doSwitch(p.id, false)}>
+ Switch
+
+ doSwitch(p.id, true)}>Restore
+ {
+ await call({ type: 'profiles/delete', profileId: p.id });
+ refresh();
+ }}
+ >
+ ✕
+
+
+
+ ))}
+
+ )}
+
+ {
+ if (activeTabId == null) return;
+ const res = await call({ type: 'snapshots/restore', snapshotId: id, tabId: activeTabId });
+ if (res) setLastResult(res);
+ }}
+ />
+
+ );
+}
+
+function SwitchResultPanel({ result }: { result: SwitchResult }) {
+ return (
+
+
+ {result.succeeded ? 'Switch applied' : 'Switch completed with issues'} — a pre-switch
+ snapshot was saved.
+
+
+ {result.results.map((r) => (
+
+ {r.store}
+
+ {r.status}
+ {r.message ? ` — ${r.message}` : ''}
+
+
+ ))}
+
+
+ );
+}
+
+function SnapshotList({
+ snapshots,
+ onRestore,
+}: {
+ snapshots: Snapshot[];
+ onRestore: (id: string) => void;
+}) {
+ if (snapshots.length === 0) return null;
+ return (
+
+ Recovery snapshots
+
+ {snapshots.map((s) => (
+
+
+ {s.origin} · {s.reason} · {new Date(s.createdAt).toLocaleString()}
+
+ onRestore(s.id)}>Restore
+
+ ))}
+
+
+ );
+}
diff --git a/src/ui/views/SettingsView.tsx b/src/ui/views/SettingsView.tsx
new file mode 100644
index 0000000..9afc5cf
--- /dev/null
+++ b/src/ui/views/SettingsView.tsx
@@ -0,0 +1,116 @@
+/**
+ * Settings (PRD §9.8 cross-cutting): theme (P1), telemetry opt-in (off by
+ * default), passphrase lock (P1), entitlement status, and license activation.
+ */
+
+import React, { useEffect, useState } from 'react';
+import { Panel, Button } from '@/ui/components/primitives';
+import { useBackground } from '@/ui/hooks/useBackground';
+import { useStore } from '@/state/store';
+import type { AppSettings } from '@/services/storage/settingsRepository';
+
+export function SettingsView() {
+ const { call, loading, error } = useBackground();
+ const entitlement = useStore((s) => s.entitlement);
+ const setEntitlement = useStore((s) => s.setEntitlement);
+ const settings = useStore((s) => s.settings);
+ const setSettings = useStore((s) => s.setSettings);
+ const setView = useStore((s) => s.setView);
+ const [licenseKey, setLicenseKey] = useState('');
+
+ useEffect(() => {
+ call({ type: 'entitlement/get' }).then((e) => e && setEntitlement(e));
+ call({ type: 'settings/get' }).then((s) => s && setSettings(s));
+ }, [call, setEntitlement, setSettings]);
+
+ const patch = async (p: Partial) => {
+ const next = await call({ type: 'settings/patch', patch: p });
+ if (next) setSettings(next);
+ };
+
+ return (
+
+
+
+
Plan
+
Current tier: {entitlement?.tier ?? 'free'}
+
+
+ License key
+
+ setLicenseKey(e.target.value)}
+ placeholder="Paste Pro license key…"
+ className="flex-1 px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-transparent"
+ />
+ {
+ const e = await call({ type: 'entitlement/activate', licenseKey });
+ if (e) setEntitlement(e);
+ }}
+ >
+ Activate
+
+
+
+
+
+
+ Theme
+
+ patch({ theme: e.target.value as AppSettings['theme'] })}
+ className="mt-1 px-2 py-1 rounded border border-gray-300 dark:border-gray-600 bg-transparent"
+ >
+ System
+ Light
+ Dark
+
+
+
+
+ patch({ telemetryOptIn: e.target.checked })}
+ />
+
+ Share anonymous usage events{' '}
+ (off by default; never session contents)
+
+
+
+
+
Onboarding
+
{
+ await patch({ onboardingComplete: false });
+ setView('onboarding');
+ }}
+ >
+ Show welcome again
+
+
+
+
+
Passphrase lock
+
+ Encrypt your vault behind a passphrase. (P1 — coming soon.)
+
+
+ Set passphrase
+
+
+
+ {error &&
{error}
}
+
+
+ );
+}
diff --git a/src/ui/views/SiteAccessView.tsx b/src/ui/views/SiteAccessView.tsx
new file mode 100644
index 0000000..b91b85f
--- /dev/null
+++ b/src/ui/views/SiteAccessView.tsx
@@ -0,0 +1,68 @@
+/**
+ * Site access settings (PRD §9.6 / §14.1).
+ * Shows granted origins, lets the user grant the active site, and revoke.
+ */
+
+import React, { useEffect } from 'react';
+import { Panel, Button, Empty } from '@/ui/components/primitives';
+import { useBackground } from '@/ui/hooks/useBackground';
+import { useStore } from '@/state/store';
+
+export function SiteAccessView() {
+ const { call, error } = useBackground();
+ const granted = useStore((s) => s.grantedOrigins);
+ const setGranted = useStore((s) => s.setGrantedOrigins);
+ const activeOrigin = useStore((s) => s.activeOrigin);
+
+ const refresh = () => call({ type: 'permissions/list' }).then((o) => o && setGranted(o));
+
+ useEffect(() => {
+ refresh();
+ // eslint-disable-next-line react-hooks/exhaustive-deps
+ }, []);
+
+ return (
+ {
+ await call({ type: 'permissions/request', origin: activeOrigin });
+ refresh();
+ }}
+ >
+ Grant this site
+
+ ) : null
+ }
+ >
+
+ Sessionist only touches sites you explicitly grant. Access is per-origin and revocable.
+
+ {error && {error}
}
+
+ {granted.length === 0 ? (
+ No sites granted yet.
+ ) : (
+
+ {granted.map((origin) => (
+
+ {origin}
+ {
+ await call({ type: 'permissions/revoke', origin });
+ refresh();
+ }}
+ >
+ Revoke
+
+
+ ))}
+
+ )}
+
+ );
+}
diff --git a/src/ui/views/TeamView.tsx b/src/ui/views/TeamView.tsx
new file mode 100644
index 0000000..61a795f
--- /dev/null
+++ b/src/ui/views/TeamView.tsx
@@ -0,0 +1,27 @@
+/**
+ * Team sync & shared vaults (P2 — PRD §9.7). Build only after validation gates.
+ * This is the entry point; the feature is intentionally gated/disabled in MVP.
+ */
+
+import React from 'react';
+import { Panel, Button, Empty } from '@/ui/components/primitives';
+
+export function TeamView() {
+ return (
+
+
+ Encrypted cloud sync and shared vaults are a P2 feature. They unlock after Sessionist proves
+ install, activation, and Pro-conversion demand.
+
+
+ Sign in with Google
+ Create a shared vault
+ Invite a teammate
+
+
+ Note: zero-knowledge sync stops our servers reading your data — it cannot stop an authorized
+ teammate from exporting a decrypted profile on their own device.
+
+
+ );
+}
diff --git a/src/ui/views/UpgradeView.tsx b/src/ui/views/UpgradeView.tsx
new file mode 100644
index 0000000..9616153
--- /dev/null
+++ b/src/ui/views/UpgradeView.tsx
@@ -0,0 +1,54 @@
+/**
+ * Paywall / upsell (PRD §10 flow 5 / §11). One-time Pro purchase via
+ * Stripe-hosted Checkout. Triggered at usage milestones, not as a hard block.
+ */
+
+import React, { useEffect } from 'react';
+import { Panel, Button } from '@/ui/components/primitives';
+import { useBackground } from '@/ui/hooks/useBackground';
+import { trackAsync } from '@/services/telemetry/telemetry';
+
+const PRO_FEATURES = [
+ 'Unlimited session profiles',
+ 'Project / environment profile sets',
+ 'Bulk export & saved export presets',
+ 'Puppeteer / Selenium / cURL exports',
+ 'Redacted sharing snippets',
+ 'Passphrase lock & larger local vault handling',
+];
+
+export function UpgradeView() {
+ const { call, loading, error } = useBackground();
+
+ useEffect(() => {
+ trackAsync('paywall_view');
+ }, []);
+
+ const checkout = async () => {
+ const res = await call({ type: 'entitlement/startCheckout' });
+ if (res?.checkoutUrl) {
+ trackAsync('upgrade');
+ chrome.tabs.create({ url: res.checkoutUrl });
+ }
+ };
+
+ return (
+
+
+ Core cookie editing stays free forever. Pro unlocks scale and power workflows.
+
+
+ {PRO_FEATURES.map((f) => (
+
+ ✓
+ {f}
+
+ ))}
+
+
+ {loading ? 'Opening checkout…' : 'Upgrade to Pro'}
+
+ {error && {error}
}
+
+ );
+}
diff --git a/tailwind.config.js b/tailwind.config.js
new file mode 100644
index 0000000..49f2ad5
--- /dev/null
+++ b/tailwind.config.js
@@ -0,0 +1,17 @@
+/** @type {import('tailwindcss').Config} */
+export default {
+ darkMode: 'class', // PRD §9.8: light/dark theme (P1).
+ content: ['./src/**/*.{html,tsx,ts}'],
+ theme: {
+ extend: {
+ colors: {
+ // Placeholder brand palette — refine before public listing.
+ brand: {
+ DEFAULT: '#2563eb',
+ fg: '#ffffff',
+ },
+ },
+ },
+ },
+ plugins: [],
+};
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..4777fad
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "extends": "./.wxt/tsconfig.json",
+ "compilerOptions": {
+ "strict": true,
+ "noUncheckedIndexedAccess": true,
+ "noImplicitOverride": true,
+ "noUnusedLocals": false,
+ "noFallthroughCasesInSwitch": true,
+ "jsx": "react-jsx",
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ },
+ "include": ["src", "wxt.config.ts"]
+}
diff --git a/worker/package-lock.json b/worker/package-lock.json
new file mode 100644
index 0000000..9fc09c8
--- /dev/null
+++ b/worker/package-lock.json
@@ -0,0 +1,1606 @@
+{
+ "name": "sessionist-worker",
+ "version": "0.1.0",
+ "lockfileVersion": 3,
+ "requires": true,
+ "packages": {
+ "": {
+ "name": "sessionist-worker",
+ "version": "0.1.0",
+ "devDependencies": {
+ "@cloudflare/workers-types": "^4.20241127.0",
+ "typescript": "^5.6.3",
+ "wrangler": "^3.90.0"
+ }
+ },
+ "node_modules/@cloudflare/kv-asset-handler": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.4.tgz",
+ "integrity": "sha512-YLPHc8yASwjNkmcDMQMY35yiWjoKAKnhUbPRszBRS0YgH+IXtsMp61j+yTcnCE3oO2DgP0U3iejLC8FTtKDC8Q==",
+ "dev": true,
+ "license": "MIT OR Apache-2.0",
+ "dependencies": {
+ "mime": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=16.13"
+ }
+ },
+ "node_modules/@cloudflare/unenv-preset": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/@cloudflare/unenv-preset/-/unenv-preset-2.0.2.tgz",
+ "integrity": "sha512-nyzYnlZjjV5xT3LizahG1Iu6mnrCaxglJ04rZLpDwlDVDZ7v46lNsfxhV3A/xtfgQuSHmLnc6SVI+KwBpc3Lwg==",
+ "dev": true,
+ "license": "MIT OR Apache-2.0",
+ "peerDependencies": {
+ "unenv": "2.0.0-rc.14",
+ "workerd": "^1.20250124.0"
+ },
+ "peerDependenciesMeta": {
+ "workerd": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@cloudflare/workerd-darwin-64": {
+ "version": "1.20250718.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20250718.0.tgz",
+ "integrity": "sha512-FHf4t7zbVN8yyXgQ/r/GqLPaYZSGUVzeR7RnL28Mwj2djyw2ZergvytVc7fdGcczl6PQh+VKGfZCfUqpJlbi9g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-darwin-arm64": {
+ "version": "1.20250718.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20250718.0.tgz",
+ "integrity": "sha512-fUiyUJYyqqp4NqJ0YgGtp4WJh/II/YZsUnEb6vVy5Oeas8lUOxnN+ZOJ8N/6/5LQCVAtYCChRiIrBbfhTn5Z8Q==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-linux-64": {
+ "version": "1.20250718.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20250718.0.tgz",
+ "integrity": "sha512-5+eb3rtJMiEwp08Kryqzzu8d1rUcK+gdE442auo5eniMpT170Dz0QxBrqkg2Z48SFUPYbj+6uknuA5tzdRSUSg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-linux-arm64": {
+ "version": "1.20250718.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20250718.0.tgz",
+ "integrity": "sha512-Aa2M/DVBEBQDdATMbn217zCSFKE+ud/teS+fFS+OQqKABLn0azO2qq6ANAHYOIE6Q3Sq4CxDIQr8lGdaJHwUog==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workerd-windows-64": {
+ "version": "1.20250718.0",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20250718.0.tgz",
+ "integrity": "sha512-dY16RXKffmugnc67LTbyjdDHZn5NoTF1yHEf2fN4+OaOnoGSp3N1x77QubTDwqZ9zECWxgQfDLjddcH8dWeFhg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/@cloudflare/workers-types": {
+ "version": "4.20260605.1",
+ "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20260605.1.tgz",
+ "integrity": "sha512-9YJaGPQwuQYFHoElVhJP40ZmUO/Z2OiBon58sKpHjgwq5btC/B2BZLC45AQ14k+1I+hjcY2z2t2R6uUxU9AqwQ==",
+ "dev": true,
+ "license": "MIT OR Apache-2.0"
+ },
+ "node_modules/@cspotcode/source-map-support": {
+ "version": "0.8.1",
+ "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz",
+ "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "0.3.9"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@emnapi/runtime": {
+ "version": "1.10.0",
+ "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.10.0.tgz",
+ "integrity": "sha512-ewvYlk86xUoGI0zQRNq/mC+16R1QeDlKQy21Ki3oSYXNgLb45GV1P6A0M+/s6nyCuNDqe5VpaY84BzXGwVbwFA==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "tslib": "^2.4.0"
+ }
+ },
+ "node_modules/@esbuild-plugins/node-globals-polyfill": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-globals-polyfill/-/node-globals-polyfill-0.2.3.tgz",
+ "integrity": "sha512-r3MIryXDeXDOZh7ih1l/yE9ZLORCd5e8vWg02azWRGj5SPTuoh69A2AIyn0Z31V/kHBfZ4HgWJ+OK3GTTwLmnw==",
+ "dev": true,
+ "license": "ISC",
+ "peerDependencies": {
+ "esbuild": "*"
+ }
+ },
+ "node_modules/@esbuild-plugins/node-modules-polyfill": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/@esbuild-plugins/node-modules-polyfill/-/node-modules-polyfill-0.2.2.tgz",
+ "integrity": "sha512-LXV7QsWJxRuMYvKbiznh+U1ilIop3g2TeKRzUxOG5X3YITc8JyyTa90BmLwqqv0YnX4v32CSlG+vsziZp9dMvA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "escape-string-regexp": "^4.0.0",
+ "rollup-plugin-node-polyfills": "^0.2.1"
+ },
+ "peerDependencies": {
+ "esbuild": "*"
+ }
+ },
+ "node_modules/@esbuild/android-arm": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.17.19.tgz",
+ "integrity": "sha512-rIKddzqhmav7MSmoFCmDIb6e2W57geRsM94gV2l38fzhXMwq7hZoClug9USI2pFRGL06f4IOPHHpFNOkWieR8A==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/android-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.17.19.tgz",
+ "integrity": "sha512-KBMWvEZooR7+kzY0BtbTQn0OAYY7CsiydT63pVEaPtVYF0hXbUaOyZog37DKxK7NF3XacBJOpYT4adIJh+avxA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/android-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.17.19.tgz",
+ "integrity": "sha512-uUTTc4xGNDT7YSArp/zbtmbhO0uEEK9/ETW29Wk1thYUJBz3IVnvgEiEwEa9IeLyvnpKrWK64Utw2bgUmDveww==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "android"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/darwin-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.17.19.tgz",
+ "integrity": "sha512-80wEoCfF/hFKM6WE1FyBHc9SfUblloAWx6FJkFWTWiCoht9Mc0ARGEM47e67W9rI09YoUxJL68WHfDRYEAvOhg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/darwin-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.17.19.tgz",
+ "integrity": "sha512-IJM4JJsLhRYr9xdtLytPLSH9k/oxR3boaUIYiHkAawtwNOXKE8KoU8tMvryogdcT8AU+Bflmh81Xn6Q0vTZbQw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/freebsd-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.17.19.tgz",
+ "integrity": "sha512-pBwbc7DufluUeGdjSU5Si+P3SoMF5DQ/F/UmTSb8HXO80ZEAJmrykPyzo1IfNbAoaqw48YRpv8shwd1NoI0jcQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/freebsd-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.17.19.tgz",
+ "integrity": "sha512-4lu+n8Wk0XlajEhbEffdy2xy53dpR06SlzvhGByyg36qJw6Kpfk7cp45DR/62aPH9mtJRmIyrXAS5UWBrJT6TQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "freebsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-arm": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.17.19.tgz",
+ "integrity": "sha512-cdmT3KxjlOQ/gZ2cjfrQOtmhG4HJs6hhvm3mWSRDPtZ/lP5oe8FWceS10JaSJC13GBd4eH/haHnqf7hhGNLerA==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.17.19.tgz",
+ "integrity": "sha512-ct1Tg3WGwd3P+oZYqic+YZF4snNl2bsnMKRkb3ozHmnM0dGWuxcPTTntAF6bOP0Sp4x0PjSF+4uHQ1xvxfRKqg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-ia32": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.17.19.tgz",
+ "integrity": "sha512-w4IRhSy1VbsNxHRQpeGCHEmibqdTUx61Vc38APcsRbuVgK0OPEnQ0YD39Brymn96mOx48Y2laBQGqgZ0j9w6SQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-loong64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.17.19.tgz",
+ "integrity": "sha512-2iAngUbBPMq439a+z//gE+9WBldoMp1s5GWsUSgqHLzLJ9WoZLZhpwWuym0u0u/4XmZ3gpHmzV84PonE+9IIdQ==",
+ "cpu": [
+ "loong64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-mips64el": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.17.19.tgz",
+ "integrity": "sha512-LKJltc4LVdMKHsrFe4MGNPp0hqDFA1Wpt3jE1gEyM3nKUvOiO//9PheZZHfYRfYl6AwdTH4aTcXSqBerX0ml4A==",
+ "cpu": [
+ "mips64el"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-ppc64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.17.19.tgz",
+ "integrity": "sha512-/c/DGybs95WXNS8y3Ti/ytqETiW7EU44MEKuCAcpPto3YjQbyK3IQVKfF6nbghD7EcLUGl0NbiL5Rt5DMhn5tg==",
+ "cpu": [
+ "ppc64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-riscv64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.17.19.tgz",
+ "integrity": "sha512-FC3nUAWhvFoutlhAkgHf8f5HwFWUL6bYdvLc/TTuxKlvLi3+pPzdZiFKSWz/PF30TB1K19SuCxDTI5KcqASJqA==",
+ "cpu": [
+ "riscv64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-s390x": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.17.19.tgz",
+ "integrity": "sha512-IbFsFbxMWLuKEbH+7sTkKzL6NJmG2vRyy6K7JJo55w+8xDk7RElYn6xvXtDW8HCfoKBFK69f3pgBJSUSQPr+4Q==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/linux-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.17.19.tgz",
+ "integrity": "sha512-68ngA9lg2H6zkZcyp22tsVt38mlhWde8l3eJLWkyLrp4HwMUr3c1s/M2t7+kHIhvMjglIBrFpncX1SzMckomGw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/netbsd-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.17.19.tgz",
+ "integrity": "sha512-CwFq42rXCR8TYIjIfpXCbRX0rp1jo6cPIUPSaWwzbVI4aOfX96OXY8M6KNmtPcg7QjYeDmN+DD0Wp3LaBOLf4Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/openbsd-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.17.19.tgz",
+ "integrity": "sha512-cnq5brJYrSZ2CF6c35eCmviIN3k3RczmHz8eYaVlNasVqsNY+JKohZU5MKmaOI+KkllCdzOKKdPs762VCPC20g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/sunos-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.17.19.tgz",
+ "integrity": "sha512-vCRT7yP3zX+bKWFeP/zdS6SqdWB8OIpaRq/mbXQxTGHnIxspRtigpkUcDMlSCOejlHowLqII7K2JKevwyRP2rg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/win32-arm64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.17.19.tgz",
+ "integrity": "sha512-yYx+8jwowUstVdorcMdNlzklLYhPxjniHWFKgRqH7IFlUEa0Umu3KuYplf1HUZZ422e3NU9F4LGb+4O0Kdcaag==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/win32-ia32": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.17.19.tgz",
+ "integrity": "sha512-eggDKanJszUtCdlVs0RB+h35wNlb5v4TWEkq4vZcmVt5u/HiDZrTXe2bWFQUez3RgNHwx/x4sk5++4NSSicKkw==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@esbuild/win32-x64": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.17.19.tgz",
+ "integrity": "sha512-lAhycmKnVOuRYNtRtatQR1LPQf2oYCkRGkSFnseDAKPl8lu5SOsK/e1sXe5a0Pc5kHIHe6P2I/ilntNv2xf3cA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@fastify/busboy": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/@fastify/busboy/-/busboy-2.1.1.tgz",
+ "integrity": "sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/@img/sharp-darwin-arm64": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.33.5.tgz",
+ "integrity": "sha512-UT4p+iz/2H4twwAoLCqfA9UH5pI6DggwKEGuaPy7nCVQ8ZsiY5PIcrRvD1DzuY3qYL07NtIQcWnBSY/heikIFQ==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-darwin-arm64": "1.0.4"
+ }
+ },
+ "node_modules/@img/sharp-darwin-x64": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.33.5.tgz",
+ "integrity": "sha512-fyHac4jIc1ANYGRDxtiqelIbdWkIuQaI84Mv45KvGRRxSAa7o7d1ZKAOBaYbnepLC1WqxfpimdeWfvqqSGwR2Q==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-darwin-x64": "1.0.4"
+ }
+ },
+ "node_modules/@img/sharp-libvips-darwin-arm64": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.0.4.tgz",
+ "integrity": "sha512-XblONe153h0O2zuFfTAbQYAX2JhYmDHeWikp1LM9Hul9gVPjFY427k6dFEcOL72O01QxQsWi761svJ/ev9xEDg==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-darwin-x64": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.0.4.tgz",
+ "integrity": "sha512-xnGR8YuZYfJGmWPvmlunFaWJsb9T/AO2ykoP3Fz/0X5XV2aoYBPkX6xqCQvUTKKiLddarLaxpzNe+b1hjeWHAQ==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-arm": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.0.5.tgz",
+ "integrity": "sha512-gvcC4ACAOPRNATg/ov8/MnbxFDJqf/pDePbBnuBDcjsI8PssmjoKMAz4LtLaVi+OnSb5FK/yIOamqDwGmXW32g==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-arm64": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.0.4.tgz",
+ "integrity": "sha512-9B+taZ8DlyyqzZQnoeIvDVR/2F4EbMepXMc/NdVbkzsJbzkUjhXv/70GQJ7tdLA4YJgNP25zukcxpX2/SueNrA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-s390x": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.0.4.tgz",
+ "integrity": "sha512-u7Wz6ntiSSgGSGcjZ55im6uvTrOxSIS8/dgoVMoiGE9I6JAfU50yH5BoDlYA1tcuGS7g/QNtetJnxA6QEsCVTA==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linux-x64": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.0.4.tgz",
+ "integrity": "sha512-MmWmQ3iPFZr0Iev+BAgVMb3ZyC4KeFc3jFxnNbEPas60e1cIfevbtuyf9nDGIzOaW9PdnDciJm+wFFaTlj5xYw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linuxmusl-arm64": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.0.4.tgz",
+ "integrity": "sha512-9Ti+BbTYDcsbp4wfYib8Ctm1ilkugkA/uscUn6UXK1ldpC1JjiXbLfFZtRlBhjPZ5o1NCLiDbg8fhUPKStHoTA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-libvips-linuxmusl-x64": {
+ "version": "1.0.4",
+ "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.0.4.tgz",
+ "integrity": "sha512-viYN1KX9m+/hGkJtvYYp+CCLgnJXwiQB39damAO7WMdKWlIhmYTfHjwSbQeUK/20vY154mwezd9HflVFM1wVSw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-linux-arm": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.33.5.tgz",
+ "integrity": "sha512-JTS1eldqZbJxjvKaAkxhZmBqPRGmxgu+qFKSInv8moZ2AmT5Yib3EQ1c6gp493HvrvV8QgdOXdyaIBrhvFhBMQ==",
+ "cpu": [
+ "arm"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-arm": "1.0.5"
+ }
+ },
+ "node_modules/@img/sharp-linux-arm64": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.33.5.tgz",
+ "integrity": "sha512-JMVv+AMRyGOHtO1RFBiJy/MBsgz0x4AWrT6QoEVVTyh1E39TrCUpTRI7mx9VksGX4awWASxqCYLCV4wBZHAYxA==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-arm64": "1.0.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-s390x": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.33.5.tgz",
+ "integrity": "sha512-y/5PCd+mP4CA/sPDKl2961b+C9d+vPAveS33s6Z3zfASk2j5upL6fXVPZi7ztePZ5CuH+1kW8JtvxgbuXHRa4Q==",
+ "cpu": [
+ "s390x"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-s390x": "1.0.4"
+ }
+ },
+ "node_modules/@img/sharp-linux-x64": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.33.5.tgz",
+ "integrity": "sha512-opC+Ok5pRNAzuvq1AG0ar+1owsu842/Ab+4qvU879ippJBHvyY5n2mxF1izXqkPYlGuP/M556uh53jRLJmzTWA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linux-x64": "1.0.4"
+ }
+ },
+ "node_modules/@img/sharp-linuxmusl-arm64": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.33.5.tgz",
+ "integrity": "sha512-XrHMZwGQGvJg2V/oRSUfSAfjfPxO+4DkiRh6p2AFjLQztWUuY/o8Mq0eMQVIY7HJ1CDQUJlxGGZRw1a5bqmd1g==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linuxmusl-arm64": "1.0.4"
+ }
+ },
+ "node_modules/@img/sharp-linuxmusl-x64": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.33.5.tgz",
+ "integrity": "sha512-WT+d/cgqKkkKySYmqoZ8y3pxx7lx9vVejxW/W4DOFMYVSkErR+w7mf2u8m/y4+xHe7yY9DAXQMWQhpnMuFfScw==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "os": [
+ "linux"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-libvips-linuxmusl-x64": "1.0.4"
+ }
+ },
+ "node_modules/@img/sharp-wasm32": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.33.5.tgz",
+ "integrity": "sha512-ykUW4LVGaMcU9lu9thv85CbRMAwfeadCJHRsg2GmeRa/cJxsVY9Rbd57JcMxBkKHag5U/x7TSBpScF4U8ElVzg==",
+ "cpu": [
+ "wasm32"
+ ],
+ "dev": true,
+ "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT",
+ "optional": true,
+ "dependencies": {
+ "@emnapi/runtime": "^1.2.0"
+ },
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-ia32": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.33.5.tgz",
+ "integrity": "sha512-T36PblLaTwuVJ/zw/LaH0PdZkRz5rd3SmMHX8GSmR7vtNSP5Z6bQkExdSK7xGWyxLw4sUknBuugTelgw2faBbQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@img/sharp-win32-x64": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.33.5.tgz",
+ "integrity": "sha512-MpY/o8/8kj+EcnxwvrP4aTJSWw/aZ7JIGR4aBeZkZw5B7/Jn+tY9/VNwtcoGmdT7GfggGIU4kygOMSbYnOrAbg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "license": "Apache-2.0 AND LGPL-3.0-or-later",
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ }
+ },
+ "node_modules/@jridgewell/resolve-uri": {
+ "version": "3.1.2",
+ "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz",
+ "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@jridgewell/sourcemap-codec": {
+ "version": "1.5.5",
+ "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.5.tgz",
+ "integrity": "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@jridgewell/trace-mapping": {
+ "version": "0.3.9",
+ "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz",
+ "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@jridgewell/resolve-uri": "^3.0.3",
+ "@jridgewell/sourcemap-codec": "^1.4.10"
+ }
+ },
+ "node_modules/acorn": {
+ "version": "8.14.0",
+ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz",
+ "integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "acorn": "bin/acorn"
+ },
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/acorn-walk": {
+ "version": "8.3.2",
+ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.2.tgz",
+ "integrity": "sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
+ "node_modules/as-table": {
+ "version": "1.0.55",
+ "resolved": "https://registry.npmjs.org/as-table/-/as-table-1.0.55.tgz",
+ "integrity": "sha512-xvsWESUJn0JN421Xb9MQw6AsMHRCUknCe0Wjlxvjud80mU4E6hQf1A6NzQKcYNmYw62MfzEtXc+badstZP3JpQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "printable-characters": "^1.0.42"
+ }
+ },
+ "node_modules/blake3-wasm": {
+ "version": "2.1.5",
+ "resolved": "https://registry.npmjs.org/blake3-wasm/-/blake3-wasm-2.1.5.tgz",
+ "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/color": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/color/-/color-4.2.3.tgz",
+ "integrity": "sha512-1rXeuUUiGGrykh+CeBdu5Ie7OJwinCgQY0bc7GCRxy5xVHy+moaqkpL/jqQq0MtQOeYcrqEz4abc5f0KtU7W4A==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "color-convert": "^2.0.1",
+ "color-string": "^1.9.0"
+ },
+ "engines": {
+ "node": ">=12.5.0"
+ }
+ },
+ "node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/color-string": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.1.tgz",
+ "integrity": "sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "color-name": "^1.0.0",
+ "simple-swizzle": "^0.2.2"
+ }
+ },
+ "node_modules/cookie": {
+ "version": "0.7.2",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
+ "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/data-uri-to-buffer": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/data-uri-to-buffer/-/data-uri-to-buffer-2.0.2.tgz",
+ "integrity": "sha512-ND9qDTLc6diwj+Xe5cdAgVTbLVdXbtxTJRXRhli8Mowuaan+0EJOtdqJ0QCHNSSPyoXGx9HX2/VMnKeC34AChA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/defu": {
+ "version": "6.1.7",
+ "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.7.tgz",
+ "integrity": "sha512-7z22QmUWiQ/2d0KkdYmANbRUVABpZ9SNYyH5vx6PZ+nE5bcC0l7uFvEfHlyld/HcGBFTL536ClDt3DEcSlEJAQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/detect-libc": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
+ "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/esbuild": {
+ "version": "0.17.19",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.17.19.tgz",
+ "integrity": "sha512-XQ0jAPFkK/u3LcVRcvVHQcTIqD6E2H1fvZMA5dQPSOWb3suUbWbfbRf94pjc0bNzRYLfIrDRQXr7X+LHIm5oHw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "optionalDependencies": {
+ "@esbuild/android-arm": "0.17.19",
+ "@esbuild/android-arm64": "0.17.19",
+ "@esbuild/android-x64": "0.17.19",
+ "@esbuild/darwin-arm64": "0.17.19",
+ "@esbuild/darwin-x64": "0.17.19",
+ "@esbuild/freebsd-arm64": "0.17.19",
+ "@esbuild/freebsd-x64": "0.17.19",
+ "@esbuild/linux-arm": "0.17.19",
+ "@esbuild/linux-arm64": "0.17.19",
+ "@esbuild/linux-ia32": "0.17.19",
+ "@esbuild/linux-loong64": "0.17.19",
+ "@esbuild/linux-mips64el": "0.17.19",
+ "@esbuild/linux-ppc64": "0.17.19",
+ "@esbuild/linux-riscv64": "0.17.19",
+ "@esbuild/linux-s390x": "0.17.19",
+ "@esbuild/linux-x64": "0.17.19",
+ "@esbuild/netbsd-x64": "0.17.19",
+ "@esbuild/openbsd-x64": "0.17.19",
+ "@esbuild/sunos-x64": "0.17.19",
+ "@esbuild/win32-arm64": "0.17.19",
+ "@esbuild/win32-ia32": "0.17.19",
+ "@esbuild/win32-x64": "0.17.19"
+ }
+ },
+ "node_modules/escape-string-regexp": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
+ "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/estree-walker": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz",
+ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/exit-hook": {
+ "version": "2.2.1",
+ "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-2.2.1.tgz",
+ "integrity": "sha512-eNTPlAD67BmP31LDINZ3U7HSF8l57TxOY2PmBJ1shpCvpnxBF93mWCE8YHBnXs8qiUZJc9WDcWIeC3a2HIAMfw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/exsolve": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.8.tgz",
+ "integrity": "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/fsevents": {
+ "version": "2.3.3",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
+ "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
+ "node_modules/get-source": {
+ "version": "2.0.12",
+ "resolved": "https://registry.npmjs.org/get-source/-/get-source-2.0.12.tgz",
+ "integrity": "sha512-X5+4+iD+HoSeEED+uwrQ07BOQr0kEDFMVqqpBuI+RaZBpBpHCuXxo70bjar6f0b0u/DQJsJ7ssurpP0V60Az+w==",
+ "dev": true,
+ "license": "Unlicense",
+ "dependencies": {
+ "data-uri-to-buffer": "^2.0.0",
+ "source-map": "^0.6.1"
+ }
+ },
+ "node_modules/glob-to-regexp": {
+ "version": "0.4.1",
+ "resolved": "https://registry.npmjs.org/glob-to-regexp/-/glob-to-regexp-0.4.1.tgz",
+ "integrity": "sha512-lkX1HJXwyMcprw/5YUZc2s7DrpAiHB21/V+E1rHUrVNokkvB6bqMzT0VfV6/86ZNabt1k14YOIaT7nDvOX3Iiw==",
+ "dev": true,
+ "license": "BSD-2-Clause"
+ },
+ "node_modules/is-arrayish": {
+ "version": "0.3.4",
+ "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.3.4.tgz",
+ "integrity": "sha512-m6UrgzFVUYawGBh1dUsWR5M2Clqic9RVXC/9f8ceNlv2IcO9j9J/z8UoCLPqtsPBFNzEpfR3xftohbfqDx8EQA==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true
+ },
+ "node_modules/magic-string": {
+ "version": "0.25.9",
+ "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.9.tgz",
+ "integrity": "sha512-RmF0AsMzgt25qzqqLc1+MbHmhdx0ojF2Fvs4XnOqz2ZOBXzzkEwc/dJQZCYHAn7v1jbVOjAZfK8msRn4BxO4VQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "sourcemap-codec": "^1.4.8"
+ }
+ },
+ "node_modules/mime": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/mime/-/mime-3.0.0.tgz",
+ "integrity": "sha512-jSCU7/VB1loIWBZe14aEYHU/+1UMEHoaO7qxCOVJOw9GgH72VAWppxNcjU+x9a2k3GSIBXNKxXQFqRvvZ7vr3A==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "mime": "cli.js"
+ },
+ "engines": {
+ "node": ">=10.0.0"
+ }
+ },
+ "node_modules/miniflare": {
+ "version": "3.20250718.3",
+ "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20250718.3.tgz",
+ "integrity": "sha512-JuPrDJhwLrNLEJiNLWO7ZzJrv/Vv9kZuwMYCfv0LskQDM6Eonw4OvywO3CH/wCGjgHzha/qyjUh8JQ068TjDgQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@cspotcode/source-map-support": "0.8.1",
+ "acorn": "8.14.0",
+ "acorn-walk": "8.3.2",
+ "exit-hook": "2.2.1",
+ "glob-to-regexp": "0.4.1",
+ "stoppable": "1.1.0",
+ "undici": "^5.28.5",
+ "workerd": "1.20250718.0",
+ "ws": "8.18.0",
+ "youch": "3.3.4",
+ "zod": "3.22.3"
+ },
+ "bin": {
+ "miniflare": "bootstrap.js"
+ },
+ "engines": {
+ "node": ">=16.13"
+ }
+ },
+ "node_modules/mustache": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/mustache/-/mustache-4.2.0.tgz",
+ "integrity": "sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "mustache": "bin/mustache"
+ }
+ },
+ "node_modules/ohash": {
+ "version": "2.0.11",
+ "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz",
+ "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/path-to-regexp": {
+ "version": "6.3.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz",
+ "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/pathe": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
+ "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/printable-characters": {
+ "version": "1.0.42",
+ "resolved": "https://registry.npmjs.org/printable-characters/-/printable-characters-1.0.42.tgz",
+ "integrity": "sha512-dKp+C4iXWK4vVYZmYSd0KBH5F/h1HoZRsbJ82AVKRO3PEo8L4lBS/vLwhVtpwwuYcoIsVY+1JYKR268yn480uQ==",
+ "dev": true,
+ "license": "Unlicense"
+ },
+ "node_modules/rollup-plugin-inject": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-inject/-/rollup-plugin-inject-3.0.2.tgz",
+ "integrity": "sha512-ptg9PQwzs3orn4jkgXJ74bfs5vYz1NCZlSQMBUA0wKcGp5i5pA1AO3fOUEte8enhGUC+iapTCzEWw2jEFFUO/w==",
+ "deprecated": "This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "estree-walker": "^0.6.1",
+ "magic-string": "^0.25.3",
+ "rollup-pluginutils": "^2.8.1"
+ }
+ },
+ "node_modules/rollup-plugin-node-polyfills": {
+ "version": "0.2.1",
+ "resolved": "https://registry.npmjs.org/rollup-plugin-node-polyfills/-/rollup-plugin-node-polyfills-0.2.1.tgz",
+ "integrity": "sha512-4kCrKPTJ6sK4/gLL/U5QzVT8cxJcofO0OU74tnB19F40cmuAKSzH5/siithxlofFEjwvw1YAhPmbvGNA6jEroA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "rollup-plugin-inject": "^3.0.0"
+ }
+ },
+ "node_modules/rollup-pluginutils": {
+ "version": "2.8.2",
+ "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz",
+ "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "estree-walker": "^0.6.1"
+ }
+ },
+ "node_modules/semver": {
+ "version": "7.8.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz",
+ "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==",
+ "dev": true,
+ "license": "ISC",
+ "optional": true,
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/sharp": {
+ "version": "0.33.5",
+ "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.33.5.tgz",
+ "integrity": "sha512-haPVm1EkS9pgvHrQ/F3Xy+hgcuMV0Wm9vfIBSiwZ05k+xgb0PkBQpGsAA/oWdDobNaZTH5ppvHtzCFbnSEwHVw==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "Apache-2.0",
+ "optional": true,
+ "dependencies": {
+ "color": "^4.2.3",
+ "detect-libc": "^2.0.3",
+ "semver": "^7.6.3"
+ },
+ "engines": {
+ "node": "^18.17.0 || ^20.3.0 || >=21.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/libvips"
+ },
+ "optionalDependencies": {
+ "@img/sharp-darwin-arm64": "0.33.5",
+ "@img/sharp-darwin-x64": "0.33.5",
+ "@img/sharp-libvips-darwin-arm64": "1.0.4",
+ "@img/sharp-libvips-darwin-x64": "1.0.4",
+ "@img/sharp-libvips-linux-arm": "1.0.5",
+ "@img/sharp-libvips-linux-arm64": "1.0.4",
+ "@img/sharp-libvips-linux-s390x": "1.0.4",
+ "@img/sharp-libvips-linux-x64": "1.0.4",
+ "@img/sharp-libvips-linuxmusl-arm64": "1.0.4",
+ "@img/sharp-libvips-linuxmusl-x64": "1.0.4",
+ "@img/sharp-linux-arm": "0.33.5",
+ "@img/sharp-linux-arm64": "0.33.5",
+ "@img/sharp-linux-s390x": "0.33.5",
+ "@img/sharp-linux-x64": "0.33.5",
+ "@img/sharp-linuxmusl-arm64": "0.33.5",
+ "@img/sharp-linuxmusl-x64": "0.33.5",
+ "@img/sharp-wasm32": "0.33.5",
+ "@img/sharp-win32-ia32": "0.33.5",
+ "@img/sharp-win32-x64": "0.33.5"
+ }
+ },
+ "node_modules/simple-swizzle": {
+ "version": "0.2.4",
+ "resolved": "https://registry.npmjs.org/simple-swizzle/-/simple-swizzle-0.2.4.tgz",
+ "integrity": "sha512-nAu1WFPQSMNr2Zn9PGSZK9AGn4t/y97lEm+MXTtUDwfP0ksAIX4nO+6ruD9Jwut4C49SB1Ws+fbXsm/yScWOHw==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "dependencies": {
+ "is-arrayish": "^0.3.1"
+ }
+ },
+ "node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/sourcemap-codec": {
+ "version": "1.4.8",
+ "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz",
+ "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==",
+ "deprecated": "Please use @jridgewell/sourcemap-codec instead",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/stacktracey": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/stacktracey/-/stacktracey-2.2.0.tgz",
+ "integrity": "sha512-ETyQEz+CzXiLjEbyJqpbp+/T79RQD/6wqFucRBIlVNZfYq2Ay7wbretD4cxpbymZlaPWx58aIhPEY1Cr8DlVvg==",
+ "dev": true,
+ "license": "Unlicense",
+ "dependencies": {
+ "as-table": "^1.0.36",
+ "get-source": "^2.0.12"
+ }
+ },
+ "node_modules/stoppable": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
+ "integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4",
+ "npm": ">=6"
+ }
+ },
+ "node_modules/tslib": {
+ "version": "2.8.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
+ "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
+ "dev": true,
+ "license": "0BSD",
+ "optional": true
+ },
+ "node_modules/typescript": {
+ "version": "5.9.3",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
+ "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "tsc": "bin/tsc",
+ "tsserver": "bin/tsserver"
+ },
+ "engines": {
+ "node": ">=14.17"
+ }
+ },
+ "node_modules/ufo": {
+ "version": "1.6.4",
+ "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.4.tgz",
+ "integrity": "sha512-JFNbkD1Svwe0KvGi8GOeLcP4kAWQ609twvCdcHxq1oSL8svv39ZuSvajcD8B+5D0eL4+s1Is2D/O6KN3qcTeRA==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/undici": {
+ "version": "5.29.0",
+ "resolved": "https://registry.npmjs.org/undici/-/undici-5.29.0.tgz",
+ "integrity": "sha512-raqeBD6NQK4SkWhQzeYKd1KmIG6dllBOTt55Rmkt4HtI9mwdWtJljnrXjAFUBLTSN67HWrOIZ3EPF4kjUw80Bg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@fastify/busboy": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=14.0"
+ }
+ },
+ "node_modules/unenv": {
+ "version": "2.0.0-rc.14",
+ "resolved": "https://registry.npmjs.org/unenv/-/unenv-2.0.0-rc.14.tgz",
+ "integrity": "sha512-od496pShMen7nOy5VmVJCnq8rptd45vh6Nx/r2iPbrba6pa6p+tS2ywuIHRZ/OBvSbQZB0kWvpO9XBNVFXHD3Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "defu": "^6.1.4",
+ "exsolve": "^1.0.1",
+ "ohash": "^2.0.10",
+ "pathe": "^2.0.3",
+ "ufo": "^1.5.4"
+ }
+ },
+ "node_modules/workerd": {
+ "version": "1.20250718.0",
+ "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20250718.0.tgz",
+ "integrity": "sha512-kqkIJP/eOfDlUyBzU7joBg+tl8aB25gEAGqDap+nFWb+WHhnooxjGHgxPBy3ipw2hnShPFNOQt5lFRxbwALirg==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "workerd": "bin/workerd"
+ },
+ "engines": {
+ "node": ">=16"
+ },
+ "optionalDependencies": {
+ "@cloudflare/workerd-darwin-64": "1.20250718.0",
+ "@cloudflare/workerd-darwin-arm64": "1.20250718.0",
+ "@cloudflare/workerd-linux-64": "1.20250718.0",
+ "@cloudflare/workerd-linux-arm64": "1.20250718.0",
+ "@cloudflare/workerd-windows-64": "1.20250718.0"
+ }
+ },
+ "node_modules/wrangler": {
+ "version": "3.114.17",
+ "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.114.17.tgz",
+ "integrity": "sha512-tAvf7ly+tB+zwwrmjsCyJ2pJnnc7SZhbnNwXbH+OIdVas3zTSmjcZOjmLKcGGptssAA3RyTKhcF9BvKZzMUycA==",
+ "dev": true,
+ "license": "MIT OR Apache-2.0",
+ "dependencies": {
+ "@cloudflare/kv-asset-handler": "0.3.4",
+ "@cloudflare/unenv-preset": "2.0.2",
+ "@esbuild-plugins/node-globals-polyfill": "0.2.3",
+ "@esbuild-plugins/node-modules-polyfill": "0.2.2",
+ "blake3-wasm": "2.1.5",
+ "esbuild": "0.17.19",
+ "miniflare": "3.20250718.3",
+ "path-to-regexp": "6.3.0",
+ "unenv": "2.0.0-rc.14",
+ "workerd": "1.20250718.0"
+ },
+ "bin": {
+ "wrangler": "bin/wrangler.js",
+ "wrangler2": "bin/wrangler.js"
+ },
+ "engines": {
+ "node": ">=16.17.0"
+ },
+ "optionalDependencies": {
+ "fsevents": "~2.3.2",
+ "sharp": "^0.33.5"
+ },
+ "peerDependencies": {
+ "@cloudflare/workers-types": "^4.20250408.0"
+ },
+ "peerDependenciesMeta": {
+ "@cloudflare/workers-types": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/ws": {
+ "version": "8.18.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz",
+ "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/youch": {
+ "version": "3.3.4",
+ "resolved": "https://registry.npmjs.org/youch/-/youch-3.3.4.tgz",
+ "integrity": "sha512-UeVBXie8cA35DS6+nBkls68xaBBXCye0CNznrhszZjTbRVnJKQuNsyLKBTTL4ln1o1rh2PKtv35twV7irj5SEg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cookie": "^0.7.1",
+ "mustache": "^4.2.0",
+ "stacktracey": "^2.1.8"
+ }
+ },
+ "node_modules/zod": {
+ "version": "3.22.3",
+ "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.3.tgz",
+ "integrity": "sha512-EjIevzuJRiRPbVH4mGc8nApb/lVLKVpmUhAaR5R5doKGfAnGJ6Gr3CViAVjP+4FWSxCsybeWQdcgCtbX+7oZug==",
+ "dev": true,
+ "license": "MIT",
+ "funding": {
+ "url": "https://github.com/sponsors/colinhacks"
+ }
+ }
+ }
+}
diff --git a/worker/package.json b/worker/package.json
new file mode 100644
index 0000000..3020636
--- /dev/null
+++ b/worker/package.json
@@ -0,0 +1,17 @@
+{
+ "name": "sessionist-worker",
+ "version": "0.1.0",
+ "private": true,
+ "description": "Cloudflare Worker: Stripe Checkout sessions + Ed25519 license minting (PRD §13.8).",
+ "type": "module",
+ "scripts": {
+ "dev": "wrangler dev",
+ "deploy": "wrangler deploy",
+ "compile": "tsc --noEmit"
+ },
+ "devDependencies": {
+ "@cloudflare/workers-types": "^4.20241127.0",
+ "typescript": "^5.6.3",
+ "wrangler": "^3.90.0"
+ }
+}
diff --git a/worker/src/index.ts b/worker/src/index.ts
new file mode 100644
index 0000000..2d61899
--- /dev/null
+++ b/worker/src/index.ts
@@ -0,0 +1,70 @@
+/**
+ * Cloudflare Worker — Pro checkout + license minting (PRD §13.8).
+ *
+ * Routes:
+ * POST /checkout -> create a Stripe-hosted Checkout session
+ * POST /webhook -> handle checkout.session.completed, mint a key
+ * GET /health -> liveness
+ *
+ * No license database for MVP: the Ed25519-signed key IS the license, verified
+ * offline by the extension. Stubbed here — wire Stripe + WebCrypto signing in.
+ */
+
+export interface Env {
+ STRIPE_SECRET_KEY: string;
+ STRIPE_WEBHOOK_SECRET: string;
+ LICENSE_SIGNING_KEY: string;
+ PRO_PRICE_ID: string;
+ SUCCESS_URL: string;
+ CANCEL_URL: string;
+}
+
+export default {
+ async fetch(request: Request, env: Env): Promise {
+ const url = new URL(request.url);
+
+ if (request.method === 'GET' && url.pathname === '/health') {
+ return json({ ok: true });
+ }
+
+ if (request.method === 'POST' && url.pathname === '/checkout') {
+ return createCheckoutSession(request, env);
+ }
+
+ if (request.method === 'POST' && url.pathname === '/webhook') {
+ return handleStripeWebhook(request, env);
+ }
+
+ return new Response('Not found', { status: 404 });
+ },
+};
+
+/** Create a Stripe Checkout session for the one-time $29 Pro purchase. */
+async function createCheckoutSession(_request: Request, _env: Env): Promise {
+ // TODO: call Stripe API to create a Checkout session for PRO_PRICE_ID,
+ // return { checkoutUrl }.
+ return json({ error: 'not_implemented', endpoint: 'checkout' }, 501);
+}
+
+/** Verify the webhook signature, then mint an Ed25519-signed license key. */
+async function handleStripeWebhook(_request: Request, _env: Env): Promise {
+ // TODO: verify STRIPE_WEBHOOK_SECRET, on checkout.session.completed sign an
+ // entitlement payload with LICENSE_SIGNING_KEY and deliver the key to the buyer.
+ return json({ error: 'not_implemented', endpoint: 'webhook' }, 501);
+}
+
+/** Sign an entitlement payload into a portable, offline-verifiable key. */
+export async function mintLicenseKey(
+ _signingKeyPkcs8Base64: string,
+ _payload: { subjectId: string; tier: 'pro'; issuedAt: string },
+): Promise {
+ // TODO: crypto.subtle.importKey('pkcs8', ...Ed25519) + sign(payload).
+ throw new Error('not_implemented: mintLicenseKey');
+}
+
+function json(body: unknown, status = 200): Response {
+ return new Response(JSON.stringify(body), {
+ status,
+ headers: { 'content-type': 'application/json' },
+ });
+}
diff --git a/worker/tsconfig.json b/worker/tsconfig.json
new file mode 100644
index 0000000..8f64e3f
--- /dev/null
+++ b/worker/tsconfig.json
@@ -0,0 +1,14 @@
+{
+ "compilerOptions": {
+ "target": "ES2022",
+ "module": "ES2022",
+ "moduleResolution": "Bundler",
+ "lib": ["ES2022"],
+ "types": ["@cloudflare/workers-types"],
+ "strict": true,
+ "noEmit": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true
+ },
+ "include": ["src"]
+}
diff --git a/worker/wrangler.toml b/worker/wrangler.toml
new file mode 100644
index 0000000..e56b334
--- /dev/null
+++ b/worker/wrangler.toml
@@ -0,0 +1,16 @@
+name = "sessionist-checkout"
+main = "src/index.ts"
+compatibility_date = "2024-11-27"
+
+# Secrets (set via `wrangler secret put`), never committed:
+# STRIPE_SECRET_KEY — Stripe API key
+# STRIPE_WEBHOOK_SECRET — verifies checkout.session.completed webhooks
+# LICENSE_SIGNING_KEY — Ed25519 private key (PKCS#8, base64) for minting
+#
+# The matching Ed25519 *public* key is baked into the extension build as
+# WXT_LICENSE_PUBLIC_KEY so license keys verify offline (PRD §13.8).
+
+[vars]
+PRO_PRICE_ID = "price_replace_me"
+SUCCESS_URL = "https://sessionist.example/thanks"
+CANCEL_URL = "https://sessionist.example/cancel"
diff --git a/wxt.config.ts b/wxt.config.ts
new file mode 100644
index 0000000..d6aa8ad
--- /dev/null
+++ b/wxt.config.ts
@@ -0,0 +1,46 @@
+import { defineConfig } from 'wxt';
+
+// WXT configuration. See https://wxt.dev
+// Manifest V3, minimal install-time permissions. Host access is requested at
+// runtime when the user acts on a site (see PRD §9.6 / §14.1).
+export default defineConfig({
+ modules: ['@wxt-dev/module-react'],
+ // Canonical WXT layout: everything under src/. WXT then maps `@` -> src,
+ // matching the tsconfig `@/*` paths mapping used by tsc.
+ srcDir: 'src',
+ imports: false, // explicit imports only — keep the skeleton legible.
+ manifest: {
+ name: 'Sessionist — Cookie Editor, Session Manager & Playwright Export',
+ description:
+ 'Save, switch, and export browser session identities. Cookie editor, session profiles, and Playwright storageState export for developers and QA.',
+ // Minimum viable install-time permissions (PRD §9.6 / §13.2). `tabs` is
+ // intentionally omitted — it would expose every tab's URL/title; `activeTab`
+ // + per-origin host grants cover the active-tab model. Multi-tab coordination
+ // (which would need `tabs`) is P1/cut from MVP (PRD §17).
+ permissions: ['cookies', 'storage', 'sidePanel', 'scripting', 'activeTab'],
+ // No at install. Host access is requested at runtime via
+ // chrome.permissions.request (optional_host_permissions).
+ optional_host_permissions: ['*://*/*'],
+ action: {
+ default_title: 'Sessionist',
+ },
+ // Open the side panel when the toolbar icon is clicked (wired in background).
+ side_panel: {
+ default_path: 'sidepanel.html',
+ },
+ },
+ hooks: {
+ // WXT binds the popup entrypoint to action.default_popup, which would make
+ // the toolbar icon open the popup. PRD §13.1 is side-panel-first, so strip
+ // default_popup — the icon then opens the side panel (openPanelOnActionClick
+ // is set in the background). The popup remains a buildable P1 surface.
+ 'build:manifestGenerated': (_wxt, manifest) => {
+ if (manifest.action) delete manifest.action.default_popup;
+ },
+ },
+ vite: () => ({
+ css: {
+ postcss: './postcss.config.js',
+ },
+ }),
+});
From 87a631f139449087b4ad0bbd340fb19567b1c1d2 Mon Sep 17 00:00:00 2001
From: Murraylr
Date: Fri, 5 Jun 2026 22:09:55 -0400
Subject: [PATCH 03/33] Add comprehensive spec-by-test suite (988 tests) + test
harness
Spec-by-test: tests encode the PRD contract for every feature so they fail
cleanly against the stubs (NotImplementedError/assertion) and pass only when a
feature is implemented correctly. 988 tests across cookies, profiles/switch,
export, crypto, storage, permissions, licensing, worker, telemetry, router,
and UI. 362 pass now (wiring/UI/telemetry/settings already implemented).
Infrastructure:
- Realistic in-memory chrome.* fake (cookies/storage/permissions/tabs/
scripting/runtime/sidePanel) with fault injection, in tests/harness.
- vitest + jsdom + @testing-library + fake-indexeddb; tests/CONTRACTS.md as
the cross-cutting contract source of truth.
- Testability seams: licenseVerifier.setLicensePublicKey, background
messageHandler extraction, clipboard lib, worker LicensePayload.validUntil.
Every group was independently verified by implementing it in a throwaway
worktree and proving the tests go green; mutation testing confirmed the
already-green groups catch bugs. Hardening of weak/edge tests follows.
Co-Authored-By: Claude Opus 4.8 (1M context)
---
.gitignore | 3 +
eslint.config.js | 14 +
package-lock.json | 2088 +++++++++++++++++-
package.json | 13 +
src/background/messageHandler.ts | 50 +
src/entrypoints/background.ts | 42 +-
src/lib/clipboard.ts | 25 +
src/services/cookies/cookieService.ts | 7 +-
src/services/licensing/licenseVerifier.ts | 22 +-
src/ui/views/ExportView.tsx | 12 +-
tests/CONTRACTS.md | 212 ++
tests/background/messageHandler.test.ts | 370 ++++
tests/background/router.test.ts | 642 ++++++
tests/cookies/cookieImportExport.test.ts | 650 ++++++
tests/cookies/cookieService.test.ts | 570 +++++
tests/cookies/netscapeFormat.test.ts | 334 +++
tests/cookies/router.cookies.test.ts | 322 +++
tests/crypto/encryption.test.ts | 260 +++
tests/crypto/keyManager.test.ts | 97 +
tests/crypto/passphrase.test.ts | 218 ++
tests/export/playwrightExport.test.ts | 460 ++++
tests/export/redaction.test.ts | 318 +++
tests/export/snippetExport.test.ts | 315 +++
tests/harness/factories.ts | 66 +
tests/harness/fakeChrome.ts | 549 +++++
tests/licensing/entitlementService.test.ts | 422 ++++
tests/licensing/licenseVerifier.test.ts | 427 ++++
tests/permissions/permissionService.test.ts | 417 ++++
tests/permissions/router.permissions.test.ts | 189 ++
tests/profiles/captureService.test.ts | 282 +++
tests/profiles/correctnessMatrix.test.ts | 494 +++++
tests/profiles/profileService.test.ts | 295 +++
tests/profiles/router.profiles.test.ts | 367 +++
tests/profiles/snapshotService.test.ts | 212 ++
tests/profiles/switchEngine.test.ts | 441 ++++
tests/profiles/webStorageCapture.test.ts | 196 ++
tests/sanity.test.ts | 65 +
tests/setup.ts | 25 +
tests/storage/db.test.ts | 276 +++
tests/storage/profileRepository.test.ts | 500 +++++
tests/storage/settingsRepository.test.ts | 207 ++
tests/telemetry/telemetry.test.ts | 314 +++
tests/ui/App.test.tsx | 243 ++
tests/ui/CookieEditorView.test.tsx | 349 +++
tests/ui/ExportView.test.tsx | 251 +++
tests/ui/OnboardingView.test.tsx | 97 +
tests/ui/ProfilesView.test.tsx | 331 +++
tests/ui/SettingsView.test.tsx | 240 ++
tests/ui/SiteAccessView.test.tsx | 158 ++
tests/ui/TeamView.test.tsx | 44 +
tests/ui/UpgradeView.test.tsx | 110 +
tests/ui/accessibility.test.tsx | 155 ++
tests/ui/helpers.tsx | 128 ++
tests/ui/store.test.ts | 158 ++
tests/ui/useActiveTab.test.tsx | 117 +
tests/ui/useBackground.test.tsx | 145 ++
tests/ui/useTheme.test.tsx | 130 ++
tests/worker/worker.test.ts | 555 +++++
vitest.config.ts | 25 +
worker/src/index.ts | 14 +-
60 files changed, 15910 insertions(+), 128 deletions(-)
create mode 100644 src/background/messageHandler.ts
create mode 100644 src/lib/clipboard.ts
create mode 100644 tests/CONTRACTS.md
create mode 100644 tests/background/messageHandler.test.ts
create mode 100644 tests/background/router.test.ts
create mode 100644 tests/cookies/cookieImportExport.test.ts
create mode 100644 tests/cookies/cookieService.test.ts
create mode 100644 tests/cookies/netscapeFormat.test.ts
create mode 100644 tests/cookies/router.cookies.test.ts
create mode 100644 tests/crypto/encryption.test.ts
create mode 100644 tests/crypto/keyManager.test.ts
create mode 100644 tests/crypto/passphrase.test.ts
create mode 100644 tests/export/playwrightExport.test.ts
create mode 100644 tests/export/redaction.test.ts
create mode 100644 tests/export/snippetExport.test.ts
create mode 100644 tests/harness/factories.ts
create mode 100644 tests/harness/fakeChrome.ts
create mode 100644 tests/licensing/entitlementService.test.ts
create mode 100644 tests/licensing/licenseVerifier.test.ts
create mode 100644 tests/permissions/permissionService.test.ts
create mode 100644 tests/permissions/router.permissions.test.ts
create mode 100644 tests/profiles/captureService.test.ts
create mode 100644 tests/profiles/correctnessMatrix.test.ts
create mode 100644 tests/profiles/profileService.test.ts
create mode 100644 tests/profiles/router.profiles.test.ts
create mode 100644 tests/profiles/snapshotService.test.ts
create mode 100644 tests/profiles/switchEngine.test.ts
create mode 100644 tests/profiles/webStorageCapture.test.ts
create mode 100644 tests/sanity.test.ts
create mode 100644 tests/setup.ts
create mode 100644 tests/storage/db.test.ts
create mode 100644 tests/storage/profileRepository.test.ts
create mode 100644 tests/storage/settingsRepository.test.ts
create mode 100644 tests/telemetry/telemetry.test.ts
create mode 100644 tests/ui/App.test.tsx
create mode 100644 tests/ui/CookieEditorView.test.tsx
create mode 100644 tests/ui/ExportView.test.tsx
create mode 100644 tests/ui/OnboardingView.test.tsx
create mode 100644 tests/ui/ProfilesView.test.tsx
create mode 100644 tests/ui/SettingsView.test.tsx
create mode 100644 tests/ui/SiteAccessView.test.tsx
create mode 100644 tests/ui/TeamView.test.tsx
create mode 100644 tests/ui/UpgradeView.test.tsx
create mode 100644 tests/ui/accessibility.test.tsx
create mode 100644 tests/ui/helpers.tsx
create mode 100644 tests/ui/store.test.ts
create mode 100644 tests/ui/useActiveTab.test.tsx
create mode 100644 tests/ui/useBackground.test.tsx
create mode 100644 tests/ui/useTheme.test.tsx
create mode 100644 tests/worker/worker.test.ts
create mode 100644 vitest.config.ts
diff --git a/.gitignore b/.gitignore
index f4a851d..7f1d2e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,6 +11,9 @@ stats.html
.env.*
!.env.example
+# Agent worktrees / local tooling
+.claude/
+
# Editor / OS
.vscode/
.idea/
diff --git a/eslint.config.js b/eslint.config.js
index 0cf5769..08745fe 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -50,4 +50,18 @@ export default tseslint.config(
],
},
},
+ {
+ // Tests + harness — browser + chrome + node globals, lenient unused-var rule.
+ files: ['tests/**/*.{ts,tsx}', 'e2e/**/*.{ts,tsx}'],
+ languageOptions: {
+ globals: { ...globals.browser, ...globals.node, chrome: 'readonly' },
+ },
+ rules: {
+ '@typescript-eslint/no-unused-vars': [
+ 'warn',
+ { argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
+ ],
+ '@typescript-eslint/no-explicit-any': 'off',
+ },
+ },
);
diff --git a/package-lock.json b/package-lock.json
index aa3b3ff..dc6a9cd 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,19 +15,28 @@
"zustand": "^4.5.5"
},
"devDependencies": {
+ "@playwright/test": "^1.49.0",
+ "@testing-library/dom": "^10.4.0",
+ "@testing-library/jest-dom": "^6.6.3",
+ "@testing-library/react": "^16.0.1",
+ "@testing-library/user-event": "^14.5.2",
"@types/chrome": "^0.0.270",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
+ "@vitest/coverage-v8": "^2.1.8",
"@wxt-dev/module-react": "1.1.3",
"autoprefixer": "^10.4.20",
"eslint": "^9.15.0",
"eslint-plugin-react-hooks": "^5.0.0",
+ "fake-indexeddb": "^6.0.0",
"globals": "^15.12.0",
+ "jsdom": "^25.0.1",
"postcss": "^8.4.49",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.15",
"typescript": "^5.6.3",
"typescript-eslint": "^8.15.0",
+ "vitest": "^2.1.8",
"wxt": "^0.19.13"
}
},
@@ -42,6 +51,13 @@
"many-keys-map": "^3.0.0"
}
},
+ "node_modules/@adobe/css-tools": {
+ "version": "4.5.0",
+ "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.5.0.tgz",
+ "integrity": "sha512-6OzddxPio9UiWTCemp4N8cYLV2ZN1ncRnV1cVGtve7dhPOtRkleRyx32GQCYSwDYgaHU3USMm84tNsvKzRCa1Q==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@aklinker1/rollup-plugin-visualizer": {
"version": "5.12.0",
"resolved": "https://registry.npmjs.org/@aklinker1/rollup-plugin-visualizer/-/rollup-plugin-visualizer-5.12.0.tgz",
@@ -139,6 +155,41 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/@ampproject/remapping": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
+ "integrity": "sha512-30iZtAPgz+LTIYoeivqYo853f02jBYSd5uGnGpkFV0M3xOt9aN73erkgYAmZU43x4VfqcnLxW9Kpg3R5LC4YYw==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "@jridgewell/gen-mapping": "^0.3.5",
+ "@jridgewell/trace-mapping": "^0.3.24"
+ },
+ "engines": {
+ "node": ">=6.0.0"
+ }
+ },
+ "node_modules/@asamuzakjp/css-color": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz",
+ "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@csstools/css-calc": "^2.1.3",
+ "@csstools/css-color-parser": "^3.0.9",
+ "@csstools/css-parser-algorithms": "^3.0.4",
+ "@csstools/css-tokenizer": "^3.0.3",
+ "lru-cache": "^10.4.3"
+ }
+ },
+ "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": {
+ "version": "10.4.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/@babel/code-frame": {
"version": "7.29.7",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz",
@@ -431,6 +482,128 @@
"node": ">=6.9.0"
}
},
+ "node_modules/@bcoe/v8-coverage": {
+ "version": "0.2.3",
+ "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz",
+ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@csstools/color-helpers": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.1.0.tgz",
+ "integrity": "sha512-S11EXWJyy0Mz5SYvRmY8nJYTFFd1LCNV+7cXyAgQtOOuzb4EsgfqDufL+9esx72/eLhsRdGZwaldu/h+E4t4BA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT-0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@csstools/css-calc": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz",
+ "integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-parser-algorithms": "^3.0.5",
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-color-parser": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.1.0.tgz",
+ "integrity": "sha512-nbtKwh3a6xNVIp/VRuXV64yTKnb1IjTAEEh3irzS+HkKjAOYLTGNb9pmVNntZ8iVBHcWDA2Dof0QtPgFI1BaTA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT",
+ "dependencies": {
+ "@csstools/color-helpers": "^5.1.0",
+ "@csstools/css-calc": "^2.1.4"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-parser-algorithms": "^3.0.5",
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-parser-algorithms": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz",
+ "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-tokenizer": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz",
+ "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@devicefarmer/adbkit": {
"version": "3.3.8",
"resolved": "https://registry.npmjs.org/@devicefarmer/adbkit/-/adbkit-3.3.8.tgz",
@@ -1166,6 +1339,90 @@
"url": "https://github.com/sponsors/nzakas"
}
},
+ "node_modules/@isaacs/cliui": {
+ "version": "8.0.2",
+ "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz",
+ "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "string-width": "^5.1.2",
+ "string-width-cjs": "npm:string-width@^4.2.0",
+ "strip-ansi": "^7.0.1",
+ "strip-ansi-cjs": "npm:strip-ansi@^6.0.1",
+ "wrap-ansi": "^8.1.0",
+ "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@isaacs/cliui/node_modules/ansi-styles": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@isaacs/cliui/node_modules/emoji-regex": {
+ "version": "9.2.2",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz",
+ "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@isaacs/cliui/node_modules/string-width": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz",
+ "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "eastasianwidth": "^0.2.0",
+ "emoji-regex": "^9.2.2",
+ "strip-ansi": "^7.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/@isaacs/cliui/node_modules/wrap-ansi": {
+ "version": "8.1.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz",
+ "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.1.0",
+ "string-width": "^5.0.1",
+ "strip-ansi": "^7.0.1"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/@istanbuljs/schema": {
+ "version": "0.1.6",
+ "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.6.tgz",
+ "integrity": "sha512-+Sg6GCR/wy1oSmQDFq4LQDAhm3ETKnorxN+y5nbLULOR3P0c14f2Wurzj3/xqPXtasLFfHd5iRFQ7AJt4KH2cw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.13",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
@@ -1254,6 +1511,33 @@
"node": ">= 8"
}
},
+ "node_modules/@pkgjs/parseargs": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz",
+ "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==",
+ "dev": true,
+ "license": "MIT",
+ "optional": true,
+ "engines": {
+ "node": ">=14"
+ }
+ },
+ "node_modules/@playwright/test": {
+ "version": "1.60.0",
+ "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.60.0.tgz",
+ "integrity": "sha512-O71yZIbAh/PxDMNGns37GHBIfrVkEVyn+AXyIa5dOTfb4/xNvRWV+Vv/NMbNCtODB/pO7vLlF2OTmMVLhmr7Ag==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "playwright": "1.60.0"
+ },
+ "bin": {
+ "playwright": "cli.js"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@pnpm/config.env-replace": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@pnpm/config.env-replace/-/config.env-replace-1.1.0.tgz",
@@ -1699,6 +1983,102 @@
"win32"
]
},
+ "node_modules/@testing-library/dom": {
+ "version": "10.4.1",
+ "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",
+ "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/runtime": "^7.12.5",
+ "@types/aria-query": "^5.0.1",
+ "aria-query": "5.3.0",
+ "dom-accessibility-api": "^0.5.9",
+ "lz-string": "^1.5.0",
+ "picocolors": "1.1.1",
+ "pretty-format": "^27.0.2"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@testing-library/jest-dom": {
+ "version": "6.9.1",
+ "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-6.9.1.tgz",
+ "integrity": "sha512-zIcONa+hVtVSSep9UT3jZ5rizo2BsxgyDYU7WFD5eICBE7no3881HGeb/QkGfsJs6JTkY1aQhT7rIPC7e+0nnA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@adobe/css-tools": "^4.4.0",
+ "aria-query": "^5.0.0",
+ "css.escape": "^1.5.1",
+ "dom-accessibility-api": "^0.6.3",
+ "picocolors": "^1.1.1",
+ "redent": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=14",
+ "npm": ">=6",
+ "yarn": ">=1"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/dom-accessibility-api": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.6.3.tgz",
+ "integrity": "sha512-7ZgogeTnjuHbo+ct10G9Ffp0mif17idi0IyWNVA/wcwcm7NPOD/WEHVP3n7n3MhXqxoIYm8d6MuZohYWIZ4T3w==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@testing-library/react": {
+ "version": "16.3.2",
+ "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-16.3.2.tgz",
+ "integrity": "sha512-XU5/SytQM+ykqMnAnvB2umaJNIOsLF3PVv//1Ew4CTcpz0/BRyy/af40qqrt7SjKpDdT1saBMc42CUok5gaw+g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.12.5"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@testing-library/dom": "^10.0.0",
+ "@types/react": "^18.0.0 || ^19.0.0",
+ "@types/react-dom": "^18.0.0 || ^19.0.0",
+ "react": "^18.0.0 || ^19.0.0",
+ "react-dom": "^18.0.0 || ^19.0.0"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "@types/react-dom": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@testing-library/user-event": {
+ "version": "14.6.1",
+ "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-14.6.1.tgz",
+ "integrity": "sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12",
+ "npm": ">=6"
+ },
+ "peerDependencies": {
+ "@testing-library/dom": ">=7.21.4"
+ }
+ },
+ "node_modules/@types/aria-query": {
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz",
+ "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/babel__core": {
"version": "7.20.5",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz",
@@ -2161,38 +2541,198 @@
"vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
}
},
- "node_modules/@webext-core/fake-browser": {
- "version": "1.5.2",
- "resolved": "https://registry.npmjs.org/@webext-core/fake-browser/-/fake-browser-1.5.2.tgz",
- "integrity": "sha512-nkDQwOJ23X5Q7cEtN6LRuBtVFf1KVOFi5GoQAro0lzqdh59F5E+K350j1isbnqYbzsXRh1NJtboudIcHfZtvOQ==",
+ "node_modules/@vitest/coverage-v8": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@vitest/coverage-v8/-/coverage-v8-2.1.9.tgz",
+ "integrity": "sha512-Z2cOr0ksM00MpEfyVE8KXIYPEcBFxdbLSs56L8PO0QQMxt/6bDj45uQfxoc96v05KW3clk7vvgP0qfDit9DmfQ==",
"dev": true,
"license": "MIT",
"dependencies": {
- "@types/webextension-polyfill": ">=0.10.5",
- "lodash.merge": "^4.6.2"
+ "@ampproject/remapping": "^2.3.0",
+ "@bcoe/v8-coverage": "^0.2.3",
+ "debug": "^4.3.7",
+ "istanbul-lib-coverage": "^3.2.2",
+ "istanbul-lib-report": "^3.0.1",
+ "istanbul-lib-source-maps": "^5.0.6",
+ "istanbul-reports": "^3.1.7",
+ "magic-string": "^0.30.12",
+ "magicast": "^0.3.5",
+ "std-env": "^3.8.0",
+ "test-exclude": "^7.0.1",
+ "tinyrainbow": "^1.2.0"
},
- "engines": {
- "node": "*"
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "@vitest/browser": "2.1.9",
+ "vitest": "2.1.9"
+ },
+ "peerDependenciesMeta": {
+ "@vitest/browser": {
+ "optional": true
+ }
}
},
- "node_modules/@webext-core/isolated-element": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/@webext-core/isolated-element/-/isolated-element-1.1.5.tgz",
- "integrity": "sha512-4m6oP8Vzm/68YO1QmkUOZqqUcmyBtA53tji2g00/nYXE3E3IceYgeub7eIqvXDV2Z7xU6cm6qO1IMt4XFVwtvQ==",
+ "node_modules/@vitest/expect": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-2.1.9.tgz",
+ "integrity": "sha512-UJCIkTBenHeKT1TTlKMJWy1laZewsRIzYighyYiJKZreqtdxSos/S1t+ktRMQWu2CKqaarrkeszJx1cgC5tGZw==",
"dev": true,
"license": "MIT",
"dependencies": {
- "is-potential-custom-element-name": "^1.0.1"
+ "@vitest/spy": "2.1.9",
+ "@vitest/utils": "2.1.9",
+ "chai": "^5.1.2",
+ "tinyrainbow": "^1.2.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
}
},
- "node_modules/@webext-core/match-patterns": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/@webext-core/match-patterns/-/match-patterns-1.0.3.tgz",
- "integrity": "sha512-NY39ACqCxdKBmHgw361M9pfJma8e4AZo20w9AY+5ZjIj1W2dvXC8J31G5fjfOGbulW9w4WKpT8fPooi0mLkn9A==",
+ "node_modules/@vitest/mocker": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-2.1.9.tgz",
+ "integrity": "sha512-tVL6uJgoUdi6icpxmdrn5YNo3g3Dxv+IHJBr0GXHaEdTcw3F+cPKnsXFhli6nO+f/6SDKPHEK1UN+k+TQv0Ehg==",
"dev": true,
- "license": "MIT"
- },
- "node_modules/@wxt-dev/browser": {
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/spy": "2.1.9",
+ "estree-walker": "^3.0.3",
+ "magic-string": "^0.30.12"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "msw": "^2.4.9",
+ "vite": "^5.0.0"
+ },
+ "peerDependenciesMeta": {
+ "msw": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/@vitest/pretty-format": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-2.1.9.tgz",
+ "integrity": "sha512-KhRIdGV2U9HOUzxfiHmY8IFHTdqtOhIzCpd8WRdJiE7D/HUcZVD0EgQCVjm+Q9gkUXWgBvMmTtZgIG48wq7sOQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tinyrainbow": "^1.2.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/runner": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-2.1.9.tgz",
+ "integrity": "sha512-ZXSSqTFIrzduD63btIfEyOmNcBmQvgOVsPNPe0jYtESiXkhd8u2erDLnMxmGrDCwHCCHE7hxwRDCT3pt0esT4g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/utils": "2.1.9",
+ "pathe": "^1.1.2"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/runner/node_modules/pathe": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
+ "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@vitest/snapshot": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-2.1.9.tgz",
+ "integrity": "sha512-oBO82rEjsxLNJincVhLhaxxZdEtV0EFHMK5Kmx5sJ6H9L183dHECjiefOAdnqpIgT5eZwT04PoggUnW88vOBNQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/pretty-format": "2.1.9",
+ "magic-string": "^0.30.12",
+ "pathe": "^1.1.2"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/snapshot/node_modules/pathe": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
+ "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@vitest/spy": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-2.1.9.tgz",
+ "integrity": "sha512-E1B35FwzXXTs9FHNK6bDszs7mtydNi5MIfUWpceJ8Xbfb1gBMscAnwLbEu+B44ed6W3XjL9/ehLPHR1fkf1KLQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tinyspy": "^3.0.2"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@vitest/utils": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-2.1.9.tgz",
+ "integrity": "sha512-v0psaMSkNJ3A2NMrUEHFRzJtDPFn+/VWZ5WxImB21T9fjucJRmS7xCS3ppEnARb9y11OAzaD+P2Ps+b+BGX5iQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@vitest/pretty-format": "2.1.9",
+ "loupe": "^3.1.2",
+ "tinyrainbow": "^1.2.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/@webext-core/fake-browser": {
+ "version": "1.5.2",
+ "resolved": "https://registry.npmjs.org/@webext-core/fake-browser/-/fake-browser-1.5.2.tgz",
+ "integrity": "sha512-nkDQwOJ23X5Q7cEtN6LRuBtVFf1KVOFi5GoQAro0lzqdh59F5E+K350j1isbnqYbzsXRh1NJtboudIcHfZtvOQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/webextension-polyfill": ">=0.10.5",
+ "lodash.merge": "^4.6.2"
+ },
+ "engines": {
+ "node": "*"
+ }
+ },
+ "node_modules/@webext-core/isolated-element": {
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@webext-core/isolated-element/-/isolated-element-1.1.5.tgz",
+ "integrity": "sha512-4m6oP8Vzm/68YO1QmkUOZqqUcmyBtA53tji2g00/nYXE3E3IceYgeub7eIqvXDV2Z7xU6cm6qO1IMt4XFVwtvQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "is-potential-custom-element-name": "^1.0.1"
+ }
+ },
+ "node_modules/@webext-core/match-patterns": {
+ "version": "1.0.3",
+ "resolved": "https://registry.npmjs.org/@webext-core/match-patterns/-/match-patterns-1.0.3.tgz",
+ "integrity": "sha512-NY39ACqCxdKBmHgw361M9pfJma8e4AZo20w9AY+5ZjIj1W2dvXC8J31G5fjfOGbulW9w4WKpT8fPooi0mLkn9A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@wxt-dev/browser": {
"version": "0.1.42",
"resolved": "https://registry.npmjs.org/@wxt-dev/browser/-/browser-0.1.42.tgz",
"integrity": "sha512-BSb0H09i4+0WlqFnN7LnZW0M6uCPH9KndciGx7mwOFKRVjNCorqwPk3hiVB58yQ+cyJNpDvYWL6IoPBxvP8qEA==",
@@ -2264,6 +2804,16 @@
"node": ">=12.0"
}
},
+ "node_modules/agent-base": {
+ "version": "7.1.4",
+ "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz",
+ "integrity": "sha512-MnA+YT8fwfJPgBx3m60MNqakm30XOkyIoH1y6huTQvC0PwZG7ki8NacLBcrPbNoo8vEZy7Jpuk7+jMO+CUovTQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/ajv": {
"version": "6.15.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.15.0.tgz",
@@ -2426,6 +2976,16 @@
"dev": true,
"license": "Python-2.0"
},
+ "node_modules/aria-query": {
+ "version": "5.3.0",
+ "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz",
+ "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "dequal": "^2.0.3"
+ }
+ },
"node_modules/array-differ": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/array-differ/-/array-differ-4.0.0.tgz",
@@ -2452,6 +3012,16 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/assertion-error": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz",
+ "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/async": {
"version": "3.2.6",
"resolved": "https://registry.npmjs.org/async/-/async-3.2.6.tgz",
@@ -2469,6 +3039,13 @@
"tslib": "^2.4.0"
}
},
+ "node_modules/asynckit": {
+ "version": "0.4.0",
+ "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
+ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/atomic-sleep": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz",
@@ -2820,6 +3397,20 @@
"node": ">=8"
}
},
+ "node_modules/call-bind-apply-helpers": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
+ "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "function-bind": "^1.1.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/callsites": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz",
@@ -2874,6 +3465,23 @@
],
"license": "CC-BY-4.0"
},
+ "node_modules/chai": {
+ "version": "5.3.3",
+ "resolved": "https://registry.npmjs.org/chai/-/chai-5.3.3.tgz",
+ "integrity": "sha512-4zNhdJD/iOjSH0A05ea+Ke6MU5mmpQcbQsSOkgdaUMJ9zTlDTD/GYlwohmIE2u0gaxHYiVHEn1Fw9mZ/ktJWgw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "assertion-error": "^2.0.1",
+ "check-error": "^2.1.1",
+ "deep-eql": "^5.0.1",
+ "loupe": "^3.1.0",
+ "pathval": "^2.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
@@ -2891,6 +3499,16 @@
"url": "https://github.com/chalk/chalk?sponsor=1"
}
},
+ "node_modules/check-error": {
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.3.tgz",
+ "integrity": "sha512-PAJdDJusoxnwm1VwW07VWwUN1sl7smmC3OKggvndJFadxxDRyFJBX/ggnu/KE4kQAB7a3Dp8f/YXC1FlUprWmA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 16"
+ }
+ },
"node_modules/chokidar": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz",
@@ -3187,6 +3805,19 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/combined-stream": {
+ "version": "1.0.8",
+ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
+ "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "delayed-stream": "~1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.8"
+ }
+ },
"node_modules/commander": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
@@ -3333,6 +3964,13 @@
"url": "https://github.com/sponsors/fb55"
}
},
+ "node_modules/css.escape": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz",
+ "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/cssesc": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
@@ -3353,6 +3991,27 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/cssstyle": {
+ "version": "4.6.0",
+ "resolved": "https://registry.npmjs.org/cssstyle/-/cssstyle-4.6.0.tgz",
+ "integrity": "sha512-2z+rWdzbbSZv6/rhtvzvqeZQHrBaqgogqt85sqFNbabZOuFbCVFb8kPeEtZjiKkbrm395irpNKiYeFeLiQnFPg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@asamuzakjp/css-color": "^3.2.0",
+ "rrweb-cssom": "^0.8.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/cssstyle/node_modules/rrweb-cssom": {
+ "version": "0.8.0",
+ "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.8.0.tgz",
+ "integrity": "sha512-guoltQEx+9aMf2gDZ0s62EcV8lsXR+0w8915TC3ITdn2YueuNjdAYh/levpU9nFaoChh9RUS5ZdQMrKfVEN9tw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/csstype": {
"version": "3.2.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz",
@@ -3360,6 +4019,20 @@
"devOptional": true,
"license": "MIT"
},
+ "node_modules/data-urls": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz",
+ "integrity": "sha512-ZYP5VBHshaDAiVZxjbRVcFJpc+4xGgT0bK3vzy1HLN8jTO975HEbuYzZJcHoQEY5K1a0z8YayJkyVETa08eNTg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "whatwg-mimetype": "^4.0.0",
+ "whatwg-url": "^14.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/debounce": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/debounce/-/debounce-1.2.1.tgz",
@@ -3385,6 +4058,23 @@
}
}
},
+ "node_modules/decimal.js": {
+ "version": "10.6.0",
+ "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz",
+ "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/deep-eql": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz",
+ "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=6"
+ }
+ },
"node_modules/deep-extend": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz",
@@ -3452,6 +4142,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/delayed-stream": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
+ "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.4.0"
+ }
+ },
"node_modules/dequal": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/dequal/-/dequal-2.0.3.tgz",
@@ -3483,6 +4183,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/dom-accessibility-api": {
+ "version": "0.5.16",
+ "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz",
+ "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/dom-serializer": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
@@ -3600,6 +4307,28 @@
"url": "https://dotenvx.com"
}
},
+ "node_modules/dunder-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
+ "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "gopd": "^1.2.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/eastasianwidth": {
+ "version": "0.2.0",
+ "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz",
+ "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/electron-to-chromium": {
"version": "1.5.368",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.368.tgz",
@@ -3650,6 +4379,16 @@
"is-arrayish": "^0.2.1"
}
},
+ "node_modules/es-define-property": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
+ "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/es-errors": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
@@ -3667,6 +4406,35 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/es-object-atoms": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
+ "integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
+ "node_modules/es-set-tostringtag": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz",
+ "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "es-errors": "^1.3.0",
+ "get-intrinsic": "^1.2.6",
+ "has-tostringtag": "^1.0.2",
+ "hasown": "^2.0.2"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/es6-error": {
"version": "4.1.1",
"resolved": "https://registry.npmjs.org/es6-error/-/es6-error-4.1.1.tgz",
@@ -3960,6 +4728,16 @@
"url": "https://github.com/sindresorhus/execa?sponsor=1"
}
},
+ "node_modules/expect-type": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.3.0.tgz",
+ "integrity": "sha512-knvyeauYhqjOYvQ66MznSMs83wmHrCycNEN6Ao+2AeYEfxUIkuiVxdEa1qlGEPK+We3n0THiDciYSsCcgW/DoA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=12.0.0"
+ }
+ },
"node_modules/exsolve": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.8.tgz",
@@ -3967,6 +4745,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/fake-indexeddb": {
+ "version": "6.2.5",
+ "resolved": "https://registry.npmjs.org/fake-indexeddb/-/fake-indexeddb-6.2.5.tgz",
+ "integrity": "sha512-CGnyrvbhPlWYMngksqrSSUT1BAVP49dZocrHuK0SvtR0D5TMs5wP0o3j7jexDJW01KSadjBp1M/71o/KR3nD1w==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/fast-deep-equal": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz",
@@ -4132,8 +4920,42 @@
"dev": true,
"license": "ISC"
},
- "node_modules/form-data-encoder": {
- "version": "4.1.0",
+ "node_modules/foreground-child": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz",
+ "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "cross-spawn": "^7.0.6",
+ "signal-exit": "^4.0.1"
+ },
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/form-data": {
+ "version": "4.0.5",
+ "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz",
+ "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "asynckit": "^0.4.0",
+ "combined-stream": "^1.0.8",
+ "es-set-tostringtag": "^2.1.0",
+ "hasown": "^2.0.2",
+ "mime-types": "^2.1.12"
+ },
+ "engines": {
+ "node": ">= 6"
+ }
+ },
+ "node_modules/form-data-encoder": {
+ "version": "4.1.0",
"resolved": "https://registry.npmjs.org/form-data-encoder/-/form-data-encoder-4.1.0.tgz",
"integrity": "sha512-G6NsmEW15s0Uw9XnCg+33H3ViYRyiM0hMrMhhqQOR8NFc5GhYrI+6I3u7OTw7b91J2g8rtvMBZJDbcGb2YUniw==",
"dev": true,
@@ -4324,6 +5146,31 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/get-intrinsic": {
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
+ "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "call-bind-apply-helpers": "^1.0.2",
+ "es-define-property": "^1.0.1",
+ "es-errors": "^1.3.0",
+ "es-object-atoms": "^1.1.1",
+ "function-bind": "^1.1.2",
+ "get-proto": "^1.0.1",
+ "gopd": "^1.2.0",
+ "has-symbols": "^1.1.0",
+ "hasown": "^2.0.2",
+ "math-intrinsics": "^1.1.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/get-port-please": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.2.0.tgz",
@@ -4331,6 +5178,20 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/get-proto": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
+ "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "dunder-proto": "^1.0.1",
+ "es-object-atoms": "^1.0.0"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/get-stream": {
"version": "8.0.1",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-8.0.1.tgz",
@@ -4403,6 +5264,28 @@
"pathe": "^2.0.1"
}
},
+ "node_modules/glob": {
+ "version": "10.5.0",
+ "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz",
+ "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==",
+ "deprecated": "Old versions of glob are not supported, and contain widely publicized security vulnerabilities, which have been fixed in the current version. Please update. Support for old versions may be purchased (at exorbitant rates) by contacting i@izs.me",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "foreground-child": "^3.1.0",
+ "jackspeak": "^3.1.2",
+ "minimatch": "^9.0.4",
+ "minipass": "^7.1.2",
+ "package-json-from-dist": "^1.0.0",
+ "path-scurry": "^1.11.1"
+ },
+ "bin": {
+ "glob": "dist/esm/bin.mjs"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
"node_modules/glob-parent": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz",
@@ -4423,6 +5306,42 @@
"dev": true,
"license": "BSD-2-Clause"
},
+ "node_modules/glob/node_modules/brace-expansion": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.1.tgz",
+ "integrity": "sha512-WR1cURNjuvBLMZBMbqM0UoE+WAfdUcEV1ccD8PVBVOI+Z3ND4+SZbN8RsfT2bMuG1qwz5RFvPukSZm5fF2D5eA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^1.0.0"
+ }
+ },
+ "node_modules/glob/node_modules/minimatch": {
+ "version": "9.0.9",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz",
+ "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "brace-expansion": "^2.0.2"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/glob/node_modules/minipass": {
+ "version": "7.1.3",
+ "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz",
+ "integrity": "sha512-tEBHqDnIoM/1rXME1zgka9g6Q2lcoCkxHLuc7ODJ5BxbP5d4c2Z5cGgtXAku59200Cx7diuHTOYfSBD8n6mm8A==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "engines": {
+ "node": ">=16 || 14 >=14.17"
+ }
+ },
"node_modules/global-directory": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/global-directory/-/global-directory-4.0.1.tgz",
@@ -4462,6 +5381,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/gopd": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
+ "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/graceful-fs": {
"version": "4.2.11",
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz",
@@ -4493,6 +5425,35 @@
"node": ">=8"
}
},
+ "node_modules/has-symbols": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
+ "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
+ "node_modules/has-tostringtag": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz",
+ "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-symbols": "^1.0.3"
+ },
+ "engines": {
+ "node": ">= 0.4"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/ljharb"
+ }
+ },
"node_modules/hasown": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
@@ -4513,6 +5474,19 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/html-encoding-sniffer": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/html-encoding-sniffer/-/html-encoding-sniffer-4.0.0.tgz",
+ "integrity": "sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "whatwg-encoding": "^3.1.1"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/html-escaper": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-3.0.3.tgz",
@@ -4553,6 +5527,34 @@
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
+ "node_modules/http-proxy-agent": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-7.0.2.tgz",
+ "integrity": "sha512-T1gkAiYYDWYx3V5Bmyu7HcfcvL7mUrTWiM6yOfa3PIphViJ/gFPbvidQ+veqSOHci/PxBcDabeUNCzpOODJZig==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.0",
+ "debug": "^4.3.4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
+ "node_modules/https-proxy-agent": {
+ "version": "7.0.6",
+ "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz",
+ "integrity": "sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "agent-base": "^7.1.2",
+ "debug": "4"
+ },
+ "engines": {
+ "node": ">= 14"
+ }
+ },
"node_modules/human-signals": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/human-signals/-/human-signals-5.0.0.tgz",
@@ -4563,6 +5565,19 @@
"node": ">=16.17.0"
}
},
+ "node_modules/iconv-lite": {
+ "version": "0.6.3",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
+ "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "safer-buffer": ">= 2.1.2 < 3.0.0"
+ },
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
"node_modules/ignore": {
"version": "5.3.2",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.2.tgz",
@@ -4618,6 +5633,16 @@
"node": ">=0.8.19"
}
},
+ "node_modules/indent-string": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/indent-string/-/indent-string-4.0.0.tgz",
+ "integrity": "sha512-EdDDZu4A2OyIK7Lr/2zG+w5jmbuk1DVBnEwREQvBzspBJkCEbRa8GxU1lghYcaGJCnRWibjDXlq779X1/y5xwg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
@@ -4942,6 +5967,83 @@
"node": ">=0.10.0"
}
},
+ "node_modules/istanbul-lib-coverage": {
+ "version": "3.2.2",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz",
+ "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-lib-report": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz",
+ "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "istanbul-lib-coverage": "^3.0.0",
+ "make-dir": "^4.0.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/istanbul-lib-source-maps": {
+ "version": "5.0.6",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-5.0.6.tgz",
+ "integrity": "sha512-yg2d+Em4KizZC5niWhQaIomgf5WlL4vOOjZ5xGCmF8SnPE/mDWWXgvRExdcpCgh9lLRRa1/fSYp2ymmbJ1pI+A==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "@jridgewell/trace-mapping": "^0.3.23",
+ "debug": "^4.1.1",
+ "istanbul-lib-coverage": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
+ "node_modules/istanbul-reports": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.2.0.tgz",
+ "integrity": "sha512-HGYWWS/ehqTV3xN10i23tkPkpH46MLCIMFNCaaKNavAXTF1RkqxawEPtnjnGZ6XKSInBKkiOA5BKS+aZiY3AvA==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "html-escaper": "^2.0.0",
+ "istanbul-lib-report": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/istanbul-reports/node_modules/html-escaper": {
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz",
+ "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/jackspeak": {
+ "version": "3.4.3",
+ "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz",
+ "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "@isaacs/cliui": "^8.0.2"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ },
+ "optionalDependencies": {
+ "@pkgjs/parseargs": "^0.11.0"
+ }
+ },
"node_modules/jiti": {
"version": "1.21.7",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz",
@@ -4981,6 +6083,47 @@
"js-yaml": "bin/js-yaml.js"
}
},
+ "node_modules/jsdom": {
+ "version": "25.0.1",
+ "resolved": "https://registry.npmjs.org/jsdom/-/jsdom-25.0.1.tgz",
+ "integrity": "sha512-8i7LzZj7BF8uplX+ZyOlIz86V6TAsSs+np6m1kpW9u0JWi4z/1t+FzcK1aek+ybTnAC4KhBL4uXCNT0wcUIeCw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cssstyle": "^4.1.0",
+ "data-urls": "^5.0.0",
+ "decimal.js": "^10.4.3",
+ "form-data": "^4.0.0",
+ "html-encoding-sniffer": "^4.0.0",
+ "http-proxy-agent": "^7.0.2",
+ "https-proxy-agent": "^7.0.5",
+ "is-potential-custom-element-name": "^1.0.1",
+ "nwsapi": "^2.2.12",
+ "parse5": "^7.1.2",
+ "rrweb-cssom": "^0.7.1",
+ "saxes": "^6.0.0",
+ "symbol-tree": "^3.2.4",
+ "tough-cookie": "^5.0.0",
+ "w3c-xmlserializer": "^5.0.0",
+ "webidl-conversions": "^7.0.0",
+ "whatwg-encoding": "^3.1.1",
+ "whatwg-mimetype": "^4.0.0",
+ "whatwg-url": "^14.0.0",
+ "ws": "^8.18.0",
+ "xml-name-validator": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "canvas": "^2.11.2"
+ },
+ "peerDependenciesMeta": {
+ "canvas": {
+ "optional": true
+ }
+ }
+ },
"node_modules/jsesc": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz",
@@ -5373,6 +6516,13 @@
"loose-envify": "cli.js"
}
},
+ "node_modules/loupe": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.1.tgz",
+ "integrity": "sha512-CdzqowRJCeLU72bHvWqwRBBlLcMEtIvGrlvef74kMnV2AolS9Y8xUv1I0U/MNAWMhBlKIoyuEgoJ0t/bbwHbLQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/lru-cache": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz",
@@ -5383,6 +6533,16 @@
"yallist": "^3.0.2"
}
},
+ "node_modules/lz-string": {
+ "version": "1.5.0",
+ "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz",
+ "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==",
+ "dev": true,
+ "license": "MIT",
+ "bin": {
+ "lz-string": "bin/bin.js"
+ }
+ },
"node_modules/magic-string": {
"version": "0.30.21",
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.21.tgz",
@@ -5405,6 +6565,35 @@
"source-map-js": "^1.2.0"
}
},
+ "node_modules/make-dir": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz",
+ "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "semver": "^7.5.3"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/make-dir/node_modules/semver": {
+ "version": "7.8.2",
+ "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz",
+ "integrity": "sha512-c8jsqUZm3omBOI66G90z1Dyw5z622G8oLG+omfsHBJf3CWQTlOcwOjvOG6wtiNfW6anKm/eA39LMwMtMez2TiQ==",
+ "dev": true,
+ "license": "ISC",
+ "bin": {
+ "semver": "bin/semver.js"
+ },
+ "engines": {
+ "node": ">=10"
+ }
+ },
"node_modules/make-error": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz",
@@ -5432,6 +6621,16 @@
"dev": true,
"license": "Apache-2.0"
},
+ "node_modules/math-intrinsics": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
+ "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 0.4"
+ }
+ },
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@@ -5463,14 +6662,37 @@
"node": ">=8.6"
}
},
- "node_modules/mimic-fn": {
- "version": "4.0.0",
- "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
- "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
+ "node_modules/mime-db": {
+ "version": "1.52.0",
+ "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
+ "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
"dev": true,
"license": "MIT",
"engines": {
- "node": ">=12"
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mime-types": {
+ "version": "2.1.35",
+ "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
+ "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "mime-db": "1.52.0"
+ },
+ "engines": {
+ "node": ">= 0.6"
+ }
+ },
+ "node_modules/mimic-fn": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-4.0.0.tgz",
+ "integrity": "sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -5489,6 +6711,16 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/min-indent": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz",
+ "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/minimatch": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.5.tgz",
@@ -5814,6 +7046,13 @@
"url": "https://github.com/fb55/nth-check?sponsor=1"
}
},
+ "node_modules/nwsapi": {
+ "version": "2.2.23",
+ "resolved": "https://registry.npmjs.org/nwsapi/-/nwsapi-2.2.23.tgz",
+ "integrity": "sha512-7wfH4sLbt4M0gCDzGE6vzQBo0bfTKjU7Sfpqy/7gs1qBfYz2vEJH6vXcBKpO3+6Yu1telwd0t9HpyOoLEQQbIQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/nypm": {
"version": "0.3.12",
"resolved": "https://registry.npmjs.org/nypm/-/nypm-0.3.12.tgz",
@@ -6067,6 +7306,13 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/package-json-from-dist": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz",
+ "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==",
+ "dev": true,
+ "license": "BlueOak-1.0.0"
+ },
"node_modules/package-json/node_modules/semver": {
"version": "7.8.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.8.2.tgz",
@@ -6130,6 +7376,32 @@
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
}
},
+ "node_modules/parse5": {
+ "version": "7.3.0",
+ "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
+ "integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "entities": "^6.0.0"
+ },
+ "funding": {
+ "url": "https://github.com/inikulin/parse5?sponsor=1"
+ }
+ },
+ "node_modules/parse5/node_modules/entities": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
+ "integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=0.12"
+ },
+ "funding": {
+ "url": "https://github.com/fb55/entities?sponsor=1"
+ }
+ },
"node_modules/path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
@@ -6157,6 +7429,30 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/path-scurry": {
+ "version": "1.11.1",
+ "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz",
+ "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "lru-cache": "^10.2.0",
+ "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0"
+ },
+ "engines": {
+ "node": ">=16 || 14 >=14.18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/path-scurry/node_modules/lru-cache": {
+ "version": "10.4.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/pathe": {
"version": "2.0.3",
"resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz",
@@ -6164,6 +7460,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/pathval": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz",
+ "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">= 14.16"
+ }
+ },
"node_modules/perfect-debounce": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz",
@@ -6263,6 +7569,53 @@
"pathe": "^2.0.3"
}
},
+ "node_modules/playwright": {
+ "version": "1.60.0",
+ "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.60.0.tgz",
+ "integrity": "sha512-hheHdokM8cdqCb0lcE3s+zT4t4W+vvjpGxsZlDnikarzx8tSzMebh3UiFtgqwFwnTnjYQcsyMF8ei2mCO/tpeA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "dependencies": {
+ "playwright-core": "1.60.0"
+ },
+ "bin": {
+ "playwright": "cli.js"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "fsevents": "2.3.2"
+ }
+ },
+ "node_modules/playwright-core": {
+ "version": "1.60.0",
+ "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.60.0.tgz",
+ "integrity": "sha512-9bW6zvX/m0lEbgTKJ6YppOKx8H3VOPBMOCFh2irXFOT4BbHgrx5hPjwJYLT40Lu+4qtD36qKc/Hn56StUW57IA==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "bin": {
+ "playwright-core": "cli.js"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/playwright/node_modules/fsevents": {
+ "version": "2.3.2",
+ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz",
+ "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==",
+ "dev": true,
+ "hasInstallScript": true,
+ "license": "MIT",
+ "optional": true,
+ "os": [
+ "darwin"
+ ],
+ "engines": {
+ "node": "^8.16.0 || ^10.6.0 || >=11.0.0"
+ }
+ },
"node_modules/postcss": {
"version": "8.5.15",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.15.tgz",
@@ -6452,6 +7805,44 @@
"url": "https://github.com/prettier/prettier?sponsor=1"
}
},
+ "node_modules/pretty-format": {
+ "version": "27.5.1",
+ "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz",
+ "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1",
+ "ansi-styles": "^5.0.0",
+ "react-is": "^17.0.1"
+ },
+ "engines": {
+ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
+ }
+ },
+ "node_modules/pretty-format/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/pretty-format/node_modules/ansi-styles": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz",
+ "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@@ -6683,6 +8074,13 @@
"react": "^18.3.1"
}
},
+ "node_modules/react-is": {
+ "version": "17.0.2",
+ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
+ "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/react-refresh": {
"version": "0.17.0",
"resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz",
@@ -6742,6 +8140,20 @@
"node": ">= 12.13.0"
}
},
+ "node_modules/redent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz",
+ "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "indent-string": "^4.0.0",
+ "strip-indent": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/registry-auth-token": {
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/registry-auth-token/-/registry-auth-token-5.1.1.tgz",
@@ -6909,6 +8321,13 @@
"fsevents": "~2.3.2"
}
},
+ "node_modules/rrweb-cssom": {
+ "version": "0.7.1",
+ "resolved": "https://registry.npmjs.org/rrweb-cssom/-/rrweb-cssom-0.7.1.tgz",
+ "integrity": "sha512-TrEMa7JGdVm0UThDJSx7ddw5nVm3UJS9o9CCIZ72B1vSyEZoziDqBYP3XIoi/12lKrJR8rE3jeFHMok2F/Mnsg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/run-applescript": {
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/run-applescript/-/run-applescript-7.1.0.tgz",
@@ -6963,6 +8382,13 @@
"node": ">=10"
}
},
+ "node_modules/safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/sax": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/sax/-/sax-1.6.0.tgz",
@@ -6973,6 +8399,19 @@
"node": ">=11.0.0"
}
},
+ "node_modules/saxes": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/saxes/-/saxes-6.0.0.tgz",
+ "integrity": "sha512-xAg7SOnEhrm5zI3puOOKyy1OMcMlIJZYNJY7xLBwSze0UjhPLnWfj2GF2EpT0jmzaJKIWKHLsaSSajf35bcYnA==",
+ "dev": true,
+ "license": "ISC",
+ "dependencies": {
+ "xmlchars": "^2.2.0"
+ },
+ "engines": {
+ "node": ">=v12.22.7"
+ }
+ },
"node_modules/scheduler": {
"version": "0.23.2",
"resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz",
@@ -7062,6 +8501,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/siginfo": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz",
+ "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==",
+ "dev": true,
+ "license": "ISC"
+ },
"node_modules/signal-exit": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
@@ -7198,6 +8644,20 @@
"node": ">= 10.x"
}
},
+ "node_modules/stackback": {
+ "version": "0.0.2",
+ "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz",
+ "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/std-env": {
+ "version": "3.10.0",
+ "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.10.0.tgz",
+ "integrity": "sha512-5GS12FdOZNliM5mAOxFRg7Ir0pWz8MdpYm6AY6VPkGpbA7ZzmbzNcBJQ0GPvvyWgcY7QAhCgf9Uy89I03faLkg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/stdin-discarder": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz",
@@ -7239,6 +8699,62 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/string-width-cjs": {
+ "name": "string-width",
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/string-width-cjs/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/string-width-cjs/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/string-width-cjs/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/strip-ansi": {
"version": "7.2.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
@@ -7255,6 +8771,30 @@
"url": "https://github.com/chalk/strip-ansi?sponsor=1"
}
},
+ "node_modules/strip-ansi-cjs": {
+ "name": "strip-ansi",
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/strip-ansi-cjs/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/strip-bom": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-5.0.0.tgz",
@@ -7281,6 +8821,19 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/strip-indent": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz",
+ "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "min-indent": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/strip-json-comments": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz",
@@ -7380,6 +8933,13 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/symbol-tree": {
+ "version": "3.2.4",
+ "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz",
+ "integrity": "sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/tailwindcss": {
"version": "3.4.19",
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz",
@@ -7444,14 +9004,68 @@
"dev": true,
"license": "ISC"
},
- "node_modules/thenify": {
- "version": "3.3.1",
- "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
- "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
+ "node_modules/test-exclude": {
+ "version": "7.0.2",
+ "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-7.0.2.tgz",
+ "integrity": "sha512-u9E6A+ZDYdp7a4WnarkXPZOx8Ilz46+kby6p1yZ8zsGTz9gYa6FIS7lj2oezzNKmtdyyJNNmmXDppga5GB7kSw==",
"dev": true,
- "license": "MIT",
+ "license": "ISC",
"dependencies": {
- "any-promise": "^1.0.0"
+ "@istanbuljs/schema": "^0.1.2",
+ "glob": "^10.4.1",
+ "minimatch": "^10.2.2"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/test-exclude/node_modules/balanced-match": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-4.0.4.tgz",
+ "integrity": "sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/test-exclude/node_modules/brace-expansion": {
+ "version": "5.0.6",
+ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-5.0.6.tgz",
+ "integrity": "sha512-kLpxurY4Z4r9sgMsyG0Z9uzsBlgiU/EFKhj/h91/8yHu0edo7XuixOIH3VcJ8kkxs6/jPzoI6U9Vj3WqbMQ94g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "balanced-match": "^4.0.2"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ }
+ },
+ "node_modules/test-exclude/node_modules/minimatch": {
+ "version": "10.2.5",
+ "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.2.5.tgz",
+ "integrity": "sha512-MULkVLfKGYDFYejP07QOurDLLQpcjk7Fw+7jXS2R2czRQzR56yHRveU5NDJEOviH+hETZKSkIk5c+T23GjFUMg==",
+ "dev": true,
+ "license": "BlueOak-1.0.0",
+ "dependencies": {
+ "brace-expansion": "^5.0.5"
+ },
+ "engines": {
+ "node": "18 || 20 || >=22"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/thenify": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz",
+ "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "any-promise": "^1.0.0"
}
},
"node_modules/thenify-all": {
@@ -7484,6 +9098,13 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/tinybench": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz",
+ "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/tinyexec": {
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz",
@@ -7539,6 +9160,56 @@
"url": "https://github.com/sponsors/jonschlinkert"
}
},
+ "node_modules/tinypool": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz",
+ "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^18.0.0 || >=20.0.0"
+ }
+ },
+ "node_modules/tinyrainbow": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-1.2.0.tgz",
+ "integrity": "sha512-weEDEq7Z5eTHPDh4xjX789+fHfF+P8boiFB+0vbWzpbnbsEr/GRaohi/uMKxg8RZMXnl1ItAi/IUHWMsjDV7kQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/tinyspy": {
+ "version": "3.0.2",
+ "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-3.0.2.tgz",
+ "integrity": "sha512-n1cw8k1k0x4pgA2+9XrOkFydTerNcJ1zWCO5Nn9scWHTD+5tp8dghT2x1uduQePZTZgd3Tupf+x9BxJjeJi77Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=14.0.0"
+ }
+ },
+ "node_modules/tldts": {
+ "version": "6.1.86",
+ "resolved": "https://registry.npmjs.org/tldts/-/tldts-6.1.86.tgz",
+ "integrity": "sha512-WMi/OQ2axVTf/ykqCQgXiIct+mSQDFdH2fkwhPwgEwvJ1kSzZRiinb0zF2Xb8u4+OqPChmyI6MEu4EezNJz+FQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tldts-core": "^6.1.86"
+ },
+ "bin": {
+ "tldts": "bin/cli.js"
+ }
+ },
+ "node_modules/tldts-core": {
+ "version": "6.1.86",
+ "resolved": "https://registry.npmjs.org/tldts-core/-/tldts-core-6.1.86.tgz",
+ "integrity": "sha512-Je6p7pkk+KMzMv2XXKmAE3McmolOQFdxkKw0R8EYNr7sELW46JqnNeTX8ybPiQgvg1ymCoF8LXs5fzFaZvJPTA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/tmp": {
"version": "0.2.5",
"resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.5.tgz",
@@ -7562,6 +9233,32 @@
"node": ">=8.0"
}
},
+ "node_modules/tough-cookie": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-5.1.2.tgz",
+ "integrity": "sha512-FVDYdxtnj0G6Qm/DhNPSb8Ju59ULcup3tuJxkFb5K8Bv2pUXILbf0xZWU8PX8Ov19OXljbUyveOFwRMwkXzO+A==",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "dependencies": {
+ "tldts": "^6.1.32"
+ },
+ "engines": {
+ "node": ">=16"
+ }
+ },
+ "node_modules/tr46": {
+ "version": "5.1.1",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-5.1.1.tgz",
+ "integrity": "sha512-hdF5ZgjTqgAntKkklYw0R03MG2x/bSzTtkxmIRw/sTNV8YXsCJ1tfLAX23lhxhHJlEf3CRCOCGGWw3vI3GaSPw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "punycode": "^2.3.1"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/ts-api-utils": {
"version": "2.5.0",
"resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.5.0.tgz",
@@ -7893,24 +9590,21 @@
}
},
"node_modules/vite": {
- "version": "7.3.5",
- "resolved": "https://registry.npmjs.org/vite/-/vite-7.3.5.tgz",
- "integrity": "sha512-KuOaNhcnGFN2zIPGA7wRmzF+lJA1sea7rHq17aiJ++9lzY1WWG6Jpwqwe1KNbRVPIqHmr8GLYx7jbrQcN/7/ww==",
+ "version": "5.4.21",
+ "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.21.tgz",
+ "integrity": "sha512-o5a9xKjbtuhY6Bi5S3+HvbRERmouabWbyUcpXXUA1u+GNUKoROi9byOJ8M0nHbHYHkYICiMlqxkg1KkYmm25Sw==",
"dev": true,
"license": "MIT",
"dependencies": {
- "esbuild": "^0.27.0",
- "fdir": "^6.5.0",
- "picomatch": "^4.0.3",
- "postcss": "^8.5.6",
- "rollup": "^4.43.0",
- "tinyglobby": "^0.2.15"
+ "esbuild": "^0.21.3",
+ "postcss": "^8.4.43",
+ "rollup": "^4.20.0"
},
"bin": {
"vite": "bin/vite.js"
},
"engines": {
- "node": "^20.19.0 || >=22.12.0"
+ "node": "^18.0.0 || >=20.0.0"
},
"funding": {
"url": "https://github.com/vitejs/vite?sponsor=1"
@@ -7919,25 +9613,19 @@
"fsevents": "~2.3.3"
},
"peerDependencies": {
- "@types/node": "^20.19.0 || >=22.12.0",
- "jiti": ">=1.21.0",
- "less": "^4.0.0",
+ "@types/node": "^18.0.0 || >=20.0.0",
+ "less": "*",
"lightningcss": "^1.21.0",
- "sass": "^1.70.0",
- "sass-embedded": "^1.70.0",
- "stylus": ">=0.54.8",
- "sugarss": "^5.0.0",
- "terser": "^5.16.0",
- "tsx": "^4.8.1",
- "yaml": "^2.4.2"
+ "sass": "*",
+ "sass-embedded": "*",
+ "stylus": "*",
+ "sugarss": "*",
+ "terser": "^5.4.0"
},
"peerDependenciesMeta": {
"@types/node": {
"optional": true
},
- "jiti": {
- "optional": true
- },
"less": {
"optional": true
},
@@ -7958,12 +9646,6 @@
},
"terser": {
"optional": true
- },
- "tsx": {
- "optional": true
- },
- "yaml": {
- "optional": true
}
}
},
@@ -7990,35 +9672,113 @@
"url": "https://opencollective.com/vitest"
}
},
- "node_modules/vite/node_modules/fdir": {
- "version": "6.5.0",
- "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
- "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
+ "node_modules/vitest": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/vitest/-/vitest-2.1.9.tgz",
+ "integrity": "sha512-MSmPM9REYqDGBI8439mA4mWhV5sKmDlBKWIYbA3lRb2PTHACE0mgKwA8yQ2xq9vxDTuk4iPrECBAEW2aoFXY0Q==",
"dev": true,
"license": "MIT",
+ "dependencies": {
+ "@vitest/expect": "2.1.9",
+ "@vitest/mocker": "2.1.9",
+ "@vitest/pretty-format": "^2.1.9",
+ "@vitest/runner": "2.1.9",
+ "@vitest/snapshot": "2.1.9",
+ "@vitest/spy": "2.1.9",
+ "@vitest/utils": "2.1.9",
+ "chai": "^5.1.2",
+ "debug": "^4.3.7",
+ "expect-type": "^1.1.0",
+ "magic-string": "^0.30.12",
+ "pathe": "^1.1.2",
+ "std-env": "^3.8.0",
+ "tinybench": "^2.9.0",
+ "tinyexec": "^0.3.1",
+ "tinypool": "^1.0.1",
+ "tinyrainbow": "^1.2.0",
+ "vite": "^5.0.0",
+ "vite-node": "2.1.9",
+ "why-is-node-running": "^2.3.0"
+ },
+ "bin": {
+ "vitest": "vitest.mjs"
+ },
"engines": {
- "node": ">=12.0.0"
+ "node": "^18.0.0 || >=20.0.0"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
},
"peerDependencies": {
- "picomatch": "^3 || ^4"
+ "@edge-runtime/vm": "*",
+ "@types/node": "^18.0.0 || >=20.0.0",
+ "@vitest/browser": "2.1.9",
+ "@vitest/ui": "2.1.9",
+ "happy-dom": "*",
+ "jsdom": "*"
},
"peerDependenciesMeta": {
- "picomatch": {
+ "@edge-runtime/vm": {
+ "optional": true
+ },
+ "@types/node": {
+ "optional": true
+ },
+ "@vitest/browser": {
+ "optional": true
+ },
+ "@vitest/ui": {
+ "optional": true
+ },
+ "happy-dom": {
+ "optional": true
+ },
+ "jsdom": {
"optional": true
}
}
},
- "node_modules/vite/node_modules/picomatch": {
- "version": "4.0.4",
- "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
- "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
+ "node_modules/vitest/node_modules/pathe": {
+ "version": "1.1.2",
+ "resolved": "https://registry.npmjs.org/pathe/-/pathe-1.1.2.tgz",
+ "integrity": "sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/vitest/node_modules/vite-node": {
+ "version": "2.1.9",
+ "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-2.1.9.tgz",
+ "integrity": "sha512-AM9aQ/IPrW/6ENLQg3AGY4K1N2TGZdR5e4gu/MmmR2xR3Ll1+dib+nook92g4TV3PXVyeyxdWwtaCAiUL0hMxA==",
"dev": true,
"license": "MIT",
+ "dependencies": {
+ "cac": "^6.7.14",
+ "debug": "^4.3.7",
+ "es-module-lexer": "^1.5.4",
+ "pathe": "^1.1.2",
+ "vite": "^5.0.0"
+ },
+ "bin": {
+ "vite-node": "vite-node.mjs"
+ },
"engines": {
- "node": ">=12"
+ "node": "^18.0.0 || >=20.0.0"
},
"funding": {
- "url": "https://github.com/sponsors/jonschlinkert"
+ "url": "https://opencollective.com/vitest"
+ }
+ },
+ "node_modules/w3c-xmlserializer": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
+ "integrity": "sha512-o8qghlI8NZHU1lLPrpi2+Uq7abh4GGPpYANlalzWxyWteJOCsr/P+oPBA49TOLu5FTZO4d3F9MnWJfiMo4BkmA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "xml-name-validator": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
}
},
"node_modules/watchpack": {
@@ -8088,6 +9848,16 @@
"dev": true,
"license": "MPL-2.0"
},
+ "node_modules/webidl-conversions": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
+ "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==",
+ "dev": true,
+ "license": "BSD-2-Clause",
+ "engines": {
+ "node": ">=12"
+ }
+ },
"node_modules/webpack-virtual-modules": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/webpack-virtual-modules/-/webpack-virtual-modules-0.6.2.tgz",
@@ -8095,6 +9865,44 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/whatwg-encoding": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/whatwg-encoding/-/whatwg-encoding-3.1.1.tgz",
+ "integrity": "sha512-6qN4hJdMwfYBtE3YBTTHhoeuUrDBPZmbQaxWAqSALV/MeEnR5z1xd8UKud2RAkFoPkmB+hli1TZSnyi84xz1vQ==",
+ "deprecated": "Use @exodus/bytes instead for a more spec-conformant and faster implementation",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "iconv-lite": "0.6.3"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/whatwg-mimetype": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-mimetype/-/whatwg-mimetype-4.0.0.tgz",
+ "integrity": "sha512-QaKxh0eNIi2mE9p2vEdzfagOKHCcj1pJ56EEHGQOVxp8r9/iszLUUV7v89x9O1p/T+NlTM5W7jW6+cz4Fq1YVg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/whatwg-url": {
+ "version": "14.2.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-14.2.0.tgz",
+ "integrity": "sha512-De72GdQZzNTUBBChsXueQUnPKDkg/5A5zp7pFDuQAj5UFoENpiACU0wlCvzpAGnTkj++ihpKwKyYewn/XNUbKw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "tr46": "^5.1.0",
+ "webidl-conversions": "^7.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/when": {
"version": "3.7.7",
"resolved": "https://registry.npmjs.org/when/-/when-3.7.7.tgz",
@@ -8125,6 +9933,23 @@
"node": ">= 8"
}
},
+ "node_modules/why-is-node-running": {
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz",
+ "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "siginfo": "^2.0.0",
+ "stackback": "0.0.2"
+ },
+ "bin": {
+ "why-is-node-running": "cli.js"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/widest-line": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/widest-line/-/widest-line-5.0.0.tgz",
@@ -8176,6 +10001,80 @@
"url": "https://github.com/chalk/wrap-ansi?sponsor=1"
}
},
+ "node_modules/wrap-ansi-cjs": {
+ "name": "wrap-ansi",
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/string-width": {
+ "version": "4.2.3",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
+ "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/wrap-ansi-cjs/node_modules/strip-ansi": {
+ "version": "6.0.1",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
+ "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/wrap-ansi/node_modules/ansi-styles": {
"version": "6.2.3",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
@@ -8189,6 +10088,28 @@
"url": "https://github.com/chalk/ansi-styles?sponsor=1"
}
},
+ "node_modules/ws": {
+ "version": "8.21.0",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.21.0.tgz",
+ "integrity": "sha512-Vsp28b7DRcimFQvrqu2Wek3z1iYxDCWqHYB8Qsnk/S4RfaCQzPGPyBNuVjJV3cd6UiKtUtp6sNM77gWvzcCH+g==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
+ }
+ },
"node_modules/wsl-utils": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/wsl-utils/-/wsl-utils-0.1.0.tgz",
@@ -8483,6 +10404,16 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/xml-name-validator": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
+ "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/xml2js": {
"version": "0.6.2",
"resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.6.2.tgz",
@@ -8507,6 +10438,13 @@
"node": ">=4.0"
}
},
+ "node_modules/xmlchars": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
+ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/y18n": {
"version": "5.0.8",
"resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz",
diff --git a/package.json b/package.json
index 0f37fe1..de41139 100644
--- a/package.json
+++ b/package.json
@@ -15,6 +15,10 @@
"lint": "eslint .",
"format": "prettier --check .",
"format:write": "prettier --write .",
+ "test": "vitest run",
+ "test:watch": "vitest",
+ "test:coverage": "vitest run --coverage",
+ "test:e2e": "playwright test",
"postinstall": "wxt prepare"
},
"dependencies": {
@@ -23,19 +27,28 @@
"zustand": "^4.5.5"
},
"devDependencies": {
+ "@playwright/test": "^1.49.0",
+ "@testing-library/dom": "^10.4.0",
+ "@testing-library/jest-dom": "^6.6.3",
+ "@testing-library/react": "^16.0.1",
+ "@testing-library/user-event": "^14.5.2",
"@types/chrome": "^0.0.270",
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
+ "@vitest/coverage-v8": "^2.1.8",
"@wxt-dev/module-react": "1.1.3",
"autoprefixer": "^10.4.20",
"eslint": "^9.15.0",
"eslint-plugin-react-hooks": "^5.0.0",
+ "fake-indexeddb": "^6.0.0",
"globals": "^15.12.0",
+ "jsdom": "^25.0.1",
"postcss": "^8.4.49",
"prettier": "^3.3.3",
"tailwindcss": "^3.4.15",
"typescript": "^5.6.3",
"typescript-eslint": "^8.15.0",
+ "vitest": "^2.1.8",
"wxt": "^0.19.13"
},
"overrides": {
diff --git a/src/background/messageHandler.ts b/src/background/messageHandler.ts
new file mode 100644
index 0000000..10880e0
--- /dev/null
+++ b/src/background/messageHandler.ts
@@ -0,0 +1,50 @@
+/**
+ * Background message-handling logic, extracted from the entrypoint so it is unit
+ * testable without the WXT `defineBackground` wrapper.
+ *
+ * - Validates the sender (same extension) and message shape before routing.
+ * - Wraps every reply in a BgEnvelope.
+ * - Sanitizes errors so secret values can't leak to the UI (PRD §14.3 / §15).
+ */
+
+import type { BgRequest, BgEnvelope } from '@/types/messages';
+import { handleRequest } from '@/background/router';
+import { logger } from '@/lib/logger';
+import { isSafeMessageError } from '@/lib/result';
+
+/**
+ * The chrome.runtime.onMessage listener. Returns true to keep the channel open
+ * for the async response, or false to ignore a message that isn't ours.
+ */
+export function backgroundMessageListener(
+ message: unknown,
+ sender: chrome.runtime.MessageSender,
+ sendResponse: (response: BgEnvelope) => void,
+): boolean {
+ if (sender.id !== chrome.runtime.id) return false;
+ if (typeof (message as { type?: unknown })?.type !== 'string') return false;
+
+ const req = message as BgRequest;
+ handleRequest(req)
+ .then((value) => sendResponse({ ok: true, value }))
+ .catch((error: unknown) => {
+ logger.error('background', `handler failed for ${req.type}`, {
+ name: error instanceof Error ? error.name : 'Error',
+ });
+ sendResponse({ ok: false, error: sanitizeError(error) });
+ });
+ return true;
+}
+
+/**
+ * Reduce an error to a string for the UI. Only known-safe error types have their
+ * message forwarded; everything else is generic so a secret value a service
+ * accidentally put in an Error message cannot reach the UI (PRD §14.3 / §15).
+ */
+export function sanitizeError(error: unknown): string {
+ if (isSafeMessageError(error)) {
+ return `${error.name}: ${(error.message.split('\n')[0] ?? '').slice(0, 200)}`;
+ }
+ if (error instanceof Error) return `${error.name}: an unexpected error occurred`;
+ return 'An unexpected error occurred';
+}
diff --git a/src/entrypoints/background.ts b/src/entrypoints/background.ts
index 74bd407..a00ec67 100644
--- a/src/entrypoints/background.ts
+++ b/src/entrypoints/background.ts
@@ -2,16 +2,14 @@
* MV3 service worker entry point (PRD §13.3).
*
* - Opens the side panel on toolbar click.
- * - Routes typed UI messages through the central router, wrapping each reply in
- * a BgEnvelope.
+ * - Routes typed UI messages through the central router (logic lives in the
+ * testable backgroundMessageListener).
* Treated as ephemeral: no durable state lives here (PRD §13.3).
*/
import { defineBackground } from 'wxt/sandbox';
-import type { BgRequest, BgEnvelope } from '@/types/messages';
-import { handleRequest } from '@/background/router';
+import { backgroundMessageListener } from '@/background/messageHandler';
import { logger } from '@/lib/logger';
-import { isSafeMessageError } from '@/lib/result';
import { trackAsync } from '@/services/telemetry/telemetry';
export default defineBackground(() => {
@@ -26,37 +24,5 @@ export default defineBackground(() => {
if (details.reason === 'install') trackAsync('install'); // opt-in checked inside
});
- // Type-safe request router. Only handles messages that look like a BgRequest
- // (a `type` string) from this extension, leaving other senders/listeners
- // untouched. Returning true keeps the channel open for the async response.
- chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
- if (sender.id !== chrome.runtime.id) return false;
- if (typeof (message as { type?: unknown })?.type !== 'string') return false;
-
- const req = message as BgRequest;
- handleRequest(req)
- .then((value) => sendResponse({ ok: true, value } satisfies BgEnvelope))
- .catch((error: unknown) => {
- // Log only structural metadata — never the free-form message, which
- // could embed cookie/storage values (PRD §14.3 / §15).
- logger.error('background', `handler failed for ${req.type}`, {
- name: error instanceof Error ? error.name : 'Error',
- });
- sendResponse({ ok: false, error: sanitizeError(error) } satisfies BgEnvelope);
- });
- return true;
- });
+ chrome.runtime.onMessage.addListener(backgroundMessageListener);
});
-
-/**
- * Reduce an error to a string for the UI. Only known-safe error types have their
- * message forwarded; everything else is generic so a secret value that a service
- * accidentally put in an Error message cannot reach the UI (PRD §14.3 / §15).
- */
-function sanitizeError(error: unknown): string {
- if (isSafeMessageError(error)) {
- return `${error.name}: ${(error.message.split('\n')[0] ?? '').slice(0, 200)}`;
- }
- if (error instanceof Error) return `${error.name}: an unexpected error occurred`;
- return 'An unexpected error occurred';
-}
diff --git a/src/lib/clipboard.ts b/src/lib/clipboard.ts
new file mode 100644
index 0000000..b5a602c
--- /dev/null
+++ b/src/lib/clipboard.ts
@@ -0,0 +1,25 @@
+/**
+ * Thin wrappers over clipboard + file download so UI components depend on an
+ * injectable seam (spy-able in tests) rather than calling browser globals that
+ * are awkward to mock (navigator.clipboard, URL.createObjectURL).
+ */
+
+/** Copy text to the clipboard. Resolves false if the API is unavailable. */
+export async function copyToClipboard(text: string): Promise {
+ try {
+ await navigator.clipboard.writeText(text);
+ return true;
+ } catch {
+ return false;
+ }
+}
+
+/** Trigger a browser download of `text` as `filename`. */
+export function downloadText(filename: string, text: string): void {
+ const url = URL.createObjectURL(new Blob([text], { type: 'text/plain' }));
+ const a = document.createElement('a');
+ a.href = url;
+ a.download = filename;
+ a.click();
+ URL.revokeObjectURL(url);
+}
diff --git a/src/services/cookies/cookieService.ts b/src/services/cookies/cookieService.ts
index 4e8ca59..d9d4a34 100644
--- a/src/services/cookies/cookieService.ts
+++ b/src/services/cookies/cookieService.ts
@@ -18,9 +18,12 @@ export async function setCookie(_cookie: CookieRecord): Promise {
throw new NotImplementedError('cookies/cookieService.setCookie');
}
-/** Delete a single cookie unless it is locked (PRD §9.1 protect/lock). */
+/**
+ * Delete a single cookie unless it is locked (PRD §9.1 protect/lock). The target
+ * includes partitionKey/storeId so CHIPS-partitioned cookies are addressable.
+ */
export async function deleteCookie(
- _cookie: Pick,
+ _cookie: Pick,
): Promise {
throw new NotImplementedError('cookies/cookieService.deleteCookie');
}
diff --git a/src/services/licensing/licenseVerifier.ts b/src/services/licensing/licenseVerifier.ts
index 4a74f9a..53f0489 100644
--- a/src/services/licensing/licenseVerifier.ts
+++ b/src/services/licensing/licenseVerifier.ts
@@ -5,6 +5,9 @@
* checkout. The extension verifies it locally with a public key baked into the
* build (WXT_LICENSE_PUBLIC_KEY). No license DB for MVP.
*
+ * Key format (see tests/CONTRACTS.md §7):
+ * base64url(JSON payload) + "." + base64url(ed25519 signature over payload bytes)
+ *
* Honest framing (PRD §13.8): the gate is removable since the core is
* source-available. Ed25519 makes keys unforgeable, not the client untamperable.
* Do not build anti-piracy machinery around this.
@@ -13,8 +16,25 @@
import type { Entitlement } from '@/types/models';
import { NotImplementedError } from '@/lib/result';
+// Public key (base64, raw/SPKI) used to verify license signatures. Defaults to
+// the value baked in at build time; `setLicensePublicKey` is the seam used by
+// the build and by tests to inject a key.
+const buildEnv = (import.meta as { env?: Record }).env;
+let publicKeyBase64 = buildEnv?.WXT_LICENSE_PUBLIC_KEY ?? '';
+
+export function setLicensePublicKey(base64: string): void {
+ publicKeyBase64 = base64;
+}
+
+export function getLicensePublicKey(): string {
+ return publicKeyBase64;
+}
+
/** Verify an Ed25519-signed license key and decode its entitlement payload. */
export async function verifyLicenseKey(_licenseKey: string): Promise {
- // TODO: crypto.subtle.verify with the baked-in public key.
+ // TODO: split on '.', base64url-decode payload + signature, crypto.subtle.verify
+ // with the imported Ed25519 public key (publicKeyBase64); return the entitlement
+ // (or null on bad signature / expired validUntil).
+ void publicKeyBase64;
throw new NotImplementedError('licensing/verifier.verifyLicenseKey');
}
diff --git a/src/ui/views/ExportView.tsx b/src/ui/views/ExportView.tsx
index f7d260b..7a1b855 100644
--- a/src/ui/views/ExportView.tsx
+++ b/src/ui/views/ExportView.tsx
@@ -9,6 +9,7 @@ import { Panel, Button, Empty, ProBadge } from '@/ui/components/primitives';
import { useBackground } from '@/ui/hooks/useBackground';
import { useStore } from '@/state/store';
import { trackAsync } from '@/services/telemetry/telemetry';
+import { copyToClipboard, downloadText } from '@/lib/clipboard';
type Target = 'playwright' | 'puppeteer' | 'selenium' | 'curl';
@@ -56,15 +57,6 @@ export function ExportView() {
setOutput(res ?? '');
};
- const downloadText = (filename: string, text: string) => {
- const url = URL.createObjectURL(new Blob([text], { type: 'text/plain' }));
- const a = document.createElement('a');
- a.href = url;
- a.download = filename;
- a.click();
- URL.revokeObjectURL(url);
- };
-
if (profiles.length === 0) {
return (
@@ -112,7 +104,7 @@ export function ExportView() {
-
output && navigator.clipboard.writeText(output)} disabled={!output}>
+ output && copyToClipboard(output)} disabled={!output}>
Copy
downloadText('sessionist-export.txt', output)} disabled={!output}>
diff --git a/tests/CONTRACTS.md b/tests/CONTRACTS.md
new file mode 100644
index 0000000..2ec3dd2
--- /dev/null
+++ b/tests/CONTRACTS.md
@@ -0,0 +1,212 @@
+# Test contracts (single source of truth)
+
+These are the cross-cutting behavioural contracts the tests encode. They are
+derived from the PRD and resolve ambiguities so that independently-written test
+groups (and the eventual implementation) agree. When a test needs a decision not
+covered here, prefer the PRD; if still ambiguous, pick the simplest behaviour
+that satisfies the PRD acceptance criteria and document it in the test.
+
+The golden rule: **a test must fail against the current stub (NotImplementedError
+or a clean assertion) and pass only against a correct implementation. A test must
+fail if the implementation is wrong or an edge case is unhandled.** Never assert
+that a function throws NotImplementedError (that would invert the suite).
+
+---
+
+## 1. Cookie JSON import/export (§9.1, §9.5)
+
+`exportCookies(cookies)` → a JSON string of an array; each element is the
+serialized `CookieRecord` (camelCase, exactly the supported fields:
+`name, value, domain, path, secure, httpOnly, sameSite, expirationDate?,
+hostOnly?, session?, storeId?, partitionKey?`). `JSON.parse(exportCookies(x))`
+must deep-equal the input's supported fields (round-trip, no data loss).
+
+`importCookies(json)` accepts:
+- **Sessionist format** (the above).
+- **EditThisCookie format**: array of objects with `name, value, domain, path,
+ secure, httpOnly, expirationDate, sameSite` where `sameSite` is
+ `no_restriction|lax|strict|unspecified` and there is an `id` field to ignore.
+- **Cookie-Editor format**: same camelCase fields; `sameSite` may be
+ `"no_restriction"|"lax"|"strict"`.
+`detectFormat(json)` returns `'sessionist'|'editthiscookie'|'cookie-editor'|'unknown'`.
+Malformed JSON or a non-array payload → `importCookies` throws (a normal Error),
+`detectFormat` returns `'unknown'`.
+Imported records are normalized to `CookieRecord` (defaults: `path:'/'`,
+`secure:false`, `httpOnly:false`, `sameSite:'unspecified'`).
+
+## 2. Cookie service (§9.1)
+
+- `listCookies(origin)` returns cookies for the origin's registrable domain and
+ related subdomains (via `chrome.cookies.getAll({ domain })`), each mapped to a
+ `CookieRecord`. `locked` defaults to absent/false.
+- `setCookie(cookie)` calls `chrome.cookies.set` with a correctly-constructed
+ `url` (scheme from `secure`, host from `domain`, `path`), passing all supported
+ fields including `partitionKey`/`storeId` when present.
+- `deleteCookie({name,domain,path,partitionKey,storeId})` removes exactly that
+ cookie. A cookie that is locked (tracked by the lock set) must NOT be deleted
+ by `deleteCookie`/`deleteAllForSite`; attempting to delete a locked cookie is a
+ no-op (or rejects) and the cookie remains.
+- `deleteAllForSite(origin)` deletes all non-locked cookies for the origin and
+ returns the count deleted.
+- CHIPS/partitioned: two cookies with identical name/domain/path but different
+ `partitionKey` are distinct; deleting one leaves the other.
+- **Lock set**: locked cookies are stored in `chrome.storage.local` under the key
+ `lockedCookies` as `{ name, domain, path }[]`. `listCookies` sets `locked:true`
+ on matching records; `deleteCookie`/`deleteAllForSite` skip locked cookies.
+
+## 3. Profile capture + switch (§9.2, §13.6)
+
+`captureProfile({name, tabId, extraOrigins?})` returns a `Profile` with:
+- `cookies`: all cookies across `domainScope`.
+- `localStorage`/`sessionStorage`: captured from the active tab via executeScript.
+- `domainScope`: at least the active origin; includes `extraOrigins`.
+- `unsupportedStores`: includes an `indexedDB` notice (capture is gated, §9.2).
+- `sizeBytes`: serialized size; `createdAt`/`updatedAt` ISO strings; `id` unique.
+
+`switchToProfile(profileId, tabId)` performs the transaction-like sequence and
+returns a `SwitchResult`:
+1. Takes a pre-switch `Snapshot` of current supported state FIRST and persists it
+ (a snapshot must exist even if a later step fails).
+2. Clears current supported state for the scope.
+3. Applies the profile's stores.
+4. Reloads the tab (`chrome.tabs.reload`) — after apply, awaited.
+5. `results: StoreResult[]` has one entry per store with `status`
+ (`applied`/`cleared`/`failed`/`not-captured`); `succeeded` is true iff no
+ store `failed`. `snapshotId` references the persisted snapshot.
+- Web storage for non-active origins in a multi-domain `domainScope` is reported
+ `not-captured`/`skipped`, never silently dropped. Cookies cover the full scope.
+- IndexedDB always appears as `not-captured` (disclosed limitation).
+- `restoreAdditive(profileId, tabId)` applies WITHOUT clearing first.
+- If a store apply throws mid-switch, that store's `StoreResult.status` is
+ `failed`, `succeeded` is false, and the pre-switch snapshot is still persisted
+ (recoverable). Tests force this with `control.setFailure({...})`.
+- `restoreSnapshotAsSwitch(id, ...)` for a non-existent snapshot id throws a
+ `UserFacingError`.
+
+## 4. Playwright storageState export (§9.3, §13.7)
+
+`toStorageState(profile)` → `{ cookies: [...], origins: [...] }`:
+- Each cookie maps to Playwright shape: `name, value, domain, path, expires,
+ httpOnly, secure, sameSite`.
+ - `expires`: `expirationDate` if set, else `-1` (session).
+ - `sameSite`: `lax→'Lax'`, `strict→'Strict'`, `no_restriction→'None'`,
+ `unspecified→'Lax'` (Playwright has no "unspecified").
+- `origins`: grouped by origin; each `{ origin, localStorage: [{name,value}] }`
+ from `profile.localStorage` (keyed under `profile.origin`). Empty localStorage
+ → that origin is omitted.
+- `sessionStorage` and IndexedDB are NOT included (not part of standard
+ storageState). `exportStorageStateJson` returns `JSON.stringify(toStorageState)`.
+- `validateForPlaywright(cookies)` returns human-readable warnings (e.g. a cookie
+ missing `domain`); empty array means clean.
+
+## 5. Automation export snippets (§9.4)
+
+`exportPuppeteerSnippet`, `exportSeleniumSnippet(profile,'python'|'js')`,
+`exportCurlSnippet` return strings that:
+- contain every cookie name/value,
+- are syntactically the documented API call (`page.setCookie(`,
+ `driver.add_cookie(`, `curl ... -b "k=v; ..."`),
+- cURL joins cookies as `name=value; name2=value2`.
+`scanForSecrets(profile)` returns a warning per value that looks like a secret
+(jwt-ish, long high-entropy, or keys named token/secret/key/auth). `redactSnippet`
+masks values leaving structure.
+
+## 6. Encryption + keys (§13.5)
+
+`encryptJson(key, keyId, value, aad?)` → `EncryptedBlob {v:1, alg:'AES-GCM',
+keyId, ciphertext, iv}`. `decryptJson(key, blob, aad?)` returns the original
+value. Properties:
+- round-trips arbitrary JSON-serializable values,
+- a fresh random 96-bit IV per call (two encryptions of the same value differ),
+- decrypt with the wrong key rejects,
+- decrypt with a different `aad` than used to encrypt rejects (AAD binding).
+`keyManager.getOrCreateDataKey()` returns a non-extractable AES-GCM `CryptoKey`,
+generating + persisting on first call and returning the same key thereafter.
+`passphrase.deriveKeyFromPassphrase(pass, salt)` is deterministic for the same
+inputs (PBKDF2, 600k iters); `unlockWithPassphrase` succeeds for the right
+passphrase and fails for the wrong one.
+
+## 7. Licensing — Worker mints, extension verifies (§13.8) — CROSS-GROUP
+
+This contract MUST be identical in the worker tests and the extension licensing
+tests, since interop is the whole point.
+
+License key format: `base64url(JSON payload) + "." + base64url(ed25519 signature
+over the UTF-8 payload bytes)`.
+Payload: `{ subjectId: string, tier: 'pro', issuedAt: string (ISO),
+validUntil?: string (ISO) }`.
+- `worker mintLicenseKey(pkcs8PrivateKeyBase64, payload)` produces that string.
+- `verifyLicenseKey(key)` (extension) verifies the Ed25519 signature with the
+ baked public key and returns the `Entitlement` (`{subjectId, tier:'pro',
+ validUntil?}`) or `null` if the signature is invalid/tampered or `validUntil`
+ is in the past.
+- A key minted by the worker's private key verifies with the matching public key;
+ a key signed by a different key, or with a flipped payload byte, returns null.
+Key encodings (pinned to match the tests):
+- public key passed to `setLicensePublicKey`: **base64 (standard) of the raw
+ 32-byte Ed25519 public key** (verifier imports it via `crypto.subtle.importKey
+ ('raw', ...)`).
+- private key passed to `mintLicenseKey`: **base64 (standard) of the PKCS8 DER**
+ (`crypto.subtle.exportKey('pkcs8', ...)`).
+- signature segment: base64url of the raw 64-byte Ed25519 signature over the
+ UTF-8 payload bytes (not over the base64url string).
+
+Tests generate an Ed25519 keypair via WebCrypto, inject the public key into the
+verifier via `setLicensePublicKey`, mint with the private key, and assert
+round-trip + tamper rejection. `entitlementService` must persist the signed key
+string and re-verify it on every `getEntitlement()` read (so a hand-edited cached
+tier cannot grant pro).
+
+## 8. Entitlements (§11)
+
+- `getEntitlement()` returns the cached entitlement or `{subjectId:'local',
+ tier:'free'}` by default.
+- `activateLicense(key)` verifies, persists, and returns the entitlement; an
+ invalid key rejects/returns free and does NOT persist pro.
+- A tampered cached entitlement in storage must not grant pro unless backed by a
+ valid signed key (re-verify on read).
+- `hasPro()` is true for `pro`/`team`, false for `free`.
+
+## 9. Permissions (§9.6, §14.1)
+
+- `requestOrigin(origin)` calls `chrome.permissions.request({origins:[pattern]})`
+ with a single concrete origin pattern (never `*://*/*`/``); on grant
+ it adds the origin to `settings.grantedOrigins` and returns true; on denial
+ returns false and does not persist.
+- `listGrantedOrigins()` reflects granted origins; `revokeOrigin` removes the
+ permission and the stored origin; `hasOrigin` mirrors `permissions.contains`.
+
+## 10. Telemetry (§15)
+
+- `track(event)` is a no-op (no network, no log) when `telemetryOptIn` is false;
+ when true it records exactly the event name and never any value/key/url.
+- Only the allowed event union is accepted (type-level).
+- `setOptIn` persists the flag.
+
+## 11. Settings/storage (§13.4)
+
+- `getSettings()` merges stored over `DEFAULT_SETTINGS`; `telemetryOptIn` and
+ `onboardingComplete` default false; `freeProfileLimit` default 3.
+- `profileRepository.saveProfile` encrypts the blob before it reaches storage
+ (no plaintext cookie/localStorage values appear in the persisted bytes),
+ tracks `sizeBytes`, and round-trips via `getProfile`. Snapshots likewise.
+- `shouldPromptUpsell()` reads `settings.freeProfileLimit` (default 3) and
+ returns true once the saved profile count reaches it, false below; switching is
+ never gated. Tests patch `freeProfileLimit` to verify it's the tunable used.
+
+## 12. Manifest / permission posture (§9.6, §13.2, §14)
+
+The built manifest must have: no `host_permissions`, no `` anywhere,
+no `content_scripts`, no `action.default_popup`, and `permissions` ⊆
+`{cookies, storage, sidePanel, scripting, activeTab}`. `optional_host_permissions`
+may be `['*://*/*']`.
+
+## 13. Messaging/router (§13.1, §13.3)
+
+- Every `BgRequest['type']` has a handler; the router calls the matching service
+ and returns its value.
+- `backgroundMessageListener` ignores messages from other senders
+ (`sender.id !== chrome.runtime.id`) and non-`{type}` messages (returns false),
+ wraps success as `{ok:true,value}` and failure as `{ok:false,error}`.
+- `sanitizeError` forwards messages only for `NotImplementedError`/
+ `UserFacingError`; any other Error becomes a generic string (no secret leak).
diff --git a/tests/background/messageHandler.test.ts b/tests/background/messageHandler.test.ts
new file mode 100644
index 0000000..482679a
--- /dev/null
+++ b/tests/background/messageHandler.test.ts
@@ -0,0 +1,370 @@
+/**
+ * backgroundMessageListener + sanitizeError tests
+ * CONTRACTS.md §13 / PRD §13.1 / §13.3 / §14.3.
+ *
+ * Implementation status:
+ * backgroundMessageListener and sanitizeError are IMPLEMENTED → all tests
+ * here should be GREEN now.
+ *
+ * Seam note: backgroundMessageListener calls handleRequest(), which in turn
+ * calls stub services that throw NotImplementedError. We exploit this by
+ * letting valid requests through to the stubs; the envelope error surface is
+ * what we assert, not NotImplementedError itself. Where we need success paths
+ * we spy on service modules to return canned values.
+ */
+
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+
+import {
+ backgroundMessageListener,
+ sanitizeError,
+} from '@/background/messageHandler';
+import { NotImplementedError, UserFacingError } from '@/lib/result';
+
+// ── helpers ────────────────────────────────────────────────────────────────
+
+const RUNTIME_ID = chrome.runtime.id; // 'sessionist-test-id' from fakeChrome
+
+function ownSender(): chrome.runtime.MessageSender {
+ return { id: RUNTIME_ID };
+}
+
+function foreignSender(): chrome.runtime.MessageSender {
+ return { id: 'some-other-extension' };
+}
+
+/** Wrap backgroundMessageListener in a Promise-based helper. */
+function invoke(
+ message: unknown,
+ sender: chrome.runtime.MessageSender = ownSender(),
+): Promise {
+ return new Promise((resolve) => {
+ const keepOpen = backgroundMessageListener(message, sender, resolve as (r: unknown) => void);
+ // If the listener returned false it will never call sendResponse — resolve undefined.
+ if (!keepOpen) resolve(undefined);
+ });
+}
+
+beforeEach(() => {
+ control.reset();
+ vi.restoreAllMocks();
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// sanitizeError
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('sanitizeError', () => {
+ it('forwards the message of NotImplementedError (name: message)', () => {
+ const err = new NotImplementedError('cookies/list');
+ const result = sanitizeError(err);
+ expect(result).toBe('NotImplementedError: Not implemented: cookies/list');
+ });
+
+ it('forwards the message of UserFacingError (name: message)', () => {
+ const err = new UserFacingError('Profile not found');
+ const result = sanitizeError(err);
+ expect(result).toBe('UserFacingError: Profile not found');
+ });
+
+ it('does NOT forward the message of a plain Error (generic string)', () => {
+ const secretMsg = 'super-secret-db-password-12345';
+ const err = new Error(secretMsg);
+ const result = sanitizeError(err);
+ expect(result).not.toContain(secretMsg);
+ });
+
+ it('plain Error becomes "Error: an unexpected error occurred"', () => {
+ const err = new Error('any internal detail');
+ const result = sanitizeError(err);
+ expect(result).toBe('Error: an unexpected error occurred');
+ });
+
+ it('custom Error subclass that is not safe-listed: message is NOT forwarded', () => {
+ class InternalError extends Error {
+ constructor(msg: string) {
+ super(msg);
+ this.name = 'InternalError';
+ }
+ }
+ const secretMsg = 'token=eyJhbGciOiJSUzI1NiJ9.payload.sig';
+ const err = new InternalError(secretMsg);
+ const result = sanitizeError(err);
+ expect(result).not.toContain(secretMsg);
+ expect(result).toContain('an unexpected error occurred');
+ });
+
+ it('non-Error value → "An unexpected error occurred"', () => {
+ expect(sanitizeError('some string')).toBe('An unexpected error occurred');
+ expect(sanitizeError(42)).toBe('An unexpected error occurred');
+ expect(sanitizeError(null)).toBe('An unexpected error occurred');
+ expect(sanitizeError(undefined)).toBe('An unexpected error occurred');
+ expect(sanitizeError({ message: 'fake-error' })).toBe('An unexpected error occurred');
+ });
+
+ it('caps NotImplementedError message at 200 chars on the first line', () => {
+ const longMsg = 'x'.repeat(250);
+ const err = new NotImplementedError(longMsg);
+ const result = sanitizeError(err);
+ // The forwarded portion is "Not implemented: " + longMsg (first line, sliced to 200).
+ // Total: "NotImplementedError: " + up to 200 chars of the original message.
+ expect(result.length).toBeLessThanOrEqual('NotImplementedError: '.length + 200);
+ });
+
+ it('only the first line of a multi-line NotImplementedError message is forwarded', () => {
+ class FakeNotImpl extends Error {
+ constructor() {
+ super('safe first line\nsecret second line with key=abc');
+ this.name = 'NotImplementedError';
+ Object.setPrototypeOf(this, NotImplementedError.prototype);
+ }
+ }
+ const err = new FakeNotImpl();
+ const result = sanitizeError(err);
+ expect(result).toContain('safe first line');
+ expect(result).not.toContain('secret second line');
+ });
+
+ it('UserFacingError: only the first line is forwarded', () => {
+ const err = new UserFacingError('Profile not found\ninternal trace here');
+ const result = sanitizeError(err);
+ expect(result).toContain('Profile not found');
+ expect(result).not.toContain('internal trace here');
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// backgroundMessageListener — sender validation
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('backgroundMessageListener — sender validation', () => {
+ it('ignores messages from a foreign sender (returns false, no sendResponse)', async () => {
+ const sendResponse = vi.fn();
+ const kept = backgroundMessageListener(
+ { type: 'settings/get' },
+ foreignSender(),
+ sendResponse,
+ );
+ expect(kept).toBe(false);
+ // Give async tasks a chance to run; sendResponse must not be called.
+ await new Promise((r) => setTimeout(r, 10));
+ expect(sendResponse).not.toHaveBeenCalled();
+ });
+
+ it('ignores messages with no sender.id (returns false)', async () => {
+ const sendResponse = vi.fn();
+ const kept = backgroundMessageListener({ type: 'settings/get' }, {}, sendResponse);
+ expect(kept).toBe(false);
+ await new Promise((r) => setTimeout(r, 10));
+ expect(sendResponse).not.toHaveBeenCalled();
+ });
+
+ it('ignores messages with sender.id set to empty string', async () => {
+ const sendResponse = vi.fn();
+ const kept = backgroundMessageListener({ type: 'settings/get' }, { id: '' }, sendResponse);
+ expect(kept).toBe(false);
+ await new Promise((r) => setTimeout(r, 10));
+ expect(sendResponse).not.toHaveBeenCalled();
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// backgroundMessageListener — message shape validation
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('backgroundMessageListener — message shape validation', () => {
+ it('ignores a message that has no "type" property (returns false)', async () => {
+ const sendResponse = vi.fn();
+ const kept = backgroundMessageListener({ payload: 'something' }, ownSender(), sendResponse);
+ expect(kept).toBe(false);
+ await new Promise((r) => setTimeout(r, 10));
+ expect(sendResponse).not.toHaveBeenCalled();
+ });
+
+ it('ignores a message where type is a number (not a string)', async () => {
+ const sendResponse = vi.fn();
+ const kept = backgroundMessageListener({ type: 42 }, ownSender(), sendResponse);
+ expect(kept).toBe(false);
+ await new Promise((r) => setTimeout(r, 10));
+ expect(sendResponse).not.toHaveBeenCalled();
+ });
+
+ it('ignores a null message', async () => {
+ const sendResponse = vi.fn();
+ const kept = backgroundMessageListener(null, ownSender(), sendResponse);
+ expect(kept).toBe(false);
+ await new Promise((r) => setTimeout(r, 10));
+ expect(sendResponse).not.toHaveBeenCalled();
+ });
+
+ it('ignores a plain string message', async () => {
+ const sendResponse = vi.fn();
+ const kept = backgroundMessageListener('hello', ownSender(), sendResponse);
+ expect(kept).toBe(false);
+ await new Promise((r) => setTimeout(r, 10));
+ expect(sendResponse).not.toHaveBeenCalled();
+ });
+
+ it('ignores a message where type is null', async () => {
+ const sendResponse = vi.fn();
+ const kept = backgroundMessageListener({ type: null }, ownSender(), sendResponse);
+ expect(kept).toBe(false);
+ await new Promise((r) => setTimeout(r, 10));
+ expect(sendResponse).not.toHaveBeenCalled();
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// backgroundMessageListener — returns true and calls sendResponse
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('backgroundMessageListener — valid message dispatching', () => {
+ it('returns true (keeps channel open) for a valid own-sender message', () => {
+ const kept = backgroundMessageListener(
+ { type: 'settings/get' },
+ ownSender(),
+ vi.fn(),
+ );
+ expect(kept).toBe(true);
+ });
+
+ it('calls sendResponse eventually for a stub-handled request (error envelope)', async () => {
+ const response = await invoke({ type: 'settings/get' });
+ // settings/get IS IMPLEMENTED — it should resolve successfully.
+ expect(response).toMatchObject({ ok: true });
+ });
+
+ it('success path: wraps value in { ok: true, value }', async () => {
+ // settings/get is implemented; seed a known setting value.
+ control.seedStorage({ settings: { telemetryOptIn: false, theme: 'dark' } });
+ const response = await invoke({ type: 'settings/get' }) as { ok: boolean; value: unknown };
+ expect(response.ok).toBe(true);
+ expect((response.value as Record)?.theme).toBe('dark');
+ });
+
+ it('failure path: stub service → { ok: false, error: string }', async () => {
+ // cookies/list is a stub (throws NotImplementedError); error must be wrapped.
+ const response = await invoke({ type: 'cookies/list', origin: 'https://example.com' }) as {
+ ok: boolean;
+ error: string;
+ };
+ expect(response.ok).toBe(false);
+ expect(typeof response.error).toBe('string');
+ expect(response.error.length).toBeGreaterThan(0);
+ });
+
+ it('error string from a stub does NOT contain raw internal detail beyond NotImplementedError message', async () => {
+ const response = await invoke({
+ type: 'cookies/list',
+ origin: 'https://secret.bank.com',
+ }) as { ok: boolean; error: string };
+ expect(response.ok).toBe(false);
+ // The error may contain "NotImplementedError" but must not contain the origin.
+ expect(response.error).not.toContain('secret.bank.com');
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// backgroundMessageListener — via chrome.runtime.sendMessage integration
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('backgroundMessageListener — chrome.runtime.sendMessage integration', () => {
+ beforeEach(() => {
+ chrome.runtime.onMessage.addListener(backgroundMessageListener);
+ });
+
+ it('fakeChrome.runtime.sendMessage routes to the listener', async () => {
+ control.seedStorage({ settings: { telemetryOptIn: true, theme: 'system' } });
+ const response = await chrome.runtime.sendMessage({ type: 'settings/get' }) as {
+ ok: boolean;
+ value: Record;
+ };
+ expect(response.ok).toBe(true);
+ expect(response.value.theme).toBe('system');
+ });
+
+ it('stub request surfaced as error envelope through sendMessage', async () => {
+ const response = await chrome.runtime.sendMessage({
+ type: 'profiles/list',
+ }) as { ok: boolean; error: string };
+ expect(response.ok).toBe(false);
+ expect(typeof response.error).toBe('string');
+ });
+
+ it('unknown type with valid shape → routes to handler map, error envelope', async () => {
+ // A type string that has no handler at all would throw in the handler map
+ // lookup. It IS a string, so the listener accepts it — but the dispatch fails.
+ // The envelope wraps the failure.
+ const response = await chrome.runtime.sendMessage({
+ type: 'no_such_handler_xyzzy',
+ }) as { ok: boolean; error: string };
+ // Either the dispatch throws (ok:false) or it is undefined (sendMessage
+ // returned undefined because the listener returned false for a non-string type).
+ // Since 'no_such_handler_xyzzy' is a string, the listener accepts and
+ // handleRequest throws → ok:false.
+ expect(response.ok).toBe(false);
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// backgroundMessageListener — mock-service success path
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('backgroundMessageListener — mocked service success', () => {
+ it('wraps a mocked success in { ok:true, value }', async () => {
+ // Spy on the settings service to bypass the real storage.
+ const mockSettings = {
+ theme: 'light' as const,
+ telemetryOptIn: true,
+ onboardingComplete: false,
+ grantedOrigins: [],
+ freeProfileLimit: 3,
+ };
+ const spy = vi.spyOn(
+ await import('@/services/storage/settingsRepository'),
+ 'getSettings',
+ ).mockResolvedValueOnce(mockSettings);
+
+ const response = await invoke({ type: 'settings/get' }) as { ok: boolean; value: unknown };
+
+ expect(response.ok).toBe(true);
+ expect(response.value).toEqual(mockSettings);
+ spy.mockRestore();
+ });
+
+ it('wraps a mocked rejection in { ok:false, error }', async () => {
+ const spy = vi.spyOn(
+ await import('@/services/storage/settingsRepository'),
+ 'getSettings',
+ ).mockRejectedValueOnce(new UserFacingError('Storage unavailable'));
+
+ const response = await invoke({ type: 'settings/get' }) as {
+ ok: boolean;
+ error: string;
+ };
+
+ expect(response.ok).toBe(false);
+ expect(response.error).toContain('UserFacingError');
+ expect(response.error).toContain('Storage unavailable');
+ spy.mockRestore();
+ });
+
+ it('generic Error thrown by a service produces a sanitized error string', async () => {
+ const secretMsg = 'internal db password = secret123';
+ const spy = vi.spyOn(
+ await import('@/services/storage/settingsRepository'),
+ 'getSettings',
+ ).mockRejectedValueOnce(new Error(secretMsg));
+
+ const response = await invoke({ type: 'settings/get' }) as {
+ ok: boolean;
+ error: string;
+ };
+
+ expect(response.ok).toBe(false);
+ expect(response.error).not.toContain(secretMsg);
+ expect(response.error).toContain('an unexpected error occurred');
+ spy.mockRestore();
+ });
+});
diff --git a/tests/background/router.test.ts b/tests/background/router.test.ts
new file mode 100644
index 0000000..068a91b
--- /dev/null
+++ b/tests/background/router.test.ts
@@ -0,0 +1,642 @@
+/**
+ * Router wiring tests — CONTRACTS.md §13 / PRD §13.1 / §13.3.
+ *
+ * Implementation status:
+ * handleRequest() dispatch table is IMPLEMENTED.
+ * Service implementations are STUBS (throw NotImplementedError).
+ *
+ * Strategy: vi.spyOn each service module's exported function to return a
+ * canned value, then call handleRequest(). This proves the wiring (correct
+ * function called with correct args) independently of whether the service is
+ * implemented. All such tests are GREEN now.
+ *
+ * Exhaustiveness tests that iterate BgRequest['type'] members are also GREEN.
+ *
+ * Ephemerality test (statelessness) is GREEN.
+ *
+ * Intentional gap: export/* handlers call requireProfile() internally which
+ * calls profileRepo.getProfile(); we spy on that to supply a Profile, then spy
+ * on the export service to prove routing. Tests that let stubs throw will see
+ * NotImplementedError surfaced as an envelope error — never asserted as desired.
+ */
+
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { makeProfile, makeCookie, makeSnapshot, makeEntitlement } from '../harness/factories';
+
+import { handleRequest } from '@/background/router';
+import { NotImplementedError } from '@/lib/result';
+import type { BgRequest } from '@/types/messages';
+
+// Service modules for spying.
+import * as cookieService from '@/services/cookies/cookieService';
+import * as cookieIO from '@/services/cookies/cookieImportExport';
+import * as profileService from '@/services/profiles/profileService';
+import * as captureService from '@/services/profiles/captureService';
+import * as switchEngine from '@/services/profiles/switchEngine';
+import * as snapshotService from '@/services/profiles/snapshotService';
+import * as profileRepo from '@/services/storage/profileRepository';
+import * as settingsRepo from '@/services/storage/settingsRepository';
+import * as playwrightExport from '@/services/export/playwrightExport';
+import * as puppeteerExport from '@/services/export/puppeteerExport';
+import * as seleniumExport from '@/services/export/seleniumExport';
+import * as curlExport from '@/services/export/curlExport';
+import * as permissionService from '@/services/permissions/permissionService';
+import * as entitlementService from '@/services/licensing/entitlementService';
+import type { AppSettings } from '@/services/storage/settingsRepository';
+
+beforeEach(() => {
+ control.reset();
+ vi.restoreAllMocks();
+});
+
+// ── helpers ────────────────────────────────────────────────────────────────
+
+/** Swallow NotImplementedError so tests about wiring don't fail on the stub. */
+async function routeOrCatch(req: BgRequest): Promise {
+ try {
+ return await handleRequest(req);
+ } catch (e) {
+ if (e instanceof NotImplementedError) return e;
+ throw e;
+ }
+}
+
+const MOCK_SETTINGS: AppSettings = {
+ theme: 'system',
+ telemetryOptIn: false,
+ onboardingComplete: false,
+ grantedOrigins: [],
+ freeProfileLimit: 3,
+};
+
+// ══════════════════════════════════════════════════════════════════════════
+// §A Cookie handlers
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: cookies/list', () => {
+ it('calls cookieService.listCookies with the origin arg', async () => {
+ const spy = vi.spyOn(cookieService, 'listCookies').mockResolvedValue([]);
+ const result = await handleRequest({ type: 'cookies/list', origin: 'https://example.com' });
+ expect(spy).toHaveBeenCalledWith('https://example.com');
+ expect(result).toEqual([]);
+ });
+
+ it('returns the value produced by cookieService.listCookies', async () => {
+ const cookies = [makeCookie(), makeCookie({ name: 'b' })];
+ vi.spyOn(cookieService, 'listCookies').mockResolvedValue(cookies);
+ const result = await handleRequest({ type: 'cookies/list', origin: 'https://example.com' });
+ expect(result).toEqual(cookies);
+ });
+});
+
+describe('router: cookies/set', () => {
+ it('calls cookieService.setCookie with the cookie arg', async () => {
+ const spy = vi.spyOn(cookieService, 'setCookie').mockResolvedValue(undefined);
+ const cookie = makeCookie();
+ await handleRequest({ type: 'cookies/set', cookie });
+ expect(spy).toHaveBeenCalledWith(cookie);
+ });
+});
+
+describe('router: cookies/delete', () => {
+ it('calls cookieService.deleteCookie with the cookie arg', async () => {
+ const spy = vi.spyOn(cookieService, 'deleteCookie').mockResolvedValue(undefined);
+ const cookie = makeCookie();
+ await handleRequest({ type: 'cookies/delete', cookie });
+ expect(spy).toHaveBeenCalledWith(cookie);
+ });
+});
+
+describe('router: cookies/deleteAll', () => {
+ it('calls cookieService.deleteAllForSite with origin and returns count', async () => {
+ const spy = vi.spyOn(cookieService, 'deleteAllForSite').mockResolvedValue(7);
+ const result = await handleRequest({ type: 'cookies/deleteAll', origin: 'https://app.example.com' });
+ expect(spy).toHaveBeenCalledWith('https://app.example.com');
+ expect(result).toBe(7);
+ });
+});
+
+describe('router: cookies/import', () => {
+ it('calls cookieIO.importCookies with the json arg', async () => {
+ const imported = [makeCookie()];
+ const spy = vi.spyOn(cookieIO, 'importCookies').mockReturnValue(imported);
+ const json = JSON.stringify([{ name: 'a', value: 'b' }]);
+ const result = await handleRequest({ type: 'cookies/import', json });
+ expect(spy).toHaveBeenCalledWith(json);
+ expect(result).toEqual(imported);
+ });
+});
+
+describe('router: cookies/export', () => {
+ it('calls cookieService.listCookies then cookieIO.exportCookies and returns a string', async () => {
+ const cookies = [makeCookie()];
+ vi.spyOn(cookieService, 'listCookies').mockResolvedValue(cookies);
+ const spy = vi.spyOn(cookieIO, 'exportCookies').mockReturnValue('["json"]');
+ const result = await handleRequest({ type: 'cookies/export', origin: 'https://example.com' });
+ expect(spy).toHaveBeenCalledWith(cookies);
+ expect(result).toBe('["json"]');
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §B Profile handlers
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: profiles/list', () => {
+ it('calls profileService.listProfiles and returns its value', async () => {
+ const profiles = [makeProfile()];
+ const spy = vi.spyOn(profileService, 'listProfiles').mockResolvedValue(profiles);
+ const result = await handleRequest({ type: 'profiles/list' });
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(result).toEqual(profiles);
+ });
+});
+
+describe('router: profiles/capture', () => {
+ it('calls captureService.captureProfile with name and tabId', async () => {
+ const profile = makeProfile();
+ const spy = vi.spyOn(captureService, 'captureProfile').mockResolvedValue(profile);
+ const result = await handleRequest({ type: 'profiles/capture', name: 'QA Admin', tabId: 42 });
+ expect(spy).toHaveBeenCalledWith({ name: 'QA Admin', tabId: 42 });
+ expect(result).toEqual(profile);
+ });
+});
+
+describe('router: profiles/switch', () => {
+ it('calls switchEngine.switchToProfile with profileId and tabId', async () => {
+ const switchResult = {
+ profileId: 'p1',
+ snapshotId: 's1',
+ results: [],
+ succeeded: true,
+ };
+ const spy = vi.spyOn(switchEngine, 'switchToProfile').mockResolvedValue(switchResult);
+ const result = await handleRequest({ type: 'profiles/switch', profileId: 'p1', tabId: 5 });
+ expect(spy).toHaveBeenCalledWith('p1', 5);
+ expect(result).toEqual(switchResult);
+ });
+});
+
+describe('router: profiles/restore', () => {
+ it('calls switchEngine.restoreAdditive with profileId and tabId', async () => {
+ const switchResult = { profileId: 'p2', snapshotId: 's2', results: [], succeeded: true };
+ const spy = vi.spyOn(switchEngine, 'restoreAdditive').mockResolvedValue(switchResult);
+ const result = await handleRequest({ type: 'profiles/restore', profileId: 'p2', tabId: 9 });
+ expect(spy).toHaveBeenCalledWith('p2', 9);
+ expect(result).toEqual(switchResult);
+ });
+});
+
+describe('router: profiles/delete', () => {
+ it('calls profileService.deleteProfile with the profileId', async () => {
+ const spy = vi.spyOn(profileService, 'deleteProfile').mockResolvedValue(undefined);
+ await handleRequest({ type: 'profiles/delete', profileId: 'p3' });
+ expect(spy).toHaveBeenCalledWith('p3');
+ });
+});
+
+describe('router: profiles/shouldPromptUpsell', () => {
+ it('calls profileService.shouldPromptUpsell and returns boolean', async () => {
+ const spy = vi.spyOn(profileService, 'shouldPromptUpsell').mockResolvedValue(true);
+ const result = await handleRequest({ type: 'profiles/shouldPromptUpsell' });
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(result).toBe(true);
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §C Snapshot handlers
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: snapshots/list', () => {
+ it('calls profileRepo.listSnapshots and returns snapshots', async () => {
+ const snapshots = [makeSnapshot()];
+ const spy = vi.spyOn(profileRepo, 'listSnapshots').mockResolvedValue(snapshots);
+ const result = await handleRequest({ type: 'snapshots/list' });
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(result).toEqual(snapshots);
+ });
+});
+
+describe('router: snapshots/restore', () => {
+ it('calls snapshotService.restoreSnapshotAsSwitch with snapshotId and tabId', async () => {
+ const switchResult = { profileId: '', snapshotId: 'sn1', results: [], succeeded: true };
+ const spy = vi
+ .spyOn(snapshotService, 'restoreSnapshotAsSwitch')
+ .mockResolvedValue(switchResult);
+ const result = await handleRequest({ type: 'snapshots/restore', snapshotId: 'sn1', tabId: 3 });
+ expect(spy).toHaveBeenCalledWith('sn1', 3);
+ expect(result).toEqual(switchResult);
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §D Export handlers — these go through requireProfile() first
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: export/playwright', () => {
+ it('calls profileRepo.getProfile then playwrightExport.exportStorageStateJson', async () => {
+ const profile = makeProfile({ id: 'p-export-1' });
+ const getProfileSpy = vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(profile);
+ const exportSpy = vi
+ .spyOn(playwrightExport, 'exportStorageStateJson')
+ .mockReturnValue('{"cookies":[]}');
+
+ const result = await handleRequest({ type: 'export/playwright', profileId: 'p-export-1' });
+
+ expect(getProfileSpy).toHaveBeenCalledWith('p-export-1');
+ expect(exportSpy).toHaveBeenCalledWith(profile);
+ expect(result).toBe('{"cookies":[]}');
+ });
+
+ it('throws UserFacingError (Profile not found) when profile does not exist', async () => {
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(undefined);
+
+ await expect(
+ handleRequest({ type: 'export/playwright', profileId: 'missing' }),
+ ).rejects.toMatchObject({ name: 'UserFacingError', message: 'Profile not found' });
+ });
+});
+
+describe('router: export/puppeteer', () => {
+ it('calls profileRepo.getProfile then puppeteerExport.exportPuppeteerSnippet', async () => {
+ const profile = makeProfile({ id: 'p-export-2' });
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(profile);
+ const exportSpy = vi
+ .spyOn(puppeteerExport, 'exportPuppeteerSnippet')
+ .mockReturnValue('page.setCookie(...)');
+
+ const result = await handleRequest({ type: 'export/puppeteer', profileId: 'p-export-2' });
+
+ expect(exportSpy).toHaveBeenCalledWith(profile);
+ expect(result).toBe('page.setCookie(...)');
+ });
+});
+
+describe('router: export/selenium', () => {
+ it('calls profileRepo.getProfile then seleniumExport.exportSeleniumSnippet with lang', async () => {
+ const profile = makeProfile({ id: 'p-export-3' });
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(profile);
+ const exportSpy = vi
+ .spyOn(seleniumExport, 'exportSeleniumSnippet')
+ .mockReturnValue('driver.add_cookie(...)');
+
+ const result = await handleRequest({
+ type: 'export/selenium',
+ profileId: 'p-export-3',
+ lang: 'python',
+ });
+
+ expect(exportSpy).toHaveBeenCalledWith(profile, 'python');
+ expect(result).toBe('driver.add_cookie(...)');
+ });
+});
+
+describe('router: export/curl', () => {
+ it('calls profileRepo.getProfile then curlExport.exportCurlSnippet', async () => {
+ const profile = makeProfile({ id: 'p-export-4' });
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(profile);
+ const exportSpy = vi
+ .spyOn(curlExport, 'exportCurlSnippet')
+ .mockReturnValue('curl -b "a=b"');
+
+ const result = await handleRequest({ type: 'export/curl', profileId: 'p-export-4' });
+
+ expect(exportSpy).toHaveBeenCalledWith(profile);
+ expect(result).toBe('curl -b "a=b"');
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §E Permission handlers
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: permissions/list', () => {
+ it('calls permissionService.listGrantedOrigins', async () => {
+ const spy = vi.spyOn(permissionService, 'listGrantedOrigins').mockResolvedValue(['https://a.com/*']);
+ const result = await handleRequest({ type: 'permissions/list' });
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(result).toEqual(['https://a.com/*']);
+ });
+});
+
+describe('router: permissions/request', () => {
+ it('calls permissionService.requestOrigin with origin', async () => {
+ const spy = vi.spyOn(permissionService, 'requestOrigin').mockResolvedValue(true);
+ const result = await handleRequest({ type: 'permissions/request', origin: 'https://b.com/*' });
+ expect(spy).toHaveBeenCalledWith('https://b.com/*');
+ expect(result).toBe(true);
+ });
+});
+
+describe('router: permissions/revoke', () => {
+ it('calls permissionService.revokeOrigin with origin', async () => {
+ const spy = vi.spyOn(permissionService, 'revokeOrigin').mockResolvedValue(true);
+ const result = await handleRequest({ type: 'permissions/revoke', origin: 'https://c.com/*' });
+ expect(spy).toHaveBeenCalledWith('https://c.com/*');
+ expect(result).toBe(true);
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §F Settings handlers (both are IMPLEMENTED → fully green)
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: settings/get', () => {
+ it('calls settingsRepo.getSettings and returns AppSettings', async () => {
+ const spy = vi.spyOn(settingsRepo, 'getSettings').mockResolvedValue(MOCK_SETTINGS);
+ const result = await handleRequest({ type: 'settings/get' });
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(result).toEqual(MOCK_SETTINGS);
+ });
+
+ it('returns default settings from real storage when none are seeded', async () => {
+ // No spy — uses real settingsRepo with empty fakeChrome storage.
+ const result = await handleRequest({ type: 'settings/get' }) as AppSettings;
+ expect(result.telemetryOptIn).toBe(false);
+ expect(result.freeProfileLimit).toBe(3);
+ });
+});
+
+describe('router: settings/patch', () => {
+ it('calls settingsRepo.patchSettings with the patch and returns updated settings', async () => {
+ const patched: AppSettings = { ...MOCK_SETTINGS, theme: 'dark' };
+ const spy = vi.spyOn(settingsRepo, 'patchSettings').mockResolvedValue(patched);
+ const result = await handleRequest({ type: 'settings/patch', patch: { theme: 'dark' } });
+ expect(spy).toHaveBeenCalledWith({ theme: 'dark' });
+ expect(result).toEqual(patched);
+ });
+
+ it('real patchSettings stores and retrieves via fakeChrome storage', async () => {
+ await handleRequest({ type: 'settings/patch', patch: { theme: 'light' } });
+ const result = await handleRequest({ type: 'settings/get' }) as AppSettings;
+ expect(result.theme).toBe('light');
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §G Entitlement handlers
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: entitlement/get', () => {
+ it('calls entitlementService.getEntitlement and returns an Entitlement', async () => {
+ const entitlement = makeEntitlement({ tier: 'pro' });
+ const spy = vi.spyOn(entitlementService, 'getEntitlement').mockResolvedValue(entitlement);
+ const result = await handleRequest({ type: 'entitlement/get' });
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(result).toEqual(entitlement);
+ });
+});
+
+describe('router: entitlement/activate', () => {
+ it('calls entitlementService.activateLicense with the license key', async () => {
+ const entitlement = makeEntitlement({ tier: 'pro' });
+ const spy = vi.spyOn(entitlementService, 'activateLicense').mockResolvedValue(entitlement);
+ const result = await handleRequest({ type: 'entitlement/activate', licenseKey: 'KEY-abc' });
+ expect(spy).toHaveBeenCalledWith('KEY-abc');
+ expect(result).toEqual(entitlement);
+ });
+});
+
+describe('router: entitlement/startCheckout', () => {
+ it('calls entitlementService.startCheckout and returns checkoutUrl', async () => {
+ const spy = vi
+ .spyOn(entitlementService, 'startCheckout')
+ .mockResolvedValue({ checkoutUrl: 'https://checkout.stripe.com/xyz' });
+ const result = await handleRequest({ type: 'entitlement/startCheckout' });
+ expect(spy).toHaveBeenCalledTimes(1);
+ expect(result).toEqual({ checkoutUrl: 'https://checkout.stripe.com/xyz' });
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §H Exhaustiveness — every BgRequest type has a handler
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: exhaustiveness', () => {
+ /**
+ * The full list of BgRequest type literals. This list is derived from
+ * types/messages.ts and must be kept in sync with that union. A new type
+ * added to BgRequest that is missing here will cause this test to PASS
+ * incorrectly (the test only checks what it knows about). However, the
+ * TypeScript Handlers type forces a compile error for missing keys — so the
+ * combination of compiler + runtime gives exhaustiveness.
+ */
+ const ALL_TYPES: BgRequest['type'][] = [
+ 'cookies/list',
+ 'cookies/set',
+ 'cookies/delete',
+ 'cookies/deleteAll',
+ 'cookies/import',
+ 'cookies/export',
+ 'profiles/list',
+ 'profiles/capture',
+ 'profiles/switch',
+ 'profiles/restore',
+ 'profiles/delete',
+ 'profiles/shouldPromptUpsell',
+ 'snapshots/list',
+ 'snapshots/restore',
+ 'export/playwright',
+ 'export/puppeteer',
+ 'export/selenium',
+ 'export/curl',
+ 'permissions/list',
+ 'permissions/request',
+ 'permissions/revoke',
+ 'settings/get',
+ 'settings/patch',
+ 'entitlement/get',
+ 'entitlement/activate',
+ 'entitlement/startCheckout',
+ ];
+
+ it('has a handler for all 26 BgRequest type literals', () => {
+ expect(ALL_TYPES).toHaveLength(26);
+ });
+
+ it('each type routes without throwing a "handler not found" error', async () => {
+ // Spy on all leaf services to return trivial values so we don't hit stubs
+ // for the mocked ones; the others return NotImplementedError which is fine
+ // (it proves the handler was called, not that it was absent).
+ vi.spyOn(cookieService, 'listCookies').mockResolvedValue([]);
+ vi.spyOn(cookieService, 'setCookie').mockResolvedValue(undefined);
+ vi.spyOn(cookieService, 'deleteCookie').mockResolvedValue(undefined);
+ vi.spyOn(cookieService, 'deleteAllForSite').mockResolvedValue(0);
+ vi.spyOn(cookieIO, 'importCookies').mockReturnValue([]);
+ vi.spyOn(cookieIO, 'exportCookies').mockReturnValue('[]');
+ vi.spyOn(profileService, 'listProfiles').mockResolvedValue([]);
+ vi.spyOn(profileService, 'shouldPromptUpsell').mockResolvedValue(false);
+ vi.spyOn(profileService, 'deleteProfile').mockResolvedValue(undefined);
+ const switchResult = { profileId: 'x', snapshotId: 'y', results: [], succeeded: true };
+ vi.spyOn(captureService, 'captureProfile').mockResolvedValue(makeProfile());
+ vi.spyOn(switchEngine, 'switchToProfile').mockResolvedValue(switchResult);
+ vi.spyOn(switchEngine, 'restoreAdditive').mockResolvedValue(switchResult);
+ vi.spyOn(profileRepo, 'listSnapshots').mockResolvedValue([]);
+ vi.spyOn(snapshotService, 'restoreSnapshotAsSwitch').mockResolvedValue(switchResult);
+ const profile = makeProfile();
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(profile);
+ vi.spyOn(playwrightExport, 'exportStorageStateJson').mockReturnValue('{}');
+ vi.spyOn(puppeteerExport, 'exportPuppeteerSnippet').mockReturnValue('');
+ vi.spyOn(seleniumExport, 'exportSeleniumSnippet').mockReturnValue('');
+ vi.spyOn(curlExport, 'exportCurlSnippet').mockReturnValue('');
+ vi.spyOn(permissionService, 'listGrantedOrigins').mockResolvedValue([]);
+ vi.spyOn(permissionService, 'requestOrigin').mockResolvedValue(true);
+ vi.spyOn(permissionService, 'revokeOrigin').mockResolvedValue(true);
+ vi.spyOn(settingsRepo, 'getSettings').mockResolvedValue(MOCK_SETTINGS);
+ vi.spyOn(settingsRepo, 'patchSettings').mockResolvedValue(MOCK_SETTINGS);
+ const ent = makeEntitlement();
+ vi.spyOn(entitlementService, 'getEntitlement').mockResolvedValue(ent);
+ vi.spyOn(entitlementService, 'activateLicense').mockResolvedValue(ent);
+ vi.spyOn(entitlementService, 'startCheckout').mockResolvedValue({
+ checkoutUrl: 'https://checkout.example.com',
+ });
+
+ // Build minimal valid requests for each type.
+ const minimalRequests: BgRequest[] = [
+ { type: 'cookies/list', origin: 'https://a.com' },
+ { type: 'cookies/set', cookie: makeCookie() },
+ { type: 'cookies/delete', cookie: makeCookie() },
+ { type: 'cookies/deleteAll', origin: 'https://a.com' },
+ { type: 'cookies/import', json: '[]' },
+ { type: 'cookies/export', origin: 'https://a.com' },
+ { type: 'profiles/list' },
+ { type: 'profiles/capture', name: 'n', tabId: 1 },
+ { type: 'profiles/switch', profileId: 'p', tabId: 1 },
+ { type: 'profiles/restore', profileId: 'p', tabId: 1 },
+ { type: 'profiles/delete', profileId: 'p' },
+ { type: 'profiles/shouldPromptUpsell' },
+ { type: 'snapshots/list' },
+ { type: 'snapshots/restore', snapshotId: 's', tabId: 1 },
+ { type: 'export/playwright', profileId: 'p' },
+ { type: 'export/puppeteer', profileId: 'p' },
+ { type: 'export/selenium', profileId: 'p', lang: 'python' },
+ { type: 'export/curl', profileId: 'p' },
+ { type: 'permissions/list' },
+ { type: 'permissions/request', origin: 'https://a.com/*' },
+ { type: 'permissions/revoke', origin: 'https://a.com/*' },
+ { type: 'settings/get' },
+ { type: 'settings/patch', patch: {} },
+ { type: 'entitlement/get' },
+ { type: 'entitlement/activate', licenseKey: 'KEY' },
+ { type: 'entitlement/startCheckout' },
+ ];
+
+ expect(minimalRequests).toHaveLength(ALL_TYPES.length);
+
+ for (const req of minimalRequests) {
+ // Must not throw a "handler not found" type of error.
+ // void handlers return undefined; non-void return a value — both are fine.
+ await handleRequest(req).catch((_err: unknown) => {
+ // A handler that exists but whose service throws is still routed correctly.
+ // We only fail if handler lookup itself throws (e.g. undefined handler).
+ // In practice all services are spied above, so no throws expected here.
+ });
+ }
+ });
+
+ it('every type in ALL_TYPES appears in the minimalRequests list (coverage guard)', () => {
+ const representedTypes = new Set([
+ 'cookies/list', 'cookies/set', 'cookies/delete', 'cookies/deleteAll',
+ 'cookies/import', 'cookies/export', 'profiles/list', 'profiles/capture',
+ 'profiles/switch', 'profiles/restore', 'profiles/delete', 'profiles/shouldPromptUpsell',
+ 'snapshots/list', 'snapshots/restore', 'export/playwright', 'export/puppeteer',
+ 'export/selenium', 'export/curl', 'permissions/list', 'permissions/request',
+ 'permissions/revoke', 'settings/get', 'settings/patch', 'entitlement/get',
+ 'entitlement/activate', 'entitlement/startCheckout',
+ ]);
+ for (const t of ALL_TYPES) {
+ expect(representedTypes.has(t)).toBe(true);
+ }
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §I Ephemerality / statelessness (PRD §13.3)
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: statelessness (PRD §13.3)', () => {
+ it('a sequence of handleRequest calls does not accumulate shared mutable state', async () => {
+ // Use a factory so each call gets a fresh object, proving the router holds no
+ // static result cache between calls.
+ vi.spyOn(settingsRepo, 'getSettings').mockImplementation(async () => ({
+ ...MOCK_SETTINGS,
+ }));
+
+ // Call settings/get three times; each must return a fresh (equal) result.
+ const r1 = await handleRequest({ type: 'settings/get' });
+ const r2 = await handleRequest({ type: 'settings/get' });
+ const r3 = await handleRequest({ type: 'settings/get' });
+
+ // Results are equal.
+ expect(r1).toEqual(r2);
+ expect(r2).toEqual(r3);
+ // Each call returns a distinct object — no shared reference.
+ expect(r1).not.toBe(r2);
+ expect(r2).not.toBe(r3);
+ // Mutating one result must not affect the next call (no shared router-level state).
+ (r1 as Record)['theme'] = 'hacked';
+ const r4 = await handleRequest({ type: 'settings/get' });
+ expect((r4 as Record)['theme']).toBe('system');
+ });
+
+ it('consecutive calls with different types return independent values', async () => {
+ vi.spyOn(cookieService, 'listCookies').mockResolvedValue([makeCookie()]);
+ vi.spyOn(permissionService, 'listGrantedOrigins').mockResolvedValue(['https://x.com/*']);
+
+ const cookies = await handleRequest({ type: 'cookies/list', origin: 'https://x.com' });
+ const origins = await handleRequest({ type: 'permissions/list' });
+
+ expect(Array.isArray(cookies)).toBe(true);
+ expect(Array.isArray(origins)).toBe(true);
+ expect(cookies).not.toEqual(origins);
+ });
+
+ it('a failed request does not corrupt the router for subsequent requests', async () => {
+ // First call: stub throws.
+ vi.spyOn(cookieService, 'listCookies').mockRejectedValueOnce(new Error('transient failure'));
+ await expect(
+ handleRequest({ type: 'cookies/list', origin: 'https://example.com' }),
+ ).rejects.toThrow();
+
+ // Second call: spy returns a clean value.
+ vi.spyOn(cookieService, 'listCookies').mockResolvedValue([]);
+ const result = await handleRequest({ type: 'cookies/list', origin: 'https://example.com' });
+ expect(result).toEqual([]);
+ });
+});
+
+// ══════════════════════════════════════════════════════════════════════════
+// §J requireProfile — UserFacingError when profile is absent
+// ══════════════════════════════════════════════════════════════════════════
+
+describe('router: requireProfile guard', () => {
+ it('export/playwright: throws UserFacingError when getProfile returns undefined', async () => {
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(undefined);
+ await expect(
+ handleRequest({ type: 'export/playwright', profileId: 'no-such-profile' }),
+ ).rejects.toMatchObject({ name: 'UserFacingError', message: 'Profile not found' });
+ });
+
+ it('export/puppeteer: throws UserFacingError when getProfile returns undefined', async () => {
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(undefined);
+ await expect(
+ handleRequest({ type: 'export/puppeteer', profileId: 'ghost' }),
+ ).rejects.toMatchObject({ name: 'UserFacingError', message: 'Profile not found' });
+ });
+
+ it('export/selenium: throws UserFacingError when getProfile returns undefined', async () => {
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(undefined);
+ await expect(
+ handleRequest({ type: 'export/selenium', profileId: 'ghost', lang: 'js' }),
+ ).rejects.toMatchObject({ name: 'UserFacingError', message: 'Profile not found' });
+ });
+
+ it('export/curl: throws UserFacingError when getProfile returns undefined', async () => {
+ vi.spyOn(profileRepo, 'getProfile').mockResolvedValue(undefined);
+ await expect(
+ handleRequest({ type: 'export/curl', profileId: 'ghost' }),
+ ).rejects.toMatchObject({ name: 'UserFacingError', message: 'Profile not found' });
+ });
+});
diff --git a/tests/cookies/cookieImportExport.test.ts b/tests/cookies/cookieImportExport.test.ts
new file mode 100644
index 0000000..76e69c1
--- /dev/null
+++ b/tests/cookies/cookieImportExport.test.ts
@@ -0,0 +1,650 @@
+/**
+ * Tests for src/services/cookies/cookieImportExport.ts
+ *
+ * Contract: CONTRACTS.md §1 (cookie JSON import/export)
+ * PRD: §9.1 (round-trip), §9.5 (import onboarding — EditThisCookie / Cookie-Editor)
+ *
+ * Every test must fail against the current stub (NotImplementedError or assertion)
+ * and pass only against a correct implementation. Never assert NotImplementedError.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { makeCookie } from '../harness/factories';
+import {
+ detectFormat,
+ importCookies,
+ exportCookies,
+} from '@/services/cookies/cookieImportExport';
+import type { CookieRecord } from '@/types/models';
+
+beforeEach(() => {
+ control.reset();
+});
+
+// ---------------------------------------------------------------------------
+// Helper data fixtures
+// ---------------------------------------------------------------------------
+
+/** A minimal valid Sessionist JSON array (the exported format). */
+function sessionistJson(overrides: Partial[] = []): string {
+ const cookies: CookieRecord[] = overrides.length
+ ? overrides.map((o) => makeCookie(o))
+ : [makeCookie()];
+ // Produce Sessionist JSON manually so we can test importCookies without
+ // relying on exportCookies (chicken-and-egg).
+ return JSON.stringify(
+ cookies.map((c) => ({
+ name: c.name,
+ value: c.value,
+ domain: c.domain,
+ path: c.path,
+ secure: c.secure,
+ httpOnly: c.httpOnly,
+ sameSite: c.sameSite,
+ ...(c.expirationDate != null ? { expirationDate: c.expirationDate } : {}),
+ ...(c.hostOnly != null ? { hostOnly: c.hostOnly } : {}),
+ ...(c.session != null ? { session: c.session } : {}),
+ ...(c.storeId != null ? { storeId: c.storeId } : {}),
+ ...(c.partitionKey != null ? { partitionKey: c.partitionKey } : {}),
+ })),
+ );
+}
+
+/** EditThisCookie export sample for a typical session cookie. */
+const ETC_SAMPLE = JSON.stringify([
+ {
+ id: 1,
+ name: 'sessionId',
+ value: 'abc123',
+ domain: '.example.com',
+ path: '/',
+ secure: true,
+ httpOnly: true,
+ expirationDate: 4102444800,
+ sameSite: 'no_restriction',
+ session: false,
+ storeId: '0',
+ },
+]);
+
+/** EditThisCookie sample with sameSite = unspecified. */
+const ETC_SAMPLE_UNSPECIFIED = JSON.stringify([
+ {
+ id: 2,
+ name: 'pref',
+ value: 'dark',
+ domain: 'example.com',
+ path: '/',
+ secure: false,
+ httpOnly: false,
+ expirationDate: 4102444800,
+ sameSite: 'unspecified',
+ session: false,
+ },
+]);
+
+/** Cookie-Editor export sample (camelCase, sameSite lowercase). */
+const CE_SAMPLE = JSON.stringify([
+ {
+ name: 'token',
+ value: 'xyz789',
+ domain: 'example.com',
+ path: '/api',
+ secure: true,
+ httpOnly: false,
+ expirationDate: 4102444800,
+ sameSite: 'lax',
+ session: false,
+ },
+]);
+
+/** Cookie-Editor sample with sameSite = no_restriction. */
+const CE_SAMPLE_NO_RESTRICTION = JSON.stringify([
+ {
+ name: 'cross',
+ value: 'val',
+ domain: 'example.com',
+ path: '/',
+ secure: true,
+ httpOnly: false,
+ sameSite: 'no_restriction',
+ },
+]);
+
+// ---------------------------------------------------------------------------
+// detectFormat
+// ---------------------------------------------------------------------------
+
+describe('detectFormat', () => {
+ it('detects Sessionist format', () => {
+ const json = sessionistJson();
+ const fmt = detectFormat(json);
+ expect(fmt).toBe('sessionist');
+ });
+
+ it('detects EditThisCookie format (has id field)', () => {
+ expect(detectFormat(ETC_SAMPLE)).toBe('editthiscookie');
+ });
+
+ it('detects EditThisCookie format with sameSite=unspecified', () => {
+ expect(detectFormat(ETC_SAMPLE_UNSPECIFIED)).toBe('editthiscookie');
+ });
+
+ it('detects Cookie-Editor format', () => {
+ expect(detectFormat(CE_SAMPLE)).toBe('cookie-editor');
+ });
+
+ it('returns "unknown" for malformed JSON', () => {
+ expect(detectFormat('not json at all {')).toBe('unknown');
+ });
+
+ it('returns "unknown" for a non-array JSON value', () => {
+ expect(detectFormat(JSON.stringify({ name: 'c' }))).toBe('unknown');
+ });
+
+ it('returns "unknown" for an empty string', () => {
+ expect(detectFormat('')).toBe('unknown');
+ });
+
+ it('returns "unknown" for JSON null', () => {
+ expect(detectFormat('null')).toBe('unknown');
+ });
+
+ it('returns "unknown" for a JSON number', () => {
+ expect(detectFormat('42')).toBe('unknown');
+ });
+
+ it('returns "unknown" for an empty array []', () => {
+ // An empty array has no items to inspect for format signals; must be unknown or sessionist.
+ // Contract §1 says detectFormat returns one of the four literals. Empty array is ambiguous.
+ // We accept either 'unknown' or 'sessionist' here — both are safe.
+ const result = detectFormat('[]');
+ expect(['unknown', 'sessionist']).toContain(result);
+ });
+
+ it('returns a known format string (never throws) for well-formed JSON', () => {
+ const knownFormats = ['sessionist', 'editthiscookie', 'cookie-editor', 'unknown'];
+ const result = detectFormat(sessionistJson());
+ expect(knownFormats).toContain(result);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// exportCookies
+// ---------------------------------------------------------------------------
+
+describe('exportCookies', () => {
+ it('returns a JSON string (parseable)', () => {
+ const cookies = [makeCookie()];
+ const json = exportCookies(cookies);
+ expect(() => JSON.parse(json)).not.toThrow();
+ });
+
+ it('returns a JSON array', () => {
+ const cookies = [makeCookie()];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(Array.isArray(result)).toBe(true);
+ });
+
+ it('exports empty array when given empty input', () => {
+ const result = JSON.parse(exportCookies([]));
+ expect(result).toEqual([]);
+ });
+
+ it('serializes name field', () => {
+ const cookies = [makeCookie({ name: 'myName' })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].name).toBe('myName');
+ });
+
+ it('serializes value field', () => {
+ const cookies = [makeCookie({ value: 'myValue' })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].value).toBe('myValue');
+ });
+
+ it('serializes domain field', () => {
+ const cookies = [makeCookie({ domain: 'test.example.com' })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].domain).toBe('test.example.com');
+ });
+
+ it('serializes path field', () => {
+ const cookies = [makeCookie({ path: '/some/path' })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].path).toBe('/some/path');
+ });
+
+ it('serializes secure flag', () => {
+ const cookies = [makeCookie({ secure: true })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].secure).toBe(true);
+ });
+
+ it('serializes httpOnly flag', () => {
+ const cookies = [makeCookie({ httpOnly: true })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].httpOnly).toBe(true);
+ });
+
+ it('serializes sameSite field', () => {
+ for (const ss of ['no_restriction', 'lax', 'strict', 'unspecified'] as const) {
+ const cookies = [makeCookie({ sameSite: ss })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].sameSite).toBe(ss);
+ }
+ });
+
+ it('serializes expirationDate when present', () => {
+ const expiry = 4102444800;
+ const cookies = [makeCookie({ expirationDate: expiry })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].expirationDate).toBe(expiry);
+ });
+
+ it('omits or leaves undefined expirationDate for session cookies', () => {
+ const { expirationDate: _e, ...rest } = makeCookie();
+ const sessionCookie: CookieRecord = { ...rest, session: true };
+ const result = JSON.parse(exportCookies([sessionCookie]));
+ expect(result[0].expirationDate).toBeUndefined();
+ });
+
+ it('serializes storeId when present', () => {
+ const cookies = [makeCookie({ storeId: '5' })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].storeId).toBe('5');
+ });
+
+ it('serializes partitionKey when present', () => {
+ const cookies = [makeCookie({ partitionKey: 'https://top.com' })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].partitionKey).toBe('https://top.com');
+ });
+
+ it('serializes hostOnly when present', () => {
+ const cookies = [makeCookie({ hostOnly: true })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result[0].hostOnly).toBe(true);
+ });
+
+ it('serializes session flag when present', () => {
+ const cookies = [makeCookie({ session: false })];
+ const result = JSON.parse(exportCookies(cookies));
+ // session:false should be preserved (not undefined)
+ expect(result[0].session).toBe(false);
+ });
+
+ it('does NOT include locked field (internal UI annotation — not part of transfer format)', () => {
+ const cookies = [makeCookie({ locked: true })];
+ const result = JSON.parse(exportCookies(cookies));
+ // The locked field is a UI-layer concept; it must not be exported
+ expect(result[0].locked).toBeUndefined();
+ });
+
+ it('exports multiple cookies', () => {
+ const cookies = [makeCookie({ name: 'a' }), makeCookie({ name: 'b' }), makeCookie({ name: 'c' })];
+ const result = JSON.parse(exportCookies(cookies));
+ expect(result).toHaveLength(3);
+ const names = result.map((c: { name: string }) => c.name);
+ expect(names).toContain('a');
+ expect(names).toContain('b');
+ expect(names).toContain('c');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Round-trip: exportCookies → importCookies (Sessionist format)
+// ---------------------------------------------------------------------------
+
+describe('round-trip: exportCookies → importCookies', () => {
+ it('round-trips name', () => {
+ const cookies = [makeCookie({ name: 'roundTrip' })];
+ const imported = importCookies(exportCookies(cookies));
+ expect(imported[0]!.name).toBe('roundTrip');
+ });
+
+ it('round-trips value', () => {
+ const cookies = [makeCookie({ value: 'secret-val-42' })];
+ const imported = importCookies(exportCookies(cookies));
+ expect(imported[0]!.value).toBe('secret-val-42');
+ });
+
+ it('round-trips domain', () => {
+ const cookies = [makeCookie({ domain: 'api.example.com' })];
+ const imported = importCookies(exportCookies(cookies));
+ expect(imported[0]!.domain).toBe('api.example.com');
+ });
+
+ it('round-trips path', () => {
+ const cookies = [makeCookie({ path: '/v2/auth' })];
+ const imported = importCookies(exportCookies(cookies));
+ expect(imported[0]!.path).toBe('/v2/auth');
+ });
+
+ it('round-trips secure flag', () => {
+ for (const secure of [true, false]) {
+ const imported = importCookies(exportCookies([makeCookie({ secure })]));
+ expect(imported[0]!.secure).toBe(secure);
+ }
+ });
+
+ it('round-trips httpOnly flag', () => {
+ for (const httpOnly of [true, false]) {
+ const imported = importCookies(exportCookies([makeCookie({ httpOnly })]));
+ expect(imported[0]!.httpOnly).toBe(httpOnly);
+ }
+ });
+
+ it('round-trips sameSite for all four values', () => {
+ for (const ss of ['no_restriction', 'lax', 'strict', 'unspecified'] as const) {
+ const imported = importCookies(exportCookies([makeCookie({ sameSite: ss })]));
+ expect(imported[0]!.sameSite).toBe(ss);
+ }
+ });
+
+ it('round-trips expirationDate', () => {
+ const expiry = 4102444800;
+ const imported = importCookies(exportCookies([makeCookie({ expirationDate: expiry })]));
+ expect(imported[0]!.expirationDate).toBe(expiry);
+ });
+
+ it('round-trips storeId', () => {
+ const imported = importCookies(exportCookies([makeCookie({ storeId: '7' })]));
+ expect(imported[0]!.storeId).toBe('7');
+ });
+
+ it('round-trips partitionKey', () => {
+ const imported = importCookies(exportCookies([makeCookie({ partitionKey: 'https://top.com' })]));
+ expect(imported[0]!.partitionKey).toBe('https://top.com');
+ });
+
+ it('round-trips hostOnly', () => {
+ const imported = importCookies(exportCookies([makeCookie({ hostOnly: true })]));
+ expect(imported[0]!.hostOnly).toBe(true);
+ });
+
+ it('round-trips multiple cookies with no data loss', () => {
+ const original = [
+ makeCookie({ name: 'a', value: 'va', secure: true, sameSite: 'strict' }),
+ makeCookie({ name: 'b', value: 'vb', httpOnly: true, sameSite: 'lax' }),
+ ];
+ const imported = importCookies(exportCookies(original));
+ expect(imported).toHaveLength(2);
+ const byName = Object.fromEntries(imported.map((c) => [c.name, c]));
+ expect(byName['a']!.value).toBe('va');
+ expect(byName['a']!.secure).toBe(true);
+ expect(byName['a']!.sameSite).toBe('strict');
+ expect(byName['b']!.value).toBe('vb');
+ expect(byName['b']!.httpOnly).toBe(true);
+ expect(byName['b']!.sameSite).toBe('lax');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// importCookies — Sessionist format
+// ---------------------------------------------------------------------------
+
+describe('importCookies — Sessionist format', () => {
+ it('imports a single Sessionist cookie record', () => {
+ const json = sessionistJson([{ name: 'tok', value: 'xyz' }]);
+ const result = importCookies(json);
+ expect(result).toHaveLength(1);
+ expect(result[0]!.name).toBe('tok');
+ expect(result[0]!.value).toBe('xyz');
+ });
+
+ it('imports empty Sessionist array', () => {
+ const result = importCookies('[]');
+ expect(result).toEqual([]);
+ });
+
+ it('applies default path "/" if missing from import', () => {
+ const minimal = JSON.stringify([{ name: 'c', value: 'v', domain: 'example.com' }]);
+ const result = importCookies(minimal);
+ expect(result[0]!.path).toBe('/');
+ });
+
+ it('applies default secure:false if missing', () => {
+ const minimal = JSON.stringify([{ name: 'c', value: 'v', domain: 'example.com', path: '/' }]);
+ const result = importCookies(minimal);
+ expect(result[0]!.secure).toBe(false);
+ });
+
+ it('applies default httpOnly:false if missing', () => {
+ const minimal = JSON.stringify([{ name: 'c', value: 'v', domain: 'example.com', path: '/' }]);
+ const result = importCookies(minimal);
+ expect(result[0]!.httpOnly).toBe(false);
+ });
+
+ it('applies default sameSite:"unspecified" if missing', () => {
+ const minimal = JSON.stringify([{ name: 'c', value: 'v', domain: 'example.com', path: '/' }]);
+ const result = importCookies(minimal);
+ expect(result[0]!.sameSite).toBe('unspecified');
+ });
+
+ it('returns CookieRecord[] (has all required fields after normalization)', () => {
+ const result = importCookies(sessionistJson());
+ const c = result[0]!;
+ expect(typeof c.name).toBe('string');
+ expect(typeof c.value).toBe('string');
+ expect(typeof c.domain).toBe('string');
+ expect(typeof c.path).toBe('string');
+ expect(typeof c.secure).toBe('boolean');
+ expect(typeof c.httpOnly).toBe('boolean');
+ expect(typeof c.sameSite).toBe('string');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// importCookies — EditThisCookie format
+// ---------------------------------------------------------------------------
+
+describe('importCookies — EditThisCookie format', () => {
+ it('imports the ETC sample without errors', () => {
+ expect(() => importCookies(ETC_SAMPLE)).not.toThrow();
+ });
+
+ it('maps name correctly from ETC format', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect(result[0]!.name).toBe('sessionId');
+ });
+
+ it('maps value correctly from ETC format', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect(result[0]!.value).toBe('abc123');
+ });
+
+ it('maps domain correctly from ETC format', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect(result[0]!.domain).toBe('.example.com');
+ });
+
+ it('maps secure flag from ETC format', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect(result[0]!.secure).toBe(true);
+ });
+
+ it('maps httpOnly from ETC format', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect(result[0]!.httpOnly).toBe(true);
+ });
+
+ it('maps expirationDate from ETC format', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect(result[0]!.expirationDate).toBe(4102444800);
+ });
+
+ it('maps sameSite "no_restriction" from ETC format to "no_restriction"', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect(result[0]!.sameSite).toBe('no_restriction');
+ });
+
+ it('maps sameSite "unspecified" from ETC format to "unspecified"', () => {
+ const result = importCookies(ETC_SAMPLE_UNSPECIFIED);
+ expect(result[0]!.sameSite).toBe('unspecified');
+ });
+
+ it('ignores the "id" field (does not appear on CookieRecord)', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect((result[0] as Record)['id']).toBeUndefined();
+ });
+
+ it('maps path correctly from ETC format', () => {
+ const result = importCookies(ETC_SAMPLE);
+ expect(result[0]!.path).toBe('/');
+ });
+
+ it('imports multiple ETC cookies', () => {
+ const multi = JSON.stringify([
+ { id: 1, name: 'a', value: '1', domain: 'example.com', path: '/', secure: false, httpOnly: false, expirationDate: 9999999999, sameSite: 'lax' },
+ { id: 2, name: 'b', value: '2', domain: 'example.com', path: '/', secure: true, httpOnly: true, expirationDate: 9999999999, sameSite: 'strict' },
+ ]);
+ const result = importCookies(multi);
+ expect(result).toHaveLength(2);
+ expect(result.map((c) => c.name)).toContain('a');
+ expect(result.map((c) => c.name)).toContain('b');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// importCookies — Cookie-Editor format
+// ---------------------------------------------------------------------------
+
+describe('importCookies — Cookie-Editor format', () => {
+ it('imports the Cookie-Editor sample without errors', () => {
+ expect(() => importCookies(CE_SAMPLE)).not.toThrow();
+ });
+
+ it('maps name from Cookie-Editor format', () => {
+ const result = importCookies(CE_SAMPLE);
+ expect(result[0]!.name).toBe('token');
+ });
+
+ it('maps value from Cookie-Editor format', () => {
+ const result = importCookies(CE_SAMPLE);
+ expect(result[0]!.value).toBe('xyz789');
+ });
+
+ it('maps sameSite "lax" from Cookie-Editor format', () => {
+ const result = importCookies(CE_SAMPLE);
+ expect(result[0]!.sameSite).toBe('lax');
+ });
+
+ it('maps sameSite "no_restriction" from Cookie-Editor format', () => {
+ const result = importCookies(CE_SAMPLE_NO_RESTRICTION);
+ expect(result[0]!.sameSite).toBe('no_restriction');
+ });
+
+ it('maps expirationDate from Cookie-Editor format', () => {
+ const result = importCookies(CE_SAMPLE);
+ expect(result[0]!.expirationDate).toBe(4102444800);
+ });
+
+ it('maps path from Cookie-Editor format', () => {
+ const result = importCookies(CE_SAMPLE);
+ expect(result[0]!.path).toBe('/api');
+ });
+
+ it('maps secure from Cookie-Editor format', () => {
+ const result = importCookies(CE_SAMPLE);
+ expect(result[0]!.secure).toBe(true);
+ });
+
+ it('maps httpOnly from Cookie-Editor format', () => {
+ const result = importCookies(CE_SAMPLE);
+ expect(result[0]!.httpOnly).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// importCookies — error / malformed input
+// ---------------------------------------------------------------------------
+
+describe('importCookies — malformed/invalid input', () => {
+ it('throws a normal Error (not NotImplementedError) for malformed JSON', () => {
+ expect(() => importCookies('{bad json')).toThrow();
+ try {
+ importCookies('{bad json');
+ } catch (e) {
+ expect(e).toBeInstanceOf(Error);
+ expect((e as Error).name).not.toBe('NotImplementedError');
+ }
+ });
+
+ it('throws a normal Error for a JSON object (non-array)', () => {
+ expect(() => importCookies(JSON.stringify({ name: 'c' }))).toThrow();
+ try {
+ importCookies(JSON.stringify({ name: 'c' }));
+ } catch (e) {
+ expect(e).toBeInstanceOf(Error);
+ expect((e as Error).name).not.toBe('NotImplementedError');
+ }
+ });
+
+ it('throws a normal Error for JSON null', () => {
+ expect(() => importCookies('null')).toThrow();
+ });
+
+ it('throws a normal Error for a JSON number', () => {
+ expect(() => importCookies('42')).toThrow();
+ });
+
+ it('throws a normal Error for a JSON string', () => {
+ expect(() => importCookies('"hello"')).toThrow();
+ });
+
+ it('throws for an empty string', () => {
+ expect(() => importCookies('')).toThrow();
+ });
+
+ it('does NOT throw NotImplementedError for malformed input', () => {
+ // The error must be a normal (non-stub) Error
+ let caught: unknown;
+ try {
+ importCookies('not json');
+ } catch (e) {
+ caught = e;
+ }
+ expect(caught).toBeDefined();
+ expect((caught as Error).name).not.toBe('NotImplementedError');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Field normalization defaults
+// ---------------------------------------------------------------------------
+
+describe('importCookies — field normalization', () => {
+ it('applies path default "/" when field is missing', () => {
+ const result = importCookies(JSON.stringify([{ name: 'c', value: 'v', domain: 'x.com' }]));
+ expect(result[0]!.path).toBe('/');
+ });
+
+ it('applies secure default false when field is missing', () => {
+ const result = importCookies(JSON.stringify([{ name: 'c', value: 'v', domain: 'x.com', path: '/' }]));
+ expect(result[0]!.secure).toBe(false);
+ });
+
+ it('applies httpOnly default false when field is missing', () => {
+ const result = importCookies(JSON.stringify([{ name: 'c', value: 'v', domain: 'x.com', path: '/' }]));
+ expect(result[0]!.httpOnly).toBe(false);
+ });
+
+ it('applies sameSite default "unspecified" when field is missing', () => {
+ const result = importCookies(JSON.stringify([{ name: 'c', value: 'v', domain: 'x.com', path: '/' }]));
+ expect(result[0]!.sameSite).toBe('unspecified');
+ });
+
+ it('preserves explicitly-set fields over defaults', () => {
+ const result = importCookies(
+ JSON.stringify([
+ { name: 'c', value: 'v', domain: 'x.com', path: '/sub', secure: true, httpOnly: true, sameSite: 'strict' },
+ ]),
+ );
+ expect(result[0]!.path).toBe('/sub');
+ expect(result[0]!.secure).toBe(true);
+ expect(result[0]!.httpOnly).toBe(true);
+ expect(result[0]!.sameSite).toBe('strict');
+ });
+});
diff --git a/tests/cookies/cookieService.test.ts b/tests/cookies/cookieService.test.ts
new file mode 100644
index 0000000..64a9ccf
--- /dev/null
+++ b/tests/cookies/cookieService.test.ts
@@ -0,0 +1,570 @@
+/**
+ * Tests for src/services/cookies/cookieService.ts
+ *
+ * Contract: CONTRACTS.md §2
+ * PRD: §9.1 (cookie editor — free forever)
+ *
+ * Every test MUST:
+ * - fail against the current stub (NotImplementedError or clean assertion)
+ * - pass only against a correct implementation
+ * - fail if the implementation is wrong or an edge case is unhandled
+ * Never assert that a function throws NotImplementedError.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { makeCookie } from '../harness/factories';
+import {
+ listCookies,
+ setCookie,
+ deleteCookie,
+ deleteAllForSite,
+} from '@/services/cookies/cookieService';
+import type { CookieRecord } from '@/types/models';
+
+beforeEach(() => {
+ control.reset();
+});
+
+// ---------------------------------------------------------------------------
+// listCookies
+// ---------------------------------------------------------------------------
+
+describe('listCookies', () => {
+ it('returns an empty array when no cookies exist for the origin', async () => {
+ control.seedCookies([{ name: 'other', domain: 'other.com' }]);
+ const result = await listCookies('https://example.com');
+ expect(result).toEqual([]);
+ });
+
+ it('returns cookies whose domain exactly matches the origin registrable domain', async () => {
+ control.seedCookies([
+ { name: 'exact', domain: 'example.com', value: 'v1' },
+ { name: 'other', domain: 'other.com', value: 'v2' },
+ ]);
+ const result = await listCookies('https://example.com');
+ expect(result).toHaveLength(1);
+ expect(result[0]!.name).toBe('exact');
+ });
+
+ it('includes cookies set on subdomains of the origin', async () => {
+ control.seedCookies([
+ { name: 'root', domain: 'example.com', value: 'r' },
+ { name: 'sub', domain: 'api.example.com', value: 's' },
+ { name: 'deep', domain: 'cdn.static.example.com', value: 'd' },
+ ]);
+ const result = await listCookies('https://example.com');
+ const names = result.map((c) => c.name).sort();
+ expect(names).toContain('root');
+ expect(names).toContain('sub');
+ expect(names).toContain('deep');
+ });
+
+ it('does NOT include cookies from unrelated domains', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com' },
+ { name: 'b', domain: 'notexample.com' },
+ { name: 'c', domain: 'evil-example.com' },
+ ]);
+ const result = await listCookies('https://example.com');
+ const names = result.map((c) => c.name);
+ expect(names).not.toContain('b');
+ expect(names).not.toContain('c');
+ });
+
+ it('maps secure flag faithfully', async () => {
+ control.seedCookies([
+ { name: 'sec', domain: 'example.com', secure: true },
+ { name: 'plain', domain: 'example.com', secure: false },
+ ]);
+ const result = await listCookies('https://example.com');
+ const byName = Object.fromEntries(result.map((c) => [c.name, c]));
+ expect(byName['sec']!.secure).toBe(true);
+ expect(byName['plain']!.secure).toBe(false);
+ });
+
+ it('maps httpOnly flag faithfully', async () => {
+ control.seedCookies([
+ { name: 'ho', domain: 'example.com', httpOnly: true },
+ { name: 'nho', domain: 'example.com', httpOnly: false },
+ ]);
+ const result = await listCookies('https://example.com');
+ const byName = Object.fromEntries(result.map((c) => [c.name, c]));
+ expect(byName['ho']!.httpOnly).toBe(true);
+ expect(byName['nho']!.httpOnly).toBe(false);
+ });
+
+ it('maps sameSite values faithfully (all four variants)', async () => {
+ const sameSiteValues = ['no_restriction', 'lax', 'strict', 'unspecified'] as const;
+ for (const ss of sameSiteValues) {
+ control.reset();
+ control.seedCookies([{ name: 'c', domain: 'example.com', sameSite: ss }]);
+ const result = await listCookies('https://example.com');
+ expect(result[0]!.sameSite).toBe(ss);
+ }
+ });
+
+ it('maps expirationDate faithfully (session cookie has no expirationDate)', async () => {
+ const expiry = 4102444800; // 2100-01-01
+ control.seedCookies([
+ { name: 'persistent', domain: 'example.com', expirationDate: expiry, session: false },
+ { name: 'session', domain: 'example.com', session: true },
+ ]);
+ const result = await listCookies('https://example.com');
+ const byName = Object.fromEntries(result.map((c) => [c.name, c]));
+ expect(byName['persistent']!.expirationDate).toBe(expiry);
+ expect(byName['session']!.expirationDate).toBeUndefined();
+ });
+
+ it('maps partitionKey faithfully when present', async () => {
+ control.seedCookies([
+ {
+ name: 'partitioned',
+ domain: 'example.com',
+ partitionKey: { topLevelSite: 'https://top.com' },
+ },
+ ]);
+ const result = await listCookies('https://example.com');
+ expect(result[0]!.partitionKey).toBeTruthy();
+ });
+
+ it('maps storeId faithfully', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com', storeId: '42' }]);
+ const result = await listCookies('https://example.com');
+ expect(result[0]!.storeId).toBe('42');
+ });
+
+ it('maps hostOnly faithfully', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com', hostOnly: true }]);
+ const result = await listCookies('https://example.com');
+ expect(result[0]!.hostOnly).toBe(true);
+ });
+
+ it('maps session flag faithfully', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com', session: true }]);
+ const result = await listCookies('https://example.com');
+ expect(result[0]!.session).toBe(true);
+ });
+
+ it('returns CookieRecord[] (has required fields: name, value, domain, path, secure, httpOnly, sameSite)', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com', value: 'val', path: '/app' }]);
+ const result = await listCookies('https://example.com');
+ expect(result).toHaveLength(1);
+ const c = result[0]!;
+ expect(typeof c.name).toBe('string');
+ expect(typeof c.value).toBe('string');
+ expect(typeof c.domain).toBe('string');
+ expect(typeof c.path).toBe('string');
+ expect(typeof c.secure).toBe('boolean');
+ expect(typeof c.httpOnly).toBe('boolean');
+ expect(typeof c.sameSite).toBe('string');
+ });
+
+ it('locked defaults to absent/false on listed records (not set by listCookies)', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com' }]);
+ const result = await listCookies('https://example.com');
+ // locked is a UI-layer annotation; listCookies should not set it to true
+ expect(result[0]!.locked).toBeFalsy();
+ });
+
+ it('path field is preserved on each cookie record', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com', path: '/api/v2' }]);
+ const result = await listCookies('https://example.com');
+ expect(result[0]!.path).toBe('/api/v2');
+ });
+
+ it('handles origin with path component (uses domain portion only)', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com' }]);
+ const result = await listCookies('https://example.com/some/deep/path');
+ expect(result).toHaveLength(1);
+ });
+
+ it('handles origin with port (ignores port, matches on domain)', async () => {
+ control.seedCookies([{ name: 'c', domain: 'localhost' }]);
+ const result = await listCookies('http://localhost:3000');
+ expect(result).toHaveLength(1);
+ });
+
+ it('returns multiple cookies in an array (not just the first)', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com' },
+ { name: 'b', domain: 'example.com' },
+ { name: 'c', domain: 'example.com' },
+ ]);
+ const result = await listCookies('https://example.com');
+ expect(result.length).toBeGreaterThanOrEqual(3);
+ const names = result.map((c) => c.name);
+ expect(names).toContain('a');
+ expect(names).toContain('b');
+ expect(names).toContain('c');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// setCookie — create
+// ---------------------------------------------------------------------------
+
+describe('setCookie — create', () => {
+ it('creates a new cookie in the chrome store', async () => {
+ const cookie = makeCookie({ name: 'newCookie', value: 'hello', domain: 'example.com', secure: false });
+ await setCookie(cookie);
+ const stored = control.getCookies();
+ expect(stored.some((c) => c.name === 'newCookie' && c.value === 'hello')).toBe(true);
+ });
+
+ it('uses https scheme in url when secure is true', async () => {
+ const cookie = makeCookie({ name: 'sec', domain: 'example.com', secure: true });
+ await setCookie(cookie);
+ // Verify chrome.cookies.set was called with a url starting with https://
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ url: expect.stringMatching(/^https:\/\//) }),
+ );
+ });
+
+ it('uses http scheme in url when secure is false', async () => {
+ const cookie = makeCookie({ name: 'plain', domain: 'example.com', secure: false });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ url: expect.stringMatching(/^http:\/\//) }),
+ );
+ });
+
+ it('constructs url from domain + path', async () => {
+ const cookie = makeCookie({ name: 'c', domain: 'example.com', path: '/app', secure: false });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ url: expect.stringContaining('example.com') }),
+ );
+ });
+
+ it('passes name and value to chrome.cookies.set', async () => {
+ const cookie = makeCookie({ name: 'myKey', value: 'myVal', domain: 'example.com' });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ name: 'myKey', value: 'myVal' }),
+ );
+ });
+
+ it('passes domain to chrome.cookies.set', async () => {
+ const cookie = makeCookie({ name: 'c', domain: 'example.com' });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ domain: expect.stringContaining('example.com') }),
+ );
+ });
+
+ it('passes path to chrome.cookies.set', async () => {
+ const cookie = makeCookie({ name: 'c', domain: 'example.com', path: '/deep/path' });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ path: '/deep/path' }),
+ );
+ });
+
+ it('passes httpOnly flag to chrome.cookies.set', async () => {
+ const cookie = makeCookie({ name: 'c', domain: 'example.com', httpOnly: true });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ httpOnly: true }),
+ );
+ });
+
+ it('passes sameSite to chrome.cookies.set', async () => {
+ const cookie = makeCookie({ name: 'c', domain: 'example.com', sameSite: 'strict' });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ sameSite: 'strict' }),
+ );
+ });
+
+ it('passes expirationDate when present', async () => {
+ const expiry = 4102444800;
+ const cookie = makeCookie({ name: 'c', domain: 'example.com', expirationDate: expiry });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ expirationDate: expiry }),
+ );
+ });
+
+ it('passes storeId when present', async () => {
+ const cookie = makeCookie({ name: 'c', domain: 'example.com', storeId: '1' });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ storeId: '1' }),
+ );
+ });
+
+ it('passes partitionKey when present', async () => {
+ const cookie = makeCookie({
+ name: 'c',
+ domain: 'example.com',
+ partitionKey: 'https://top.com',
+ });
+ await setCookie(cookie);
+ expect(chrome.cookies.set).toHaveBeenCalledWith(
+ expect.objectContaining({ partitionKey: 'https://top.com' }),
+ );
+ });
+
+ it('does NOT include partitionKey when absent', async () => {
+ const { partitionKey: _pk, ...rest } = makeCookie({ name: 'c', domain: 'example.com' });
+ const cookie: CookieRecord = { ...rest };
+ await setCookie(cookie);
+ const call = (chrome.cookies.set as ReturnType).mock.calls[0]![0] as Record;
+ // partitionKey should not be explicitly set (or should be undefined/absent)
+ expect(call['partitionKey']).toBeUndefined();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// setCookie — update (idempotent / upsert)
+// ---------------------------------------------------------------------------
+
+describe('setCookie — update', () => {
+ it('updates an existing cookie value without duplicating it', async () => {
+ control.seedCookies([{ name: 'session', domain: 'example.com', value: 'old', path: '/' }]);
+ const updated = makeCookie({ name: 'session', domain: 'example.com', value: 'new', path: '/' });
+ await setCookie(updated);
+ const stored = control.getCookies().filter((c) => c.name === 'session' && c.domain === 'example.com');
+ expect(stored).toHaveLength(1);
+ expect(stored[0]!.value).toBe('new');
+ });
+
+ it('can update flags on an existing cookie', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com', httpOnly: false }]);
+ await setCookie(makeCookie({ name: 'c', domain: 'example.com', httpOnly: true, secure: false }));
+ const stored = control.getCookies().filter((c) => c.name === 'c');
+ expect(stored[0]!.httpOnly).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// deleteCookie
+// ---------------------------------------------------------------------------
+
+describe('deleteCookie', () => {
+ it('removes the targeted cookie by name + domain + path', async () => {
+ control.seedCookies([
+ { name: 'target', domain: 'example.com', path: '/' },
+ { name: 'keep', domain: 'example.com', path: '/' },
+ ]);
+ await deleteCookie({ name: 'target', domain: 'example.com', path: '/' });
+ const remaining = control.getCookies().map((c) => c.name);
+ expect(remaining).not.toContain('target');
+ expect(remaining).toContain('keep');
+ });
+
+ it('calls chrome.cookies.remove with the correct url', async () => {
+ control.seedCookies([{ name: 'c', domain: 'example.com', path: '/', secure: false }]);
+ await deleteCookie({ name: 'c', domain: 'example.com', path: '/' });
+ expect(chrome.cookies.remove).toHaveBeenCalledWith(
+ expect.objectContaining({ name: 'c', url: expect.stringContaining('example.com') }),
+ );
+ });
+
+ it('does not remove a cookie with a different name', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com' },
+ { name: 'b', domain: 'example.com' },
+ ]);
+ await deleteCookie({ name: 'a', domain: 'example.com', path: '/' });
+ expect(control.getCookies().some((c) => c.name === 'b')).toBe(true);
+ });
+
+ it('does not remove a cookie with a different domain', async () => {
+ control.seedCookies([
+ { name: 'c', domain: 'example.com' },
+ { name: 'c', domain: 'other.com' },
+ ]);
+ await deleteCookie({ name: 'c', domain: 'example.com', path: '/' });
+ expect(control.getCookies().some((c) => c.domain === 'other.com')).toBe(true);
+ });
+
+ it('does not remove a cookie with a different path', async () => {
+ control.seedCookies([
+ { name: 'c', domain: 'example.com', path: '/admin' },
+ { name: 'c', domain: 'example.com', path: '/public' },
+ ]);
+ await deleteCookie({ name: 'c', domain: 'example.com', path: '/admin' });
+ expect(control.getCookies().some((c) => c.path === '/public')).toBe(true);
+ });
+
+ it('is a no-op (does not throw) when the cookie does not exist', async () => {
+ await expect(
+ deleteCookie({ name: 'nonexistent', domain: 'example.com', path: '/' }),
+ ).resolves.not.toThrow();
+ });
+
+ it('does NOT delete a locked cookie — cookie remains after attempt', async () => {
+ control.seedCookies([{ name: 'locked', domain: 'example.com', path: '/' }]);
+ // The lock is tracked inside the service; we pass locked:true in the cookie shape.
+ // The service must honour the locked field on the CookieRecord passed to deleteCookie
+ // OR it must have a separate lock-set seeded through its own API.
+ // Contract: if the cookie is marked locked, deleteCookie is a no-op.
+ const lockedCookie: CookieRecord = makeCookie({
+ name: 'locked',
+ domain: 'example.com',
+ path: '/',
+ locked: true,
+ });
+ // Attempt to delete by identity — should not succeed
+ await deleteCookie({ name: 'locked', domain: 'example.com', path: '/' });
+ // Because the lock state is stored in the service, we test via the assumption
+ // that the implementation will check its lock set. We verify the raw chrome API
+ // was NOT called to remove (implementation must not remove locked cookies).
+ // If the implementation is correct, chrome.cookies.remove is either not called
+ // OR called but the cookie is still in the store.
+ // We assert the cookie remains in the fake store.
+ // NOTE: This test will FAIL against the stub (NotImplementedError) as required.
+ // The seam: the implementation must expose a way to mark cookies locked
+ // (e.g. chrome.storage.local key 'lockedCookies'). The test seeds the lock
+ // by writing directly to storage.
+ control.seedStorage({
+ lockedCookies: [{ name: 'locked', domain: 'example.com', path: '/' }],
+ });
+ control.reset();
+ control.seedCookies([{ name: 'locked', domain: 'example.com', path: '/' }]);
+ control.seedStorage({
+ lockedCookies: [{ name: 'locked', domain: 'example.com', path: '/' }],
+ });
+ await deleteCookie({ name: 'locked', domain: 'example.com', path: '/' });
+ expect(control.getCookies().some((c) => c.name === 'locked')).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// deleteCookie — CHIPS / partitioned cookies
+// ---------------------------------------------------------------------------
+
+describe('deleteCookie — CHIPS partitioned cookies', () => {
+ it('deletes only the cookie matching the specified partitionKey, leaving the other', async () => {
+ control.seedCookies([
+ {
+ name: 'token',
+ domain: 'example.com',
+ path: '/',
+ partitionKey: { topLevelSite: 'https://site-a.com' },
+ },
+ {
+ name: 'token',
+ domain: 'example.com',
+ path: '/',
+ partitionKey: { topLevelSite: 'https://site-b.com' },
+ },
+ ]);
+
+ // Delete only the site-a partition
+ await deleteCookie({
+ name: 'token',
+ domain: 'example.com',
+ path: '/',
+ partitionKey: 'https://site-a.com',
+ });
+
+ // site-b cookie must survive
+ const remaining = control.getCookies();
+ const siteB = remaining.find(
+ (c) =>
+ c.name === 'token' &&
+ JSON.stringify(c.partitionKey ?? null).includes('site-b'),
+ );
+ expect(siteB).toBeDefined();
+ });
+
+ it('both partitioned cookies exist before any deletion', async () => {
+ control.seedCookies([
+ {
+ name: 'token',
+ domain: 'example.com',
+ path: '/',
+ partitionKey: { topLevelSite: 'https://site-a.com' },
+ },
+ {
+ name: 'token',
+ domain: 'example.com',
+ path: '/',
+ partitionKey: { topLevelSite: 'https://site-b.com' },
+ },
+ ]);
+ const all = control.getCookies();
+ const tokens = all.filter((c) => c.name === 'token' && c.domain === 'example.com');
+ expect(tokens).toHaveLength(2);
+ });
+
+ it('passes partitionKey to chrome.cookies.remove', async () => {
+ control.seedCookies([
+ { name: 'c', domain: 'example.com', path: '/', partitionKey: { topLevelSite: 'https://top.com' } },
+ ]);
+ await deleteCookie({
+ name: 'c',
+ domain: 'example.com',
+ path: '/',
+ partitionKey: 'https://top.com',
+ });
+ expect(chrome.cookies.remove).toHaveBeenCalledWith(
+ expect.objectContaining({ partitionKey: expect.anything() }),
+ );
+ });
+});
+
+// ---------------------------------------------------------------------------
+// deleteAllForSite
+// ---------------------------------------------------------------------------
+
+describe('deleteAllForSite', () => {
+ it('returns 0 when there are no cookies for the origin', async () => {
+ control.seedCookies([{ name: 'other', domain: 'other.com' }]);
+ const count = await deleteAllForSite('https://example.com');
+ expect(count).toBe(0);
+ });
+
+ it('deletes all non-locked cookies for the origin and returns count', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com' },
+ { name: 'b', domain: 'example.com' },
+ { name: 'c', domain: 'example.com' },
+ ]);
+ const count = await deleteAllForSite('https://example.com');
+ expect(count).toBe(3);
+ const remaining = control.getCookies().filter((c) => c.domain.includes('example.com'));
+ expect(remaining).toHaveLength(0);
+ });
+
+ it('does NOT delete cookies from other sites', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com' },
+ { name: 'b', domain: 'other.com' },
+ ]);
+ await deleteAllForSite('https://example.com');
+ expect(control.getCookies().some((c) => c.name === 'b')).toBe(true);
+ });
+
+ it('count includes subdomain cookies that were deleted', async () => {
+ control.seedCookies([
+ { name: 'root', domain: 'example.com' },
+ { name: 'api', domain: 'api.example.com' },
+ ]);
+ const count = await deleteAllForSite('https://example.com');
+ expect(count).toBeGreaterThanOrEqual(2);
+ });
+
+ it('preserves locked cookies and does NOT count them in the return value', async () => {
+ control.seedCookies([
+ { name: 'normal', domain: 'example.com' },
+ { name: 'protected', domain: 'example.com' },
+ ]);
+ control.seedStorage({
+ lockedCookies: [{ name: 'protected', domain: 'example.com', path: '/' }],
+ });
+ const count = await deleteAllForSite('https://example.com');
+ // Only the non-locked cookie should be deleted; count must NOT include locked ones
+ expect(count).toBe(1);
+ expect(control.getCookies().some((c) => c.name === 'protected')).toBe(true);
+ });
+
+ it('returns an integer (not a float or string)', async () => {
+ control.seedCookies([{ name: 'a', domain: 'example.com' }]);
+ const count = await deleteAllForSite('https://example.com');
+ expect(Number.isInteger(count)).toBe(true);
+ });
+});
diff --git a/tests/cookies/netscapeFormat.test.ts b/tests/cookies/netscapeFormat.test.ts
new file mode 100644
index 0000000..8dd95e3
--- /dev/null
+++ b/tests/cookies/netscapeFormat.test.ts
@@ -0,0 +1,334 @@
+/**
+ * Tests for src/services/cookies/netscapeFormat.ts
+ *
+ * Contract: CONTRACTS.md §1 (Netscape format — P1)
+ * PRD: §9.1 ("Netscape cookies.txt import/export is P1")
+ *
+ * These are P1 contract tests. They encode the spec so the implementation,
+ * once written, passes them. They must fail against the current stub
+ * (NotImplementedError or assertion). Never assert NotImplementedError.
+ *
+ * Netscape cookies.txt format:
+ * - Header comment lines starting with '#' are ignored on import
+ * - Columns (tab-separated): domain includeSubdomains path secure expires name value
+ * - includeSubdomains: "TRUE" if domain starts with '.', else "FALSE"
+ * - secure: "TRUE" / "FALSE"
+ * - expires: Unix timestamp (integer), 0 for session cookies
+ * - HttpOnly cookies: line prefixed with "#HttpOnly_" followed by domain (no leading '#' on remaining cols)
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { makeCookie } from '../harness/factories';
+import { importNetscape, exportNetscape } from '@/services/cookies/netscapeFormat';
+import type { CookieRecord } from '@/types/models';
+
+beforeEach(() => {
+ control.reset();
+});
+
+// ---------------------------------------------------------------------------
+// Fixtures
+// ---------------------------------------------------------------------------
+
+/**
+ * A minimal well-formed Netscape cookies.txt.
+ * Columns: domain TAB includeSubdomains TAB path TAB secure TAB expires TAB name TAB value
+ */
+const NETSCAPE_MINIMAL = [
+ '# Netscape HTTP Cookie File',
+ 'example.com\tFALSE\t/\tFALSE\t0\tsession\tabc',
+].join('\n');
+
+/**
+ * A more complete Netscape file exercising all flags.
+ */
+const NETSCAPE_FULL = [
+ '# Netscape HTTP Cookie File',
+ '# Generated by Sessionist',
+ '.example.com\tTRUE\t/\tTRUE\t4102444800\tauth\ttoken123',
+ 'other.com\tFALSE\t/api\tFALSE\t0\tpref\tdark',
+ '#HttpOnly_.secure.com\tFALSE\t/\tTRUE\t4102444800\thttponly_cookie\thidden',
+].join('\n');
+
+// ---------------------------------------------------------------------------
+// exportNetscape
+// ---------------------------------------------------------------------------
+
+describe('exportNetscape', () => {
+ it('returns a non-empty string for a non-empty input', () => {
+ const result = exportNetscape([makeCookie()]);
+ expect(typeof result).toBe('string');
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('returns a string (may be just a header) for empty input', () => {
+ const result = exportNetscape([]);
+ expect(typeof result).toBe('string');
+ });
+
+ it('includes the cookie name in the output', () => {
+ const result = exportNetscape([makeCookie({ name: 'myToken' })]);
+ expect(result).toContain('myToken');
+ });
+
+ it('includes the cookie value in the output', () => {
+ const result = exportNetscape([makeCookie({ value: 'secret-value' })]);
+ expect(result).toContain('secret-value');
+ });
+
+ it('includes the domain in the output', () => {
+ const result = exportNetscape([makeCookie({ domain: 'example.com' })]);
+ expect(result).toContain('example.com');
+ });
+
+ it('includes the path in the output', () => {
+ const result = exportNetscape([makeCookie({ path: '/api/v1' })]);
+ expect(result).toContain('/api/v1');
+ });
+
+ it('marks secure cookies with TRUE in the secure column', () => {
+ const result = exportNetscape([makeCookie({ secure: true })]);
+ expect(result).toContain('TRUE');
+ });
+
+ it('marks non-secure cookies with FALSE in the secure column', () => {
+ const result = exportNetscape([makeCookie({ secure: false })]);
+ expect(result).toContain('FALSE');
+ });
+
+ it('includes expirationDate as Unix timestamp when present', () => {
+ const expiry = 4102444800;
+ const result = exportNetscape([makeCookie({ expirationDate: expiry })]);
+ expect(result).toContain(String(expiry));
+ });
+
+ it('uses 0 (or omits) expiry for session cookies without expirationDate', () => {
+ const { expirationDate: _e, ...rest } = makeCookie();
+ const sessionCookie: CookieRecord = { ...rest, session: true };
+ const result = exportNetscape([sessionCookie]);
+ // Session cookies have expiry 0 or the absence of a future timestamp
+ // The output should not contain the cookie's expiry as a large number
+ expect(result).not.toContain('4102444800');
+ });
+
+ it('uses leading-dot domain with TRUE includeSubdomains for subdomain cookies', () => {
+ const result = exportNetscape([makeCookie({ domain: '.example.com', hostOnly: false })]);
+ // Should have .example.com in output along with TRUE for includeSubdomains
+ expect(result).toContain('.example.com');
+ expect(result).toContain('TRUE');
+ });
+
+ it('uses FALSE includeSubdomains for host-only cookies', () => {
+ const result = exportNetscape([makeCookie({ domain: 'example.com', hostOnly: true })]);
+ expect(result).toContain('FALSE');
+ });
+
+ it('prefixes httpOnly cookies with #HttpOnly_', () => {
+ const result = exportNetscape([makeCookie({ httpOnly: true, domain: 'example.com' })]);
+ expect(result).toContain('#HttpOnly_');
+ });
+
+ it('does NOT prefix non-httpOnly cookies with #HttpOnly_', () => {
+ const result = exportNetscape([makeCookie({ httpOnly: false })]);
+ expect(result).not.toContain('#HttpOnly_');
+ });
+
+ it('uses tab separators between columns', () => {
+ const result = exportNetscape([makeCookie()]);
+ // At least one tab in the data lines
+ const lines = result.split('\n').filter((l) => !l.startsWith('#') && l.trim().length > 0);
+ expect(lines.length).toBeGreaterThan(0);
+ expect(lines[0]).toContain('\t');
+ });
+
+ it('exports multiple cookies as multiple lines', () => {
+ const cookies = [
+ makeCookie({ name: 'a' }),
+ makeCookie({ name: 'b' }),
+ ];
+ const result = exportNetscape(cookies);
+ expect(result).toContain('a');
+ expect(result).toContain('b');
+ const dataLines = result.split('\n').filter((l) => !l.startsWith('#') && l.trim().length > 0);
+ expect(dataLines).toHaveLength(2);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// importNetscape
+// ---------------------------------------------------------------------------
+
+describe('importNetscape', () => {
+ it('imports the minimal Netscape sample without throwing', () => {
+ expect(() => importNetscape(NETSCAPE_MINIMAL)).not.toThrow();
+ });
+
+ it('returns an array', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ expect(Array.isArray(result)).toBe(true);
+ });
+
+ it('parses the cookie name from a Netscape line', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ expect(result.some((c) => c.name === 'session')).toBe(true);
+ });
+
+ it('parses the cookie value from a Netscape line', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ expect(result.find((c) => c.name === 'session')!.value).toBe('abc');
+ });
+
+ it('parses the domain from a Netscape line', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ expect(result[0]!.domain).toBe('example.com');
+ });
+
+ it('parses the path from a Netscape line', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ expect(result[0]!.path).toBe('/');
+ });
+
+ it('parses secure=FALSE as false', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ expect(result.find((c) => c.name === 'session')!.secure).toBe(false);
+ });
+
+ it('parses secure=TRUE as true (full sample)', () => {
+ const result = importNetscape(NETSCAPE_FULL);
+ const auth = result.find((c) => c.name === 'auth');
+ expect(auth).toBeDefined();
+ expect(auth!.secure).toBe(true);
+ });
+
+ it('ignores # comment lines that are not #HttpOnly_', () => {
+ const result = importNetscape(NETSCAPE_FULL);
+ // The two comment lines do not produce cookie records
+ // NETSCAPE_FULL has 3 data cookies (auth, pref, httponly_cookie)
+ expect(result.length).toBeGreaterThanOrEqual(3);
+ });
+
+ it('parses expirationDate from Netscape timestamp', () => {
+ const result = importNetscape(NETSCAPE_FULL);
+ const auth = result.find((c) => c.name === 'auth');
+ expect(auth!.expirationDate).toBe(4102444800);
+ });
+
+ it('leaves expirationDate undefined for expiry=0 (session cookie)', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ const session = result.find((c) => c.name === 'session');
+ // Expiry 0 means session cookie — expirationDate should be absent or undefined
+ expect(session!.expirationDate).toBeUndefined();
+ });
+
+ it('sets domain with leading dot when includeSubdomains=TRUE', () => {
+ const result = importNetscape(NETSCAPE_FULL);
+ const auth = result.find((c) => c.name === 'auth');
+ expect(auth!.domain).toBe('.example.com');
+ });
+
+ it('sets domain without leading dot when includeSubdomains=FALSE', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ expect(result[0]!.domain).not.toMatch(/^\./);
+ });
+
+ it('recognises the #HttpOnly_ prefix and sets httpOnly=true', () => {
+ const result = importNetscape(NETSCAPE_FULL);
+ const hoC = result.find((c) => c.name === 'httponly_cookie');
+ expect(hoC).toBeDefined();
+ expect(hoC!.httpOnly).toBe(true);
+ });
+
+ it('sets httpOnly=false for normal (non-#HttpOnly_) lines', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ expect(result[0]!.httpOnly).toBe(false);
+ });
+
+ it('returns CookieRecord[] with required fields after import', () => {
+ const result = importNetscape(NETSCAPE_MINIMAL);
+ const c = result[0]!;
+ expect(typeof c.name).toBe('string');
+ expect(typeof c.value).toBe('string');
+ expect(typeof c.domain).toBe('string');
+ expect(typeof c.path).toBe('string');
+ expect(typeof c.secure).toBe('boolean');
+ expect(typeof c.httpOnly).toBe('boolean');
+ });
+
+ it('returns empty array for input with only comment lines', () => {
+ const onlyComments = '# Netscape HTTP Cookie File\n# another comment\n';
+ const result = importNetscape(onlyComments);
+ expect(result).toEqual([]);
+ });
+
+ it('returns empty array for empty string', () => {
+ const result = importNetscape('');
+ expect(result).toEqual([]);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Round-trip: exportNetscape → importNetscape
+// ---------------------------------------------------------------------------
+
+describe('round-trip: exportNetscape → importNetscape', () => {
+ it('round-trips name', () => {
+ const cookies = [makeCookie({ name: 'myToken', secure: false })];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported.some((c) => c.name === 'myToken')).toBe(true);
+ });
+
+ it('round-trips value', () => {
+ const cookies = [makeCookie({ value: 'abc123', secure: false })];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported[0]!.value).toBe('abc123');
+ });
+
+ it('round-trips domain', () => {
+ const cookies = [makeCookie({ domain: 'api.example.com', secure: false })];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported.some((c) => c.domain.includes('api.example.com'))).toBe(true);
+ });
+
+ it('round-trips path', () => {
+ const cookies = [makeCookie({ path: '/v2', secure: false })];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported[0]!.path).toBe('/v2');
+ });
+
+ it('round-trips secure=true', () => {
+ const cookies = [makeCookie({ secure: true })];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported[0]!.secure).toBe(true);
+ });
+
+ it('round-trips secure=false', () => {
+ const cookies = [makeCookie({ secure: false })];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported[0]!.secure).toBe(false);
+ });
+
+ it('round-trips httpOnly=true via #HttpOnly_ prefix', () => {
+ const cookies = [makeCookie({ httpOnly: true, secure: false })];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported[0]!.httpOnly).toBe(true);
+ });
+
+ it('round-trips expirationDate', () => {
+ const expiry = 4102444800;
+ const cookies = [makeCookie({ expirationDate: expiry })];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported[0]!.expirationDate).toBe(expiry);
+ });
+
+ it('round-trips multiple cookies', () => {
+ const cookies = [
+ makeCookie({ name: 'a', value: 'va' }),
+ makeCookie({ name: 'b', value: 'vb' }),
+ ];
+ const imported = importNetscape(exportNetscape(cookies));
+ expect(imported.length).toBeGreaterThanOrEqual(2);
+ expect(imported.some((c) => c.name === 'a' && c.value === 'va')).toBe(true);
+ expect(imported.some((c) => c.name === 'b' && c.value === 'vb')).toBe(true);
+ });
+});
diff --git a/tests/cookies/router.cookies.test.ts b/tests/cookies/router.cookies.test.ts
new file mode 100644
index 0000000..bcd5658
--- /dev/null
+++ b/tests/cookies/router.cookies.test.ts
@@ -0,0 +1,322 @@
+/**
+ * Router integration tests for cookie-related message types.
+ *
+ * Contract: CONTRACTS.md §13 (messaging/router)
+ * PRD: §13.1, §13.3
+ *
+ * These tests drive chrome.runtime.sendMessage → backgroundMessageListener →
+ * handleRequest → cookie services and assert the BgEnvelope shape.
+ *
+ * Because the cookie services are stubs (NotImplementedError), every test that
+ * calls a stub service will receive { ok: false, error: 'NotImplementedError: ...' }.
+ * The tests assert the *shape* contract: every route returns a BgEnvelope; the
+ * router does not crash with an import/infra error; the error string is sanitized.
+ * When the service is implemented the same tests assert the success shape.
+ *
+ * Tests that check the success path (ok: true + typed value) will fail against
+ * the stub and pass only when the service is implemented correctly.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { makeCookie } from '../harness/factories';
+import { backgroundMessageListener } from '@/background/messageHandler';
+import { handleRequest } from '@/background/router';
+import type { BgEnvelope } from '@/types/messages';
+import type { CookieRecord } from '@/types/models';
+
+beforeEach(() => {
+ control.reset();
+ // Register the listener on the fake chrome runtime so sendMessage dispatches it.
+ chrome.runtime.onMessage.addListener(backgroundMessageListener as Parameters[0]);
+});
+
+// ---------------------------------------------------------------------------
+// Helper: send a message through the full stack and unwrap the envelope
+// ---------------------------------------------------------------------------
+
+async function send(message: unknown): Promise> {
+ return chrome.runtime.sendMessage(message) as Promise>;
+}
+
+// ---------------------------------------------------------------------------
+// Router: every cookie route returns a BgEnvelope (never throws uncaught)
+// ---------------------------------------------------------------------------
+
+describe('router — envelope contract (applies to stub & implemented)', () => {
+ it('cookies/list returns a BgEnvelope with ok:boolean', async () => {
+ const resp = await send({ type: 'cookies/list', origin: 'https://example.com' });
+ expect(resp).toHaveProperty('ok');
+ expect(typeof resp.ok).toBe('boolean');
+ });
+
+ it('cookies/set returns a BgEnvelope with ok:boolean', async () => {
+ const resp = await send({ type: 'cookies/set', cookie: makeCookie() });
+ expect(resp).toHaveProperty('ok');
+ expect(typeof resp.ok).toBe('boolean');
+ });
+
+ it('cookies/delete returns a BgEnvelope with ok:boolean', async () => {
+ const resp = await send({
+ type: 'cookies/delete',
+ cookie: { name: 'c', domain: 'example.com', path: '/' },
+ });
+ expect(resp).toHaveProperty('ok');
+ expect(typeof resp.ok).toBe('boolean');
+ });
+
+ it('cookies/deleteAll returns a BgEnvelope with ok:boolean', async () => {
+ const resp = await send({ type: 'cookies/deleteAll', origin: 'https://example.com' });
+ expect(resp).toHaveProperty('ok');
+ expect(typeof resp.ok).toBe('boolean');
+ });
+
+ it('cookies/import returns a BgEnvelope with ok:boolean', async () => {
+ const resp = await send({ type: 'cookies/import', json: '[]' });
+ expect(resp).toHaveProperty('ok');
+ expect(typeof resp.ok).toBe('boolean');
+ });
+
+ it('cookies/export returns a BgEnvelope with ok:boolean', async () => {
+ const resp = await send({ type: 'cookies/export', origin: 'https://example.com' });
+ expect(resp).toHaveProperty('ok');
+ expect(typeof resp.ok).toBe('boolean');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Router: error envelopes are sanitized (no secret leak)
+// ---------------------------------------------------------------------------
+
+describe('router — error sanitization (CONTRACTS.md §13)', () => {
+ it('cookies/list failure envelope has an error string (not an object)', async () => {
+ const resp = await send({ type: 'cookies/list', origin: 'https://example.com' });
+ if (!resp.ok) {
+ expect(typeof resp.error).toBe('string');
+ }
+ });
+
+ it('error string is non-empty when service throws', async () => {
+ const resp = await send({ type: 'cookies/list', origin: 'https://example.com' });
+ if (!resp.ok) {
+ expect(resp.error.length).toBeGreaterThan(0);
+ }
+ });
+
+ it('error string does not expose raw stack traces', async () => {
+ const resp = await send({ type: 'cookies/list', origin: 'https://example.com' });
+ if (!resp.ok) {
+ expect(resp.error).not.toContain('at ');
+ expect(resp.error).not.toContain('Object.');
+ }
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Router: ignores messages from foreign senders
+// ---------------------------------------------------------------------------
+
+describe('router — sender validation (CONTRACTS.md §13)', () => {
+ it('returns false / ignores messages from a different extension id', () => {
+ const responses: unknown[] = [];
+ const result = backgroundMessageListener(
+ { type: 'cookies/list', origin: 'https://x.com' },
+ { id: 'some-other-extension-id' } as chrome.runtime.MessageSender,
+ (r) => responses.push(r),
+ );
+ expect(result).toBe(false);
+ expect(responses).toHaveLength(0);
+ });
+
+ it('returns false for messages without a type field', () => {
+ const responses: unknown[] = [];
+ const result = backgroundMessageListener(
+ { notAType: true },
+ { id: chrome.runtime.id } as chrome.runtime.MessageSender,
+ (r) => responses.push(r),
+ );
+ expect(result).toBe(false);
+ expect(responses).toHaveLength(0);
+ });
+
+ it('returns false for non-object messages', () => {
+ const responses: unknown[] = [];
+ const result = backgroundMessageListener(
+ 'just a string',
+ { id: chrome.runtime.id } as chrome.runtime.MessageSender,
+ (r) => responses.push(r),
+ );
+ expect(result).toBe(false);
+ expect(responses).toHaveLength(0);
+ });
+
+ it('returns true (keeps channel open) for a valid same-extension message', () => {
+ const result = backgroundMessageListener(
+ { type: 'cookies/list', origin: 'https://example.com' },
+ { id: chrome.runtime.id } as chrome.runtime.MessageSender,
+ () => {},
+ );
+ expect(result).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// handleRequest: success path (FAILS against stub; passes when implemented)
+// ---------------------------------------------------------------------------
+
+describe('handleRequest cookies/list — success shape', () => {
+ it('returns CookieRecord[] when service is implemented', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com', value: 'v1' },
+ { name: 'b', domain: 'example.com', value: 'v2' },
+ ]);
+ const result = await handleRequest({ type: 'cookies/list', origin: 'https://example.com' });
+ expect(Array.isArray(result)).toBe(true);
+ const cookies = result as CookieRecord[];
+ expect(cookies.length).toBeGreaterThanOrEqual(2);
+ expect(cookies[0]).toHaveProperty('name');
+ expect(cookies[0]).toHaveProperty('value');
+ expect(cookies[0]).toHaveProperty('domain');
+ });
+
+ it('returns only cookies matching the requested origin', async () => {
+ control.seedCookies([
+ { name: 'target', domain: 'example.com', value: 'yes' },
+ { name: 'other', domain: 'other.com', value: 'no' },
+ ]);
+ const result = await handleRequest({ type: 'cookies/list', origin: 'https://example.com' }) as CookieRecord[];
+ expect(result.some((c) => c.name === 'target')).toBe(true);
+ expect(result.every((c) => !c.name.includes('other'))).toBe(true);
+ });
+});
+
+describe('handleRequest cookies/set — success shape', () => {
+ it('resolves without a value (void) when service is implemented', async () => {
+ const cookie = makeCookie({ name: 'setMe', domain: 'example.com', secure: false });
+ const result = await handleRequest({ type: 'cookies/set', cookie });
+ expect(result).toBeUndefined();
+ });
+
+ it('creates the cookie in the fake store when service is implemented', async () => {
+ const cookie = makeCookie({ name: 'newOne', domain: 'example.com', value: 'hi', secure: false });
+ await handleRequest({ type: 'cookies/set', cookie });
+ expect(control.getCookies().some((c) => c.name === 'newOne' && c.value === 'hi')).toBe(true);
+ });
+});
+
+describe('handleRequest cookies/delete — success shape', () => {
+ it('resolves without a value (void) when service is implemented', async () => {
+ control.seedCookies([{ name: 'del', domain: 'example.com', path: '/' }]);
+ const result = await handleRequest({
+ type: 'cookies/delete',
+ cookie: { name: 'del', domain: 'example.com', path: '/' },
+ });
+ expect(result).toBeUndefined();
+ });
+
+ it('removes the cookie from the fake store when service is implemented', async () => {
+ control.seedCookies([{ name: 'gone', domain: 'example.com', path: '/' }]);
+ await handleRequest({
+ type: 'cookies/delete',
+ cookie: { name: 'gone', domain: 'example.com', path: '/' },
+ });
+ expect(control.getCookies().some((c) => c.name === 'gone')).toBe(false);
+ });
+});
+
+describe('handleRequest cookies/deleteAll — success shape', () => {
+ it('returns a number when service is implemented', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com' },
+ { name: 'b', domain: 'example.com' },
+ ]);
+ const result = await handleRequest({ type: 'cookies/deleteAll', origin: 'https://example.com' });
+ expect(typeof result).toBe('number');
+ });
+
+ it('returns count >= number of seeded cookies when service is implemented', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com' },
+ { name: 'b', domain: 'example.com' },
+ ]);
+ const result = await handleRequest({ type: 'cookies/deleteAll', origin: 'https://example.com' }) as number;
+ expect(result).toBeGreaterThanOrEqual(2);
+ });
+});
+
+describe('handleRequest cookies/import — success shape', () => {
+ it('returns CookieRecord[] when service is implemented', async () => {
+ const json = JSON.stringify([
+ { name: 'imported', value: 'v', domain: 'x.com', path: '/', secure: false, httpOnly: false, sameSite: 'lax' },
+ ]);
+ const result = await handleRequest({ type: 'cookies/import', json });
+ expect(Array.isArray(result)).toBe(true);
+ const cookies = result as CookieRecord[];
+ expect(cookies[0]!.name).toBe('imported');
+ });
+
+ it('imported records have normalized fields when service is implemented', async () => {
+ const json = JSON.stringify([{ name: 'c', value: 'v', domain: 'x.com' }]);
+ const result = await handleRequest({ type: 'cookies/import', json }) as CookieRecord[];
+ expect(result[0]!.path).toBe('/');
+ expect(result[0]!.secure).toBe(false);
+ expect(result[0]!.httpOnly).toBe(false);
+ expect(result[0]!.sameSite).toBe('unspecified');
+ });
+});
+
+describe('handleRequest cookies/export — success shape', () => {
+ it('returns a JSON string when service is implemented', async () => {
+ control.seedCookies([{ name: 'exp', domain: 'example.com', value: 'v' }]);
+ const result = await handleRequest({ type: 'cookies/export', origin: 'https://example.com' });
+ expect(typeof result).toBe('string');
+ expect(() => JSON.parse(result as string)).not.toThrow();
+ });
+
+ it('exported JSON contains the origin cookies when service is implemented', async () => {
+ control.seedCookies([{ name: 'myC', domain: 'example.com', value: 'myV' }]);
+ const result = await handleRequest({ type: 'cookies/export', origin: 'https://example.com' }) as string;
+ const parsed = JSON.parse(result) as CookieRecord[];
+ expect(parsed.some((c) => c.name === 'myC')).toBe(true);
+ });
+
+ it('export round-trips through import without data loss when both are implemented', async () => {
+ const { makeCookie: _mc } = await import('../harness/factories');
+ control.seedCookies([
+ { name: 'rt', domain: 'example.com', value: 'rtval', secure: true, httpOnly: false, sameSite: 'lax' },
+ ]);
+ const exported = await handleRequest({ type: 'cookies/export', origin: 'https://example.com' }) as string;
+ const reimported = await handleRequest({ type: 'cookies/import', json: exported }) as CookieRecord[];
+ expect(reimported.some((c) => c.name === 'rt' && c.value === 'rtval')).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Router: envelope wraps success value (not: true without value)
+// ---------------------------------------------------------------------------
+
+describe('router — full envelope via sendMessage (success path when implemented)', () => {
+ it('cookies/list: ok:true envelope has value property that is an array', async () => {
+ control.seedCookies([{ name: 'z', domain: 'example.com' }]);
+ const resp = await send({ type: 'cookies/list', origin: 'https://example.com' });
+ if (resp.ok) {
+ expect(Array.isArray(resp.value)).toBe(true);
+ }
+ });
+
+ it('cookies/deleteAll: ok:true envelope has value property that is a number', async () => {
+ control.seedCookies([{ name: 'x', domain: 'example.com' }]);
+ const resp = await send({ type: 'cookies/deleteAll', origin: 'https://example.com' });
+ if (resp.ok) {
+ expect(typeof resp.value).toBe('number');
+ }
+ });
+
+ it('cookies/export: ok:true envelope has value property that is a string', async () => {
+ control.seedCookies([{ name: 'y', domain: 'example.com' }]);
+ const resp = await send({ type: 'cookies/export', origin: 'https://example.com' });
+ if (resp.ok) {
+ expect(typeof resp.value).toBe('string');
+ }
+ });
+});
diff --git a/tests/crypto/encryption.test.ts b/tests/crypto/encryption.test.ts
new file mode 100644
index 0000000..66e04de
--- /dev/null
+++ b/tests/crypto/encryption.test.ts
@@ -0,0 +1,260 @@
+/**
+ * Tests for src/services/crypto/encryption.ts (§13.5, CONTRACTS §6).
+ *
+ * WebCrypto (globalThis.crypto.subtle) is real in the jsdom test environment.
+ * Tests generate their own AES-GCM keys so they are self-contained and do not
+ * depend on keyManager.
+ *
+ * Contract (CONTRACTS.md §6):
+ * - encryptJson / decryptJson round-trip arbitrary JSON-serializable values.
+ * - EncryptedBlob has: v:1, alg:'AES-GCM', keyId (string), ciphertext (ArrayBuffer), iv (Uint8Array).
+ * - Fresh random 96-bit IV per call → two encryptions of the same value differ.
+ * - Decrypting with the WRONG key rejects.
+ * - Decrypting with a DIFFERENT aad than used to encrypt rejects (AAD binding).
+ * - Decrypting with the SAME aad as used to encrypt succeeds.
+ */
+
+import { describe, it, expect, beforeAll } from 'vitest';
+import { encryptJson, decryptJson } from '@/services/crypto/encryption';
+import type { EncryptedBlob } from '@/services/crypto/encryption';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+async function makeKey(): Promise {
+ return globalThis.crypto.subtle.generateKey(
+ { name: 'AES-GCM', length: 256 },
+ /* extractable */ true,
+ ['encrypt', 'decrypt'],
+ );
+}
+
+// ---------------------------------------------------------------------------
+// Suite
+// ---------------------------------------------------------------------------
+
+describe('encryption.encryptJson / decryptJson', () => {
+ let key: CryptoKey;
+ const KEY_ID = 'test-key-1';
+
+ beforeAll(async () => {
+ key = await makeKey();
+ });
+
+ // -------------------------------------------------------------------------
+ // EncryptedBlob shape
+ // -------------------------------------------------------------------------
+
+ it('returns a blob with v:1, alg:AES-GCM, keyId, ciphertext, iv', async () => {
+ const blob = await encryptJson(key, KEY_ID, { hello: 'world' });
+
+ expect(blob.v).toBe(1);
+ expect(blob.alg).toBe('AES-GCM');
+ expect(blob.keyId).toBe(KEY_ID);
+ expect(blob.ciphertext).toBeInstanceOf(ArrayBuffer);
+ expect(blob.iv).toBeInstanceOf(Uint8Array);
+ });
+
+ it('iv is exactly 12 bytes (96 bits)', async () => {
+ const blob = await encryptJson(key, KEY_ID, 42);
+ expect(blob.iv.byteLength).toBe(12);
+ });
+
+ it('ciphertext is non-empty for a non-trivial value', async () => {
+ const blob = await encryptJson(key, KEY_ID, { data: 'some data' });
+ expect(blob.ciphertext.byteLength).toBeGreaterThan(0);
+ });
+
+ // -------------------------------------------------------------------------
+ // Round-trip: arbitrary JSON-serializable values
+ // -------------------------------------------------------------------------
+
+ it('round-trips a plain object', async () => {
+ const value = { name: 'admin', cookies: [{ name: 'session', value: 'abc' }] };
+ const blob = await encryptJson(key, KEY_ID, value);
+ const out = await decryptJson(key, blob);
+ expect(out).toEqual(value);
+ });
+
+ it('round-trips an array', async () => {
+ const value = [1, 2, 3, 'hello', null, true];
+ const blob = await encryptJson(key, KEY_ID, value);
+ const out = await decryptJson(key, blob);
+ expect(out).toEqual(value);
+ });
+
+ it('round-trips a string', async () => {
+ const value = 'a plain string with "quotes" and \\slashes';
+ const blob = await encryptJson(key, KEY_ID, value);
+ const out = await decryptJson(key, blob);
+ expect(out).toBe(value);
+ });
+
+ it('round-trips a number', async () => {
+ const blob = await encryptJson(key, KEY_ID, 3.14);
+ expect(await decryptJson(key, blob)).toBe(3.14);
+ });
+
+ it('round-trips a boolean true', async () => {
+ const blob = await encryptJson(key, KEY_ID, true);
+ expect(await decryptJson(key, blob)).toBe(true);
+ });
+
+ it('round-trips null', async () => {
+ const blob = await encryptJson(key, KEY_ID, null);
+ expect(await decryptJson(key, blob)).toBeNull();
+ });
+
+ it('round-trips a deeply-nested object', async () => {
+ const value = { a: { b: { c: { d: [1, 2, { e: 'deep' }] } } } };
+ const blob = await encryptJson(key, KEY_ID, value);
+ expect(await decryptJson(key, blob)).toEqual(value);
+ });
+
+ it('round-trips an empty object', async () => {
+ const blob = await encryptJson(key, KEY_ID, {});
+ expect(await decryptJson(key, blob)).toEqual({});
+ });
+
+ it('round-trips a large payload (simulates a profile blob)', async () => {
+ const value = {
+ id: 'profile-1',
+ cookies: Array.from({ length: 50 }, (_, i) => ({
+ name: `cookie_${i}`,
+ value: `value_${'x'.repeat(80)}`,
+ })),
+ localStorage: Object.fromEntries(
+ Array.from({ length: 20 }, (_, i) => [`key_${i}`, `val_${'y'.repeat(200)}`]),
+ ),
+ };
+ const blob = await encryptJson(key, KEY_ID, value);
+ expect(await decryptJson(key, blob)).toEqual(value);
+ });
+
+ // -------------------------------------------------------------------------
+ // Random IV: two encryptions of the same value produce different iv/ciphertext
+ // -------------------------------------------------------------------------
+
+ it('produces a different IV each call for the same value', async () => {
+ const value = { test: 'random-iv' };
+ const blob1 = await encryptJson(key, KEY_ID, value);
+ const blob2 = await encryptJson(key, KEY_ID, value);
+
+ // IVs must differ (astronomically unlikely they are equal with random 96-bit)
+ expect(Buffer.from(blob1.iv).toString('hex')).not.toBe(
+ Buffer.from(blob2.iv).toString('hex'),
+ );
+ });
+
+ it('produces different ciphertext each call for the same value (random IV)', async () => {
+ const value = 'same plaintext';
+ const blob1 = await encryptJson(key, KEY_ID, value);
+ const blob2 = await encryptJson(key, KEY_ID, value);
+
+ expect(Buffer.from(blob1.ciphertext).toString('hex')).not.toBe(
+ Buffer.from(blob2.ciphertext).toString('hex'),
+ );
+ });
+
+ // -------------------------------------------------------------------------
+ // Wrong-key rejection
+ // -------------------------------------------------------------------------
+
+ it('rejects decryption with a different key', async () => {
+ const otherKey = await makeKey();
+ const blob = await encryptJson(key, KEY_ID, { secret: 'data' });
+
+ // Must reject — wrong key means AES-GCM authentication fails
+ await expect(decryptJson(otherKey, blob)).rejects.toThrow();
+ });
+
+ it('rejects decryption with a freshly generated key (not the encrypting key)', async () => {
+ const encryptor = await makeKey();
+ const decryptor = await makeKey();
+
+ const blob = await encryptJson(encryptor, KEY_ID, [1, 2, 3]);
+ await expect(decryptJson(decryptor, blob)).rejects.toThrow();
+ });
+
+ // -------------------------------------------------------------------------
+ // AAD binding
+ // -------------------------------------------------------------------------
+
+ it('round-trips when the same aad is provided to both encrypt and decrypt', async () => {
+ const value = { profile: 'admin' };
+ const aad = 'profile-id-abc';
+ const blob = await encryptJson(key, KEY_ID, value, aad);
+ const out = await decryptJson(key, blob, aad);
+ expect(out).toEqual(value);
+ });
+
+ it('rejects when aad is omitted on decrypt but was provided on encrypt', async () => {
+ const blob = await encryptJson(key, KEY_ID, { x: 1 }, 'some-aad');
+ // decryptJson without aad should fail (different additional data)
+ await expect(decryptJson(key, blob)).rejects.toThrow();
+ });
+
+ it('rejects when a different aad is provided on decrypt', async () => {
+ const blob = await encryptJson(key, KEY_ID, { x: 1 }, 'correct-aad');
+ await expect(decryptJson(key, blob, 'wrong-aad')).rejects.toThrow();
+ });
+
+ it('rejects when aad is provided on decrypt but was not used on encrypt', async () => {
+ const blob = await encryptJson(key, KEY_ID, { x: 1 }); // no aad
+ await expect(decryptJson(key, blob, 'unexpected-aad')).rejects.toThrow();
+ });
+
+ it('rejects when the aad is a substring of the correct aad', async () => {
+ const blob = await encryptJson(key, KEY_ID, { x: 1 }, 'profile-id-long');
+ await expect(decryptJson(key, blob, 'profile-id')).rejects.toThrow();
+ });
+
+ it('rejects when the aad is a superset of the correct aad', async () => {
+ const blob = await encryptJson(key, KEY_ID, { x: 1 }, 'profile');
+ await expect(decryptJson(key, blob, 'profile-extra')).rejects.toThrow();
+ });
+
+ // -------------------------------------------------------------------------
+ // keyId is stored in the blob (for rotation / migration)
+ // -------------------------------------------------------------------------
+
+ it('stores the keyId string in the blob unmodified', async () => {
+ const blob1 = await encryptJson(key, 'mvp-key-v1', {});
+ expect(blob1.keyId).toBe('mvp-key-v1');
+
+ const blob2 = await encryptJson(key, 'passphrase-derived-key', {});
+ expect(blob2.keyId).toBe('passphrase-derived-key');
+ });
+
+ // -------------------------------------------------------------------------
+ // Tampered blob
+ // -------------------------------------------------------------------------
+
+ it('rejects if the ciphertext bytes are mutated (integrity protection)', async () => {
+ const blob = await encryptJson(key, KEY_ID, { important: true });
+
+ // Flip the first byte of the ciphertext
+ const tampered: EncryptedBlob = {
+ ...blob,
+ ciphertext: (() => {
+ const buf = blob.ciphertext.slice(0);
+ const view = new Uint8Array(buf);
+ view[0] ^= 0xff;
+ return buf;
+ })(),
+ };
+
+ await expect(decryptJson(key, tampered)).rejects.toThrow();
+ });
+
+ it('rejects if the iv bytes are mutated', async () => {
+ const blob = await encryptJson(key, KEY_ID, { important: true });
+
+ const tamperedIv = new Uint8Array(blob.iv);
+ tamperedIv[0] ^= 0xff;
+
+ const tampered: EncryptedBlob = { ...blob, iv: tamperedIv };
+ await expect(decryptJson(key, tampered)).rejects.toThrow();
+ });
+});
diff --git a/tests/crypto/keyManager.test.ts b/tests/crypto/keyManager.test.ts
new file mode 100644
index 0000000..f528e36
--- /dev/null
+++ b/tests/crypto/keyManager.test.ts
@@ -0,0 +1,97 @@
+/**
+ * Tests for src/services/crypto/keyManager.ts (§13.5, CONTRACTS §6).
+ *
+ * Contract (CONTRACTS.md §6):
+ * - getOrCreateDataKey() returns a non-extractable AES-GCM CryptoKey
+ * (key.extractable === false, key.algorithm.name === 'AES-GCM').
+ * - First call generates + persists; second call returns the same key
+ * (encrypt with key from first call / decrypt with key from second call works).
+ * - isPassphraseSet() returns false initially (no passphrase configured).
+ * - isUnlocked() returns false initially (vault not yet unlocked).
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { getOrCreateDataKey, isPassphraseSet, isUnlocked } from '@/services/crypto/keyManager';
+import { encryptJson, decryptJson } from '@/services/crypto/encryption';
+
+// ---------------------------------------------------------------------------
+// Note on state: chrome.storage is reset and IndexedDB is reset by setup.ts
+// beforeEach, so each test starts with a clean key store.
+// ---------------------------------------------------------------------------
+
+describe('keyManager.getOrCreateDataKey', () => {
+ it('returns a CryptoKey', async () => {
+ const key = await getOrCreateDataKey();
+ expect(key).toBeDefined();
+ // CryptoKey is a native platform type; check duck-typed properties
+ expect(typeof key).toBe('object');
+ expect(key).not.toBeNull();
+ });
+
+ it('returns a non-extractable key (key.extractable === false)', async () => {
+ const key = await getOrCreateDataKey();
+ expect(key.extractable).toBe(false);
+ });
+
+ it('returns an AES-GCM key (key.algorithm.name === "AES-GCM")', async () => {
+ const key = await getOrCreateDataKey();
+ expect(key.algorithm.name).toBe('AES-GCM');
+ });
+
+ it('key supports encrypt and decrypt usages', async () => {
+ const key = await getOrCreateDataKey();
+ expect(key.usages).toContain('encrypt');
+ expect(key.usages).toContain('decrypt');
+ });
+
+ it('is AES-256 (256-bit key length)', async () => {
+ const key = await getOrCreateDataKey();
+ // AesKeyAlgorithm exposes `length`
+ expect((key.algorithm as AesKeyAlgorithm).length).toBe(256);
+ });
+
+ it('second call returns the same key (can decrypt blob encrypted with first call key)', async () => {
+ const key1 = await getOrCreateDataKey();
+ const payload = { secret: 'round-trip-check', id: 'profile-42' };
+ const blob = await encryptJson(key1, 'test-key', payload);
+
+ // Second call should retrieve the persisted key, not generate a new one
+ const key2 = await getOrCreateDataKey();
+ const decrypted = await decryptJson(key2, blob);
+
+ expect(decrypted).toEqual(payload);
+ });
+
+ it('second call returns the same key identity (cross-call decryption succeeds for multiple payloads)', async () => {
+ const key1 = await getOrCreateDataKey();
+ const blob1 = await encryptJson(key1, 'k', { a: 1 });
+ const blob2 = await encryptJson(key1, 'k', { b: 2 });
+
+ const key2 = await getOrCreateDataKey();
+ expect(await decryptJson(key2, blob1)).toEqual({ a: 1 });
+ expect(await decryptJson(key2, blob2)).toEqual({ b: 2 });
+ });
+
+ it('generates the key (first call) even when called concurrently', async () => {
+ // Both calls should resolve to a key that decrypts the same blob
+ const [key1, key2] = await Promise.all([getOrCreateDataKey(), getOrCreateDataKey()]);
+ const blob = await encryptJson(key1, 'k', { concurrent: true });
+ // key2 must be compatible (same underlying key material)
+ await expect(decryptJson(key2, blob)).resolves.toEqual({ concurrent: true });
+ });
+});
+
+describe('keyManager.isPassphraseSet', () => {
+ it('returns false when no passphrase has been configured', async () => {
+ const result = await isPassphraseSet();
+ expect(result).toBe(false);
+ });
+});
+
+describe('keyManager.isUnlocked', () => {
+ it('returns false initially (vault not yet unlocked in this session)', () => {
+ // isUnlocked is synchronous — it reflects in-memory session state
+ const result = isUnlocked();
+ expect(result).toBe(false);
+ });
+});
diff --git a/tests/crypto/passphrase.test.ts b/tests/crypto/passphrase.test.ts
new file mode 100644
index 0000000..6da085a
--- /dev/null
+++ b/tests/crypto/passphrase.test.ts
@@ -0,0 +1,218 @@
+/**
+ * Tests for src/services/crypto/passphrase.ts (§13.5, CONTRACTS §6).
+ *
+ * Contract (CONTRACTS.md §6):
+ * - deriveKeyFromPassphrase(pass, salt) is deterministic for the same inputs
+ * (derive twice, encrypt with one / decrypt with other must succeed).
+ * - Different passphrase → different key (cross-decrypt must fail).
+ * - setPassphrase + unlockWithPassphrase: true for correct, false for wrong.
+ * - PBKDF2_ITERATIONS is 600_000 (checked as a constant).
+ *
+ * Note: PBKDF2 with 600k iterations is intentionally slow (security). Tests
+ * that call deriveKeyFromPassphrase are marked with a 10-second timeout.
+ */
+
+import { describe, it, expect } from 'vitest';
+import {
+ deriveKeyFromPassphrase,
+ setPassphrase,
+ unlockWithPassphrase,
+ PBKDF2_ITERATIONS,
+} from '@/services/crypto/passphrase';
+import { encryptJson, decryptJson } from '@/services/crypto/encryption';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function randomSalt(): Uint8Array {
+ return globalThis.crypto.getRandomValues(new Uint8Array(16));
+}
+
+const KEY_ID = 'passphrase-derived';
+
+// ---------------------------------------------------------------------------
+// Constants
+// ---------------------------------------------------------------------------
+
+describe('PBKDF2_ITERATIONS constant', () => {
+ it('is 600_000 as mandated by PRD §13.5', () => {
+ expect(PBKDF2_ITERATIONS).toBe(600_000);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// deriveKeyFromPassphrase
+// ---------------------------------------------------------------------------
+
+describe('passphrase.deriveKeyFromPassphrase', () => {
+ it(
+ 'returns a CryptoKey',
+ async () => {
+ const salt = randomSalt();
+ const key = await deriveKeyFromPassphrase('hunter2', salt);
+ expect(key).toBeDefined();
+ expect(typeof key).toBe('object');
+ },
+ 10_000,
+ );
+
+ it(
+ 'returned key has algorithm AES-GCM',
+ async () => {
+ const key = await deriveKeyFromPassphrase('pass', randomSalt());
+ expect(key.algorithm.name).toBe('AES-GCM');
+ },
+ 10_000,
+ );
+
+ it(
+ 'returned key has usages that include encrypt and decrypt',
+ async () => {
+ const key = await deriveKeyFromPassphrase('pass', randomSalt());
+ expect(key.usages).toContain('encrypt');
+ expect(key.usages).toContain('decrypt');
+ },
+ 10_000,
+ );
+
+ it(
+ 'is deterministic: same passphrase + salt → same key material (cross-call decrypt succeeds)',
+ async () => {
+ const salt = randomSalt();
+ const passphrase = 'deterministic-pass-1';
+
+ const key1 = await deriveKeyFromPassphrase(passphrase, salt);
+ const key2 = await deriveKeyFromPassphrase(passphrase, salt);
+
+ const value = { deterministic: true, payload: 'hello' };
+ const blob = await encryptJson(key1, KEY_ID, value);
+ const out = await decryptJson(key2, blob);
+
+ expect(out).toEqual(value);
+ },
+ 20_000,
+ );
+
+ it(
+ 'different passphrase → different key (cross-decrypt fails)',
+ async () => {
+ const salt = randomSalt();
+ const key1 = await deriveKeyFromPassphrase('correct-horse', salt);
+ const key2 = await deriveKeyFromPassphrase('wrong-battery', salt);
+
+ const blob = await encryptJson(key1, KEY_ID, { sensitive: 'data' });
+ await expect(decryptJson(key2, blob)).rejects.toThrow();
+ },
+ 20_000,
+ );
+
+ it(
+ 'different salt → different key (same passphrase, cross-decrypt fails)',
+ async () => {
+ const passphrase = 'same-password';
+ const salt1 = randomSalt();
+ const salt2 = randomSalt();
+
+ const key1 = await deriveKeyFromPassphrase(passphrase, salt1);
+ const key2 = await deriveKeyFromPassphrase(passphrase, salt2);
+
+ const blob = await encryptJson(key1, KEY_ID, { x: 1 });
+ await expect(decryptJson(key2, blob)).rejects.toThrow();
+ },
+ 20_000,
+ );
+
+ it(
+ 'works with a Unicode passphrase',
+ async () => {
+ const salt = randomSalt();
+ const pass = 'パスワード🔐ñoño';
+ const key1 = await deriveKeyFromPassphrase(pass, salt);
+ const key2 = await deriveKeyFromPassphrase(pass, salt);
+
+ const blob = await encryptJson(key1, KEY_ID, 'unicode ok');
+ expect(await decryptJson(key2, blob)).toBe('unicode ok');
+ },
+ 20_000,
+ );
+
+ it(
+ 'works with an empty passphrase (degenerate input)',
+ async () => {
+ const salt = randomSalt();
+ const key1 = await deriveKeyFromPassphrase('', salt);
+ const key2 = await deriveKeyFromPassphrase('', salt);
+
+ const blob = await encryptJson(key1, KEY_ID, null);
+ expect(await decryptJson(key2, blob)).toBeNull();
+ },
+ 20_000,
+ );
+});
+
+// ---------------------------------------------------------------------------
+// setPassphrase / unlockWithPassphrase
+// ---------------------------------------------------------------------------
+
+describe('passphrase.setPassphrase + unlockWithPassphrase', () => {
+ it(
+ 'unlockWithPassphrase returns true for the correct passphrase after setPassphrase',
+ async () => {
+ await setPassphrase('my-secure-pass');
+ const ok = await unlockWithPassphrase('my-secure-pass');
+ expect(ok).toBe(true);
+ },
+ 30_000,
+ );
+
+ it(
+ 'unlockWithPassphrase returns false for a wrong passphrase',
+ async () => {
+ await setPassphrase('correct-pass');
+ const ok = await unlockWithPassphrase('wrong-pass');
+ expect(ok).toBe(false);
+ },
+ 30_000,
+ );
+
+ it(
+ 'unlockWithPassphrase returns false for an empty string when the passphrase is non-empty',
+ async () => {
+ await setPassphrase('non-empty');
+ const ok = await unlockWithPassphrase('');
+ expect(ok).toBe(false);
+ },
+ 30_000,
+ );
+
+ it(
+ 'unlockWithPassphrase returns false for a passphrase with an extra character appended',
+ async () => {
+ await setPassphrase('exactpass');
+ const ok = await unlockWithPassphrase('exactpass!');
+ expect(ok).toBe(false);
+ },
+ 30_000,
+ );
+
+ it(
+ 'unlockWithPassphrase is case-sensitive',
+ async () => {
+ await setPassphrase('Password');
+ const ok = await unlockWithPassphrase('password');
+ expect(ok).toBe(false);
+ },
+ 30_000,
+ );
+
+ it(
+ 'unlockWithPassphrase returns true again after correct passphrase (idempotent unlock)',
+ async () => {
+ await setPassphrase('repeat-me');
+ expect(await unlockWithPassphrase('repeat-me')).toBe(true);
+ expect(await unlockWithPassphrase('repeat-me')).toBe(true);
+ },
+ 40_000,
+ );
+});
diff --git a/tests/export/playwrightExport.test.ts b/tests/export/playwrightExport.test.ts
new file mode 100644
index 0000000..dd3755b
--- /dev/null
+++ b/tests/export/playwrightExport.test.ts
@@ -0,0 +1,460 @@
+/**
+ * Contract tests for Playwright storageState export.
+ *
+ * References:
+ * PRD §9.3 (MVP), §13.7 (implementation notes)
+ * CONTRACTS.md §4 (authoritative sameSite mapping, expires, origins grouping)
+ *
+ * Every test fails against the current NotImplementedError stub and must pass
+ * only when the implementation is correct. Never assert NotImplementedError.
+ */
+
+import { describe, it, expect } from 'vitest';
+import {
+ toStorageState,
+ exportStorageStateJson,
+ validateForPlaywright,
+ type PlaywrightStorageState,
+} from '@/services/export/playwrightExport';
+import { makeCookie, makeProfile } from '../harness/factories';
+
+// ---------------------------------------------------------------------------
+// toStorageState — cookie field mapping
+// ---------------------------------------------------------------------------
+
+describe('toStorageState: cookie field mapping', () => {
+ it('maps name and value verbatim', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ name: 'auth_token', value: 'secret-xyz-789' })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies).toHaveLength(1);
+ expect(state.cookies[0].name).toBe('auth_token');
+ expect(state.cookies[0].value).toBe('secret-xyz-789');
+ });
+
+ it('maps domain verbatim', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ domain: 'api.example.com' })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].domain).toBe('api.example.com');
+ });
+
+ it('maps path verbatim', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ path: '/api/v2' })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].path).toBe('/api/v2');
+ });
+
+ it('maps httpOnly verbatim', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ httpOnly: true })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].httpOnly).toBe(true);
+ });
+
+ it('maps httpOnly=false verbatim', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ httpOnly: false })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].httpOnly).toBe(false);
+ });
+
+ it('maps secure verbatim', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ secure: true })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].secure).toBe(true);
+ });
+
+ it('maps secure=false verbatim', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ secure: false })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].secure).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// toStorageState — expires mapping (CONTRACTS.md §4)
+// ---------------------------------------------------------------------------
+
+describe('toStorageState: expires mapping', () => {
+ it('uses expirationDate as expires when set', () => {
+ const expirationDate = 4102444800; // 2100-01-01
+ const profile = makeProfile({
+ cookies: [makeCookie({ expirationDate })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].expires).toBe(expirationDate);
+ });
+
+ it('uses -1 for session cookies (expirationDate absent)', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ expirationDate: undefined, session: true })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].expires).toBe(-1);
+ });
+
+ it('uses -1 for cookies where session=true even if they have an expirationDate in edge cases — session flag wins when expirationDate is missing', () => {
+ // Additional guard: if expirationDate is explicitly undefined (session cookie),
+ // expires must be -1 regardless of other fields.
+ const profile = makeProfile({
+ cookies: [makeCookie({ expirationDate: undefined })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].expires).toBe(-1);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// toStorageState — sameSite mapping (CONTRACTS.md §4)
+// ---------------------------------------------------------------------------
+
+describe('toStorageState: sameSite mapping', () => {
+ it('maps lax → Lax', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ sameSite: 'lax' })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].sameSite).toBe('Lax');
+ });
+
+ it('maps strict → Strict', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ sameSite: 'strict' })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].sameSite).toBe('Strict');
+ });
+
+ it('maps no_restriction → None', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ sameSite: 'no_restriction' })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies[0].sameSite).toBe('None');
+ });
+
+ it('maps unspecified → Lax (Playwright has no unspecified)', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ sameSite: 'unspecified' })],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ // CONTRACTS.md §4: unspecified → 'Lax'
+ expect(state.cookies[0].sameSite).toBe('Lax');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// toStorageState — origins grouping (CONTRACTS.md §4)
+// ---------------------------------------------------------------------------
+
+describe('toStorageState: origins grouping', () => {
+ it('emits origins with localStorage as [{name, value}] pairs', () => {
+ const profile = makeProfile({
+ origin: 'https://example.com',
+ localStorage: { token: 'lsval', theme: 'dark' },
+ cookies: [],
+ });
+ const state = toStorageState(profile);
+ expect(state.origins).toHaveLength(1);
+ expect(state.origins[0].origin).toBe('https://example.com');
+ expect(state.origins[0].localStorage).toEqual(
+ expect.arrayContaining([
+ { name: 'token', value: 'lsval' },
+ { name: 'theme', value: 'dark' },
+ ]),
+ );
+ expect(state.origins[0].localStorage).toHaveLength(2);
+ });
+
+ it('omits origin entirely when localStorage is empty', () => {
+ const profile = makeProfile({
+ origin: 'https://example.com',
+ localStorage: {},
+ cookies: [],
+ });
+ const state = toStorageState(profile);
+ // CONTRACTS.md §4: empty localStorage → that origin is omitted
+ expect(state.origins).toHaveLength(0);
+ });
+
+ it('excludes sessionStorage from origins (not part of standard storageState)', () => {
+ const profile = makeProfile({
+ origin: 'https://example.com',
+ localStorage: { key: 'val' },
+ sessionStorage: { sess: 'sesval' },
+ cookies: [],
+ });
+ const state = toStorageState(profile);
+ // sessionStorage must not appear anywhere in origins
+ for (const origin of state.origins) {
+ const lsNames = origin.localStorage.map((e) => e.name);
+ expect(lsNames).not.toContain('sess');
+ }
+ });
+
+ it('groups localStorage under profile.origin URL', () => {
+ const profile = makeProfile({
+ origin: 'https://staging.myapp.io',
+ localStorage: { userId: '42' },
+ cookies: [],
+ });
+ const state = toStorageState(profile);
+ expect(state.origins[0].origin).toBe('https://staging.myapp.io');
+ });
+
+ it('produces empty origins[] when localStorage is empty for all origins', () => {
+ const profile = makeProfile({
+ localStorage: {},
+ cookies: [makeCookie()],
+ });
+ const state = toStorageState(profile);
+ expect(state.origins).toEqual([]);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// toStorageState — IndexedDB and sessionStorage exclusion (CONTRACTS.md §4)
+// ---------------------------------------------------------------------------
+
+describe('toStorageState: excluded stores', () => {
+ it('does not include sessionStorage in the output object at all', () => {
+ const profile = makeProfile({
+ sessionStorage: { key: 'should-not-appear' },
+ localStorage: {},
+ cookies: [],
+ });
+ const state = toStorageState(profile);
+ // sessionStorage must be absent from the returned object
+ expect((state as Record)['sessionStorage']).toBeUndefined();
+ });
+
+ it('does not include indexedDB in the output object', () => {
+ const profile = makeProfile({ cookies: [], localStorage: {} });
+ const state = toStorageState(profile);
+ expect((state as Record)['indexedDB']).toBeUndefined();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// toStorageState — exact Playwright storageState shape (CONTRACTS.md §4)
+// ---------------------------------------------------------------------------
+
+describe('toStorageState: output shape exactly matches Playwright storageState', () => {
+ it('returns an object with exactly {cookies, origins} at the top level', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie()],
+ localStorage: { k: 'v' },
+ });
+ const state = toStorageState(profile);
+ const keys = Object.keys(state).sort();
+ expect(keys).toEqual(['cookies', 'origins']);
+ });
+
+ it('each cookie entry has exactly the documented Playwright cookie keys', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie()],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ const cookieKeys = Object.keys(state.cookies[0]).sort();
+ // Playwright cookie shape: name, value, domain, path, expires, httpOnly, secure, sameSite
+ expect(cookieKeys).toEqual(
+ ['domain', 'expires', 'httpOnly', 'name', 'path', 'sameSite', 'secure', 'value'].sort(),
+ );
+ });
+
+ it('each origin entry has exactly {origin, localStorage} keys', () => {
+ const profile = makeProfile({
+ cookies: [],
+ origin: 'https://example.com',
+ localStorage: { x: 'y' },
+ });
+ const state = toStorageState(profile);
+ const originKeys = Object.keys(state.origins[0]).sort();
+ expect(originKeys).toEqual(['localStorage', 'origin'].sort());
+ });
+
+ it('localStorage entries have exactly {name, value} keys', () => {
+ const profile = makeProfile({
+ cookies: [],
+ origin: 'https://example.com',
+ localStorage: { myKey: 'myVal' },
+ });
+ const state = toStorageState(profile);
+ const entryKeys = Object.keys(state.origins[0].localStorage[0]).sort();
+ expect(entryKeys).toEqual(['name', 'value'].sort());
+ });
+
+ it('sameSite is one of the Playwright-accepted values (Strict|Lax|None)', () => {
+ const sameSiteValues: Array<'no_restriction' | 'lax' | 'strict' | 'unspecified'> = [
+ 'no_restriction',
+ 'lax',
+ 'strict',
+ 'unspecified',
+ ];
+ const profile = makeProfile({
+ cookies: sameSiteValues.map((ss, i) =>
+ makeCookie({ sameSite: ss, name: `cookie_${i}` }),
+ ),
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ const allowed = new Set(['Strict', 'Lax', 'None']);
+ for (const c of state.cookies) {
+ expect(allowed.has(c.sameSite)).toBe(true);
+ }
+ });
+});
+
+// ---------------------------------------------------------------------------
+// toStorageState — multi-cookie profile
+// ---------------------------------------------------------------------------
+
+describe('toStorageState: multiple cookies', () => {
+ it('maps all cookies in the profile, preserving order', () => {
+ const profile = makeProfile({
+ cookies: [
+ makeCookie({ name: 'a', value: '1' }),
+ makeCookie({ name: 'b', value: '2' }),
+ makeCookie({ name: 'c', value: '3' }),
+ ],
+ localStorage: {},
+ });
+ const state = toStorageState(profile);
+ expect(state.cookies).toHaveLength(3);
+ expect(state.cookies.map((c) => c.name)).toEqual(['a', 'b', 'c']);
+ });
+
+ it('handles an empty cookies array gracefully', () => {
+ const profile = makeProfile({ cookies: [], localStorage: {} });
+ const state = toStorageState(profile);
+ expect(state.cookies).toEqual([]);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// exportStorageStateJson — serialization (CONTRACTS.md §4)
+// ---------------------------------------------------------------------------
+
+describe('exportStorageStateJson', () => {
+ it('returns a string', () => {
+ const profile = makeProfile({ cookies: [makeCookie()], localStorage: { k: 'v' } });
+ const json = exportStorageStateJson(profile);
+ expect(typeof json).toBe('string');
+ });
+
+ it('parses back to the same object as toStorageState (round-trip)', () => {
+ const profile = makeProfile({
+ cookies: [
+ makeCookie({ name: 'sess', value: 'tok', sameSite: 'lax', expirationDate: 9999999 }),
+ ],
+ localStorage: { userId: '99' },
+ });
+ const json = exportStorageStateJson(profile);
+ const parsed = JSON.parse(json) as PlaywrightStorageState;
+ const direct = toStorageState(profile);
+ expect(parsed).toEqual(direct);
+ });
+
+ it('is valid JSON (does not throw on JSON.parse)', () => {
+ const profile = makeProfile({ cookies: [makeCookie()], localStorage: {} });
+ const json = exportStorageStateJson(profile);
+ expect(() => JSON.parse(json)).not.toThrow();
+ });
+
+ it('JSON string contains the cookie name from the profile', () => {
+ const profile = makeProfile({
+ cookies: [makeCookie({ name: 'special_auth' })],
+ localStorage: {},
+ });
+ const json = exportStorageStateJson(profile);
+ expect(json).toContain('special_auth');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// validateForPlaywright — warning logic (CONTRACTS.md §4)
+// ---------------------------------------------------------------------------
+
+describe('validateForPlaywright: returns [] for clean cookies', () => {
+ it('returns empty array for a well-formed cookie set', () => {
+ const cookies = [
+ makeCookie({ name: 'a', domain: 'example.com' }),
+ makeCookie({ name: 'b', domain: 'api.example.com' }),
+ ];
+ const warnings = validateForPlaywright(cookies);
+ expect(warnings).toEqual([]);
+ });
+
+ it('returns an array (not null/undefined) for empty input', () => {
+ const warnings = validateForPlaywright([]);
+ expect(Array.isArray(warnings)).toBe(true);
+ expect(warnings).toEqual([]);
+ });
+});
+
+describe('validateForPlaywright: warns for malformed cookies', () => {
+ it('warns when domain is missing/empty', () => {
+ const cookies = [makeCookie({ domain: '' })];
+ const warnings = validateForPlaywright(cookies);
+ expect(warnings.length).toBeGreaterThan(0);
+ // Warning must be a non-empty string
+ expect(typeof warnings[0]).toBe('string');
+ expect(warnings[0].length).toBeGreaterThan(0);
+ });
+
+ it('warns when name is missing/empty', () => {
+ const cookies = [makeCookie({ name: '' })];
+ const warnings = validateForPlaywright(cookies);
+ expect(warnings.length).toBeGreaterThan(0);
+ });
+
+ it('warns for multiple malformed cookies (one warning per issue at minimum)', () => {
+ const cookies = [makeCookie({ domain: '' }), makeCookie({ name: '' })];
+ const warnings = validateForPlaywright(cookies);
+ // At least 2 warnings: one per malformed cookie
+ expect(warnings.length).toBeGreaterThanOrEqual(2);
+ });
+
+ it('does not warn for a cookie with all required fields present', () => {
+ const cookies = [
+ makeCookie({
+ name: 'auth',
+ value: 'token123',
+ domain: 'example.com',
+ path: '/',
+ httpOnly: true,
+ secure: true,
+ sameSite: 'lax',
+ expirationDate: 4102444800,
+ }),
+ ];
+ const warnings = validateForPlaywright(cookies);
+ expect(warnings).toEqual([]);
+ });
+});
diff --git a/tests/export/redaction.test.ts b/tests/export/redaction.test.ts
new file mode 100644
index 0000000..4f3e047
--- /dev/null
+++ b/tests/export/redaction.test.ts
@@ -0,0 +1,318 @@
+/**
+ * Contract tests for export redaction / secret scanning.
+ *
+ * References:
+ * PRD §9.3 (redaction/preview warnings), §9.4 (obfuscate/redact option),
+ * §14.3 (warn before sharing exports)
+ * CONTRACTS.md §5 (scanForSecrets: jwt-ish / long high-entropy /
+ * token|secret|key|auth named values;
+ * redactSnippet masks values, keeps structure)
+ *
+ * Fail against NotImplementedError stubs; pass only when correct.
+ * Never assert NotImplementedError.
+ */
+
+import { describe, it, expect } from 'vitest';
+import { scanForSecrets, redactSnippet, type RedactionWarning } from '@/services/export/redaction';
+import { makeCookie, makeProfile } from '../harness/factories';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function profileWithCookies(
+ cookies: Array<{ name: string; value: string }>,
+) {
+ return makeProfile({
+ cookies: cookies.map(({ name, value }) => makeCookie({ name, value })),
+ localStorage: {},
+ });
+}
+
+/** Generate a string of n characters that is high-entropy (pseudo-random alphanum). */
+function highEntropyValue(n: number): string {
+ // Mix of upper/lower/digits/symbols to ensure high entropy score.
+ const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-+/=';
+ let s = '';
+ // Deterministic but varied — interleave char classes to guarantee high entropy.
+ for (let i = 0; i < n; i++) {
+ s += chars[i % chars.length];
+ }
+ return s;
+}
+
+/** Build a plausible JWT-like string (3 base64url segments). */
+function jwtLike(): string {
+ const b64 = (s: string) => Buffer.from(s).toString('base64url');
+ return [
+ b64(JSON.stringify({ alg: 'HS256', typ: 'JWT' })),
+ b64(JSON.stringify({ sub: '1234567890', name: 'Test User', iat: 1516239022 })),
+ 'SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
+ ].join('.');
+}
+
+// ---------------------------------------------------------------------------
+// scanForSecrets — returns RedactionWarning[]
+// ---------------------------------------------------------------------------
+
+describe('scanForSecrets: return type', () => {
+ it('always returns an array', () => {
+ const profile = makeProfile({ cookies: [], localStorage: {} });
+ const result = scanForSecrets(profile);
+ expect(Array.isArray(result)).toBe(true);
+ });
+
+ it('returns RedactionWarning objects with field and reason properties', () => {
+ const profile = profileWithCookies([
+ { name: 'auth_token', value: 'eyJhbGciOiJIUzI1NiJ9.abc.def' },
+ ]);
+ const result = scanForSecrets(profile);
+ // If any warning is returned, it must have field and reason strings
+ if (result.length > 0) {
+ expect(typeof result[0].field).toBe('string');
+ expect(typeof result[0].reason).toBe('string');
+ }
+ });
+});
+
+describe('scanForSecrets: returns [] for benign values', () => {
+ it('returns [] for a normal session cookie with short alphanumeric value', () => {
+ const profile = profileWithCookies([
+ { name: 'theme', value: 'dark' },
+ ]);
+ const result = scanForSecrets(profile);
+ expect(result).toEqual([]);
+ });
+
+ it('returns [] for a boolean-like value', () => {
+ const profile = profileWithCookies([{ name: 'accepted_terms', value: 'true' }]);
+ expect(scanForSecrets(profile)).toEqual([]);
+ });
+
+ it('returns [] for a numeric value', () => {
+ const profile = profileWithCookies([{ name: 'user_id', value: '42' }]);
+ expect(scanForSecrets(profile)).toEqual([]);
+ });
+
+ it('returns [] for a short non-sensitive name with short value', () => {
+ const profile = profileWithCookies([{ name: 'lang', value: 'en-US' }]);
+ expect(scanForSecrets(profile)).toEqual([]);
+ });
+
+ it('returns [] for profile with no cookies and empty localStorage', () => {
+ const profile = makeProfile({ cookies: [], localStorage: {} });
+ expect(scanForSecrets(profile)).toEqual([]);
+ });
+});
+
+describe('scanForSecrets: flags JWT-like values (CONTRACTS.md §5)', () => {
+ it('flags a value that looks like a JWT (three base64url segments separated by dots)', () => {
+ const jwt = jwtLike();
+ const profile = profileWithCookies([{ name: 'id_token', value: jwt }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('flags a JWT even when the cookie name is innocuous', () => {
+ const jwt = jwtLike();
+ const profile = profileWithCookies([{ name: 'cookie_a', value: jwt }]);
+ const result = scanForSecrets(profile);
+ // The value pattern alone (JWT-like) should trigger a warning
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('includes the cookie field in the warning for a JWT value', () => {
+ const jwt = jwtLike();
+ const profile = profileWithCookies([{ name: 'token_x', value: jwt }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ // The warning should reference the field that was flagged
+ expect(result[0].field.length).toBeGreaterThan(0);
+ });
+});
+
+describe('scanForSecrets: flags long high-entropy values (CONTRACTS.md §5)', () => {
+ it('flags a value that is long and high-entropy (>= ~40 chars, mixed charset)', () => {
+ const longSecret = highEntropyValue(64);
+ const profile = profileWithCookies([{ name: 'random_value', value: longSecret }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('does not flag a long but low-entropy value (repeated characters)', () => {
+ // All same character — low entropy
+ const lowEntropy = 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa';
+ const profile = profileWithCookies([{ name: 'padding', value: lowEntropy }]);
+ const result = scanForSecrets(profile);
+ // Low entropy string should not be flagged even if it's long
+ expect(result).toEqual([]);
+ });
+});
+
+describe('scanForSecrets: flags by name pattern (CONTRACTS.md §5)', () => {
+ it('flags a cookie named "token" regardless of value length', () => {
+ const profile = profileWithCookies([{ name: 'token', value: 'short_but_named_token' }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('flags a cookie named "secret"', () => {
+ const profile = profileWithCookies([{ name: 'secret', value: 'some_value_here' }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('flags a cookie named "key"', () => {
+ const profile = profileWithCookies([{ name: 'key', value: 'some_key_value' }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('flags a cookie named "auth"', () => {
+ const profile = profileWithCookies([{ name: 'auth', value: 'bearer-xyz' }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('flags cookie names containing "token" as a substring (e.g., auth_token)', () => {
+ const profile = profileWithCookies([{ name: 'auth_token', value: 'tkn_abc_def' }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('flags cookie names containing "secret" as a substring (e.g., client_secret)', () => {
+ const profile = profileWithCookies([{ name: 'client_secret', value: 'cs_abc' }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('flags cookie names containing "key" as a substring (e.g., api_key)', () => {
+ const profile = profileWithCookies([{ name: 'api_key', value: 'akval' }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+
+ it('flags cookie names containing "auth" as a substring (e.g., authorization)', () => {
+ const profile = profileWithCookies([{ name: 'authorization', value: 'Bearer xyz' }]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThan(0);
+ });
+});
+
+describe('scanForSecrets: multiple cookies — warns per flagged item', () => {
+ it('flags two separately suspicious cookies, returning at least 2 warnings', () => {
+ const profile = profileWithCookies([
+ { name: 'auth_token', value: jwtLike() },
+ { name: 'api_key', value: highEntropyValue(64) },
+ ]);
+ const result = scanForSecrets(profile);
+ expect(result.length).toBeGreaterThanOrEqual(2);
+ });
+
+ it('only flags the suspicious cookie when mixed with benign ones', () => {
+ const profile = profileWithCookies([
+ { name: 'theme', value: 'dark' },
+ { name: 'auth_token', value: jwtLike() },
+ { name: 'lang', value: 'en' },
+ ]);
+ const result = scanForSecrets(profile);
+ // At least 1 warning for the auth_token
+ expect(result.length).toBeGreaterThanOrEqual(1);
+ // Benign cookies must not each produce spurious warnings beyond 1
+ // (theme and lang should not appear as warnings)
+ const flaggedFields = result.map((w: RedactionWarning) => w.field);
+ // At most one extra warning for the JWT value pattern beyond name
+ // — but definitely NOT more warnings than cookies
+ expect(result.length).toBeLessThanOrEqual(profile.cookies.length);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// redactSnippet — masks values, keeps structure (CONTRACTS.md §5)
+// ---------------------------------------------------------------------------
+
+describe('redactSnippet: return type and basic contract', () => {
+ it('returns a string', () => {
+ const result = redactSnippet('page.setCookie({ name: "token", value: "secret123" })');
+ expect(typeof result).toBe('string');
+ });
+
+ it('returns a non-empty string', () => {
+ const result = redactSnippet('curl -b "auth=abc123"');
+ expect(result.length).toBeGreaterThan(0);
+ });
+});
+
+describe('redactSnippet: masks values while keeping structure', () => {
+ it('does not expose the original secret value verbatim in the output', () => {
+ const snippet = 'page.setCookie({ name: "auth_token", value: "super-secret-value-xyz" })';
+ const redacted = redactSnippet(snippet);
+ expect(redacted).not.toContain('super-secret-value-xyz');
+ });
+
+ it('preserves the structural API call (page.setCookie) in the output', () => {
+ const snippet = 'page.setCookie({ name: "token", value: "tok-abc-def" })';
+ const redacted = redactSnippet(snippet);
+ // Structure is preserved — the API call name remains
+ expect(redacted).toContain('page.setCookie');
+ });
+
+ it('preserves cookie names in the output (only values are masked)', () => {
+ const snippet = 'driver.add_cookie({"name": "auth_token", "value": "mysecret"})';
+ const redacted = redactSnippet(snippet);
+ // The cookie name (auth_token) should be preserved
+ expect(redacted).toContain('auth_token');
+ // The value should be masked
+ expect(redacted).not.toContain('mysecret');
+ });
+
+ it('replaces the secret value with a placeholder/mask marker', () => {
+ const snippet = 'page.setCookie({ name: "token", value: "cleartext-secret" })';
+ const redacted = redactSnippet(snippet);
+ // Some form of masking token must appear (e.g., *****, [REDACTED], )
+ const hasMask =
+ redacted.includes('*') ||
+ redacted.toLowerCase().includes('redact') ||
+ redacted.includes('[') ||
+ redacted.includes('<');
+ expect(hasMask).toBe(true);
+ });
+
+ it('preserves cURL -b flag structure while masking value', () => {
+ const snippet = 'curl -b "session=abc123; token=mysecret"';
+ const redacted = redactSnippet(snippet);
+ // -b must still appear (structure preserved)
+ expect(redacted).toContain('-b');
+ // The actual secret values should be masked
+ expect(redacted).not.toContain('abc123');
+ expect(redacted).not.toContain('mysecret');
+ });
+
+ it('preserves driver.addCookie structure for JS selenium snippet', () => {
+ const snippet = "driver.addCookie({name: 'auth', value: 'topsecret'})";
+ const redacted = redactSnippet(snippet);
+ expect(redacted).toContain('driver.addCookie');
+ expect(redacted).not.toContain('topsecret');
+ });
+
+ it('is idempotent — redacting already-redacted output does not error', () => {
+ const snippet = 'page.setCookie({ name: "token", value: "cleartext" })';
+ const once = redactSnippet(snippet);
+ // Re-redacting must not throw
+ expect(() => redactSnippet(once)).not.toThrow();
+ });
+
+ it('handles an empty string gracefully', () => {
+ expect(() => redactSnippet('')).not.toThrow();
+ const result = redactSnippet('');
+ expect(typeof result).toBe('string');
+ });
+
+ it('handles a snippet with no recognizable secret values (passthrough or unchanged)', () => {
+ // A snippet with no cookie values to mask — should return a valid string
+ const snippet = 'const page = await browser.newPage();';
+ expect(() => redactSnippet(snippet)).not.toThrow();
+ const result = redactSnippet(snippet);
+ expect(typeof result).toBe('string');
+ });
+});
diff --git a/tests/export/snippetExport.test.ts b/tests/export/snippetExport.test.ts
new file mode 100644
index 0000000..324f453
--- /dev/null
+++ b/tests/export/snippetExport.test.ts
@@ -0,0 +1,315 @@
+/**
+ * Contract tests for automation-export snippet generators.
+ *
+ * References:
+ * PRD §9.4 (Puppeteer/Selenium/cURL P1 exports)
+ * CONTRACTS.md §5 (authoritative: API call substrings, cURL join format,
+ * Python vs JS selenium difference)
+ *
+ * Fail against NotImplementedError stubs; pass only when correct.
+ * Never assert NotImplementedError.
+ */
+
+import { describe, it, expect } from 'vitest';
+import { exportPuppeteerSnippet } from '@/services/export/puppeteerExport';
+import { exportSeleniumSnippet } from '@/services/export/seleniumExport';
+import { exportCurlSnippet } from '@/services/export/curlExport';
+import { makeCookie, makeProfile } from '../harness/factories';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+/** Build a profile with explicit cookie list and no localStorage noise. */
+function profileWith(...cookies: Parameters[0][]) {
+ return makeProfile({
+ cookies: cookies.map((c) => makeCookie(c)),
+ localStorage: {},
+ });
+}
+
+// ---------------------------------------------------------------------------
+// exportPuppeteerSnippet (CONTRACTS.md §5)
+// ---------------------------------------------------------------------------
+
+describe('exportPuppeteerSnippet: output is a string', () => {
+ it('returns a string', () => {
+ const snippet = exportPuppeteerSnippet(makeProfile());
+ expect(typeof snippet).toBe('string');
+ expect(snippet.length).toBeGreaterThan(0);
+ });
+});
+
+describe('exportPuppeteerSnippet: contains every cookie name and value', () => {
+ it('includes the cookie name in the snippet', () => {
+ const profile = profileWith({ name: 'auth_token', value: 'tok-abc' });
+ const snippet = exportPuppeteerSnippet(profile);
+ expect(snippet).toContain('auth_token');
+ });
+
+ it('includes the cookie value in the snippet', () => {
+ const profile = profileWith({ name: 'auth_token', value: 'tok-abc' });
+ const snippet = exportPuppeteerSnippet(profile);
+ expect(snippet).toContain('tok-abc');
+ });
+
+ it('includes all cookie names when there are multiple cookies', () => {
+ const profile = profileWith(
+ { name: 'session', value: 's1' },
+ { name: 'csrf', value: 'c1' },
+ { name: 'user_id', value: 'u999' },
+ );
+ const snippet = exportPuppeteerSnippet(profile);
+ expect(snippet).toContain('session');
+ expect(snippet).toContain('csrf');
+ expect(snippet).toContain('user_id');
+ });
+
+ it('includes all cookie values when there are multiple cookies', () => {
+ const profile = profileWith(
+ { name: 'session', value: 's1' },
+ { name: 'csrf', value: 'c1' },
+ );
+ const snippet = exportPuppeteerSnippet(profile);
+ expect(snippet).toContain('s1');
+ expect(snippet).toContain('c1');
+ });
+});
+
+describe('exportPuppeteerSnippet: uses the correct Puppeteer API call', () => {
+ it('contains the page.setCookie( API call substring (CONTRACTS.md §5)', () => {
+ const profile = profileWith({ name: 'sess', value: 'xyz' });
+ const snippet = exportPuppeteerSnippet(profile);
+ // CONTRACTS.md §5: correct API call substring
+ expect(snippet).toContain('page.setCookie(');
+ });
+});
+
+describe('exportPuppeteerSnippet: edge cases', () => {
+ it('handles a profile with no cookies without throwing', () => {
+ const profile = makeProfile({ cookies: [], localStorage: {} });
+ expect(() => exportPuppeteerSnippet(profile)).not.toThrow();
+ });
+
+ it('produces a string even for zero cookies', () => {
+ const profile = makeProfile({ cookies: [], localStorage: {} });
+ const snippet = exportPuppeteerSnippet(profile);
+ expect(typeof snippet).toBe('string');
+ });
+
+ it('includes cookie domain in the snippet (Puppeteer setCookie takes a full cookie object)', () => {
+ const profile = profileWith({ name: 'c', value: 'v', domain: 'api.example.com' });
+ const snippet = exportPuppeteerSnippet(profile);
+ expect(snippet).toContain('api.example.com');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// exportSeleniumSnippet — Python dialect (CONTRACTS.md §5)
+// ---------------------------------------------------------------------------
+
+describe('exportSeleniumSnippet(python): output is a string', () => {
+ it('returns a string for python lang', () => {
+ const snippet = exportSeleniumSnippet(makeProfile(), 'python');
+ expect(typeof snippet).toBe('string');
+ expect(snippet.length).toBeGreaterThan(0);
+ });
+});
+
+describe('exportSeleniumSnippet(python): contains every cookie name and value', () => {
+ it('includes the cookie name', () => {
+ const profile = profileWith({ name: 'access_token', value: 'at-123' });
+ const snippet = exportSeleniumSnippet(profile, 'python');
+ expect(snippet).toContain('access_token');
+ });
+
+ it('includes the cookie value', () => {
+ const profile = profileWith({ name: 'access_token', value: 'at-123' });
+ const snippet = exportSeleniumSnippet(profile, 'python');
+ expect(snippet).toContain('at-123');
+ });
+
+ it('includes all names and values for multiple cookies', () => {
+ const profile = profileWith(
+ { name: 'a', value: 'alpha' },
+ { name: 'b', value: 'beta' },
+ );
+ const snippet = exportSeleniumSnippet(profile, 'python');
+ expect(snippet).toContain('a');
+ expect(snippet).toContain('alpha');
+ expect(snippet).toContain('b');
+ expect(snippet).toContain('beta');
+ });
+});
+
+describe('exportSeleniumSnippet(python): uses the correct Selenium API call', () => {
+ it('contains driver.add_cookie( (CONTRACTS.md §5)', () => {
+ const profile = profileWith({ name: 's', value: 'v' });
+ const snippet = exportSeleniumSnippet(profile, 'python');
+ // CONTRACTS.md §5: python dialect uses driver.add_cookie(
+ expect(snippet).toContain('driver.add_cookie(');
+ });
+
+ it('does not use the JS-style addCookie API', () => {
+ const profile = profileWith({ name: 's', value: 'v' });
+ const snippet = exportSeleniumSnippet(profile, 'python');
+ // Python Selenium uses add_cookie, not addCookie
+ expect(snippet).not.toContain('addCookie(');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// exportSeleniumSnippet — JS dialect (CONTRACTS.md §5)
+// ---------------------------------------------------------------------------
+
+describe('exportSeleniumSnippet(js): output is a string', () => {
+ it('returns a string for js lang', () => {
+ const snippet = exportSeleniumSnippet(makeProfile(), 'js');
+ expect(typeof snippet).toBe('string');
+ expect(snippet.length).toBeGreaterThan(0);
+ });
+});
+
+describe('exportSeleniumSnippet(js): contains every cookie name and value', () => {
+ it('includes the cookie name', () => {
+ const profile = profileWith({ name: 'refresh_token', value: 'rt-999' });
+ const snippet = exportSeleniumSnippet(profile, 'js');
+ expect(snippet).toContain('refresh_token');
+ });
+
+ it('includes the cookie value', () => {
+ const profile = profileWith({ name: 'refresh_token', value: 'rt-999' });
+ const snippet = exportSeleniumSnippet(profile, 'js');
+ expect(snippet).toContain('rt-999');
+ });
+});
+
+describe('exportSeleniumSnippet(js): uses the correct JS Selenium API call', () => {
+ it('contains driver.addCookie( (CONTRACTS.md §5 — Python vs JS differ)', () => {
+ const profile = profileWith({ name: 's', value: 'v' });
+ const snippet = exportSeleniumSnippet(profile, 'js');
+ // CONTRACTS.md §5: "selenium python vs js differ appropriately"
+ // JS WebDriverJS uses driver.addCookie, Python uses driver.add_cookie
+ expect(snippet).toContain('driver.addCookie(');
+ });
+
+ it('does not use the Python-style add_cookie API', () => {
+ const profile = profileWith({ name: 's', value: 'v' });
+ const snippet = exportSeleniumSnippet(profile, 'js');
+ expect(snippet).not.toContain('add_cookie(');
+ });
+});
+
+describe('exportSeleniumSnippet: python and js outputs differ from each other', () => {
+ it('python and js snippets are distinct strings', () => {
+ const profile = profileWith({ name: 'c', value: 'v' });
+ const python = exportSeleniumSnippet(profile, 'python');
+ const js = exportSeleniumSnippet(profile, 'js');
+ // The two dialects must produce different output — they are not the same API
+ expect(python).not.toBe(js);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// exportCurlSnippet (CONTRACTS.md §5)
+// ---------------------------------------------------------------------------
+
+describe('exportCurlSnippet: output is a string', () => {
+ it('returns a string', () => {
+ const snippet = exportCurlSnippet(makeProfile());
+ expect(typeof snippet).toBe('string');
+ expect(snippet.length).toBeGreaterThan(0);
+ });
+});
+
+describe('exportCurlSnippet: contains every cookie name and value', () => {
+ it('includes the cookie name', () => {
+ const profile = profileWith({ name: 'sess_id', value: 'sid-abc' });
+ const snippet = exportCurlSnippet(profile);
+ expect(snippet).toContain('sess_id');
+ });
+
+ it('includes the cookie value', () => {
+ const profile = profileWith({ name: 'sess_id', value: 'sid-abc' });
+ const snippet = exportCurlSnippet(profile);
+ expect(snippet).toContain('sid-abc');
+ });
+
+ it('includes all cookie names for multiple cookies', () => {
+ const profile = profileWith(
+ { name: 'token', value: 't1' },
+ { name: 'user', value: 'u1' },
+ { name: 'pref', value: 'p1' },
+ );
+ const snippet = exportCurlSnippet(profile);
+ expect(snippet).toContain('token');
+ expect(snippet).toContain('user');
+ expect(snippet).toContain('pref');
+ });
+
+ it('includes all cookie values for multiple cookies', () => {
+ const profile = profileWith(
+ { name: 'token', value: 't1' },
+ { name: 'user', value: 'u1' },
+ );
+ const snippet = exportCurlSnippet(profile);
+ expect(snippet).toContain('t1');
+ expect(snippet).toContain('u1');
+ });
+});
+
+describe('exportCurlSnippet: correct cURL API shape (CONTRACTS.md §5)', () => {
+ it('contains curl and the -b flag', () => {
+ const profile = profileWith({ name: 'c', value: 'v' });
+ const snippet = exportCurlSnippet(profile);
+ expect(snippet).toContain('curl');
+ expect(snippet).toContain('-b');
+ });
+
+ it('joins cookies with "; " (semicolon-space) in the -b cookie string', () => {
+ const profile = profileWith(
+ { name: 'a', value: 'alpha' },
+ { name: 'b', value: 'beta' },
+ );
+ const snippet = exportCurlSnippet(profile);
+ // CONTRACTS.md §5: cURL joins cookies as "name=value; name2=value2"
+ expect(snippet).toContain('a=alpha; b=beta');
+ });
+
+ it('formats each cookie as name=value', () => {
+ const profile = profileWith({ name: 'myKey', value: 'myVal' });
+ const snippet = exportCurlSnippet(profile);
+ expect(snippet).toContain('myKey=myVal');
+ });
+
+ it('wraps the cookie string in quotes in the -b argument', () => {
+ const profile = profileWith({ name: 'k', value: 'v' });
+ const snippet = exportCurlSnippet(profile);
+ // The -b "k=v" value must be quoted so it works in a shell
+ expect(snippet).toMatch(/-b\s+"[^"]+"/);
+ });
+
+ it('three cookies are joined by exactly "; " between each pair', () => {
+ const profile = profileWith(
+ { name: 'x', value: '1' },
+ { name: 'y', value: '2' },
+ { name: 'z', value: '3' },
+ );
+ const snippet = exportCurlSnippet(profile);
+ expect(snippet).toContain('x=1; y=2; z=3');
+ });
+});
+
+describe('exportCurlSnippet: edge cases', () => {
+ it('handles a single cookie without trailing separator', () => {
+ const profile = profileWith({ name: 'only', value: 'one' });
+ const snippet = exportCurlSnippet(profile);
+ // Should not have a trailing "; " after the single cookie
+ expect(snippet).not.toMatch(/only=one;\s*"/);
+ });
+
+ it('handles zero cookies without throwing', () => {
+ const profile = makeProfile({ cookies: [], localStorage: {} });
+ expect(() => exportCurlSnippet(profile)).not.toThrow();
+ });
+});
diff --git a/tests/harness/factories.ts b/tests/harness/factories.ts
new file mode 100644
index 0000000..fb681b9
--- /dev/null
+++ b/tests/harness/factories.ts
@@ -0,0 +1,66 @@
+/**
+ * Test data factories. Centralized so every test builds domain objects the same
+ * way and so a model change surfaces in one place.
+ */
+
+import type { CookieRecord, Profile, Snapshot, Entitlement, StoreResult } from '@/types/models';
+
+let seq = 0;
+const id = (p: string) => `${p}-${++seq}`;
+
+export function makeCookie(over: Partial = {}): CookieRecord {
+ return {
+ name: 'session',
+ value: 'abc123',
+ domain: 'example.com',
+ path: '/',
+ secure: true,
+ httpOnly: true,
+ sameSite: 'lax',
+ expirationDate: 4102444800, // 2100-01-01
+ hostOnly: false,
+ session: false,
+ storeId: '0',
+ ...over,
+ };
+}
+
+export function makeProfile(over: Partial = {}): Profile {
+ return {
+ id: id('profile'),
+ name: 'admin / staging',
+ environment: 'staging',
+ tags: ['admin'],
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ cookies: [makeCookie()],
+ localStorage: { token: 'lsval' },
+ sessionStorage: {},
+ sizeBytes: 128,
+ createdAt: '2026-01-01T00:00:00.000Z',
+ updatedAt: '2026-01-01T00:00:00.000Z',
+ ...over,
+ };
+}
+
+export function makeSnapshot(over: Partial = {}): Snapshot {
+ return {
+ id: id('snapshot'),
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ cookies: [makeCookie()],
+ localStorage: {},
+ sessionStorage: {},
+ createdAt: '2026-01-01T00:00:00.000Z',
+ reason: 'pre-switch',
+ ...over,
+ };
+}
+
+export function makeEntitlement(over: Partial = {}): Entitlement {
+ return { subjectId: 'local', tier: 'free', ...over };
+}
+
+export function makeStoreResult(over: Partial = {}): StoreResult {
+ return { store: 'cookies', status: 'applied', ...over };
+}
diff --git a/tests/harness/fakeChrome.ts b/tests/harness/fakeChrome.ts
new file mode 100644
index 0000000..270733b
--- /dev/null
+++ b/tests/harness/fakeChrome.ts
@@ -0,0 +1,549 @@
+/**
+ * Realistic in-memory fake of the subset of the `chrome.*` extension API that
+ * Sessionist uses. Installed on globalThis by tests/setup.ts and reset between
+ * tests. The goal is behaviour close enough to real Chrome that a service which
+ * passes here will work in the browser:
+ *
+ * - chrome.storage.local — real get/set/remove/clear semantics
+ * - chrome.cookies — a cookie store with domain/url/path matching
+ * - chrome.permissions — per-origin grants; request() is configurable
+ * - chrome.tabs — tabs with per-tab page web storage; query/reload/...
+ * - chrome.scripting — executeScript actually runs the injected func
+ * against the target tab's web storage
+ * - chrome.runtime — id, messaging (sendMessage/onMessage), onInstalled
+ * - chrome.sidePanel — setPanelBehavior/open/setOptions recorders
+ *
+ * Tests drive it via the exported `control` helper (seed cookies/tabs/grants,
+ * set whether permission requests are granted, trigger lifecycle events, etc.).
+ */
+
+import { vi } from 'vitest';
+
+// --------------------------------------------------------------------------
+// Types (loosely structural; mirror chrome.* shapes we depend on)
+// --------------------------------------------------------------------------
+
+export interface FakeCookie {
+ name: string;
+ value: string;
+ domain: string;
+ path: string;
+ secure: boolean;
+ httpOnly: boolean;
+ sameSite: 'no_restriction' | 'lax' | 'strict' | 'unspecified';
+ expirationDate?: number;
+ hostOnly: boolean;
+ session: boolean;
+ storeId: string;
+ partitionKey?: { topLevelSite?: string } | string;
+}
+
+export interface FakeTab {
+ id: number;
+ url: string;
+ active: boolean;
+ windowId: number;
+ /** Per-tab page web storage (origin-scoped in reality). */
+ localStorage: Record;
+ sessionStorage: Record;
+}
+
+interface Listener {
+ addListener: (cb: (...a: A) => unknown) => void;
+ removeListener: (cb: (...a: A) => unknown) => void;
+ hasListener: (cb: (...a: A) => unknown) => boolean;
+ _emit: (...a: A) => unknown[];
+ _clear: () => void;
+}
+
+function makeEvent (): Listener {
+ const cbs = new Set<(...a: A) => unknown>();
+ return {
+ addListener: (cb) => void cbs.add(cb),
+ removeListener: (cb) => void cbs.delete(cb),
+ hasListener: (cb) => cbs.has(cb),
+ _emit: (...a: A) => [...cbs].map((cb) => cb(...a)),
+ _clear: () => cbs.clear(),
+ };
+}
+
+const ALL_EVENTS: Array<{ _clear: () => void }> = [];
+function trackedEvent (): Listener {
+ const e = makeEvent ();
+ ALL_EVENTS.push(e);
+ return e;
+}
+
+// --------------------------------------------------------------------------
+// Mutable state (reset() clears it)
+// --------------------------------------------------------------------------
+
+interface State {
+ storage: Record;
+ cookies: FakeCookie[];
+ grantedOrigins: Set;
+ installPermissions: Set;
+ /** Result request() resolves to; can be a fn for per-call decisions. */
+ grantDecision: boolean | ((origins: string[]) => boolean);
+ tabs: FakeTab[];
+ nextTabId: number;
+ panelBehavior: unknown;
+ panelOpens: unknown[];
+ lastError: { message: string } | undefined;
+ /** Fault injection: make specific chrome APIs throw to test failure paths. */
+ failures: {
+ cookieSet?: boolean;
+ cookieRemove?: boolean;
+ cookieGetAll?: boolean;
+ executeScript?: boolean;
+ permissionRequest?: boolean;
+ storageSet?: boolean;
+ };
+}
+
+const state: State = freshState();
+
+function freshState(): State {
+ return {
+ storage: {},
+ cookies: [],
+ grantedOrigins: new Set(),
+ installPermissions: new Set(['cookies', 'storage', 'sidePanel', 'scripting', 'activeTab']),
+ grantDecision: true,
+ tabs: [],
+ nextTabId: 1,
+ panelBehavior: undefined,
+ panelOpens: [],
+ lastError: undefined,
+ failures: {},
+ };
+}
+
+// --------------------------------------------------------------------------
+// Events
+// --------------------------------------------------------------------------
+
+const onMessage =
+ trackedEvent<[unknown, chrome.runtime.MessageSender, (response?: unknown) => void]>();
+const onInstalled = trackedEvent<[{ reason: string }]>();
+const onActivated = trackedEvent<[{ tabId: number; windowId: number }]>();
+const onUpdated = trackedEvent<[number, { status?: string; url?: string }, FakeTab]>();
+const permOnAdded = trackedEvent<[{ origins?: string[] }]>();
+const permOnRemoved = trackedEvent<[{ origins?: string[] }]>();
+
+// --------------------------------------------------------------------------
+// Helpers
+// --------------------------------------------------------------------------
+
+/** Chrome getAll domain filter: cookie matches a domain or its subdomains. */
+function domainMatches(cookieDomain: string, filterDomain: string): boolean {
+ const c = cookieDomain.replace(/^\./, '').toLowerCase();
+ const f = filterDomain.replace(/^\./, '').toLowerCase();
+ return c === f || c.endsWith('.' + f) || f.endsWith('.' + c);
+}
+
+function urlMatchesCookie(url: string, cookie: FakeCookie): boolean {
+ let u: URL;
+ try {
+ u = new URL(url);
+ } catch {
+ return false;
+ }
+ const host = u.hostname.toLowerCase();
+ const cd = cookie.domain.replace(/^\./, '').toLowerCase();
+ const domainOk = cookie.hostOnly ? host === cd : host === cd || host.endsWith('.' + cd);
+ const pathOk = u.pathname.startsWith(cookie.path);
+ const secureOk = cookie.secure ? u.protocol === 'https:' : true;
+ return domainOk && pathOk && secureOk;
+}
+
+function partitionEq(a: FakeCookie['partitionKey'], b: FakeCookie['partitionKey']): boolean {
+ return JSON.stringify(a ?? null) === JSON.stringify(b ?? null);
+}
+
+// --------------------------------------------------------------------------
+// chrome.storage.local
+// --------------------------------------------------------------------------
+
+const storageLocal = {
+ get: vi.fn(async (keys?: string | string[] | Record | null) => {
+ if (keys == null) return { ...state.storage };
+ if (typeof keys === 'string') {
+ return keys in state.storage ? { [keys]: state.storage[keys] } : {};
+ }
+ if (Array.isArray(keys)) {
+ const out: Record = {};
+ for (const k of keys) if (k in state.storage) out[k] = state.storage[k];
+ return out;
+ }
+ // object of defaults
+ const out: Record = {};
+ for (const [k, def] of Object.entries(keys)) {
+ out[k] = k in state.storage ? state.storage[k] : def;
+ }
+ return out;
+ }),
+ set: vi.fn(async (items: Record) => {
+ if (state.failures.storageSet) throw new Error('fake: storage.local.set failed');
+ Object.assign(state.storage, structuredClone(items));
+ }),
+ remove: vi.fn(async (keys: string | string[]) => {
+ for (const k of Array.isArray(keys) ? keys : [keys]) delete state.storage[k];
+ }),
+ clear: vi.fn(async () => {
+ state.storage = {};
+ }),
+};
+
+// --------------------------------------------------------------------------
+// chrome.cookies
+// --------------------------------------------------------------------------
+
+const cookies = {
+ getAll: vi.fn(async (details: chrome.cookies.GetAllDetails = {}) => {
+ if (state.failures.cookieGetAll) throw new Error('fake: cookies.getAll failed');
+ return state.cookies.filter((c) => {
+ if (details.name != null && c.name !== details.name) return false;
+ if (details.domain != null && !domainMatches(c.domain, details.domain)) return false;
+ if (details.path != null && c.path !== details.path) return false;
+ if (details.secure != null && c.secure !== details.secure) return false;
+ if (details.session != null && c.session !== details.session) return false;
+ if (details.storeId != null && c.storeId !== details.storeId) return false;
+ if (details.url != null && !urlMatchesCookie(details.url, c)) return false;
+ return true;
+ });
+ }),
+ get: vi.fn(async (details: { url: string; name: string; storeId?: string }) => {
+ return (
+ state.cookies.find((c) => c.name === details.name && urlMatchesCookie(details.url, c)) ?? null
+ );
+ }),
+ set: vi.fn(async (details: chrome.cookies.SetDetails) => {
+ if (state.failures.cookieSet) throw new Error('fake: cookies.set failed');
+ const url = new URL(details.url);
+ const hostOnly = details.domain == null;
+ const cookie: FakeCookie = {
+ name: details.name ?? '',
+ value: details.value ?? '',
+ domain: (details.domain ?? url.hostname).toLowerCase(),
+ path: details.path ?? '/',
+ secure: details.secure ?? false,
+ httpOnly: details.httpOnly ?? false,
+ sameSite: (details.sameSite as FakeCookie['sameSite']) ?? 'unspecified',
+ expirationDate: details.expirationDate,
+ hostOnly,
+ session: details.expirationDate == null,
+ storeId: details.storeId ?? '0',
+ partitionKey: details.partitionKey as FakeCookie['partitionKey'],
+ };
+ // Replace cookie with same identity (name+domain+path+partition+store).
+ const idx = state.cookies.findIndex(
+ (c) =>
+ c.name === cookie.name &&
+ c.domain === cookie.domain &&
+ c.path === cookie.path &&
+ c.storeId === cookie.storeId &&
+ partitionEq(c.partitionKey, cookie.partitionKey),
+ );
+ if (idx >= 0) state.cookies[idx] = cookie;
+ else state.cookies.push(cookie);
+ return cookie;
+ }),
+ remove: vi.fn(
+ async (details: { url: string; name: string; storeId?: string; partitionKey?: unknown }) => {
+ if (state.failures.cookieRemove) throw new Error('fake: cookies.remove failed');
+ const before = state.cookies.length;
+ state.cookies = state.cookies.filter(
+ (c) =>
+ !(
+ c.name === details.name &&
+ urlMatchesCookie(details.url, c) &&
+ (details.storeId == null || c.storeId === details.storeId) &&
+ (details.partitionKey === undefined ||
+ partitionEq(c.partitionKey, details.partitionKey as FakeCookie['partitionKey']))
+ ),
+ );
+ return before === state.cookies.length ? null : { url: details.url, name: details.name };
+ },
+ ),
+};
+
+// --------------------------------------------------------------------------
+// chrome.permissions
+// --------------------------------------------------------------------------
+
+const permissions = {
+ getAll: vi.fn(async () => ({
+ permissions: [...state.installPermissions],
+ origins: [...state.grantedOrigins],
+ })),
+ contains: vi.fn(async (perms: { origins?: string[]; permissions?: string[] }) => {
+ const originsOk = (perms.origins ?? []).every((o) => state.grantedOrigins.has(o));
+ const permsOk = (perms.permissions ?? []).every((p) => state.installPermissions.has(p));
+ return originsOk && permsOk;
+ }),
+ request: vi.fn(async (perms: { origins?: string[]; permissions?: string[] }) => {
+ if (state.failures.permissionRequest) throw new Error('fake: permissions.request failed');
+ const origins = perms.origins ?? [];
+ const grant =
+ typeof state.grantDecision === 'function'
+ ? state.grantDecision(origins)
+ : state.grantDecision;
+ if (grant) {
+ origins.forEach((o) => state.grantedOrigins.add(o));
+ if (origins.length) permOnAdded._emit({ origins });
+ }
+ return grant;
+ }),
+ remove: vi.fn(async (perms: { origins?: string[] }) => {
+ const origins = perms.origins ?? [];
+ origins.forEach((o) => state.grantedOrigins.delete(o));
+ if (origins.length) permOnRemoved._emit({ origins });
+ return true;
+ }),
+ onAdded: permOnAdded,
+ onRemoved: permOnRemoved,
+};
+
+// --------------------------------------------------------------------------
+// chrome.tabs
+// --------------------------------------------------------------------------
+
+function publicTab(t: FakeTab): chrome.tabs.Tab {
+ // Real Chrome omits url unless `tabs`/host permission is held; tests seed url
+ // directly, so we expose it. Strip the internal storage fields.
+ const { localStorage, sessionStorage, ...rest } = t;
+ void localStorage;
+ void sessionStorage;
+ return rest as unknown as chrome.tabs.Tab;
+}
+
+const tabs = {
+ query: vi.fn(async (info: chrome.tabs.QueryInfo = {}) => {
+ return state.tabs
+ .filter((t) => {
+ if (info.active != null && t.active !== info.active) return false;
+ if (info.url != null) {
+ const pats = Array.isArray(info.url) ? info.url : [info.url];
+ if (!pats.some((p) => matchPattern(p, t.url))) return false;
+ }
+ return true;
+ })
+ .map(publicTab);
+ }),
+ get: vi.fn(async (tabId: number) => {
+ const t = state.tabs.find((x) => x.id === tabId);
+ if (!t) throw new Error(`No tab with id: ${tabId}`);
+ return publicTab(t);
+ }),
+ reload: vi.fn(async (_tabId?: number) => {}),
+ create: vi.fn(async (props: { url?: string; active?: boolean }) => {
+ const t: FakeTab = {
+ id: state.nextTabId++,
+ url: props.url ?? 'about:blank',
+ active: props.active ?? true,
+ windowId: 1,
+ localStorage: {},
+ sessionStorage: {},
+ };
+ state.tabs.push(t);
+ return publicTab(t);
+ }),
+ sendMessage: vi.fn(async (_tabId: number, _msg: unknown) => undefined),
+ onActivated,
+ onUpdated,
+};
+
+function matchPattern(pattern: string, url: string): boolean {
+ if (pattern === '' || pattern === '*://*/*') return true;
+ // very small glob: scheme://host/path with * wildcards
+ const re = new RegExp(
+ '^' + pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*') + '$',
+ );
+ return re.test(url);
+}
+
+// --------------------------------------------------------------------------
+// chrome.scripting — actually executes the injected func against the tab page
+// --------------------------------------------------------------------------
+
+const scripting = {
+ executeScript: vi.fn(
+ async (injection: {
+ target: { tabId: number };
+ func: (...a: Args) => R;
+ args?: Args;
+ }) => {
+ if (state.failures.executeScript) throw new Error('fake: executeScript failed');
+ const tab = state.tabs.find((t) => t.id === injection.target.tabId);
+ if (!tab) throw new Error(`Cannot access tab ${injection.target.tabId}`);
+ // Permission gate, like the real API: need host access for the origin.
+ const origin = (() => {
+ try {
+ return new URL(tab.url).origin + '/*';
+ } catch {
+ return '';
+ }
+ })();
+ const hasHost =
+ state.grantedOrigins.has(origin) ||
+ [...state.grantedOrigins].some((o) => o === '*://*/*' || o === '');
+ if (!hasHost && !state.installPermissions.has('activeTab')) {
+ throw new Error('Cannot access contents of the page. Missing host permission.');
+ }
+ // Load the tab's page storage into jsdom window storage, run, save back.
+ loadPageStorage(tab);
+ try {
+ const result = injection.func(...((injection.args ?? []) as Args));
+ return [{ result, frameId: 0 }];
+ } finally {
+ savePageStorage(tab);
+ }
+ },
+ ),
+};
+
+function loadPageStorage(tab: FakeTab) {
+ window.localStorage.clear();
+ window.sessionStorage.clear();
+ for (const [k, v] of Object.entries(tab.localStorage)) window.localStorage.setItem(k, v);
+ for (const [k, v] of Object.entries(tab.sessionStorage)) window.sessionStorage.setItem(k, v);
+}
+
+function savePageStorage(tab: FakeTab) {
+ tab.localStorage = {};
+ tab.sessionStorage = {};
+ for (let i = 0; i < window.localStorage.length; i++) {
+ const k = window.localStorage.key(i)!;
+ tab.localStorage[k] = window.localStorage.getItem(k)!;
+ }
+ for (let i = 0; i < window.sessionStorage.length; i++) {
+ const k = window.sessionStorage.key(i)!;
+ tab.sessionStorage[k] = window.sessionStorage.getItem(k)!;
+ }
+}
+
+// --------------------------------------------------------------------------
+// chrome.runtime — messaging + lifecycle
+// --------------------------------------------------------------------------
+
+const RUNTIME_ID = 'sessionist-test-id';
+
+const runtime = {
+ id: RUNTIME_ID,
+ lastError: undefined as { message: string } | undefined,
+ sendMessage: vi.fn(async (message: unknown) => {
+ // Dispatch to onMessage listeners; resolve with the first response delivered
+ // via sendResponse (mirrors chrome's single-response model).
+ const sender: chrome.runtime.MessageSender = { id: RUNTIME_ID };
+ return new Promise((resolve) => {
+ let responded = false;
+ const sendResponse = (response?: unknown) => {
+ if (!responded) {
+ responded = true;
+ resolve(response);
+ }
+ };
+ const results = onMessage._emit(message, sender, sendResponse);
+ // If no listener kept the channel open (returned true) and none responded
+ // synchronously, resolve undefined.
+ const keptOpen = results.some((r) => r === true);
+ if (!keptOpen && !responded) resolve(undefined);
+ });
+ }),
+ onMessage,
+ onInstalled,
+};
+
+// --------------------------------------------------------------------------
+// chrome.sidePanel
+// --------------------------------------------------------------------------
+
+const sidePanel = {
+ setPanelBehavior: vi.fn(async (behavior: unknown) => {
+ state.panelBehavior = behavior;
+ }),
+ open: vi.fn(async (opts: unknown) => {
+ state.panelOpens.push(opts);
+ }),
+ setOptions: vi.fn(async () => {}),
+};
+
+// --------------------------------------------------------------------------
+// Assembled fake + test control surface
+// --------------------------------------------------------------------------
+
+export const fakeChrome = {
+ runtime,
+ storage: { local: storageLocal },
+ cookies,
+ permissions,
+ tabs,
+ scripting,
+ sidePanel,
+};
+
+export const control = {
+ reset() {
+ Object.assign(state, freshState());
+ window.localStorage.clear();
+ window.sessionStorage.clear();
+ ALL_EVENTS.forEach((e) => e._clear());
+ vi.clearAllMocks();
+ },
+ // --- seeding ---
+ seedCookies(cs: Partial[]) {
+ state.cookies.push(...cs.map(normalizeCookie));
+ },
+ getCookies: () => state.cookies.map((c) => ({ ...c })),
+ seedStorage(obj: Record) {
+ Object.assign(state.storage, structuredClone(obj));
+ },
+ getStorage: () => structuredClone(state.storage),
+ grantOrigin(origin: string) {
+ state.grantedOrigins.add(origin);
+ },
+ getGrantedOrigins: () => [...state.grantedOrigins],
+ setGrantDecision(decision: boolean | ((origins: string[]) => boolean)) {
+ state.grantDecision = decision;
+ },
+ /** Fault injection — make specific chrome APIs throw (test failure paths). */
+ setFailure(failures: Partial) {
+ Object.assign(state.failures, failures);
+ },
+ addTab(tab: Partial & { url: string }): FakeTab {
+ const t: FakeTab = {
+ id: tab.id ?? state.nextTabId++,
+ url: tab.url,
+ active: tab.active ?? true,
+ windowId: tab.windowId ?? 1,
+ localStorage: tab.localStorage ?? {},
+ sessionStorage: tab.sessionStorage ?? {},
+ };
+ state.tabs.push(t);
+ return t;
+ },
+ getTab: (id: number) => state.tabs.find((t) => t.id === id),
+ // --- lifecycle triggers ---
+ triggerInstalled: (reason = 'install') => onInstalled._emit({ reason }),
+ triggerTabActivated: (tabId: number, windowId = 1) => onActivated._emit({ tabId, windowId }),
+ getPanelBehavior: () => state.panelBehavior,
+ getPanelOpens: () => state.panelOpens,
+};
+
+function normalizeCookie(c: Partial): FakeCookie {
+ return {
+ name: c.name ?? 'c',
+ value: c.value ?? 'v',
+ domain: (c.domain ?? 'example.com').toLowerCase(),
+ path: c.path ?? '/',
+ secure: c.secure ?? false,
+ httpOnly: c.httpOnly ?? false,
+ sameSite: c.sameSite ?? 'unspecified',
+ expirationDate: c.expirationDate,
+ hostOnly: c.hostOnly ?? false,
+ session: c.session ?? c.expirationDate == null,
+ storeId: c.storeId ?? '0',
+ partitionKey: c.partitionKey,
+ };
+}
diff --git a/tests/licensing/entitlementService.test.ts b/tests/licensing/entitlementService.test.ts
new file mode 100644
index 0000000..1e81cfa
--- /dev/null
+++ b/tests/licensing/entitlementService.test.ts
@@ -0,0 +1,422 @@
+/**
+ * Tests for the entitlement service (PRD §11 / CONTRACTS.md §8).
+ *
+ * These tests encode the contract so they fail cleanly now (the service throws
+ * NotImplementedError) and pass only when correctly implemented.
+ * We NEVER assert NotImplementedError.
+ *
+ * Dependency: verifyLicenseKey is a real dependency here; the tests rely on the
+ * shared in-memory key injected via setLicensePublicKey so that activateLicense
+ * can perform a real signature check. This is intentional — entitlement activation
+ * is the interop point described in CONTRACTS §8.
+ *
+ * chrome.storage.local is provided by the fakeChrome harness (tests/setup.ts).
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import {
+ getEntitlement,
+ activateLicense,
+ startCheckout,
+ hasPro,
+} from '@/services/licensing/entitlementService';
+import { setLicensePublicKey } from '@/services/licensing/licenseVerifier';
+import { control } from '../harness/fakeChrome';
+
+// ---------------------------------------------------------------------------
+// Shared crypto helpers (same assumptions as licenseVerifier.test.ts)
+// ---------------------------------------------------------------------------
+
+function toBase64Url(buf: ArrayBuffer | Uint8Array): string {
+ const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
+ return Buffer.from(bytes).toString('base64url');
+}
+
+function toBase64(buf: ArrayBuffer | Uint8Array): string {
+ const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
+ return Buffer.from(bytes).toString('base64');
+}
+
+interface KeyPair {
+ privateKey: CryptoKey;
+ publicKey: CryptoKey;
+ publicKeyBase64: string;
+ privateKeyBase64: string;
+}
+
+async function generateKeyPair(): Promise {
+ const kp = await crypto.subtle.generateKey({ name: 'Ed25519' }, true, ['sign', 'verify']);
+ const rawPub = await crypto.subtle.exportKey('raw', kp.publicKey);
+ const pkcs8Priv = await crypto.subtle.exportKey('pkcs8', kp.privateKey);
+ return {
+ privateKey: kp.privateKey,
+ publicKey: kp.publicKey,
+ publicKeyBase64: toBase64(rawPub),
+ privateKeyBase64: toBase64(pkcs8Priv),
+ };
+}
+
+interface LicensePayload {
+ subjectId: string;
+ tier: 'pro';
+ issuedAt: string;
+ validUntil?: string;
+}
+
+async function mintKey(kp: KeyPair, payload: LicensePayload): Promise {
+ const payloadJson = JSON.stringify(payload);
+ const payloadBytes = new TextEncoder().encode(payloadJson);
+ const payloadB64u = toBase64Url(payloadBytes);
+ const sig = await crypto.subtle.sign('Ed25519', kp.privateKey, payloadBytes);
+ return `${payloadB64u}.${toBase64Url(sig)}`;
+}
+
+// ---------------------------------------------------------------------------
+// Setup — fresh keypair + public key injection per test
+// ---------------------------------------------------------------------------
+
+let kp: KeyPair;
+
+beforeEach(async () => {
+ // control.reset() is called by tests/setup.ts beforeEach, which clears
+ // chrome.storage.local — so each test starts with no persisted entitlement.
+ kp = await generateKeyPair();
+ setLicensePublicKey(kp.publicKeyBase64);
+});
+
+// ---------------------------------------------------------------------------
+// CONTRACTS §8: getEntitlement
+// ---------------------------------------------------------------------------
+
+describe('getEntitlement', () => {
+ it('returns the free default when no license has been activated', async () => {
+ const ent = await getEntitlement();
+
+ expect(ent.subjectId).toBe('local');
+ expect(ent.tier).toBe('free');
+ });
+
+ it('returns an object (never null/undefined)', async () => {
+ const ent = await getEntitlement();
+ expect(ent).not.toBeNull();
+ expect(ent).not.toBeUndefined();
+ expect(typeof ent).toBe('object');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// CONTRACTS §8: activateLicense — valid key
+// ---------------------------------------------------------------------------
+
+describe('activateLicense — valid key', () => {
+ it('verifies, persists, and returns pro entitlement', async () => {
+ const key = await mintKey(kp, {
+ subjectId: 'buyer-1',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const ent = await activateLicense(key);
+
+ expect(ent.tier).toBe('pro');
+ expect(ent.subjectId).toBe('buyer-1');
+ });
+
+ it('getEntitlement reflects pro after activateLicense succeeds', async () => {
+ const key = await mintKey(kp, {
+ subjectId: 'buyer-2',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ await activateLicense(key);
+ const ent = await getEntitlement();
+
+ expect(ent.tier).toBe('pro');
+ expect(ent.subjectId).toBe('buyer-2');
+ });
+
+ it('preserves validUntil from the license payload', async () => {
+ const validUntil = new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString();
+ const key = await mintKey(kp, {
+ subjectId: 'buyer-3',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ validUntil,
+ });
+
+ const ent = await activateLicense(key);
+
+ expect(ent.validUntil).toBe(validUntil);
+ });
+
+ it('re-activating with a new valid key updates the stored entitlement', async () => {
+ const key1 = await mintKey(kp, {
+ subjectId: 'original-buyer',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+ await activateLicense(key1);
+
+ const kp2 = await generateKeyPair();
+ setLicensePublicKey(kp2.publicKeyBase64);
+ const key2 = await mintKey(kp2, {
+ subjectId: 'new-buyer',
+ tier: 'pro',
+ issuedAt: '2026-06-01T00:00:00.000Z',
+ });
+ await activateLicense(key2);
+
+ const ent = await getEntitlement();
+ expect(ent.subjectId).toBe('new-buyer');
+ expect(ent.tier).toBe('pro');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// CONTRACTS §8: activateLicense — invalid key must NOT persist pro
+// ---------------------------------------------------------------------------
+
+describe('activateLicense — invalid key', () => {
+ it('does not persist pro for a tampered key (rejects or returns free)', async () => {
+ const key = await mintKey(kp, {
+ subjectId: 'tamper',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+ // Flip a byte in the payload
+ const [payloadB64u, sigB64u] = key.split('.');
+ const bytes = Buffer.from(payloadB64u, 'base64url');
+ bytes[0] ^= 0x01;
+ const badKey = `${bytes.toString('base64url')}.${sigB64u}`;
+
+ // The service must either reject (throw) or return free — either is compliant.
+ let result: Awaited> | null = null;
+ try {
+ result = await activateLicense(badKey);
+ } catch {
+ // Threw — that's fine, just check nothing was persisted.
+ }
+
+ // If it returned something, it must be free.
+ if (result !== null) {
+ expect(result.tier).not.toBe('pro');
+ }
+
+ // Regardless, getEntitlement must remain free.
+ const ent = await getEntitlement();
+ expect(ent.tier).toBe('free');
+ });
+
+ it('does not persist pro for a key signed by a different private key', async () => {
+ const kp2 = await generateKeyPair();
+ const badKey = await mintKey(kp2, {
+ subjectId: 'wrong-signer',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+ // kp's public key is in the verifier; kp2 signed the key → invalid
+
+ try {
+ await activateLicense(badKey);
+ } catch {
+ // expected
+ }
+
+ const ent = await getEntitlement();
+ expect(ent.tier).toBe('free');
+ });
+
+ it('does not persist pro for an expired key', async () => {
+ const expiredKey = await mintKey(kp, {
+ subjectId: 'expired',
+ tier: 'pro',
+ issuedAt: '2020-01-01T00:00:00.000Z',
+ validUntil: '2021-01-01T00:00:00.000Z',
+ });
+
+ try {
+ await activateLicense(expiredKey);
+ } catch {
+ // expected
+ }
+
+ const ent = await getEntitlement();
+ expect(ent.tier).toBe('free');
+ });
+
+ it('does not persist pro for a completely malformed key string', async () => {
+ try {
+ await activateLicense('not-a-valid-key-at-all');
+ } catch {
+ // expected
+ }
+
+ const ent = await getEntitlement();
+ expect(ent.tier).toBe('free');
+ });
+
+ it('does not persist pro for an empty string key', async () => {
+ try {
+ await activateLicense('');
+ } catch {
+ // expected
+ }
+
+ const ent = await getEntitlement();
+ expect(ent.tier).toBe('free');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// CONTRACTS §8: tampered cached entitlement must NOT grant pro
+// ---------------------------------------------------------------------------
+
+describe('tampered cached entitlement', () => {
+ it('does not grant pro when chrome.storage holds a pro entitlement with no backing key', async () => {
+ // Directly inject a pro entitlement object into storage, bypassing activateLicense.
+ // This simulates an attacker editing the extension's storage. The service
+ // must re-verify on read and fall back to free.
+ control.seedStorage({
+ entitlement: { subjectId: 'hacker', tier: 'pro' },
+ });
+
+ const ent = await getEntitlement();
+
+ // If the service re-verifies (no backing key in storage) it must return free.
+ // If the service trusts cached values, this test will fail — which is correct:
+ // a tampered cache must NOT grant pro without a valid signed key.
+ expect(ent.tier).toBe('free');
+ });
+
+ it('does not grant pro when the stored license key is absent but tier is pro', async () => {
+ // Store a pro tier with no signed key — service must refuse.
+ control.seedStorage({
+ // Some services store {tier:'pro'} without the key; others store the key separately.
+ // Either way, the signed key must be present and valid.
+ entitlement: { subjectId: 'no-key-user', tier: 'pro', validUntil: undefined },
+ licenseKey: null,
+ });
+
+ const ent = await getEntitlement();
+ expect(ent.tier).toBe('free');
+ });
+
+ it('grants pro when both the entitlement and valid backing key are stored', async () => {
+ // First activate properly, then call getEntitlement in a fresh read.
+ const key = await mintKey(kp, {
+ subjectId: 'legit',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+ await activateLicense(key);
+
+ // getEntitlement re-reads from storage — it should still return pro.
+ const ent = await getEntitlement();
+ expect(ent.tier).toBe('pro');
+ expect(ent.subjectId).toBe('legit');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// CONTRACTS §8: hasPro
+// ---------------------------------------------------------------------------
+
+describe('hasPro', () => {
+ it('returns false by default (free tier)', async () => {
+ expect(await hasPro()).toBe(false);
+ });
+
+ it('returns true after activating a valid pro license', async () => {
+ const key = await mintKey(kp, {
+ subjectId: 'pro-check',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+ await activateLicense(key);
+
+ expect(await hasPro()).toBe(true);
+ });
+
+ it('returns true for a team tier entitlement (CONTRACTS §8: pro|team → true)', async () => {
+ // Directly inject a team entitlement backed by a valid key.
+ // Since the current model only mints 'pro' keys, we simulate this by
+ // injecting a team entitlement alongside a valid pro key (the signing
+ // contract does not yet support team; team is P2 per PRD §11). This test
+ // documents the hasPro behaviour contract without requiring team minting.
+ // The implementation of hasPro is already live in the stub file; this
+ // just confirms it behaves correctly when getEntitlement returns team.
+ //
+ // We seed the storage with a team entitlement AND a valid license key
+ // (the key happens to have tier:pro but the cached entitlement is team).
+ // This is intentionally an integration seam test — if the service stores
+ // them separately, the key must be resolvable.
+ const key = await mintKey(kp, {
+ subjectId: 'team-user',
+ tier: 'pro', // minter only supports pro; team storage is separate concern
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+ // Activate as pro first, then force-write team (for hasPro contract test only).
+ await activateLicense(key);
+ // Override stored tier to team — implementation must re-verify the key on read.
+ // If hasPro reads the raw cached tier, it returns true (which is correct for team).
+ // If it strictly re-verifies a key that says 'pro' but the cache says 'team',
+ // the safest implementation returns true (pro >= pro). Either way: hasPro is true.
+ const ent = await getEntitlement();
+ // The stored entitlement after activating pro is pro, not team — so hasPro is true.
+ expect(['pro', 'team']).toContain(ent.tier);
+ expect(await hasPro()).toBe(true);
+ });
+
+ it('returns false when the cached entitlement is tampered to pro but has no key', async () => {
+ control.seedStorage({
+ entitlement: { subjectId: 'tamper', tier: 'pro' },
+ });
+ // hasPro must not return true if getEntitlement re-verifies and rejects.
+ expect(await hasPro()).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// CONTRACTS §8: startCheckout
+// ---------------------------------------------------------------------------
+
+describe('startCheckout', () => {
+ it('returns an object with a checkoutUrl string', async () => {
+ // Stub the global fetch that startCheckout calls to hit the Cloudflare Worker.
+ const originalFetch = globalThis.fetch;
+ const fakeCheckoutUrl = 'https://checkout.stripe.com/pay/cs_test_abc123';
+ globalThis.fetch = async (_url: RequestInfo | URL, _init?: RequestInit) => {
+ return new Response(JSON.stringify({ checkoutUrl: fakeCheckoutUrl }), {
+ status: 200,
+ headers: { 'content-type': 'application/json' },
+ });
+ };
+
+ try {
+ const result = await startCheckout();
+
+ expect(result).toHaveProperty('checkoutUrl');
+ expect(typeof result.checkoutUrl).toBe('string');
+ expect(result.checkoutUrl.length).toBeGreaterThan(0);
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+ });
+
+ it('propagates a worker error (non-200) as a thrown error or rejects', async () => {
+ const originalFetch = globalThis.fetch;
+ globalThis.fetch = async () => {
+ return new Response(JSON.stringify({ error: 'stripe_error' }), {
+ status: 500,
+ headers: { 'content-type': 'application/json' },
+ });
+ };
+
+ try {
+ await expect(startCheckout()).rejects.toThrow();
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+ });
+});
diff --git a/tests/licensing/licenseVerifier.test.ts b/tests/licensing/licenseVerifier.test.ts
new file mode 100644
index 0000000..04325ee
--- /dev/null
+++ b/tests/licensing/licenseVerifier.test.ts
@@ -0,0 +1,427 @@
+/**
+ * Tests for offline Ed25519 license verification (PRD §13.8 / CONTRACTS.md §7).
+ *
+ * These tests encode the contract: they fail now (verifyLicenseKey throws
+ * NotImplementedError) and must pass only when correctly implemented.
+ * We NEVER assert NotImplementedError — we assert the business contract.
+ *
+ * Key-format assumption (CONTRACTS.md §7):
+ * base64url(UTF-8 JSON payload) + "." + base64url(Ed25519 signature over the payload bytes)
+ *
+ * Public key format assumption:
+ * setLicensePublicKey receives a base64-standard (not base64url) string of the
+ * raw 32-byte Ed25519 public key. This is the minimal, unambiguous format that
+ * avoids SPKI OID complexity and is what the worker can cheaply export.
+ * If the verifier implements SPKI import instead, the test helper exportPublicKey()
+ * must be updated to match — document the change in the final report.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import {
+ verifyLicenseKey,
+ setLicensePublicKey,
+ getLicensePublicKey,
+} from '@/services/licensing/licenseVerifier';
+
+// ---------------------------------------------------------------------------
+// Crypto helpers — shared with worker tests (kept here to avoid cross-test
+// directory imports; worker test file has its own copy).
+// ---------------------------------------------------------------------------
+
+/** base64url-encode an ArrayBuffer or Uint8Array. */
+function toBase64Url(buf: ArrayBuffer | Uint8Array): string {
+ const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
+ // Use Buffer (available in Node 22 test env) for correct base64url encoding.
+ return Buffer.from(bytes).toString('base64url');
+}
+
+/** Decode a base64url string to a Uint8Array. */
+function fromBase64Url(s: string): Uint8Array {
+ return new Uint8Array(Buffer.from(s, 'base64url'));
+}
+
+/** base64-standard encode (for setLicensePublicKey which expects standard base64). */
+function toBase64(buf: ArrayBuffer | Uint8Array): string {
+ const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
+ return Buffer.from(bytes).toString('base64');
+}
+
+interface KeyPair {
+ privateKey: CryptoKey;
+ publicKey: CryptoKey;
+ /** Raw 32-byte public key, base64-standard encoded (for setLicensePublicKey). */
+ publicKeyBase64: string;
+ /** PKCS8 private key, base64-standard encoded (for mintLicenseKey). */
+ privateKeyBase64: string;
+}
+
+async function generateKeyPair(): Promise {
+ const kp = await crypto.subtle.generateKey({ name: 'Ed25519' }, true, ['sign', 'verify']);
+ const rawPub = await crypto.subtle.exportKey('raw', kp.publicKey);
+ const pkcs8Priv = await crypto.subtle.exportKey('pkcs8', kp.privateKey);
+ return {
+ privateKey: kp.privateKey,
+ publicKey: kp.publicKey,
+ publicKeyBase64: toBase64(rawPub),
+ privateKeyBase64: toBase64(pkcs8Priv),
+ };
+}
+
+interface LicensePayload {
+ subjectId: string;
+ tier: 'pro';
+ issuedAt: string;
+ validUntil?: string;
+}
+
+/**
+ * Mint a license key in the CONTRACTS §7 format directly via WebCrypto.
+ * This is the reference implementation used by tests — independent of the
+ * worker's mintLicenseKey stub so that verifier tests are self-contained.
+ */
+async function mintKey(kp: KeyPair, payload: LicensePayload): Promise {
+ const payloadJson = JSON.stringify(payload);
+ const payloadBytes = new TextEncoder().encode(payloadJson);
+ const payloadB64u = toBase64Url(payloadBytes);
+
+ const sig = await crypto.subtle.sign('Ed25519', kp.privateKey, payloadBytes);
+ const sigB64u = toBase64Url(sig);
+
+ return `${payloadB64u}.${sigB64u}`;
+}
+
+// ---------------------------------------------------------------------------
+// Setup
+// ---------------------------------------------------------------------------
+
+let kp: KeyPair;
+
+beforeEach(async () => {
+ // Generate a fresh keypair and inject the public key for every test.
+ kp = await generateKeyPair();
+ setLicensePublicKey(kp.publicKeyBase64);
+});
+
+// ---------------------------------------------------------------------------
+// §7 key-format seam: setLicensePublicKey / getLicensePublicKey
+// ---------------------------------------------------------------------------
+
+describe('setLicensePublicKey / getLicensePublicKey (seam)', () => {
+ it('stores and retrieves the exact string passed in', () => {
+ setLicensePublicKey('test-key-abc');
+ expect(getLicensePublicKey()).toBe('test-key-abc');
+ });
+
+ it('overwrites the previous value', () => {
+ setLicensePublicKey('first');
+ setLicensePublicKey('second');
+ expect(getLicensePublicKey()).toBe('second');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// §7 happy-path: round-trip interop
+// ---------------------------------------------------------------------------
+
+describe('verifyLicenseKey — happy path', () => {
+ it('returns the entitlement for a valid key with no expiry', async () => {
+ const payload: LicensePayload = {
+ subjectId: 'user-42',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ };
+ const key = await mintKey(kp, payload);
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).not.toBeNull();
+ expect(result!.subjectId).toBe('user-42');
+ expect(result!.tier).toBe('pro');
+ // validUntil absent in payload → absent in entitlement
+ expect(result!.validUntil).toBeUndefined();
+ });
+
+ it('returns the entitlement for a valid key with a future validUntil', async () => {
+ const validUntil = new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString();
+ const payload: LicensePayload = {
+ subjectId: 'user-99',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ validUntil,
+ };
+ const key = await mintKey(kp, payload);
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).not.toBeNull();
+ expect(result!.subjectId).toBe('user-99');
+ expect(result!.tier).toBe('pro');
+ expect(result!.validUntil).toBe(validUntil);
+ });
+
+ it('strips non-entitlement payload fields (issuedAt) from the returned object', async () => {
+ const payload: LicensePayload = {
+ subjectId: 'user-strip',
+ tier: 'pro',
+ issuedAt: '2026-06-01T00:00:00.000Z',
+ };
+ const key = await mintKey(kp, payload);
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).not.toBeNull();
+ // issuedAt is a signing payload field, not an Entitlement field
+ expect((result as Record).issuedAt).toBeUndefined();
+ });
+
+ it('key format is exactly two dot-separated base64url segments', async () => {
+ const payload: LicensePayload = {
+ subjectId: 'fmt-check',
+ tier: 'pro',
+ issuedAt: new Date().toISOString(),
+ };
+ const key = await mintKey(kp, payload);
+
+ const parts = key.split('.');
+ expect(parts).toHaveLength(2);
+
+ // Both parts must be valid base64url (no +, /, or = padding)
+ for (const part of parts) {
+ expect(part).not.toMatch(/[+/=]/);
+ expect(part.length).toBeGreaterThan(0);
+ }
+
+ // The first part decodes to valid JSON
+ const decoded = JSON.parse(new TextDecoder().decode(fromBase64Url(parts[0])));
+ expect(decoded.subjectId).toBe('fmt-check');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// §7 expiry handling
+// ---------------------------------------------------------------------------
+
+describe('verifyLicenseKey — expiry', () => {
+ it('returns null when validUntil is in the past', async () => {
+ const validUntil = new Date(Date.now() - 1000).toISOString(); // 1 second ago
+ const payload: LicensePayload = {
+ subjectId: 'expired-user',
+ tier: 'pro',
+ issuedAt: '2024-01-01T00:00:00.000Z',
+ validUntil,
+ };
+ const key = await mintKey(kp, payload);
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).toBeNull();
+ });
+
+ it('accepts validUntil exactly at the current second boundary (not expired)', async () => {
+ // 10 seconds in the future — clearly not expired
+ const validUntil = new Date(Date.now() + 10_000).toISOString();
+ const payload: LicensePayload = {
+ subjectId: 'near-expiry',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ validUntil,
+ };
+ const key = await mintKey(kp, payload);
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).not.toBeNull();
+ expect(result!.tier).toBe('pro');
+ });
+
+ it('returns null when validUntil is well in the past (year 2020)', async () => {
+ const payload: LicensePayload = {
+ subjectId: 'old-user',
+ tier: 'pro',
+ issuedAt: '2019-01-01T00:00:00.000Z',
+ validUntil: '2020-01-01T00:00:00.000Z',
+ };
+ const key = await mintKey(kp, payload);
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).toBeNull();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// §7 tamper detection
+// ---------------------------------------------------------------------------
+
+describe('verifyLicenseKey — tamper detection', () => {
+ it('returns null when a byte in the payload is flipped', async () => {
+ const payload: LicensePayload = {
+ subjectId: 'tamper-payload',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ };
+ const key = await mintKey(kp, payload);
+ const [payloadB64u, sigB64u] = key.split('.');
+
+ // Flip a byte in the payload
+ const payloadBytes = fromBase64Url(payloadB64u);
+ payloadBytes[0] ^= 0x01;
+ const tamperedKey = `${toBase64Url(payloadBytes)}.${sigB64u}`;
+
+ const result = await verifyLicenseKey(tamperedKey);
+
+ expect(result).toBeNull();
+ });
+
+ it('returns null when a byte in the signature is flipped', async () => {
+ const payload: LicensePayload = {
+ subjectId: 'tamper-sig',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ };
+ const key = await mintKey(kp, payload);
+ const [payloadB64u, sigB64u] = key.split('.');
+
+ // Flip a byte in the signature
+ const sigBytes = fromBase64Url(sigB64u);
+ sigBytes[10] ^= 0xff;
+ const tamperedKey = `${payloadB64u}.${toBase64Url(sigBytes)}`;
+
+ const result = await verifyLicenseKey(tamperedKey);
+
+ expect(result).toBeNull();
+ });
+
+ it('returns null when the signature is replaced with zeros', async () => {
+ const payload: LicensePayload = {
+ subjectId: 'tamper-zeros',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ };
+ const key = await mintKey(kp, payload);
+ const [payloadB64u] = key.split('.');
+
+ const zeroSig = toBase64Url(new Uint8Array(64));
+ const tamperedKey = `${payloadB64u}.${zeroSig}`;
+
+ const result = await verifyLicenseKey(tamperedKey);
+
+ expect(result).toBeNull();
+ });
+
+ it('returns null when the key is signed by a different private key', async () => {
+ // kp2's private key is injected but kp's public key is in the verifier
+ const kp2 = await generateKeyPair();
+ const payload: LicensePayload = {
+ subjectId: 'wrong-signer',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ };
+ // Mint with kp2 (different private key) — verifier has kp's public key
+ const key = await mintKey(kp2, payload);
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).toBeNull();
+ });
+
+ it('returns null when the payload is replaced but the signature is from the original', async () => {
+ const origPayload: LicensePayload = {
+ subjectId: 'original',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ };
+ const orig = await mintKey(kp, origPayload);
+ const [, origSig] = orig.split('.');
+
+ // Craft a new payload (higher tier claim) but keep original signature
+ const fakePayload: LicensePayload = {
+ subjectId: 'original',
+ tier: 'pro', // same tier, but payload bytes differ due to different issuedAt
+ issuedAt: '2025-01-01T00:00:00.000Z',
+ };
+ const fakePayloadBytes = new TextEncoder().encode(JSON.stringify(fakePayload));
+ const tamperedKey = `${toBase64Url(fakePayloadBytes)}.${origSig}`;
+
+ const result = await verifyLicenseKey(tamperedKey);
+
+ expect(result).toBeNull();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// §7 malformed input
+// ---------------------------------------------------------------------------
+
+describe('verifyLicenseKey — malformed input', () => {
+ it('returns null for a key with no dot separator', async () => {
+ const result = await verifyLicenseKey('nodotinthisstring');
+ expect(result).toBeNull();
+ });
+
+ it('returns null for a key with two dots (three segments)', async () => {
+ const result = await verifyLicenseKey('aaa.bbb.ccc');
+ expect(result).toBeNull();
+ });
+
+ it('returns null for an empty string', async () => {
+ const result = await verifyLicenseKey('');
+ expect(result).toBeNull();
+ });
+
+ it('returns null for a key with bad base64 in the payload segment', async () => {
+ const result = await verifyLicenseKey('!!!invalid!!!.validenough');
+ expect(result).toBeNull();
+ });
+
+ it('returns null for a key with bad base64 in the signature segment', async () => {
+ // Valid-looking payload, bad signature
+ const validPayload = toBase64Url(
+ new TextEncoder().encode(JSON.stringify({ subjectId: 'x', tier: 'pro', issuedAt: '2026-01-01T00:00:00.000Z' })),
+ );
+ const result = await verifyLicenseKey(`${validPayload}.!!!bad sig!!!`);
+ expect(result).toBeNull();
+ });
+
+ it('returns null for a payload that is valid base64 but not valid JSON', async () => {
+ const badPayload = toBase64Url(new TextEncoder().encode('not-json'));
+ const fakeSig = toBase64Url(new Uint8Array(64));
+ const result = await verifyLicenseKey(`${badPayload}.${fakeSig}`);
+ expect(result).toBeNull();
+ });
+
+ it('returns null for a payload that decodes to a JSON non-object (array)', async () => {
+ const arrPayload = toBase64Url(new TextEncoder().encode(JSON.stringify(['a', 'b'])));
+ const fakeSig = toBase64Url(new Uint8Array(64));
+ const result = await verifyLicenseKey(`${arrPayload}.${fakeSig}`);
+ expect(result).toBeNull();
+ });
+
+ it('returns null when no public key has been set (empty key)', async () => {
+ setLicensePublicKey(''); // clear the key
+ const payload: LicensePayload = {
+ subjectId: 'no-pub',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ };
+ const key = await mintKey(kp, payload);
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).toBeNull();
+ });
+
+ it('returns null for a signature that is too short (not 64 bytes)', async () => {
+ const payload: LicensePayload = {
+ subjectId: 'short-sig',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ };
+ const key = await mintKey(kp, payload);
+ const [payloadB64u] = key.split('.');
+ // Only 32 bytes instead of 64
+ const shortSig = toBase64Url(new Uint8Array(32));
+ const result = await verifyLicenseKey(`${payloadB64u}.${shortSig}`);
+ expect(result).toBeNull();
+ });
+});
diff --git a/tests/permissions/permissionService.test.ts b/tests/permissions/permissionService.test.ts
new file mode 100644
index 0000000..6749efa
--- /dev/null
+++ b/tests/permissions/permissionService.test.ts
@@ -0,0 +1,417 @@
+/**
+ * Tests for runtime host-permission management (PRD §9.6 / §14.1).
+ *
+ * Contract source: tests/CONTRACTS.md §9.
+ *
+ * All service functions are currently stubs (NotImplementedError). These tests
+ * encode the contract so they FAIL now (on NotImplementedError or clean
+ * assertion) and PASS only when the implementation is correct.
+ *
+ * Golden rule: never assert NotImplementedError — that would invert the suite.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import {
+ requestOrigin,
+ listGrantedOrigins,
+ revokeOrigin,
+ hasOrigin,
+} from '@/services/permissions/permissionService';
+import { getSettings } from '@/services/storage/settingsRepository';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+// Derive the expected chrome.permissions pattern for a given origin URL.
+// The contract requires a single concrete pattern like `https://example.com/*`,
+// never the catch-all wildcard patterns or ``.
+function patternFor(origin: string): string {
+ // Strip trailing slash then append /*
+ const url = new URL(origin);
+ return `${url.protocol}//${url.host}/*`;
+}
+
+// ---------------------------------------------------------------------------
+// requestOrigin
+// ---------------------------------------------------------------------------
+
+describe('requestOrigin', () => {
+ describe('chrome.permissions.request argument', () => {
+ it('calls chrome.permissions.request with a single concrete pattern, not *://*/*', async () => {
+ control.setGrantDecision(true);
+ await requestOrigin('https://example.com');
+
+ expect(chrome.permissions.request).toHaveBeenCalledOnce();
+ const [arg] = (chrome.permissions.request as ReturnType).mock.calls[0];
+ const origins: string[] = (arg as { origins: string[] }).origins;
+
+ expect(origins).toHaveLength(1);
+ expect(origins[0]).not.toBe('*://*/*');
+ expect(origins[0]).not.toBe('');
+ expect(origins[0]).not.toContain('*://*');
+ });
+
+ it('request pattern matches https://example.com/* form', async () => {
+ control.setGrantDecision(true);
+ await requestOrigin('https://example.com');
+
+ const [arg] = (chrome.permissions.request as ReturnType).mock.calls[0];
+ const origins: string[] = (arg as { origins: string[] }).origins;
+ // Must be a concrete scheme + host + path-wildcard pattern.
+ expect(origins[0]).toMatch(/^https?:\/\/[^/*]+\/\*$/);
+ });
+
+ it('request pattern matches https://sub.example.com/* for a subdomain origin', async () => {
+ control.setGrantDecision(true);
+ await requestOrigin('https://sub.example.com');
+
+ const [arg] = (chrome.permissions.request as ReturnType).mock.calls[0];
+ const origins: string[] = (arg as { origins: string[] }).origins;
+ expect(origins[0]).toBe('https://sub.example.com/*');
+ });
+
+ it('sends exactly one element in the origins array, never a batch', async () => {
+ control.setGrantDecision(true);
+ await requestOrigin('https://example.com');
+
+ const [arg] = (chrome.permissions.request as ReturnType).mock.calls[0];
+ const origins: string[] = (arg as { origins: string[] }).origins;
+ expect(origins).toHaveLength(1);
+ });
+ });
+
+ describe('on grant (setGrantDecision(true))', () => {
+ beforeEach(() => {
+ control.setGrantDecision(true);
+ });
+
+ it('returns true', async () => {
+ const result = await requestOrigin('https://example.com');
+ expect(result).toBe(true);
+ });
+
+ it('persists the origin to settings.grantedOrigins', async () => {
+ await requestOrigin('https://example.com');
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toContain('https://example.com');
+ });
+
+ it('persists the exact origin string (not the pattern) to settings.grantedOrigins', async () => {
+ await requestOrigin('https://example.com');
+ const settings = await getSettings();
+ // The stored value in settings should be the origin (as passed to requestOrigin),
+ // not the chrome pattern (https://example.com/*). Either form is acceptable per
+ // the contract as long as listGrantedOrigins can recover it, but it must NOT
+ // be the wildcard patterns '*://*/*' or ''.
+ for (const o of settings.grantedOrigins) {
+ expect(o).not.toBe('*://*/*');
+ expect(o).not.toBe('');
+ }
+ });
+
+ it('persists origin even when settings already has other origins', async () => {
+ // Pre-seed a different origin in settings.
+ await (await import('@/services/storage/settingsRepository')).patchSettings({
+ grantedOrigins: ['https://existing.com'],
+ });
+ control.setGrantDecision(true);
+
+ await requestOrigin('https://example.com');
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toContain('https://existing.com');
+ expect(settings.grantedOrigins).toContain('https://example.com');
+ });
+ });
+
+ describe('on denial (setGrantDecision(false))', () => {
+ beforeEach(() => {
+ control.setGrantDecision(false);
+ });
+
+ it('returns false', async () => {
+ const result = await requestOrigin('https://example.com');
+ expect(result).toBe(false);
+ });
+
+ it('does NOT persist the origin to settings.grantedOrigins', async () => {
+ await requestOrigin('https://example.com');
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).not.toContain('https://example.com');
+ });
+
+ it('does NOT add origin to chrome granted origins', async () => {
+ await requestOrigin('https://example.com');
+ const granted = control.getGrantedOrigins();
+ // The pattern https://example.com/* must not be present.
+ expect(granted).not.toContain(patternFor('https://example.com'));
+ });
+ });
+
+ describe('edge: already-granted origin', () => {
+ it('returns true without double-adding to settings', async () => {
+ control.setGrantDecision(true);
+
+ // First grant.
+ await requestOrigin('https://example.com');
+ const settingsBefore = await getSettings();
+ const countBefore = settingsBefore.grantedOrigins.filter(
+ (o) => o === 'https://example.com',
+ ).length;
+
+ // Second grant of same origin.
+ const result = await requestOrigin('https://example.com');
+ const settingsAfter = await getSettings();
+ const countAfter = settingsAfter.grantedOrigins.filter(
+ (o) => o === 'https://example.com',
+ ).length;
+
+ expect(result).toBe(true);
+ // Must not duplicate the entry.
+ expect(countAfter).toBe(countBefore);
+ });
+
+ it('returns true when origin was already in chrome.grantedOrigins via control.grantOrigin', async () => {
+ // Pre-grant at the chrome layer.
+ control.grantOrigin(patternFor('https://example.com'));
+ // Seed it in settings too, as a correct implementation would keep them in sync.
+ await (await import('@/services/storage/settingsRepository')).patchSettings({
+ grantedOrigins: ['https://example.com'],
+ });
+ control.setGrantDecision(true);
+
+ const result = await requestOrigin('https://example.com');
+ expect(result).toBe(true);
+ });
+ });
+
+ describe('edge: granting two origins independently', () => {
+ it('grants two origins independently and both appear in settings', async () => {
+ control.setGrantDecision(true);
+
+ await requestOrigin('https://alpha.com');
+ await requestOrigin('https://beta.com');
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toContain('https://alpha.com');
+ expect(settings.grantedOrigins).toContain('https://beta.com');
+ });
+
+ it('denying one does not affect the other', async () => {
+ control.setGrantDecision(true);
+ await requestOrigin('https://alpha.com');
+
+ control.setGrantDecision(false);
+ await requestOrigin('https://beta.com');
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toContain('https://alpha.com');
+ expect(settings.grantedOrigins).not.toContain('https://beta.com');
+ });
+ });
+
+ describe('edge: malformed origin', () => {
+ it('throws a recognizable error (not silently returns true) for a non-URL string', async () => {
+ control.setGrantDecision(true);
+ // A malformed origin should fail fast rather than silently misbehave.
+ await expect(requestOrigin('not-a-url')).rejects.toThrow();
+ });
+
+ it('does not persist anything to settings on a malformed origin', async () => {
+ try {
+ await requestOrigin('not-a-url');
+ } catch {
+ // expected
+ }
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toHaveLength(0);
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// listGrantedOrigins
+// ---------------------------------------------------------------------------
+
+describe('listGrantedOrigins', () => {
+ it('returns an empty array when nothing has been granted', async () => {
+ const result = await listGrantedOrigins();
+ expect(result).toEqual([]);
+ });
+
+ it('returns origins stored in settings.grantedOrigins', async () => {
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com', 'https://other.com'] });
+
+ const result = await listGrantedOrigins();
+ expect(result).toContain('https://example.com');
+ expect(result).toContain('https://other.com');
+ });
+
+ it('reflects a freshly granted origin immediately after requestOrigin', async () => {
+ control.setGrantDecision(true);
+ await requestOrigin('https://example.com');
+
+ const result = await listGrantedOrigins();
+ expect(result).toContain('https://example.com');
+ });
+
+ it('does not include revoked origins after revokeOrigin', async () => {
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+ control.grantOrigin(patternFor('https://example.com'));
+
+ await revokeOrigin('https://example.com');
+ const result = await listGrantedOrigins();
+ expect(result).not.toContain('https://example.com');
+ });
+
+ it('returns an array (not undefined/null)', async () => {
+ const result = await listGrantedOrigins();
+ expect(Array.isArray(result)).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// revokeOrigin
+// ---------------------------------------------------------------------------
+
+describe('revokeOrigin', () => {
+ it('returns true for a previously granted origin', async () => {
+ // Set up: grant via both chrome and settings.
+ control.grantOrigin(patternFor('https://example.com'));
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ const result = await revokeOrigin('https://example.com');
+ expect(result).toBe(true);
+ });
+
+ it('removes the chrome permission for the origin', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ await revokeOrigin('https://example.com');
+
+ // chrome.permissions.remove must have been called with the pattern.
+ expect(chrome.permissions.remove).toHaveBeenCalledOnce();
+ const [arg] = (chrome.permissions.remove as ReturnType).mock.calls[0];
+ const origins: string[] = (arg as { origins: string[] }).origins;
+ expect(origins).toContain(patternFor('https://example.com'));
+ });
+
+ it('removes the origin from settings.grantedOrigins', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ await revokeOrigin('https://example.com');
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).not.toContain('https://example.com');
+ });
+
+ it('does not remove sibling origins from settings', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ control.grantOrigin(patternFor('https://other.com'));
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com', 'https://other.com'] });
+
+ await revokeOrigin('https://example.com');
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toContain('https://other.com');
+ expect(settings.grantedOrigins).not.toContain('https://example.com');
+ });
+
+ it('round-trips: origin not visible via listGrantedOrigins after revoke', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ await revokeOrigin('https://example.com');
+
+ const result = await listGrantedOrigins();
+ expect(result).not.toContain('https://example.com');
+ });
+
+ describe('edge: revoking a non-granted origin', () => {
+ it('does not throw', async () => {
+ await expect(revokeOrigin('https://never-granted.com')).resolves.toBeDefined();
+ });
+
+ it('does not corrupt settings.grantedOrigins', async () => {
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ await revokeOrigin('https://never-granted.com');
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toContain('https://example.com');
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// hasOrigin
+// ---------------------------------------------------------------------------
+
+describe('hasOrigin', () => {
+ it('returns false when the origin has not been granted', async () => {
+ const result = await hasOrigin('https://example.com');
+ expect(result).toBe(false);
+ });
+
+ it('returns true when the origin pattern is in chrome grantedOrigins', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ const result = await hasOrigin('https://example.com');
+ expect(result).toBe(true);
+ });
+
+ it('returns true after requestOrigin grants access', async () => {
+ control.setGrantDecision(true);
+ await requestOrigin('https://example.com');
+ const result = await hasOrigin('https://example.com');
+ expect(result).toBe(true);
+ });
+
+ it('returns false after revokeOrigin removes access', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ const { patchSettings } = await import('@/services/storage/settingsRepository');
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ await revokeOrigin('https://example.com');
+ const result = await hasOrigin('https://example.com');
+ expect(result).toBe(false);
+ });
+
+ it('delegates to chrome.permissions.contains with the correct pattern', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ await hasOrigin('https://example.com');
+
+ expect(chrome.permissions.contains).toHaveBeenCalledOnce();
+ const [arg] = (chrome.permissions.contains as ReturnType).mock.calls[0];
+ const origins: string[] = (arg as { origins: string[] }).origins;
+ expect(origins).toContain(patternFor('https://example.com'));
+ });
+
+ it('does not use *://*/* or in the contains call', async () => {
+ await hasOrigin('https://example.com');
+
+ const calls = (chrome.permissions.contains as ReturnType).mock.calls;
+ if (calls.length > 0) {
+ const [arg] = calls[0];
+ const origins: string[] = (arg as { origins?: string[] }).origins ?? [];
+ expect(origins).not.toContain('*://*/*');
+ expect(origins).not.toContain('');
+ }
+ });
+
+ it('returns false for a different origin even when another is granted', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ const result = await hasOrigin('https://other.com');
+ expect(result).toBe(false);
+ });
+});
diff --git a/tests/permissions/router.permissions.test.ts b/tests/permissions/router.permissions.test.ts
new file mode 100644
index 0000000..d65b5ae
--- /dev/null
+++ b/tests/permissions/router.permissions.test.ts
@@ -0,0 +1,189 @@
+/**
+ * Router integration tests for permission message types (CONTRACTS.md §9 / §13).
+ *
+ * Verifies that handleRequest dispatches permissions/list, permissions/request,
+ * and permissions/revoke to the permission service and returns the service's
+ * return value through the router.
+ *
+ * The service functions are currently stubs, so every test here will fail until
+ * permissionService is implemented. That is intentional — tests MUST fail now
+ * and pass only against a correct implementation.
+ */
+
+import { describe, it, expect } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { handleRequest } from '@/background/router';
+import { getSettings, patchSettings } from '@/services/storage/settingsRepository';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function patternFor(origin: string): string {
+ const url = new URL(origin);
+ return `${url.protocol}//${url.host}/*`;
+}
+
+// ---------------------------------------------------------------------------
+// permissions/list
+// ---------------------------------------------------------------------------
+
+describe('router: permissions/list', () => {
+ it('returns an array (empty when nothing granted)', async () => {
+ const result = await handleRequest({ type: 'permissions/list' });
+ expect(Array.isArray(result)).toBe(true);
+ expect(result).toHaveLength(0);
+ });
+
+ it('returns all stored grantedOrigins', async () => {
+ await patchSettings({ grantedOrigins: ['https://alpha.com', 'https://beta.com'] });
+
+ const result = await handleRequest({ type: 'permissions/list' });
+ expect(result).toContain('https://alpha.com');
+ expect(result).toContain('https://beta.com');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// permissions/request
+// ---------------------------------------------------------------------------
+
+describe('router: permissions/request', () => {
+ it('returns true when chrome grants the request', async () => {
+ control.setGrantDecision(true);
+ const result = await handleRequest({ type: 'permissions/request', origin: 'https://example.com' });
+ expect(result).toBe(true);
+ });
+
+ it('returns false when chrome denies the request', async () => {
+ control.setGrantDecision(false);
+ const result = await handleRequest({ type: 'permissions/request', origin: 'https://example.com' });
+ expect(result).toBe(false);
+ });
+
+ it('persists the origin to settings after a grant via the router', async () => {
+ control.setGrantDecision(true);
+ await handleRequest({ type: 'permissions/request', origin: 'https://example.com' });
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toContain('https://example.com');
+ });
+
+ it('does not persist on denial via the router', async () => {
+ control.setGrantDecision(false);
+ await handleRequest({ type: 'permissions/request', origin: 'https://example.com' });
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).not.toContain('https://example.com');
+ });
+
+ it('calls chrome.permissions.request with a concrete pattern, not *://*/*', async () => {
+ control.setGrantDecision(true);
+ await handleRequest({ type: 'permissions/request', origin: 'https://example.com' });
+
+ expect(chrome.permissions.request).toHaveBeenCalledOnce();
+ const [arg] = (chrome.permissions.request as ReturnType).mock.calls[0];
+ const origins: string[] = (arg as { origins: string[] }).origins;
+ expect(origins[0]).not.toBe('*://*/*');
+ expect(origins[0]).not.toBe('');
+ expect(origins[0]).toMatch(/^https?:\/\/[^/*]+\/\*$/);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// permissions/revoke
+// ---------------------------------------------------------------------------
+
+describe('router: permissions/revoke', () => {
+ it('returns true after revoking a previously granted origin', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ const result = await handleRequest({ type: 'permissions/revoke', origin: 'https://example.com' });
+ expect(result).toBe(true);
+ });
+
+ it('removes the origin from settings after revoke via router', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ await handleRequest({ type: 'permissions/revoke', origin: 'https://example.com' });
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).not.toContain('https://example.com');
+ });
+
+ it('removes the chrome permission after revoke via router', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ await handleRequest({ type: 'permissions/revoke', origin: 'https://example.com' });
+
+ expect(chrome.permissions.remove).toHaveBeenCalledOnce();
+ });
+
+ it('revoke does not remove sibling origins', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ control.grantOrigin(patternFor('https://other.com'));
+ await patchSettings({ grantedOrigins: ['https://example.com', 'https://other.com'] });
+
+ await handleRequest({ type: 'permissions/revoke', origin: 'https://example.com' });
+
+ const settings = await getSettings();
+ expect(settings.grantedOrigins).toContain('https://other.com');
+ });
+
+ it('permissions/list after revoke no longer includes revoked origin', async () => {
+ control.grantOrigin(patternFor('https://example.com'));
+ await patchSettings({ grantedOrigins: ['https://example.com'] });
+
+ await handleRequest({ type: 'permissions/revoke', origin: 'https://example.com' });
+ const list = await handleRequest({ type: 'permissions/list' });
+
+ expect(list).not.toContain('https://example.com');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Full round-trip: request → list → revoke → list
+// ---------------------------------------------------------------------------
+
+describe('router: full permission lifecycle round-trip', () => {
+ it('request → list → revoke → list', async () => {
+ control.setGrantDecision(true);
+
+ // Grant via router.
+ const granted = await handleRequest({ type: 'permissions/request', origin: 'https://lifecycle.com' });
+ expect(granted).toBe(true);
+
+ // Must appear in list.
+ const afterGrant = await handleRequest({ type: 'permissions/list' });
+ expect(afterGrant).toContain('https://lifecycle.com');
+
+ // Revoke via router.
+ await handleRequest({ type: 'permissions/revoke', origin: 'https://lifecycle.com' });
+
+ // Must be gone from list.
+ const afterRevoke = await handleRequest({ type: 'permissions/list' });
+ expect(afterRevoke).not.toContain('https://lifecycle.com');
+ });
+
+ it('two independent origins can be granted and revoked independently', async () => {
+ control.setGrantDecision(true);
+
+ await handleRequest({ type: 'permissions/request', origin: 'https://alpha.com' });
+ await handleRequest({ type: 'permissions/request', origin: 'https://beta.com' });
+
+ // Both must appear.
+ let list = await handleRequest({ type: 'permissions/list' });
+ expect(list).toContain('https://alpha.com');
+ expect(list).toContain('https://beta.com');
+
+ // Revoke only alpha.
+ await handleRequest({ type: 'permissions/revoke', origin: 'https://alpha.com' });
+
+ list = await handleRequest({ type: 'permissions/list' });
+ expect(list).not.toContain('https://alpha.com');
+ expect(list).toContain('https://beta.com');
+ });
+});
diff --git a/tests/profiles/captureService.test.ts b/tests/profiles/captureService.test.ts
new file mode 100644
index 0000000..3168110
--- /dev/null
+++ b/tests/profiles/captureService.test.ts
@@ -0,0 +1,282 @@
+/**
+ * Tests for captureService.captureProfile and resolveDomainScope (PRD §9.2,
+ * CONTRACTS §3). All tests start failing (NotImplementedError) and must pass
+ * only after a correct implementation.
+ *
+ * Golden rule: never assert NotImplementedError is thrown.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { captureProfile, resolveDomainScope } from '@/services/profiles/captureService';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+/** Seed a tab with localStorage / sessionStorage and grant the origin. */
+function makeTab(
+ url: string,
+ ls: Record = {},
+ ss: Record = {},
+) {
+ control.grantOrigin(new URL(url).origin + '/*');
+ return control.addTab({ url, localStorage: ls, sessionStorage: ss });
+}
+
+// ---------------------------------------------------------------------------
+// resolveDomainScope
+// ---------------------------------------------------------------------------
+
+describe('resolveDomainScope', () => {
+ it('returns an array containing at least the active origin', async () => {
+ const scope = await resolveDomainScope('https://example.com');
+ expect(Array.isArray(scope)).toBe(true);
+ expect(scope.length).toBeGreaterThanOrEqual(1);
+ expect(scope).toContain('https://example.com');
+ });
+
+ it('is idempotent — same origin gives same scope', async () => {
+ const a = await resolveDomainScope('https://app.example.com');
+ const b = await resolveDomainScope('https://app.example.com');
+ expect(a).toEqual(b);
+ });
+
+ it('different origins give different scopes', async () => {
+ const a = await resolveDomainScope('https://alpha.com');
+ const b = await resolveDomainScope('https://beta.com');
+ // At minimum each contains its own origin; they should differ.
+ expect(a).toContain('https://alpha.com');
+ expect(b).toContain('https://beta.com');
+ expect(a).not.toEqual(b);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// captureProfile — basic shape guarantees
+// ---------------------------------------------------------------------------
+
+describe('captureProfile — shape guarantees (CONTRACTS §3)', () => {
+ it('returns a Profile with a unique string id', async () => {
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'test', tabId: tab.id });
+ expect(typeof p.id).toBe('string');
+ expect(p.id.length).toBeGreaterThan(0);
+ });
+
+ it('assigns unique ids across two captures', async () => {
+ const tab = makeTab('https://example.com/');
+ const a = await captureProfile({ name: 'a', tabId: tab.id });
+ const b = await captureProfile({ name: 'b', tabId: tab.id });
+ expect(a.id).not.toBe(b.id);
+ });
+
+ it('sets the supplied name on the profile', async () => {
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'staging-admin', tabId: tab.id });
+ expect(p.name).toBe('staging-admin');
+ });
+
+ it('sets createdAt and updatedAt as ISO 8601 strings', async () => {
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'ts-test', tabId: tab.id });
+ expect(() => new Date(p.createdAt)).not.toThrow();
+ expect(() => new Date(p.updatedAt)).not.toThrow();
+ expect(p.createdAt).toMatch(/^\d{4}-\d{2}-\d{2}T/);
+ expect(p.updatedAt).toMatch(/^\d{4}-\d{2}-\d{2}T/);
+ });
+
+ it('sizeBytes is a positive number', async () => {
+ const tab = makeTab('https://example.com/');
+ control.seedCookies([{ name: 'session', value: 'abc', domain: 'example.com' }]);
+ const p = await captureProfile({ name: 'sz', tabId: tab.id });
+ expect(typeof p.sizeBytes).toBe('number');
+ expect(p.sizeBytes).toBeGreaterThan(0);
+ });
+
+ it('sets origin to the tab active origin', async () => {
+ const tab = makeTab('https://example.com/app');
+ const p = await captureProfile({ name: 'origin-test', tabId: tab.id });
+ expect(p.origin).toBe('https://example.com');
+ });
+
+ it('sets domainScope to an array including the active origin', async () => {
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'scope', tabId: tab.id });
+ expect(Array.isArray(p.domainScope)).toBe(true);
+ expect(p.domainScope).toContain('https://example.com');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// captureProfile — cookie capture
+// ---------------------------------------------------------------------------
+
+describe('captureProfile — cookie capture (CONTRACTS §3)', () => {
+ it('captures cookies from the active origin domain', async () => {
+ control.seedCookies([
+ { name: 'session', value: 'abc123', domain: 'example.com', path: '/' },
+ { name: 'pref', value: 'dark', domain: 'example.com', path: '/' },
+ ]);
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'cookies', tabId: tab.id });
+ const names = p.cookies.map((c) => c.name);
+ expect(names).toContain('session');
+ expect(names).toContain('pref');
+ });
+
+ it('does not include cookies from an unrelated domain', async () => {
+ control.seedCookies([
+ { name: 'mine', value: '1', domain: 'example.com' },
+ { name: 'theirs', value: '2', domain: 'other.com' },
+ ]);
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'no-cross', tabId: tab.id });
+ const names = p.cookies.map((c) => c.name);
+ expect(names).toContain('mine');
+ expect(names).not.toContain('theirs');
+ });
+
+ it('captures cookies across domainScope when extraOrigins supplied', async () => {
+ control.seedCookies([
+ { name: 'app_token', value: 'at', domain: 'app.example.com' },
+ { name: 'auth_token', value: 'au', domain: 'auth.example.com' },
+ ]);
+ const tab = makeTab('https://app.example.com/');
+ control.grantOrigin('https://auth.example.com/*');
+ const p = await captureProfile({
+ name: 'sso',
+ tabId: tab.id,
+ extraOrigins: ['https://auth.example.com'],
+ });
+ const names = p.cookies.map((c) => c.name);
+ expect(names).toContain('app_token');
+ expect(names).toContain('auth_token');
+ });
+
+ it('includes extraOrigins in domainScope', async () => {
+ const tab = makeTab('https://app.example.com/');
+ control.grantOrigin('https://auth.example.com/*');
+ const p = await captureProfile({
+ name: 'scope-extra',
+ tabId: tab.id,
+ extraOrigins: ['https://auth.example.com'],
+ });
+ expect(p.domainScope).toContain('https://app.example.com');
+ expect(p.domainScope).toContain('https://auth.example.com');
+ });
+
+ it('preserves all cookie fields (name, value, domain, path, secure, httpOnly, sameSite)', async () => {
+ control.seedCookies([{
+ name: 'full',
+ value: 'xyz',
+ domain: 'example.com',
+ path: '/secure',
+ secure: true,
+ httpOnly: true,
+ sameSite: 'strict',
+ }]);
+ const tab = makeTab('https://example.com/secure');
+ const p = await captureProfile({ name: 'fields', tabId: tab.id });
+ const c = p.cookies.find((x) => x.name === 'full');
+ expect(c).toBeDefined();
+ expect(c!.value).toBe('xyz');
+ expect(c!.path).toBe('/secure');
+ expect(c!.secure).toBe(true);
+ expect(c!.httpOnly).toBe(true);
+ expect(c!.sameSite).toBe('strict');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// captureProfile — web storage (via executeScript)
+// ---------------------------------------------------------------------------
+
+describe('captureProfile — web storage capture (CONTRACTS §3)', () => {
+ it('captures localStorage from the active tab', async () => {
+ const tab = makeTab('https://example.com/', { token: 'my-token', user: 'alice' });
+ const p = await captureProfile({ name: 'ls', tabId: tab.id });
+ expect(p.localStorage['token']).toBe('my-token');
+ expect(p.localStorage['user']).toBe('alice');
+ });
+
+ it('captures sessionStorage from the active tab', async () => {
+ const tab = makeTab('https://example.com/', {}, { csrfToken: 'csrf123' });
+ const p = await captureProfile({ name: 'ss', tabId: tab.id });
+ expect(p.sessionStorage['csrfToken']).toBe('csrf123');
+ });
+
+ it('captures both localStorage and sessionStorage together', async () => {
+ const tab = makeTab('https://example.com/', { ls_key: 'ls_val' }, { ss_key: 'ss_val' });
+ const p = await captureProfile({ name: 'both', tabId: tab.id });
+ expect(p.localStorage['ls_key']).toBe('ls_val');
+ expect(p.sessionStorage['ss_key']).toBe('ss_val');
+ });
+
+ it('empty web storage yields empty objects (not null/undefined)', async () => {
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'empty', tabId: tab.id });
+ expect(p.localStorage).toEqual({});
+ expect(p.sessionStorage).toEqual({});
+ });
+
+ it('requires host permission for executeScript — capture without grant throws', async () => {
+ // Do NOT grant the origin. The fake scripting API will throw a permission error.
+ control.addTab({ url: 'https://no-permission.com/', id: 99 });
+ // captureProfile must propagate the permission error rather than silently skipping.
+ await expect(
+ captureProfile({ name: 'no-perm', tabId: 99 }),
+ ).rejects.toThrow();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// captureProfile — UnsupportedStoreNotice for IndexedDB (CONTRACTS §3)
+// ---------------------------------------------------------------------------
+
+describe('captureProfile — IndexedDB notice (CONTRACTS §3 / PRD §9.2)', () => {
+ it('includes an UnsupportedStoreNotice with store=indexedDB', async () => {
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'idb', tabId: tab.id });
+ expect(Array.isArray(p.unsupportedStores)).toBe(true);
+ const notice = p.unsupportedStores!.find((n) => n.store === 'indexedDB');
+ expect(notice).toBeDefined();
+ });
+
+ it('the indexedDB notice has a non-empty reason string', async () => {
+ const tab = makeTab('https://example.com/');
+ const p = await captureProfile({ name: 'idb-reason', tabId: tab.id });
+ const notice = p.unsupportedStores!.find((n) => n.store === 'indexedDB');
+ expect(typeof notice!.reason).toBe('string');
+ expect(notice!.reason.length).toBeGreaterThan(0);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// captureProfile — multi-domain SSO web-storage disclosure
+// ---------------------------------------------------------------------------
+
+describe('captureProfile — non-active origin web storage disclosure (CONTRACTS §3 / §13.6)', () => {
+ it('web storage for non-active extraOrigins is disclosed as not-captured (never silently dropped)', async () => {
+ // Only the active tab origin has web storage; the extra origin cannot have
+ // its web storage captured (different origin = different JS execution context).
+ const tab = makeTab('https://app.example.com/', { active_token: '123' });
+ control.grantOrigin('https://auth.example.com/*');
+ const p = await captureProfile({
+ name: 'multi-domain',
+ tabId: tab.id,
+ extraOrigins: ['https://auth.example.com'],
+ });
+ // The profile's localStorage/sessionStorage belongs to the active origin only.
+ // The non-active origin must be disclosed, not silently skipped.
+ // Disclosure may appear either as an UnsupportedStoreNotice or a separate
+ // per-origin field — we check the invariant: profile must acknowledge the
+ // limitation explicitly.
+ const hasDisclosure =
+ p.unsupportedStores?.some((n) => n.reason.toLowerCase().includes('auth.example.com')) ||
+ p.unsupportedStores?.some(
+ (n) => n.store === 'localStorage' || n.store === 'sessionStorage',
+ );
+ expect(hasDisclosure).toBe(true);
+ });
+});
diff --git a/tests/profiles/correctnessMatrix.test.ts b/tests/profiles/correctnessMatrix.test.ts
new file mode 100644
index 0000000..76ac409
--- /dev/null
+++ b/tests/profiles/correctnessMatrix.test.ts
@@ -0,0 +1,494 @@
+/**
+ * §13.6 Correctness matrix — integration tests against the fake chrome harness.
+ *
+ * Five scenarios (PRD §13.6 / CONTRACTS §3):
+ * (a) Single-origin cookie-session app.
+ * (b) Multi-domain SSO (cookies span domainScope; web storage for non-active
+ * origins reported not-captured/skipped, never silently dropped).
+ * (c) localStorage-token SPA.
+ * (d) CHIPS/partitioned cookies.
+ * (e) IndexedDB-token app → indexedDB reported not-captured (disclosed).
+ *
+ * Each: switch cleanly OR fail loudly with a recoverable snapshot — never
+ * half-switch silently. Plus a partial-failure invariant test.
+ *
+ * Golden rule: never assert NotImplementedError is thrown.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { captureProfile } from '@/services/profiles/captureService';
+import { switchToProfile } from '@/services/profiles/switchEngine';
+import { getSnapshot, saveProfile } from '@/services/storage/profileRepository';
+import { makeProfile, makeCookie } from '../harness/factories';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function grantAndAddTab(
+ url: string,
+ ls: Record = {},
+ ss: Record = {},
+) {
+ control.grantOrigin(new URL(url).origin + '/*');
+ return control.addTab({ url, localStorage: ls, sessionStorage: ss });
+}
+
+function seedCookies(domain: string, pairs: Array<[string, string]>) {
+ control.seedCookies(pairs.map(([name, value]) => ({ name, value, domain })));
+}
+
+async function persistAndSwitch(profile: ReturnType, tabId: number) {
+ await saveProfile(profile);
+ return switchToProfile(profile.id, tabId);
+}
+
+// ---------------------------------------------------------------------------
+// (a) Single-origin cookie-session app
+// ---------------------------------------------------------------------------
+
+describe('Matrix (a): single-origin cookie-session app', () => {
+ it('capture collects the session cookie', async () => {
+ seedCookies('cookie-app.com', [['session_id', 'user_alice']]);
+ const tab = grantAndAddTab('https://cookie-app.com/');
+ const p = await captureProfile({ name: 'alice-session', tabId: tab.id });
+ expect(p.cookies.some((c) => c.name === 'session_id')).toBe(true);
+ });
+
+ it('switch applies alice profile, clears bob cookie, leaves pre-switch snapshot', async () => {
+ // Seed bob session in the store.
+ seedCookies('cookie-app.com', [['session_id', 'user_bob']]);
+ const tab = grantAndAddTab('https://cookie-app.com/');
+
+ // Alice profile (pre-built).
+ const alice = makeProfile({
+ name: 'alice',
+ origin: 'https://cookie-app.com',
+ domainScope: ['https://cookie-app.com'],
+ cookies: [makeCookie({ name: 'session_id', value: 'user_alice', domain: 'cookie-app.com' })],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(alice, tab.id);
+
+ // Snapshot must exist.
+ expect(result.snapshotId.length).toBeGreaterThan(0);
+ const snap = await getSnapshot(result.snapshotId);
+ expect(snap).toBeDefined();
+ // Snapshot must have captured bob's session before the switch.
+ expect(snap!.cookies.some((c) => c.value === 'user_bob')).toBe(true);
+
+ // After switch: alice's cookie must be present.
+ const cookies = control.getCookies().filter((c) => c.domain === 'cookie-app.com');
+ expect(cookies.some((c) => c.name === 'session_id' && c.value === 'user_alice')).toBe(true);
+ // Bob's cookie must be gone.
+ expect(cookies.some((c) => c.value === 'user_bob')).toBe(false);
+
+ expect(result.succeeded).toBe(true);
+ });
+
+ it('switch result has a cookies StoreResult with status applied', async () => {
+ const tab = grantAndAddTab('https://cookie-app.com/');
+ const profile = makeProfile({
+ origin: 'https://cookie-app.com',
+ domainScope: ['https://cookie-app.com'],
+ cookies: [makeCookie({ name: 'sess', value: 'v', domain: 'cookie-app.com' })],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ const cookiesResult = result.results.find((r) => r.store === 'cookies');
+ expect(cookiesResult).toBeDefined();
+ expect(cookiesResult!.status).toBe('applied');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// (b) Multi-domain SSO
+// ---------------------------------------------------------------------------
+
+describe('Matrix (b): multi-domain SSO', () => {
+ it('capture collects cookies from both app and auth domains', async () => {
+ seedCookies('app.sso-example.com', [['app_session', 'app_v']]);
+ seedCookies('auth.sso-example.com', [['auth_token', 'auth_v']]);
+ const tab = grantAndAddTab('https://app.sso-example.com/', { app_data: 'ls_val' });
+ control.grantOrigin('https://auth.sso-example.com/*');
+
+ const p = await captureProfile({
+ name: 'sso-profile',
+ tabId: tab.id,
+ extraOrigins: ['https://auth.sso-example.com'],
+ });
+
+ expect(p.cookies.some((c) => c.name === 'app_session')).toBe(true);
+ expect(p.cookies.some((c) => c.name === 'auth_token')).toBe(true);
+ expect(p.domainScope).toContain('https://app.sso-example.com');
+ expect(p.domainScope).toContain('https://auth.sso-example.com');
+ });
+
+ it('web storage for non-active origin is disclosed (not-captured or skipped)', async () => {
+ const tab = grantAndAddTab('https://app.sso-example.com/', { active_token: 'at' });
+ control.grantOrigin('https://auth.sso-example.com/*');
+
+ const p = await captureProfile({
+ name: 'sso-ws-disclosure',
+ tabId: tab.id,
+ extraOrigins: ['https://auth.sso-example.com'],
+ });
+
+ // The profile must NOT silently claim it captured localStorage for auth.sso-example.com.
+ // Disclosure appears as an UnsupportedStoreNotice or a distinct field.
+ const notices = p.unsupportedStores ?? [];
+ const hasDisclosure =
+ notices.some((n) =>
+ n.reason.toLowerCase().includes('auth') ||
+ n.store === 'localStorage' ||
+ n.store === 'sessionStorage',
+ );
+ expect(hasDisclosure).toBe(true);
+ });
+
+ it('switch applies cookies across the full domainScope', async () => {
+ seedCookies('app.sso-example.com', [['stale_app', 'stale']]);
+ const tab = grantAndAddTab('https://app.sso-example.com/');
+ control.grantOrigin('https://auth.sso-example.com/*');
+
+ const profile = makeProfile({
+ name: 'sso-switch',
+ origin: 'https://app.sso-example.com',
+ domainScope: ['https://app.sso-example.com', 'https://auth.sso-example.com'],
+ cookies: [
+ makeCookie({ name: 'app_session', value: 'new_app', domain: 'app.sso-example.com' }),
+ makeCookie({ name: 'auth_token', value: 'new_auth', domain: 'auth.sso-example.com' }),
+ ],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+
+ expect(result.succeeded).toBe(true);
+ const cookies = control.getCookies();
+ expect(cookies.some((c) => c.name === 'app_session' && c.value === 'new_app')).toBe(true);
+ expect(cookies.some((c) => c.name === 'auth_token' && c.value === 'new_auth')).toBe(true);
+ expect(cookies.some((c) => c.name === 'stale_app')).toBe(false);
+ });
+
+ it('non-active origin web storage result is not-captured or skipped — never silently applied without acknowledgement', async () => {
+ const tab = grantAndAddTab('https://app.sso-example.com/', { app_ls: 'v' });
+ control.grantOrigin('https://auth.sso-example.com/*');
+
+ const profile = makeProfile({
+ name: 'sso-ws-switch',
+ origin: 'https://app.sso-example.com',
+ domainScope: ['https://app.sso-example.com', 'https://auth.sso-example.com'],
+ cookies: [],
+ localStorage: { app_ls: 'v' },
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+
+ // Every web-storage-related store result must be explicitly surfaced.
+ const webResults = result.results.filter(
+ (r) => r.store === 'localStorage' || r.store === 'sessionStorage',
+ );
+ expect(webResults.length).toBeGreaterThan(0);
+ // None may be silently omitted: the sum of statuses must account for both
+ // the applied active-origin result and the non-active-origin disclosure.
+ const unknownStatus = webResults.some(
+ (r) => !['applied', 'cleared', 'skipped', 'failed', 'not-captured'].includes(r.status),
+ );
+ expect(unknownStatus).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// (c) localStorage-token SPA
+// ---------------------------------------------------------------------------
+
+describe('Matrix (c): localStorage-token SPA', () => {
+ it('capture picks up the token in localStorage', async () => {
+ const tab = grantAndAddTab('https://spa.example.com/', { access_token: 'jwt.eyJ...abc' });
+ const p = await captureProfile({ name: 'spa-profile', tabId: tab.id });
+ expect(p.localStorage['access_token']).toMatch(/^jwt\./);
+ });
+
+ it('switch replaces old token with profile token', async () => {
+ const tab = grantAndAddTab('https://spa.example.com/', { access_token: 'old_jwt' });
+ const profile = makeProfile({
+ name: 'spa-switch',
+ origin: 'https://spa.example.com',
+ domainScope: ['https://spa.example.com'],
+ cookies: [],
+ localStorage: { access_token: 'new_jwt_for_alice' },
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+
+ expect(result.succeeded).toBe(true);
+ const finalTab = control.getTab(tab.id)!;
+ expect(finalTab.localStorage['access_token']).toBe('new_jwt_for_alice');
+ });
+
+ it('switch result has localStorage entry with applied status', async () => {
+ const tab = grantAndAddTab('https://spa.example.com/');
+ const profile = makeProfile({
+ name: 'spa-ls-result',
+ origin: 'https://spa.example.com',
+ domainScope: ['https://spa.example.com'],
+ cookies: [],
+ localStorage: { token: 'v' },
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ const lsResult = result.results.find((r) => r.store === 'localStorage');
+ expect(lsResult).toBeDefined();
+ expect(lsResult!.status).toBe('applied');
+ });
+
+ it('snapshot captures the old token before switch', async () => {
+ const tab = grantAndAddTab('https://spa.example.com/', { access_token: 'old_token_snap' });
+ const profile = makeProfile({
+ name: 'spa-snap',
+ origin: 'https://spa.example.com',
+ domainScope: ['https://spa.example.com'],
+ cookies: [],
+ localStorage: { access_token: 'new_token' },
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ const snap = await getSnapshot(result.snapshotId);
+ expect(snap!.localStorage['access_token']).toBe('old_token_snap');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// (d) CHIPS / partitioned cookies
+// ---------------------------------------------------------------------------
+
+describe('Matrix (d): CHIPS/partitioned cookies', () => {
+ it('capture records partitionKey on a partitioned cookie', async () => {
+ control.seedCookies([{
+ name: 'chipped',
+ value: 'partitioned_val',
+ domain: 'embedded.example.com',
+ path: '/',
+ partitionKey: { topLevelSite: 'https://host-site.com' },
+ }]);
+ const tab = grantAndAddTab('https://embedded.example.com/');
+ const p = await captureProfile({ name: 'chips', tabId: tab.id });
+ const chipped = p.cookies.find((c) => c.name === 'chipped');
+ expect(chipped).toBeDefined();
+ expect(chipped!.partitionKey).toBeDefined();
+ });
+
+ it('two cookies with same name/domain but different partitionKey are both captured', async () => {
+ control.seedCookies([
+ {
+ name: 'sessid',
+ value: 'val_p1',
+ domain: 'widget.example.com',
+ partitionKey: { topLevelSite: 'https://site-a.com' },
+ },
+ {
+ name: 'sessid',
+ value: 'val_p2',
+ domain: 'widget.example.com',
+ partitionKey: { topLevelSite: 'https://site-b.com' },
+ },
+ ]);
+ const tab = grantAndAddTab('https://widget.example.com/');
+ const p = await captureProfile({ name: 'chips-multi', tabId: tab.id });
+ const sessCookies = p.cookies.filter((c) => c.name === 'sessid');
+ expect(sessCookies.length).toBe(2);
+ });
+
+ it('switch applies partitioned cookies with their partitionKey intact', async () => {
+ const tab = grantAndAddTab('https://embedded.example.com/');
+ const profile = makeProfile({
+ name: 'chips-switch',
+ origin: 'https://embedded.example.com',
+ domainScope: ['https://embedded.example.com'],
+ cookies: [
+ {
+ name: 'chipped',
+ value: 'restored_val',
+ domain: 'embedded.example.com',
+ path: '/',
+ secure: false,
+ httpOnly: false,
+ sameSite: 'unspecified',
+ partitionKey: 'https://host-site.com',
+ },
+ ],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ expect(result.succeeded).toBe(true);
+ const applied = control.getCookies().find(
+ (c) => c.name === 'chipped' && c.value === 'restored_val',
+ );
+ expect(applied).toBeDefined();
+ expect(applied!.partitionKey).toBeDefined();
+ });
+
+ it('deleting a partitioned cookie does not remove the unpartitioned counterpart', async () => {
+ // Seed one partitioned and one unpartitioned cookie with the same name.
+ control.seedCookies([
+ {
+ name: 'same_name',
+ value: 'partitioned',
+ domain: 'embedded.example.com',
+ partitionKey: { topLevelSite: 'https://top.com' },
+ },
+ {
+ name: 'same_name',
+ value: 'unpartitioned',
+ domain: 'embedded.example.com',
+ },
+ ]);
+ // After a clear-then-apply switch, the correct partition semantics must hold.
+ const tab = grantAndAddTab('https://embedded.example.com/');
+ const profile = makeProfile({
+ name: 'chips-delete',
+ origin: 'https://embedded.example.com',
+ domainScope: ['https://embedded.example.com'],
+ cookies: [
+ // Only restore the unpartitioned one.
+ {
+ name: 'same_name',
+ value: 'unpartitioned',
+ domain: 'embedded.example.com',
+ path: '/',
+ secure: false,
+ httpOnly: false,
+ sameSite: 'unspecified',
+ },
+ ],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ expect(result.succeeded).toBe(true);
+ // The unpartitioned cookie should be present after the switch.
+ const remaining = control.getCookies().filter((c) => c.name === 'same_name');
+ expect(remaining.some((c) => c.value === 'unpartitioned')).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// (e) IndexedDB-token app — must be disclosed, never silently dropped
+// ---------------------------------------------------------------------------
+
+describe('Matrix (e): IndexedDB-token app — limitation disclosed', () => {
+ it('capture explicitly includes an indexedDB UnsupportedStoreNotice', async () => {
+ const tab = grantAndAddTab('https://idb-app.example.com/');
+ const p = await captureProfile({ name: 'idb-app', tabId: tab.id });
+ const idbNotice = p.unsupportedStores?.find((n) => n.store === 'indexedDB');
+ expect(idbNotice).toBeDefined();
+ expect(idbNotice!.reason.length).toBeGreaterThan(0);
+ });
+
+ it('switch result includes indexedDB as not-captured (never silently applied)', async () => {
+ const tab = grantAndAddTab('https://idb-app.example.com/');
+ const profile = makeProfile({
+ name: 'idb-switch',
+ origin: 'https://idb-app.example.com',
+ domainScope: ['https://idb-app.example.com'],
+ cookies: [],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ const idbResult = result.results.find((r) => r.store === 'indexedDB');
+ expect(idbResult).toBeDefined();
+ expect(idbResult!.status).toBe('not-captured');
+ });
+
+ it('indexedDB not-captured status does not cause succeeded=false (limitation, not failure)', async () => {
+ const tab = grantAndAddTab('https://idb-app.example.com/');
+ const profile = makeProfile({
+ name: 'idb-succeeded',
+ origin: 'https://idb-app.example.com',
+ domainScope: ['https://idb-app.example.com'],
+ cookies: [],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ // not-captured is a known limitation, not a store failure — must not make succeeded=false.
+ const hasActualFailure = result.results.some((r) => r.status === 'failed');
+ if (!hasActualFailure) {
+ expect(result.succeeded).toBe(true);
+ }
+ });
+
+ it('pre-switch snapshot always exists even in an IndexedDB-token app scenario', async () => {
+ const tab = grantAndAddTab('https://idb-app.example.com/');
+ const profile = makeProfile({
+ name: 'idb-snapshot',
+ origin: 'https://idb-app.example.com',
+ domainScope: ['https://idb-app.example.com'],
+ cookies: [],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ const snap = await getSnapshot(result.snapshotId);
+ expect(snap).toBeDefined();
+ expect(snap!.id).toBe(result.snapshotId);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Cross-cutting: partial failure leaves snapshot + succeeded=false
+// ---------------------------------------------------------------------------
+
+describe('Cross-cutting: partial failure invariants (CONTRACTS §3)', () => {
+ it('when succeeded=false, the snapshotId is still a non-empty string (recovery available)', async () => {
+ // This test seeds a normal switch and checks the invariant holds for the
+ // general case. A seam to inject store failures would allow a tighter test;
+ // see the seams section in the final report.
+ const tab = grantAndAddTab('https://example.com/');
+ const profile = makeProfile({
+ name: 'partial-invariant',
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ // In all cases (success or failure), snapshotId must be a non-empty string.
+ expect(typeof result.snapshotId).toBe('string');
+ expect(result.snapshotId.length).toBeGreaterThan(0);
+ });
+
+ it('snapshot is retrievable and valid even after a switch completes', async () => {
+ const tab = grantAndAddTab('https://example.com/', { before: 'value' });
+ const profile = makeProfile({
+ name: 'recovery-check',
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ localStorage: { after: 'value' },
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ const snap = await getSnapshot(result.snapshotId);
+ expect(snap).toBeDefined();
+ expect(typeof snap!.id).toBe('string');
+ expect(typeof snap!.reason).toBe('string');
+ expect(snap!.reason.length).toBeGreaterThan(0);
+ });
+
+ it('no switch ever produces a result with status outside the allowed enum', async () => {
+ const tab = grantAndAddTab('https://example.com/');
+ const profile = makeProfile({
+ name: 'enum-check',
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await persistAndSwitch(profile, tab.id);
+ const allowedStatuses = new Set(['applied', 'cleared', 'skipped', 'failed', 'not-captured']);
+ for (const r of result.results) {
+ expect(allowedStatuses.has(r.status)).toBe(true);
+ }
+ });
+});
diff --git a/tests/profiles/profileService.test.ts b/tests/profiles/profileService.test.ts
new file mode 100644
index 0000000..76131ee
--- /dev/null
+++ b/tests/profiles/profileService.test.ts
@@ -0,0 +1,295 @@
+/**
+ * Tests for profileService: listProfiles, saveCapturedProfile, deleteProfile,
+ * updateProfileMeta, shouldPromptUpsell.
+ * PRD §9.2, §11.1, CONTRACTS §3, §11.
+ *
+ * Golden rule: never assert NotImplementedError is thrown.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import {
+ listProfiles,
+ saveCapturedProfile,
+ deleteProfile,
+ updateProfileMeta,
+ shouldPromptUpsell,
+} from '@/services/profiles/profileService';
+import { makeProfile, makeCookie } from '../harness/factories';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function baseProfile(name: string, origin = 'https://example.com') {
+ return makeProfile({ name, origin, domainScope: [origin] });
+}
+
+// ---------------------------------------------------------------------------
+// listProfiles
+// ---------------------------------------------------------------------------
+
+describe('listProfiles', () => {
+ it('returns an empty array when no profiles have been saved', async () => {
+ const profiles = await listProfiles();
+ expect(Array.isArray(profiles)).toBe(true);
+ expect(profiles).toHaveLength(0);
+ });
+
+ it('returns all saved profiles after saving one', async () => {
+ const p = baseProfile('admin');
+ await saveCapturedProfile(p);
+ const profiles = await listProfiles();
+ expect(profiles).toHaveLength(1);
+ expect(profiles[0].id).toBe(p.id);
+ });
+
+ it('returns all saved profiles (multiple)', async () => {
+ const p1 = baseProfile('admin');
+ const p2 = baseProfile('user');
+ await saveCapturedProfile(p1);
+ await saveCapturedProfile(p2);
+ const profiles = await listProfiles();
+ expect(profiles).toHaveLength(2);
+ const ids = profiles.map((p) => p.id);
+ expect(ids).toContain(p1.id);
+ expect(ids).toContain(p2.id);
+ });
+
+ it('profiles list does not contain deleted profiles', async () => {
+ const p1 = baseProfile('to-delete');
+ const p2 = baseProfile('to-keep');
+ await saveCapturedProfile(p1);
+ await saveCapturedProfile(p2);
+ await deleteProfile(p1.id);
+ const profiles = await listProfiles();
+ const ids = profiles.map((p) => p.id);
+ expect(ids).not.toContain(p1.id);
+ expect(ids).toContain(p2.id);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// saveCapturedProfile
+// ---------------------------------------------------------------------------
+
+describe('saveCapturedProfile', () => {
+ it('returns the saved profile', async () => {
+ const p = baseProfile('saved');
+ const returned = await saveCapturedProfile(p);
+ expect(returned).toHaveProperty('id', p.id);
+ expect(returned).toHaveProperty('name', 'saved');
+ });
+
+ it('the returned profile has sizeBytes > 0', async () => {
+ const p = makeProfile({
+ name: 'sz-test',
+ cookies: [makeCookie()],
+ localStorage: { tok: 'abc' },
+ });
+ const returned = await saveCapturedProfile(p);
+ expect(returned.sizeBytes).toBeGreaterThan(0);
+ });
+
+ it('persists the profile so it appears in listProfiles', async () => {
+ const p = baseProfile('persist-check');
+ await saveCapturedProfile(p);
+ const profiles = await listProfiles();
+ expect(profiles.some((x) => x.id === p.id)).toBe(true);
+ });
+
+ it('saves cookie data without data loss', async () => {
+ const cookie = makeCookie({ name: 'auth', value: 'secret123', domain: 'example.com' });
+ const p = makeProfile({ cookies: [cookie] });
+ await saveCapturedProfile(p);
+ const profiles = await listProfiles();
+ const saved = profiles.find((x) => x.id === p.id)!;
+ expect(saved.cookies[0].name).toBe('auth');
+ expect(saved.cookies[0].value).toBe('secret123');
+ });
+
+ it('saves localStorage data without data loss', async () => {
+ const p = makeProfile({ localStorage: { tok: 'ls_value', lang: 'en' } });
+ await saveCapturedProfile(p);
+ const profiles = await listProfiles();
+ const saved = profiles.find((x) => x.id === p.id)!;
+ expect(saved.localStorage['tok']).toBe('ls_value');
+ expect(saved.localStorage['lang']).toBe('en');
+ });
+
+ it('saving the same id twice updates the stored profile (no duplicate)', async () => {
+ const p = baseProfile('update-on-save');
+ await saveCapturedProfile(p);
+ const updated = { ...p, name: 'updated-name' };
+ await saveCapturedProfile(updated);
+ const profiles = await listProfiles();
+ const matches = profiles.filter((x) => x.id === p.id);
+ expect(matches).toHaveLength(1);
+ expect(matches[0].name).toBe('updated-name');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// deleteProfile
+// ---------------------------------------------------------------------------
+
+describe('deleteProfile', () => {
+ it('removes the profile from storage', async () => {
+ const p = baseProfile('to-delete');
+ await saveCapturedProfile(p);
+ await deleteProfile(p.id);
+ const profiles = await listProfiles();
+ expect(profiles.some((x) => x.id === p.id)).toBe(false);
+ });
+
+ it('does not remove other profiles', async () => {
+ const p1 = baseProfile('del-me');
+ const p2 = baseProfile('keep-me');
+ await saveCapturedProfile(p1);
+ await saveCapturedProfile(p2);
+ await deleteProfile(p1.id);
+ const profiles = await listProfiles();
+ expect(profiles.some((x) => x.id === p2.id)).toBe(true);
+ });
+
+ it('deleting a non-existent id does not throw', async () => {
+ await expect(deleteProfile('ghost-id')).resolves.not.toThrow();
+ });
+
+ it('profile count drops by 1 after delete', async () => {
+ const p1 = baseProfile('a');
+ const p2 = baseProfile('b');
+ await saveCapturedProfile(p1);
+ await saveCapturedProfile(p2);
+ await deleteProfile(p1.id);
+ const profiles = await listProfiles();
+ expect(profiles).toHaveLength(1);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// updateProfileMeta
+// ---------------------------------------------------------------------------
+
+describe('updateProfileMeta', () => {
+ it('updates the name field', async () => {
+ const p = baseProfile('old-name');
+ await saveCapturedProfile(p);
+ const updated = await updateProfileMeta(p.id, { name: 'new-name' });
+ expect(updated.name).toBe('new-name');
+ });
+
+ it('updates the environment field', async () => {
+ const p = baseProfile('env-test');
+ await saveCapturedProfile(p);
+ const updated = await updateProfileMeta(p.id, { environment: 'prod' });
+ expect(updated.environment).toBe('prod');
+ });
+
+ it('updates the tags field', async () => {
+ const p = baseProfile('tags-test');
+ await saveCapturedProfile(p);
+ const updated = await updateProfileMeta(p.id, { tags: ['admin', 'qa'] });
+ expect(updated.tags).toEqual(['admin', 'qa']);
+ });
+
+ it('partial update: only specified fields change', async () => {
+ const p = makeProfile({ name: 'partial', environment: 'dev', tags: ['tag1'] });
+ await saveCapturedProfile(p);
+ const updated = await updateProfileMeta(p.id, { name: 'updated-name' });
+ // Other fields must be unchanged.
+ expect(updated.environment).toBe('dev');
+ expect(updated.tags).toEqual(['tag1']);
+ });
+
+ it('update is reflected in listProfiles', async () => {
+ const p = baseProfile('list-update');
+ await saveCapturedProfile(p);
+ await updateProfileMeta(p.id, { name: 'reflected' });
+ const profiles = await listProfiles();
+ const found = profiles.find((x) => x.id === p.id)!;
+ expect(found.name).toBe('reflected');
+ });
+
+ it('rejects for a non-existent profile id', async () => {
+ await expect(
+ updateProfileMeta('ghost-id', { name: 'irrelevant' }),
+ ).rejects.toThrow();
+ });
+
+ it('non-meta fields (cookies, localStorage) are not modified by updateProfileMeta', async () => {
+ const p = makeProfile({ localStorage: { tok: 'secret' } });
+ await saveCapturedProfile(p);
+ await updateProfileMeta(p.id, { name: 'meta-only' });
+ const profiles = await listProfiles();
+ const saved = profiles.find((x) => x.id === p.id)!;
+ expect(saved.localStorage['tok']).toBe('secret');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// shouldPromptUpsell — PRD §9.2 / CONTRACTS §11
+// ---------------------------------------------------------------------------
+
+describe('shouldPromptUpsell (CONTRACTS §11 / PRD §9.2)', () => {
+ it('returns false when no profiles have been saved (below free limit)', async () => {
+ const prompt = await shouldPromptUpsell();
+ expect(prompt).toBe(false);
+ });
+
+ it('returns false after saving 1 profile (below free limit of 3)', async () => {
+ await saveCapturedProfile(baseProfile('p1'));
+ const prompt = await shouldPromptUpsell();
+ expect(prompt).toBe(false);
+ });
+
+ it('returns false after saving 2 profiles (below free limit of 3)', async () => {
+ await saveCapturedProfile(baseProfile('p1'));
+ await saveCapturedProfile(baseProfile('p2'));
+ const prompt = await shouldPromptUpsell();
+ expect(prompt).toBe(false);
+ });
+
+ it('returns true at the free milestone (3rd profile — default freeProfileLimit=3)', async () => {
+ await saveCapturedProfile(baseProfile('p1'));
+ await saveCapturedProfile(baseProfile('p2'));
+ await saveCapturedProfile(baseProfile('p3'));
+ const prompt = await shouldPromptUpsell();
+ expect(prompt).toBe(true);
+ });
+
+ it('returns true when more than 3 profiles are saved', async () => {
+ await saveCapturedProfile(baseProfile('p1'));
+ await saveCapturedProfile(baseProfile('p2'));
+ await saveCapturedProfile(baseProfile('p3'));
+ await saveCapturedProfile(baseProfile('p4'));
+ const prompt = await shouldPromptUpsell();
+ expect(prompt).toBe(true);
+ });
+
+ it('returns false again if profiles drop below the limit after deletion', async () => {
+ const p1 = baseProfile('p1');
+ const p2 = baseProfile('p2');
+ const p3 = baseProfile('p3');
+ await saveCapturedProfile(p1);
+ await saveCapturedProfile(p2);
+ await saveCapturedProfile(p3);
+ // Deleting one should bring count back below the milestone.
+ await deleteProfile(p3.id);
+ const prompt = await shouldPromptUpsell();
+ expect(prompt).toBe(false);
+ });
+
+ it('switching (switchToProfile) is never gated — always callable regardless of upsell', async () => {
+ // This test documents the contract: switchToProfile must not throw a
+ // "free limit exceeded" error. The upsell is a soft prompt, not a hard gate.
+ // (Full wiring tested in switchEngine.test.ts; here we assert shouldPromptUpsell
+ // returns a boolean and not an Error, confirming the function contract is clear.)
+ await saveCapturedProfile(baseProfile('p1'));
+ await saveCapturedProfile(baseProfile('p2'));
+ await saveCapturedProfile(baseProfile('p3'));
+ const prompt = await shouldPromptUpsell();
+ // Prompt is a boolean signal — not an Error, not a thrown exception.
+ expect(typeof prompt).toBe('boolean');
+ });
+});
diff --git a/tests/profiles/router.profiles.test.ts b/tests/profiles/router.profiles.test.ts
new file mode 100644
index 0000000..155d830
--- /dev/null
+++ b/tests/profiles/router.profiles.test.ts
@@ -0,0 +1,367 @@
+/**
+ * Router integration tests for profiles/* and snapshots/* message types.
+ * PRD §13.1 / §13.3, CONTRACTS §13.
+ *
+ * Tests verify:
+ * - handleRequest routes profiles/* and snapshots/* messages to the correct
+ * service and returns a typed response.
+ * - backgroundMessageListener wraps success as {ok:true,value} and failure
+ * as {ok:false,error}.
+ * - Messages from other senders are ignored (returns false).
+ * - Non-{type} messages are ignored (returns false).
+ * - sanitizeError: NotImplementedError/UserFacingError forward message;
+ * other Error becomes a generic string.
+ *
+ * Because all profile/snapshot services are stubs, most router calls will
+ * respond {ok:false,error:'NotImplementedError:...'} at this stage. The tests
+ * assert the ENVELOPE SHAPE is always correct and the error is a sanitized
+ * string — never a raw thrown value.
+ *
+ * Golden rule: never assert NotImplementedError is thrown.
+ */
+
+import { describe, it, expect, vi } from 'vitest';
+import { handleRequest } from '@/background/router';
+import {
+ backgroundMessageListener,
+ sanitizeError,
+} from '@/background/messageHandler';
+import { NotImplementedError, UserFacingError } from '@/lib/result';
+import type { BgRequest } from '@/types/messages';
+import { control } from '../harness/fakeChrome';
+import { makeProfile, makeSnapshot } from '../harness/factories';
+import { saveProfile, saveSnapshot } from '@/services/storage/profileRepository';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+const RUNTIME_ID = (chrome.runtime as { id: string }).id;
+
+/** Simulate a message from the same extension. */
+function sameSender(): chrome.runtime.MessageSender {
+ return { id: RUNTIME_ID };
+}
+
+/** Simulate a message from a different extension. */
+function foreignSender(): chrome.runtime.MessageSender {
+ return { id: 'other-extension-id' };
+}
+
+/**
+ * Send a message through backgroundMessageListener and collect the envelope.
+ * Returns a Promise resolving to the BgEnvelope received by sendResponse.
+ */
+function dispatch(
+ message: unknown,
+ sender: chrome.runtime.MessageSender = sameSender(),
+): Promise<{ ok: boolean; value?: unknown; error?: string } | undefined> {
+ return new Promise((resolve) => {
+ const kept = backgroundMessageListener(
+ message,
+ sender,
+ (response) => resolve(response as { ok: boolean; value?: unknown; error?: string }),
+ );
+ // If the listener returned false (ignored), resolve undefined.
+ if (kept === false) resolve(undefined);
+ });
+}
+
+// ---------------------------------------------------------------------------
+// handleRequest — message routing (profiles/*)
+// ---------------------------------------------------------------------------
+
+describe('handleRequest — profiles/* routing', () => {
+ it('profiles/list: handleRequest does not throw an unhandled rejection', async () => {
+ const req: BgRequest = { type: 'profiles/list' };
+ // handleRequest may reject (stub not implemented) — we just assert it rejects
+ // cleanly with an Error, not an unhandled crash.
+ let caught: unknown;
+ try {
+ await handleRequest(req);
+ } catch (e) {
+ caught = e;
+ }
+ // Either resolved or rejected with an Error instance (never undefined or crash).
+ if (caught !== undefined) {
+ expect(caught instanceof Error).toBe(true);
+ }
+ });
+
+ it('profiles/capture: handleRequest does not throw an unhandled rejection', async () => {
+ control.grantOrigin('https://example.com/*');
+ control.addTab({ url: 'https://example.com/', id: 1 });
+ const req: BgRequest = { type: 'profiles/capture', name: 'test', tabId: 1 };
+ let caught: unknown;
+ try {
+ await handleRequest(req);
+ } catch (e) {
+ caught = e;
+ }
+ if (caught !== undefined) {
+ expect(caught instanceof Error).toBe(true);
+ }
+ });
+
+ it('profiles/delete: handleRequest does not throw an unhandled rejection', async () => {
+ const req: BgRequest = { type: 'profiles/delete', profileId: 'any-id' };
+ let caught: unknown;
+ try {
+ await handleRequest(req);
+ } catch (e) {
+ caught = e;
+ }
+ if (caught !== undefined) {
+ expect(caught instanceof Error).toBe(true);
+ }
+ });
+
+ it('profiles/shouldPromptUpsell: handleRequest does not throw an unhandled rejection', async () => {
+ const req: BgRequest = { type: 'profiles/shouldPromptUpsell' };
+ let caught: unknown;
+ try {
+ await handleRequest(req);
+ } catch (e) {
+ caught = e;
+ }
+ if (caught !== undefined) {
+ expect(caught instanceof Error).toBe(true);
+ }
+ });
+
+ it('profiles/switch: handleRequest does not throw an unhandled rejection', async () => {
+ control.grantOrigin('https://example.com/*');
+ control.addTab({ url: 'https://example.com/', id: 2 });
+ const req: BgRequest = { type: 'profiles/switch', profileId: 'any-id', tabId: 2 };
+ let caught: unknown;
+ try {
+ await handleRequest(req);
+ } catch (e) {
+ caught = e;
+ }
+ if (caught !== undefined) {
+ expect(caught instanceof Error).toBe(true);
+ }
+ });
+
+ it('profiles/restore: handleRequest does not throw an unhandled rejection', async () => {
+ control.grantOrigin('https://example.com/*');
+ control.addTab({ url: 'https://example.com/', id: 3 });
+ const req: BgRequest = { type: 'profiles/restore', profileId: 'any-id', tabId: 3 };
+ let caught: unknown;
+ try {
+ await handleRequest(req);
+ } catch (e) {
+ caught = e;
+ }
+ if (caught !== undefined) {
+ expect(caught instanceof Error).toBe(true);
+ }
+ });
+});
+
+// ---------------------------------------------------------------------------
+// handleRequest — message routing (snapshots/*)
+// ---------------------------------------------------------------------------
+
+describe('handleRequest — snapshots/* routing', () => {
+ it('snapshots/list: handleRequest does not throw an unhandled rejection', async () => {
+ const req: BgRequest = { type: 'snapshots/list' };
+ let caught: unknown;
+ try {
+ await handleRequest(req);
+ } catch (e) {
+ caught = e;
+ }
+ if (caught !== undefined) {
+ expect(caught instanceof Error).toBe(true);
+ }
+ });
+
+ it('snapshots/restore: handleRequest does not throw an unhandled rejection', async () => {
+ control.grantOrigin('https://example.com/*');
+ control.addTab({ url: 'https://example.com/', id: 4 });
+ const req: BgRequest = { type: 'snapshots/restore', snapshotId: 'any-id', tabId: 4 };
+ let caught: unknown;
+ try {
+ await handleRequest(req);
+ } catch (e) {
+ caught = e;
+ }
+ if (caught !== undefined) {
+ expect(caught instanceof Error).toBe(true);
+ }
+ });
+});
+
+// ---------------------------------------------------------------------------
+// backgroundMessageListener — envelope wrapping
+// ---------------------------------------------------------------------------
+
+describe('backgroundMessageListener — envelope for profiles/* messages', () => {
+ it('wraps a successful profiles/list response in {ok:true,value}', async () => {
+ // Pre-populate via profileRepository so the service can return a real value.
+ const p = makeProfile();
+ await saveProfile(p);
+ // profiles/list calls profileService.listProfiles which is a stub — the
+ // envelope will be {ok:false,...}. The important contract: it IS an envelope.
+ const envelope = await dispatch({ type: 'profiles/list' });
+ expect(envelope).toBeDefined();
+ expect(typeof envelope!.ok).toBe('boolean');
+ if (envelope!.ok) {
+ expect(envelope).toHaveProperty('value');
+ } else {
+ expect(envelope).toHaveProperty('error');
+ expect(typeof envelope!.error).toBe('string');
+ }
+ });
+
+ it('wraps a failure (NotImplementedError) in {ok:false,error:string}', async () => {
+ const envelope = await dispatch({ type: 'profiles/list' });
+ // If the service is still a stub, we get {ok:false,error:'NotImplementedError:...'}.
+ if (envelope && !envelope.ok) {
+ expect(typeof envelope.error).toBe('string');
+ expect(envelope.error!.length).toBeGreaterThan(0);
+ }
+ });
+
+ it('always returns an envelope object with exactly ok:true|false', async () => {
+ const envelope = await dispatch({ type: 'profiles/shouldPromptUpsell' });
+ expect(envelope).toBeDefined();
+ expect(envelope!.ok === true || envelope!.ok === false).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// backgroundMessageListener — sender and shape filtering (CONTRACTS §13)
+// ---------------------------------------------------------------------------
+
+describe('backgroundMessageListener — sender validation (CONTRACTS §13)', () => {
+ it('returns false (ignores) for a message from a foreign extension', () => {
+ const kept = backgroundMessageListener(
+ { type: 'profiles/list' },
+ foreignSender(),
+ () => {},
+ );
+ expect(kept).toBe(false);
+ });
+
+ it('returns false for a message with no type field', () => {
+ const kept = backgroundMessageListener(
+ { notAType: true },
+ sameSender(),
+ () => {},
+ );
+ expect(kept).toBe(false);
+ });
+
+ it('returns false for a null message', () => {
+ const kept = backgroundMessageListener(null, sameSender(), () => {});
+ expect(kept).toBe(false);
+ });
+
+ it('returns false for a string message', () => {
+ const kept = backgroundMessageListener('profiles/list', sameSender(), () => {});
+ expect(kept).toBe(false);
+ });
+
+ it('returns true (keeps channel open) for a valid profiles/* message', () => {
+ const kept = backgroundMessageListener(
+ { type: 'profiles/list' },
+ sameSender(),
+ () => {},
+ );
+ expect(kept).toBe(true);
+ });
+
+ it('returns true for a valid snapshots/* message', () => {
+ const kept = backgroundMessageListener(
+ { type: 'snapshots/list' },
+ sameSender(),
+ () => {},
+ );
+ expect(kept).toBe(true);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// sanitizeError (CONTRACTS §13)
+// ---------------------------------------------------------------------------
+
+describe('sanitizeError — error message safety (CONTRACTS §13)', () => {
+ it('forwards the message for NotImplementedError', () => {
+ const err = new NotImplementedError('profiles/capture.captureProfile');
+ const sanitized = sanitizeError(err);
+ expect(sanitized).toContain('NotImplementedError');
+ expect(sanitized.length).toBeGreaterThan(0);
+ });
+
+ it('forwards the message for UserFacingError', () => {
+ const err = new UserFacingError('Profile not found');
+ const sanitized = sanitizeError(err);
+ expect(sanitized).toContain('Profile not found');
+ });
+
+ it('returns a generic string (no message) for other Error types', () => {
+ const err = new TypeError('secret_value=abc123');
+ const sanitized = sanitizeError(err);
+ // Must not leak the error message contents.
+ expect(sanitized).not.toContain('secret_value');
+ expect(sanitized).not.toContain('abc123');
+ expect(sanitized.length).toBeGreaterThan(0);
+ });
+
+ it('returns a generic string for plain thrown values', () => {
+ const sanitized = sanitizeError({ message: 'leaked_secret' });
+ expect(sanitized).not.toContain('leaked_secret');
+ expect(typeof sanitized).toBe('string');
+ expect(sanitized.length).toBeGreaterThan(0);
+ });
+
+ it('truncates very long NotImplementedError messages to ≤200 chars in the message portion', () => {
+ const longFeature = 'x'.repeat(300);
+ const err = new NotImplementedError(longFeature);
+ const sanitized = sanitizeError(err);
+ // The sanitized string is PREFIX + up to 200 chars of the message.
+ // Total string may exceed 200 due to the prefix; the message portion is capped.
+ expect(sanitized.length).toBeLessThan(300); // well under if truncated
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Router: every profiles/* and snapshots/* type has a handler (CONTRACTS §13)
+// ---------------------------------------------------------------------------
+
+describe('handleRequest — exhaustiveness: all known profile/snapshot types route without crash', () => {
+ const PROFILE_ID = 'test-profile-id';
+ const SNAPSHOT_ID = 'test-snapshot-id';
+ const TAB_ID = 99;
+
+ const profileMessages: BgRequest[] = [
+ { type: 'profiles/list' },
+ { type: 'profiles/capture', name: 'cap', tabId: TAB_ID },
+ { type: 'profiles/switch', profileId: PROFILE_ID, tabId: TAB_ID },
+ { type: 'profiles/restore', profileId: PROFILE_ID, tabId: TAB_ID },
+ { type: 'profiles/delete', profileId: PROFILE_ID },
+ { type: 'profiles/shouldPromptUpsell' },
+ { type: 'snapshots/list' },
+ { type: 'snapshots/restore', snapshotId: SNAPSHOT_ID, tabId: TAB_ID },
+ ];
+
+ for (const msg of profileMessages) {
+ it(`${msg.type} is handled (not an untyped crash)`, async () => {
+ control.grantOrigin('https://example.com/*');
+ control.addTab({ url: 'https://example.com/', id: TAB_ID });
+ let error: unknown = null;
+ try {
+ await handleRequest(msg);
+ } catch (e) {
+ error = e;
+ }
+ // If it threw, it must be an Error instance (not undefined, not a string).
+ if (error !== null) {
+ expect(error instanceof Error).toBe(true);
+ }
+ });
+ }
+});
diff --git a/tests/profiles/snapshotService.test.ts b/tests/profiles/snapshotService.test.ts
new file mode 100644
index 0000000..21036ae
--- /dev/null
+++ b/tests/profiles/snapshotService.test.ts
@@ -0,0 +1,212 @@
+/**
+ * Tests for snapshotService: takeSnapshot and restoreSnapshotAsSwitch.
+ * PRD §8 (principle 5 — snapshot before destructive), §9.2, CONTRACTS §3.
+ *
+ * Golden rule: never assert NotImplementedError is thrown.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { takeSnapshot, restoreSnapshotAsSwitch } from '@/services/profiles/snapshotService';
+import { getSnapshot } from '@/services/storage/profileRepository';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function grantedTab(
+ url: string,
+ ls: Record = {},
+ ss: Record = {},
+) {
+ control.grantOrigin(new URL(url).origin + '/*');
+ return control.addTab({ url, localStorage: ls, sessionStorage: ss });
+}
+
+function seedOriginCookies(domain: string, pairs: Array<[string, string]>) {
+ control.seedCookies(pairs.map(([name, value]) => ({ name, value, domain })));
+}
+
+// ---------------------------------------------------------------------------
+// takeSnapshot — shape
+// ---------------------------------------------------------------------------
+
+describe('takeSnapshot — shape guarantees', () => {
+ it('returns a Snapshot with a unique string id', async () => {
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ expect(typeof snap.id).toBe('string');
+ expect(snap.id.length).toBeGreaterThan(0);
+ });
+
+ it('ids are unique across two snapshots', async () => {
+ const tab = grantedTab('https://example.com/');
+ const a = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ const b = await takeSnapshot('https://example.com', tab.id, 'pre-clear');
+ expect(a.id).not.toBe(b.id);
+ });
+
+ it('sets createdAt to an ISO 8601 timestamp', async () => {
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ expect(snap.createdAt).toMatch(/^\d{4}-\d{2}-\d{2}T/);
+ expect(Number.isNaN(new Date(snap.createdAt).getTime())).toBe(false);
+ });
+
+ it('records the supplied reason', async () => {
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ expect(snap.reason).toBe('pre-switch');
+ });
+
+ it('records the active origin', async () => {
+ const tab = grantedTab('https://staging.example.com/');
+ const snap = await takeSnapshot('https://staging.example.com', tab.id, 'pre-switch');
+ expect(snap.origin).toBe('https://staging.example.com');
+ });
+
+ it('domainScope is an array containing at least the origin', async () => {
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ expect(Array.isArray(snap.domainScope)).toBe(true);
+ expect(snap.domainScope).toContain('https://example.com');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// takeSnapshot — captures current state
+// ---------------------------------------------------------------------------
+
+describe('takeSnapshot — captures current state', () => {
+ it('captures cookies present for the origin', async () => {
+ seedOriginCookies('example.com', [['sess', 'abc'], ['pref', 'dark']]);
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ const names = snap.cookies.map((c) => c.name);
+ expect(names).toContain('sess');
+ expect(names).toContain('pref');
+ });
+
+ it('captures localStorage from the active tab', async () => {
+ const tab = grantedTab('https://example.com/', { token: 'tok1', lang: 'en' });
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ expect(snap.localStorage['token']).toBe('tok1');
+ expect(snap.localStorage['lang']).toBe('en');
+ });
+
+ it('captures sessionStorage from the active tab', async () => {
+ const tab = grantedTab('https://example.com/', {}, { csrf: 'csrf-snap' });
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ expect(snap.sessionStorage['csrf']).toBe('csrf-snap');
+ });
+
+ it('empty tab gives empty maps (not undefined)', async () => {
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ expect(snap.localStorage).toEqual({});
+ expect(snap.sessionStorage).toEqual({});
+ });
+});
+
+// ---------------------------------------------------------------------------
+// takeSnapshot — persisted to repository (PRD §8 principle 5)
+// ---------------------------------------------------------------------------
+
+describe('takeSnapshot — persists to profileRepository', () => {
+ it('snapshot is retrievable from storage by id after takeSnapshot', async () => {
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ const retrieved = await getSnapshot(snap.id);
+ expect(retrieved).toBeDefined();
+ expect(retrieved!.id).toBe(snap.id);
+ });
+
+ it('persisted snapshot has same cookies as returned snapshot', async () => {
+ seedOriginCookies('example.com', [['persisted_cookie', 'pval']]);
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ const retrieved = await getSnapshot(snap.id);
+ const names = retrieved!.cookies.map((c) => c.name);
+ expect(names).toContain('persisted_cookie');
+ });
+
+ it('persisted snapshot has same localStorage as returned snapshot', async () => {
+ const tab = grantedTab('https://example.com/', { persist_key: 'persist_val' });
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ const retrieved = await getSnapshot(snap.id);
+ expect(retrieved!.localStorage['persist_key']).toBe('persist_val');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// restoreSnapshotAsSwitch — returns SwitchResult
+// ---------------------------------------------------------------------------
+
+describe('restoreSnapshotAsSwitch — returns SwitchResult', () => {
+ it('returns an object with profileId, snapshotId, results, and succeeded fields', async () => {
+ const tab = grantedTab('https://example.com/');
+ seedOriginCookies('example.com', [['s', 'v']]);
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ const result = await restoreSnapshotAsSwitch(snap.id, tab.id);
+ expect(result).toHaveProperty('snapshotId');
+ expect(result).toHaveProperty('results');
+ expect(result).toHaveProperty('succeeded');
+ expect(Array.isArray(result.results)).toBe(true);
+ });
+
+ it('succeeded is true when no store failed', async () => {
+ const tab = grantedTab('https://example.com/', { k: 'v' });
+ seedOriginCookies('example.com', [['s', 'v']]);
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ const result = await restoreSnapshotAsSwitch(snap.id, tab.id);
+ expect(result.succeeded).toBe(true);
+ });
+
+ it('restores cookies from the snapshot back to the cookie store', async () => {
+ seedOriginCookies('example.com', [['original_cookie', 'original_val']]);
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+
+ // Simulate state change after snapshot.
+ control.reset();
+ control.grantOrigin('https://example.com/*');
+ const tab2 = control.addTab({ url: 'https://example.com/', id: tab.id });
+
+ await restoreSnapshotAsSwitch(snap.id, tab2.id);
+ const stored = control.getCookies().filter((c) => c.domain === 'example.com');
+ expect(stored.some((c) => c.name === 'original_cookie')).toBe(true);
+ });
+
+ it('restores localStorage from the snapshot into the tab', async () => {
+ const tab = grantedTab('https://example.com/', { restore_key: 'restore_val' });
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+
+ // Wipe the tab's storage.
+ await chrome.scripting.executeScript({
+ target: { tabId: tab.id },
+ func: () => { window.localStorage.clear(); },
+ });
+
+ await restoreSnapshotAsSwitch(snap.id, tab.id);
+ const finalTab = control.getTab(tab.id)!;
+ expect(finalTab.localStorage['restore_key']).toBe('restore_val');
+ });
+
+ it('rejects with an error for a non-existent snapshotId', async () => {
+ const tab = grantedTab('https://example.com/');
+ await expect(
+ restoreSnapshotAsSwitch('does-not-exist', tab.id),
+ ).rejects.toThrow();
+ });
+
+ it('results array has at least one StoreResult entry', async () => {
+ const tab = grantedTab('https://example.com/');
+ const snap = await takeSnapshot('https://example.com', tab.id, 'pre-switch');
+ const result = await restoreSnapshotAsSwitch(snap.id, tab.id);
+ expect(result.results.length).toBeGreaterThan(0);
+ for (const r of result.results) {
+ expect(r).toHaveProperty('store');
+ expect(r).toHaveProperty('status');
+ }
+ });
+});
diff --git a/tests/profiles/switchEngine.test.ts b/tests/profiles/switchEngine.test.ts
new file mode 100644
index 0000000..1cf3844
--- /dev/null
+++ b/tests/profiles/switchEngine.test.ts
@@ -0,0 +1,441 @@
+/**
+ * Tests for switchEngine: switchToProfile, restoreAdditive, findConflictingTabs.
+ * PRD §9.2, §8 (principle 5), §13.6; CONTRACTS §3.
+ *
+ * The transaction-like sequence contract (CONTRACTS §3):
+ * 1. Snapshot taken & persisted FIRST (exists even if a later step fails).
+ * 2. Current state cleared.
+ * 3. Profile applied.
+ * 4. Tab reloaded (chrome.tabs.reload called after apply).
+ * 5. SwitchResult.results has one StoreResult per store; succeeded=false iff
+ * any store failed; snapshotId set.
+ *
+ * Golden rule: never assert NotImplementedError is thrown.
+ */
+
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import { switchToProfile, restoreAdditive, findConflictingTabs } from '@/services/profiles/switchEngine';
+import { getSnapshot, saveProfile, getProfile } from '@/services/storage/profileRepository';
+import { makeProfile, makeCookie } from '../harness/factories';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function grantedTab(
+ url: string,
+ ls: Record = {},
+ ss: Record = {},
+) {
+ control.grantOrigin(new URL(url).origin + '/*');
+ return control.addTab({ url, localStorage: ls, sessionStorage: ss });
+}
+
+function seedCookies(domain: string, pairs: Array<[string, string]>) {
+ control.seedCookies(pairs.map(([name, value]) => ({ name, value, domain })));
+}
+
+/** Persist a profile into the repository so switchToProfile can load it. */
+async function persistProfile(over: Partial[0]> = {}) {
+ const p = makeProfile(over);
+ await saveProfile(p);
+ return p;
+}
+
+// ---------------------------------------------------------------------------
+// switchToProfile — SwitchResult shape
+// ---------------------------------------------------------------------------
+
+describe('switchToProfile — SwitchResult shape (CONTRACTS §3)', () => {
+ it('returns a SwitchResult with profileId, snapshotId, results, succeeded', async () => {
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ cookies: [makeCookie({ domain: 'example.com' })],
+ localStorage: { tok: 'v' },
+ sessionStorage: {},
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ expect(result).toHaveProperty('profileId', profile.id);
+ expect(result).toHaveProperty('snapshotId');
+ expect(typeof result.snapshotId).toBe('string');
+ expect(result.snapshotId.length).toBeGreaterThan(0);
+ expect(result).toHaveProperty('results');
+ expect(Array.isArray(result.results)).toBe(true);
+ expect(result).toHaveProperty('succeeded');
+ });
+
+ it('results has one StoreResult per store with a valid status', async () => {
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ const validStatuses = new Set(['applied', 'cleared', 'skipped', 'failed', 'not-captured']);
+ for (const r of result.results) {
+ expect(typeof r.store).toBe('string');
+ expect(validStatuses.has(r.status)).toBe(true);
+ }
+ });
+
+ it('succeeded is true when all stores applied without failure', async () => {
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ cookies: [makeCookie({ domain: 'example.com' })],
+ localStorage: { t: 'v' },
+ sessionStorage: {},
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ expect(result.succeeded).toBe(true);
+ const failedStores = result.results.filter((r) => r.status === 'failed');
+ expect(failedStores).toHaveLength(0);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// switchToProfile — Step 1: snapshot persisted FIRST
+// ---------------------------------------------------------------------------
+
+describe('switchToProfile — step 1: snapshot persisted before any mutation (CONTRACTS §3)', () => {
+ it('snapshotId returned by switchToProfile points to a persisted Snapshot', async () => {
+ const tab = grantedTab('https://example.com/', { pre_key: 'pre_val' });
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ const snap = await getSnapshot(result.snapshotId);
+ expect(snap).toBeDefined();
+ expect(snap!.id).toBe(result.snapshotId);
+ });
+
+ it('snapshot captures pre-switch localStorage before it is cleared', async () => {
+ const tab = grantedTab('https://example.com/', { pre_key: 'pre_val' });
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ localStorage: { post_key: 'post_val' },
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ const snap = await getSnapshot(result.snapshotId);
+ // The snapshot must contain the BEFORE state.
+ expect(snap!.localStorage['pre_key']).toBe('pre_val');
+ });
+
+ it('snapshot captures pre-switch cookies before they are replaced', async () => {
+ seedCookies('example.com', [['old_session', 'old_val']]);
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ cookies: [makeCookie({ name: 'new_session', value: 'new_val', domain: 'example.com' })],
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ const snap = await getSnapshot(result.snapshotId);
+ const names = snap!.cookies.map((c) => c.name);
+ expect(names).toContain('old_session');
+ });
+
+ it('snapshot is persisted even if a store apply step throws (partial failure recovery)', async () => {
+ // We cannot force a partial failure from outside without production seams.
+ // What we CAN assert: after any completed switch, a snapshot always exists.
+ const tab = grantedTab('https://example.com/', { key: 'val' });
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ // If switchToProfile returns at all, a snapshot must be persisted.
+ const snap = await getSnapshot(result.snapshotId);
+ expect(snap).toBeDefined();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// switchToProfile — Step 2+3: clears then applies
+// ---------------------------------------------------------------------------
+
+describe('switchToProfile — step 2+3: clear current state then apply profile', () => {
+ it('old cookies for the site are replaced by profile cookies', async () => {
+ seedCookies('example.com', [['old_cookie', 'old_val']]);
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ cookies: [makeCookie({ name: 'new_cookie', value: 'new_val', domain: 'example.com' })],
+ });
+ await switchToProfile(profile.id, tab.id);
+ const cookies = control.getCookies().filter((c) => c.domain === 'example.com');
+ expect(cookies.some((c) => c.name === 'new_cookie')).toBe(true);
+ // Old cookie should be gone (cleared before apply).
+ expect(cookies.some((c) => c.name === 'old_cookie')).toBe(false);
+ });
+
+ it('old localStorage is replaced by profile localStorage', async () => {
+ const tab = grantedTab('https://example.com/', { old_key: 'old_val' });
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ localStorage: { new_key: 'new_val' },
+ sessionStorage: {},
+ });
+ await switchToProfile(profile.id, tab.id);
+ const finalTab = control.getTab(tab.id)!;
+ expect(finalTab.localStorage['new_key']).toBe('new_val');
+ expect(finalTab.localStorage['old_key']).toBeUndefined();
+ });
+
+ it('profile with empty localStorage leaves the tab with empty localStorage', async () => {
+ const tab = grantedTab('https://example.com/', { will_be_cleared: '1' });
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ localStorage: {},
+ sessionStorage: {},
+ });
+ await switchToProfile(profile.id, tab.id);
+ const finalTab = control.getTab(tab.id)!;
+ expect(Object.keys(finalTab.localStorage)).toHaveLength(0);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// switchToProfile — Step 4: tab reloaded after apply
+// ---------------------------------------------------------------------------
+
+describe('switchToProfile — step 4: chrome.tabs.reload called after apply', () => {
+ it('calls chrome.tabs.reload with the target tab id', async () => {
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ // tabs.reload is a vi.fn() — it was cleared by control.reset(); track new calls.
+ const reloadSpy = vi.spyOn(chrome.tabs, 'reload');
+ await switchToProfile(profile.id, tab.id);
+ expect(reloadSpy).toHaveBeenCalled();
+ const callArgs = reloadSpy.mock.calls;
+ const calledWithTab = callArgs.some(([id]) => id === tab.id);
+ expect(calledWithTab).toBe(true);
+ });
+
+ it('reload happens AFTER apply (localStorage is set before reload fires)', async () => {
+ const order: string[] = [];
+ const tab = grantedTab('https://example.com/');
+ // We can observe: after switchToProfile completes, the tab has the new state
+ // AND reload was called. Verifying apply-then-reload ordering.
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ localStorage: { applied_first: 'yes' },
+ sessionStorage: {},
+ });
+ const reloadSpy = vi.spyOn(chrome.tabs, 'reload').mockImplementation(async (tabId) => {
+ // At the moment reload fires, applied state must already be in the tab.
+ const t = control.getTab(tabId as number);
+ if (t && t.localStorage['applied_first'] === 'yes') {
+ order.push('apply_then_reload');
+ }
+ return undefined;
+ });
+ await switchToProfile(profile.id, tab.id);
+ expect(order).toContain('apply_then_reload');
+ reloadSpy.mockRestore();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// switchToProfile — IndexedDB and non-active-origin web storage disclosure
+// ---------------------------------------------------------------------------
+
+describe('switchToProfile — store disclosures (CONTRACTS §3 / §13.6)', () => {
+ it('results includes an indexedDB entry with not-captured status', async () => {
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ const idbResult = result.results.find((r) => r.store === 'indexedDB');
+ expect(idbResult).toBeDefined();
+ expect(idbResult!.status).toBe('not-captured');
+ });
+
+ it('multi-domain profile: web storage for non-active origin is not-captured (never silently dropped)', async () => {
+ const tab = grantedTab('https://app.example.com/');
+ control.grantOrigin('https://auth.example.com/*');
+ const profile = await persistProfile({
+ origin: 'https://app.example.com',
+ domainScope: ['https://app.example.com', 'https://auth.example.com'],
+ cookies: [makeCookie({ domain: 'app.example.com' })],
+ localStorage: { app_token: 'at' },
+ sessionStorage: {},
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ // The result for non-active-origin web storage must be reported.
+ const webStorageResults = result.results.filter(
+ (r) => r.store === 'localStorage' || r.store === 'sessionStorage',
+ );
+ // At minimum there must be coverage: applied for active origin, not-captured/skipped for others.
+ expect(webStorageResults.length).toBeGreaterThan(0);
+ // None of the web-storage results should be silently 'cleared' without acknowledgement.
+ const silentDrop = webStorageResults.every((r) => r.status === 'cleared');
+ expect(silentDrop).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// switchToProfile — partial store failure scenario
+// ---------------------------------------------------------------------------
+
+describe('switchToProfile — partial failure: snapshot persisted, succeeded=false', () => {
+ /**
+ * We cannot inject a store failure from outside without a production seam.
+ * The test documents the *invariant*: when succeeded=false, snapshotId must be set.
+ * When a correct implementation is in place and a failure path is triggered
+ * (e.g. cookie set fails), this test will validate the invariant.
+ *
+ * For now: if switchToProfile resolves at all (even failure path), snapshotId
+ * must be non-empty.
+ */
+ it('when the switch completes, snapshotId is always a non-empty string', async () => {
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ expect(typeof result.snapshotId).toBe('string');
+ expect(result.snapshotId.length).toBeGreaterThan(0);
+ });
+
+ it('succeeded is false iff at least one store result has status=failed', async () => {
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await switchToProfile(profile.id, tab.id);
+ const hasFailure = result.results.some((r) => r.status === 'failed');
+ if (hasFailure) {
+ expect(result.succeeded).toBe(false);
+ } else {
+ expect(result.succeeded).toBe(true);
+ }
+ });
+});
+
+// ---------------------------------------------------------------------------
+// restoreAdditive — applies without clearing
+// ---------------------------------------------------------------------------
+
+describe('restoreAdditive — applies without clearing (CONTRACTS §3 / PRD §9.2)', () => {
+ it('returns a SwitchResult', async () => {
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ });
+ const result = await restoreAdditive(profile.id, tab.id);
+ expect(result).toHaveProperty('results');
+ expect(result).toHaveProperty('succeeded');
+ });
+
+ it('does NOT remove existing cookies before applying profile cookies', async () => {
+ seedCookies('example.com', [['existing_cookie', 'existing_val']]);
+ const tab = grantedTab('https://example.com/');
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ cookies: [makeCookie({ name: 'new_cookie', value: 'new_val', domain: 'example.com' })],
+ });
+ await restoreAdditive(profile.id, tab.id);
+ const cookies = control.getCookies().filter((c) => c.domain === 'example.com');
+ // Existing cookie must survive (additive, not clear-then-apply).
+ expect(cookies.some((c) => c.name === 'existing_cookie')).toBe(true);
+ // Profile cookie must be added.
+ expect(cookies.some((c) => c.name === 'new_cookie')).toBe(true);
+ });
+
+ it('does NOT wipe existing localStorage before applying profile localStorage', async () => {
+ const tab = grantedTab('https://example.com/', { keep_me: 'keep_val' });
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ localStorage: { profile_key: 'profile_val' },
+ sessionStorage: {},
+ });
+ await restoreAdditive(profile.id, tab.id);
+ const finalTab = control.getTab(tab.id)!;
+ expect(finalTab.localStorage['keep_me']).toBe('keep_val');
+ expect(finalTab.localStorage['profile_key']).toBe('profile_val');
+ });
+
+ it('profile key overwrites a conflicting existing key (merge semantics)', async () => {
+ const tab = grantedTab('https://example.com/', { conflict: 'old_val' });
+ const profile = await persistProfile({
+ origin: 'https://example.com',
+ domainScope: ['https://example.com'],
+ localStorage: { conflict: 'new_val' },
+ sessionStorage: {},
+ });
+ await restoreAdditive(profile.id, tab.id);
+ const finalTab = control.getTab(tab.id)!;
+ expect(finalTab.localStorage['conflict']).toBe('new_val');
+ });
+
+ it('rejects for a profile id that does not exist', async () => {
+ const tab = grantedTab('https://example.com/');
+ await expect(restoreAdditive('ghost-id', tab.id)).rejects.toThrow();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// findConflictingTabs
+// ---------------------------------------------------------------------------
+
+describe('findConflictingTabs', () => {
+ it('returns an empty array when no other same-origin tabs are open', async () => {
+ const tab = grantedTab('https://example.com/');
+ const ids = await findConflictingTabs('https://example.com', tab.id);
+ expect(Array.isArray(ids)).toBe(true);
+ expect(ids).toHaveLength(0);
+ });
+
+ it('returns ids of other open tabs for the same origin', async () => {
+ const active = grantedTab('https://example.com/page1');
+ const other1 = control.addTab({ url: 'https://example.com/page2', active: false });
+ const other2 = control.addTab({ url: 'https://example.com/page3', active: false });
+ const ids = await findConflictingTabs('https://example.com', active.id);
+ expect(ids).toContain(other1.id);
+ expect(ids).toContain(other2.id);
+ // Must NOT include the active tab itself.
+ expect(ids).not.toContain(active.id);
+ });
+
+ it('does not include tabs from a different origin', async () => {
+ const active = grantedTab('https://example.com/');
+ const otherOrigin = control.addTab({ url: 'https://other.com/page', active: false });
+ const ids = await findConflictingTabs('https://example.com', active.id);
+ expect(ids).not.toContain(otherOrigin.id);
+ });
+
+ it('does not include the active tab id in the conflict list', async () => {
+ const tab1 = grantedTab('https://example.com/a');
+ control.addTab({ url: 'https://example.com/b', active: false });
+ const ids = await findConflictingTabs('https://example.com', tab1.id);
+ expect(ids).not.toContain(tab1.id);
+ });
+
+ it('returns ids for tabs on subpaths of the same origin', async () => {
+ const active = grantedTab('https://example.com/');
+ const sub = control.addTab({ url: 'https://example.com/deep/path?q=1', active: false });
+ const ids = await findConflictingTabs('https://example.com', active.id);
+ expect(ids).toContain(sub.id);
+ });
+});
diff --git a/tests/profiles/webStorageCapture.test.ts b/tests/profiles/webStorageCapture.test.ts
new file mode 100644
index 0000000..3186a0e
--- /dev/null
+++ b/tests/profiles/webStorageCapture.test.ts
@@ -0,0 +1,196 @@
+/**
+ * Tests for captureWebStorage / applyWebStorage / clearWebStorage
+ * (PRD §9.2, §9.6, CONTRACTS §3).
+ *
+ * The functions inject page-context scripts via chrome.scripting.executeScript.
+ * All tests use the fakeChrome harness whose scripting.executeScript actually
+ * executes the injected function against the tab's in-memory web storage.
+ *
+ * Golden rule: never assert NotImplementedError is thrown.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+import {
+ captureWebStorage,
+ applyWebStorage,
+ clearWebStorage,
+} from '@/services/capture/webStorageCapture';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function grantedTab(url: string, ls: Record = {}, ss: Record = {}) {
+ control.grantOrigin(new URL(url).origin + '/*');
+ return control.addTab({ url, localStorage: ls, sessionStorage: ss });
+}
+
+// ---------------------------------------------------------------------------
+// captureWebStorage
+// ---------------------------------------------------------------------------
+
+describe('captureWebStorage — basic capture', () => {
+ it('returns an object with localStorage and sessionStorage keys', async () => {
+ const tab = grantedTab('https://example.com/', { a: '1' }, { b: '2' });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap).toHaveProperty('localStorage');
+ expect(snap).toHaveProperty('sessionStorage');
+ });
+
+ it('captures localStorage key-value pairs from the tab', async () => {
+ const tab = grantedTab('https://example.com/', { token: 'abc', user: 'alice' });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage).toEqual({ token: 'abc', user: 'alice' });
+ });
+
+ it('captures sessionStorage key-value pairs from the tab', async () => {
+ const tab = grantedTab('https://example.com/', {}, { csrf: 'xyz789' });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.sessionStorage).toEqual({ csrf: 'xyz789' });
+ });
+
+ it('captures both stores together without mixing them', async () => {
+ const tab = grantedTab(
+ 'https://example.com/',
+ { ls1: 'lsval' },
+ { ss1: 'ssval' },
+ );
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage).toEqual({ ls1: 'lsval' });
+ expect(snap.sessionStorage).toEqual({ ss1: 'ssval' });
+ });
+
+ it('returns empty objects for a tab with no web storage', async () => {
+ const tab = grantedTab('https://example.com/');
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage).toEqual({});
+ expect(snap.sessionStorage).toEqual({});
+ });
+
+ it('requires host permission — throws without a granted origin', async () => {
+ // Deliberately do NOT grant.
+ control.addTab({ url: 'https://no-grant.com/', id: 50 });
+ await expect(captureWebStorage(50)).rejects.toThrow();
+ });
+});
+
+describe('captureWebStorage — round-trip with various value types', () => {
+ it('preserves values with special characters', async () => {
+ const tab = grantedTab('https://example.com/', {
+ json: '{"a":1}',
+ url: 'https://sub.example.com/path?q=1&r=2',
+ });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage['json']).toBe('{"a":1}');
+ expect(snap.localStorage['url']).toBe('https://sub.example.com/path?q=1&r=2');
+ });
+
+ it('preserves empty-string values', async () => {
+ const tab = grantedTab('https://example.com/', { emptyKey: '' });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage['emptyKey']).toBe('');
+ });
+
+ it('preserves keys with dots and slashes', async () => {
+ const tab = grantedTab('https://example.com/', { 'my.key/1': 'val' });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage['my.key/1']).toBe('val');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// applyWebStorage
+// ---------------------------------------------------------------------------
+
+describe('applyWebStorage', () => {
+ it('writes localStorage entries into the tab', async () => {
+ const tab = grantedTab('https://example.com/');
+ await applyWebStorage(tab.id, { localStorage: { tok: 'applied' }, sessionStorage: {} });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage['tok']).toBe('applied');
+ });
+
+ it('writes sessionStorage entries into the tab', async () => {
+ const tab = grantedTab('https://example.com/');
+ await applyWebStorage(tab.id, { localStorage: {}, sessionStorage: { csrf: 'c1' } });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.sessionStorage['csrf']).toBe('c1');
+ });
+
+ it('applies both stores in one call', async () => {
+ const tab = grantedTab('https://example.com/');
+ await applyWebStorage(tab.id, {
+ localStorage: { ls: 'lv' },
+ sessionStorage: { ss: 'sv' },
+ });
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage['ls']).toBe('lv');
+ expect(snap.sessionStorage['ss']).toBe('sv');
+ });
+
+ it('full round-trip: capture → apply to blank tab → re-capture gives same data', async () => {
+ const src = grantedTab('https://example.com/', { k: 'v1' }, { m: 'n2' });
+ const snap = await captureWebStorage(src.id);
+
+ const dst = grantedTab('https://example.com/');
+ await applyWebStorage(dst.id, snap);
+ const snap2 = await captureWebStorage(dst.id);
+ expect(snap2.localStorage).toEqual(snap.localStorage);
+ expect(snap2.sessionStorage).toEqual(snap.sessionStorage);
+ });
+
+ it('does not erase existing keys not present in the applied snapshot (additive, not replace)', async () => {
+ const tab = grantedTab('https://example.com/', { pre: 'existing' });
+ await applyWebStorage(tab.id, { localStorage: { tok: 'new' }, sessionStorage: {} });
+ const snap = await captureWebStorage(tab.id);
+ // Apply is additive (merge), not a full replace; pre-existing key survives.
+ expect(snap.localStorage['pre']).toBe('existing');
+ expect(snap.localStorage['tok']).toBe('new');
+ });
+
+ it('requires host permission — throws without a granted origin', async () => {
+ control.addTab({ url: 'https://no-grant.com/', id: 51 });
+ await expect(
+ applyWebStorage(51, { localStorage: { x: '1' }, sessionStorage: {} }),
+ ).rejects.toThrow();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// clearWebStorage
+// ---------------------------------------------------------------------------
+
+describe('clearWebStorage', () => {
+ it('removes all localStorage entries from the tab', async () => {
+ const tab = grantedTab('https://example.com/', { a: '1', b: '2' });
+ await clearWebStorage(tab.id);
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage).toEqual({});
+ });
+
+ it('removes all sessionStorage entries from the tab', async () => {
+ const tab = grantedTab('https://example.com/', {}, { x: 'y' });
+ await clearWebStorage(tab.id);
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.sessionStorage).toEqual({});
+ });
+
+ it('clears both stores together', async () => {
+ const tab = grantedTab('https://example.com/', { ls: '1' }, { ss: '2' });
+ await clearWebStorage(tab.id);
+ const snap = await captureWebStorage(tab.id);
+ expect(snap.localStorage).toEqual({});
+ expect(snap.sessionStorage).toEqual({});
+ });
+
+ it('is idempotent — clearing an already-empty tab does not throw', async () => {
+ const tab = grantedTab('https://example.com/');
+ await expect(clearWebStorage(tab.id)).resolves.not.toThrow();
+ });
+
+ it('requires host permission — throws without a granted origin', async () => {
+ control.addTab({ url: 'https://no-grant.com/', id: 52 });
+ await expect(clearWebStorage(52)).rejects.toThrow();
+ });
+});
diff --git a/tests/sanity.test.ts b/tests/sanity.test.ts
new file mode 100644
index 0000000..63861fb
--- /dev/null
+++ b/tests/sanity.test.ts
@@ -0,0 +1,65 @@
+/**
+ * Sanity checks for the test harness itself + a sample green/red split.
+ * These prove the fake chrome API, IndexedDB, and module resolution all work
+ * before the real suites build on them.
+ */
+
+import { describe, it, expect } from 'vitest';
+import { control } from './harness/fakeChrome';
+import {
+ getSettings,
+ patchSettings,
+ DEFAULT_SETTINGS,
+} from '@/services/storage/settingsRepository';
+import { listCookies } from '@/services/cookies/cookieService';
+import { readPageStorage } from '@/services/capture/pageScript';
+import { NotImplementedError } from '@/lib/result';
+
+describe('harness: chrome.storage', () => {
+ it('round-trips and applies defaults (settingsRepository is implemented → green)', async () => {
+ expect(await getSettings()).toEqual(DEFAULT_SETTINGS);
+ const next = await patchSettings({ telemetryOptIn: true });
+ expect(next.telemetryOptIn).toBe(true);
+ expect((await getSettings()).telemetryOptIn).toBe(true);
+ });
+
+ it('isolates state between tests', async () => {
+ // telemetryOptIn from the previous test must not leak here.
+ expect((await getSettings()).telemetryOptIn).toBe(false);
+ });
+});
+
+describe('harness: chrome.cookies', () => {
+ it('matches by domain and url', async () => {
+ control.seedCookies([
+ { name: 'a', domain: 'example.com' },
+ { name: 'b', domain: '.example.com' },
+ { name: 'c', domain: 'other.com' },
+ ]);
+ const all = await chrome.cookies.getAll({ domain: 'example.com' });
+ expect(all.map((c) => c.name).sort()).toEqual(['a', 'b']);
+ });
+});
+
+describe('harness: chrome.scripting executes the injected fn against tab storage', () => {
+ it('reads the target tab web storage', async () => {
+ const tab = control.addTab({
+ url: 'https://example.com/app',
+ localStorage: { token: 'xyz' },
+ sessionStorage: { tmp: '1' },
+ });
+ control.grantOrigin('https://example.com/*');
+ const [{ result }] = await chrome.scripting.executeScript({
+ target: { tabId: tab.id },
+ func: readPageStorage,
+ });
+ expect(result).toEqual({ localStorage: { token: 'xyz' }, sessionStorage: { tmp: '1' } });
+ });
+});
+
+describe('red-but-clean: unimplemented service reaches real code', () => {
+ it('listCookies throws NotImplementedError (not an infra error)', async () => {
+ control.grantOrigin('https://example.com/*');
+ await expect(listCookies('https://example.com')).rejects.toBeInstanceOf(NotImplementedError);
+ });
+});
diff --git a/tests/setup.ts b/tests/setup.ts
new file mode 100644
index 0000000..2a88b62
--- /dev/null
+++ b/tests/setup.ts
@@ -0,0 +1,25 @@
+/**
+ * Global test setup: installs the fake chrome API, an in-memory IndexedDB, and
+ * jest-dom matchers, and resets all shared state before every test so tests are
+ * fully isolated.
+ */
+
+import 'fake-indexeddb/auto';
+import '@testing-library/jest-dom/vitest';
+import { afterEach, beforeEach, vi } from 'vitest';
+import { cleanup } from '@testing-library/react';
+import { fakeChrome, control } from './harness/fakeChrome';
+import { IDBFactory } from 'fake-indexeddb';
+
+// Expose the fake chrome API as the global the production code uses.
+vi.stubGlobal('chrome', fakeChrome);
+
+beforeEach(() => {
+ control.reset();
+ // Fresh IndexedDB per test.
+ globalThis.indexedDB = new IDBFactory();
+});
+
+afterEach(() => {
+ cleanup();
+});
diff --git a/tests/storage/db.test.ts b/tests/storage/db.test.ts
new file mode 100644
index 0000000..1e546db
--- /dev/null
+++ b/tests/storage/db.test.ts
@@ -0,0 +1,276 @@
+/**
+ * Tests for src/services/storage/db.ts (§13.4, CONTRACTS §11).
+ *
+ * Contract:
+ * - openDb() creates the object stores (profiles, snapshots, projects).
+ * - putBlob / getBlob round-trip an ArrayBuffer.
+ * - deleteBlob removes the entry.
+ * - listKeys lists all keys in a store.
+ * - Missing key → getBlob returns undefined.
+ *
+ * The global `indexedDB` is a fresh fake-indexeddb instance per test
+ * (installed by tests/setup.ts beforeEach).
+ */
+
+import { describe, it, expect } from 'vitest';
+import {
+ openDb,
+ getBlob,
+ putBlob,
+ deleteBlob,
+ listKeys,
+ DB_NAME,
+ DB_VERSION,
+ STORE_PROFILES,
+ STORE_SNAPSHOTS,
+ STORE_PROJECTS,
+} from '@/services/storage/db';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+function makeBuffer(content: string): ArrayBuffer {
+ return new TextEncoder().encode(content).buffer;
+}
+
+function bufferToString(buf: ArrayBuffer): string {
+ return new TextDecoder().decode(buf);
+}
+
+// ---------------------------------------------------------------------------
+// openDb
+// ---------------------------------------------------------------------------
+
+describe('db.openDb', () => {
+ it('returns an IDBDatabase instance', async () => {
+ const db = await openDb();
+ expect(db).toBeDefined();
+ // IDBDatabase has `name` and `version`
+ expect(db.name).toBe(DB_NAME);
+ expect(db.version).toBe(DB_VERSION);
+ db.close();
+ });
+
+ it('creates the profiles object store', async () => {
+ const db = await openDb();
+ expect(db.objectStoreNames.contains(STORE_PROFILES)).toBe(true);
+ db.close();
+ });
+
+ it('creates the snapshots object store', async () => {
+ const db = await openDb();
+ expect(db.objectStoreNames.contains(STORE_SNAPSHOTS)).toBe(true);
+ db.close();
+ });
+
+ it('creates the projects object store', async () => {
+ const db = await openDb();
+ expect(db.objectStoreNames.contains(STORE_PROJECTS)).toBe(true);
+ db.close();
+ });
+
+ it('can be called multiple times (returns an open db each time)', async () => {
+ const db1 = await openDb();
+ const db2 = await openDb();
+ expect(db1.name).toBe(DB_NAME);
+ expect(db2.name).toBe(DB_NAME);
+ db1.close();
+ db2.close();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// putBlob / getBlob round-trip
+// ---------------------------------------------------------------------------
+
+describe('db.putBlob / getBlob', () => {
+ it('round-trips an ArrayBuffer for a profile key', async () => {
+ const buf = makeBuffer('encrypted-profile-payload');
+ await putBlob(STORE_PROFILES, 'profile-1', buf);
+ const out = await getBlob(STORE_PROFILES, 'profile-1');
+
+ expect(out).toBeDefined();
+ expect(bufferToString(out!)).toBe('encrypted-profile-payload');
+ });
+
+ it('round-trips an ArrayBuffer for a snapshot key', async () => {
+ const buf = makeBuffer('snapshot-data');
+ await putBlob(STORE_SNAPSHOTS, 'snap-1', buf);
+ const out = await getBlob(STORE_SNAPSHOTS, 'snap-1');
+
+ expect(out).toBeDefined();
+ expect(bufferToString(out!)).toBe('snapshot-data');
+ });
+
+ it('round-trips an empty ArrayBuffer (zero bytes)', async () => {
+ const buf = new ArrayBuffer(0);
+ await putBlob(STORE_PROFILES, 'empty-key', buf);
+ const out = await getBlob(STORE_PROFILES, 'empty-key');
+
+ expect(out).toBeDefined();
+ expect(out!.byteLength).toBe(0);
+ });
+
+ it('round-trips binary data (not just text)', async () => {
+ const bytes = new Uint8Array([0x00, 0xff, 0x80, 0x42, 0x01]);
+ await putBlob(STORE_PROFILES, 'binary-key', bytes.buffer);
+ const out = await getBlob(STORE_PROFILES, 'binary-key');
+
+ expect(out).toBeDefined();
+ expect(new Uint8Array(out!)).toEqual(bytes);
+ });
+
+ it('overwrites an existing blob for the same key', async () => {
+ await putBlob(STORE_PROFILES, 'overwrite-me', makeBuffer('old'));
+ await putBlob(STORE_PROFILES, 'overwrite-me', makeBuffer('new'));
+
+ const out = await getBlob(STORE_PROFILES, 'overwrite-me');
+ expect(bufferToString(out!)).toBe('new');
+ });
+
+ it('stores blobs in different stores independently (same key, different stores)', async () => {
+ const profileBuf = makeBuffer('profile-data');
+ const snapshotBuf = makeBuffer('snapshot-data');
+
+ await putBlob(STORE_PROFILES, 'shared-key', profileBuf);
+ await putBlob(STORE_SNAPSHOTS, 'shared-key', snapshotBuf);
+
+ const profileOut = await getBlob(STORE_PROFILES, 'shared-key');
+ const snapOut = await getBlob(STORE_SNAPSHOTS, 'shared-key');
+
+ expect(bufferToString(profileOut!)).toBe('profile-data');
+ expect(bufferToString(snapOut!)).toBe('snapshot-data');
+ });
+
+ it('stores a large blob (simulates an encrypted profile)', async () => {
+ const largeBuf = new Uint8Array(50_000);
+ globalThis.crypto.getRandomValues(largeBuf);
+
+ await putBlob(STORE_PROFILES, 'large-key', largeBuf.buffer);
+ const out = await getBlob(STORE_PROFILES, 'large-key');
+
+ expect(out).toBeDefined();
+ expect(out!.byteLength).toBe(50_000);
+ expect(new Uint8Array(out!)).toEqual(largeBuf);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// getBlob: missing key
+// ---------------------------------------------------------------------------
+
+describe('db.getBlob: missing key', () => {
+ it('returns undefined for a key that was never written', async () => {
+ const out = await getBlob(STORE_PROFILES, 'nonexistent');
+ expect(out).toBeUndefined();
+ });
+
+ it('returns undefined for a key in an empty store', async () => {
+ const out = await getBlob(STORE_SNAPSHOTS, 'also-missing');
+ expect(out).toBeUndefined();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// deleteBlob
+// ---------------------------------------------------------------------------
+
+describe('db.deleteBlob', () => {
+ it('removes a previously written blob', async () => {
+ await putBlob(STORE_PROFILES, 'to-delete', makeBuffer('bye'));
+ await deleteBlob(STORE_PROFILES, 'to-delete');
+
+ const out = await getBlob(STORE_PROFILES, 'to-delete');
+ expect(out).toBeUndefined();
+ });
+
+ it('is a no-op for a key that does not exist (does not throw)', async () => {
+ await expect(deleteBlob(STORE_PROFILES, 'not-there')).resolves.toBeUndefined();
+ });
+
+ it('only deletes the specified key (sibling keys are untouched)', async () => {
+ await putBlob(STORE_PROFILES, 'keep-me', makeBuffer('keep'));
+ await putBlob(STORE_PROFILES, 'delete-me', makeBuffer('gone'));
+
+ await deleteBlob(STORE_PROFILES, 'delete-me');
+
+ expect(await getBlob(STORE_PROFILES, 'delete-me')).toBeUndefined();
+ expect(await getBlob(STORE_PROFILES, 'keep-me')).toBeDefined();
+ });
+
+ it('deletes from the correct store (blob in other store survives)', async () => {
+ await putBlob(STORE_PROFILES, 'cross-store', makeBuffer('profile'));
+ await putBlob(STORE_SNAPSHOTS, 'cross-store', makeBuffer('snapshot'));
+
+ await deleteBlob(STORE_PROFILES, 'cross-store');
+
+ expect(await getBlob(STORE_PROFILES, 'cross-store')).toBeUndefined();
+ expect(await getBlob(STORE_SNAPSHOTS, 'cross-store')).toBeDefined();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// listKeys
+// ---------------------------------------------------------------------------
+
+describe('db.listKeys', () => {
+ it('returns an empty array when the store is empty', async () => {
+ const keys = await listKeys(STORE_PROFILES);
+ expect(keys).toEqual([]);
+ });
+
+ it('returns all written keys', async () => {
+ await putBlob(STORE_PROFILES, 'a', makeBuffer('1'));
+ await putBlob(STORE_PROFILES, 'b', makeBuffer('2'));
+ await putBlob(STORE_PROFILES, 'c', makeBuffer('3'));
+
+ const keys = await listKeys(STORE_PROFILES);
+ expect(keys.sort()).toEqual(['a', 'b', 'c']);
+ });
+
+ it('does not include deleted keys', async () => {
+ await putBlob(STORE_PROFILES, 'x', makeBuffer('x'));
+ await putBlob(STORE_PROFILES, 'y', makeBuffer('y'));
+ await deleteBlob(STORE_PROFILES, 'x');
+
+ const keys = await listKeys(STORE_PROFILES);
+ expect(keys).toContain('y');
+ expect(keys).not.toContain('x');
+ });
+
+ it('lists keys per store independently', async () => {
+ await putBlob(STORE_PROFILES, 'prof-key', makeBuffer('p'));
+ await putBlob(STORE_SNAPSHOTS, 'snap-key', makeBuffer('s'));
+
+ const profileKeys = await listKeys(STORE_PROFILES);
+ const snapshotKeys = await listKeys(STORE_SNAPSHOTS);
+
+ expect(profileKeys).toContain('prof-key');
+ expect(profileKeys).not.toContain('snap-key');
+
+ expect(snapshotKeys).toContain('snap-key');
+ expect(snapshotKeys).not.toContain('prof-key');
+ });
+
+ it('returns a string[] (keys are strings)', async () => {
+ await putBlob(STORE_PROFILES, 'str-key-1', makeBuffer('data'));
+
+ const keys = await listKeys(STORE_PROFILES);
+ expect(Array.isArray(keys)).toBe(true);
+ for (const k of keys) {
+ expect(typeof k).toBe('string');
+ }
+ });
+
+ it('count matches number of distinct put blobs', async () => {
+ for (let i = 0; i < 5; i++) {
+ await putBlob(STORE_SNAPSHOTS, `snap-count-${i}`, makeBuffer(`data${i}`));
+ }
+ const keys = await listKeys(STORE_SNAPSHOTS);
+ // Filter to only the keys we just wrote (other tests in the same file
+ // get fresh IndexedDB per test, but just in case)
+ const ours = keys.filter((k) => k.startsWith('snap-count-'));
+ expect(ours).toHaveLength(5);
+ });
+});
diff --git a/tests/storage/profileRepository.test.ts b/tests/storage/profileRepository.test.ts
new file mode 100644
index 0000000..6e7484c
--- /dev/null
+++ b/tests/storage/profileRepository.test.ts
@@ -0,0 +1,500 @@
+/**
+ * Tests for src/services/storage/profileRepository.ts (§13.4, §13.5, CONTRACTS §11).
+ *
+ * Contract (CONTRACTS.md §11):
+ * - saveProfile then getProfile round-trips a Profile.
+ * - The PERSISTED bytes contain NO plaintext cookie/localStorage values
+ * (encrypted at rest — inspected via the db layer).
+ * - sizeBytes tracked; estimateSizeBytes increases with payload.
+ * - listProfiles / deleteProfile.
+ * - Snapshots: saveSnapshot / getSnapshot / listSnapshots.
+ *
+ * Key-injection seam needed:
+ * profileRepository currently calls getOrCreateDataKey() internally.
+ * To test encryption-at-rest without depending on keyManager, the
+ * production module needs an injectable key seam, e.g.:
+ *
+ * export function _setKeyForTesting(key: CryptoKey): void
+ *
+ * or an optional parameter to saveProfile/getProfile:
+ *
+ * export async function saveProfile(profile, key?: CryptoKey): Promise
+ *
+ * Until such a seam exists, encryption-at-rest tests drive through the
+ * real keyManager (which must also be implemented for those tests to pass).
+ * Tests are written to tolerate the layering: they fail with NotImplementedError
+ * now and pass only when the full stack is implemented.
+ *
+ * NOTE: This test file intentionally exercises the full stack
+ * (profileRepository → db → keyManager → encryption) because that is the only
+ * way to verify the "encrypted at rest" property without a key-injection seam.
+ * See SEAMS section in the final report.
+ */
+
+import { describe, it, expect } from 'vitest';
+import {
+ saveProfile,
+ getProfile,
+ listProfiles,
+ deleteProfile,
+ saveSnapshot,
+ getSnapshot,
+ listSnapshots,
+ estimateSizeBytes,
+} from '@/services/storage/profileRepository';
+import { getBlob, listKeys, STORE_PROFILES, STORE_SNAPSHOTS } from '@/services/storage/db';
+import { makeProfile, makeSnapshot } from '../harness/factories';
+
+// ---------------------------------------------------------------------------
+// Helpers
+// ---------------------------------------------------------------------------
+
+/** Check whether a raw ArrayBuffer contains a given string as a UTF-8 subsequence. */
+function bufferContainsString(buf: ArrayBuffer, needle: string): boolean {
+ const bytes = new Uint8Array(buf);
+ const text = new TextDecoder().decode(bytes);
+ return text.includes(needle);
+}
+
+// ---------------------------------------------------------------------------
+// listProfiles (empty state)
+// ---------------------------------------------------------------------------
+
+describe('profileRepository.listProfiles', () => {
+ it('returns an empty array when no profiles have been saved', async () => {
+ const profiles = await listProfiles();
+ expect(profiles).toEqual([]);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// saveProfile / getProfile
+// ---------------------------------------------------------------------------
+
+describe('profileRepository.saveProfile / getProfile', () => {
+ it('round-trips a profile (getProfile returns the same shape as saveProfile received)', async () => {
+ const profile = makeProfile({ name: 'test-profile' });
+ await saveProfile(profile);
+
+ const retrieved = await getProfile(profile.id);
+ expect(retrieved).toBeDefined();
+ expect(retrieved!.id).toBe(profile.id);
+ expect(retrieved!.name).toBe(profile.name);
+ expect(retrieved!.origin).toBe(profile.origin);
+ });
+
+ it('round-trips all standard profile fields faithfully', async () => {
+ const profile = makeProfile({
+ name: 'admin / staging',
+ environment: 'staging',
+ tags: ['admin', 'qa'],
+ origin: 'https://example.com',
+ domainScope: ['https://example.com', 'https://api.example.com'],
+ cookies: [
+ {
+ name: 'session',
+ value: 'very-secret-session-token',
+ domain: 'example.com',
+ path: '/',
+ secure: true,
+ httpOnly: true,
+ sameSite: 'lax',
+ },
+ ],
+ localStorage: { token: 'bearer-secret-value', user: 'admin' },
+ sessionStorage: { tab_id: 'xyz' },
+ });
+
+ await saveProfile(profile);
+ const out = await getProfile(profile.id);
+
+ expect(out).toBeDefined();
+ expect(out!.cookies).toEqual(profile.cookies);
+ expect(out!.localStorage).toEqual(profile.localStorage);
+ expect(out!.sessionStorage).toEqual(profile.sessionStorage);
+ expect(out!.tags).toEqual(profile.tags);
+ expect(out!.environment).toBe(profile.environment);
+ expect(out!.domainScope).toEqual(profile.domainScope);
+ expect(out!.createdAt).toBe(profile.createdAt);
+ expect(out!.updatedAt).toBe(profile.updatedAt);
+ });
+
+ it('returns undefined for a profile id that was never saved', async () => {
+ const out = await getProfile('nonexistent-id');
+ expect(out).toBeUndefined();
+ });
+
+ it('can save and retrieve multiple profiles independently', async () => {
+ const p1 = makeProfile({ name: 'profile-A' });
+ const p2 = makeProfile({ name: 'profile-B' });
+
+ await saveProfile(p1);
+ await saveProfile(p2);
+
+ const out1 = await getProfile(p1.id);
+ const out2 = await getProfile(p2.id);
+
+ expect(out1!.name).toBe('profile-A');
+ expect(out2!.name).toBe('profile-B');
+ });
+
+ it('overwrites a profile when saved again with the same id', async () => {
+ const profile = makeProfile({ name: 'original' });
+ await saveProfile(profile);
+
+ const updated = { ...profile, name: 'updated', updatedAt: '2026-06-01T00:00:00.000Z' };
+ await saveProfile(updated);
+
+ const out = await getProfile(profile.id);
+ expect(out!.name).toBe('updated');
+ expect(out!.updatedAt).toBe('2026-06-01T00:00:00.000Z');
+ });
+
+ it('sizeBytes on the retrieved profile is a positive number', async () => {
+ const profile = makeProfile();
+ await saveProfile(profile);
+
+ const out = await getProfile(profile.id);
+ expect(out!.sizeBytes).toBeGreaterThan(0);
+ });
+
+ // -------------------------------------------------------------------------
+ // Encrypted at rest (CONTRACTS §11)
+ // -------------------------------------------------------------------------
+
+ it('persisted bytes in IndexedDB do NOT contain plaintext cookie values', async () => {
+ const sensitiveValue = 'super-secret-session-token-xyz';
+ const profile = makeProfile({
+ cookies: [
+ {
+ name: 'session',
+ value: sensitiveValue,
+ domain: 'example.com',
+ path: '/',
+ secure: true,
+ httpOnly: true,
+ sameSite: 'lax',
+ },
+ ],
+ });
+
+ await saveProfile(profile);
+
+ // Inspect the raw bytes in IndexedDB via the db layer
+ const rawBlob = await getBlob(STORE_PROFILES, profile.id);
+ expect(rawBlob).toBeDefined();
+
+ // The plaintext must NOT appear in the stored bytes
+ expect(bufferContainsString(rawBlob!, sensitiveValue)).toBe(false);
+ });
+
+ it('persisted bytes do NOT contain plaintext localStorage values', async () => {
+ const sensitiveToken = 'bearer-eyJhbGciOiJFZERTQSJ9-secret';
+ const profile = makeProfile({
+ localStorage: { authToken: sensitiveToken, userId: '42' },
+ });
+
+ await saveProfile(profile);
+
+ const rawBlob = await getBlob(STORE_PROFILES, profile.id);
+ expect(rawBlob).toBeDefined();
+ expect(bufferContainsString(rawBlob!, sensitiveToken)).toBe(false);
+ });
+
+ it('persisted bytes do NOT contain the profile name as plaintext (full blob is ciphertext)', async () => {
+ // The profile name is not a secret, but if any plaintext leaks it would
+ // mean the blob is not fully encrypted. A uniquely-identifiable name in
+ // plaintext storage would mean cookie/localStorage values would also leak.
+ const uniqueName = 'DO-NOT-STORE-PLAINTEXT-' + Math.random().toString(36);
+ const profile = makeProfile({ name: uniqueName });
+
+ await saveProfile(profile);
+
+ const rawBlob = await getBlob(STORE_PROFILES, profile.id);
+ expect(rawBlob).toBeDefined();
+ // If the entire blob is ciphertext, the name should not appear literally
+ expect(bufferContainsString(rawBlob!, uniqueName)).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// listProfiles (populated)
+// ---------------------------------------------------------------------------
+
+describe('profileRepository.listProfiles (populated)', () => {
+ it('returns all saved profiles', async () => {
+ const p1 = makeProfile({ name: 'list-test-1' });
+ const p2 = makeProfile({ name: 'list-test-2' });
+ const p3 = makeProfile({ name: 'list-test-3' });
+
+ await saveProfile(p1);
+ await saveProfile(p2);
+ await saveProfile(p3);
+
+ const list = await listProfiles();
+ const ids = list.map((p) => p.id).sort();
+ expect(ids).toEqual([p1.id, p2.id, p3.id].sort());
+ });
+
+ it('returns Profile objects (not raw blobs)', async () => {
+ const profile = makeProfile();
+ await saveProfile(profile);
+
+ const list = await listProfiles();
+ expect(list.length).toBeGreaterThan(0);
+ for (const p of list) {
+ expect(p).toHaveProperty('id');
+ expect(p).toHaveProperty('name');
+ expect(p).toHaveProperty('cookies');
+ expect(p).toHaveProperty('localStorage');
+ }
+ });
+});
+
+// ---------------------------------------------------------------------------
+// deleteProfile
+// ---------------------------------------------------------------------------
+
+describe('profileRepository.deleteProfile', () => {
+ it('removes the profile so getProfile returns undefined', async () => {
+ const profile = makeProfile();
+ await saveProfile(profile);
+ await deleteProfile(profile.id);
+
+ expect(await getProfile(profile.id)).toBeUndefined();
+ });
+
+ it('removes the profile from listProfiles', async () => {
+ const p1 = makeProfile();
+ const p2 = makeProfile();
+
+ await saveProfile(p1);
+ await saveProfile(p2);
+ await deleteProfile(p1.id);
+
+ const list = await listProfiles();
+ const ids = list.map((p) => p.id);
+ expect(ids).not.toContain(p1.id);
+ expect(ids).toContain(p2.id);
+ });
+
+ it('removes the blob from IndexedDB', async () => {
+ const profile = makeProfile();
+ await saveProfile(profile);
+ await deleteProfile(profile.id);
+
+ const rawBlob = await getBlob(STORE_PROFILES, profile.id);
+ expect(rawBlob).toBeUndefined();
+ });
+
+ it('is a no-op for an id that does not exist (does not throw)', async () => {
+ await expect(deleteProfile('not-a-real-id')).resolves.toBeUndefined();
+ });
+
+ it('only deletes the specified profile (sibling profiles untouched)', async () => {
+ const keep = makeProfile({ name: 'keep-me' });
+ const gone = makeProfile({ name: 'gone' });
+
+ await saveProfile(keep);
+ await saveProfile(gone);
+ await deleteProfile(gone.id);
+
+ expect(await getProfile(keep.id)).toBeDefined();
+ expect(await getProfile(gone.id)).toBeUndefined();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// estimateSizeBytes
+// ---------------------------------------------------------------------------
+
+describe('profileRepository.estimateSizeBytes', () => {
+ it('returns a positive number for a non-empty profile', () => {
+ const profile = makeProfile();
+ expect(estimateSizeBytes(profile)).toBeGreaterThan(0);
+ });
+
+ it('increases when localStorage has more data', () => {
+ const small = makeProfile({ localStorage: { k: 'v' } });
+ const large = makeProfile({
+ localStorage: Object.fromEntries(
+ Array.from({ length: 50 }, (_, i) => [`key_${i}`, 'x'.repeat(200)]),
+ ),
+ });
+
+ expect(estimateSizeBytes(large)).toBeGreaterThan(estimateSizeBytes(small));
+ });
+
+ it('increases when more cookies are present', () => {
+ const few = makeProfile({
+ cookies: [{ name: 'a', value: 'b', domain: 'x.com', path: '/', secure: false, httpOnly: false, sameSite: 'lax' }],
+ });
+ const many = makeProfile({
+ cookies: Array.from({ length: 20 }, (_, i) => ({
+ name: `cookie_${i}`,
+ value: 'a'.repeat(100),
+ domain: 'x.com',
+ path: '/',
+ secure: false,
+ httpOnly: false,
+ sameSite: 'lax' as const,
+ })),
+ });
+
+ expect(estimateSizeBytes(many)).toBeGreaterThan(estimateSizeBytes(few));
+ });
+
+ it('returns a number (not NaN, not Infinity)', () => {
+ const size = estimateSizeBytes(makeProfile());
+ expect(Number.isFinite(size)).toBe(true);
+ expect(Number.isNaN(size)).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Snapshots: saveSnapshot / getSnapshot / listSnapshots
+// ---------------------------------------------------------------------------
+
+describe('profileRepository.saveSnapshot / getSnapshot', () => {
+ it('round-trips a snapshot', async () => {
+ const snap = makeSnapshot({ reason: 'pre-switch' });
+ await saveSnapshot(snap);
+
+ const out = await getSnapshot(snap.id);
+ expect(out).toBeDefined();
+ expect(out!.id).toBe(snap.id);
+ expect(out!.origin).toBe(snap.origin);
+ expect(out!.reason).toBe(snap.reason);
+ });
+
+ it('round-trips all snapshot fields', async () => {
+ const snap = makeSnapshot({
+ origin: 'https://app.example.com',
+ domainScope: ['https://app.example.com'],
+ cookies: [
+ {
+ name: 'pre_switch_cookie',
+ value: 'pre-value',
+ domain: 'app.example.com',
+ path: '/',
+ secure: true,
+ httpOnly: true,
+ sameSite: 'strict',
+ },
+ ],
+ localStorage: { before: 'state' },
+ sessionStorage: { tab: 'data' },
+ reason: 'pre-switch',
+ });
+
+ await saveSnapshot(snap);
+ const out = await getSnapshot(snap.id);
+
+ expect(out!.cookies).toEqual(snap.cookies);
+ expect(out!.localStorage).toEqual(snap.localStorage);
+ expect(out!.sessionStorage).toEqual(snap.sessionStorage);
+ expect(out!.domainScope).toEqual(snap.domainScope);
+ });
+
+ it('returns undefined for a snapshot id that was never saved', async () => {
+ expect(await getSnapshot('not-a-real-snap')).toBeUndefined();
+ });
+
+ it('can save and retrieve multiple snapshots', async () => {
+ const s1 = makeSnapshot({ reason: 'pre-switch' });
+ const s2 = makeSnapshot({ reason: 'pre-clear' });
+
+ await saveSnapshot(s1);
+ await saveSnapshot(s2);
+
+ expect((await getSnapshot(s1.id))!.reason).toBe('pre-switch');
+ expect((await getSnapshot(s2.id))!.reason).toBe('pre-clear');
+ });
+
+ // Encrypted at rest for snapshots
+ it('persisted snapshot bytes do NOT contain plaintext cookie values', async () => {
+ const secretVal = 'snapshot-secret-cookie-value-abc';
+ const snap = makeSnapshot({
+ cookies: [
+ {
+ name: 'snap_session',
+ value: secretVal,
+ domain: 'example.com',
+ path: '/',
+ secure: true,
+ httpOnly: true,
+ sameSite: 'lax',
+ },
+ ],
+ });
+
+ await saveSnapshot(snap);
+
+ const rawBlob = await getBlob(STORE_SNAPSHOTS, snap.id);
+ expect(rawBlob).toBeDefined();
+ expect(bufferContainsString(rawBlob!, secretVal)).toBe(false);
+ });
+});
+
+describe('profileRepository.listSnapshots', () => {
+ it('returns an empty array when no snapshots have been saved', async () => {
+ expect(await listSnapshots()).toEqual([]);
+ });
+
+ it('returns all saved snapshots', async () => {
+ const s1 = makeSnapshot();
+ const s2 = makeSnapshot();
+
+ await saveSnapshot(s1);
+ await saveSnapshot(s2);
+
+ const list = await listSnapshots();
+ const ids = list.map((s) => s.id).sort();
+ expect(ids).toEqual([s1.id, s2.id].sort());
+ });
+
+ it('returned items are Snapshot objects (not raw buffers)', async () => {
+ const snap = makeSnapshot();
+ await saveSnapshot(snap);
+
+ const list = await listSnapshots();
+ expect(list.length).toBeGreaterThan(0);
+ for (const s of list) {
+ expect(s).toHaveProperty('id');
+ expect(s).toHaveProperty('origin');
+ expect(s).toHaveProperty('cookies');
+ expect(s).toHaveProperty('reason');
+ }
+ });
+});
+
+// ---------------------------------------------------------------------------
+// IndexedDB key presence (structural check)
+// ---------------------------------------------------------------------------
+
+describe('profileRepository: IndexedDB key presence', () => {
+ it('profile is stored in IndexedDB under its id as the key', async () => {
+ const profile = makeProfile();
+ await saveProfile(profile);
+
+ const keys = await listKeys(STORE_PROFILES);
+ expect(keys).toContain(profile.id);
+ });
+
+ it('snapshot is stored in IndexedDB under its id as the key', async () => {
+ const snap = makeSnapshot();
+ await saveSnapshot(snap);
+
+ const keys = await listKeys(STORE_SNAPSHOTS);
+ expect(keys).toContain(snap.id);
+ });
+
+ it('deleted profile key is absent from IndexedDB', async () => {
+ const profile = makeProfile();
+ await saveProfile(profile);
+ await deleteProfile(profile.id);
+
+ const keys = await listKeys(STORE_PROFILES);
+ expect(keys).not.toContain(profile.id);
+ });
+});
diff --git a/tests/storage/settingsRepository.test.ts b/tests/storage/settingsRepository.test.ts
new file mode 100644
index 0000000..8579d0d
--- /dev/null
+++ b/tests/storage/settingsRepository.test.ts
@@ -0,0 +1,207 @@
+/**
+ * Tests for src/services/storage/settingsRepository.ts (CONTRACTS §11).
+ *
+ * settingsRepository is ALREADY IMPLEMENTED → all tests here must be GREEN now.
+ *
+ * Contract (CONTRACTS.md §11):
+ * - getSettings() merges stored values over DEFAULT_SETTINGS.
+ * - telemetryOptIn defaults false.
+ * - onboardingComplete defaults false.
+ * - freeProfileLimit defaults 3.
+ * - theme defaults 'system'.
+ * - grantedOrigins defaults [].
+ * - patchSettings merges + persists.
+ * - Partial stored values merge over defaults (missing stored keys fall back to defaults).
+ */
+
+import { describe, it, expect } from 'vitest';
+import {
+ getSettings,
+ patchSettings,
+ DEFAULT_SETTINGS,
+} from '@/services/storage/settingsRepository';
+import { control } from '../harness/fakeChrome';
+
+// ---------------------------------------------------------------------------
+// DEFAULT_SETTINGS shape
+// ---------------------------------------------------------------------------
+
+describe('settingsRepository.DEFAULT_SETTINGS', () => {
+ it('has telemetryOptIn: false', () => {
+ expect(DEFAULT_SETTINGS.telemetryOptIn).toBe(false);
+ });
+
+ it('has onboardingComplete: false', () => {
+ expect(DEFAULT_SETTINGS.onboardingComplete).toBe(false);
+ });
+
+ it('has freeProfileLimit: 3', () => {
+ expect(DEFAULT_SETTINGS.freeProfileLimit).toBe(3);
+ });
+
+ it('has theme: "system"', () => {
+ expect(DEFAULT_SETTINGS.theme).toBe('system');
+ });
+
+ it('has grantedOrigins: []', () => {
+ expect(DEFAULT_SETTINGS.grantedOrigins).toEqual([]);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// getSettings — defaults
+// ---------------------------------------------------------------------------
+
+describe('settingsRepository.getSettings (empty storage)', () => {
+ it('returns DEFAULT_SETTINGS when nothing is stored', async () => {
+ const settings = await getSettings();
+ expect(settings).toEqual(DEFAULT_SETTINGS);
+ });
+
+ it('returns telemetryOptIn: false by default', async () => {
+ expect((await getSettings()).telemetryOptIn).toBe(false);
+ });
+
+ it('returns onboardingComplete: false by default', async () => {
+ expect((await getSettings()).onboardingComplete).toBe(false);
+ });
+
+ it('returns freeProfileLimit: 3 by default', async () => {
+ expect((await getSettings()).freeProfileLimit).toBe(3);
+ });
+
+ it('returns theme: "system" by default', async () => {
+ expect((await getSettings()).theme).toBe('system');
+ });
+
+ it('returns grantedOrigins: [] by default', async () => {
+ expect((await getSettings()).grantedOrigins).toEqual([]);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// patchSettings
+// ---------------------------------------------------------------------------
+
+describe('settingsRepository.patchSettings', () => {
+ it('merges a single field update and returns the merged result', async () => {
+ const next = await patchSettings({ telemetryOptIn: true });
+ expect(next.telemetryOptIn).toBe(true);
+ // Other fields should retain their defaults
+ expect(next.onboardingComplete).toBe(false);
+ expect(next.freeProfileLimit).toBe(3);
+ });
+
+ it('persists the change (getSettings after patch reflects the update)', async () => {
+ await patchSettings({ telemetryOptIn: true });
+ const stored = await getSettings();
+ expect(stored.telemetryOptIn).toBe(true);
+ });
+
+ it('persists onboardingComplete = true', async () => {
+ await patchSettings({ onboardingComplete: true });
+ expect((await getSettings()).onboardingComplete).toBe(true);
+ });
+
+ it('can update theme to dark', async () => {
+ await patchSettings({ theme: 'dark' });
+ expect((await getSettings()).theme).toBe('dark');
+ });
+
+ it('can update theme to light', async () => {
+ await patchSettings({ theme: 'light' });
+ expect((await getSettings()).theme).toBe('light');
+ });
+
+ it('can update freeProfileLimit', async () => {
+ await patchSettings({ freeProfileLimit: 5 });
+ expect((await getSettings()).freeProfileLimit).toBe(5);
+ });
+
+ it('can set grantedOrigins to a non-empty array', async () => {
+ await patchSettings({ grantedOrigins: ['https://example.com/*'] });
+ expect((await getSettings()).grantedOrigins).toEqual(['https://example.com/*']);
+ });
+
+ it('sequential patches accumulate (each patch does not reset unmentioned fields)', async () => {
+ await patchSettings({ telemetryOptIn: true });
+ await patchSettings({ onboardingComplete: true });
+
+ const settings = await getSettings();
+ expect(settings.telemetryOptIn).toBe(true);
+ expect(settings.onboardingComplete).toBe(true);
+ });
+
+ it('returns the full merged AppSettings object (not just the patched fields)', async () => {
+ const result = await patchSettings({ telemetryOptIn: true });
+ expect(result).toHaveProperty('telemetryOptIn');
+ expect(result).toHaveProperty('onboardingComplete');
+ expect(result).toHaveProperty('theme');
+ expect(result).toHaveProperty('freeProfileLimit');
+ expect(result).toHaveProperty('grantedOrigins');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Partial stored values merge over defaults (CONTRACTS §11)
+// ---------------------------------------------------------------------------
+
+describe('settingsRepository.getSettings: partial stored values merge over defaults', () => {
+ it('missing stored keys fall back to defaults', async () => {
+ // Seed storage with only one field to simulate an older stored settings
+ // blob that does not yet contain all keys (e.g. after a settings schema update).
+ control.seedStorage({ settings: { telemetryOptIn: true } });
+
+ const settings = await getSettings();
+
+ // The stored field should be present
+ expect(settings.telemetryOptIn).toBe(true);
+ // Unset fields must fall back to defaults
+ expect(settings.onboardingComplete).toBe(false);
+ expect(settings.freeProfileLimit).toBe(3);
+ expect(settings.theme).toBe('system');
+ expect(settings.grantedOrigins).toEqual([]);
+ });
+
+ it('fully stored settings are returned as-is (no defaults override stored)', async () => {
+ const stored = {
+ theme: 'dark' as const,
+ telemetryOptIn: true,
+ onboardingComplete: true,
+ grantedOrigins: ['https://example.com/*'],
+ freeProfileLimit: 10,
+ };
+ control.seedStorage({ settings: stored });
+
+ const settings = await getSettings();
+ expect(settings).toEqual(stored);
+ });
+
+ it('a stored freeProfileLimit of 0 is NOT overridden by the default 3', async () => {
+ // Edge case: 0 is falsy but it is a valid stored value.
+ control.seedStorage({ settings: { freeProfileLimit: 0 } });
+ const settings = await getSettings();
+ // Implementation uses spread merge so 0 overrides default 3.
+ // (If the implementation uses || instead of ??, this test will catch the bug.)
+ expect(settings.freeProfileLimit).toBe(0);
+ });
+
+ it('a stored telemetryOptIn of false is explicitly false (not missing)', async () => {
+ control.seedStorage({ settings: { telemetryOptIn: false } });
+ const settings = await getSettings();
+ expect(settings.telemetryOptIn).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Isolation between tests
+// ---------------------------------------------------------------------------
+
+describe('settingsRepository: test isolation', () => {
+ it('does not retain state from a previous test (chrome.storage reset)', async () => {
+ // If any earlier test in this file patched settings, the reset in
+ // setup.ts beforeEach must have cleared it.
+ const settings = await getSettings();
+ expect(settings).toEqual(DEFAULT_SETTINGS);
+ });
+});
diff --git a/tests/telemetry/telemetry.test.ts b/tests/telemetry/telemetry.test.ts
new file mode 100644
index 0000000..240e6d5
--- /dev/null
+++ b/tests/telemetry/telemetry.test.ts
@@ -0,0 +1,314 @@
+/**
+ * Telemetry tests — CONTRACTS.md §10 / PRD §15.
+ *
+ * Implementation status:
+ * - track(), trackAsync(), setOptIn() are IMPLEMENTED → tests here are GREEN.
+ * - Type-level tests are compile-time assertions that never fail at runtime.
+ *
+ * Coverage:
+ * 1. track is a no-op when telemetryOptIn is false (default).
+ * 2. track does not throw for any allowed event.
+ * 3. track reads opt-in and does not network-fetch (logger.debug only).
+ * 4. track does not accept a payload (type-level).
+ * 5. setOptIn persists via settingsRepository → chrome.storage.local.
+ * 6. trackAsync is fire-and-forget (void, swallows errors).
+ * 7. Only the allowed TelemetryEvent union members are valid (type-level).
+ */
+
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { control } from '../harness/fakeChrome';
+
+// ── import after fakeChrome is globally installed ──────────────────────────
+import { track, trackAsync, setOptIn, type TelemetryEvent } from '@/services/telemetry/telemetry';
+import * as settingsRepo from '@/services/storage/settingsRepository';
+
+// ── helpers ────────────────────────────────────────────────────────────────
+
+/** All events listed in the TelemetryEvent union (PRD §15). */
+const ALL_EVENTS: TelemetryEvent[] = [
+ 'install',
+ 'profile_saved',
+ 'profile_switch_success',
+ 'profile_switch_failure',
+ 'playwright_export_used',
+ 'paywall_view',
+ 'upgrade',
+ 'review_prompt_shown',
+ 'team_invite_sent',
+ 'team_invite_accepted',
+];
+
+beforeEach(() => {
+ control.reset();
+});
+
+// ── §1 NO-OP when opt-out ─────────────────────────────────────────────────
+
+describe('track — telemetryOptIn false (default)', () => {
+ it('does not call chrome.storage.local.set (no persistence side-effect)', async () => {
+ // Default settings have telemetryOptIn:false. Just calling track must not
+ // write anything back to storage (it only reads).
+ const setSpy = vi.spyOn(chrome.storage.local, 'set');
+
+ await track('install');
+
+ expect(setSpy).not.toHaveBeenCalled();
+ });
+
+ it('resolves to void (does not throw) for every allowed event', async () => {
+ for (const event of ALL_EVENTS) {
+ await expect(track(event)).resolves.toBeUndefined();
+ }
+ });
+
+ it('reads settings to check opt-in (exactly once per call)', async () => {
+ const getSpy = vi.spyOn(chrome.storage.local, 'get');
+
+ await track('install');
+
+ // Must read storage to determine opt-in status.
+ expect(getSpy).toHaveBeenCalledTimes(1);
+ });
+
+ it('does not invoke fetch or XMLHttpRequest (no network emission)', async () => {
+ // Neither fetch nor XHR exist in jsdom unless the test adds them; assert
+ // that the global fetch was never called (jsdom provides a no-op fetch).
+ const fetchSpy = vi.spyOn(globalThis, 'fetch').mockResolvedValue(new Response());
+
+ await track('profile_saved');
+
+ expect(fetchSpy).not.toHaveBeenCalled();
+ });
+});
+
+// ── §2 RECORDS when opt-in ────────────────────────────────────────────────
+
+describe('track — telemetryOptIn true', () => {
+ beforeEach(async () => {
+ // Persist opt-in to storage so getSettings() sees it.
+ await setOptIn(true);
+ });
+
+ it('does not throw for any allowed event', async () => {
+ for (const event of ALL_EVENTS) {
+ await expect(track(event)).resolves.toBeUndefined();
+ }
+ });
+
+ it('logs via logger.debug (the only emission allowed before network TODO lands)', async () => {
+ const debugSpy = vi.spyOn(console, 'debug').mockImplementation(() => {});
+
+ await track('paywall_view');
+
+ // logger.debug is called — proves the opt-in branch was entered.
+ expect(debugSpy).toHaveBeenCalled();
+ // The call args include an object with type: 'paywall_view'.
+ // logger.debug passes meta as the third arg: { type: event }.
+ const allArgs = debugSpy.mock.calls.flat();
+ const hasEvent = allArgs.some((arg) =>
+ typeof arg === 'object' && arg !== null && (arg as Record)['type'] === 'paywall_view',
+ );
+ expect(hasEvent).toBe(true);
+ });
+
+ it('does not include a payload beyond the event name (no cookie/value/url in log)', async () => {
+ const debugSpy = vi.spyOn(console, 'debug').mockImplementation(() => {});
+ const secretValue = 'super-secret-cookie-value-87654321';
+
+ // track() has no payload parameter — the only way a secret could appear is
+ // via the event name itself, which the union forbids.
+ await track('upgrade');
+
+ // Check the meta object passed to logger.debug — it must only contain { type: 'upgrade' }.
+ const allArgs = debugSpy.mock.calls.flat();
+ const metaObjects = allArgs.filter((arg) => typeof arg === 'object' && arg !== null);
+ const metaJson = JSON.stringify(metaObjects);
+ expect(metaJson).not.toContain(secretValue);
+ // The event name is present (via { type: 'upgrade' }).
+ const hasEvent = allArgs.some((arg) =>
+ typeof arg === 'object' && arg !== null && (arg as Record)['type'] === 'upgrade',
+ );
+ expect(hasEvent).toBe(true);
+ });
+
+ it('reads opt-in and proceeds (storage.local.get is called)', async () => {
+ const getSpy = vi.spyOn(chrome.storage.local, 'get');
+
+ await track('review_prompt_shown');
+
+ expect(getSpy).toHaveBeenCalled();
+ });
+});
+
+// ── §3 setOptIn persists ──────────────────────────────────────────────────
+
+describe('setOptIn', () => {
+ it('persisting true makes subsequent track calls enter the opt-in branch', async () => {
+ await setOptIn(true);
+ const settings = await settingsRepo.getSettings();
+ expect(settings.telemetryOptIn).toBe(true);
+ });
+
+ it('persisting false makes subsequent track calls no-op again', async () => {
+ await setOptIn(true);
+ await setOptIn(false);
+ const settings = await settingsRepo.getSettings();
+ expect(settings.telemetryOptIn).toBe(false);
+ });
+
+ it('writes to chrome.storage.local', async () => {
+ const setSpy = vi.spyOn(chrome.storage.local, 'set');
+
+ await setOptIn(true);
+
+ expect(setSpy).toHaveBeenCalled();
+ // The stored settings object must have telemetryOptIn: true.
+ const storedArg = setSpy.mock.calls[0]?.[0] as Record;
+ const stored = storedArg?.['settings'] as Record | undefined;
+ expect(stored?.telemetryOptIn).toBe(true);
+ });
+
+ it('setOptIn(false) after setOptIn(true) reverts the flag in storage', async () => {
+ await setOptIn(true);
+ await setOptIn(false);
+ const setSpy = vi.spyOn(chrome.storage.local, 'set');
+ await setOptIn(false); // one more explicit call to capture the arg
+ const storedArg = setSpy.mock.calls[0]?.[0] as Record;
+ const stored = storedArg?.['settings'] as Record | undefined;
+ expect(stored?.telemetryOptIn).toBe(false);
+ });
+});
+
+// ── §4 trackAsync fire-and-forget ────────────────────────────────────────
+
+describe('trackAsync', () => {
+ it('returns void synchronously (fire-and-forget)', () => {
+ const result = trackAsync('install');
+ // Must be void — not a Promise the caller is expected to await.
+ expect(result).toBeUndefined();
+ });
+
+ it('does not propagate errors thrown by track (swallows errors)', async () => {
+ // Simulate a storage failure during opt-in check.
+ vi.spyOn(chrome.storage.local, 'get').mockRejectedValueOnce(new Error('storage failure'));
+
+ // Must not throw synchronously or cause an unhandled rejection.
+ expect(() => trackAsync('install')).not.toThrow();
+
+ // Give the microtask queue a tick to flush; still no explosion.
+ await Promise.resolve();
+ });
+
+ it('does not throw for any event even when opt-in is true', async () => {
+ await setOptIn(true);
+ for (const event of ALL_EVENTS) {
+ expect(() => trackAsync(event)).not.toThrow();
+ }
+ await Promise.resolve(); // flush microtasks
+ });
+});
+
+// ── §5 Type-level: only allowed events are valid ─────────────────────────
+
+/**
+ * This describe block contains compile-time assertions. They cannot *fail* at
+ * runtime (they are always true), but they WILL produce TypeScript errors if the
+ * TelemetryEvent union does not contain the specified literal — making the test
+ * suite fail at tsc/vitest type-check time.
+ *
+ * Strategy: assign each literal to a typed variable. If the literal is absent
+ * from the union, the assignment is a type error.
+ */
+describe('TelemetryEvent union — type-level membership (compile-time)', () => {
+ it('all PRD §15 event literals are members of TelemetryEvent', () => {
+ // Each assignment is a compile-time type assertion.
+ const _install: TelemetryEvent = 'install';
+ const _profileSaved: TelemetryEvent = 'profile_saved';
+ const _switchSuccess: TelemetryEvent = 'profile_switch_success';
+ const _switchFailure: TelemetryEvent = 'profile_switch_failure';
+ const _playwrightExport: TelemetryEvent = 'playwright_export_used';
+ const _paywallView: TelemetryEvent = 'paywall_view';
+ const _upgrade: TelemetryEvent = 'upgrade';
+ const _reviewPrompt: TelemetryEvent = 'review_prompt_shown';
+ const _teamInviteSent: TelemetryEvent = 'team_invite_sent';
+ const _teamInviteAccepted: TelemetryEvent = 'team_invite_accepted';
+
+ // Suppress unused-variable warnings — these exist solely for type checking.
+ void [
+ _install, _profileSaved, _switchSuccess, _switchFailure, _playwrightExport,
+ _paywallView, _upgrade, _reviewPrompt, _teamInviteSent, _teamInviteAccepted,
+ ];
+
+ expect(true).toBe(true); // runtime assertion is trivially true
+ });
+
+ it('track() signature accepts no payload parameter (type-level)', () => {
+ // track is declared as (event: TelemetryEvent) => Promise.
+ // Assigning it to a function that takes only one argument satisfies the type.
+ // If a payload param were added this check would still pass (it's additive),
+ // but the MISSING payload check is enforced by the fact that we never pass one
+ // anywhere in this file — any accidental payload would be a TS error.
+ type TrackFn = (event: TelemetryEvent) => Promise;
+ const _typed: TrackFn = track;
+ void _typed;
+ expect(true).toBe(true);
+ });
+});
+
+// ── §6 track never throws (always swallows) ──────────────────────────────
+
+describe('track error swallowing', () => {
+ it('does not throw when getSettings rejects', async () => {
+ vi.spyOn(chrome.storage.local, 'get').mockRejectedValueOnce(new Error('quota exceeded'));
+
+ await expect(track('install')).resolves.toBeUndefined();
+ });
+
+ it('does not throw when getSettings returns a value with telemetryOptIn false after opt-in seed', async () => {
+ // Even if storage returns opt-in: false, track resolves without throwing.
+ vi.spyOn(chrome.storage.local, 'get').mockResolvedValueOnce({
+ settings: { telemetryOptIn: false },
+ });
+
+ await expect(track('upgrade')).resolves.toBeUndefined();
+ });
+
+ it('swallows even when console.debug throws', async () => {
+ // Seed opt-in directly in storage so track enters the opt-in branch.
+ control.seedStorage({ settings: { telemetryOptIn: true } });
+ const debugSpy = vi.spyOn(console, 'debug').mockImplementationOnce(() => {
+ throw new Error('console error');
+ });
+
+ // track must not propagate the console error.
+ await expect(track('install')).resolves.toBeUndefined();
+ debugSpy.mockRestore();
+ });
+});
+
+// ── §7 No forbidden content escapes (CONTRACTS.md §10) ───────────────────
+
+describe('telemetry forbidden-data guardrails', () => {
+ it('track never causes chrome.storage.set to be called with cookie values', async () => {
+ await setOptIn(true);
+ control.seedStorage({ settings: { telemetryOptIn: true } });
+
+ const setSpy = vi.spyOn(chrome.storage.local, 'set');
+ // Clear spy calls from setOptIn.
+ setSpy.mockClear();
+
+ await track('profile_switch_success');
+
+ // storage.set should NOT be called by track itself (only setOptIn does that).
+ expect(setSpy).not.toHaveBeenCalled();
+ });
+
+ it('calling track with opt-in true does not write a new storage entry (read-only flow)', async () => {
+ control.seedStorage({ settings: { telemetryOptIn: true } });
+ const setSpy = vi.spyOn(chrome.storage.local, 'set');
+
+ await track('playwright_export_used');
+
+ expect(setSpy).not.toHaveBeenCalled();
+ });
+});
diff --git a/tests/ui/App.test.tsx b/tests/ui/App.test.tsx
new file mode 100644
index 0000000..a09f07d
--- /dev/null
+++ b/tests/ui/App.test.tsx
@@ -0,0 +1,243 @@
+/**
+ * Tests for the App shell (src/ui/App.tsx).
+ *
+ * Covers: settings/get on mount, onboarding routing, nav rendering,
+ * theme application via useTheme, and ErrorBoundary catch+recovery.
+ */
+
+import React from 'react';
+import { describe, it, expect, vi, beforeAll, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { App } from '@/ui/App';
+import { useStore } from '@/state/store';
+import { control } from '../harness/fakeChrome';
+import { resetStore, makeSettings, mockSendMessage, stubMatchMedia } from './helpers';
+
+// App uses useTheme which calls window.matchMedia — jsdom doesn't provide it.
+beforeAll(() => stubMatchMedia());
+
+beforeEach(() => {
+ resetStore();
+ // Always provide a default active tab so the header shows something.
+ control.addTab({ url: 'https://example.com/', active: true });
+});
+
+// ---------------------------------------------------------------------------
+// Onboarding routing
+// ---------------------------------------------------------------------------
+
+describe('App: routes to onboarding when onboardingComplete is false', () => {
+ it('shows OnboardingView when settings.onboardingComplete is false', async () => {
+ mockSendMessage({
+ 'settings/get': () => makeSettings({ onboardingComplete: false }),
+ });
+ render( );
+ await waitFor(() =>
+ expect(screen.getByText(/Welcome to Sessionist/i)).toBeInTheDocument()
+ );
+ });
+
+ it('sets view to onboarding in the store', async () => {
+ mockSendMessage({
+ 'settings/get': () => makeSettings({ onboardingComplete: false }),
+ });
+ render( );
+ await waitFor(() => expect(useStore.getState().view).toBe('onboarding'));
+ });
+});
+
+describe('App: stays on default view when onboardingComplete is true', () => {
+ it('does NOT show OnboardingView when already onboarded', async () => {
+ mockSendMessage({
+ 'settings/get': () => makeSettings({ onboardingComplete: true }),
+ 'cookies/list': () => [],
+ });
+ render( );
+ // Wait for settings to load.
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ expect(screen.queryByText(/Welcome to Sessionist/i)).not.toBeInTheDocument();
+ });
+
+ it('view stays at cookies (the initial store value)', async () => {
+ mockSendMessage({
+ 'settings/get': () => makeSettings({ onboardingComplete: true }),
+ 'cookies/list': () => [],
+ });
+ render( );
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ expect(useStore.getState().view).toBe('cookies');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// settings/get call on mount
+// ---------------------------------------------------------------------------
+
+describe('App: sends settings/get on mount', () => {
+ it('calls chrome.runtime.sendMessage with {type:"settings/get"}', async () => {
+ const spy = mockSendMessage({
+ 'settings/get': () => makeSettings(),
+ 'cookies/list': () => [],
+ });
+ render( );
+ await waitFor(() => {
+ const calls = spy.mock.calls.map((c) => (c[0] as { type: string }).type);
+ expect(calls).toContain('settings/get');
+ });
+ });
+
+ it('stores the received settings in the Zustand store', async () => {
+ const s = makeSettings({ theme: 'dark', telemetryOptIn: true });
+ mockSendMessage({ 'settings/get': () => s, 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => expect(useStore.getState().settings?.theme).toBe('dark'));
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Nav rendering
+// ---------------------------------------------------------------------------
+
+describe('App: renders nav', () => {
+ beforeEach(() => {
+ mockSendMessage({ 'settings/get': () => makeSettings(), 'cookies/list': () => [] });
+ });
+
+ it('renders all navigation buttons', async () => {
+ render( );
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ const nav = screen.getByRole('navigation', { name: /Sections/i });
+ for (const label of ['Cookies', 'Profiles', 'Export', 'Sites', 'Team', 'Settings']) {
+ // Scope to nav to avoid collisions with view-level buttons.
+ expect(nav.querySelector(`button[aria-current="page"], button`) && nav).toBeTruthy();
+ const navBtns = Array.from(nav.querySelectorAll('button')).map((b) => b.textContent?.trim());
+ expect(navBtns).toContain(label);
+ }
+ });
+
+ it('nav has aria-label="Sections"', async () => {
+ render( );
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ expect(screen.getByRole('navigation', { name: /Sections/i })).toBeInTheDocument();
+ });
+
+ it('active nav button has aria-current=page', async () => {
+ render( );
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ const cookiesBtn = screen.getByRole('button', { name: 'Cookies' });
+ expect(cookiesBtn).toHaveAttribute('aria-current', 'page');
+ });
+
+ it('clicking a nav button changes the view', async () => {
+ const user = userEvent.setup();
+ mockSendMessage({
+ 'settings/get': () => makeSettings(),
+ 'cookies/list': () => [],
+ 'profiles/list': () => [],
+ 'snapshots/list': () => [],
+ });
+ render( );
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ await user.click(screen.getByRole('button', { name: 'Profiles' }));
+ expect(screen.getByRole('button', { name: 'Profiles' })).toHaveAttribute('aria-current', 'page');
+ expect(screen.getByRole('button', { name: 'Cookies' })).not.toHaveAttribute('aria-current');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Active site in header
+// ---------------------------------------------------------------------------
+
+describe('App: header shows active origin', () => {
+ it('shows the active origin in the header', async () => {
+ mockSendMessage({ 'settings/get': () => makeSettings(), 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => screen.getByText('https://example.com'));
+ });
+
+ it('shows "no active site" when there is no active tab', async () => {
+ // Reset tabs so there are none.
+ control.reset();
+ resetStore();
+ mockSendMessage({ 'settings/get': () => makeSettings(), 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => screen.getByText('no active site'));
+ });
+});
+
+// ---------------------------------------------------------------------------
+// ErrorBoundary
+// ---------------------------------------------------------------------------
+
+describe('App: ErrorBoundary catches a thrown child', () => {
+ it('renders fallback when a child throws', async () => {
+ // Suppress React's console error during expected throw.
+ const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+
+ function Bomb() {
+ throw new Error('kaboom');
+ }
+
+ const { ErrorBoundary } = await import('@/ui/components/ErrorBoundary');
+ render(
+
+
+
+ );
+
+ expect(screen.getByText(/Something went wrong/i)).toBeInTheDocument();
+ expect(screen.getByText(/kaboom/i)).toBeInTheDocument();
+ consoleSpy.mockRestore();
+ });
+
+ it('renders the "Try again" recovery button', async () => {
+ const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+
+ function Bomb() {
+ throw new Error('boom');
+ }
+
+ const { ErrorBoundary } = await import('@/ui/components/ErrorBoundary');
+ render(
+
+
+
+ );
+
+ expect(screen.getByRole('button', { name: /Try again/i })).toBeInTheDocument();
+ consoleSpy.mockRestore();
+ });
+
+ it('clears the error when "Try again" is clicked', async () => {
+ const consoleSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+
+ let shouldThrow = true;
+ function MaybeBomb() {
+ if (shouldThrow) throw new Error('transient');
+ return recovered ;
+ }
+
+ const { ErrorBoundary } = await import('@/ui/components/ErrorBoundary');
+ const { rerender } = render(
+
+
+
+ );
+
+ expect(screen.getByText(/Something went wrong/i)).toBeInTheDocument();
+
+ // Next render the child will succeed.
+ shouldThrow = false;
+ const user = userEvent.setup();
+ await user.click(screen.getByRole('button', { name: /Try again/i }));
+
+ rerender(
+
+
+
+ );
+ expect(screen.getByText('recovered')).toBeInTheDocument();
+ consoleSpy.mockRestore();
+ });
+});
diff --git a/tests/ui/CookieEditorView.test.tsx b/tests/ui/CookieEditorView.test.tsx
new file mode 100644
index 0000000..64844c4
--- /dev/null
+++ b/tests/ui/CookieEditorView.test.tsx
@@ -0,0 +1,349 @@
+/**
+ * Tests for CookieEditorView (src/ui/views/CookieEditorView.tsx).
+ *
+ * Covers: list, search, add, edit, delete (locked/unlocked), import, export,
+ * delete-all inline confirm (NOT window.confirm), empty state.
+ */
+
+import React from 'react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor, within, fireEvent } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { CookieEditorView } from '@/ui/views/CookieEditorView';
+import { useStore } from '@/state/store';
+import { makeCookie, mockSendMessage, resetStore } from './helpers';
+
+// Seed a known active origin into the store before each test.
+function setOrigin(origin = 'https://example.com') {
+ useStore.setState({ activeOrigin: origin, activeTabId: 1 });
+}
+
+beforeEach(() => {
+ resetStore();
+ setOrigin();
+});
+
+// ---------------------------------------------------------------------------
+// List and display
+// ---------------------------------------------------------------------------
+
+describe('CookieEditorView: lists cookies from cookies/list', () => {
+ it('renders cookies returned by the background', async () => {
+ const c = makeCookie({ name: 'my-session', domain: 'example.com' });
+ mockSendMessage({ 'cookies/list': () => [c] });
+ render( );
+ await waitFor(() => expect(screen.getByText('my-session')).toBeInTheDocument());
+ });
+
+ it('sends cookies/list with the active origin', async () => {
+ const spy = mockSendMessage({ 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'cookies/list');
+ expect(call).toBeTruthy();
+ expect((call![0] as { origin: string }).origin).toBe('https://example.com');
+ });
+ });
+
+ it('shows empty state text when no cookies returned', async () => {
+ mockSendMessage({ 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => screen.getByText(/No cookies for this site yet/i));
+ });
+
+ it('empty state does not contain the word "Stub"', async () => {
+ mockSendMessage({ 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => expect(screen.queryByText(/stub/i)).not.toBeInTheDocument());
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Search / filter
+// ---------------------------------------------------------------------------
+
+describe('CookieEditorView: search filters cookies', () => {
+ it('filters the list by cookie name (case-insensitive)', async () => {
+ const c1 = makeCookie({ name: 'session-token' });
+ const c2 = makeCookie({ name: 'csrf' });
+ mockSendMessage({ 'cookies/list': () => [c1, c2] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => expect(screen.getByText('session-token')).toBeInTheDocument());
+
+ const searchInput = screen.getByRole('textbox', { name: /Search cookies/i });
+ await user.type(searchInput, 'TOKEN');
+ expect(screen.getByText('session-token')).toBeInTheDocument();
+ expect(screen.queryByText('csrf')).not.toBeInTheDocument();
+ });
+
+ it('shows all cookies when search is cleared', async () => {
+ const c1 = makeCookie({ name: 'alpha' });
+ const c2 = makeCookie({ name: 'beta' });
+ mockSendMessage({ 'cookies/list': () => [c1, c2] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => expect(screen.getByText('alpha')).toBeInTheDocument());
+
+ const searchInput = screen.getByRole('textbox', { name: /Search cookies/i });
+ await user.type(searchInput, 'alpha');
+ expect(screen.queryByText('beta')).not.toBeInTheDocument();
+ await user.clear(searchInput);
+ await waitFor(() => expect(screen.getByText('beta')).toBeInTheDocument());
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Add cookie
+// ---------------------------------------------------------------------------
+
+describe('CookieEditorView: Add opens form', () => {
+ it('shows the cookie form when Add is clicked', async () => {
+ mockSendMessage({ 'cookies/list': () => [] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText(/No cookies/i));
+ await user.click(screen.getByRole('button', { name: 'Add' }));
+ expect(screen.getByRole('button', { name: 'Save' })).toBeInTheDocument();
+ });
+
+ it('Save sends cookies/set then refetches', async () => {
+ const spy = mockSendMessage({
+ 'cookies/list': () => [],
+ 'cookies/set': () => undefined,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText(/No cookies/i));
+ await user.click(screen.getByRole('button', { name: 'Add' }));
+
+ // Fill in the name field (required for Save to be enabled).
+ const nameInput = screen.getByLabelText('Name');
+ await user.type(nameInput, 'new-cookie');
+
+ await user.click(screen.getByRole('button', { name: 'Save' }));
+
+ await waitFor(() => {
+ const setCall = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'cookies/set');
+ expect(setCall).toBeTruthy();
+ expect((setCall![0] as { cookie: { name: string } }).cookie.name).toBe('new-cookie');
+ });
+
+ // Should refetch (second call to cookies/list).
+ await waitFor(() => {
+ const listCalls = spy.mock.calls.filter(
+ (c) => (c[0] as { type: string }).type === 'cookies/list'
+ );
+ expect(listCalls.length).toBeGreaterThanOrEqual(2);
+ });
+ });
+
+ it('Save button is disabled when Name field is empty', async () => {
+ mockSendMessage({ 'cookies/list': () => [] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText(/No cookies/i));
+ await user.click(screen.getByRole('button', { name: 'Add' }));
+ const saveBtn = screen.getByRole('button', { name: 'Save' });
+ expect(saveBtn).toBeDisabled();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Edit cookie (row click)
+// ---------------------------------------------------------------------------
+
+describe('CookieEditorView: clicking a row opens the edit form', () => {
+ it('opens cookie form with the cookie data pre-filled', async () => {
+ const c = makeCookie({ name: 'edit-me', value: 'original' });
+ mockSendMessage({ 'cookies/list': () => [c] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => expect(screen.getByText('edit-me')).toBeInTheDocument());
+
+ // The edit button is the cookie name button (aria-label).
+ await user.click(screen.getByRole('button', { name: /Edit cookie edit-me/i }));
+ const valueInput = screen.getByLabelText('Value');
+ expect(valueInput).toHaveValue('original');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Delete cookie
+// ---------------------------------------------------------------------------
+
+describe('CookieEditorView: Delete sends cookies/delete', () => {
+ it('sends cookies/delete with the correct cookie', async () => {
+ const c = makeCookie({ name: 'to-delete' });
+ const spy = mockSendMessage({
+ 'cookies/list': () => [c],
+ 'cookies/delete': () => undefined,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => expect(screen.getByText('to-delete')).toBeInTheDocument());
+
+ await user.click(screen.getByRole('button', { name: /Delete cookie to-delete/i }));
+
+ await waitFor(() => {
+ const del = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'cookies/delete');
+ expect(del).toBeTruthy();
+ expect((del![0] as { cookie: { name: string } }).cookie.name).toBe('to-delete');
+ });
+ });
+
+ it('Delete button is disabled when cookie is locked', async () => {
+ const c = makeCookie({ name: 'locked-one', locked: true });
+ mockSendMessage({ 'cookies/list': () => [c] });
+ render( );
+ await waitFor(() => expect(screen.getByText('locked-one')).toBeInTheDocument());
+ expect(screen.getByRole('button', { name: /Delete cookie locked-one/i })).toBeDisabled();
+ });
+
+ it('Delete button shows "Locked" text for locked cookies', async () => {
+ const c = makeCookie({ name: 'locked-one', locked: true });
+ mockSendMessage({ 'cookies/list': () => [c] });
+ render( );
+ await waitFor(() => expect(screen.getByRole('button', { name: /Delete cookie locked-one/i })).toHaveTextContent('Locked'));
+ });
+
+ it('Delete button has a descriptive aria-label', async () => {
+ const c = makeCookie({ name: 'aria-test' });
+ mockSendMessage({ 'cookies/list': () => [c] });
+ render( );
+ await waitFor(() => expect(screen.getByText('aria-test')).toBeInTheDocument());
+ expect(screen.getByRole('button', { name: /Delete cookie aria-test/i })).toBeInTheDocument();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Import
+// ---------------------------------------------------------------------------
+
+describe('CookieEditorView: Import textarea sends cookies/import', () => {
+ it('shows the import textarea when Import is clicked', async () => {
+ mockSendMessage({ 'cookies/list': () => [] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText(/No cookies/i));
+ await user.click(screen.getByRole('button', { name: 'Import' }));
+ expect(screen.getByRole('textbox', { name: /Cookie import JSON/i })).toBeInTheDocument();
+ });
+
+ it('sends cookies/import with the pasted JSON', async () => {
+ const spy = mockSendMessage({
+ 'cookies/list': () => [],
+ 'cookies/import': () => [],
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText(/No cookies/i));
+ await user.click(screen.getByRole('button', { name: 'Import' }));
+
+ const textarea = screen.getByRole('textbox', { name: /Cookie import JSON/i });
+ // Use fireEvent.change because user.type interprets JSON's { as a key descriptor.
+ fireEvent.change(textarea, { target: { value: '[{"name":"c","value":"v"}]' } });
+
+ // Click the Import button inside the form (the one next to Cancel).
+ const importBtns = screen.getAllByRole('button', { name: 'Import' });
+ // The inner Import button is the primary-variant one in the import form.
+ const innerImport = importBtns.find((b) => b.className.includes('primary')) ?? importBtns[importBtns.length - 1];
+ await user.click(innerImport);
+
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'cookies/import');
+ expect(call).toBeTruthy();
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Export
+// ---------------------------------------------------------------------------
+
+describe('CookieEditorView: Export sends cookies/export', () => {
+ it('sends cookies/export with the active origin', async () => {
+ const spy = mockSendMessage({
+ 'cookies/list': () => [],
+ 'cookies/export': () => '[]',
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText(/No cookies/i));
+ await user.click(screen.getByRole('button', { name: 'Export' }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'cookies/export');
+ expect(call).toBeTruthy();
+ expect((call![0] as { origin: string }).origin).toBe('https://example.com');
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Delete-all inline confirm (NOT window.confirm)
+// ---------------------------------------------------------------------------
+
+describe('CookieEditorView: delete-all uses inline confirm', () => {
+ it('does not call window.confirm', async () => {
+ const confirmSpy = vi.spyOn(window, 'confirm');
+ mockSendMessage({ 'cookies/list': () => [] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Delete all for this site/i }));
+ await user.click(screen.getByRole('button', { name: /Delete all for this site/i }));
+ expect(confirmSpy).not.toHaveBeenCalled();
+ });
+
+ it('shows an inline confirmation UI after clicking delete-all', async () => {
+ mockSendMessage({ 'cookies/list': () => [] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Delete all for this site/i }));
+ await user.click(screen.getByRole('button', { name: /Delete all for this site/i }));
+ expect(screen.getByText(/Delete all cookies for this site/i)).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /Yes, delete all/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: 'Cancel' })).toBeInTheDocument();
+ });
+
+ it('sends cookies/deleteAll when confirmed', async () => {
+ const spy = mockSendMessage({
+ 'cookies/list': () => [],
+ 'cookies/deleteAll': () => 0,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Delete all for this site/i }));
+ await user.click(screen.getByRole('button', { name: /Delete all for this site/i }));
+ await user.click(screen.getByRole('button', { name: /Yes, delete all/i }));
+
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'cookies/deleteAll');
+ expect(call).toBeTruthy();
+ expect((call![0] as { origin: string }).origin).toBe('https://example.com');
+ });
+ });
+
+ it('cancels the confirmation without sending deleteAll', async () => {
+ const spy = mockSendMessage({
+ 'cookies/list': () => [],
+ 'cookies/deleteAll': () => 0,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Delete all for this site/i }));
+ await user.click(screen.getByRole('button', { name: /Delete all for this site/i }));
+ await user.click(screen.getByRole('button', { name: 'Cancel' }));
+
+ expect(spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'cookies/deleteAll')).toBeFalsy();
+ });
+
+ it('delete-all button is disabled when no active origin', async () => {
+ useStore.setState({ activeOrigin: null });
+ mockSendMessage({ 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => {
+ const btn = screen.getByRole('button', { name: /Delete all for this site/i });
+ expect(btn).toBeDisabled();
+ });
+ });
+});
diff --git a/tests/ui/ExportView.test.tsx b/tests/ui/ExportView.test.tsx
new file mode 100644
index 0000000..fdb23ec
--- /dev/null
+++ b/tests/ui/ExportView.test.tsx
@@ -0,0 +1,251 @@
+/**
+ * Tests for ExportView (src/ui/views/ExportView.tsx).
+ *
+ * Covers: profile select, Playwright export, Pro gating for
+ * puppeteer/selenium/curl, Copy uses navigator.clipboard, Download, empty state.
+ */
+
+import React from 'react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { ExportView } from '@/ui/views/ExportView';
+import { useStore } from '@/state/store';
+import { makeProfile, makeEntitlement, mockSendMessage, resetStore } from './helpers';
+
+beforeEach(() => {
+ resetStore();
+});
+
+// ---------------------------------------------------------------------------
+// Empty state
+// ---------------------------------------------------------------------------
+
+describe('ExportView: empty state when no profiles', () => {
+ it('shows prompt to capture a profile first', async () => {
+ mockSendMessage({
+ 'profiles/list': () => [],
+ 'entitlement/get': () => makeEntitlement(),
+ });
+ render( );
+ await waitFor(() =>
+ expect(screen.getByText(/Capture a profile first/i)).toBeInTheDocument()
+ );
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Profile select
+// ---------------------------------------------------------------------------
+
+describe('ExportView: profile select', () => {
+ it('renders a select with profile names', async () => {
+ const p1 = makeProfile({ name: 'Admin' });
+ const p2 = makeProfile({ name: 'Guest' });
+ mockSendMessage({
+ 'profiles/list': () => [p1, p2],
+ 'entitlement/get': () => makeEntitlement(),
+ });
+ render( );
+ await waitFor(() => expect(screen.getByRole('combobox')).toBeInTheDocument());
+ expect(screen.getByRole('option', { name: 'Admin' })).toBeInTheDocument();
+ expect(screen.getByRole('option', { name: 'Guest' })).toBeInTheDocument();
+ });
+
+ it('first profile is pre-selected', async () => {
+ const p1 = makeProfile({ name: 'First' });
+ const p2 = makeProfile({ name: 'Second' });
+ mockSendMessage({
+ 'profiles/list': () => [p1, p2],
+ 'entitlement/get': () => makeEntitlement(),
+ });
+ render( );
+ await waitFor(() => expect(screen.getByRole('combobox')).toHaveValue(p1.id));
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Playwright export (free)
+// ---------------------------------------------------------------------------
+
+describe('ExportView: Playwright export', () => {
+ it('sends export/playwright with the selected profileId', async () => {
+ const p = makeProfile({ name: 'MyProfile' });
+ const spy = mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement(),
+ 'export/playwright': () => '{"cookies":[],"origins":[]}',
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Playwright storageState/i }));
+ await user.click(screen.getByRole('button', { name: /Playwright storageState/i }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find(
+ (c) => (c[0] as { type: string }).type === 'export/playwright'
+ );
+ expect(call).toBeTruthy();
+ expect((call![0] as { profileId: string }).profileId).toBe(p.id);
+ });
+ });
+
+ it('shows the export output in the textarea', async () => {
+ const p = makeProfile({ name: 'X' });
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement(),
+ 'export/playwright': () => 'playwright-output-here',
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Playwright storageState/i }));
+ await user.click(screen.getByRole('button', { name: /Playwright storageState/i }));
+ await waitFor(() =>
+ expect(screen.getByRole('textbox', { name: /Export output/i })).toHaveValue('playwright-output-here')
+ );
+ });
+
+ it('Copy and Download buttons are enabled after export', async () => {
+ const p = makeProfile({ name: 'Y' });
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement(),
+ 'export/playwright': () => '{"cookies":[]}',
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Playwright storageState/i }));
+ await user.click(screen.getByRole('button', { name: /Playwright storageState/i }));
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Copy' })).not.toBeDisabled());
+ expect(screen.getByRole('button', { name: 'Download' })).not.toBeDisabled();
+ });
+
+ it('Copy/Download are disabled before any export', async () => {
+ const p = makeProfile({ name: 'Z' });
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement(),
+ });
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: 'Copy' }));
+ expect(screen.getByRole('button', { name: 'Copy' })).toBeDisabled();
+ expect(screen.getByRole('button', { name: 'Download' })).toBeDisabled();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Copy uses navigator.clipboard
+// ---------------------------------------------------------------------------
+
+describe('ExportView: Copy uses navigator.clipboard.writeText', () => {
+ // NOTE: jsdom blocks direct navigator.clipboard.writeText spy in the component's
+ // execution context (no Permissions API). We verify the button is wired and
+ // enabled when output is present; the actual clipboard write is covered by
+ // integration tests or requires a navigator.clipboard seam in production code.
+ it('Copy button is enabled only when there is output and clicking it does not throw', async () => {
+ const p = makeProfile({ name: 'clip' });
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement(),
+ 'export/playwright': () => 'clipped-content',
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Playwright storageState/i }));
+ await user.click(screen.getByRole('button', { name: /Playwright storageState/i }));
+ // Wait for output to appear in textarea.
+ await waitFor(() =>
+ expect(screen.getByRole('textbox', { name: /Export output/i })).toHaveValue('clipped-content')
+ );
+ // Copy button should now be enabled.
+ expect(screen.getByRole('button', { name: 'Copy' })).not.toBeDisabled();
+ // Clicking it should not throw (even if clipboard access is restricted in jsdom).
+ await expect(user.click(screen.getByRole('button', { name: 'Copy' }))).resolves.not.toThrow();
+ });
+
+ // NOTE: Verifying the actual clipboard.writeText call requires a seam in
+ // production code (e.g. an injectable clipboard service) because jsdom
+ // blocks navigator.clipboard access from component context. This is a
+ // documented production seam — see final report.
+});
+
+// ---------------------------------------------------------------------------
+// Pro gating — free user
+// ---------------------------------------------------------------------------
+
+describe('ExportView: Pro targets route free user to upgrade', () => {
+ it.each([
+ ['Puppeteer', /Puppeteer/i],
+ ['Selenium', /Selenium/i],
+ ['cURL', /cURL/i],
+ ])('%s routes to upgrade when entitlement is free', async (_name, btnPattern) => {
+ const p = makeProfile({ name: 'p' });
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement({ tier: 'free' }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: btnPattern }));
+ await user.click(screen.getByRole('button', { name: btnPattern }));
+ expect(useStore.getState().view).toBe('upgrade');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Pro gating — pro user actually exports
+// ---------------------------------------------------------------------------
+
+describe('ExportView: Pro targets export for pro users', () => {
+ it('sends export/puppeteer when entitlement is pro', async () => {
+ const p = makeProfile({ name: 'ProP' });
+ const spy = mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement({ tier: 'pro' }),
+ 'export/puppeteer': () => 'puppeteer-snippet',
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Puppeteer/i }));
+ await user.click(screen.getByRole('button', { name: /Puppeteer/i }));
+ await waitFor(() => {
+ expect(spy.mock.calls.some((c) => (c[0] as { type: string }).type === 'export/puppeteer')).toBe(true);
+ });
+ // Pro users should NOT be routed to upgrade.
+ expect(useStore.getState().view).not.toBe('upgrade');
+ });
+
+ it('sends export/curl when entitlement is pro', async () => {
+ const p = makeProfile({ name: 'ProC' });
+ const spy = mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement({ tier: 'pro' }),
+ 'export/curl': () => 'curl-snippet',
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /cURL/i }));
+ await user.click(screen.getByRole('button', { name: /cURL/i }));
+ await waitFor(() => {
+ expect(spy.mock.calls.some((c) => (c[0] as { type: string }).type === 'export/curl')).toBe(true);
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Security warning always present
+// ---------------------------------------------------------------------------
+
+describe('ExportView: security warning', () => {
+ it('shows the secrets warning when profiles exist', async () => {
+ const p = makeProfile({ name: 'p' });
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement(),
+ });
+ render( );
+ await waitFor(() =>
+ expect(screen.getByText(/real session secrets/i)).toBeInTheDocument()
+ );
+ });
+});
diff --git a/tests/ui/OnboardingView.test.tsx b/tests/ui/OnboardingView.test.tsx
new file mode 100644
index 0000000..560e881
--- /dev/null
+++ b/tests/ui/OnboardingView.test.tsx
@@ -0,0 +1,97 @@
+/**
+ * Tests for OnboardingView (src/ui/views/OnboardingView.tsx).
+ *
+ * Both CTAs should send settings/patch {onboardingComplete:true} and then
+ * navigate to the appropriate view.
+ */
+
+import React from 'react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { OnboardingView } from '@/ui/views/OnboardingView';
+import { useStore } from '@/state/store';
+import { resetStore, makeSettings, mockSendMessage } from './helpers';
+
+beforeEach(() => {
+ resetStore();
+});
+
+describe('OnboardingView: renders', () => {
+ it('shows the welcome heading', () => {
+ mockSendMessage({});
+ render( );
+ expect(screen.getByText(/Welcome to Sessionist/i)).toBeInTheDocument();
+ });
+
+ it('shows both CTA buttons', () => {
+ render( );
+ expect(screen.getByRole('button', { name: /Import cookies/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /Capture this session/i })).toBeInTheDocument();
+ });
+});
+
+describe('OnboardingView: "Import cookies" CTA', () => {
+ it('sends settings/patch with onboardingComplete:true', async () => {
+ const spy = mockSendMessage({
+ 'settings/patch': () => makeSettings({ onboardingComplete: true }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Import cookies/i }));
+ await waitFor(() => {
+ const patchCall = spy.mock.calls.find(
+ (c) => (c[0] as { type: string }).type === 'settings/patch'
+ );
+ expect(patchCall).toBeTruthy();
+ expect((patchCall![0] as { patch: object }).patch).toMatchObject({ onboardingComplete: true });
+ });
+ });
+
+ it('navigates to the cookies view', async () => {
+ mockSendMessage({
+ 'settings/patch': () => makeSettings({ onboardingComplete: true }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Import cookies/i }));
+ await waitFor(() => expect(useStore.getState().view).toBe('cookies'));
+ });
+});
+
+describe('OnboardingView: "Capture this session" CTA', () => {
+ it('sends settings/patch with onboardingComplete:true', async () => {
+ const spy = mockSendMessage({
+ 'settings/patch': () => makeSettings({ onboardingComplete: true }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Capture this session/i }));
+ await waitFor(() => {
+ const patchCall = spy.mock.calls.find(
+ (c) => (c[0] as { type: string }).type === 'settings/patch'
+ );
+ expect(patchCall).toBeTruthy();
+ expect((patchCall![0] as { patch: object }).patch).toMatchObject({ onboardingComplete: true });
+ });
+ });
+
+ it('navigates to the profiles view', async () => {
+ mockSendMessage({
+ 'settings/patch': () => makeSettings({ onboardingComplete: true }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Capture this session/i }));
+ await waitFor(() => expect(useStore.getState().view).toBe('profiles'));
+ });
+
+ it('updates the settings in the store', async () => {
+ const next = makeSettings({ onboardingComplete: true, theme: 'dark' });
+ mockSendMessage({ 'settings/patch': () => next });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Capture this session/i }));
+ await waitFor(() => expect(useStore.getState().settings?.onboardingComplete).toBe(true));
+ });
+});
diff --git a/tests/ui/ProfilesView.test.tsx b/tests/ui/ProfilesView.test.tsx
new file mode 100644
index 0000000..110f46e
--- /dev/null
+++ b/tests/ui/ProfilesView.test.tsx
@@ -0,0 +1,331 @@
+/**
+ * Tests for ProfilesView (src/ui/views/ProfilesView.tsx).
+ *
+ * Covers: capture (inline form, NOT window.prompt), save→upsell routing,
+ * switch, restore, delete, snapshot list, snapshot restore.
+ */
+
+import React from 'react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { ProfilesView } from '@/ui/views/ProfilesView';
+import { useStore } from '@/state/store';
+import {
+ makeProfile, makeSnapshot, makeStoreResult,
+ mockSendMessage, resetStore,
+} from './helpers';
+
+function setTabId(id = 5) {
+ useStore.setState({ activeTabId: id });
+}
+
+beforeEach(() => {
+ resetStore();
+ setTabId();
+});
+
+// ---------------------------------------------------------------------------
+// Render + list
+// ---------------------------------------------------------------------------
+
+describe('ProfilesView: renders profiles list', () => {
+ it('shows profile names from profiles/list', async () => {
+ const p = makeProfile({ name: 'admin / staging' });
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'snapshots/list': () => [],
+ });
+ render( );
+ await waitFor(() => expect(screen.getByText('admin / staging')).toBeInTheDocument());
+ });
+
+ it('shows empty state when no profiles', async () => {
+ mockSendMessage({ 'profiles/list': () => [], 'snapshots/list': () => [] });
+ render( );
+ await waitFor(() => expect(screen.getByText(/No saved profiles/i)).toBeInTheDocument());
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Capture — inline form (NOT window.prompt)
+// ---------------------------------------------------------------------------
+
+describe('ProfilesView: Capture toggles inline form', () => {
+ it('does NOT call window.prompt when Capture is clicked', async () => {
+ const promptSpy = vi.spyOn(window, 'prompt');
+ mockSendMessage({ 'profiles/list': () => [], 'snapshots/list': () => [] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Capture current/i }));
+ await user.click(screen.getByRole('button', { name: /Capture current/i }));
+ expect(promptSpy).not.toHaveBeenCalled();
+ });
+
+ it('shows an inline name input after clicking Capture', async () => {
+ mockSendMessage({ 'profiles/list': () => [], 'snapshots/list': () => [] });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Capture current/i }));
+ await user.click(screen.getByRole('button', { name: /Capture current/i }));
+ expect(screen.getByLabelText(/Profile name/i)).toBeInTheDocument();
+ });
+
+ it('Save is disabled when name is empty', async () => {
+ mockSendMessage({ 'profiles/list': () => [], 'snapshots/list': () => [] });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Capture current/i }));
+ const saveBtn = screen.getByRole('button', { name: 'Save' });
+ expect(saveBtn).toBeDisabled();
+ });
+});
+
+describe('ProfilesView: Save sends profiles/capture', () => {
+ it('sends profiles/capture with the name and tabId', async () => {
+ const saved = makeProfile({ name: 'my profile' });
+ const spy = mockSendMessage({
+ 'profiles/list': () => [],
+ 'snapshots/list': () => [],
+ 'profiles/capture': () => saved,
+ 'profiles/shouldPromptUpsell': () => false,
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Capture current/i }));
+ await user.type(screen.getByLabelText(/Profile name/i), 'my profile');
+ await user.click(screen.getByRole('button', { name: 'Save' }));
+
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'profiles/capture');
+ expect(call).toBeTruthy();
+ expect((call![0] as { name: string }).name).toBe('my profile');
+ expect((call![0] as { tabId: number }).tabId).toBe(5);
+ });
+ });
+
+ it('checks shouldPromptUpsell after saving', async () => {
+ const saved = makeProfile({ name: 'p' });
+ const spy = mockSendMessage({
+ 'profiles/list': () => [],
+ 'snapshots/list': () => [],
+ 'profiles/capture': () => saved,
+ 'profiles/shouldPromptUpsell': () => false,
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Capture current/i }));
+ await user.type(screen.getByLabelText(/Profile name/i), 'p');
+ await user.click(screen.getByRole('button', { name: 'Save' }));
+ await waitFor(() => {
+ expect(spy.mock.calls.some((c) => (c[0] as { type: string }).type === 'profiles/shouldPromptUpsell')).toBe(true);
+ });
+ });
+
+ it('routes to upgrade when shouldPromptUpsell returns true', async () => {
+ const saved = makeProfile({ name: 'p4' });
+ mockSendMessage({
+ 'profiles/list': () => [],
+ 'snapshots/list': () => [],
+ 'profiles/capture': () => saved,
+ 'profiles/shouldPromptUpsell': () => true,
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Capture current/i }));
+ await user.type(screen.getByLabelText(/Profile name/i), 'p4');
+ await user.click(screen.getByRole('button', { name: 'Save' }));
+ await waitFor(() => expect(useStore.getState().view).toBe('upgrade'));
+ });
+
+ it('does NOT route to upgrade when shouldPromptUpsell returns false', async () => {
+ const saved = makeProfile({ name: 'p2' });
+ mockSendMessage({
+ 'profiles/list': () => [],
+ 'snapshots/list': () => [],
+ 'profiles/capture': () => saved,
+ 'profiles/shouldPromptUpsell': () => false,
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Capture current/i }));
+ await user.type(screen.getByLabelText(/Profile name/i), 'p2');
+ await user.click(screen.getByRole('button', { name: 'Save' }));
+ // Wait for shouldPromptUpsell call to complete, then confirm we did NOT navigate to upgrade.
+ await waitFor(() => {
+ expect(useStore.getState().view).not.toBe('upgrade');
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Switch
+// ---------------------------------------------------------------------------
+
+describe('ProfilesView: Switch sends profiles/switch', () => {
+ it('sends profiles/switch with profileId and tabId', async () => {
+ const p = makeProfile({ id: 'prof-1', name: 'user A' });
+ const switchResult = {
+ profileId: 'prof-1',
+ snapshotId: 'snap-1',
+ results: [makeStoreResult({ store: 'cookies', status: 'applied' })],
+ succeeded: true,
+ };
+ const spy = mockSendMessage({
+ 'profiles/list': () => [p],
+ 'snapshots/list': () => [],
+ 'profiles/switch': () => switchResult,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => expect(screen.getByText('user A')).toBeInTheDocument());
+
+ await user.click(screen.getByRole('button', { name: 'Switch' }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'profiles/switch');
+ expect(call).toBeTruthy();
+ expect((call![0] as { profileId: string }).profileId).toBe('prof-1');
+ expect((call![0] as { tabId: number }).tabId).toBe(5);
+ });
+ });
+
+ it('renders the SwitchResult panel after switching', async () => {
+ const p = makeProfile({ name: 'user A' });
+ const switchResult = {
+ profileId: p.id,
+ snapshotId: 'snap-1',
+ results: [makeStoreResult({ store: 'cookies', status: 'applied' })],
+ succeeded: true,
+ };
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'snapshots/list': () => [],
+ 'profiles/switch': () => switchResult,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText('user A'));
+ await user.click(screen.getByRole('button', { name: 'Switch' }));
+ await waitFor(() => expect(screen.getByText(/Switch applied/i)).toBeInTheDocument());
+ });
+
+ it('shows pre-switch snapshot note in result panel', async () => {
+ const p = makeProfile({ name: 'B' });
+ const switchResult = {
+ profileId: p.id,
+ snapshotId: 'snap-x',
+ results: [makeStoreResult()],
+ succeeded: true,
+ };
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'snapshots/list': () => [],
+ 'profiles/switch': () => switchResult,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText('B'));
+ await user.click(screen.getByRole('button', { name: 'Switch' }));
+ await waitFor(() => expect(screen.getByText(/snapshot was saved/i)).toBeInTheDocument());
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Restore
+// ---------------------------------------------------------------------------
+
+describe('ProfilesView: Restore sends profiles/restore', () => {
+ it('sends profiles/restore with profileId and tabId', async () => {
+ const p = makeProfile({ id: 'prof-2', name: 'user B' });
+ const spy = mockSendMessage({
+ 'profiles/list': () => [p],
+ 'snapshots/list': () => [],
+ 'profiles/restore': () => ({
+ profileId: 'prof-2',
+ snapshotId: 's',
+ results: [],
+ succeeded: true,
+ }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText('user B'));
+ await user.click(screen.getByRole('button', { name: 'Restore' }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'profiles/restore');
+ expect(call).toBeTruthy();
+ expect((call![0] as { profileId: string }).profileId).toBe('prof-2');
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Delete
+// ---------------------------------------------------------------------------
+
+describe('ProfilesView: Delete sends profiles/delete', () => {
+ it('sends profiles/delete with the profileId', async () => {
+ const p = makeProfile({ id: 'del-1', name: 'to delete' });
+ const spy = mockSendMessage({
+ 'profiles/list': () => [p],
+ 'snapshots/list': () => [],
+ 'profiles/delete': () => undefined,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText('to delete'));
+ await user.click(screen.getByRole('button', { name: /Delete profile to delete/i }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'profiles/delete');
+ expect(call).toBeTruthy();
+ expect((call![0] as { profileId: string }).profileId).toBe('del-1');
+ });
+ });
+
+ it('delete button has aria-label with profile name', async () => {
+ const p = makeProfile({ name: 'aria profile' });
+ mockSendMessage({ 'profiles/list': () => [p], 'snapshots/list': () => [] });
+ render( );
+ await waitFor(() => screen.getByText('aria profile'));
+ expect(screen.getByRole('button', { name: /Delete profile aria profile/i })).toBeInTheDocument();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Snapshots
+// ---------------------------------------------------------------------------
+
+describe('ProfilesView: snapshots list renders and Restore sends snapshots/restore', () => {
+ it('renders the recovery snapshots section when snapshots exist', async () => {
+ const snap = makeSnapshot({ id: 'snap-1', origin: 'https://example.com', reason: 'pre-switch' });
+ mockSendMessage({
+ 'profiles/list': () => [],
+ 'snapshots/list': () => [snap],
+ });
+ render( );
+ await waitFor(() => expect(screen.getByText(/Recovery snapshots/i)).toBeInTheDocument());
+ });
+
+ it('sends snapshots/restore with snapshotId when Restore clicked', async () => {
+ const snap = makeSnapshot({ id: 'snap-42' });
+ const spy = mockSendMessage({
+ 'profiles/list': () => [],
+ 'snapshots/list': () => [snap],
+ 'snapshots/restore': () => ({
+ profileId: '',
+ snapshotId: 'snap-42',
+ results: [],
+ succeeded: true,
+ }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText(/Recovery snapshots/i));
+ await user.click(screen.getByRole('button', { name: 'Restore' }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'snapshots/restore');
+ expect(call).toBeTruthy();
+ expect((call![0] as { snapshotId: string }).snapshotId).toBe('snap-42');
+ });
+ });
+});
diff --git a/tests/ui/SettingsView.test.tsx b/tests/ui/SettingsView.test.tsx
new file mode 100644
index 0000000..0a28613
--- /dev/null
+++ b/tests/ui/SettingsView.test.tsx
@@ -0,0 +1,240 @@
+/**
+ * Tests for SettingsView (src/ui/views/SettingsView.tsx).
+ *
+ * Covers: loads entitlement + settings on mount, theme select sends settings/patch,
+ * telemetry checkbox, Activate sends entitlement/activate, Show-welcome-again resets
+ * onboarding, disabled states.
+ */
+
+import React from 'react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { SettingsView } from '@/ui/views/SettingsView';
+import { useStore } from '@/state/store';
+import { makeEntitlement, makeSettings, mockSendMessage, resetStore } from './helpers';
+
+beforeEach(() => {
+ resetStore();
+});
+
+// ---------------------------------------------------------------------------
+// Mount: loads entitlement and settings
+// ---------------------------------------------------------------------------
+
+describe('SettingsView: loads entitlement and settings on mount', () => {
+ it('sends entitlement/get on mount', async () => {
+ const spy = mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ });
+ render( );
+ await waitFor(() => {
+ expect(spy.mock.calls.some((c) => (c[0] as { type: string }).type === 'entitlement/get')).toBe(true);
+ });
+ });
+
+ it('sends settings/get on mount', async () => {
+ const spy = mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ });
+ render( );
+ await waitFor(() => {
+ expect(spy.mock.calls.some((c) => (c[0] as { type: string }).type === 'settings/get')).toBe(true);
+ });
+ });
+
+ it('shows the current tier from the entitlement', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement({ tier: 'pro' }),
+ 'settings/get': () => makeSettings(),
+ });
+ render( );
+ await waitFor(() => expect(screen.getByText(/tier: pro/i)).toBeInTheDocument());
+ });
+
+ it('shows "free" tier for free entitlement', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement({ tier: 'free' }),
+ 'settings/get': () => makeSettings(),
+ });
+ render( );
+ await waitFor(() => expect(screen.getByText(/tier: free/i)).toBeInTheDocument());
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Theme select
+// ---------------------------------------------------------------------------
+
+describe('SettingsView: theme select sends settings/patch', () => {
+ it('shows the current theme in the select', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings({ theme: 'dark' }),
+ });
+ render( );
+ await waitFor(() => {
+ const sel = screen.getByRole('combobox', { name: /theme/i });
+ expect(sel).toHaveValue('dark');
+ });
+ });
+
+ it('sends settings/patch when theme changed', async () => {
+ const spy = mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings({ theme: 'system' }),
+ 'settings/patch': () => makeSettings({ theme: 'light' }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('combobox', { name: /theme/i }));
+ await user.selectOptions(screen.getByRole('combobox', { name: /theme/i }), 'light');
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'settings/patch');
+ expect(call).toBeTruthy();
+ expect((call![0] as { patch: { theme: string } }).patch.theme).toBe('light');
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Telemetry checkbox
+// ---------------------------------------------------------------------------
+
+describe('SettingsView: telemetry checkbox persists', () => {
+ it('checkbox is unchecked by default', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings({ telemetryOptIn: false }),
+ });
+ render( );
+ await waitFor(() => {
+ const checkbox = screen.getByRole('checkbox');
+ expect(checkbox).not.toBeChecked();
+ });
+ });
+
+ it('sends settings/patch with telemetryOptIn:true when checked', async () => {
+ const spy = mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings({ telemetryOptIn: false }),
+ 'settings/patch': () => makeSettings({ telemetryOptIn: true }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('checkbox'));
+ await user.click(screen.getByRole('checkbox'));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'settings/patch');
+ expect(call).toBeTruthy();
+ expect((call![0] as { patch: { telemetryOptIn: boolean } }).patch.telemetryOptIn).toBe(true);
+ });
+ });
+
+ it('shows the checkbox as checked when telemetryOptIn is true', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings({ telemetryOptIn: true }),
+ });
+ render( );
+ await waitFor(() => expect(screen.getByRole('checkbox')).toBeChecked());
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Activate license
+// ---------------------------------------------------------------------------
+
+describe('SettingsView: Activate sends entitlement/activate', () => {
+ it('Activate button is disabled when license key input is empty', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ });
+ render( );
+ await waitFor(() => expect(screen.getByRole('button', { name: 'Activate' })).toBeDisabled());
+ });
+
+ it('Activate button is enabled when a license key is typed', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByLabelText(/License key/i));
+ await user.type(screen.getByLabelText(/License key/i), 'test-key');
+ expect(screen.getByRole('button', { name: 'Activate' })).not.toBeDisabled();
+ });
+
+ it('sends entitlement/activate with the typed key', async () => {
+ const spy = mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ 'entitlement/activate': () => makeEntitlement({ tier: 'pro' }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByLabelText(/License key/i));
+ await user.type(screen.getByLabelText(/License key/i), 'my-pro-key');
+ await user.click(screen.getByRole('button', { name: 'Activate' }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'entitlement/activate');
+ expect(call).toBeTruthy();
+ expect((call![0] as { licenseKey: string }).licenseKey).toBe('my-pro-key');
+ });
+ });
+
+ it('updates the entitlement in the store after activation', async () => {
+ const pro = makeEntitlement({ tier: 'pro' });
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ 'entitlement/activate': () => pro,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByLabelText(/License key/i));
+ await user.type(screen.getByLabelText(/License key/i), 'key');
+ await user.click(screen.getByRole('button', { name: 'Activate' }));
+ await waitFor(() => expect(useStore.getState().entitlement?.tier).toBe('pro'));
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Show welcome again
+// ---------------------------------------------------------------------------
+
+describe('SettingsView: "Show welcome again" resets onboarding and navigates', () => {
+ it('sends settings/patch with onboardingComplete:false', async () => {
+ const spy = mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings({ onboardingComplete: true }),
+ 'settings/patch': () => makeSettings({ onboardingComplete: false }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Show welcome again/i }));
+ await user.click(screen.getByRole('button', { name: /Show welcome again/i }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'settings/patch');
+ expect(call).toBeTruthy();
+ expect((call![0] as { patch: { onboardingComplete: boolean } }).patch.onboardingComplete).toBe(false);
+ });
+ });
+
+ it('navigates to onboarding view', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ 'settings/patch': () => makeSettings({ onboardingComplete: false }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Show welcome again/i }));
+ await user.click(screen.getByRole('button', { name: /Show welcome again/i }));
+ await waitFor(() => expect(useStore.getState().view).toBe('onboarding'));
+ });
+});
diff --git a/tests/ui/SiteAccessView.test.tsx b/tests/ui/SiteAccessView.test.tsx
new file mode 100644
index 0000000..04f16a5
--- /dev/null
+++ b/tests/ui/SiteAccessView.test.tsx
@@ -0,0 +1,158 @@
+/**
+ * Tests for SiteAccessView (src/ui/views/SiteAccessView.tsx).
+ *
+ * Covers: list granted origins, Grant sends permissions/request then refreshes,
+ * Revoke sends permissions/revoke.
+ */
+
+import React from 'react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { SiteAccessView } from '@/ui/views/SiteAccessView';
+import { useStore } from '@/state/store';
+import { mockSendMessage, resetStore } from './helpers';
+
+function setOrigin(origin: string | null = 'https://example.com') {
+ useStore.setState({ activeOrigin: origin });
+}
+
+beforeEach(() => {
+ resetStore();
+ setOrigin();
+});
+
+// ---------------------------------------------------------------------------
+// List granted origins
+// ---------------------------------------------------------------------------
+
+describe('SiteAccessView: lists granted origins', () => {
+ it('renders each granted origin', async () => {
+ mockSendMessage({
+ 'permissions/list': () => ['https://example.com', 'https://foo.com'],
+ });
+ render( );
+ await waitFor(() => expect(screen.getByText('https://example.com')).toBeInTheDocument());
+ expect(screen.getByText('https://foo.com')).toBeInTheDocument();
+ });
+
+ it('shows empty state when no origins granted', async () => {
+ mockSendMessage({ 'permissions/list': () => [] });
+ render( );
+ await waitFor(() => expect(screen.getByText(/No sites granted yet/i)).toBeInTheDocument());
+ });
+
+ it('sends permissions/list on mount', async () => {
+ const spy = mockSendMessage({ 'permissions/list': () => [] });
+ render( );
+ await waitFor(() => {
+ expect(spy.mock.calls.some((c) => (c[0] as { type: string }).type === 'permissions/list')).toBe(true);
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Grant
+// ---------------------------------------------------------------------------
+
+describe('SiteAccessView: Grant sends permissions/request', () => {
+ it('shows the "Grant this site" button when activeOrigin is set', async () => {
+ mockSendMessage({ 'permissions/list': () => [] });
+ render( );
+ await waitFor(() => expect(screen.getByRole('button', { name: /Grant this site/i })).toBeInTheDocument());
+ });
+
+ it('does NOT show Grant button when activeOrigin is null', async () => {
+ setOrigin(null);
+ mockSendMessage({ 'permissions/list': () => [] });
+ render( );
+ await waitFor(() => screen.getByText(/No sites granted yet/i));
+ expect(screen.queryByRole('button', { name: /Grant this site/i })).not.toBeInTheDocument();
+ });
+
+ it('sends permissions/request with the active origin', async () => {
+ const spy = mockSendMessage({
+ 'permissions/list': () => [],
+ 'permissions/request': () => true,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Grant this site/i }));
+ await user.click(screen.getByRole('button', { name: /Grant this site/i }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'permissions/request');
+ expect(call).toBeTruthy();
+ expect((call![0] as { origin: string }).origin).toBe('https://example.com');
+ });
+ });
+
+ it('refreshes the origins list after granting', async () => {
+ const spy = mockSendMessage({
+ 'permissions/list': () => [],
+ 'permissions/request': () => true,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByRole('button', { name: /Grant this site/i }));
+ const listCallsBefore = spy.mock.calls.filter(
+ (c) => (c[0] as { type: string }).type === 'permissions/list'
+ ).length;
+ await user.click(screen.getByRole('button', { name: /Grant this site/i }));
+ await waitFor(() => {
+ const listCallsAfter = spy.mock.calls.filter(
+ (c) => (c[0] as { type: string }).type === 'permissions/list'
+ ).length;
+ expect(listCallsAfter).toBeGreaterThan(listCallsBefore);
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Revoke
+// ---------------------------------------------------------------------------
+
+describe('SiteAccessView: Revoke sends permissions/revoke', () => {
+ it('sends permissions/revoke with the origin', async () => {
+ const spy = mockSendMessage({
+ 'permissions/list': () => ['https://revoke-me.com'],
+ 'permissions/revoke': () => true,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText('https://revoke-me.com'));
+ await user.click(screen.getByRole('button', { name: 'Revoke' }));
+ await waitFor(() => {
+ const call = spy.mock.calls.find((c) => (c[0] as { type: string }).type === 'permissions/revoke');
+ expect(call).toBeTruthy();
+ expect((call![0] as { origin: string }).origin).toBe('https://revoke-me.com');
+ });
+ });
+
+ it('refreshes the list after revoking', async () => {
+ const spy = mockSendMessage({
+ 'permissions/list': () => ['https://revoke-me.com'],
+ 'permissions/revoke': () => true,
+ });
+ const user = userEvent.setup();
+ render( );
+ await waitFor(() => screen.getByText('https://revoke-me.com'));
+ const before = spy.mock.calls.filter((c) => (c[0] as { type: string }).type === 'permissions/list').length;
+ await user.click(screen.getByRole('button', { name: 'Revoke' }));
+ await waitFor(() => {
+ const after = spy.mock.calls.filter((c) => (c[0] as { type: string }).type === 'permissions/list').length;
+ expect(after).toBeGreaterThan(before);
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Privacy copy
+// ---------------------------------------------------------------------------
+
+describe('SiteAccessView: privacy copy', () => {
+ it('shows per-origin access explanation', async () => {
+ mockSendMessage({ 'permissions/list': () => [] });
+ render( );
+ await waitFor(() => expect(screen.getByText(/only touches sites you explicitly grant/i)).toBeInTheDocument());
+ });
+});
diff --git a/tests/ui/TeamView.test.tsx b/tests/ui/TeamView.test.tsx
new file mode 100644
index 0000000..2cdcffa
--- /dev/null
+++ b/tests/ui/TeamView.test.tsx
@@ -0,0 +1,44 @@
+/**
+ * Tests for TeamView (src/ui/views/TeamView.tsx).
+ *
+ * Covers: P2 gated UI (buttons disabled/pointer-events-none), zero-knowledge
+ * caveat text, heading.
+ */
+
+import React from 'react';
+import { describe, it, expect } from 'vitest';
+import { render, screen } from '@testing-library/react';
+import { TeamView } from '@/ui/views/TeamView';
+
+describe('TeamView: renders P2 gated UI', () => {
+ it('shows the heading "Team (coming later)"', () => {
+ render( );
+ expect(screen.getByRole('heading', { name: /Team \(coming later\)/i })).toBeInTheDocument();
+ });
+
+ it('shows the zero-knowledge caveat text', () => {
+ render( );
+ expect(screen.getByText(/zero-knowledge sync/i)).toBeInTheDocument();
+ });
+
+ it('shows the P2 gated message', () => {
+ render( );
+ expect(screen.getByText(/P2 feature/i)).toBeInTheDocument();
+ });
+
+ it('the action buttons are wrapped in a pointer-events-none / opacity container', () => {
+ render( );
+ // The buttons exist in the DOM but their container has pointer-events-none.
+ const signInBtn = screen.getByRole('button', { name: /Sign in with Google/i });
+ expect(signInBtn).toBeInTheDocument();
+ // The parent div has opacity-50 and pointer-events-none.
+ const wrapper = signInBtn.closest('div');
+ expect(wrapper?.className).toMatch(/pointer-events-none/);
+ expect(wrapper?.className).toMatch(/opacity-50/);
+ });
+
+ it('the zero-knowledge note mentions authorized teammate', () => {
+ render( );
+ expect(screen.getByText(/authorized teammate/i)).toBeInTheDocument();
+ });
+});
diff --git a/tests/ui/UpgradeView.test.tsx b/tests/ui/UpgradeView.test.tsx
new file mode 100644
index 0000000..e82f459
--- /dev/null
+++ b/tests/ui/UpgradeView.test.tsx
@@ -0,0 +1,110 @@
+/**
+ * Tests for UpgradeView (src/ui/views/UpgradeView.tsx).
+ *
+ * Covers: Pro feature list, paywall_view telemetry on mount (does not crash),
+ * Upgrade button sends entitlement/startCheckout and opens checkout URL via
+ * chrome.tabs.create.
+ */
+
+import React from 'react';
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { UpgradeView } from '@/ui/views/UpgradeView';
+import { mockSendMessage, resetStore } from './helpers';
+
+beforeEach(() => {
+ resetStore();
+});
+
+// ---------------------------------------------------------------------------
+// Pro features list
+// ---------------------------------------------------------------------------
+
+describe('UpgradeView: renders Pro features', () => {
+ it('shows the Pro pricing heading', () => {
+ mockSendMessage({ 'entitlement/startCheckout': () => ({ checkoutUrl: 'https://checkout.test/' }) });
+ render( );
+ expect(screen.getByText(/Sessionist Pro/i)).toBeInTheDocument();
+ });
+
+ it('lists Unlimited session profiles as a feature', () => {
+ mockSendMessage({});
+ render( );
+ expect(screen.getByText(/Unlimited session profiles/i)).toBeInTheDocument();
+ });
+
+ it('lists Puppeteer / Selenium / cURL exports', () => {
+ mockSendMessage({});
+ render( );
+ expect(screen.getByText(/Puppeteer \/ Selenium \/ cURL exports/i)).toBeInTheDocument();
+ });
+
+ it('lists Passphrase lock', () => {
+ mockSendMessage({});
+ render( );
+ expect(screen.getByText(/Passphrase lock/i)).toBeInTheDocument();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// paywall_view telemetry on mount (must not crash)
+// ---------------------------------------------------------------------------
+
+describe('UpgradeView: paywall_view telemetry on mount', () => {
+ it('does not throw when mounted (paywall_view is tracked)', () => {
+ mockSendMessage({});
+ expect(() => render( )).not.toThrow();
+ });
+
+ it('Upgrade button is present after mount', () => {
+ mockSendMessage({});
+ render( );
+ expect(screen.getByRole('button', { name: /Upgrade to Pro/i })).toBeInTheDocument();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Upgrade button — sends entitlement/startCheckout and opens tab
+// ---------------------------------------------------------------------------
+
+describe('UpgradeView: Upgrade button', () => {
+ it('sends entitlement/startCheckout when clicked', async () => {
+ const spy = mockSendMessage({
+ 'entitlement/startCheckout': () => ({ checkoutUrl: 'https://buy.sessionist.com/checkout' }),
+ });
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Upgrade to Pro/i }));
+ await waitFor(() => {
+ expect(spy.mock.calls.some((c) => (c[0] as { type: string }).type === 'entitlement/startCheckout')).toBe(true);
+ });
+ });
+
+ it('calls chrome.tabs.create with the checkout URL', async () => {
+ const checkoutUrl = 'https://buy.sessionist.com/checkout';
+ mockSendMessage({
+ 'entitlement/startCheckout': () => ({ checkoutUrl }),
+ });
+ const createSpy = vi.spyOn(chrome.tabs, 'create');
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Upgrade to Pro/i }));
+ await waitFor(() => {
+ expect(createSpy).toHaveBeenCalledWith({ url: checkoutUrl });
+ });
+ });
+
+ it('does NOT open a tab if startCheckout returns no URL', async () => {
+ // Simulate a failed or empty checkout response.
+ mockSendMessage({
+ 'entitlement/startCheckout': () => ({ checkoutUrl: '' }),
+ });
+ const createSpy = vi.spyOn(chrome.tabs, 'create');
+ const user = userEvent.setup();
+ render( );
+ await user.click(screen.getByRole('button', { name: /Upgrade to Pro/i }));
+ // Give time for the async path to run.
+ await waitFor(() => expect(createSpy).not.toHaveBeenCalled());
+ });
+});
diff --git a/tests/ui/accessibility.test.tsx b/tests/ui/accessibility.test.tsx
new file mode 100644
index 0000000..e374537
--- /dev/null
+++ b/tests/ui/accessibility.test.tsx
@@ -0,0 +1,155 @@
+/**
+ * Accessibility spot-checks across components.
+ *
+ * Covers: nav has aria-current on active view; delete buttons have aria-label;
+ * form inputs have accessible labels.
+ */
+
+import React from 'react';
+import { describe, it, expect, beforeAll, beforeEach } from 'vitest';
+import { render, screen, waitFor } from '@testing-library/react';
+import { App } from '@/ui/App';
+import { CookieEditorView } from '@/ui/views/CookieEditorView';
+import { ProfilesView } from '@/ui/views/ProfilesView';
+import { SiteAccessView } from '@/ui/views/SiteAccessView';
+import { SettingsView } from '@/ui/views/SettingsView';
+import { useStore } from '@/state/store';
+import { control } from '../harness/fakeChrome';
+import { makeCookie, makeProfile, makeSettings, makeEntitlement, mockSendMessage, resetStore, stubMatchMedia } from './helpers';
+
+// App uses useTheme which calls window.matchMedia — jsdom doesn't provide it.
+beforeAll(() => stubMatchMedia());
+
+beforeEach(() => {
+ resetStore();
+});
+
+// ---------------------------------------------------------------------------
+// Nav aria-current
+// ---------------------------------------------------------------------------
+
+describe('Accessibility: nav has aria-current="page" on active view button', () => {
+ it('cookies button has aria-current when view=cookies', async () => {
+ control.addTab({ url: 'https://example.com/', active: true });
+ mockSendMessage({ 'settings/get': () => makeSettings(), 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ expect(screen.getByRole('button', { name: 'Cookies' })).toHaveAttribute('aria-current', 'page');
+ });
+
+ it('non-active buttons do NOT have aria-current', async () => {
+ control.addTab({ url: 'https://example.com/', active: true });
+ mockSendMessage({ 'settings/get': () => makeSettings(), 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ // Profiles, Export, etc. should not have aria-current.
+ expect(screen.getByRole('button', { name: 'Profiles' })).not.toHaveAttribute('aria-current');
+ expect(screen.getByRole('button', { name: 'Settings' })).not.toHaveAttribute('aria-current');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Delete buttons aria-label
+// ---------------------------------------------------------------------------
+
+describe('Accessibility: cookie delete buttons have aria-label', () => {
+ it('each cookie delete button has a descriptive aria-label', async () => {
+ useStore.setState({ activeOrigin: 'https://example.com' });
+ const c1 = makeCookie({ name: 'session' });
+ const c2 = makeCookie({ name: 'csrf' });
+ mockSendMessage({ 'cookies/list': () => [c1, c2] });
+ render( );
+ await waitFor(() => screen.getByText('session'));
+ expect(screen.getByRole('button', { name: /Delete cookie session/i })).toBeInTheDocument();
+ expect(screen.getByRole('button', { name: /Delete cookie csrf/i })).toBeInTheDocument();
+ });
+});
+
+describe('Accessibility: profile delete buttons have aria-label', () => {
+ it('each profile delete button has a descriptive aria-label', async () => {
+ useStore.setState({ activeTabId: 1 });
+ const p = makeProfile({ name: 'admin session' });
+ mockSendMessage({ 'profiles/list': () => [p], 'snapshots/list': () => [] });
+ render( );
+ await waitFor(() => screen.getByText('admin session'));
+ expect(screen.getByRole('button', { name: /Delete profile admin session/i })).toBeInTheDocument();
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Inputs have labels
+// ---------------------------------------------------------------------------
+
+describe('Accessibility: form inputs have accessible labels', () => {
+ it('cookie search has a label', async () => {
+ useStore.setState({ activeOrigin: 'https://example.com' });
+ mockSendMessage({ 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => expect(screen.getByLabelText(/Search cookies/i)).toBeInTheDocument());
+ });
+
+ it('settings license key input has a label', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ });
+ render( );
+ await waitFor(() => expect(screen.getByLabelText(/License key/i)).toBeInTheDocument());
+ });
+
+ it('settings theme select has a label', async () => {
+ mockSendMessage({
+ 'entitlement/get': () => makeEntitlement(),
+ 'settings/get': () => makeSettings(),
+ });
+ render( );
+ await waitFor(() => expect(screen.getByLabelText(/Theme/i)).toBeInTheDocument());
+ });
+
+ it('cookie import textarea has an aria-label', async () => {
+ useStore.setState({ activeOrigin: 'https://example.com' });
+ mockSendMessage({ 'cookies/list': () => [] });
+ const { getByRole } = render( );
+ await waitFor(() => screen.getByText(/No cookies/i));
+ // Click Import to show the textarea.
+ const importBtn = screen.getByRole('button', { name: 'Import' });
+ importBtn.click();
+ await waitFor(() =>
+ expect(screen.getByRole('textbox', { name: /Cookie import JSON/i })).toBeInTheDocument()
+ );
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Export view aria-label on output textarea
+// ---------------------------------------------------------------------------
+
+describe('Accessibility: export output textarea has aria-label', () => {
+ it('export output area has an accessible name', async () => {
+ const { makeProfile: mp } = await import('./helpers');
+ const { ExportView } = await import('@/ui/views/ExportView');
+ const p = mp({ name: 'P' });
+ mockSendMessage({
+ 'profiles/list': () => [p],
+ 'entitlement/get': () => makeEntitlement(),
+ });
+ render( );
+ await waitFor(() =>
+ expect(screen.getByRole('textbox', { name: /Export output/i })).toBeInTheDocument()
+ );
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Nav has aria-label
+// ---------------------------------------------------------------------------
+
+describe('Accessibility: nav landmark has aria-label', () => {
+ it('nav element is labelled "Sections"', async () => {
+ control.addTab({ url: 'https://example.com/', active: true });
+ mockSendMessage({ 'settings/get': () => makeSettings(), 'cookies/list': () => [] });
+ render( );
+ await waitFor(() => expect(useStore.getState().settings).toBeTruthy());
+ expect(screen.getByRole('navigation', { name: /Sections/i })).toBeInTheDocument();
+ });
+});
diff --git a/tests/ui/helpers.tsx b/tests/ui/helpers.tsx
new file mode 100644
index 0000000..e17ca1d
--- /dev/null
+++ b/tests/ui/helpers.tsx
@@ -0,0 +1,128 @@
+/**
+ * Shared render helpers and mock factories for UI tests.
+ *
+ * Every test that renders a React component must start from a clean Zustand
+ * store so store mutations don't bleed between tests. We reset via the store's
+ * setState (internal Zustand API) rather than touching production code.
+ */
+
+import React from 'react';
+import { render, type RenderResult } from '@testing-library/react';
+import { vi } from 'vitest';
+import { useStore } from '@/state/store';
+
+// ---------------------------------------------------------------------------
+// jsdom matchMedia stub — install once per module (idempotent)
+// ---------------------------------------------------------------------------
+
+/**
+ * jsdom does not implement window.matchMedia. Call this in beforeAll() in any
+ * test file that renders components that use useTheme (or App, which uses it).
+ * It is idempotent: calling it twice is safe.
+ */
+export function stubMatchMedia(defaultMatches = false) {
+ if (!(window as Window & typeof globalThis & { _matchMediaStubbed?: boolean })._matchMediaStubbed) {
+ Object.defineProperty(window, 'matchMedia', {
+ writable: true,
+ configurable: true,
+ value: vi.fn().mockReturnValue({
+ matches: defaultMatches,
+ addEventListener: vi.fn(),
+ removeEventListener: vi.fn(),
+ }),
+ });
+ (window as Window & typeof globalThis & { _matchMediaStubbed?: boolean })._matchMediaStubbed = true;
+ }
+}
+import type { BgRequest, BgEnvelope, BgResponseMap } from '@/types/messages';
+import type { AppSettings } from '@/services/storage/settingsRepository';
+import {
+ makeProfile,
+ makeSnapshot,
+ makeEntitlement,
+ makeCookie,
+ makeStoreResult,
+} from '../harness/factories';
+
+export { makeProfile, makeSnapshot, makeEntitlement, makeCookie, makeStoreResult };
+
+// ---------------------------------------------------------------------------
+// Store reset — avoids cross-test state leakage
+// ---------------------------------------------------------------------------
+
+/** Reset the Zustand store to its initial state before each test. */
+export function resetStore() {
+ useStore.setState({
+ view: 'cookies',
+ activeOrigin: null,
+ activeTabId: null,
+ cookies: [],
+ profiles: [],
+ snapshots: [],
+ entitlement: null,
+ grantedOrigins: [],
+ settings: null,
+ loading: false,
+ error: null,
+ });
+}
+
+// ---------------------------------------------------------------------------
+// Default settings factory
+// ---------------------------------------------------------------------------
+
+export function makeSettings(over: Partial = {}): AppSettings {
+ return {
+ theme: 'system',
+ telemetryOptIn: false,
+ onboardingComplete: true,
+ grantedOrigins: [],
+ freeProfileLimit: 3,
+ ...over,
+ };
+}
+
+// ---------------------------------------------------------------------------
+// sendMessage mock helpers
+// ---------------------------------------------------------------------------
+
+type HandlerMap = {
+ [K in BgRequest['type']]?: (msg: Extract) => BgResponseMap[K];
+};
+
+/**
+ * Install a vi.spyOn mock for chrome.runtime.sendMessage that dispatches by
+ * message type. Unknown types resolve to {ok:false,error:'unhandled'}.
+ */
+export function mockSendMessage(handlers: HandlerMap) {
+ return vi.spyOn(chrome.runtime, 'sendMessage').mockImplementation(async (msg: unknown) => {
+ const m = msg as BgRequest;
+ const h = handlers[m.type as BgRequest['type']] as
+ | ((msg: BgRequest) => unknown)
+ | undefined;
+ if (!h) return { ok: false, error: `unhandled: ${m.type}` } as BgEnvelope;
+ try {
+ const value = await h(m as never);
+ return { ok: true, value } as BgEnvelope;
+ } catch (e) {
+ return { ok: false, error: String(e) } as BgEnvelope;
+ }
+ });
+}
+
+/** Shorthand: return a fixed value for one message type. */
+export function okFor(
+ _type: T,
+ value: BgResponseMap[T],
+): BgEnvelope {
+ return { ok: true, value };
+}
+
+// ---------------------------------------------------------------------------
+// Render wrapper
+// ---------------------------------------------------------------------------
+
+/** Render a component inside a plain React tree (no Router needed). */
+export function renderUI(ui: React.ReactElement): RenderResult {
+ return render(ui);
+}
diff --git a/tests/ui/store.test.ts b/tests/ui/store.test.ts
new file mode 100644
index 0000000..64e7ac5
--- /dev/null
+++ b/tests/ui/store.test.ts
@@ -0,0 +1,158 @@
+/**
+ * Tests for the Zustand UI store (src/state/store.ts).
+ * Validates every action updates only the expected slice of state.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import { useStore } from '@/state/store';
+import { resetStore, makeSettings, makeProfile, makeSnapshot, makeEntitlement, makeCookie } from './helpers';
+
+beforeEach(() => {
+ resetStore();
+});
+
+describe('store: initial state', () => {
+ it('starts with view=cookies', () => {
+ expect(useStore.getState().view).toBe('cookies');
+ });
+
+ it('starts with null active origin/tabId', () => {
+ const s = useStore.getState();
+ expect(s.activeOrigin).toBeNull();
+ expect(s.activeTabId).toBeNull();
+ });
+
+ it('starts with empty collections', () => {
+ const s = useStore.getState();
+ expect(s.cookies).toEqual([]);
+ expect(s.profiles).toEqual([]);
+ expect(s.snapshots).toEqual([]);
+ expect(s.grantedOrigins).toEqual([]);
+ });
+
+ it('starts with null entitlement and settings', () => {
+ const s = useStore.getState();
+ expect(s.entitlement).toBeNull();
+ expect(s.settings).toBeNull();
+ });
+
+ it('starts with loading=false and error=null', () => {
+ const s = useStore.getState();
+ expect(s.loading).toBe(false);
+ expect(s.error).toBeNull();
+ });
+});
+
+describe('store: setView', () => {
+ it('updates the view', () => {
+ useStore.getState().setView('profiles');
+ expect(useStore.getState().view).toBe('profiles');
+ });
+
+ it('can navigate to all valid views', () => {
+ const views = ['onboarding', 'cookies', 'profiles', 'export', 'siteAccess', 'settings', 'team', 'upgrade'] as const;
+ for (const v of views) {
+ useStore.getState().setView(v);
+ expect(useStore.getState().view).toBe(v);
+ }
+ });
+});
+
+describe('store: setActive', () => {
+ it('sets origin and tabId', () => {
+ useStore.getState().setActive('https://example.com', 42);
+ const s = useStore.getState();
+ expect(s.activeOrigin).toBe('https://example.com');
+ expect(s.activeTabId).toBe(42);
+ });
+
+ it('clears both to null', () => {
+ useStore.getState().setActive('https://example.com', 1);
+ useStore.getState().setActive(null, null);
+ const s = useStore.getState();
+ expect(s.activeOrigin).toBeNull();
+ expect(s.activeTabId).toBeNull();
+ });
+});
+
+describe('store: setCookies', () => {
+ it('replaces the cookie list', () => {
+ const c1 = makeCookie({ name: 'a' });
+ const c2 = makeCookie({ name: 'b' });
+ useStore.getState().setCookies([c1, c2]);
+ expect(useStore.getState().cookies).toEqual([c1, c2]);
+ });
+
+ it('replaces with an empty array', () => {
+ useStore.getState().setCookies([makeCookie()]);
+ useStore.getState().setCookies([]);
+ expect(useStore.getState().cookies).toEqual([]);
+ });
+});
+
+describe('store: setProfiles', () => {
+ it('replaces the profiles list', () => {
+ const p = makeProfile();
+ useStore.getState().setProfiles([p]);
+ expect(useStore.getState().profiles).toEqual([p]);
+ });
+});
+
+describe('store: setSnapshots', () => {
+ it('replaces the snapshots list', () => {
+ const s = makeSnapshot();
+ useStore.getState().setSnapshots([s]);
+ expect(useStore.getState().snapshots).toEqual([s]);
+ });
+});
+
+describe('store: setEntitlement', () => {
+ it('stores an entitlement', () => {
+ const e = makeEntitlement({ tier: 'pro' });
+ useStore.getState().setEntitlement(e);
+ expect(useStore.getState().entitlement).toEqual(e);
+ });
+
+ it('can be set to null', () => {
+ useStore.getState().setEntitlement(makeEntitlement());
+ useStore.getState().setEntitlement(null);
+ expect(useStore.getState().entitlement).toBeNull();
+ });
+});
+
+describe('store: setGrantedOrigins', () => {
+ it('replaces the granted origins list', () => {
+ useStore.getState().setGrantedOrigins(['https://example.com', 'https://other.com']);
+ expect(useStore.getState().grantedOrigins).toEqual(['https://example.com', 'https://other.com']);
+ });
+});
+
+describe('store: setSettings', () => {
+ it('stores settings', () => {
+ const s = makeSettings({ theme: 'dark' });
+ useStore.getState().setSettings(s);
+ expect(useStore.getState().settings).toEqual(s);
+ });
+
+ it('can be set to null', () => {
+ useStore.getState().setSettings(makeSettings());
+ useStore.getState().setSettings(null);
+ expect(useStore.getState().settings).toBeNull();
+ });
+});
+
+describe('store: setLoading / setError', () => {
+ it('toggles loading', () => {
+ useStore.getState().setLoading(true);
+ expect(useStore.getState().loading).toBe(true);
+ useStore.getState().setLoading(false);
+ expect(useStore.getState().loading).toBe(false);
+ });
+
+ it('sets and clears error', () => {
+ useStore.getState().setError('oops');
+ expect(useStore.getState().error).toBe('oops');
+ useStore.getState().setError(null);
+ expect(useStore.getState().error).toBeNull();
+ });
+});
diff --git a/tests/ui/useActiveTab.test.tsx b/tests/ui/useActiveTab.test.tsx
new file mode 100644
index 0000000..2f87b94
--- /dev/null
+++ b/tests/ui/useActiveTab.test.tsx
@@ -0,0 +1,117 @@
+/**
+ * Tests for useActiveTab hook (src/ui/hooks/useActiveTab.ts).
+ *
+ * The hook queries chrome.tabs and keeps the store in sync when the user
+ * activates or navigates a tab. The fakeChrome from the harness provides the
+ * events; we use control.addTab / control.triggerTabActivated to drive them.
+ */
+
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { renderHook, act, waitFor } from '@testing-library/react';
+import { useActiveTab } from '@/ui/hooks/useActiveTab';
+import { useStore } from '@/state/store';
+import { control } from '../harness/fakeChrome';
+import { resetStore } from './helpers';
+
+beforeEach(() => {
+ resetStore();
+ // control.reset() was already called by setup.ts beforeEach, but we also
+ // reset the store separately.
+});
+
+describe('useActiveTab: resolves active origin from chrome.tabs.query', () => {
+ it('sets activeOrigin to the origin of the active tab', async () => {
+ control.addTab({ url: 'https://example.com/dashboard', active: true });
+ const { result } = renderHook(() => useActiveTab());
+ await waitFor(() => expect(result.current.activeOrigin).toBe('https://example.com'));
+ });
+
+ it('sets activeTabId to the tab id', async () => {
+ const tab = control.addTab({ url: 'https://foo.com/', active: true });
+ const { result } = renderHook(() => useActiveTab());
+ await waitFor(() => expect(result.current.activeTabId).toBe(tab.id));
+ });
+
+ it('sets activeOrigin to null when no active tab has a url', async () => {
+ // No tabs seeded — query returns empty array.
+ const { result } = renderHook(() => useActiveTab());
+ await waitFor(() => expect(result.current.activeOrigin).toBeNull());
+ });
+
+ it('parses origin correctly (strips path)', async () => {
+ control.addTab({ url: 'https://app.example.com:8080/some/path?q=1', active: true });
+ const { result } = renderHook(() => useActiveTab());
+ await waitFor(() => expect(result.current.activeOrigin).toBe('https://app.example.com:8080'));
+ });
+});
+
+describe('useActiveTab: updates on tab-activated event', () => {
+ it('re-resolves when onActivated fires', async () => {
+ const tab1 = control.addTab({ url: 'https://first.com/', active: true, id: 10 });
+ const tab2 = control.addTab({ url: 'https://second.com/', active: false, id: 11 });
+
+ const { result } = renderHook(() => useActiveTab());
+ await waitFor(() => expect(result.current.activeOrigin).toBe('https://first.com'));
+
+ // Make tab2 active and fire the event.
+ tab1.active = false;
+ tab2.active = true;
+
+ act(() => {
+ control.triggerTabActivated(tab2.id);
+ });
+
+ await waitFor(() => expect(result.current.activeOrigin).toBe('https://second.com'));
+ });
+});
+
+describe('useActiveTab: updates on tab-updated event (status/url change)', () => {
+ it('re-resolves when onUpdated fires with status=complete', async () => {
+ const tab = control.addTab({ url: 'https://before.com/', active: true });
+ const { result } = renderHook(() => useActiveTab());
+ await waitFor(() => expect(result.current.activeOrigin).toBe('https://before.com'));
+
+ // Simulate navigation completion.
+ tab.url = 'https://after.com/';
+ act(() => {
+ chrome.tabs.onUpdated._emit(tab.id, { status: 'complete' }, tab as never);
+ });
+
+ await waitFor(() => expect(result.current.activeOrigin).toBe('https://after.com'));
+ });
+
+ it('ignores updates that have neither status nor url', async () => {
+ const querySpy = vi.spyOn(chrome.tabs, 'query');
+ control.addTab({ url: 'https://stable.com/', active: true });
+ const { result } = renderHook(() => useActiveTab());
+ await waitFor(() => expect(result.current.activeOrigin).toBe('https://stable.com'));
+
+ const callsBefore = querySpy.mock.calls.length;
+ act(() => {
+ chrome.tabs.onUpdated._emit(1, {}, {} as never);
+ });
+ // No additional query should fire (the hook only re-resolves for status/url).
+ expect(querySpy.mock.calls.length).toBe(callsBefore);
+ });
+});
+
+describe('useActiveTab: cleanup on unmount', () => {
+ it('removes listeners on unmount', async () => {
+ control.addTab({ url: 'https://example.com/', active: true });
+ const { unmount, result } = renderHook(() => useActiveTab());
+ await waitFor(() => expect(result.current.activeOrigin).toBeTruthy());
+
+ // Spy on removeListener; call count should increase on unmount.
+ const onActivatedRemove = vi.spyOn(chrome.tabs.onActivated, 'removeListener');
+ unmount();
+ expect(onActivatedRemove).toHaveBeenCalledTimes(1);
+ });
+});
+
+describe('useActiveTab: also updates the store', () => {
+ it('reflects activeOrigin in the Zustand store', async () => {
+ control.addTab({ url: 'https://store-check.com/', active: true });
+ renderHook(() => useActiveTab());
+ await waitFor(() => expect(useStore.getState().activeOrigin).toBe('https://store-check.com'));
+ });
+});
diff --git a/tests/ui/useBackground.test.tsx b/tests/ui/useBackground.test.tsx
new file mode 100644
index 0000000..5efac1b
--- /dev/null
+++ b/tests/ui/useBackground.test.tsx
@@ -0,0 +1,145 @@
+/**
+ * Tests for useBackground hook (src/ui/hooks/useBackground.ts).
+ *
+ * The hook wraps chrome.runtime.sendMessage calls in loading/error state and
+ * unwraps the BgEnvelope. All chrome interactions are mocked.
+ */
+
+import { describe, it, expect, vi, beforeEach } from 'vitest';
+import { renderHook, act } from '@testing-library/react';
+import { useBackground } from '@/ui/hooks/useBackground';
+import { resetStore } from './helpers';
+
+beforeEach(() => {
+ resetStore();
+});
+
+describe('useBackground: ok envelope → value', () => {
+ it('returns the unwrapped value on ok:true', async () => {
+ vi.spyOn(chrome.runtime, 'sendMessage').mockResolvedValue({ ok: true, value: 'hello' });
+ const { result } = renderHook(() => useBackground());
+ let val: unknown;
+ await act(async () => {
+ val = await result.current.call({ type: 'settings/get' } as never);
+ });
+ expect(val).toBe('hello');
+ });
+
+ it('clears the error state on a successful call', async () => {
+ // First call fails, second succeeds — error should be cleared.
+ vi.spyOn(chrome.runtime, 'sendMessage')
+ .mockResolvedValueOnce({ ok: false, error: 'boom' })
+ .mockResolvedValueOnce({ ok: true, value: 42 });
+ const { result } = renderHook(() => useBackground());
+ await act(async () => { await result.current.call({ type: 'settings/get' } as never); });
+ expect(result.current.error).toBe('boom');
+ await act(async () => { await result.current.call({ type: 'settings/get' } as never); });
+ expect(result.current.error).toBeNull();
+ });
+});
+
+describe('useBackground: error envelope → null + error state', () => {
+ it('returns null when ok:false', async () => {
+ vi.spyOn(chrome.runtime, 'sendMessage').mockResolvedValue({ ok: false, error: 'bad call' });
+ const { result } = renderHook(() => useBackground());
+ let val: unknown;
+ await act(async () => {
+ val = await result.current.call({ type: 'settings/get' } as never);
+ });
+ expect(val).toBeNull();
+ });
+
+ it('sets error string when ok:false', async () => {
+ vi.spyOn(chrome.runtime, 'sendMessage').mockResolvedValue({ ok: false, error: 'bad call' });
+ const { result } = renderHook(() => useBackground());
+ await act(async () => { await result.current.call({ type: 'settings/get' } as never); });
+ expect(result.current.error).toBe('bad call');
+ });
+
+ it('handles a missing error field gracefully', async () => {
+ vi.spyOn(chrome.runtime, 'sendMessage').mockResolvedValue({ ok: false });
+ const { result } = renderHook(() => useBackground());
+ await act(async () => { await result.current.call({ type: 'settings/get' } as never); });
+ expect(result.current.error).toBe('Unknown error');
+ });
+
+ it('returns null when sendMessage resolves undefined (no background listener)', async () => {
+ vi.spyOn(chrome.runtime, 'sendMessage').mockResolvedValue(undefined);
+ const { result } = renderHook(() => useBackground());
+ let val: unknown;
+ await act(async () => {
+ val = await result.current.call({ type: 'settings/get' } as never);
+ });
+ expect(val).toBeNull();
+ });
+});
+
+describe('useBackground: loading flag', () => {
+ it('is true during an in-flight call and false after', async () => {
+ let resolveMsg!: (v: unknown) => void;
+ vi.spyOn(chrome.runtime, 'sendMessage').mockReturnValue(
+ new Promise((r) => { resolveMsg = r; })
+ );
+ const { result } = renderHook(() => useBackground());
+ // Start call without awaiting
+ let callPromise: Promise;
+ act(() => { callPromise = result.current.call({ type: 'settings/get' } as never); });
+ // loading should be true now
+ expect(result.current.loading).toBe(true);
+ // Resolve and await
+ await act(async () => {
+ resolveMsg({ ok: true, value: 'x' });
+ await callPromise!;
+ });
+ expect(result.current.loading).toBe(false);
+ });
+});
+
+describe('useBackground: concurrent calls — loading counter', () => {
+ it('does not turn loading off until the last call resolves', async () => {
+ const resolvers: Array<(v: unknown) => void> = [];
+ vi.spyOn(chrome.runtime, 'sendMessage').mockImplementation(() =>
+ new Promise((r) => resolvers.push(r))
+ );
+ const { result } = renderHook(() => useBackground());
+
+ let p1: Promise, p2: Promise;
+ act(() => {
+ p1 = result.current.call({ type: 'settings/get' } as never);
+ p2 = result.current.call({ type: 'settings/get' } as never);
+ });
+ expect(result.current.loading).toBe(true);
+
+ // Resolve first — loading should still be true (second is in flight).
+ await act(async () => {
+ resolvers[0]!({ ok: true, value: 1 });
+ await p1!;
+ });
+ expect(result.current.loading).toBe(true);
+
+ // Resolve second — now loading drops.
+ await act(async () => {
+ resolvers[1]!({ ok: true, value: 2 });
+ await p2!;
+ });
+ expect(result.current.loading).toBe(false);
+ });
+});
+
+describe('useBackground: call referential stability', () => {
+ it('call is the same function reference across renders', () => {
+ const { result, rerender } = renderHook(() => useBackground());
+ const first = result.current.call;
+ rerender();
+ expect(result.current.call).toBe(first);
+ });
+});
+
+describe('useBackground: thrown error', () => {
+ it('sets error when sendMessage throws', async () => {
+ vi.spyOn(chrome.runtime, 'sendMessage').mockRejectedValue(new Error('network failure'));
+ const { result } = renderHook(() => useBackground());
+ await act(async () => { await result.current.call({ type: 'settings/get' } as never); });
+ expect(result.current.error).toContain('network failure');
+ });
+});
diff --git a/tests/ui/useTheme.test.tsx b/tests/ui/useTheme.test.tsx
new file mode 100644
index 0000000..83ee947
--- /dev/null
+++ b/tests/ui/useTheme.test.tsx
@@ -0,0 +1,130 @@
+/**
+ * Tests for useTheme hook (src/ui/hooks/useTheme.ts).
+ *
+ * The hook toggles the 'dark' class on document.documentElement based on the
+ * theme setting. 'system' defers to window.matchMedia.
+ */
+
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+import { renderHook, act } from '@testing-library/react';
+import { useTheme } from '@/ui/hooks/useTheme';
+
+// jsdom doesn't implement matchMedia. Provide a writable stub that individual
+// tests can override via vi.spyOn.
+
+function makeMatchMedia(matches: boolean) {
+ let changeListeners: Array<(e: { matches: boolean }) => void> = [];
+ // Use a plain object so we can mutate `matches` when _trigger is called.
+ const mql: {
+ matches: boolean;
+ addEventListener: ReturnType;
+ removeEventListener: ReturnType;
+ _trigger: (m: boolean) => void;
+ } = {
+ matches,
+ addEventListener: vi.fn((_type: string, cb: (e: { matches: boolean }) => void) => {
+ changeListeners.push(cb);
+ }),
+ removeEventListener: vi.fn((_type: string, cb: (e: { matches: boolean }) => void) => {
+ changeListeners = changeListeners.filter((l) => l !== cb);
+ }),
+ _trigger: (newMatches: boolean) => {
+ mql.matches = newMatches;
+ changeListeners.forEach((cb) => cb({ matches: newMatches }));
+ },
+ };
+ return mql;
+}
+
+// Default (non-matching) MQL stub used for dark/light tests.
+const defaultMql = makeMatchMedia(false);
+
+let currentMql: ReturnType;
+
+beforeEach(() => {
+ // Install a default stub so the hook doesn't throw even when theme is
+ // 'dark' or 'light' (the hook always calls matchMedia unconditionally).
+ Object.defineProperty(window, 'matchMedia', {
+ writable: true,
+ configurable: true,
+ value: vi.fn().mockReturnValue(defaultMql),
+ });
+ // Ensure document.documentElement starts without 'dark'.
+ document.documentElement.classList.remove('dark');
+});
+
+afterEach(() => {
+ document.documentElement.classList.remove('dark');
+});
+
+describe('useTheme: dark theme', () => {
+ it("adds 'dark' class to documentElement when theme is 'dark'", () => {
+ renderHook(() => useTheme('dark'));
+ expect(document.documentElement.classList.contains('dark')).toBe(true);
+ });
+});
+
+describe('useTheme: light theme', () => {
+ it("removes 'dark' class when theme is 'light'", () => {
+ document.documentElement.classList.add('dark');
+ renderHook(() => useTheme('light'));
+ expect(document.documentElement.classList.contains('dark')).toBe(false);
+ });
+});
+
+describe('useTheme: system theme — matchMedia dark', () => {
+ it("adds 'dark' when system prefers dark", () => {
+ currentMql = makeMatchMedia(true);
+ vi.spyOn(window, 'matchMedia').mockReturnValue(currentMql as unknown as MediaQueryList);
+ renderHook(() => useTheme('system'));
+ expect(document.documentElement.classList.contains('dark')).toBe(true);
+ });
+
+ it("removes 'dark' when system prefers light", () => {
+ document.documentElement.classList.add('dark');
+ currentMql = makeMatchMedia(false);
+ vi.spyOn(window, 'matchMedia').mockReturnValue(currentMql as unknown as MediaQueryList);
+ renderHook(() => useTheme('system'));
+ expect(document.documentElement.classList.contains('dark')).toBe(false);
+ });
+});
+
+describe('useTheme: system theme — follows matchMedia changes', () => {
+ it("toggles 'dark' when the system preference changes", () => {
+ currentMql = makeMatchMedia(false);
+ vi.spyOn(window, 'matchMedia').mockReturnValue(currentMql as unknown as MediaQueryList);
+ renderHook(() => useTheme('system'));
+ expect(document.documentElement.classList.contains('dark')).toBe(false);
+
+ act(() => { currentMql._trigger(true); });
+ expect(document.documentElement.classList.contains('dark')).toBe(true);
+
+ act(() => { currentMql._trigger(false); });
+ expect(document.documentElement.classList.contains('dark')).toBe(false);
+ });
+});
+
+describe('useTheme: cleanup', () => {
+ it('removes the matchMedia listener on unmount', () => {
+ currentMql = makeMatchMedia(false);
+ vi.spyOn(window, 'matchMedia').mockReturnValue(currentMql as unknown as MediaQueryList);
+ const { unmount } = renderHook(() => useTheme('system'));
+ unmount();
+ expect(currentMql.removeEventListener).toHaveBeenCalledTimes(1);
+ });
+
+ it('does not add a listener when theme is dark (not system)', () => {
+ currentMql = makeMatchMedia(false);
+ vi.spyOn(window, 'matchMedia').mockReturnValue(currentMql as unknown as MediaQueryList);
+ renderHook(() => useTheme('dark'));
+ expect(currentMql.addEventListener).not.toHaveBeenCalled();
+ });
+});
+
+describe('useTheme: undefined theme', () => {
+ it('does not throw and does not mutate classList when theme is undefined', () => {
+ document.documentElement.classList.remove('dark');
+ expect(() => renderHook(() => useTheme(undefined))).not.toThrow();
+ expect(document.documentElement.classList.contains('dark')).toBe(false);
+ });
+});
diff --git a/tests/worker/worker.test.ts b/tests/worker/worker.test.ts
new file mode 100644
index 0000000..f87bd03
--- /dev/null
+++ b/tests/worker/worker.test.ts
@@ -0,0 +1,555 @@
+/**
+ * Tests for the Cloudflare Worker (worker/src/index.ts).
+ *
+ * CONTRACTS.md §7 is the authoritative key-format spec.
+ * Format: base64url(JSON payload) + "." + base64url(Ed25519 sig over payload bytes)
+ *
+ * These tests fail cleanly now (mintLicenseKey throws "not_implemented") and
+ * pass only when correctly implemented. We NEVER assert the "not_implemented"
+ * error — we assert the business contract.
+ *
+ * The worker runs in the same Node 22 environment as the extension tests;
+ * crypto.subtle is the real WebCrypto implementation.
+ *
+ * INTEROP CONTRACT (CONTRACTS §7):
+ * - mintLicenseKey(pkcs8PrivBase64, payload) must produce a key that
+ * verifyLicenseKey (extension) can verify with the matching public key.
+ * - Both sides encode the same payload JSON, sign the same UTF-8 bytes, and
+ * produce/verify the same base64url(sig) segment.
+ *
+ * Production seam required: mintLicenseKey must accept the PKCS8 private key
+ * as a base64-standard (not base64url) string. The public key must be exportable
+ * as raw 32-byte base64-standard for use with setLicensePublicKey on the extension
+ * side. This is already the assumption in the extension tests.
+ */
+
+import { describe, it, expect, beforeEach } from 'vitest';
+import workerDefault, { mintLicenseKey } from '../../worker/src/index.ts';
+
+// ---------------------------------------------------------------------------
+// Crypto helpers — mirror the extension test helpers exactly for interop
+// ---------------------------------------------------------------------------
+
+function toBase64Url(buf: ArrayBuffer | Uint8Array): string {
+ const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
+ return Buffer.from(bytes).toString('base64url');
+}
+
+function fromBase64Url(s: string): Uint8Array {
+ return new Uint8Array(Buffer.from(s, 'base64url'));
+}
+
+function toBase64(buf: ArrayBuffer | Uint8Array): string {
+ const bytes = buf instanceof Uint8Array ? buf : new Uint8Array(buf);
+ return Buffer.from(bytes).toString('base64');
+}
+
+function fromBase64(s: string): Uint8Array {
+ return new Uint8Array(Buffer.from(s, 'base64'));
+}
+
+interface KeyPair {
+ privateKey: CryptoKey;
+ publicKey: CryptoKey;
+ /** Raw 32-byte public key, base64-standard encoded. */
+ publicKeyBase64: string;
+ /** PKCS8 private key, base64-standard encoded. */
+ privateKeyBase64: string;
+}
+
+async function generateKeyPair(): Promise {
+ const kp = await crypto.subtle.generateKey({ name: 'Ed25519' }, true, ['sign', 'verify']);
+ const rawPub = await crypto.subtle.exportKey('raw', kp.publicKey);
+ const pkcs8Priv = await crypto.subtle.exportKey('pkcs8', kp.privateKey);
+ return {
+ privateKey: kp.privateKey,
+ publicKey: kp.publicKey,
+ publicKeyBase64: toBase64(rawPub),
+ privateKeyBase64: toBase64(pkcs8Priv),
+ };
+}
+
+/** Re-import the public key from raw bytes for direct crypto.subtle.verify calls. */
+async function importPublicKeyRaw(rawBase64: string): Promise {
+ const rawBytes = fromBase64(rawBase64);
+ return crypto.subtle.importKey('raw', rawBytes, { name: 'Ed25519' }, false, ['verify']);
+}
+
+// Minimal Env for the worker fetch handler
+function makeEnv(overrides: Partial> = {}): Record {
+ return {
+ STRIPE_SECRET_KEY: 'sk_test_placeholder',
+ STRIPE_WEBHOOK_SECRET: 'whsec_placeholder',
+ LICENSE_SIGNING_KEY: 'test-signing-key',
+ PRO_PRICE_ID: 'price_test_placeholder',
+ SUCCESS_URL: 'https://example.com/success',
+ CANCEL_URL: 'https://example.com/cancel',
+ ...overrides,
+ };
+}
+
+// ---------------------------------------------------------------------------
+// Setup
+// ---------------------------------------------------------------------------
+
+let kp: KeyPair;
+
+beforeEach(async () => {
+ kp = await generateKeyPair();
+});
+
+// ---------------------------------------------------------------------------
+// §7: mintLicenseKey — format
+// ---------------------------------------------------------------------------
+
+describe('mintLicenseKey — key format', () => {
+ it('returns a string with exactly one dot separator', async () => {
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'user-1',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const parts = key.split('.');
+ expect(parts).toHaveLength(2);
+ });
+
+ it('both segments are non-empty', async () => {
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'user-2',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const [payloadB64u, sigB64u] = key.split('.');
+ expect(payloadB64u.length).toBeGreaterThan(0);
+ expect(sigB64u.length).toBeGreaterThan(0);
+ });
+
+ it('both segments use base64url encoding (no +, /, or = characters)', async () => {
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'user-3',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const [payloadB64u, sigB64u] = key.split('.');
+ expect(payloadB64u).not.toMatch(/[+/=]/);
+ expect(sigB64u).not.toMatch(/[+/=]/);
+ });
+
+ it('payload segment decodes to valid JSON with subjectId, tier, issuedAt', async () => {
+ const issuedAt = '2026-01-01T00:00:00.000Z';
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'json-check',
+ tier: 'pro',
+ issuedAt,
+ });
+
+ const [payloadB64u] = key.split('.');
+ const payloadBytes = fromBase64Url(payloadB64u);
+ const payload = JSON.parse(new TextDecoder().decode(payloadBytes));
+
+ expect(payload.subjectId).toBe('json-check');
+ expect(payload.tier).toBe('pro');
+ expect(payload.issuedAt).toBe(issuedAt);
+ });
+
+ it('includes validUntil in the payload when provided', async () => {
+ const validUntil = '2027-01-01T00:00:00.000Z';
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'expiry-user',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ validUntil,
+ } as Parameters[1] & { validUntil?: string });
+
+ const [payloadB64u] = key.split('.');
+ const payload = JSON.parse(new TextDecoder().decode(fromBase64Url(payloadB64u)));
+
+ expect(payload.validUntil).toBe(validUntil);
+ });
+
+ it('signature segment decodes to exactly 64 bytes (Ed25519 signature size)', async () => {
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'sig-size',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const [, sigB64u] = key.split('.');
+ const sigBytes = fromBase64Url(sigB64u);
+ expect(sigBytes.byteLength).toBe(64);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// §7 INTEROP: signature verifies with matching public key via crypto.subtle
+// ---------------------------------------------------------------------------
+
+describe('mintLicenseKey — signature verification (CONTRACTS §7 interop)', () => {
+ it('signature verifies with the matching public key via crypto.subtle.verify', async () => {
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'interop-1',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const [payloadB64u, sigB64u] = key.split('.');
+ const payloadBytes = fromBase64Url(payloadB64u);
+ const sigBytes = fromBase64Url(sigB64u);
+
+ const pubKey = await importPublicKeyRaw(kp.publicKeyBase64);
+ const ok = await crypto.subtle.verify('Ed25519', pubKey, sigBytes, payloadBytes);
+
+ expect(ok).toBe(true);
+ });
+
+ it('signature is over the UTF-8 payload bytes (not the base64url string)', async () => {
+ // This test documents and enforces that the sig covers payload bytes, not
+ // the base64url-encoded representation.
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'bytes-contract',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const [payloadB64u, sigB64u] = key.split('.');
+ const payloadBytes = fromBase64Url(payloadB64u);
+ const sigBytes = fromBase64Url(sigB64u);
+
+ // Re-encode the payload to its base64url string and attempt to verify
+ // against THAT string (wrong: the verifier should use the raw bytes).
+ const payloadB64uBytes = new TextEncoder().encode(payloadB64u);
+ const pubKey = await importPublicKeyRaw(kp.publicKeyBase64);
+
+ const wrongOk = await crypto.subtle.verify('Ed25519', pubKey, sigBytes, payloadB64uBytes);
+ const rightOk = await crypto.subtle.verify('Ed25519', pubKey, sigBytes, payloadBytes);
+
+ // Either the implementation uses bytes (rightOk=true, wrongOk=false)
+ // or it fails entirely (both false — caught by the previous test).
+ // Crucially, if wrongOk is true, the implementation is signing the wrong thing.
+ if (rightOk) {
+ expect(wrongOk).toBe(false);
+ }
+ });
+
+ it('produces a different key for different subjectIds (determinism sanity)', async () => {
+ const key1 = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'alice',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+ const key2 = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'bob',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ expect(key1).not.toBe(key2);
+ });
+
+ it('a key signed by one private key does NOT verify with a different public key', async () => {
+ const kp2 = await generateKeyPair();
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'wrong-key',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const [payloadB64u, sigB64u] = key.split('.');
+ const payloadBytes = fromBase64Url(payloadB64u);
+ const sigBytes = fromBase64Url(sigB64u);
+
+ // Verify with kp2's public key (should fail)
+ const kp2PubKey = await importPublicKeyRaw(kp2.publicKeyBase64);
+ const ok = await crypto.subtle.verify('Ed25519', kp2PubKey, sigBytes, payloadBytes);
+
+ expect(ok).toBe(false);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// §7 INTEROP: extension round-trip (mint in worker, verify in extension)
+// ---------------------------------------------------------------------------
+
+describe('INTEROP: worker mints, extension verifies', () => {
+ it('verifyLicenseKey accepts a key minted by mintLicenseKey', async () => {
+ // Import the verifier here to test the interop contract end-to-end.
+ const { verifyLicenseKey, setLicensePublicKey } = await import(
+ '../../src/services/licensing/licenseVerifier.ts'
+ );
+
+ setLicensePublicKey(kp.publicKeyBase64);
+
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'interop-roundtrip',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).not.toBeNull();
+ expect(result!.subjectId).toBe('interop-roundtrip');
+ expect(result!.tier).toBe('pro');
+ });
+
+ it('verifyLicenseKey rejects a key minted by a different private key', async () => {
+ const { verifyLicenseKey, setLicensePublicKey } = await import(
+ '../../src/services/licensing/licenseVerifier.ts'
+ );
+
+ // Verifier holds kp's public key, but we mint with kp2's private key
+ setLicensePublicKey(kp.publicKeyBase64);
+
+ const kp2 = await generateKeyPair();
+ const key = await mintLicenseKey(kp2.privateKeyBase64, {
+ subjectId: 'wrong-pair',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const result = await verifyLicenseKey(key);
+ expect(result).toBeNull();
+ });
+
+ it('verifyLicenseKey rejects a tampered key (payload byte flipped)', async () => {
+ const { verifyLicenseKey, setLicensePublicKey } = await import(
+ '../../src/services/licensing/licenseVerifier.ts'
+ );
+
+ setLicensePublicKey(kp.publicKeyBase64);
+
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'tamper-interop',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ });
+
+ const [payloadB64u, sigB64u] = key.split('.');
+ const payloadBytes = fromBase64Url(payloadB64u);
+ payloadBytes[0] ^= 0x01;
+ const tamperedKey = `${toBase64Url(payloadBytes)}.${sigB64u}`;
+
+ const result = await verifyLicenseKey(tamperedKey);
+ expect(result).toBeNull();
+ });
+
+ it('round-trip preserves subjectId, tier, and validUntil', async () => {
+ const { verifyLicenseKey, setLicensePublicKey } = await import(
+ '../../src/services/licensing/licenseVerifier.ts'
+ );
+
+ setLicensePublicKey(kp.publicKeyBase64);
+
+ const validUntil = new Date(Date.now() + 90 * 24 * 60 * 60 * 1000).toISOString();
+ const key = await mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'full-roundtrip',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ validUntil,
+ } as Parameters[1] & { validUntil?: string });
+
+ const result = await verifyLicenseKey(key);
+
+ expect(result).not.toBeNull();
+ expect(result!.subjectId).toBe('full-roundtrip');
+ expect(result!.tier).toBe('pro');
+ expect(result!.validUntil).toBe(validUntil);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Worker fetch handler: GET /health
+// ---------------------------------------------------------------------------
+
+describe('Worker fetch handler — GET /health', () => {
+ it('returns 200 with {ok:true}', async () => {
+ const req = new Request('https://worker.example.com/health', { method: 'GET' });
+ const res = await workerDefault.fetch(req, makeEnv() as never);
+
+ expect(res.status).toBe(200);
+ const body = await res.json();
+ expect(body).toEqual({ ok: true });
+ });
+
+ it('returns JSON content-type', async () => {
+ const req = new Request('https://worker.example.com/health', { method: 'GET' });
+ const res = await workerDefault.fetch(req, makeEnv() as never);
+
+ expect(res.headers.get('content-type')).toContain('application/json');
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Worker fetch handler: POST /checkout
+// ---------------------------------------------------------------------------
+
+describe('Worker fetch handler — POST /checkout', () => {
+ it('calls Stripe and returns {checkoutUrl} (stub global fetch)', async () => {
+ const fakeStripeUrl = 'https://checkout.stripe.com/pay/cs_test_abc';
+ const originalFetch = globalThis.fetch;
+ globalThis.fetch = async (_url: RequestInfo | URL, _init?: RequestInit) => {
+ // Stripe API responds with a Checkout session object
+ return new Response(
+ JSON.stringify({ id: 'cs_test_abc', url: fakeStripeUrl }),
+ { status: 200, headers: { 'content-type': 'application/json' } },
+ );
+ };
+
+ try {
+ const req = new Request('https://worker.example.com/checkout', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ customerId: 'cus_test' }),
+ });
+ const res = await workerDefault.fetch(req, makeEnv() as never);
+
+ expect(res.status).toBe(200);
+ const body = (await res.json()) as Record;
+ expect(body).toHaveProperty('checkoutUrl');
+ expect(typeof body.checkoutUrl).toBe('string');
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+ });
+
+ it('does not return 501 when implemented (fails now — correct until implemented)', async () => {
+ // This test documents that the current stub returns 501 and the contract
+ // requires 200. When implemented, 501 must become 200.
+ const originalFetch = globalThis.fetch;
+ globalThis.fetch = async () =>
+ new Response(JSON.stringify({ id: 'cs_x', url: 'https://checkout.stripe.com/x' }), {
+ status: 200,
+ headers: { 'content-type': 'application/json' },
+ });
+
+ try {
+ const req = new Request('https://worker.example.com/checkout', {
+ method: 'POST',
+ body: '{}',
+ });
+ const res = await workerDefault.fetch(req, makeEnv() as never);
+
+ // This will fail with 501 until implemented (clean assertion failure).
+ expect(res.status).toBe(200);
+ } finally {
+ globalThis.fetch = originalFetch;
+ }
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Worker fetch handler: POST /webhook
+// ---------------------------------------------------------------------------
+
+describe('Worker fetch handler — POST /webhook', () => {
+ it('verifies Stripe signature and mints a key on checkout.session.completed', async () => {
+ // The webhook handler must: verify the stripe-signature header, read
+ // checkout.session.completed event, mint a key, and return it.
+ // We stub the Stripe signature verification by providing a fake event body.
+ // The specific verification implementation is opaque to this test — what
+ // matters is the response shape when verification "succeeds".
+ //
+ // Because Stripe signature verification requires the raw body + timestamp,
+ // a minimal compliant test stubs the entire validation so that the handler
+ // is exercised. The exact stub mechanism depends on the implementation.
+ // For now, we test the response contract.
+
+ const stripeEvent = JSON.stringify({
+ type: 'checkout.session.completed',
+ data: {
+ object: {
+ customer_email: 'buyer@example.com',
+ client_reference_id: 'user-stripe-123',
+ payment_status: 'paid',
+ },
+ },
+ });
+
+ const req = new Request('https://worker.example.com/webhook', {
+ method: 'POST',
+ headers: {
+ 'content-type': 'application/json',
+ 'stripe-signature': 't=1234567890,v1=fake-sig',
+ },
+ body: stripeEvent,
+ });
+
+ const res = await workerDefault.fetch(req, makeEnv({
+ LICENSE_SIGNING_KEY: kp.privateKeyBase64,
+ }) as never);
+
+ // The contract: on success, return 200 with a minted license key or at
+ // minimum acknowledge receipt. On stub, 501 is returned — this fails cleanly.
+ expect(res.status).toBe(200);
+ });
+
+ it('returns non-2xx when stripe-signature is missing', async () => {
+ const req = new Request('https://worker.example.com/webhook', {
+ method: 'POST',
+ headers: { 'content-type': 'application/json' },
+ body: JSON.stringify({ type: 'checkout.session.completed' }),
+ });
+
+ const res = await workerDefault.fetch(req, makeEnv() as never);
+
+ // Missing signature → 400 or 401. The stub returns 501 (not_implemented);
+ // a correct implementation must return a 4xx for invalid/missing signatures.
+ // This test fails cleanly on the stub (501 is not 4xx) and passes only
+ // when the handler correctly validates the stripe-signature header.
+ expect(res.status).toBeGreaterThanOrEqual(400);
+ expect(res.status).toBeLessThan(500); // not 5xx — must be a 4xx client error
+ });
+
+ it('returns 404 for unknown routes', async () => {
+ const req = new Request('https://worker.example.com/unknown-route', { method: 'GET' });
+ const res = await workerDefault.fetch(req, makeEnv() as never);
+
+ expect(res.status).toBe(404);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// mintLicenseKey — edge cases
+// ---------------------------------------------------------------------------
+
+describe('mintLicenseKey — edge cases', () => {
+ it('throws or rejects for an empty private key string', async () => {
+ await expect(
+ mintLicenseKey('', {
+ subjectId: 'bad',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ }),
+ ).rejects.toThrow();
+ });
+
+ it('throws or rejects for a non-PKCS8 key string', async () => {
+ await expect(
+ mintLicenseKey('not-a-real-key-base64', {
+ subjectId: 'bad2',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ }),
+ ).rejects.toThrow();
+ });
+
+ it('produces different outputs for different subjectIds (no collision)', async () => {
+ const [k1, k2] = await Promise.all([
+ mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'alice',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ }),
+ mintLicenseKey(kp.privateKeyBase64, {
+ subjectId: 'bob',
+ tier: 'pro',
+ issuedAt: '2026-01-01T00:00:00.000Z',
+ }),
+ ]);
+
+ expect(k1).not.toBe(k2);
+ });
+});
diff --git a/vitest.config.ts b/vitest.config.ts
new file mode 100644
index 0000000..df6bb05
--- /dev/null
+++ b/vitest.config.ts
@@ -0,0 +1,25 @@
+import { defineConfig } from 'vitest/config';
+import { fileURLToPath } from 'node:url';
+
+// Vitest config for the extension's unit + integration tests.
+// E2E (Playwright) lives separately under e2e/ and runs via `npm run test:e2e`.
+export default defineConfig({
+ resolve: {
+ alias: {
+ '@': fileURLToPath(new URL('./src', import.meta.url)),
+ },
+ },
+ test: {
+ globals: true,
+ environment: 'jsdom',
+ setupFiles: ['./tests/setup.ts'],
+ include: ['tests/**/*.test.{ts,tsx}'],
+ exclude: ['e2e/**', 'node_modules/**', '.output/**', '.wxt/**'],
+ coverage: {
+ provider: 'v8',
+ include: ['src/**/*.{ts,tsx}', 'worker/src/**/*.ts'],
+ exclude: ['src/entrypoints/**/main.tsx', 'src/entrypoints/**/*.html', '**/*.d.ts'],
+ reporter: ['text-summary', 'html'],
+ },
+ },
+});
diff --git a/worker/src/index.ts b/worker/src/index.ts
index 2d61899..81c44b7 100644
--- a/worker/src/index.ts
+++ b/worker/src/index.ts
@@ -53,10 +53,20 @@ async function handleStripeWebhook(_request: Request, _env: Env): Promise {
// TODO: crypto.subtle.importKey('pkcs8', ...Ed25519) + sign(payload).
throw new Error('not_implemented: mintLicenseKey');
From ae946ebcb2536246305e07a486d976cdd368ec34 Mon Sep 17 00:00:00 2001
From: Murraylr
Date: Fri, 5 Jun 2026 22:11:42 -0400
Subject: [PATCH 04/33] Add test seams: takeSnapshot domainScope, key cache
reset, isPaidTier
Co-Authored-By: Claude Opus 4.8 (1M context)
---
src/services/crypto/keyManager.ts | 9 +++++++++
src/services/crypto/passphrase.ts | 8 ++++++++
src/services/licensing/entitlementService.ts | 7 ++++++-
src/services/profiles/snapshotService.ts | 7 ++++++-
4 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/src/services/crypto/keyManager.ts b/src/services/crypto/keyManager.ts
index e52b3f0..e6d36d6 100644
--- a/src/services/crypto/keyManager.ts
+++ b/src/services/crypto/keyManager.ts
@@ -21,3 +21,12 @@ export async function isPassphraseSet(): Promise {
export function isUnlocked(): boolean {
throw new NotImplementedError('crypto/keyManager.isUnlocked');
}
+
+/**
+ * Test seam: clear any in-memory key cache so the next getOrCreateDataKey()
+ * reloads from storage. Lets tests prove the key is actually persisted (not just
+ * memoized). The real implementation wires this to its module cache.
+ */
+export function _resetCacheForTesting(): void {
+ // no-op until implemented; see contract in tests/CONTRACTS.md §6.
+}
diff --git a/src/services/crypto/passphrase.ts b/src/services/crypto/passphrase.ts
index b9c5a4e..667dcfa 100644
--- a/src/services/crypto/passphrase.ts
+++ b/src/services/crypto/passphrase.ts
@@ -22,3 +22,11 @@ export async function setPassphrase(_passphrase: string): Promise {
export async function unlockWithPassphrase(_passphrase: string): Promise {
throw new NotImplementedError('crypto/passphrase.unlockWithPassphrase');
}
+
+/**
+ * Test seam: clear in-memory unlocked-key state so locked/unlocked behaviour can
+ * be exercised deterministically across cases. Real impl wires its module cache.
+ */
+export function _resetCacheForTesting(): void {
+ // no-op until implemented.
+}
diff --git a/src/services/licensing/entitlementService.ts b/src/services/licensing/entitlementService.ts
index e46f2d4..052ad2e 100644
--- a/src/services/licensing/entitlementService.ts
+++ b/src/services/licensing/entitlementService.ts
@@ -25,8 +25,13 @@ export async function startCheckout(): Promise<{ checkoutUrl: string }> {
throw new NotImplementedError('licensing/entitlement.startCheckout');
}
+/** Pure predicate: which tiers unlock paid features. */
+export function isPaidTier(tier: Entitlement['tier']): boolean {
+ return tier === 'pro' || tier === 'team';
+}
+
/** Convenience gate used by UI/services. */
export async function hasPro(): Promise {
const e = await getEntitlement().catch(() => FREE);
- return e.tier === 'pro' || e.tier === 'team';
+ return isPaidTier(e.tier);
}
diff --git a/src/services/profiles/snapshotService.ts b/src/services/profiles/snapshotService.ts
index b062d56..22f1220 100644
--- a/src/services/profiles/snapshotService.ts
+++ b/src/services/profiles/snapshotService.ts
@@ -6,11 +6,16 @@
import type { Snapshot, SwitchResult } from '@/types/models';
import { NotImplementedError } from '@/lib/result';
-/** Snapshot current supported state for an origin/domain scope. */
+/**
+ * Snapshot current supported state for an origin/domain scope. `domainScope`
+ * lets a multi-domain pre-switch snapshot capture cookies across every origin
+ * the profile spans (so recovery is complete), not just the active origin.
+ */
export async function takeSnapshot(
_origin: string,
_tabId: number,
_reason: string,
+ _domainScope?: string[],
): Promise {
throw new NotImplementedError('profiles/snapshot.takeSnapshot');
}
From 2701cd83e023b136d1300ecca6539efa494552d1 Mon Sep 17 00:00:00 2001
From: Murraylr
Date: Fri, 5 Jun 2026 23:24:58 -0400
Subject: [PATCH 05/33] Harden test suite + add manifest, team, backend, and
E2E coverage
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Completes the spec-by-test suite. Every red group was proven satisfiable by
implementing it in a throwaway worktree; already-green groups were mutation-
tested. Weak/tautological tests were strengthened and coverage gaps filled.
Added:
- tests/manifest: permission-posture contract (no host_permissions//
content_scripts/default_popup; minimal permissions).
- tests/team: auth, zero-knowledge sync (no plaintext crosses the wire), vaults/
roles/revocation — verified, 7 mutations caught.
- backend/Sessionist.Api.Tests: 40 .NET contract tests (xUnit + WebApplication-
Factory) for the Team backend (red until implemented; /health green).
- e2e/: 43 Playwright specs + zero-dep demo app covering §10 flows, the §13.6
matrix, and the §13.7 storageState round-trip capstone.
- Hardening across cookies/profiles/export/crypto/permissions/licensing/UI:
fixed broken tests, strengthened tautological ones, closed mutation gaps
(telemetry opt-out, clipboard, curl origin, CHIPS removal fidelity, key
persistence reload, real Stripe-webhook HMAC, interop expiry).
Totals: ~1108 vitest + 40 .NET + 43 Playwright. compile/lint/format/build green;
suite red-by-design until features land. CI runs the suite (continue-on-error).
Co-Authored-By: Claude Opus 4.8 (1M context)
---
.github/workflows/ci.yml | 19 +
README.md | 14 +
backend/Sessionist.Api.Tests/ApiFactory.cs | 17 +
.../ContractTests/AuditTests.cs | 212 +
.../ContractTests/AuthTests.cs | 149 +
.../ContractTests/BillingTests.cs | 156 +
.../ContractTests/HealthTests.cs | 34 +
.../ProtectedEndpointAuthTests.cs | 79 +
.../ContractTests/SyncProfilesTests.cs | 173 +
.../ContractTests/VaultTests.cs | 215 +
.../Sessionist.Api.Tests/Helpers/JwtHelper.cs | 41 +
.../Sessionist.Api.Tests.csproj | 40 +
backend/Sessionist.Api/Program.cs | 3 +
e2e/README.md | 159 +
e2e/capture-switch.spec.ts | 205 +
e2e/cookie-editor.spec.ts | 288 +
e2e/correctness-matrix.spec.ts | 386 +
e2e/demo-app/server.cjs | 492 +
e2e/fixtures/extension.ts | 138 +
e2e/onboarding.spec.ts | 113 +
e2e/permission.spec.ts | 191 +
e2e/playwright-export.spec.ts | 369 +
eslint.config.js | 14 +-
playwright-report/index.html | 21642 ++++++++++++++++
playwright.config.ts | 114 +
tests/README.md | 71 +
tests/background/messageHandler.test.ts | 62 +-
tests/background/router.test.ts | 181 +-
tests/cookies/cookieImportExport.test.ts | 93 +-
tests/cookies/cookieService.test.ts | 116 +-
tests/cookies/netscapeFormat.test.ts | 32 +-
tests/cookies/router.cookies.test.ts | 85 +-
tests/crypto/encryption.test.ts | 68 +-
tests/crypto/keyManager.test.ts | 106 +-
tests/crypto/passphrase.test.ts | 268 +-
tests/export/playwrightExport.test.ts | 64 +-
tests/export/redaction.test.ts | 125 +-
tests/export/snippetExport.test.ts | 59 +-
tests/harness/fakeChrome.ts | 7 +-
tests/licensing/entitlementService.test.ts | 121 +-
tests/licensing/licenseVerifier.test.ts | 90 +-
tests/manifest/manifest.test.ts | 73 +
tests/permissions/permissionService.test.ts | 127 +-
tests/permissions/router.permissions.test.ts | 20 +-
tests/profiles/captureService.test.ts | 52 +-
tests/profiles/correctnessMatrix.test.ts | 28 +-
tests/profiles/profileService.test.ts | 24 +-
tests/profiles/router.profiles.test.ts | 85 +-
tests/profiles/snapshotService.test.ts | 19 +-
tests/profiles/switchEngine.test.ts | 205 +-
tests/profiles/webStorageCapture.test.ts | 6 +-
tests/storage/profileRepository.test.ts | 69 +-
tests/team/authService.test.ts | 254 +
tests/team/syncService.test.ts | 349 +
tests/team/vaultService.test.ts | 505 +
tests/telemetry/telemetry.test.ts | 135 +-
tests/ui/App.test.tsx | 17 +-
tests/ui/CookieEditorView.test.tsx | 19 +-
tests/ui/ExportView.test.tsx | 98 +-
tests/ui/OnboardingView.test.tsx | 12 +-
tests/ui/ProfilesView.test.tsx | 41 +-
tests/ui/SettingsView.test.tsx | 16 +-
tests/ui/SiteAccessView.test.tsx | 32 +-
tests/ui/UpgradeView.test.tsx | 8 +-
tests/ui/accessibility.test.tsx | 18 +-
tests/ui/helpers.tsx | 11 +-
tests/ui/store.test.ts | 25 +-
tests/ui/useBackground.test.tsx | 32 +-
tests/ui/useTheme.test.tsx | 8 +-
tests/worker/worker.test.ts | 282 +-
70 files changed, 28632 insertions(+), 749 deletions(-)
create mode 100644 backend/Sessionist.Api.Tests/ApiFactory.cs
create mode 100644 backend/Sessionist.Api.Tests/ContractTests/AuditTests.cs
create mode 100644 backend/Sessionist.Api.Tests/ContractTests/AuthTests.cs
create mode 100644 backend/Sessionist.Api.Tests/ContractTests/BillingTests.cs
create mode 100644 backend/Sessionist.Api.Tests/ContractTests/HealthTests.cs
create mode 100644 backend/Sessionist.Api.Tests/ContractTests/ProtectedEndpointAuthTests.cs
create mode 100644 backend/Sessionist.Api.Tests/ContractTests/SyncProfilesTests.cs
create mode 100644 backend/Sessionist.Api.Tests/ContractTests/VaultTests.cs
create mode 100644 backend/Sessionist.Api.Tests/Helpers/JwtHelper.cs
create mode 100644 backend/Sessionist.Api.Tests/Sessionist.Api.Tests.csproj
create mode 100644 e2e/README.md
create mode 100644 e2e/capture-switch.spec.ts
create mode 100644 e2e/cookie-editor.spec.ts
create mode 100644 e2e/correctness-matrix.spec.ts
create mode 100644 e2e/demo-app/server.cjs
create mode 100644 e2e/fixtures/extension.ts
create mode 100644 e2e/onboarding.spec.ts
create mode 100644 e2e/permission.spec.ts
create mode 100644 e2e/playwright-export.spec.ts
create mode 100644 playwright-report/index.html
create mode 100644 playwright.config.ts
create mode 100644 tests/README.md
create mode 100644 tests/manifest/manifest.test.ts
create mode 100644 tests/team/authService.test.ts
create mode 100644 tests/team/syncService.test.ts
create mode 100644 tests/team/vaultService.test.ts
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 6564401..c93dc4b 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,6 +20,22 @@ jobs:
- run: npm run format
- run: npm run build
+ # Spec-by-test suite. Currently RED BY DESIGN: tests encode the contract each
+ # feature must satisfy and go green as features are implemented. `continue-on-
+ # error` keeps it informational on the skeleton — remove it (make it a hard
+ # gate) once the suite is green.
+ tests:
+ runs-on: ubuntu-latest
+ continue-on-error: true
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-node@v4
+ with:
+ node-version: 22
+ cache: npm
+ - run: npm ci
+ - run: npm test
+
worker:
runs-on: ubuntu-latest
defaults:
@@ -43,3 +59,6 @@ jobs:
with:
dotnet-version: '10.0.x'
- run: dotnet build backend/Sessionist.Api/Sessionist.Api.csproj
+ # Backend contract tests — red by design until the Team backend is built.
+ - run: dotnet test backend/Sessionist.Api.Tests/Sessionist.Api.Tests.csproj
+ continue-on-error: true
diff --git a/README.md b/README.md
index b6689db..b8133fa 100644
--- a/README.md
+++ b/README.md
@@ -25,8 +25,22 @@ npm run build # production build -> .output/
npm run compile # typecheck only (tsc --noEmit)
npm run lint # eslint
npm run format # prettier --check (use format:write to fix)
+npm test # vitest unit + integration suite
+npm run test:coverage
+npm run test:e2e # Playwright E2E (needs `npm run build` first + a browser)
```
+### Tests
+
+The repo ships a **spec-by-test** suite (~1100 vitest + 40 .NET + 43 Playwright
+specs) that encodes the PRD contract for every feature. It is **red by design**
+on the skeleton — each test goes green only when its feature is implemented
+correctly, and fails again if an implementation is wrong or an edge case is
+unhandled. When the whole suite is green, the app meets the PRD. See
+[`tests/README.md`](tests/README.md) for layout, the fake-`chrome` harness, and
+per-PRD-section coverage; [`tests/CONTRACTS.md`](tests/CONTRACTS.md) is the
+behavioural source of truth.
+
CI (`.github/workflows/ci.yml`) runs compile + lint + format + build for the
extension, typecheck for the worker, and `dotnet build` for the backend. Use
`npm ci` (not `npm install`) for reproducible installs.
diff --git a/backend/Sessionist.Api.Tests/ApiFactory.cs b/backend/Sessionist.Api.Tests/ApiFactory.cs
new file mode 100644
index 0000000..c1cc1ca
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/ApiFactory.cs
@@ -0,0 +1,17 @@
+// Shared WebApplicationFactory for all integration tests.
+// Uses the Program from Sessionist.Api (top-level statements + "public partial class Program {}" seam).
+
+using Microsoft.AspNetCore.Mvc.Testing;
+
+namespace Sessionist.Api.Tests;
+
+///
+/// Spins up the real ASP.NET Core pipeline in-memory.
+/// All tests share a single factory instance via IClassFixture.
+///
+public sealed class ApiFactory : WebApplicationFactory
+{
+ // No custom configuration needed for the stub phase.
+ // Customise here (e.g. swap DB, inject test JWT signing key) once the
+ // real implementation arrives.
+}
diff --git a/backend/Sessionist.Api.Tests/ContractTests/AuditTests.cs b/backend/Sessionist.Api.Tests/ContractTests/AuditTests.cs
new file mode 100644
index 0000000..a4fec8e
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/ContractTests/AuditTests.cs
@@ -0,0 +1,212 @@
+// PRD §9.7 / §13.10 – Audit log contracts.
+//
+// GET /vaults/{id}/audit must return entries that contain:
+// - event type (what happened)
+// - object IDs (which vault / profile ID was affected)
+//
+// And must NEVER contain:
+// - cookies
+// - localStorage values
+// - sessionStorage values
+// - any plaintext session content
+// - cleartext profile blobs
+//
+// This is the zero-knowledge audit requirement from PRD §13.10:
+// "Audit logs track events and object IDs, not plaintext session contents."
+//
+// CURRENT STATUS: all tests FAIL (endpoint returns 501).
+// TARGET: pass once the audit endpoint is implemented.
+
+using System.Net;
+using System.Net.Http.Headers;
+using System.Text.Json;
+using Sessionist.Api.Tests.Helpers;
+using Xunit;
+
+namespace Sessionist.Api.Tests.ContractTests;
+
+///
+/// Audit log contract tests (PRD §9.7 + §13.10).
+///
+public sealed class AuditTests(ApiFactory factory) : IClassFixture
+{
+ private readonly HttpClient _client = factory.CreateClient();
+
+ private HttpClient AuthClient()
+ {
+ var client = factory.CreateClient();
+ client.DefaultRequestHeaders.Authorization =
+ AuthenticationHeaderValue.Parse(JwtHelper.BearerToken());
+ return client;
+ }
+
+ // ─── GET /vaults/{id}/audit ──────────────────────────────────────────────
+
+ ///
+ /// Audit endpoint returns 200 with a JSON array.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task GetAudit_AuthedUser_Returns200WithArray()
+ {
+ using var client = AuthClient();
+
+ var response = await client.GetAsync("/vaults/test-vault-id/audit");
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ Assert.Equal(JsonValueKind.Array, doc.RootElement.ValueKind);
+ }
+
+ ///
+ /// Each audit entry must contain an event type and an object ID.
+ /// (PRD §9.7: "Audit log for shared profile create/update/use events")
+ /// This test verifies the schema when at least one entry exists.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task GetAudit_WhenEntriesExist_EachEntryHasEventTypeAndObjectId()
+ {
+ using var client = AuthClient();
+
+ var response = await client.GetAsync("/vaults/test-vault-id/audit");
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ foreach (var entry in doc.RootElement.EnumerateArray())
+ {
+ Assert.True(
+ entry.TryGetProperty("eventType", out var eventTypeProp) &&
+ eventTypeProp.ValueKind == JsonValueKind.String &&
+ !string.IsNullOrWhiteSpace(eventTypeProp.GetString()),
+ "Each audit entry must have a non-empty 'eventType' string (PRD §9.7)");
+
+ // At least one of objectId / vaultId / profileId must be present.
+ bool hasObjectRef =
+ entry.TryGetProperty("objectId", out _) ||
+ entry.TryGetProperty("vaultId", out _) ||
+ entry.TryGetProperty("profileId", out _);
+
+ Assert.True(
+ hasObjectRef,
+ "Each audit entry must reference an object ID (objectId, vaultId, or profileId) (PRD §13.10)");
+ }
+ }
+
+ ///
+ /// Audit entries must NEVER expose plaintext session content fields.
+ /// PRD §13.10: "Audit logs track events and object IDs, not plaintext session contents."
+ /// PRD §9.7: "without storing plaintext session contents."
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task GetAudit_ResponseNeverContainsPlaintextSessionFields()
+ {
+ using var client = AuthClient();
+
+ var response = await client.GetAsync("/vaults/test-vault-id/audit");
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ // Walk every JSON node and assert no plaintext session content fields appear.
+ AssertNoPlaintextSessionFields(doc.RootElement, "audit response root");
+ }
+
+ ///
+ /// Audit entries must not contain raw cookie or storage values inline.
+ /// We also check that the string values themselves don't look like
+ /// serialised cookie / storage blobs (belt-and-suspenders against the
+ /// server accidentally echo-ing the payload back).
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task GetAudit_ResponseNeverContainsSessionContentInStringValues()
+ {
+ using var client = AuthClient();
+
+ var response = await client.GetAsync("/vaults/test-vault-id/audit");
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+
+ // Guard against any of the PRD §14.3 prohibited data appearing in the
+ // raw response body as substrings (crude but catches accidental leaks).
+ var prohibitedSubstrings = new[]
+ {
+ "\"cookieValue\"",
+ "\"storageValue\"",
+ "\"sessionStorage\"",
+ "\"localStorage\"",
+ "\"cookies\"",
+ };
+
+ foreach (var prohibited in prohibitedSubstrings)
+ {
+ Assert.DoesNotContain(
+ prohibited,
+ body,
+ StringComparison.OrdinalIgnoreCase);
+ }
+ }
+
+ ///
+ /// Without a token, the audit endpoint returns 401.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task GetAudit_WithoutToken_Returns401()
+ {
+ var response = await _client.GetAsync("/vaults/test-vault-id/audit");
+
+ Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+
+ // ─── Helpers ─────────────────────────────────────────────────────────────
+
+ ///
+ /// Prohibited field names per PRD §13.10 + §14.3.
+ /// These must NEVER appear in audit log JSON responses.
+ ///
+ private static readonly HashSet PlaintextSessionFieldNames =
+ new(StringComparer.OrdinalIgnoreCase)
+ {
+ "cookies",
+ "localStorage",
+ "sessionStorage",
+ "cookieValue",
+ "storageValue",
+ "cookieContent",
+ "sessionContent",
+ };
+
+ private static void AssertNoPlaintextSessionFields(JsonElement element, string context)
+ {
+ if (element.ValueKind == JsonValueKind.Object)
+ {
+ foreach (var property in element.EnumerateObject())
+ {
+ Assert.False(
+ PlaintextSessionFieldNames.Contains(property.Name),
+ $"PRD §13.10 violation: audit log must not contain plaintext session content. " +
+ $"Found prohibited field '{property.Name}' at {context}");
+
+ AssertNoPlaintextSessionFields(property.Value, $"{context}.{property.Name}");
+ }
+ }
+ else if (element.ValueKind == JsonValueKind.Array)
+ {
+ int i = 0;
+ foreach (var item in element.EnumerateArray())
+ {
+ AssertNoPlaintextSessionFields(item, $"{context}[{i++}]");
+ }
+ }
+ }
+}
diff --git a/backend/Sessionist.Api.Tests/ContractTests/AuthTests.cs b/backend/Sessionist.Api.Tests/ContractTests/AuthTests.cs
new file mode 100644
index 0000000..0b7608b
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/ContractTests/AuthTests.cs
@@ -0,0 +1,149 @@
+// PRD §9.7 / §13.9 – Authentication contracts.
+// Google OAuth, email magic-link, JWT refresh.
+//
+// CURRENT STATUS: all tests FAIL (endpoints return 501).
+// TARGET: pass once auth is implemented.
+
+using System.Net;
+using System.Net.Http.Json;
+using System.Text.Json;
+using Xunit;
+
+namespace Sessionist.Api.Tests.ContractTests;
+
+///
+/// Contract tests for the three auth endpoints.
+/// They document the expected behaviour per PRD §13.9:
+/// - Google OAuth token exchange → 200 + session JWT
+/// - Email magic-link request → 200 (link sent)
+/// - JWT refresh → 200 + new access token
+/// - Malformed / missing inputs → 400 or 401
+///
+public sealed class AuthTests(ApiFactory factory) : IClassFixture
+{
+ private readonly HttpClient _client = factory.CreateClient();
+
+ // ─── POST /auth/google ───────────────────────────────────────────────────
+
+ ///
+ /// A valid Google ID-token payload must result in a 200 with a JWT
+ /// access token and a refresh token (or session cookie).
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task AuthGoogle_ValidIdToken_Returns200WithTokens()
+ {
+ var payload = new { idToken = "google-id-token-stub" };
+
+ var response = await _client.PostAsJsonAsync("/auth/google", payload);
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ Assert.True(
+ doc.RootElement.TryGetProperty("accessToken", out _),
+ "Response must contain 'accessToken'");
+ Assert.True(
+ doc.RootElement.TryGetProperty("refreshToken", out _),
+ "Response must contain 'refreshToken'");
+ }
+
+ ///
+ /// A missing or empty idToken body must return 400 Bad Request.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task AuthGoogle_MissingIdToken_Returns400()
+ {
+ var payload = new { }; // no idToken field
+
+ var response = await _client.PostAsJsonAsync("/auth/google", payload);
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ // ─── POST /auth/magic-link ───────────────────────────────────────────────
+
+ ///
+ /// A valid email address triggers the magic-link flow and returns 200.
+ /// (The email itself is not validated in this contract test; the server
+ /// should queue/send it and respond 200.)
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task AuthMagicLink_ValidEmail_Returns200()
+ {
+ var payload = new { email = "qa@example.com" };
+
+ var response = await _client.PostAsJsonAsync("/auth/magic-link", payload);
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+ }
+
+ ///
+ /// A syntactically invalid email must return 400.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task AuthMagicLink_InvalidEmail_Returns400()
+ {
+ var payload = new { email = "not-an-email" };
+
+ var response = await _client.PostAsJsonAsync("/auth/magic-link", payload);
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ ///
+ /// A missing email field must return 400.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task AuthMagicLink_MissingEmail_Returns400()
+ {
+ var payload = new { };
+
+ var response = await _client.PostAsJsonAsync("/auth/magic-link", payload);
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ // ─── POST /auth/refresh ──────────────────────────────────────────────────
+
+ ///
+ /// A valid refresh token must return 200 with a new access token.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task AuthRefresh_ValidRefreshToken_Returns200WithNewAccessToken()
+ {
+ var payload = new { refreshToken = "valid-refresh-token-stub" };
+
+ var response = await _client.PostAsJsonAsync("/auth/refresh", payload);
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ Assert.True(
+ doc.RootElement.TryGetProperty("accessToken", out _),
+ "Response must contain 'accessToken'");
+ }
+
+ ///
+ /// An expired or invalid refresh token must return 401 Unauthorized.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task AuthRefresh_InvalidRefreshToken_Returns401()
+ {
+ var payload = new { refreshToken = "" };
+
+ var response = await _client.PostAsJsonAsync("/auth/refresh", payload);
+
+ Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+}
diff --git a/backend/Sessionist.Api.Tests/ContractTests/BillingTests.cs b/backend/Sessionist.Api.Tests/ContractTests/BillingTests.cs
new file mode 100644
index 0000000..d77f4ca
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/ContractTests/BillingTests.cs
@@ -0,0 +1,156 @@
+// PRD §9.7 / §13.9 – Billing contracts (Stripe seat-based).
+//
+// POST /billing/checkout → create a Stripe Checkout session for Team seats
+// POST /billing/webhook → validate Stripe webhook signature and process events
+//
+// CURRENT STATUS: all tests FAIL (endpoints return 501).
+// TARGET: pass once billing endpoints are implemented.
+
+using System.Net;
+using System.Net.Http.Headers;
+using System.Net.Http.Json;
+using System.Text;
+using System.Text.Json;
+using Sessionist.Api.Tests.Helpers;
+using Xunit;
+
+namespace Sessionist.Api.Tests.ContractTests;
+
+///
+/// Billing contract tests (PRD §13.9 / §11.1).
+/// Stripe seat-based billing: checkout session creation + webhook handling.
+///
+public sealed class BillingTests(ApiFactory factory) : IClassFixture
+{
+ private readonly HttpClient _client = factory.CreateClient();
+
+ private HttpClient AuthClient()
+ {
+ var client = factory.CreateClient();
+ client.DefaultRequestHeaders.Authorization =
+ AuthenticationHeaderValue.Parse(JwtHelper.BearerToken());
+ return client;
+ }
+
+ // ─── POST /billing/checkout ──────────────────────────────────────────────
+
+ ///
+ /// A valid checkout request (authed user, seat count) returns 200 with a
+ /// Stripe Checkout URL or session ID.
+ /// PRD §11.1: Team = $7/seat/month billed annually.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostBillingCheckout_ValidRequest_Returns200WithCheckoutUrl()
+ {
+ using var client = AuthClient();
+
+ var payload = new { seats = 5 };
+
+ var response = await client.PostAsJsonAsync("/billing/checkout", payload);
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ // The response must contain either a checkout URL or a session ID.
+ bool hasUrl = doc.RootElement.TryGetProperty("checkoutUrl", out var urlProp)
+ && urlProp.ValueKind == JsonValueKind.String
+ && !string.IsNullOrWhiteSpace(urlProp.GetString());
+
+ bool hasSessionId = doc.RootElement.TryGetProperty("sessionId", out var sidProp)
+ && sidProp.ValueKind == JsonValueKind.String
+ && !string.IsNullOrWhiteSpace(sidProp.GetString());
+
+ Assert.True(
+ hasUrl || hasSessionId,
+ "Response must contain 'checkoutUrl' or 'sessionId'");
+ }
+
+ ///
+ /// Zero or negative seat count must return 400.
+ /// FAILS NOW: returns 501.
+ ///
+ [Theory]
+ [InlineData(0)]
+ [InlineData(-1)]
+ public async Task PostBillingCheckout_InvalidSeatCount_Returns400(int seats)
+ {
+ using var client = AuthClient();
+
+ var payload = new { seats };
+
+ var response = await client.PostAsJsonAsync("/billing/checkout", payload);
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ // ─── POST /billing/webhook ───────────────────────────────────────────────
+
+ ///
+ /// The webhook endpoint requires a Stripe-Signature header.
+ /// A request without the header should return 400 (bad request / missing sig).
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostBillingWebhook_MissingStripeSignature_Returns400()
+ {
+ // No auth token and no Stripe-Signature header.
+ var payload = new StringContent(
+ "{\"type\":\"checkout.session.completed\"}",
+ Encoding.UTF8,
+ "application/json");
+
+ var response = await _client.PostAsync("/billing/webhook", payload);
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ ///
+ /// A webhook request with a syntactically present but invalid Stripe-Signature
+ /// must return 400 (signature validation failure).
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostBillingWebhook_InvalidStripeSignature_Returns400()
+ {
+ var request = new HttpRequestMessage(HttpMethod.Post, "/billing/webhook");
+ request.Content = new StringContent(
+ "{\"type\":\"checkout.session.completed\",\"data\":{\"object\":{}}}",
+ Encoding.UTF8,
+ "application/json");
+
+ // An obviously invalid Stripe signature header.
+ request.Headers.Add("Stripe-Signature", "t=fake,v1=invalidsignature");
+
+ var response = await _client.SendAsync(request);
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ ///
+ /// The /billing/webhook endpoint must be publicly accessible (no Bearer token
+ /// required — Stripe calls it directly). A missing Authorization header must
+ /// NOT result in 401 (it should succeed or fail on sig validation, not auth).
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostBillingWebhook_IsNotProtectedByJwt()
+ {
+ // No Authorization header — Stripe doesn't send one.
+ var request = new HttpRequestMessage(HttpMethod.Post, "/billing/webhook");
+ request.Content = new StringContent(
+ "{\"type\":\"checkout.session.completed\"}",
+ Encoding.UTF8,
+ "application/json");
+ request.Headers.Add("Stripe-Signature", "t=fake,v1=invalidsignature");
+
+ var response = await _client.SendAsync(request);
+
+ // Must NOT be 401 (that would mean it's behind JWT auth, which is wrong
+ // for a Stripe webhook). 400 or 200 are both acceptable depending on
+ // whether the test sig passes validation.
+ Assert.NotEqual(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+}
diff --git a/backend/Sessionist.Api.Tests/ContractTests/HealthTests.cs b/backend/Sessionist.Api.Tests/ContractTests/HealthTests.cs
new file mode 100644
index 0000000..9bad933
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/ContractTests/HealthTests.cs
@@ -0,0 +1,34 @@
+// PRD §9.7 / §13.9 – /health contract.
+// This test PASSES NOW to confirm the harness is wired correctly.
+
+using System.Net;
+using System.Text.Json;
+using Xunit;
+
+namespace Sessionist.Api.Tests.ContractTests;
+
+///
+/// /health should always return 200 {ok:true}.
+/// This test passes with the current stub implementation and acts as a
+/// canary confirming WebApplicationFactory is set up correctly.
+///
+public sealed class HealthTests(ApiFactory factory) : IClassFixture
+{
+ private readonly HttpClient _client = factory.CreateClient();
+
+ [Fact]
+ public async Task Health_Returns200_WithOkTrue()
+ {
+ var response = await _client.GetAsync("/health");
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ Assert.True(
+ doc.RootElement.TryGetProperty("ok", out var okProp),
+ "Response JSON must contain an 'ok' property");
+ Assert.Equal(JsonValueKind.True, okProp.ValueKind);
+ }
+}
diff --git a/backend/Sessionist.Api.Tests/ContractTests/ProtectedEndpointAuthTests.cs b/backend/Sessionist.Api.Tests/ContractTests/ProtectedEndpointAuthTests.cs
new file mode 100644
index 0000000..739b8d4
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/ContractTests/ProtectedEndpointAuthTests.cs
@@ -0,0 +1,79 @@
+// PRD §9.7 / §13.9 – Auth-required contract.
+// Every protected endpoint must return 401 when no bearer token is supplied.
+//
+// CURRENT STATUS: all tests FAIL (endpoints return 501 instead of 401).
+// TARGET: pass once auth middleware is wired.
+
+using System.Net;
+using System.Net.Http.Json;
+using Xunit;
+
+namespace Sessionist.Api.Tests.ContractTests;
+
+///
+/// Asserts that all endpoints behind authentication wall return 401 when
+/// the request carries no Authorization header.
+///
+public sealed class ProtectedEndpointAuthTests(ApiFactory factory) : IClassFixture
+{
+ private readonly HttpClient _client = factory.CreateClient();
+
+ public static IEnumerable ProtectedGetEndpoints =>
+ [
+ ["/sync/profiles"],
+ ["/vaults"],
+ ["/vaults/test-vault-id/audit"],
+ ];
+
+ public static IEnumerable ProtectedPostEndpoints =>
+ [
+ ["/vaults"],
+ ["/vaults/test-vault-id/invite"],
+ ["/vaults/test-vault-id/rotate-key"],
+ ["/billing/checkout"],
+ ];
+
+ public static IEnumerable ProtectedPutEndpoints =>
+ [
+ ["/sync/profiles"],
+ ];
+
+ ///
+ /// GET endpoints without a token → 401.
+ /// FAILS NOW: returns 501.
+ ///
+ [Theory]
+ [MemberData(nameof(ProtectedGetEndpoints))]
+ public async Task Get_WithoutToken_Returns401(string path)
+ {
+ var response = await _client.GetAsync(path);
+
+ Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+
+ ///
+ /// POST endpoints without a token → 401.
+ /// FAILS NOW: returns 501.
+ ///
+ [Theory]
+ [MemberData(nameof(ProtectedPostEndpoints))]
+ public async Task Post_WithoutToken_Returns401(string path)
+ {
+ var response = await _client.PostAsJsonAsync(path, new { });
+
+ Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+
+ ///
+ /// PUT endpoints without a token → 401.
+ /// FAILS NOW: returns 501.
+ ///
+ [Theory]
+ [MemberData(nameof(ProtectedPutEndpoints))]
+ public async Task Put_WithoutToken_Returns401(string path)
+ {
+ var response = await _client.PutAsJsonAsync(path, new { });
+
+ Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
+ }
+}
diff --git a/backend/Sessionist.Api.Tests/ContractTests/SyncProfilesTests.cs b/backend/Sessionist.Api.Tests/ContractTests/SyncProfilesTests.cs
new file mode 100644
index 0000000..f2ff602
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/ContractTests/SyncProfilesTests.cs
@@ -0,0 +1,173 @@
+// PRD §9.7 / §13.10 – Zero-knowledge sync: /sync/profiles contracts.
+//
+// The server stores CIPHERTEXT only. The API must:
+// PUT /sync/profiles → accept any opaque blob body (no plaintext field requirements)
+// GET /sync/profiles → return the stored ciphertext blob for the authed user
+//
+// The contract asserts the server is blind: it must NOT require or validate
+// any plaintext session fields (no "cookies", "localStorage", "origin", etc.
+// in PUT input validation or GET output schema).
+//
+// CURRENT STATUS: all tests FAIL (endpoints return 501).
+// TARGET: pass once zero-knowledge sync is implemented.
+
+using System.Net;
+using System.Net.Http.Headers;
+using System.Net.Http.Json;
+using System.Text;
+using System.Text.Json;
+using Sessionist.Api.Tests.Helpers;
+using Xunit;
+
+namespace Sessionist.Api.Tests.ContractTests;
+
+///
+/// Zero-knowledge profile sync contracts (PRD §13.10).
+///
+public sealed class SyncProfilesTests(ApiFactory factory) : IClassFixture
+{
+ private readonly HttpClient _client = factory.CreateClient();
+
+ private HttpClient AuthClient()
+ {
+ var client = factory.CreateClient();
+ client.DefaultRequestHeaders.Authorization =
+ AuthenticationHeaderValue.Parse(JwtHelper.BearerToken());
+ return client;
+ }
+
+ // ─── PUT /sync/profiles ──────────────────────────────────────────────────
+
+ ///
+ /// PUT with an opaque ciphertext body (base-64 blob, no plaintext fields)
+ /// must be accepted with 200 or 204.
+ /// The server must not require or validate plaintext session fields.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task Put_OpaqueCiphertextBlob_IsAccepted()
+ {
+ using var client = AuthClient();
+
+ // This body intentionally looks like a real zero-knowledge payload:
+ // an opaque base-64 encoded blob with no readable session data.
+ var opaqueBody = new
+ {
+ profileId = "test-profile-id-1",
+ ciphertext = Convert.ToBase64String(Encoding.UTF8.GetBytes("AES-GCM-encrypted-blob-goes-here")),
+ iv = Convert.ToBase64String(new byte[12]), // 96-bit nonce placeholder
+ version = 1
+ };
+
+ var response = await client.PutAsJsonAsync("/sync/profiles", opaqueBody);
+
+ Assert.True(
+ response.StatusCode == HttpStatusCode.OK ||
+ response.StatusCode == HttpStatusCode.NoContent,
+ $"Expected 200 or 204 but got {(int)response.StatusCode}");
+ }
+
+ ///
+ /// PUT must NOT require plaintext fields like "cookies", "localStorage",
+ /// "origin", or "name". A body with only ciphertext fields is valid.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task Put_WithNoPlaintextSessionFields_IsNotRejected()
+ {
+ using var client = AuthClient();
+
+ // Body has ONLY the opaque encrypted fields — no plaintext session data.
+ var minimalEncryptedBody = new
+ {
+ ciphertext = "c2VjcmV0LWVuY3J5cHRlZC1ibG9i", // base-64 "secret-encrypted-blob"
+ iv = "AAAAAAAAAAAAAAAA", // 16-char placeholder
+ };
+
+ var response = await client.PutAsJsonAsync("/sync/profiles", minimalEncryptedBody);
+
+ // The server must accept (2xx) or reject for a non-schema reason (e.g. missing
+ // profileId), but must NOT return 422 complaining about absent plaintext fields.
+ Assert.NotEqual(HttpStatusCode.NotImplemented, response.StatusCode);
+ Assert.False(
+ response.StatusCode == HttpStatusCode.UnprocessableEntity &&
+ await BodyContainsPlaintextFieldError(response),
+ "Server must not reject the body for missing plaintext session fields (zero-knowledge: server is blind to session contents)");
+ }
+
+ // ─── GET /sync/profiles ──────────────────────────────────────────────────
+
+ ///
+ /// GET returns the stored ciphertext blob(s) for the authed user.
+ /// The response must NOT contain plaintext session-content fields
+ /// (cookies, localStorage values, origin, sessionStorage values).
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task Get_ReturnsStoredCiphertextForAuthedUser()
+ {
+ using var client = AuthClient();
+
+ var response = await client.GetAsync("/sync/profiles");
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+
+ // The response is a collection of ciphertext blobs.
+ // It must be valid JSON.
+ using var doc = JsonDocument.Parse(body);
+
+ // The response must not contain plaintext session content fields.
+ AssertNoPlaintextSessionFields(doc.RootElement, "/sync/profiles GET response");
+ }
+
+ // ─── Helpers ─────────────────────────────────────────────────────────────
+
+ private static readonly HashSet PlaintextSessionFieldNames =
+ new(StringComparer.OrdinalIgnoreCase)
+ {
+ "cookies",
+ "localStorage",
+ "sessionStorage",
+ "cookieValue",
+ "storageValue",
+ "value", // guard against generic value fields leaking plaintext
+ };
+
+ ///
+ /// Recursively asserts that the JSON element tree contains no known
+ /// plaintext-session field names (PRD §13.10: server never stores
+ /// plaintext session contents).
+ ///
+ private static void AssertNoPlaintextSessionFields(JsonElement element, string context)
+ {
+ if (element.ValueKind == JsonValueKind.Object)
+ {
+ foreach (var property in element.EnumerateObject())
+ {
+ Assert.False(
+ PlaintextSessionFieldNames.Contains(property.Name),
+ $"PRD §13.10 violation: '{property.Name}' is a plaintext session-content field and must never appear in server responses ({context})");
+
+ AssertNoPlaintextSessionFields(property.Value, $"{context}.{property.Name}");
+ }
+ }
+ else if (element.ValueKind == JsonValueKind.Array)
+ {
+ int i = 0;
+ foreach (var item in element.EnumerateArray())
+ {
+ AssertNoPlaintextSessionFields(item, $"{context}[{i++}]");
+ }
+ }
+ }
+
+ private static async Task BodyContainsPlaintextFieldError(HttpResponseMessage response)
+ {
+ var body = await response.Content.ReadAsStringAsync();
+ return body.Contains("cookies", StringComparison.OrdinalIgnoreCase)
+ || body.Contains("localStorage", StringComparison.OrdinalIgnoreCase)
+ || body.Contains("sessionStorage", StringComparison.OrdinalIgnoreCase);
+ }
+}
diff --git a/backend/Sessionist.Api.Tests/ContractTests/VaultTests.cs b/backend/Sessionist.Api.Tests/ContractTests/VaultTests.cs
new file mode 100644
index 0000000..51ed157
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/ContractTests/VaultTests.cs
@@ -0,0 +1,215 @@
+// PRD §9.7 / §13.9 – Shared vault contracts.
+//
+// Vaults: create, list, invite, key rotation.
+// All vault operations require a valid JWT.
+//
+// CURRENT STATUS: all tests FAIL (endpoints return 501).
+// TARGET: pass once vault endpoints are implemented.
+
+using System.Net;
+using System.Net.Http.Headers;
+using System.Net.Http.Json;
+using System.Text.Json;
+using Sessionist.Api.Tests.Helpers;
+using Xunit;
+
+namespace Sessionist.Api.Tests.ContractTests;
+
+///
+/// Vault contract tests (PRD §9.7):
+/// POST /vaults → create a vault, 201 with vault ID
+/// GET /vaults → list vaults for the authed user
+/// POST /vaults/{id}/invite → invite a member by email
+/// POST /vaults/{id}/rotate-key → trigger key rotation
+///
+public sealed class VaultTests(ApiFactory factory) : IClassFixture
+{
+ private readonly HttpClient _client = factory.CreateClient();
+
+ private HttpClient AuthClient()
+ {
+ var client = factory.CreateClient();
+ client.DefaultRequestHeaders.Authorization =
+ AuthenticationHeaderValue.Parse(JwtHelper.BearerToken());
+ return client;
+ }
+
+ // ─── POST /vaults ────────────────────────────────────────────────────────
+
+ ///
+ /// Creating a vault with a valid name returns 201 and a vault object
+ /// with at least an id and name.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostVaults_ValidName_Returns201WithVaultId()
+ {
+ using var client = AuthClient();
+
+ var payload = new { name = "QA Team Vault" };
+
+ var response = await client.PostAsJsonAsync("/vaults", payload);
+
+ Assert.Equal(HttpStatusCode.Created, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ Assert.True(
+ doc.RootElement.TryGetProperty("id", out var idProp) &&
+ idProp.ValueKind == JsonValueKind.String &&
+ !string.IsNullOrWhiteSpace(idProp.GetString()),
+ "Response must contain a non-empty 'id' string");
+
+ Assert.True(
+ doc.RootElement.TryGetProperty("name", out var nameProp) &&
+ nameProp.GetString() == "QA Team Vault",
+ "Response must echo back the vault 'name'");
+ }
+
+ ///
+ /// Creating a vault with a missing name returns 400.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostVaults_MissingName_Returns400()
+ {
+ using var client = AuthClient();
+
+ var response = await client.PostAsJsonAsync("/vaults", new { });
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ // ─── GET /vaults ─────────────────────────────────────────────────────────
+
+ ///
+ /// Listing vaults for an authed user returns 200 and a JSON array.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task GetVaults_AuthedUser_Returns200WithArray()
+ {
+ using var client = AuthClient();
+
+ var response = await client.GetAsync("/vaults");
+
+ Assert.Equal(HttpStatusCode.OK, response.StatusCode);
+
+ var body = await response.Content.ReadAsStringAsync();
+ using var doc = JsonDocument.Parse(body);
+
+ Assert.Equal(JsonValueKind.Array, doc.RootElement.ValueKind);
+ }
+
+ // ─── POST /vaults/{id}/invite ────────────────────────────────────────────
+
+ ///
+ /// Inviting a member by email to an existing vault returns 200 or 204.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostVaultInvite_ValidEmail_Returns200Or204()
+ {
+ using var client = AuthClient();
+
+ var payload = new { email = "teammate@example.com", role = "member" };
+
+ var response = await client.PostAsJsonAsync(
+ "/vaults/test-vault-id/invite", payload);
+
+ Assert.True(
+ response.StatusCode == HttpStatusCode.OK ||
+ response.StatusCode == HttpStatusCode.NoContent,
+ $"Expected 200 or 204 but got {(int)response.StatusCode}");
+ }
+
+ ///
+ /// Inviting with a missing email returns 400.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostVaultInvite_MissingEmail_Returns400()
+ {
+ using var client = AuthClient();
+
+ var response = await client.PostAsJsonAsync(
+ "/vaults/test-vault-id/invite", new { role = "member" });
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ ///
+ /// Inviting with an invalid role returns 400.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostVaultInvite_InvalidRole_Returns400()
+ {
+ using var client = AuthClient();
+
+ var payload = new { email = "teammate@example.com", role = "superadmin" };
+
+ var response = await client.PostAsJsonAsync(
+ "/vaults/test-vault-id/invite", payload);
+
+ Assert.Equal(HttpStatusCode.BadRequest, response.StatusCode);
+ }
+
+ ///
+ /// Accepted roles per PRD §9.7: owner, admin, member.
+ /// FAILS NOW: returns 501.
+ ///
+ [Theory]
+ [InlineData("owner")]
+ [InlineData("admin")]
+ [InlineData("member")]
+ public async Task PostVaultInvite_ValidRole_IsAccepted(string role)
+ {
+ using var client = AuthClient();
+
+ var payload = new { email = "teammate@example.com", role };
+
+ var response = await client.PostAsJsonAsync(
+ "/vaults/test-vault-id/invite", payload);
+
+ Assert.True(
+ response.StatusCode == HttpStatusCode.OK ||
+ response.StatusCode == HttpStatusCode.NoContent ||
+ response.StatusCode == HttpStatusCode.NotFound, // vault may not exist in test db
+ $"Expected 200/204/404 for role='{role}' but got {(int)response.StatusCode}");
+ }
+
+ // ─── POST /vaults/{id}/rotate-key ───────────────────────────────────────
+
+ ///
+ /// Key rotation on an existing vault returns 200 or 204.
+ /// Per PRD §9.7, revocation requires key rotation for future shared material.
+ /// FAILS NOW: returns 501.
+ ///
+ [Fact]
+ public async Task PostVaultRotateKey_ValidVault_Returns200Or204()
+ {
+ using var client = AuthClient();
+
+ // The body may contain the new wrapped key material.
+ // At this contract level we don't validate the crypto payload shape —
+ // only that the endpoint accepts the request.
+ var payload = new
+ {
+ newWrappedKeyPerMember = new Dictionary
+ {
+ ["test-user-1"] = Convert.ToBase64String(new byte[32])
+ }
+ };
+
+ var response = await client.PostAsJsonAsync(
+ "/vaults/test-vault-id/rotate-key", payload);
+
+ Assert.True(
+ response.StatusCode == HttpStatusCode.OK ||
+ response.StatusCode == HttpStatusCode.NoContent ||
+ response.StatusCode == HttpStatusCode.NotFound, // vault may not exist
+ $"Expected 200/204/404 but got {(int)response.StatusCode}");
+ }
+}
diff --git a/backend/Sessionist.Api.Tests/Helpers/JwtHelper.cs b/backend/Sessionist.Api.Tests/Helpers/JwtHelper.cs
new file mode 100644
index 0000000..6abea0d
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/Helpers/JwtHelper.cs
@@ -0,0 +1,41 @@
+// Helper that produces a minimal Bearer token for tests that need auth.
+// Because the real JWT validation is not wired yet (501 stubs), this token
+// exists solely to provide a non-empty Authorization header so that, once
+// auth IS implemented, protected endpoints return the right business response
+// rather than 401 from a missing header.
+//
+// Replace the signing key / claims with real values once §13.9 is built.
+
+namespace Sessionist.Api.Tests.Helpers;
+
+///
+/// Builds a syntactically valid (but arbitrarily signed) Bearer token for
+/// the test harness. Not cryptographically trusted by any real validator yet.
+///
+public static class JwtHelper
+{
+ ///
+ /// Returns "Bearer <token>" — use as the Authorization header value.
+ ///
+ public static string BearerToken(string userId = "test-user-1", string email = "qa@example.com")
+ {
+ // Build a minimal HS256 JWT by hand so we have zero external crypto deps
+ // in the test project at this stage. Once the API validates JWTs we will
+ // either (a) use the real signing key in test config, or
+ // (b) stub / bypass auth in the WebApplicationFactory override.
+ var header = Base64UrlEncode("{\"alg\":\"HS256\",\"typ\":\"JWT\"}");
+ var payload = Base64UrlEncode(
+ $"{{\"sub\":\"{userId}\",\"email\":\"{email}\",\"exp\":9999999999}}");
+ var signature = Base64UrlEncode("stub-sig");
+ return $"Bearer {header}.{payload}.{signature}";
+ }
+
+ private static string Base64UrlEncode(string plain)
+ {
+ var bytes = System.Text.Encoding.UTF8.GetBytes(plain);
+ return Convert.ToBase64String(bytes)
+ .TrimEnd('=')
+ .Replace('+', '-')
+ .Replace('/', '_');
+ }
+}
diff --git a/backend/Sessionist.Api.Tests/Sessionist.Api.Tests.csproj b/backend/Sessionist.Api.Tests/Sessionist.Api.Tests.csproj
new file mode 100644
index 0000000..93ae4df
--- /dev/null
+++ b/backend/Sessionist.Api.Tests/Sessionist.Api.Tests.csproj
@@ -0,0 +1,40 @@
+
+
+
+
+
+ net10.0
+ enable
+ enable
+ false
+
+ CS8618
+
+
+
+
+
+
+
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/backend/Sessionist.Api/Program.cs b/backend/Sessionist.Api/Program.cs
index eefe687..a3e22d2 100644
--- a/backend/Sessionist.Api/Program.cs
+++ b/backend/Sessionist.Api/Program.cs
@@ -34,3 +34,6 @@
static IResult NotImplemented(string endpoint) =>
Results.Json(new { error = "not_implemented", endpoint }, statusCode: 501);
+
+// Test seam: makes Program visible to WebApplicationFactory in the test project.
+public partial class Program { }
diff --git a/e2e/README.md b/e2e/README.md
new file mode 100644
index 0000000..d6da8cd
--- /dev/null
+++ b/e2e/README.md
@@ -0,0 +1,159 @@
+# Sessionist E2E Test Suite
+
+End-to-end tests for the Sessionist MV3 browser extension using
+[Playwright](https://playwright.dev).
+
+> **Status: RED until features land.**
+> All specs compile and enumerate correctly, but they will fail against the
+> current skeleton (every service stub throws `NotImplementedError`). This is
+> intentional — these tests document the required behaviour so that CI goes
+> green automatically as each feature is implemented.
+
+---
+
+## Running the tests
+
+### Prerequisites
+
+1. Build the extension (required — tests load the built artifact):
+
+ ```bash
+ npm run build
+ ```
+
+ This produces `.output/chrome-mv3/` which the Playwright config loads.
+
+2. Install Playwright browsers (first time only):
+
+ ```bash
+ npx playwright install chromium
+ ```
+
+### Run all E2E specs
+
+```bash
+npm run test:e2e
+```
+
+This command:
+- Starts the demo-app server (`e2e/demo-app/server.cjs`) on port 4321.
+- Launches a persistent Chromium context with the extension loaded.
+- Runs all specs in the `e2e/` directory.
+
+### Run a single spec file
+
+```bash
+npx playwright test e2e/cookie-editor.spec.ts
+```
+
+### List all tests without running them (compile check)
+
+```bash
+npx playwright test --list
+```
+
+### Headed mode (see the browser)
+
+```bash
+npx playwright test --headed
+```
+
+### Debug mode (step through)
+
+```bash
+npx playwright test --debug e2e/playwright-export.spec.ts
+```
+
+### New headless mode (Chrome 112+, CI with virtual display)
+
+Set the environment variable before running:
+
+```bash
+HEADLESS=true npm run test:e2e
+```
+
+Note: MV3 extensions require headed mode or Chrome's new headless pipeline
+(`--headless=new`). Classic headless (`--headless=old`) does not load unpacked
+extensions. In CI, use a virtual display (xvfb) or set `HEADLESS=true` to
+attempt new-headless mode.
+
+---
+
+## What each spec covers
+
+| File | PRD sections | Description |
+|---|---|---|
+| `onboarding.spec.ts` | §9.5, §10 flow 1 | First-run shows onboarding UI; import + export CTAs visible; replacement import (EditThisCookie JSON → cookie list). |
+| `permission.spec.ts` | §9.6, §10 flow 2 | Per-origin grant prompt; site-access list; revoke; graceful decline; no `` at install. |
+| `capture-switch.spec.ts` | §9.2, §10 flow 3 | Capture A, capture B, switch to A; app reflects A; pre-switch snapshot created; per-store result shown; ≤ 2 clicks. |
+| `correctness-matrix.spec.ts` | §13.6 (a)–(e) | Five auth-variant scenarios: cookie-session, multi-domain SSO, localStorage SPA, CHIPS/partitioned cookie, IndexedDB (disclosed not-captured). Each either switches cleanly or fails loudly with a snapshot. |
+| `playwright-export.spec.ts` | §9.3, §13.7 | Export storageState JSON; field validation; copy button; **capstone §13.7 round-trip**: use exported storageState in a fresh Playwright context to authenticate the demo app without re-login. |
+| `cookie-editor.spec.ts` | §9.1 | View, add, edit, delete, delete-all, JSON import, JSON export, round-trip. |
+
+---
+
+## What the demo-app provides
+
+`e2e/demo-app/server.js` is a zero-dependency Node HTTP server that serves five
+auth variants matching the §13.6 correctness matrix:
+
+| Route | Auth method | Spec scenario |
+|---|---|---|
+| `/cookie-session` | `sess_user` cookie | (a) single-origin |
+| `/multi-domain-sso` | `sso_app_user` + `sso_auth_token` cookies | (b) multi-domain SSO |
+| `/localstorage-spa` | `localStorage.sessionist_ls_token` (fake JWT) | (c) localStorage SPA |
+| `/chips-cookie` | `chips_user` cookie with `Partitioned` flag | (d) CHIPS |
+| `/indexeddb-token` | IndexedDB `sessionist-demo/auth` store | (e) IndexedDB (not captured) |
+| `/status` | JSON: current server-readable auth state | Assertion helper |
+| `POST /login?variant=&user=` | — | Login for cookie-based variants |
+| `POST /logout?variant=` | — | Logout for cookie-based variants |
+
+---
+
+## E2E vs unit/integration split
+
+### Covered by these E2E specs
+
+- Full UX flows from the extension side panel to the demo app and back.
+- Per-origin permission grant/revoke lifecycle.
+- Profile capture → switch → snapshot round-trip (observable from the app).
+- The five §13.6 correctness scenarios as observable browser behaviour.
+- storageState JSON shape (cookies + origins/localStorage fields).
+- The §13.7 capstone: using exported storageState to authenticate a fresh context.
+
+### Left to unit / integration tests (`tests/`)
+
+- `cookieService` field mapping (name, value, domain, path, expiry, flags).
+- JSON compatibility with specific predecessor formats (EditThisCookie,
+ Cookie-Editor, etc.).
+- `profileService.capture()` internals: cookie API calls, localStorage injection.
+- `profileService.switch()` transaction sequence: clear → apply → reload.
+- Pre-switch snapshot creation logic.
+- `playwrightExport.ts` field validation against Playwright's expected shape.
+- `permissionService` grant/revoke persistence.
+- `entitlementService` Pro gating logic.
+- Crypto / AES-GCM encrypt-decrypt round-trips.
+- Telemetry event shapes (no cookie/storage values).
+- Netscape cookies.txt import/export (P1).
+- sessionStorage helper snippet generation (P1).
+- Multi-tab coordination warnings (P1).
+
+---
+
+## Fixture
+
+`e2e/fixtures/extension.ts` exports a `test` function extended with:
+
+| Fixture | Type | Description |
+|---|---|---|
+| `context` | `BrowserContext` | Persistent context with extension loaded (one per worker). |
+| `extensionId` | `string` | Chrome extension ID derived from the service worker URL. |
+| `sidepanelUrl` | `string` | `chrome-extension:///sidepanel.html` |
+| `openSidePanel(page?)` | `(Page?) => Promise` | Navigate to the side panel and return the page. |
+| `demoOrigin` | `string` | `http://localhost:4321` (or `DEMO_PORT` env). |
+
+Import in specs with:
+
+```ts
+import { test, expect } from './fixtures/extension';
+```
diff --git a/e2e/capture-switch.spec.ts b/e2e/capture-switch.spec.ts
new file mode 100644
index 0000000..cab2d7b
--- /dev/null
+++ b/e2e/capture-switch.spec.ts
@@ -0,0 +1,205 @@
+/**
+ * capture-switch.spec.ts
+ *
+ * Covers PRD §9.2 (Session profiles) and §10 UX flow 3 (Capture & switch).
+ *
+ * These tests are RED until the extension features are implemented.
+ *
+ * PRD acceptance criteria tested here:
+ * - §9.2: Capture identity A, log in as B, capture B, switch back to A
+ * - §9.2: After switch, the demo app reflects identity A (not B)
+ * - §9.2: A pre-switch snapshot was created before switch executed
+ * - §9.2: Per-store result (success/failure) is shown after switch
+ * - §9.2: Switch takes ≤ 2 clicks after setup
+ * - §9.2: Switching between identities never leaves state half-applied silently
+ *
+ * Left to unit tests:
+ * - profileService.capture() internals (cookie + localStorage collection)
+ * - profileService.switch() transaction sequence
+ * - Pre-switch snapshot creation logic
+ * - Per-store apply result generation
+ */
+
+import { test, expect } from './fixtures/extension';
+
+test.describe('Capture & switch — identity A → B → A (§9.2 / §10 flow 3)', () => {
+ /**
+ * Helper: log in to the cookie-session demo app as the given user by
+ * sending a POST to the demo server's /login endpoint.
+ */
+ async function loginAsCookieUser(
+ page: import('@playwright/test').Page,
+ demoOrigin: string,
+ user: string,
+ ) {
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=${encodeURIComponent(user)}`, {
+ waitUntil: 'networkidle',
+ });
+ // The server redirects to /cookie-session after login.
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+ }
+
+ test('full capture-A → capture-B → switch-to-A cycle reflects identity A in app', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const demoPage = await context.newPage();
+
+ // ── Step 1: Log in as Alice, open extension, capture profile "Alice" ──
+ await loginAsCookieUser(demoPage, demoOrigin, 'alice');
+ await expect(demoPage.getByTestId('username')).toHaveText('alice');
+
+ const panel = await openSidePanel(demoPage);
+
+ // Grant site access if needed.
+ const grantIfNeeded = async () => {
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) {
+ await grantBtn.click();
+ }
+ };
+
+ await panel.getByRole('button', { name: /capture session/i }).click();
+ await grantIfNeeded();
+
+ const profileNameInput = panel.getByRole('textbox', { name: /profile name/i });
+ await profileNameInput.fill('Alice');
+ await panel.getByRole('button', { name: /save|confirm/i }).click();
+
+ const aliceEntry = panel.getByText('Alice');
+ await expect(aliceEntry).toBeVisible({ timeout: 10_000 });
+
+ // ── Step 2: Log in as Bob, capture profile "Bob" ──
+ await loginAsCookieUser(demoPage, demoOrigin, 'bob');
+ await expect(demoPage.getByTestId('username')).toHaveText('bob');
+
+ await panel.getByRole('button', { name: /capture session/i }).click();
+ await profileNameInput.fill('Bob');
+ await panel.getByRole('button', { name: /save|confirm/i }).click();
+
+ await expect(panel.getByText('Bob')).toBeVisible({ timeout: 10_000 });
+
+ // ── Step 3: Switch back to Alice (≤ 2 clicks after setup) ──
+ const aliceProfile = panel.getByTestId('profile-item').filter({ hasText: 'Alice' });
+ await aliceProfile.click(); // click 1: select
+
+ const switchBtn = panel.getByRole('button', { name: /switch|apply/i });
+ await switchBtn.click(); // click 2: confirm
+
+ // ── Step 4: Assert demo app shows Alice ──
+ await demoPage.waitForURL(`${demoOrigin}/cookie-session`);
+ await expect(demoPage.getByTestId('username')).toHaveText('alice', { timeout: 15_000 });
+ await expect(demoPage.getByTestId('auth-status')).not.toHaveClass(/logged-out/, {
+ timeout: 10_000,
+ });
+ });
+
+ test('a pre-switch snapshot is created before switch executes', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const demoPage = await context.newPage();
+
+ await loginAsCookieUser(demoPage, demoOrigin, 'alice');
+ const panel = await openSidePanel(demoPage);
+
+ // Capture Alice.
+ await panel.getByRole('button', { name: /capture session/i }).click();
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ await panel.getByRole('textbox', { name: /profile name/i }).fill('Alice');
+ await panel.getByRole('button', { name: /save|confirm/i }).click();
+
+ // Capture Bob.
+ await loginAsCookieUser(demoPage, demoOrigin, 'bob');
+ await panel.getByRole('button', { name: /capture session/i }).click();
+ await panel.getByRole('textbox', { name: /profile name/i }).fill('Bob');
+ await panel.getByRole('button', { name: /save|confirm/i }).click();
+
+ // Switch to Alice.
+ await panel.getByTestId('profile-item').filter({ hasText: 'Alice' }).click();
+ await panel.getByRole('button', { name: /switch|apply/i }).click();
+
+ // PRD §9.2 step 2: a pre-switch snapshot must be automatically created.
+ const snapshotList = panel.getByTestId('snapshot-list');
+ await expect(snapshotList).toBeVisible({ timeout: 10_000 });
+
+ // At least one snapshot entry should exist (the auto-snapshot of Bob's state).
+ const snapshotItems = snapshotList.getByTestId('snapshot-item');
+ await expect(snapshotItems).toHaveCount(1, { timeout: 5_000 });
+ });
+
+ test('per-store switch results are shown after switch completes', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const demoPage = await context.newPage();
+ await loginAsCookieUser(demoPage, demoOrigin, 'alice');
+ const panel = await openSidePanel(demoPage);
+
+ // Quick capture → switch cycle.
+ await panel.getByRole('button', { name: /capture session/i }).click();
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ await panel.getByRole('textbox', { name: /profile name/i }).fill('Alice');
+ await panel.getByRole('button', { name: /save|confirm/i }).click();
+
+ await loginAsCookieUser(demoPage, demoOrigin, 'bob');
+ await panel.getByRole('button', { name: /capture session/i }).click();
+ await panel.getByRole('textbox', { name: /profile name/i }).fill('Bob');
+ await panel.getByRole('button', { name: /save|confirm/i }).click();
+
+ await panel.getByTestId('profile-item').filter({ hasText: 'Alice' }).click();
+ await panel.getByRole('button', { name: /switch|apply/i }).click();
+
+ // PRD §9.2 step 6: surface success/failure per store.
+ // We expect to see a result summary with at least a "cookies" row.
+ const switchResult = panel.getByTestId('switch-result');
+ await expect(switchResult).toBeVisible({ timeout: 10_000 });
+
+ const cookieResult = switchResult.getByText(/cookie/i);
+ await expect(cookieResult).toBeVisible();
+ });
+
+ test('switch never half-applies silently — result is shown for every store', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ // This test validates the §13.6 invariant: each store must report success OR
+ // failure explicitly. No store may silently succeed or silently fail.
+ const demoPage = await context.newPage();
+
+ // Use the localStorage SPA to ensure both cookies AND localStorage are in scope.
+ await demoPage.goto(`${demoOrigin}/localstorage-spa`);
+ await demoPage.getByRole('button', { name: /log in as carol/i }).click();
+
+ const panel = await openSidePanel(demoPage);
+
+ await panel.getByRole('button', { name: /capture session/i }).click();
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ await panel.getByRole('textbox', { name: /profile name/i }).fill('Carol');
+ await panel.getByRole('button', { name: /save|confirm/i }).click();
+
+ // Log out, then switch back.
+ await demoPage.getByRole('button', { name: /log out/i }).click();
+
+ await panel.getByTestId('profile-item').filter({ hasText: 'Carol' }).click();
+ await panel.getByRole('button', { name: /switch|apply/i }).click();
+
+ // Every store present in the profile must have an explicit result entry.
+ const switchResult = panel.getByTestId('switch-result');
+ await expect(switchResult).toBeVisible({ timeout: 10_000 });
+
+ // localStorage result must be shown (even if it says "not captured").
+ const localStorageResult = switchResult.getByText(/localStorage|local storage/i);
+ await expect(localStorageResult).toBeVisible();
+ });
+});
diff --git a/e2e/cookie-editor.spec.ts b/e2e/cookie-editor.spec.ts
new file mode 100644
index 0000000..62c5888
--- /dev/null
+++ b/e2e/cookie-editor.spec.ts
@@ -0,0 +1,288 @@
+/**
+ * cookie-editor.spec.ts
+ *
+ * Covers PRD §9.1 (Cookie editor — free forever).
+ *
+ * These tests are RED until the extension features are implemented.
+ *
+ * PRD acceptance criteria tested here:
+ * - §9.1: View cookies for the active tab's domain
+ * - §9.1: Add a new cookie
+ * - §9.1: Edit an existing cookie (name, value, path, expiry, flags)
+ * - §9.1: Delete a single cookie
+ * - §9.1: "Delete all for this site" (bulk delete)
+ * - §9.1: JSON export — exported JSON round-trips without data loss
+ * - §9.1: JSON import — cookies from pasted JSON appear in the editor
+ * - §9.1: Exported JSON round-trips (import → export → same set)
+ *
+ * Left to unit tests:
+ * - cookieService field-mapping correctness
+ * - JSON schema compatibility with common predecessor formats
+ * - Netscape cookies.txt format (P1)
+ */
+
+import { test, expect } from './fixtures/extension';
+
+test.describe('Cookie editor — view / add / edit / delete (§9.1)', () => {
+ test('cookie list is visible after granting site access', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ // Set a cookie via server login so there is something to display.
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=alice`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+
+ // Grant access.
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ // The cookie-editor view / cookie list must be visible.
+ const cookieList = panel.getByTestId('cookie-list');
+ await expect(cookieList).toBeVisible({ timeout: 10_000 });
+
+ // The 'sess_user' cookie set by the server must appear.
+ const cookieRow = cookieList.getByText('sess_user');
+ await expect(cookieRow).toBeVisible();
+ });
+
+ test('add a new cookie — appears in the list', async ({ context, openSidePanel, demoOrigin }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ // Click "Add cookie" button.
+ const addBtn = panel.getByRole('button', { name: /add cookie/i });
+ await addBtn.click();
+
+ // Fill in the cookie form.
+ const nameField = panel
+ .getByRole('textbox', { name: /^name$/i })
+ .or(panel.getByPlaceholder(/cookie name/i));
+ const valueField = panel
+ .getByRole('textbox', { name: /^value$/i })
+ .or(panel.getByPlaceholder(/cookie value/i));
+
+ await nameField.fill('test_cookie');
+ await valueField.fill('test_value_123');
+
+ const saveBtn = panel.getByRole('button', { name: /save|add|confirm/i }).last();
+ await saveBtn.click();
+
+ // New cookie must appear in the list.
+ const cookieList = panel.getByTestId('cookie-list');
+ await expect(cookieList.getByText('test_cookie')).toBeVisible({ timeout: 10_000 });
+ await expect(cookieList.getByText('test_value_123')).toBeVisible();
+ });
+
+ test('edit an existing cookie value', async ({ context, openSidePanel, demoOrigin }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=alice`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ // Click edit on the sess_user cookie.
+ const cookieList = panel.getByTestId('cookie-list');
+ const sessRow = cookieList.getByTestId('cookie-row').filter({ hasText: 'sess_user' });
+ await sessRow.getByRole('button', { name: /edit/i }).click();
+
+ // Change the value.
+ const valueField = panel
+ .getByRole('textbox', { name: /^value$/i })
+ .or(panel.getByPlaceholder(/cookie value/i));
+ await valueField.clear();
+ await valueField.fill('edited_value');
+
+ await panel
+ .getByRole('button', { name: /save|update|confirm/i })
+ .last()
+ .click();
+
+ // Updated value must be visible in the list.
+ await expect(cookieList.getByText('edited_value')).toBeVisible({ timeout: 10_000 });
+ });
+
+ test('delete a single cookie — removed from the list', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=alice`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ const cookieList = panel.getByTestId('cookie-list');
+ const sessRow = cookieList.getByTestId('cookie-row').filter({ hasText: 'sess_user' });
+ await sessRow.getByRole('button', { name: /delete|remove/i }).click();
+
+ // Confirmation if the UI asks for it.
+ const confirmBtn = panel.getByRole('button', { name: /confirm|yes|delete/i });
+ if (await confirmBtn.isVisible({ timeout: 2_000 }).catch(() => false)) await confirmBtn.click();
+
+ // Cookie row must be gone.
+ await expect(cookieList.getByText('sess_user')).not.toBeVisible({ timeout: 10_000 });
+ });
+
+ test('"Delete all" removes every cookie for the site', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=alice`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ const deleteAllBtn = panel.getByRole('button', { name: /delete all/i });
+ await deleteAllBtn.click();
+
+ const confirmBtn = panel.getByRole('button', { name: /confirm|yes|delete/i });
+ if (await confirmBtn.isVisible({ timeout: 2_000 }).catch(() => false)) await confirmBtn.click();
+
+ // The cookie list should be empty (or show an empty-state message).
+ const cookieList = panel.getByTestId('cookie-list');
+ await expect(cookieList.getByTestId('cookie-row')).toHaveCount(0, { timeout: 10_000 });
+ });
+});
+
+test.describe('Cookie editor — JSON import / export (§9.1)', () => {
+ test('export cookies as JSON — downloaded/displayed JSON contains the cookie', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=alice`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ // Click Export JSON.
+ const exportBtn = panel.getByRole('button', { name: /export.*json|json.*export/i });
+ await exportBtn.click();
+
+ // JSON is shown in a textarea / pre or downloaded.
+ // We check the displayed output path (download path is environment-dependent).
+ const jsonOutput = panel
+ .getByTestId('cookie-export-json')
+ .or(panel.getByRole('textbox', { name: /exported json/i }));
+ await expect(jsonOutput).toBeVisible({ timeout: 10_000 });
+
+ const jsonText = await jsonOutput.textContent();
+ const parsed: Array<{ name: string }> = JSON.parse(jsonText ?? '[]');
+ expect(parsed.some((c) => c.name === 'sess_user')).toBe(true);
+ });
+
+ test('import JSON — cookies appear in the editor list', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ const importBtn = panel.getByRole('button', { name: /import.*json|json.*import/i });
+ await importBtn.click();
+
+ const cookieJson = JSON.stringify([
+ {
+ name: 'imported_test',
+ value: 'imported_value',
+ domain: 'localhost',
+ path: '/',
+ secure: false,
+ httpOnly: false,
+ expirationDate: Math.floor(Date.now() / 1000) + 3600,
+ sameSite: 'Lax',
+ },
+ ]);
+
+ const jsonInput = panel
+ .getByRole('textbox', { name: /paste|json/i })
+ .or(panel.getByTestId('cookie-import-textarea'));
+ await jsonInput.fill(cookieJson);
+
+ const confirmBtn = panel.getByRole('button', { name: /import|confirm/i }).last();
+ await confirmBtn.click();
+
+ const cookieList = panel.getByTestId('cookie-list');
+ await expect(cookieList.getByText('imported_test')).toBeVisible({ timeout: 10_000 });
+ await expect(cookieList.getByText('imported_value')).toBeVisible();
+ });
+
+ test('JSON round-trip: import then export produces the same cookie name/value', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) await grantBtn.click();
+
+ const originalCookies = [
+ {
+ name: 'rt_cookie',
+ value: 'round_trip_value',
+ domain: 'localhost',
+ path: '/',
+ secure: false,
+ httpOnly: false,
+ expirationDate: Math.floor(Date.now() / 1000) + 7200,
+ sameSite: 'Lax',
+ },
+ ];
+
+ // Import.
+ await panel.getByRole('button', { name: /import.*json|json.*import/i }).click();
+ const jsonInput = panel
+ .getByRole('textbox', { name: /paste|json/i })
+ .or(panel.getByTestId('cookie-import-textarea'));
+ await jsonInput.fill(JSON.stringify(originalCookies));
+ await panel
+ .getByRole('button', { name: /import|confirm/i })
+ .last()
+ .click();
+ await expect(panel.getByTestId('cookie-list').getByText('rt_cookie')).toBeVisible({
+ timeout: 10_000,
+ });
+
+ // Export.
+ await panel.getByRole('button', { name: /export.*json|json.*export/i }).click();
+ const jsonOutput = panel
+ .getByTestId('cookie-export-json')
+ .or(panel.getByRole('textbox', { name: /exported json/i }));
+ await expect(jsonOutput).toBeVisible({ timeout: 10_000 });
+
+ const exportedText = await jsonOutput.textContent();
+ const exported: Array<{ name: string; value: string }> = JSON.parse(exportedText ?? '[]');
+
+ const match = exported.find((c) => c.name === 'rt_cookie');
+ expect(match).toBeDefined();
+ expect(match?.value).toBe('round_trip_value');
+ });
+});
diff --git a/e2e/correctness-matrix.spec.ts b/e2e/correctness-matrix.spec.ts
new file mode 100644
index 0000000..0550000
--- /dev/null
+++ b/e2e/correctness-matrix.spec.ts
@@ -0,0 +1,386 @@
+/**
+ * correctness-matrix.spec.ts
+ *
+ * Covers PRD §13.6 correctness test matrix — five scenarios (a)–(e).
+ *
+ * These tests are RED until the extension features are implemented.
+ *
+ * From §13.6:
+ * "E2E-validate capture→switch→restore against at least:
+ * (a) a single-origin cookie-session app,
+ * (b) a multi-domain SSO app,
+ * (c) a localStorage-token SPA,
+ * (d) a CHIPS/partitioned-cookie case,
+ * (e) an IndexedDB-token app (to confirm the §9.2 limitation behaves as
+ * disclosed).
+ * Each must either switch cleanly OR fail loudly with a recoverable snapshot
+ * — never half-switch silently."
+ *
+ * The demo-app server (e2e/demo-app/server.js) provides all five routes.
+ *
+ * Left to unit tests:
+ * - Cookie serialization for each variant
+ * - domainScope field population from multi-domain scenarios
+ * - UnsupportedStoreNotice generation for IndexedDB
+ */
+
+import { test, expect } from './fixtures/extension';
+import type { Page } from '@playwright/test';
+
+// ────────────────────────────────────────────────────────────────────────────
+// Shared helpers
+// ────────────────────────────────────────────────────────────────────────────
+
+/**
+ * Grant the extension access to the current page origin and capture a profile
+ * with the given name. Returns after the profile is visible in the panel.
+ */
+async function captureProfile(panel: Page, name: string): Promise {
+ await panel.getByRole('button', { name: /capture session/i }).click();
+
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ if (await grantBtn.isVisible({ timeout: 3_000 }).catch(() => false)) {
+ await grantBtn.click();
+ }
+
+ const nameInput = panel.getByRole('textbox', { name: /profile name/i });
+ await nameInput.fill(name);
+ await panel.getByRole('button', { name: /save|confirm/i }).click();
+ await expect(panel.getByText(name)).toBeVisible({ timeout: 10_000 });
+}
+
+/**
+ * Switch to a named profile and wait for the switch-result summary to appear.
+ */
+async function switchToProfile(panel: Page, name: string): Promise {
+ await panel.getByTestId('profile-item').filter({ hasText: name }).click();
+ await panel.getByRole('button', { name: /switch|apply/i }).click();
+ await expect(panel.getByTestId('switch-result')).toBeVisible({ timeout: 15_000 });
+}
+
+// ────────────────────────────────────────────────────────────────────────────
+// (a) Single-origin cookie-session app
+// ────────────────────────────────────────────────────────────────────────────
+
+test.describe('(a) Single-origin cookie-session app', () => {
+ test('capture alice, switch to bob, switch back to alice — app shows alice', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=alice`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+ await expect(page.getByTestId('username')).toHaveText('alice');
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Alice-cookie');
+
+ // Switch identities.
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=bob`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+ await captureProfile(panel, 'Bob-cookie');
+
+ // Switch back to Alice.
+ await switchToProfile(panel, 'Alice-cookie');
+
+ // App must reflect Alice after tab reload.
+ await page.waitForLoadState('domcontentloaded');
+ await expect(page.getByTestId('username')).toHaveText('alice', { timeout: 15_000 });
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/);
+ });
+
+ test('switch result shows cookies store as succeeded', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=alice`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Alice-cookie-2');
+
+ await page.goto(`${demoOrigin}/login?variant=cookie-session&user=bob`);
+ await page.waitForURL(`${demoOrigin}/cookie-session`);
+ await captureProfile(panel, 'Bob-cookie-2');
+
+ await switchToProfile(panel, 'Alice-cookie-2');
+
+ const result = panel.getByTestId('switch-result');
+ // Cookie store must report success.
+ await expect(result.getByText(/cookie.*success|success.*cookie/i)).toBeVisible();
+ });
+});
+
+// ────────────────────────────────────────────────────────────────────────────
+// (b) Multi-domain SSO app
+// ────────────────────────────────────────────────────────────────────────────
+
+test.describe('(b) Multi-domain SSO app', () => {
+ test('captures both sso_app_user and sso_auth_token cookies; switch restores both', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=multi-domain-sso&user=alice-sso`);
+ await page.waitForURL(`${demoOrigin}/multi-domain-sso`);
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/);
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Alice-SSO');
+
+ // Switch to Bob.
+ await page.goto(`${demoOrigin}/login?variant=multi-domain-sso&user=bob-sso`);
+ await page.waitForURL(`${demoOrigin}/multi-domain-sso`);
+ await captureProfile(panel, 'Bob-SSO');
+
+ // Switch back to Alice.
+ await switchToProfile(panel, 'Alice-SSO');
+ await page.waitForLoadState('domcontentloaded');
+
+ // Both cookies must have been restored. The demo app only shows logged-in
+ // if BOTH cookies are present.
+ await expect(page.getByTestId('username')).toHaveText('alice-sso', { timeout: 15_000 });
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/);
+ });
+
+ test('domainScope field in the profile UI lists multiple cookie paths/origins', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=multi-domain-sso&user=alice-sso`);
+ await page.waitForURL(`${demoOrigin}/multi-domain-sso`);
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Alice-SSO-scope');
+
+ // Inspect the profile detail view for the domainScope information.
+ await panel.getByTestId('profile-item').filter({ hasText: 'Alice-SSO-scope' }).click();
+ const detailView = panel.getByTestId('profile-detail');
+ await expect(detailView).toBeVisible({ timeout: 10_000 });
+
+ // The domainScope field must list more than one domain/path for SSO.
+ const scopeSection = detailView.getByTestId('domain-scope');
+ await expect(scopeSection).toBeVisible();
+ const scopeItems = scopeSection.getByTestId('domain-scope-item');
+ await expect(scopeItems).toHaveCount(2); // app + sso paths
+ });
+});
+
+// ────────────────────────────────────────────────────────────────────────────
+// (c) localStorage-token SPA
+// ────────────────────────────────────────────────────────────────────────────
+
+test.describe('(c) localStorage-token SPA', () => {
+ test('capture carol, clear storage, switch to carol — localStorage restored', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/localstorage-spa`);
+ await page.getByRole('button', { name: /log in as carol/i }).click();
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/);
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Carol-LS');
+
+ // Clear localStorage to simulate a logged-out state.
+ await page.getByRole('button', { name: /log out/i }).click();
+ await expect(page.getByTestId('auth-status')).toHaveClass(/logged-out/);
+
+ // Switch back to Carol.
+ await switchToProfile(panel, 'Carol-LS');
+ await page.waitForLoadState('domcontentloaded');
+
+ // The app reads localStorage on load; Carol's token should be restored.
+ await expect(page.getByTestId('username')).toHaveText('carol', { timeout: 15_000 });
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/);
+ });
+
+ test('switch result shows localStorage store as succeeded', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/localstorage-spa`);
+ await page.getByRole('button', { name: /log in as carol/i }).click();
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Carol-LS-2');
+
+ await page.getByRole('button', { name: /log out/i }).click();
+
+ await switchToProfile(panel, 'Carol-LS-2');
+
+ const result = panel.getByTestId('switch-result');
+ await expect(result.getByText(/localStorage.*success|success.*localStorage/i)).toBeVisible();
+ });
+});
+
+// ────────────────────────────────────────────────────────────────────────────
+// (d) CHIPS / partitioned-cookie case
+// ────────────────────────────────────────────────────────────────────────────
+
+test.describe('(d) CHIPS / partitioned-cookie case', () => {
+ test('captures partitioned cookie and restores it on switch', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=chips-cookie&user=dave`);
+ await page.waitForURL(`${demoOrigin}/chips-cookie`);
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/);
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Dave-CHIPS');
+
+ // Log out.
+ await page.goto(`${demoOrigin}/logout?variant=chips-cookie`);
+ await page.waitForURL(`${demoOrigin}/chips-cookie`);
+ await expect(page.getByTestId('auth-status')).toHaveClass(/logged-out/);
+
+ // Switch back to Dave.
+ await switchToProfile(panel, 'Dave-CHIPS');
+ await page.waitForLoadState('domcontentloaded');
+
+ await expect(page.getByTestId('username')).toHaveText('dave', { timeout: 15_000 });
+ });
+
+ test('CHIPS cookie captured with Partitioned attribute preserved', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ // Verify the exported storageState JSON includes the partitioned cookie.
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/login?variant=chips-cookie&user=dave`);
+ await page.waitForURL(`${demoOrigin}/chips-cookie`);
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Dave-CHIPS-export');
+
+ // Open export view.
+ await panel.getByTestId('profile-item').filter({ hasText: 'Dave-CHIPS-export' }).click();
+ await panel.getByRole('button', { name: /export.*playwright/i }).click();
+
+ const exportView = panel.getByTestId('export-view');
+ await expect(exportView).toBeVisible({ timeout: 10_000 });
+
+ // The storageState JSON must include the chips_user cookie.
+ const jsonOutput = await exportView.getByTestId('storage-state-json').textContent();
+ const parsed = JSON.parse(jsonOutput ?? '{}');
+ const cookies: Array<{ name: string; partitionKey?: unknown }> = parsed?.cookies ?? [];
+ const chipsCookie = cookies.find((c) => c.name === 'chips_user');
+ expect(chipsCookie).toBeDefined();
+ });
+});
+
+// ────────────────────────────────────────────────────────────────────────────
+// (e) IndexedDB-token app — disclosed NOT captured
+// ────────────────────────────────────────────────────────────────────────────
+
+test.describe('(e) IndexedDB-token app — limitation disclosed, not silent', () => {
+ test('capture on IndexedDB app shows "not captured" notice for IndexedDB store', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/indexeddb-token`);
+ await page.getByRole('button', { name: /log in as eve/i }).click();
+
+ // Wait for the page to update (IndexedDB is async).
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/, {
+ timeout: 10_000,
+ });
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Eve-IDB');
+
+ // Inspect the profile — it must surface an UnsupportedStoreNotice for IndexedDB.
+ await panel.getByTestId('profile-item').filter({ hasText: 'Eve-IDB' }).click();
+ const detailView = panel.getByTestId('profile-detail');
+ await expect(detailView).toBeVisible({ timeout: 10_000 });
+
+ // PRD §13.6: "Unsupported stores must be visible in UI as 'not captured'."
+ const notice = detailView.getByTestId('unsupported-store-notice');
+ await expect(notice).toBeVisible();
+ await expect(notice.getByText(/IndexedDB/i)).toBeVisible();
+ await expect(notice.getByText(/not captured/i)).toBeVisible();
+ });
+
+ test('switch on IndexedDB-auth app fails loudly with a recoverable pre-switch snapshot', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/indexeddb-token`);
+ await page.getByRole('button', { name: /log in as eve/i }).click();
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/, {
+ timeout: 10_000,
+ });
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Eve-IDB-switch');
+
+ // Log out.
+ await page.getByRole('button', { name: /log out/i }).click();
+
+ // Switch to Eve. This should NOT silently succeed — it must either:
+ // (a) warn before switching that IndexedDB is excluded, or
+ // (b) complete and then clearly show IndexedDB was not applied.
+ await switchToProfile(panel, 'Eve-IDB-switch');
+
+ const result = panel.getByTestId('switch-result');
+ await expect(result).toBeVisible({ timeout: 10_000 });
+
+ // The switch result must NOT show IndexedDB as "succeeded" (it cannot).
+ const idbResultText = await result.getByText(/IndexedDB/i).textContent();
+ // Must contain "not captured", "skipped", "unsupported", or similar — not "success".
+ expect(idbResultText?.toLowerCase()).not.toMatch(/success/);
+ expect(idbResultText?.toLowerCase()).toMatch(/not captured|skipped|unsupported|partial/);
+
+ // A pre-switch snapshot must have been created for recovery.
+ const snapshots = panel.getByTestId('snapshot-list');
+ await expect(snapshots).toBeVisible({ timeout: 5_000 });
+ await expect(snapshots.getByTestId('snapshot-item')).toHaveCount(1);
+ });
+
+ test('IndexedDB app remains logged-out after switch (auth cannot be restored)', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ // After a switch that cannot restore IndexedDB auth, the app must still
+ // show "not logged in" — not a corrupt or half-applied state.
+ const page = await context.newPage();
+ await page.goto(`${demoOrigin}/indexeddb-token`);
+ await page.getByRole('button', { name: /log in as eve/i }).click();
+ await expect(page.getByTestId('auth-status')).not.toHaveClass(/logged-out/, {
+ timeout: 10_000,
+ });
+
+ const panel = await openSidePanel(page);
+ await captureProfile(panel, 'Eve-IDB-clean');
+
+ await page.getByRole('button', { name: /log out/i }).click();
+ await expect(page.getByTestId('auth-status')).toHaveClass(/logged-out/);
+
+ await switchToProfile(panel, 'Eve-IDB-clean');
+ await page.waitForLoadState('domcontentloaded');
+
+ // The app must NOT show a corrupted logged-in state.
+ // It should be cleanly logged-out (IndexedDB not restored) — which is the
+ // honest "disclosed not captured" behaviour from PRD §9.2.
+ await expect(page.getByTestId('auth-status')).toHaveClass(/logged-out/, { timeout: 10_000 });
+ });
+});
diff --git a/e2e/demo-app/server.cjs b/e2e/demo-app/server.cjs
new file mode 100644
index 0000000..b3f8ecc
--- /dev/null
+++ b/e2e/demo-app/server.cjs
@@ -0,0 +1,492 @@
+/**
+ * Sessionist E2E demo-app server
+ *
+ * A minimal Node.js HTTP server (no dependencies beyond Node core) that
+ * simulates the §13.6 correctness-matrix auth scenarios:
+ *
+ * GET / — landing page (links to each auth variant)
+ * GET /cookie-session — (a) single-origin cookie-session app
+ * GET /multi-domain-sso — (b) multi-domain SSO simulation (sets cookies on
+ * two different paths to simulate cross-origin scope)
+ * GET /localstorage-spa — (c) localStorage-token SPA
+ * GET /chips-cookie — (d) CHIPS / partitioned-cookie app
+ * GET /indexeddb-token — (e) IndexedDB-token app (auth NOT captured)
+ * GET /status — JSON: { loggedIn, user, method } based on request
+ * cookies/headers — used by Playwright assertions
+ *
+ * Auth flow per variant:
+ * POST /login?variant=&user= — "logs in" by setting the appropriate
+ * auth artifact for that variant
+ * POST /logout?variant= — clears auth for that variant
+ *
+ * Design constraints:
+ * - Zero npm dependencies: pure Node http + fs.
+ * - Self-contained HTML served as inline strings.
+ * - No build step required.
+ * - CORS permissive (localhost only) for Playwright storageState testing.
+ */
+
+// @ts-check
+'use strict';
+
+const http = require('http');
+const url = require('url');
+
+const PORT = parseInt(process.env.DEMO_PORT || '4321', 10);
+
+// ---------------------------------------------------------------------------
+// HTML templates
+// ---------------------------------------------------------------------------
+
+const page = (title, body) => `
+
+
+
+ ${title} — Sessionist Demo App
+
+
+
+
+ Home
+ Cookie session
+ Multi-domain SSO
+ localStorage SPA
+ CHIPS cookie
+ IndexedDB token
+ Status JSON
+
+ ${title}
+ ${body}
+
+`;
+
+// ---------------------------------------------------------------------------
+// Cookie helpers
+// ---------------------------------------------------------------------------
+
+/** Parse a Cookie header into a name→value map. */
+function parseCookies(header) {
+ const out = {};
+ if (!header) return out;
+ for (const part of header.split(';')) {
+ const [k, ...rest] = part.trim().split('=');
+ if (k) out[k.trim()] = rest.join('=').trim();
+ }
+ return out;
+}
+
+/** Build a Set-Cookie header value. */
+function setCookie(name, value, opts = {}) {
+ let c = `${name}=${value}; Path=${opts.path || '/'}`;
+ if (opts.httpOnly) c += '; HttpOnly';
+ if (opts.sameSite) c += `; SameSite=${opts.sameSite}`;
+ if (opts.partitioned) c += '; Partitioned';
+ if (opts.maxAge !== undefined) c += `; Max-Age=${opts.maxAge}`;
+ return c;
+}
+
+/** Build a Set-Cookie header that clears a cookie. */
+function clearCookie(name, path = '/') {
+ return `${name}=; Path=${path}; Max-Age=0`;
+}
+
+// ---------------------------------------------------------------------------
+// Request body helper
+// ---------------------------------------------------------------------------
+
+function readBody(req) {
+ return new Promise((resolve) => {
+ let data = '';
+ req.on('data', (chunk) => (data += chunk));
+ req.on('end', () => resolve(data));
+ });
+}
+
+// ---------------------------------------------------------------------------
+// Route handlers
+// ---------------------------------------------------------------------------
+
+function handleRoot(req, res) {
+ const body = `
+ This demo app simulates five auth variants from PRD §13.6.
+
+ Use POST /login?variant=<v>&user=<name> to log in.
`;
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(page('Sessionist Demo App', body));
+}
+
+// (a) Single-origin cookie-session
+function handleCookieSession(req, res) {
+ const cookies = parseCookies(req.headers['cookie']);
+ const user = cookies['sess_user'] || null;
+ const loggedIn = Boolean(user);
+
+ const body = `
+
+ ${loggedIn ? `Logged in as ${user} ` : 'Not logged in'}
+
+ Auth method: session cookie (sess_user)
+
+ `;
+
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(page('(a) Cookie-Session App', body));
+}
+
+// (b) Multi-domain SSO simulation
+// We simulate multi-domain by using two cookie names on different paths.
+function handleMultiDomainSSO(req, res) {
+ const cookies = parseCookies(req.headers['cookie']);
+ const appUser = cookies['sso_app_user'] || null;
+ const authToken = cookies['sso_auth_token'] || null;
+ const loggedIn = Boolean(appUser && authToken);
+
+ const body = `
+
+ ${
+ loggedIn
+ ? `Logged in as ${appUser} (auth token present)`
+ : 'Not logged in — both app cookie and auth token required'
+ }
+
+ Auth method: sso_app_user + sso_auth_token cookies (simulates multi-domain scope)
+
+ `;
+
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(page('(b) Multi-Domain SSO App', body));
+}
+
+// (c) localStorage SPA
+// Auth token is stored in localStorage by the page itself.
+function handleLocalStorageSPA(req, res) {
+ const body = `
+
+ Checking localStorage…
+
+ Auth method: localStorage.sessionist_ls_token
+ Log in as carol
+ Log out
+ `;
+
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(page('(c) localStorage SPA', body));
+}
+
+// (d) CHIPS / partitioned-cookie
+function handleCHIPS(req, res) {
+ const cookies = parseCookies(req.headers['cookie']);
+ const user = cookies['chips_user'] || null;
+ const loggedIn = Boolean(user);
+
+ const body = `
+
+ ${loggedIn ? `Logged in as ${user} ` : 'Not logged in'}
+
+ Auth method: chips_user cookie (Partitioned / CHIPS flag set)
+ Note: CHIPS cookies are partitioned by top-level site. The Partitioned flag
+ is set in Set-Cookie; whether it is honoured depends on browser support and
+ the embedding context.
+
+ `;
+
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(page('(d) CHIPS / Partitioned-Cookie App', body));
+}
+
+// (e) IndexedDB token — auth intentionally NOT captured by Sessionist
+function handleIndexedDB(req, res) {
+ const body = `
+
+ Checking IndexedDB…
+
+ Auth method: IndexedDB — "sessionist-demo" / "auth" store
+ Important: Sessionist MVP does not capture IndexedDB auth tokens.
+ This scenario must show "not captured" in the UI and fail loudly — not silently
+ half-switch. See PRD §9.2 and §13.6(e).
+ Log in as eve
+ Log out
+ `;
+
+ res.writeHead(200, { 'Content-Type': 'text/html' });
+ res.end(page('(e) IndexedDB-Token App', body));
+}
+
+// JSON status endpoint — returns auth state readable by Playwright assertions
+// without having to parse HTML.
+function handleStatus(req, res) {
+ const cookies = parseCookies(req.headers['cookie']);
+ const status = {
+ cookieSession: {
+ loggedIn: Boolean(cookies['sess_user']),
+ user: cookies['sess_user'] || null,
+ },
+ multiDomainSSO: {
+ loggedIn: Boolean(cookies['sso_app_user'] && cookies['sso_auth_token']),
+ user: cookies['sso_app_user'] || null,
+ },
+ chipsCookie: {
+ loggedIn: Boolean(cookies['chips_user']),
+ user: cookies['chips_user'] || null,
+ },
+ // localStorage and IndexedDB cannot be read server-side; clients must check
+ // the respective page DOM or localStorage directly.
+ };
+ res.writeHead(200, {
+ 'Content-Type': 'application/json',
+ 'Access-Control-Allow-Origin': '*',
+ });
+ res.end(JSON.stringify(status, null, 2));
+}
+
+// ---------------------------------------------------------------------------
+// Login / logout POST handlers
+// ---------------------------------------------------------------------------
+
+async function handleLogin(req, res, query) {
+ await readBody(req); // consume body (form data)
+ const params = new URLSearchParams(query.search || '');
+ const variant = params.get('variant') || 'cookie-session';
+ // Extract user from URL params (fallback to form body parsing is omitted for
+ // brevity — tests drive login via query string).
+ const user = params.get('user') || 'testuser';
+
+ const headers = { Location: `/${variant}` };
+
+ switch (variant) {
+ case 'cookie-session':
+ headers['Set-Cookie'] = setCookie('sess_user', user, { httpOnly: true, sameSite: 'Lax' });
+ break;
+ case 'multi-domain-sso':
+ headers['Set-Cookie'] = [
+ setCookie('sso_app_user', user, { httpOnly: true, sameSite: 'Lax' }),
+ setCookie('sso_auth_token', 'tok-' + Math.random().toString(36).slice(2), {
+ httpOnly: true,
+ sameSite: 'Lax',
+ path: '/sso',
+ }),
+ ];
+ break;
+ case 'chips-cookie':
+ headers['Set-Cookie'] = setCookie('chips_user', user, {
+ sameSite: 'None',
+ partitioned: true,
+ // Secure would normally be required but localhost exempts it:
+ });
+ break;
+ default:
+ break;
+ }
+
+ res.writeHead(302, headers);
+ res.end();
+}
+
+async function handleLogout(req, res, query) {
+ await readBody(req);
+ const params = new URLSearchParams(query.search || '');
+ const variant = params.get('variant') || 'cookie-session';
+
+ const headers = { Location: `/${variant}` };
+
+ switch (variant) {
+ case 'cookie-session':
+ headers['Set-Cookie'] = clearCookie('sess_user');
+ break;
+ case 'multi-domain-sso':
+ headers['Set-Cookie'] = [clearCookie('sso_app_user'), clearCookie('sso_auth_token', '/sso')];
+ break;
+ case 'chips-cookie':
+ headers['Set-Cookie'] = clearCookie('chips_user');
+ break;
+ default:
+ break;
+ }
+
+ res.writeHead(302, headers);
+ res.end();
+}
+
+// ---------------------------------------------------------------------------
+// Router
+// ---------------------------------------------------------------------------
+
+async function router(req, res) {
+ const parsed = url.parse(req.url || '/', true);
+ const pathname = parsed.pathname || '/';
+ const method = req.method || 'GET';
+
+ // CORS preflight
+ res.setHeader('Access-Control-Allow-Origin', '*');
+ res.setHeader('Access-Control-Allow-Methods', 'GET,POST,OPTIONS');
+ res.setHeader('Access-Control-Allow-Headers', 'Content-Type');
+ if (method === 'OPTIONS') {
+ res.writeHead(204);
+ res.end();
+ return;
+ }
+
+ if (method === 'GET') {
+ switch (pathname) {
+ case '/':
+ return handleRoot(req, res);
+ case '/cookie-session':
+ return handleCookieSession(req, res);
+ case '/multi-domain-sso':
+ return handleMultiDomainSSO(req, res);
+ case '/localstorage-spa':
+ return handleLocalStorageSPA(req, res);
+ case '/chips-cookie':
+ return handleCHIPS(req, res);
+ case '/indexeddb-token':
+ return handleIndexedDB(req, res);
+ case '/status':
+ return handleStatus(req, res);
+ default:
+ res.writeHead(404, { 'Content-Type': 'text/plain' });
+ return res.end('Not found');
+ }
+ }
+
+ if (method === 'POST') {
+ switch (pathname) {
+ case '/login':
+ return handleLogin(req, res, parsed);
+ case '/logout':
+ return handleLogout(req, res, parsed);
+ default:
+ res.writeHead(404, { 'Content-Type': 'text/plain' });
+ return res.end('Not found');
+ }
+ }
+
+ res.writeHead(405, { 'Content-Type': 'text/plain' });
+ res.end('Method not allowed');
+}
+
+// ---------------------------------------------------------------------------
+// Start
+// ---------------------------------------------------------------------------
+
+const server = http.createServer((req, res) => {
+ router(req, res).catch((err) => {
+ console.error('[demo-app] Error:', err);
+ if (!res.headersSent) {
+ res.writeHead(500, { 'Content-Type': 'text/plain' });
+ res.end('Internal server error');
+ }
+ });
+});
+
+server.listen(PORT, '127.0.0.1', () => {
+ console.log(`[demo-app] Listening on http://localhost:${PORT}`);
+});
+
+// Graceful shutdown
+process.on('SIGTERM', () => server.close());
+process.on('SIGINT', () => server.close());
diff --git a/e2e/fixtures/extension.ts b/e2e/fixtures/extension.ts
new file mode 100644
index 0000000..d986aae
--- /dev/null
+++ b/e2e/fixtures/extension.ts
@@ -0,0 +1,138 @@
+/**
+ * Playwright fixture: extensionFixture
+ *
+ * Launches a persistent browser context with the Sessionist MV3 extension
+ * loaded and exposes:
+ * - `extensionId` — the chrome-extension:// ID assigned at runtime
+ * - `sidepanelUrl` — chrome-extension:///sidepanel.html
+ * - `context` — the persistent BrowserContext (use for cookie/storage ops)
+ * - `openSidePanel(page?)` — navigate an existing page (or open a new one) to
+ * the side panel URL and return it
+ * - `demoOrigin` — base URL of the local demo app (from DEMO_PORT env)
+ *
+ * Usage:
+ * import { test } from '../fixtures/extension';
+ * test('my spec', async ({ extensionId, context, openSidePanel }) => { ... });
+ *
+ * Why persistent context?
+ * Regular browser.newContext() does not load extensions. Only
+ * chromium.launchPersistentContext() with --load-extension gives access to
+ * chrome.* APIs and the extension's service worker.
+ *
+ * Extension ID discovery:
+ * After the context launches, we navigate to chrome://extensions/ and read the
+ * extension ID from the DOM. An alternative (used here) is to open
+ * chrome://extensions/ via the extensions management API or look for the
+ * service-worker registration — both require the extension to have already
+ * loaded. We use the background page / service worker URL approach:
+ * context.serviceWorkers() becomes non-empty once the MV3 service worker
+ * starts; we derive the ID from its URL.
+ */
+
+import path from 'path';
+import { test as base, chromium, type BrowserContext, type Page } from '@playwright/test';
+
+const EXTENSION_PATH = path.resolve('.output/chrome-mv3');
+const DEMO_PORT = process.env['DEMO_PORT'] ?? '4321';
+export const DEMO_ORIGIN = `http://localhost:${DEMO_PORT}`;
+
+export type ExtensionFixtures = {
+ /** Chrome extension ID (e.g. "abcdefghijklmnopqrstuvwxyzabcdef") */
+ extensionId: string;
+ /** Full chrome-extension://…/sidepanel.html URL */
+ sidepanelUrl: string;
+ /** The persistent BrowserContext that has the extension loaded */
+ context: BrowserContext;
+ /**
+ * Open the Sessionist side panel in a new (or given) page.
+ * Returns the page pointed at sidepanel.html.
+ */
+ openSidePanel: (page?: Page) => Promise;
+ /** Base URL of the local demo app */
+ demoOrigin: string;
+};
+
+/**
+ * Derive the extension ID from a service-worker URL.
+ * SW URL format: chrome-extension:///background.js (or similar)
+ */
+function idFromSwUrl(url: string): string {
+ const match = /^chrome-extension:\/\/([a-z]{32})\//.exec(url);
+ if (!match || !match[1]) throw new Error(`Cannot parse extension ID from SW URL: ${url}`);
+ return match[1];
+}
+
+export const test = base.extend({
+ // eslint-disable-next-line no-empty-pattern
+ context: async ({}, use) => {
+ /**
+ * Each test worker gets its own temporary user-data-dir so that extension
+ * state does not bleed between tests. Playwright will clean up the dir.
+ */
+ const userDataDir = ''; // empty string → Playwright creates a temp dir
+ const ctx = await chromium.launchPersistentContext(userDataDir, {
+ headless: process.env['HEADLESS'] === 'true',
+ args: [
+ `--disable-extensions-except=${EXTENSION_PATH}`,
+ `--load-extension=${EXTENSION_PATH}`,
+ '--no-sandbox',
+ '--disable-infobars',
+ '--disable-features=ExtensionDisabling',
+ ],
+ // Allow Playwright to detect the MV3 service worker:
+ ignoreHTTPSErrors: true,
+ });
+
+ await use(ctx);
+ await ctx.close();
+ },
+
+ extensionId: async ({ context }, use) => {
+ /**
+ * Wait for the extension service worker to register. MV3 extensions use
+ * service workers instead of background pages.
+ *
+ * Playwright exposes context.serviceWorkers() and the 'serviceworker' event.
+ * We wait up to 10 s for at least one SW that looks like the extension.
+ */
+ let sw = context.serviceWorkers().find((s) => s.url().startsWith('chrome-extension://'));
+
+ if (!sw) {
+ sw = await Promise.race([
+ new Promise((resolve) => {
+ context.on('serviceworker', (worker) => {
+ if (worker.url().startsWith('chrome-extension://')) resolve(worker);
+ });
+ }),
+ new Promise((_, reject) =>
+ setTimeout(
+ () => reject(new Error('Extension service worker did not start within 10s')),
+ 10_000,
+ ),
+ ),
+ ]);
+ }
+
+ const id = idFromSwUrl(sw.url());
+ await use(id);
+ },
+
+ sidepanelUrl: async ({ extensionId }, use) => {
+ await use(`chrome-extension://${extensionId}/sidepanel.html`);
+ },
+
+ openSidePanel: async ({ context, sidepanelUrl }, use) => {
+ const helper = async (page?: Page): Promise => {
+ const target = page ?? (await context.newPage());
+ await target.goto(sidepanelUrl, { waitUntil: 'domcontentloaded' });
+ return target;
+ };
+ await use(helper);
+ },
+
+ demoOrigin: async ({}, use) => {
+ await use(DEMO_ORIGIN);
+ },
+});
+
+export { expect } from '@playwright/test';
diff --git a/e2e/onboarding.spec.ts b/e2e/onboarding.spec.ts
new file mode 100644
index 0000000..12e5f65
--- /dev/null
+++ b/e2e/onboarding.spec.ts
@@ -0,0 +1,113 @@
+/**
+ * onboarding.spec.ts
+ *
+ * Covers PRD §9.5 (Search-intent onboarding) and §10 UX flow 1
+ * (Replacement import).
+ *
+ * These tests are RED until the extension features are implemented.
+ * The tests intentionally assert against a working extension; they document
+ * the required behaviour rather than verifying it today.
+ *
+ * PRD acceptance criteria tested here:
+ * - §9.5: First-run shows onboarding UI (not the main editor)
+ * - §9.5: "Import from cookie editor" CTA is visible
+ * - §9.5: "Export current login to Playwright" CTA is visible
+ * - §9.5: No signup is required to proceed
+ * - §10 flow 1: import JSON → cookies appear → edit as before (< 30 s)
+ *
+ * Left to unit tests:
+ * - JSON parsing correctness for specific cookie-editor formats
+ * - Individual cookie field mapping
+ */
+
+import { test, expect } from './fixtures/extension';
+
+test.describe('Onboarding — first-run flow (§9.5 / §10 flow 1)', () => {
+ test('side panel shows onboarding view on first run, not the main editor', async ({
+ openSidePanel,
+ }) => {
+ // On first run (no profiles, no settings) the extension must present the
+ // onboarding / welcome screen, not dump the user straight into the editor.
+ const panel = await openSidePanel();
+
+ // The onboarding container must be present.
+ const onboarding = panel.getByTestId('onboarding-view');
+ await expect(onboarding).toBeVisible({ timeout: 10_000 });
+
+ // The main profiles / cookie-editor view must NOT be the initial focus.
+ // It may be present in the DOM but should not be the active/first view.
+ const mainEditor = panel.getByTestId('cookie-editor-view');
+ await expect(mainEditor).not.toBeVisible();
+ });
+
+ test('onboarding shows "Import from cookie editor" CTA', async ({ openSidePanel }) => {
+ const panel = await openSidePanel();
+ const importCta = panel.getByRole('button', { name: /import from cookie editor/i });
+ await expect(importCta).toBeVisible({ timeout: 10_000 });
+ });
+
+ test('onboarding shows "Export current login to Playwright" CTA', async ({ openSidePanel }) => {
+ const panel = await openSidePanel();
+ const exportCta = panel.getByRole('button', { name: /export.*playwright/i });
+ await expect(exportCta).toBeVisible({ timeout: 10_000 });
+ });
+
+ test('no sign-up prompt or modal blocks the onboarding flow', async ({ openSidePanel }) => {
+ const panel = await openSidePanel();
+ // There must be no sign-in / create account dialog visible at first run.
+ const signupModal = panel.getByRole('dialog', { name: /sign.?up|create account|log in/i });
+ await expect(signupModal).not.toBeVisible({ timeout: 5_000 });
+ });
+
+ test('replacement import flow — JSON import populates cookie list (§10 flow 1)', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ // Navigate to the demo app first so there is an active tab for the extension
+ // to work with.
+ const demoPage = await context.newPage();
+ await demoPage.goto(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel();
+
+ // Click the import CTA.
+ const importCta = panel.getByRole('button', { name: /import from cookie editor/i });
+ await importCta.click();
+
+ // A file chooser or text-area should appear for pasting / uploading JSON.
+ // We simulate pasting an EditThisCookie-compatible JSON payload.
+ const cookieJson = JSON.stringify([
+ {
+ name: 'imported_session',
+ value: 'abc123',
+ domain: 'localhost',
+ path: '/',
+ secure: false,
+ httpOnly: false,
+ expirationDate: Math.floor(Date.now() / 1000) + 3600,
+ sameSite: 'Lax',
+ },
+ ]);
+
+ // Try locating a textarea for JSON paste; file-picker path is also valid.
+ const jsonInput = panel.getByRole('textbox', { name: /paste|json/i });
+ await jsonInput.fill(cookieJson);
+
+ const confirmBtn = panel.getByRole('button', { name: /import|confirm/i });
+ await confirmBtn.click();
+
+ // After import the cookie list should show the imported cookie.
+ const cookieRow = panel.getByText('imported_session');
+ await expect(cookieRow).toBeVisible({ timeout: 10_000 });
+ });
+
+ test('empty-state copy addresses replacement users without overclaiming (§9.5)', async ({
+ openSidePanel,
+ }) => {
+ const panel = await openSidePanel();
+ // PRD mandates copy like "Coming from EditThisCookie or another cookie editor?"
+ const copy = panel.getByText(/coming from editthiscookie/i);
+ await expect(copy).toBeVisible({ timeout: 10_000 });
+ });
+});
diff --git a/e2e/permission.spec.ts b/e2e/permission.spec.ts
new file mode 100644
index 0000000..1470e59
--- /dev/null
+++ b/e2e/permission.spec.ts
@@ -0,0 +1,191 @@
+/**
+ * permission.spec.ts
+ *
+ * Covers PRD §9.6 (Permission UX) and §10 UX flow 2 (Site permission).
+ *
+ * These tests are RED until the extension features are implemented.
+ *
+ * PRD acceptance criteria tested here:
+ * - §9.6: Acting on a site triggers a per-origin grant prompt (not silent)
+ * - §9.6: Granted origins are stored and shown in "Site access" settings
+ * - §9.6: User can revoke a previously granted origin
+ * - §9.6: Declining permission shows a graceful explanation, not an error
+ * - §9.6: Extension remains usable for already-granted sites after a decline
+ * - Extension manifest has no at install time (§14.1)
+ *
+ * Left to unit tests:
+ * - permissionService internal grant/revoke logic
+ * - chrome.permissions.request mocking
+ * - Persistence of granted-origins list in storage
+ */
+
+import { test, expect } from './fixtures/extension';
+
+test.describe('Permission UX — per-origin grant flow (§9.6 / §10 flow 2)', () => {
+ test('manifest has no install-time host_permissions', async ({ context }) => {
+ // Open the extension details page and check the manifest loaded into the
+ // extension's background service worker. We cannot easily read the manifest
+ // file from inside a test, but we can verify via the extensions management
+ // page that no broad host permission was requested at install.
+ //
+ // The authoritative check is the built manifest.json in .output/chrome-mv3/.
+ // We perform a runtime check here by verifying the extension does NOT have
+ // access to an arbitrary site without a grant.
+
+ // Create a new page navigated to a site that was never granted.
+ const page = await context.newPage();
+ await page.goto('about:blank');
+
+ // If the extension had , it could access this page's cookies
+ // immediately. We verify it does NOT by checking that the extension's
+ // cookie-capture trigger fails gracefully.
+ //
+ // In practice this assertion will be more nuanced once the extension is
+ // implemented; for now we ensure the page loads without the extension
+ // injecting unexpected scripts.
+ const injectedMarker = await page.evaluate(() =>
+ document.documentElement.getAttribute('data-sessionist-injected'),
+ );
+ expect(injectedMarker).toBeNull();
+ });
+
+ test('clicking "Capture session" on an ungranted site shows permission prompt', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ // Navigate to the demo app (a site the extension has not been granted).
+ const demoPage = await context.newPage();
+ await demoPage.goto(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(demoPage);
+
+ // The capture button should be visible.
+ const captureBtn = panel.getByRole('button', { name: /capture session/i });
+ await captureBtn.click();
+
+ // Sessionist must show a permission-request UI — either:
+ // (a) a dialog/modal explaining what access is needed, or
+ // (b) the browser's native permission dialog (cannot assert from Playwright
+ // in MV3 unless we grant it programmatically).
+ //
+ // We assert on the in-extension permission step (option a):
+ const permissionStep = panel.getByTestId('permission-prompt');
+ await expect(permissionStep).toBeVisible({ timeout: 10_000 });
+
+ // The prompt must explain what access is for.
+ const promptText = panel.getByText(/allow sessionist/i);
+ await expect(promptText).toBeVisible();
+
+ // Domain/origin must be shown explicitly.
+ const originText = panel.getByText(/localhost/i);
+ await expect(originText).toBeVisible();
+ });
+
+ test('granted origin appears in Site Access settings list', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const demoPage = await context.newPage();
+ await demoPage.goto(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(demoPage);
+
+ // Grant access (simulate the user accepting the permission prompt).
+ const captureBtn = panel.getByRole('button', { name: /capture session/i });
+ await captureBtn.click();
+
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ await grantBtn.click();
+
+ // Navigate to site-access settings.
+ const settingsBtn = panel.getByRole('button', { name: /settings|site access/i });
+ await settingsBtn.click();
+
+ const siteAccessView = panel.getByTestId('site-access-view');
+ await expect(siteAccessView).toBeVisible({ timeout: 10_000 });
+
+ // The granted origin must appear in the list.
+ const grantedOrigin = siteAccessView.getByText(/localhost/i);
+ await expect(grantedOrigin).toBeVisible();
+ });
+
+ test('user can revoke a previously granted origin', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const demoPage = await context.newPage();
+ await demoPage.goto(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(demoPage);
+
+ // Grant access.
+ const captureBtn = panel.getByRole('button', { name: /capture session/i });
+ await captureBtn.click();
+ const grantBtn = panel.getByRole('button', { name: /grant|allow/i });
+ await grantBtn.click();
+
+ // Go to site access settings and revoke.
+ const settingsBtn = panel.getByRole('button', { name: /settings|site access/i });
+ await settingsBtn.click();
+
+ const siteAccessView = panel.getByTestId('site-access-view');
+ const revokeBtn = siteAccessView.getByRole('button', { name: /revoke|remove/i }).first();
+ await revokeBtn.click();
+
+ // After revoke, the origin should no longer appear in the list.
+ const grantedOrigin = siteAccessView.getByText(/localhost/i);
+ await expect(grantedOrigin).not.toBeVisible({ timeout: 5_000 });
+ });
+
+ test('declining permission shows graceful explanation, not an error', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ const demoPage = await context.newPage();
+ await demoPage.goto(`${demoOrigin}/cookie-session`);
+
+ const panel = await openSidePanel(demoPage);
+
+ const captureBtn = panel.getByRole('button', { name: /capture session/i });
+ await captureBtn.click();
+
+ // Decline the permission.
+ const declineBtn = panel.getByRole('button', { name: /cancel|deny|decline/i });
+ await declineBtn.click();
+
+ // Must show an explanation, not a thrown error or blank screen.
+ const explanation = panel.getByTestId('permission-declined-notice');
+ await expect(explanation).toBeVisible({ timeout: 10_000 });
+
+ // The extension UI must still be usable (no crash / white screen).
+ await expect(
+ panel.getByTestId('onboarding-view').or(panel.getByTestId('cookie-editor-view')),
+ ).toBeVisible();
+ });
+
+ test('extension remains usable for already-granted sites after a new-site decline', async ({
+ context,
+ openSidePanel,
+ demoOrigin,
+ }) => {
+ // First grant localhost.
+ const page1 = await context.newPage();
+ await page1.goto(`${demoOrigin}/cookie-session`);
+ const panel = await openSidePanel(page1);
+ const captureBtn = panel.getByRole('button', { name: /capture session/i });
+ await captureBtn.click();
+ await panel.getByRole('button', { name: /grant|allow/i }).click();
+
+ // Now navigate to a different origin (simulate by using a different path that
+ // the extension treats as a different origin — or simply close and reopen).
+ // For the test, we assert the panel still shows the granted site data.
+ const siteSection = panel
+ .getByTestId('site-access-view')
+ .or(panel.getByTestId('profiles-view'));
+ await expect(siteSection).toBeVisible({ timeout: 10_000 });
+ });
+});
diff --git a/e2e/playwright-export.spec.ts b/e2e/playwright-export.spec.ts
new file mode 100644
index 0000000..0a2cd19
--- /dev/null
+++ b/e2e/playwright-export.spec.ts
@@ -0,0 +1,369 @@
+/**
+ * playwright-export.spec.ts
+ *
+ * Covers PRD §9.3 (Playwright export — MVP) and §13.7 (Playwright export
+ * implementation), specifically the §13.7 acceptance criterion:
+ *
+ * "E2E tests should verify that generated state authenticates against a
+ * controlled demo app."
+ *
+ * And §9.3 acceptance:
+ *
+ * "A generated Playwright storageState file can be used by a Playwright test
+ * fixture to authenticate against the same app without manually re-running
+ * the login flow, assuming that app's auth state is represented by supported
+ * exported stores."
+ *
+ * CAPSTONE TEST: playwright-export.spec.ts is the §13.7 storageState round-
+ * trip test. It:
+ * 1. Logs into the demo app and captures a profile.
+ * 2. Exports the profile as storageState JSON via the extension UI.
+ * 3. Writes the JSON to a temp file.
+ * 4. Opens a brand-new Playwright context using storageState: .
+ * 5. Navigates to the demo app and asserts it shows "logged in" WITHOUT any
+ * login interaction — the storageState alone provides authentication.
+ *
+ * These tests are RED until the extension features are implemented.
+ *
+ * Left to unit tests:
+ * - playwrightExport.ts field mapping / validation
+ * - Cookie-to-Playwright-cookie-shape conversion
+ * - localStorage origins array construction
+ */
+
+import path from 'path';
+import fs from 'fs/promises';
+import os from 'os';
+import { test, expect, DEMO_ORIGIN } from './fixtures/extension';
+import { chromium } from '@playwright/test';
+
+// ────────────────────────────────────────────────────────────────────────────
+// Helpers
+// ────────────────────────────────────────────────────────────────────────────
+
+/** Extract the storageState JSON text from the export view. */
+async function getStorageStateJson(panel: import('@playwright/test').Page): Promise {
+ const exportView = panel.getByTestId('export-view');
+ await expect(exportView).toBeVisible({ timeout: 10_000 });
+
+ // The JSON may be shown in a /